@fluid-app/portal-core 0.1.16

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 (195) hide show
  1. package/dist/chunk-CKQMccvm.cjs +28 -0
  2. package/dist/data-sources/DataAwareWidget.cjs +50 -0
  3. package/dist/data-sources/DataAwareWidget.cjs.map +1 -0
  4. package/dist/data-sources/DataAwareWidget.d.cts +24 -0
  5. package/dist/data-sources/DataAwareWidget.d.cts.map +1 -0
  6. package/dist/data-sources/DataAwareWidget.d.mts +24 -0
  7. package/dist/data-sources/DataAwareWidget.d.mts.map +1 -0
  8. package/dist/data-sources/DataAwareWidget.mjs +48 -0
  9. package/dist/data-sources/DataAwareWidget.mjs.map +1 -0
  10. package/dist/data-sources/ErrorState.cjs +20 -0
  11. package/dist/data-sources/ErrorState.cjs.map +1 -0
  12. package/dist/data-sources/ErrorState.d.cts +7 -0
  13. package/dist/data-sources/ErrorState.d.cts.map +1 -0
  14. package/dist/data-sources/ErrorState.d.mts +7 -0
  15. package/dist/data-sources/ErrorState.d.mts.map +1 -0
  16. package/dist/data-sources/ErrorState.mjs +18 -0
  17. package/dist/data-sources/ErrorState.mjs.map +1 -0
  18. package/dist/data-sources/context.cjs +24 -0
  19. package/dist/data-sources/context.cjs.map +1 -0
  20. package/dist/data-sources/context.d.cts +21 -0
  21. package/dist/data-sources/context.d.cts.map +1 -0
  22. package/dist/data-sources/context.d.mts +21 -0
  23. package/dist/data-sources/context.d.mts.map +1 -0
  24. package/dist/data-sources/context.mjs +21 -0
  25. package/dist/data-sources/context.mjs.map +1 -0
  26. package/dist/data-sources/fetchers/api.cjs +65 -0
  27. package/dist/data-sources/fetchers/api.cjs.map +1 -0
  28. package/dist/data-sources/fetchers/api.d.cts +10 -0
  29. package/dist/data-sources/fetchers/api.d.cts.map +1 -0
  30. package/dist/data-sources/fetchers/api.d.mts +10 -0
  31. package/dist/data-sources/fetchers/api.d.mts.map +1 -0
  32. package/dist/data-sources/fetchers/api.mjs +64 -0
  33. package/dist/data-sources/fetchers/api.mjs.map +1 -0
  34. package/dist/data-sources/fetchers/custom.cjs +108 -0
  35. package/dist/data-sources/fetchers/custom.cjs.map +1 -0
  36. package/dist/data-sources/fetchers/custom.d.cts +17 -0
  37. package/dist/data-sources/fetchers/custom.d.cts.map +1 -0
  38. package/dist/data-sources/fetchers/custom.d.mts +17 -0
  39. package/dist/data-sources/fetchers/custom.d.mts.map +1 -0
  40. package/dist/data-sources/fetchers/custom.mjs +107 -0
  41. package/dist/data-sources/fetchers/custom.mjs.map +1 -0
  42. package/dist/data-sources/fetchers/static.cjs +161 -0
  43. package/dist/data-sources/fetchers/static.cjs.map +1 -0
  44. package/dist/data-sources/fetchers/static.d.cts +40 -0
  45. package/dist/data-sources/fetchers/static.d.cts.map +1 -0
  46. package/dist/data-sources/fetchers/static.d.mts +40 -0
  47. package/dist/data-sources/fetchers/static.d.mts.map +1 -0
  48. package/dist/data-sources/fetchers/static.mjs +158 -0
  49. package/dist/data-sources/fetchers/static.mjs.map +1 -0
  50. package/dist/data-sources/preview-context.cjs +21 -0
  51. package/dist/data-sources/preview-context.cjs.map +1 -0
  52. package/dist/data-sources/preview-context.d.cts +13 -0
  53. package/dist/data-sources/preview-context.d.cts.map +1 -0
  54. package/dist/data-sources/preview-context.d.mts +13 -0
  55. package/dist/data-sources/preview-context.d.mts.map +1 -0
  56. package/dist/data-sources/preview-context.mjs +18 -0
  57. package/dist/data-sources/preview-context.mjs.map +1 -0
  58. package/dist/data-sources/registry-context.cjs +53 -0
  59. package/dist/data-sources/registry-context.cjs.map +1 -0
  60. package/dist/data-sources/registry-context.d.cts +48 -0
  61. package/dist/data-sources/registry-context.d.cts.map +1 -0
  62. package/dist/data-sources/registry-context.d.mts +48 -0
  63. package/dist/data-sources/registry-context.d.mts.map +1 -0
  64. package/dist/data-sources/registry-context.mjs +49 -0
  65. package/dist/data-sources/registry-context.mjs.map +1 -0
  66. package/dist/data-sources/registry.cjs +31 -0
  67. package/dist/data-sources/registry.cjs.map +1 -0
  68. package/dist/data-sources/registry.d.cts +19 -0
  69. package/dist/data-sources/registry.d.cts.map +1 -0
  70. package/dist/data-sources/registry.d.mts +19 -0
  71. package/dist/data-sources/registry.d.mts.map +1 -0
  72. package/dist/data-sources/registry.mjs +29 -0
  73. package/dist/data-sources/registry.mjs.map +1 -0
  74. package/dist/data-sources/transformers.cjs +154 -0
  75. package/dist/data-sources/transformers.cjs.map +1 -0
  76. package/dist/data-sources/transformers.d.cts +10 -0
  77. package/dist/data-sources/transformers.d.cts.map +1 -0
  78. package/dist/data-sources/transformers.d.mts +10 -0
  79. package/dist/data-sources/transformers.d.mts.map +1 -0
  80. package/dist/data-sources/transformers.mjs +153 -0
  81. package/dist/data-sources/transformers.mjs.map +1 -0
  82. package/dist/data-sources/types.cjs +0 -0
  83. package/dist/data-sources/types.d.cts +2 -0
  84. package/dist/data-sources/types.d.mts +2 -0
  85. package/dist/data-sources/types.mjs +1 -0
  86. package/dist/data-sources/use-widget-data.cjs +111 -0
  87. package/dist/data-sources/use-widget-data.cjs.map +1 -0
  88. package/dist/data-sources/use-widget-data.d.cts +17 -0
  89. package/dist/data-sources/use-widget-data.d.cts.map +1 -0
  90. package/dist/data-sources/use-widget-data.d.mts +17 -0
  91. package/dist/data-sources/use-widget-data.d.mts.map +1 -0
  92. package/dist/data-sources/use-widget-data.mjs +109 -0
  93. package/dist/data-sources/use-widget-data.mjs.map +1 -0
  94. package/dist/index-B5cTNde-.d.cts +246 -0
  95. package/dist/index-B5cTNde-.d.cts.map +1 -0
  96. package/dist/index-Cqt2JzkQ.d.mts +246 -0
  97. package/dist/index-Cqt2JzkQ.d.mts.map +1 -0
  98. package/dist/registries/index.cjs +243 -0
  99. package/dist/registries/index.cjs.map +1 -0
  100. package/dist/registries/index.d.cts +338 -0
  101. package/dist/registries/index.d.cts.map +1 -0
  102. package/dist/registries/index.d.mts +338 -0
  103. package/dist/registries/index.d.mts.map +1 -0
  104. package/dist/registries/index.mjs +229 -0
  105. package/dist/registries/index.mjs.map +1 -0
  106. package/dist/shell/AppShellLayout.cjs +49 -0
  107. package/dist/shell/AppShellLayout.cjs.map +1 -0
  108. package/dist/shell/AppShellLayout.d.cts +39 -0
  109. package/dist/shell/AppShellLayout.d.cts.map +1 -0
  110. package/dist/shell/AppShellLayout.d.mts +39 -0
  111. package/dist/shell/AppShellLayout.d.mts.map +1 -0
  112. package/dist/shell/AppShellLayout.mjs +46 -0
  113. package/dist/shell/AppShellLayout.mjs.map +1 -0
  114. package/dist/shell/ScreenHeader.cjs +44 -0
  115. package/dist/shell/ScreenHeader.cjs.map +1 -0
  116. package/dist/shell/ScreenHeader.d.cts +12 -0
  117. package/dist/shell/ScreenHeader.d.cts.map +1 -0
  118. package/dist/shell/ScreenHeader.d.mts +12 -0
  119. package/dist/shell/ScreenHeader.d.mts.map +1 -0
  120. package/dist/shell/ScreenHeader.mjs +42 -0
  121. package/dist/shell/ScreenHeader.mjs.map +1 -0
  122. package/dist/shell/ScreenHeaderContext.cjs +91 -0
  123. package/dist/shell/ScreenHeaderContext.cjs.map +1 -0
  124. package/dist/shell/ScreenHeaderContext.d.cts +35 -0
  125. package/dist/shell/ScreenHeaderContext.d.cts.map +1 -0
  126. package/dist/shell/ScreenHeaderContext.d.mts +35 -0
  127. package/dist/shell/ScreenHeaderContext.d.mts.map +1 -0
  128. package/dist/shell/ScreenHeaderContext.mjs +86 -0
  129. package/dist/shell/ScreenHeaderContext.mjs.map +1 -0
  130. package/dist/shell/ThemeModeContext.cjs +70 -0
  131. package/dist/shell/ThemeModeContext.cjs.map +1 -0
  132. package/dist/shell/ThemeModeContext.d.cts +33 -0
  133. package/dist/shell/ThemeModeContext.d.cts.map +1 -0
  134. package/dist/shell/ThemeModeContext.d.mts +33 -0
  135. package/dist/shell/ThemeModeContext.d.mts.map +1 -0
  136. package/dist/shell/ThemeModeContext.mjs +66 -0
  137. package/dist/shell/ThemeModeContext.mjs.map +1 -0
  138. package/dist/shell/index.cjs +43 -0
  139. package/dist/shell/index.d.cts +7 -0
  140. package/dist/shell/index.d.mts +7 -0
  141. package/dist/shell/index.mjs +7 -0
  142. package/dist/shell/sidebar.cjs +390 -0
  143. package/dist/shell/sidebar.cjs.map +1 -0
  144. package/dist/shell/sidebar.d.cts +85 -0
  145. package/dist/shell/sidebar.d.cts.map +1 -0
  146. package/dist/shell/sidebar.d.mts +85 -0
  147. package/dist/shell/sidebar.d.mts.map +1 -0
  148. package/dist/shell/sidebar.mjs +364 -0
  149. package/dist/shell/sidebar.mjs.map +1 -0
  150. package/dist/shell/use-mobile.cjs +51 -0
  151. package/dist/shell/use-mobile.cjs.map +1 -0
  152. package/dist/shell/use-mobile.d.cts +7 -0
  153. package/dist/shell/use-mobile.d.cts.map +1 -0
  154. package/dist/shell/use-mobile.d.mts +7 -0
  155. package/dist/shell/use-mobile.d.mts.map +1 -0
  156. package/dist/shell/use-mobile.mjs +47 -0
  157. package/dist/shell/use-mobile.mjs.map +1 -0
  158. package/dist/theme/index.cjs +758 -0
  159. package/dist/theme/index.cjs.map +1 -0
  160. package/dist/theme/index.d.cts +131 -0
  161. package/dist/theme/index.d.cts.map +1 -0
  162. package/dist/theme/index.d.mts +131 -0
  163. package/dist/theme/index.d.mts.map +1 -0
  164. package/dist/theme/index.mjs +728 -0
  165. package/dist/theme/index.mjs.map +1 -0
  166. package/dist/types/index.cjs +18 -0
  167. package/dist/types/index.d.cts +4 -0
  168. package/dist/types/index.d.mts +4 -0
  169. package/dist/types/index.mjs +2 -0
  170. package/dist/types-27AHMek-.d.cts +85 -0
  171. package/dist/types-27AHMek-.d.cts.map +1 -0
  172. package/dist/types-BXFX9bXp.cjs +303 -0
  173. package/dist/types-BXFX9bXp.cjs.map +1 -0
  174. package/dist/types-Bjmd7Fdx.mjs +208 -0
  175. package/dist/types-Bjmd7Fdx.mjs.map +1 -0
  176. package/dist/types-C5Zs5V3E.d.mts +155 -0
  177. package/dist/types-C5Zs5V3E.d.mts.map +1 -0
  178. package/dist/types-CeCPKvOv.d.mts +85 -0
  179. package/dist/types-CeCPKvOv.d.mts.map +1 -0
  180. package/dist/types-DrzvahW8.d.cts +155 -0
  181. package/dist/types-DrzvahW8.d.cts.map +1 -0
  182. package/dist/widget-schema-BKZgsNG7.d.mts +119 -0
  183. package/dist/widget-schema-BKZgsNG7.d.mts.map +1 -0
  184. package/dist/widget-schema-BSX2fVhW.d.cts +119 -0
  185. package/dist/widget-schema-BSX2fVhW.d.cts.map +1 -0
  186. package/dist/widget-utils/index.cjs +130 -0
  187. package/dist/widget-utils/index.cjs.map +1 -0
  188. package/dist/widget-utils/index.d.cts +47 -0
  189. package/dist/widget-utils/index.d.cts.map +1 -0
  190. package/dist/widget-utils/index.d.mts +47 -0
  191. package/dist/widget-utils/index.d.mts.map +1 -0
  192. package/dist/widget-utils/index.mjs +119 -0
  193. package/dist/widget-utils/index.mjs.map +1 -0
  194. package/package.json +200 -0
  195. package/src/styles/globals.css +1 -0
@@ -0,0 +1,109 @@
1
+ import { useDataSourceRegistryConfig } from "./registry-context.mjs";
2
+ import { useCallback, useRef } from "react";
3
+ import { useQueries } from "@tanstack/react-query";
4
+ //#region src/data-sources/use-widget-data.ts
5
+ /**
6
+ * Generates a unique key for a data source to use in query caching.
7
+ */
8
+ function getSourceKey(source) {
9
+ if (source.type === "api") {
10
+ const varsKey = source.variables ? `:${JSON.stringify(source.variables)}` : "";
11
+ return `${source.endpoint}${varsKey}`;
12
+ }
13
+ if (source.type === "custom") return `custom:${(source.selectedItems?.map((item) => {
14
+ return `${item.shareableType}:${item.id}`;
15
+ }) ?? []).join(",")}`;
16
+ if (source.type === "static") return `static:${source.staticType}:${source.selectedId}`;
17
+ return "unknown";
18
+ }
19
+ /**
20
+ * Resolves query results into widget props by mapping each source's result
21
+ * to its target props.
22
+ */
23
+ function resolvePropsFromQueries(queryResults, sources, errorConfig) {
24
+ if (sources.length === 0) return void 0;
25
+ if (queryResults.some((q) => q.isLoading && !q.data)) return void 0;
26
+ const hasError = !!queryResults.find((q) => q.error)?.error;
27
+ if (hasError && errorConfig?.fallback) return errorConfig.fallback;
28
+ if (hasError) return;
29
+ const resolvedProps = {};
30
+ for (const query of queryResults) {
31
+ if (!query.data) continue;
32
+ const { source, result } = query.data;
33
+ if (!source?.targetProps) continue;
34
+ if (result !== null && typeof result === "object" && !Array.isArray(result) && source.targetProps.length > 1) {
35
+ const resultObj = result;
36
+ for (const prop of source.targetProps) if (prop in resultObj) resolvedProps[prop] = resultObj[prop];
37
+ } else for (const prop of source.targetProps) resolvedProps[prop] = result;
38
+ }
39
+ return resolvedProps;
40
+ }
41
+ /**
42
+ * Hook that fetches and resolves data sources for a widget using React Query.
43
+ */
44
+ function useWidgetData(widget, options) {
45
+ const config = useDataSourceRegistryConfig();
46
+ const registry = options?.registry ?? config.registry;
47
+ const baseUrl = options?.baseUrl ?? config.baseUrl;
48
+ const getApiHeaders = config.getApiHeaders;
49
+ const variables = config.variables;
50
+ const sources = widget.dataSource?.sources ?? [];
51
+ const errorConfig = widget.dataSource?.error;
52
+ const widgetId = widget.id ?? "unknown";
53
+ const widgetType = widget.type;
54
+ const queryResultsRef = useRef([]);
55
+ const results = useQueries({ queries: sources.map((source) => ({
56
+ queryKey: [
57
+ "portal-widget-data",
58
+ getSourceKey(source),
59
+ baseUrl,
60
+ variables
61
+ ],
62
+ queryFn: async ({ signal }) => {
63
+ const context = {
64
+ widgetId,
65
+ widgetType,
66
+ signal,
67
+ baseUrl,
68
+ getApiHeaders,
69
+ variables
70
+ };
71
+ const fetcher = registry.fetchers[source.type];
72
+ if (!fetcher) throw new Error(`No fetcher registered for source type: ${source.type}`);
73
+ let result = await fetcher(source, context);
74
+ if (source.transform) {
75
+ const transformer = registry.transformers[source.transform];
76
+ if (transformer) result = transformer(result, source);
77
+ else console.warn(`Transform "${source.transform}" not found in registry`);
78
+ }
79
+ return {
80
+ source,
81
+ result
82
+ };
83
+ },
84
+ enabled: sources.length > 0,
85
+ retry: errorConfig?.retryCount ?? 0,
86
+ retryDelay: errorConfig?.retryDelay ?? 1e3,
87
+ refetchInterval: source.refreshInterval || false
88
+ })) });
89
+ queryResultsRef.current = results;
90
+ const isLoading = results.some((q) => q.isLoading);
91
+ const failedQuery = results.find((q) => q.error);
92
+ const error = failedQuery?.error instanceof Error ? failedQuery.error : failedQuery?.error ? new Error(String(failedQuery.error)) : null;
93
+ return {
94
+ data: resolvePropsFromQueries(results.map((q) => ({
95
+ data: q.data,
96
+ isLoading: q.isLoading,
97
+ error: q.error instanceof Error ? q.error : null
98
+ })), sources, errorConfig),
99
+ isLoading,
100
+ error,
101
+ refetch: useCallback(() => {
102
+ queryResultsRef.current.forEach((q) => q.refetch());
103
+ }, [])
104
+ };
105
+ }
106
+ //#endregion
107
+ export { useWidgetData };
108
+
109
+ //# sourceMappingURL=use-widget-data.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-widget-data.mjs","names":[],"sources":["../../src/data-sources/use-widget-data.ts"],"sourcesContent":["import { useQueries } from \"@tanstack/react-query\";\nimport { useCallback, useRef } from \"react\";\nimport type { WidgetSchema } from \"../types/widget-schema\";\nimport type {\n DataSourceRegistry,\n WidgetDataResult,\n DataSourceContext,\n DataSource,\n} from \"./types\";\nimport { useDataSourceRegistryConfig } from \"./registry-context\";\n\ninterface UseWidgetDataOptions {\n /** Override the default registry from context */\n registry?: DataSourceRegistry | undefined;\n /** Base URL for API calls (e.g., \"https://api.fluid.app/api\") */\n baseUrl?: string | undefined;\n}\n\n/** Result shape from a single source query */\ninterface SourceQueryResult {\n source: DataSource;\n result: unknown;\n}\n\n/**\n * Generates a unique key for a data source to use in query caching.\n */\nfunction getSourceKey(source: DataSource): string {\n if (source.type === \"api\") {\n const varsKey = source.variables\n ? `:${JSON.stringify(source.variables)}`\n : \"\";\n return `${source.endpoint}${varsKey}`;\n }\n if (source.type === \"custom\") {\n const itemKeys =\n source.selectedItems?.map((item) => {\n return `${item.shareableType}:${item.id}`;\n }) ?? [];\n return `custom:${itemKeys.join(\",\")}`;\n }\n if (source.type === \"static\") {\n return `static:${source.staticType}:${source.selectedId}`;\n }\n return \"unknown\";\n}\n\n/**\n * Resolves query results into widget props by mapping each source's result\n * to its target props.\n */\nfunction resolvePropsFromQueries<T>(\n queryResults: ReadonlyArray<{\n data?: SourceQueryResult | undefined;\n isLoading: boolean;\n error: Error | null;\n }>,\n sources: DataSource[],\n errorConfig?: { fallback?: unknown },\n): T | undefined {\n if (sources.length === 0) return undefined;\n if (queryResults.some((q) => q.isLoading && !q.data)) return undefined;\n\n const failedQuery = queryResults.find((q) => q.error);\n const hasError = !!failedQuery?.error;\n\n if (hasError && errorConfig?.fallback) {\n return errorConfig.fallback as T;\n }\n\n if (hasError) {\n return undefined;\n }\n\n const resolvedProps: Record<string, unknown> = {};\n\n for (const query of queryResults) {\n if (!query.data) continue;\n const { source, result } = query.data;\n\n // Sentry fix: FLUID-ADMIN-1DH — source or targetProps can be undefined from malformed widget config\n if (!source?.targetProps) continue;\n\n if (\n result !== null &&\n typeof result === \"object\" &&\n !Array.isArray(result) &&\n source.targetProps.length > 1\n ) {\n const resultObj = result as Record<string, unknown>;\n for (const prop of source.targetProps) {\n if (prop in resultObj) {\n resolvedProps[prop] = resultObj[prop];\n }\n }\n } else {\n for (const prop of source.targetProps) {\n resolvedProps[prop] = result;\n }\n }\n }\n\n return resolvedProps as T;\n}\n\n/**\n * Hook that fetches and resolves data sources for a widget using React Query.\n */\nexport function useWidgetData<T = Record<string, unknown>>(\n widget: WidgetSchema,\n options?: UseWidgetDataOptions,\n): WidgetDataResult<T> {\n const config = useDataSourceRegistryConfig();\n const registry = options?.registry ?? config.registry;\n const baseUrl = options?.baseUrl ?? config.baseUrl;\n const getApiHeaders = config.getApiHeaders;\n const variables = config.variables;\n\n const sources = widget.dataSource?.sources ?? [];\n const errorConfig = widget.dataSource?.error;\n const widgetId = widget.id ?? \"unknown\";\n const widgetType = widget.type;\n\n const queryResultsRef = useRef<Array<{ refetch: () => void }>>([]);\n\n const results = useQueries({\n queries: sources.map((source: DataSource) => ({\n queryKey: [\n \"portal-widget-data\",\n getSourceKey(source),\n baseUrl,\n variables,\n ] as const,\n queryFn: async ({\n signal,\n }: {\n signal: AbortSignal;\n }): Promise<SourceQueryResult> => {\n const context: DataSourceContext = {\n widgetId,\n widgetType,\n signal,\n baseUrl,\n getApiHeaders,\n variables,\n };\n\n const fetcher = registry.fetchers[source.type];\n if (!fetcher) {\n throw new Error(\n `No fetcher registered for source type: ${source.type}`,\n );\n }\n\n const rawData = await fetcher(source, context);\n\n // Apply transform\n let result = rawData;\n if (source.transform) {\n const transformer = registry.transformers[source.transform];\n if (transformer) {\n result = transformer(result, source);\n } else {\n console.warn(\n `Transform \"${source.transform}\" not found in registry`,\n );\n }\n }\n return { source, result };\n },\n enabled: sources.length > 0,\n retry: errorConfig?.retryCount ?? 0,\n retryDelay: errorConfig?.retryDelay ?? 1000,\n refetchInterval: source.refreshInterval || false,\n })),\n });\n\n // Update ref for refetch callback\n queryResultsRef.current = results;\n\n // Aggregate loading state\n const isLoading = results.some((q) => q.isLoading);\n\n // Get first error from any failed query\n const failedQuery = results.find((q) => q.error);\n const error =\n failedQuery?.error instanceof Error\n ? failedQuery.error\n : failedQuery?.error\n ? new Error(String(failedQuery.error))\n : null;\n\n // Resolve data from all queries\n const data = resolvePropsFromQueries<T>(\n results.map((q) => ({\n data: q.data as SourceQueryResult | undefined,\n isLoading: q.isLoading,\n error: q.error instanceof Error ? q.error : null,\n })),\n sources,\n errorConfig,\n );\n\n // Stable refetch callback using ref\n const refetch = useCallback(() => {\n queryResultsRef.current.forEach((q) => q.refetch());\n }, []);\n\n return {\n data,\n isLoading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;;;;AA2BA,SAAS,aAAa,QAA4B;AAChD,KAAI,OAAO,SAAS,OAAO;EACzB,MAAM,UAAU,OAAO,YACnB,IAAI,KAAK,UAAU,OAAO,UAAU,KACpC;AACJ,SAAO,GAAG,OAAO,WAAW;;AAE9B,KAAI,O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.cjs";
2
+ import { _ as ThemeDefinition } from "./types-27AHMek-.cjs";
3
+ import { components } from "@fluid-app/fluidos-api-client";
4
+
5
+ //#region src/types/navigation.d.ts
6
+ /** The API schema type — single source of truth for navigation item fields. */
7
+ type ApiNavigationItem = components["schemas"]["FluidOSNavigationItem"];
8
+ /**
9
+ * Strip `null` from a union type, converting `T | null` → `T`.
10
+ * Used to convert API's null convention to portal-core's undefined convention.
11
+ */
12
+ type StripNull<T> = Exclude<T, null>;
13
+ /**
14
+ * Navigation item in the sidebar/menu structure.
15
+ *
16
+ * Derived from `FluidOSNavigationItem` (the API schema) so field types
17
+ * track upstream changes. Differences from the API type:
18
+ * - `id` is optional (system/default items may not have one)
19
+ * - `label` is required (transforms default null to "Untitled")
20
+ * - `section` is a frontend-only extension (not in API)
21
+ * - Nullable fields use `undefined` instead of `null` (except `parent_id`)
22
+ */
23
+ interface NavigationItem {
24
+ /** Database-generated identifier — optional because system/default items may not have one */
25
+ readonly id?: ApiNavigationItem["id"];
26
+ /** URL slug for routing */
27
+ slug?: StripNull<ApiNavigationItem["slug"]>;
28
+ /** Display label — required; transforms default null API values to "Untitled" */
29
+ label: string;
30
+ /** Icon identifier (e.g., FontAwesome name) */
31
+ icon?: StripNull<ApiNavigationItem["icon"]>;
32
+ /** Section grouping for quick links (frontend-only, not in API) */
33
+ section?: string;
34
+ /** Associated screen ID */
35
+ screen_id?: StripNull<ApiNavigationItem["screen_id"]>;
36
+ /** Sort order */
37
+ position?: StripNull<ApiNavigationItem["position"]>;
38
+ /** Parent navigation item ID (null for root items) */
39
+ parent_id?: ApiNavigationItem["parent_id"];
40
+ /** Origin of this navigation item */
41
+ source?: ApiNavigationItem["source"];
42
+ /** Nested navigation items */
43
+ children: NavigationItem[];
44
+ }
45
+ /**
46
+ * Screen definition with its component tree
47
+ */
48
+ interface ScreenDefinition {
49
+ readonly id: number;
50
+ slug: string;
51
+ name: string;
52
+ component_tree: WidgetSchema[];
53
+ }
54
+ /**
55
+ * Navigation configuration for the portal
56
+ */
57
+ interface Navigation {
58
+ readonly definition_id: number;
59
+ readonly id: number;
60
+ name: string;
61
+ navigation_items: NavigationItem[];
62
+ screens: ScreenDefinition[];
63
+ }
64
+ /** A portal app profile — themes, navigation, and definition reference. */
65
+ interface RepAppProfile {
66
+ name: string;
67
+ themes: ThemeDefinition[];
68
+ activeThemeId?: string;
69
+ navigation: Navigation;
70
+ mobile_navigation?: Navigation;
71
+ definition_id: number;
72
+ }
73
+ /** Full portal app data returned by the fluidos API or builder preview. */
74
+ interface RepAppData {
75
+ definition_id: number;
76
+ published_version: number;
77
+ screens: ScreenDefinition[];
78
+ profile: RepAppProfile;
79
+ }
80
+ /** Wrapper for the `/fluid_os/definitions/active` API response. */
81
+ interface RepAppManifest {
82
+ manifest: RepAppData;
83
+ }
84
+ //#endregion
85
+ //#region src/types/shareable-item.d.ts
86
+ /**
87
+ * Base props for a shareable item.
88
+ * Uses structural typing to be compatible with various modal implementations.
89
+ * The index signature allows additional properties from consuming apps.
90
+ */
91
+ interface ShareableItem {
92
+ id: string | number;
93
+ title?: string | null;
94
+ image_url?: string | null;
95
+ imageUrl?: string | null;
96
+ kind?: string | null;
97
+ type?: string | null;
98
+ shareableType?: string | null;
99
+ share_link?: string | null;
100
+ videoUrl?: string;
101
+ price?: string | number | null;
102
+ display_price?: string | null;
103
+ [key: string]: unknown;
104
+ }
105
+ //#endregion
106
+ //#region src/types/field-types.d.ts
107
+ /**
108
+ * Color options constant - single source of truth for color values.
109
+ * Use COLOR_OPTIONS.primary instead of "primary" for type-safe comparisons.
110
+ */
111
+ declare const COLOR_OPTIONS: {
112
+ readonly background: "background";
113
+ readonly foreground: "foreground";
114
+ readonly primary: "primary";
115
+ readonly secondary: "secondary";
116
+ readonly accent: "accent";
117
+ readonly muted: "muted";
118
+ readonly destructive: "destructive";
119
+ };
120
+ /**
121
+ * Union type of all color options, derived from COLOR_OPTIONS constant.
122
+ * @see deriving-typeof-for-object-keys pattern
123
+ */
124
+ type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];
125
+ declare const FONT_SIZE_OPTIONS: {
126
+ readonly "2xl": "2xl";
127
+ readonly xl: "xl";
128
+ readonly lg: "lg";
129
+ readonly md: "md";
130
+ readonly sm: "sm";
131
+ readonly xs: "xs";
132
+ };
133
+ type FontSizeOptions = (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS];
134
+ declare const BORDER_RADIUS_OPTIONS: {
135
+ readonly none: "none";
136
+ readonly sm: "sm";
137
+ readonly md: "md";
138
+ readonly lg: "lg";
139
+ readonly xl: "xl";
140
+ readonly full: "full";
141
+ };
142
+ type BorderRadiusOptions = (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS];
143
+ /** Padding values - numeric, so we use a tuple for derivation */
144
+ declare const PADDING_VALUES: readonly [0, 2, 4, 6, 8, 10];
145
+ type PaddingOptions = (typeof PADDING_VALUES)[number];
146
+ declare const BUTTON_SIZE_OPTIONS: {
147
+ readonly sm: "sm";
148
+ readonly default: "default";
149
+ readonly lg: "lg";
150
+ readonly xl: "xl";
151
+ };
152
+ type ButtonSizeOptions = (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS];
153
+ declare const GAP_OPTIONS: {
154
+ readonly none: "none";
155
+ readonly xs: "xs";
156
+ readonly sm: "sm";
157
+ readonly md: "md";
158
+ readonly lg: "lg";
159
+ readonly xl: "xl";
160
+ };
161
+ type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS];
162
+ declare const VERTICAL_ALIGN_OPTIONS: {
163
+ readonly top: "top";
164
+ readonly center: "center";
165
+ readonly bottom: "bottom";
166
+ };
167
+ type VerticalAlign = (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS];
168
+ declare const HORIZONTAL_ALIGN_OPTIONS: {
169
+ readonly left: "left";
170
+ readonly center: "center";
171
+ readonly right: "right";
172
+ };
173
+ type HorizontalAlign = (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS];
174
+ type AlignOptions = {
175
+ vertical?: VerticalAlign;
176
+ horizontal?: HorizontalAlign;
177
+ };
178
+ declare const BACKGROUND_TYPES: {
179
+ readonly solid: "solid";
180
+ readonly image: "image";
181
+ };
182
+ type BackgroundType = (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES];
183
+ interface BackgroundValue {
184
+ type: BackgroundType;
185
+ color?: ColorOptions;
186
+ resource?: ShareableItem;
187
+ }
188
+ /**
189
+ * Section layout configuration - single source of truth for layout types.
190
+ * SectionLayoutType is derived from these keys to prevent drift.
191
+ */
192
+ declare const SECTION_LAYOUT_CONFIG: {
193
+ readonly "single-column": {
194
+ readonly columns: 1;
195
+ readonly widths: readonly ["1fr"];
196
+ readonly gridClasses: "";
197
+ };
198
+ readonly "2c-equal": {
199
+ readonly columns: 2;
200
+ readonly widths: readonly ["1fr", "1fr"];
201
+ readonly gridClasses: "@md:grid-cols-2";
202
+ };
203
+ readonly "2c-left-wider": {
204
+ readonly columns: 2;
205
+ readonly widths: readonly ["2fr", "1fr"];
206
+ readonly gridClasses: "@md:grid-cols-[2fr_1fr]";
207
+ };
208
+ readonly "2c-right-wider": {
209
+ readonly columns: 2;
210
+ readonly widths: readonly ["1fr", "2fr"];
211
+ readonly gridClasses: "@md:grid-cols-[1fr_2fr]";
212
+ };
213
+ readonly "2c-left-narrow": {
214
+ readonly columns: 2;
215
+ readonly widths: readonly ["1fr", "3fr"];
216
+ readonly gridClasses: "@md:grid-cols-[1fr_3fr]";
217
+ };
218
+ readonly "2c-right-narrow": {
219
+ readonly columns: 2;
220
+ readonly widths: readonly ["3fr", "1fr"];
221
+ readonly gridClasses: "@md:grid-cols-[3fr_1fr]";
222
+ };
223
+ readonly "3c-equal": {
224
+ readonly columns: 3;
225
+ readonly widths: readonly ["1fr", "1fr", "1fr"];
226
+ readonly gridClasses: "@md:grid-cols-3";
227
+ };
228
+ readonly "3c-middle-wider": {
229
+ readonly columns: 3;
230
+ readonly widths: readonly ["1fr", "2fr", "1fr"];
231
+ readonly gridClasses: "@md:grid-cols-[1fr_2fr_1fr]";
232
+ };
233
+ };
234
+ /**
235
+ * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys.
236
+ * @see deriving-typeof-for-object-keys pattern
237
+ */
238
+ type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG;
239
+ /** @deprecated Use SECTION_LAYOUT_CONFIG instead */
240
+ declare const sectionLayoutConfig: typeof SECTION_LAYOUT_CONFIG;
241
+ //#endregion
242
+ //#region src/types/index.d.ts
243
+ type StrictOmit<T, K extends keyof T> = Omit<T, K>;
244
+ //#endregion
245
+ export { RepAppProfile as A, VerticalAlign as C, NavigationItem as D, Navigation as E, RepAppData as O, VERTICAL_ALIGN_OPTIONS as S, ShareableItem as T, HorizontalAlign as _, BUTTON_SIZE_OPTIONS as a, SECTION_LAYOUT_CONFIG as b, BorderRadiusOptions as c, ColorOptions as d, FONT_SIZE_OPTIONS as f, HORIZONTAL_ALIGN_OPTIONS as g, GapOptions as h, BORDER_RADIUS_OPTIONS as i, ScreenDefinition as j, RepAppManifest as k, ButtonSizeOptions as l, GAP_OPTIONS as m, AlignOptions as n, BackgroundType as o, FontSizeOptions as p, BACKGROUND_TYPES as r, BackgroundValue as s, StrictOmit as t, COLOR_OPTIONS as u, PADDING_VALUES as v, sectionLayoutConfig as w, SectionLayoutType as x, PaddingOptions as y };
246
+ //# sourceMappingURL=index-B5cTNde-.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B5cTNde-.d.cts","names":[],"sources":["../src/types/navigation.ts","../src/types/shareable-item.ts","../src/types/field-types.ts","../src/types/index.ts"],"mappings":";;;;;;KAQK,iBAAA,GAAoB,UAAA;;;;;KAMpB,SAAA,MAAe,OAAA,CAAQ,CAAA;;;;;;;;;AAY5B;;UAAiB,cAAA;;WAEN,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ACA,WAAA;EAAA;EAAA,SAEF,eAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,gBAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,gBAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,iBAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,UAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;EAAA;EAAA,SAEF,iBAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;EAAA;AAAA;;;;;KAoDD,iBAAA,gBAAiC,qBAAA;;cAGhC,mBAAA,SAA4B,qBAAA;;;KCvK7B,UAAA,oBAA8B,CAAA,IAAK,IAAA,CAAK,CAAA,EAAG,CAAA"}
@@ -0,0 +1,246 @@
1
+ import { a as WidgetSchema } from "./widget-schema-BKZgsNG7.mjs";
2
+ import { _ as ThemeDefinition } from "./types-CeCPKvOv.mjs";
3
+ import { components } from "@fluid-app/fluidos-api-client";
4
+
5
+ //#region src/types/navigation.d.ts
6
+ /** The API schema type — single source of truth for navigation item fields. */
7
+ type ApiNavigationItem = components["schemas"]["FluidOSNavigationItem"];
8
+ /**
9
+ * Strip `null` from a union type, converting `T | null` → `T`.
10
+ * Used to convert API's null convention to portal-core's undefined convention.
11
+ */
12
+ type StripNull<T> = Exclude<T, null>;
13
+ /**
14
+ * Navigation item in the sidebar/menu structure.
15
+ *
16
+ * Derived from `FluidOSNavigationItem` (the API schema) so field types
17
+ * track upstream changes. Differences from the API type:
18
+ * - `id` is optional (system/default items may not have one)
19
+ * - `label` is required (transforms default null to "Untitled")
20
+ * - `section` is a frontend-only extension (not in API)
21
+ * - Nullable fields use `undefined` instead of `null` (except `parent_id`)
22
+ */
23
+ interface NavigationItem {
24
+ /** Database-generated identifier — optional because system/default items may not have one */
25
+ readonly id?: ApiNavigationItem["id"];
26
+ /** URL slug for routing */
27
+ slug?: StripNull<ApiNavigationItem["slug"]>;
28
+ /** Display label — required; transforms default null API values to "Untitled" */
29
+ label: string;
30
+ /** Icon identifier (e.g., FontAwesome name) */
31
+ icon?: StripNull<ApiNavigationItem["icon"]>;
32
+ /** Section grouping for quick links (frontend-only, not in API) */
33
+ section?: string;
34
+ /** Associated screen ID */
35
+ screen_id?: StripNull<ApiNavigationItem["screen_id"]>;
36
+ /** Sort order */
37
+ position?: StripNull<ApiNavigationItem["position"]>;
38
+ /** Parent navigation item ID (null for root items) */
39
+ parent_id?: ApiNavigationItem["parent_id"];
40
+ /** Origin of this navigation item */
41
+ source?: ApiNavigationItem["source"];
42
+ /** Nested navigation items */
43
+ children: NavigationItem[];
44
+ }
45
+ /**
46
+ * Screen definition with its component tree
47
+ */
48
+ interface ScreenDefinition {
49
+ readonly id: number;
50
+ slug: string;
51
+ name: string;
52
+ component_tree: WidgetSchema[];
53
+ }
54
+ /**
55
+ * Navigation configuration for the portal
56
+ */
57
+ interface Navigation {
58
+ readonly definition_id: number;
59
+ readonly id: number;
60
+ name: string;
61
+ navigation_items: NavigationItem[];
62
+ screens: ScreenDefinition[];
63
+ }
64
+ /** A portal app profile — themes, navigation, and definition reference. */
65
+ interface RepAppProfile {
66
+ name: string;
67
+ themes: ThemeDefinition[];
68
+ activeThemeId?: string;
69
+ navigation: Navigation;
70
+ mobile_navigation?: Navigation;
71
+ definition_id: number;
72
+ }
73
+ /** Full portal app data returned by the fluidos API or builder preview. */
74
+ interface RepAppData {
75
+ definition_id: number;
76
+ published_version: number;
77
+ screens: ScreenDefinition[];
78
+ profile: RepAppProfile;
79
+ }
80
+ /** Wrapper for the `/fluid_os/definitions/active` API response. */
81
+ interface RepAppManifest {
82
+ manifest: RepAppData;
83
+ }
84
+ //#endregion
85
+ //#region src/types/shareable-item.d.ts
86
+ /**
87
+ * Base props for a shareable item.
88
+ * Uses structural typing to be compatible with various modal implementations.
89
+ * The index signature allows additional properties from consuming apps.
90
+ */
91
+ interface ShareableItem {
92
+ id: string | number;
93
+ title?: string | null;
94
+ image_url?: string | null;
95
+ imageUrl?: string | null;
96
+ kind?: string | null;
97
+ type?: string | null;
98
+ shareableType?: string | null;
99
+ share_link?: string | null;
100
+ videoUrl?: string;
101
+ price?: string | number | null;
102
+ display_price?: string | null;
103
+ [key: string]: unknown;
104
+ }
105
+ //#endregion
106
+ //#region src/types/field-types.d.ts
107
+ /**
108
+ * Color options constant - single source of truth for color values.
109
+ * Use COLOR_OPTIONS.primary instead of "primary" for type-safe comparisons.
110
+ */
111
+ declare const COLOR_OPTIONS: {
112
+ readonly background: "background";
113
+ readonly foreground: "foreground";
114
+ readonly primary: "primary";
115
+ readonly secondary: "secondary";
116
+ readonly accent: "accent";
117
+ readonly muted: "muted";
118
+ readonly destructive: "destructive";
119
+ };
120
+ /**
121
+ * Union type of all color options, derived from COLOR_OPTIONS constant.
122
+ * @see deriving-typeof-for-object-keys pattern
123
+ */
124
+ type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];
125
+ declare const FONT_SIZE_OPTIONS: {
126
+ readonly "2xl": "2xl";
127
+ readonly xl: "xl";
128
+ readonly lg: "lg";
129
+ readonly md: "md";
130
+ readonly sm: "sm";
131
+ readonly xs: "xs";
132
+ };
133
+ type FontSizeOptions = (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS];
134
+ declare const BORDER_RADIUS_OPTIONS: {
135
+ readonly none: "none";
136
+ readonly sm: "sm";
137
+ readonly md: "md";
138
+ readonly lg: "lg";
139
+ readonly xl: "xl";
140
+ readonly full: "full";
141
+ };
142
+ type BorderRadiusOptions = (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS];
143
+ /** Padding values - numeric, so we use a tuple for derivation */
144
+ declare const PADDING_VALUES: readonly [0, 2, 4, 6, 8, 10];
145
+ type PaddingOptions = (typeof PADDING_VALUES)[number];
146
+ declare const BUTTON_SIZE_OPTIONS: {
147
+ readonly sm: "sm";
148
+ readonly default: "default";
149
+ readonly lg: "lg";
150
+ readonly xl: "xl";
151
+ };
152
+ type ButtonSizeOptions = (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS];
153
+ declare const GAP_OPTIONS: {
154
+ readonly none: "none";
155
+ readonly xs: "xs";
156
+ readonly sm: "sm";
157
+ readonly md: "md";
158
+ readonly lg: "lg";
159
+ readonly xl: "xl";
160
+ };
161
+ type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS];
162
+ declare const VERTICAL_ALIGN_OPTIONS: {
163
+ readonly top: "top";
164
+ readonly center: "center";
165
+ readonly bottom: "bottom";
166
+ };
167
+ type VerticalAlign = (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS];
168
+ declare const HORIZONTAL_ALIGN_OPTIONS: {
169
+ readonly left: "left";
170
+ readonly center: "center";
171
+ readonly right: "right";
172
+ };
173
+ type HorizontalAlign = (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS];
174
+ type AlignOptions = {
175
+ vertical?: VerticalAlign;
176
+ horizontal?: HorizontalAlign;
177
+ };
178
+ declare const BACKGROUND_TYPES: {
179
+ readonly solid: "solid";
180
+ readonly image: "image";
181
+ };
182
+ type BackgroundType = (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES];
183
+ interface BackgroundValue {
184
+ type: BackgroundType;
185
+ color?: ColorOptions;
186
+ resource?: ShareableItem;
187
+ }
188
+ /**
189
+ * Section layout configuration - single source of truth for layout types.
190
+ * SectionLayoutType is derived from these keys to prevent drift.
191
+ */
192
+ declare const SECTION_LAYOUT_CONFIG: {
193
+ readonly "single-column": {
194
+ readonly columns: 1;
195
+ readonly widths: readonly ["1fr"];
196
+ readonly gridClasses: "";
197
+ };
198
+ readonly "2c-equal": {
199
+ readonly columns: 2;
200
+ readonly widths: readonly ["1fr", "1fr"];
201
+ readonly gridClasses: "@md:grid-cols-2";
202
+ };
203
+ readonly "2c-left-wider": {
204
+ readonly columns: 2;
205
+ readonly widths: readonly ["2fr", "1fr"];
206
+ readonly gridClasses: "@md:grid-cols-[2fr_1fr]";
207
+ };
208
+ readonly "2c-right-wider": {
209
+ readonly columns: 2;
210
+ readonly widths: readonly ["1fr", "2fr"];
211
+ readonly gridClasses: "@md:grid-cols-[1fr_2fr]";
212
+ };
213
+ readonly "2c-left-narrow": {
214
+ readonly columns: 2;
215
+ readonly widths: readonly ["1fr", "3fr"];
216
+ readonly gridClasses: "@md:grid-cols-[1fr_3fr]";
217
+ };
218
+ readonly "2c-right-narrow": {
219
+ readonly columns: 2;
220
+ readonly widths: readonly ["3fr", "1fr"];
221
+ readonly gridClasses: "@md:grid-cols-[3fr_1fr]";
222
+ };
223
+ readonly "3c-equal": {
224
+ readonly columns: 3;
225
+ readonly widths: readonly ["1fr", "1fr", "1fr"];
226
+ readonly gridClasses: "@md:grid-cols-3";
227
+ };
228
+ readonly "3c-middle-wider": {
229
+ readonly columns: 3;
230
+ readonly widths: readonly ["1fr", "2fr", "1fr"];
231
+ readonly gridClasses: "@md:grid-cols-[1fr_2fr_1fr]";
232
+ };
233
+ };
234
+ /**
235
+ * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys.
236
+ * @see deriving-typeof-for-object-keys pattern
237
+ */
238
+ type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG;
239
+ /** @deprecated Use SECTION_LAYOUT_CONFIG instead */
240
+ declare const sectionLayoutConfig: typeof SECTION_LAYOUT_CONFIG;
241
+ //#endregion
242
+ //#region src/types/index.d.ts
243
+ type StrictOmit<T, K extends keyof T> = Omit<T, K>;
244
+ //#endregion
245
+ export { RepAppProfile as A, VerticalAlign as C, NavigationItem as D, Navigation as E, RepAppData as O, VERTICAL_ALIGN_OPTIONS as S, ShareableItem as T, HorizontalAlign as _, BUTTON_SIZE_OPTIONS as a, SECTION_LAYOUT_CONFIG as b, BorderRadiusOptions as c, ColorOptions as d, FONT_SIZE_OPTIONS as f, HORIZONTAL_ALIGN_OPTIONS as g, GapOptions as h, BORDER_RADIUS_OPTIONS as i, ScreenDefinition as j, RepAppManifest as k, ButtonSizeOptions as l, GAP_OPTIONS as m, AlignOptions as n, BackgroundType as o, FontSizeOptions as p, BACKGROUND_TYPES as r, BackgroundValue as s, StrictOmit as t, COLOR_OPTIONS as u, PADDING_VALUES as v, sectionLayoutConfig as w, SectionLayoutType as x, PaddingOptions as y };
246
+ //# sourceMappingURL=index-Cqt2JzkQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Cqt2JzkQ.d.mts","names":[],"sources":["../src/types/navigation.ts","../src/types/shareable-item.ts","../src/types/field-types.ts","../src/types/index.ts"],"mappings":";;;;;;KAQK,iBAAA,GAAoB,UAAA;;;;;KAMpB,SAAA,MAAe,OAAA,CAAQ,CAAA;;;;;;;;;AAY5B;;UAAiB,cAAA;;WAEN,EAAA,GAAK,iBAAA;;EAEd,IAAA,GAAO,SAAA,CAAU,iBAAA;;EAEjB,KAAA;;EAEA,IAAA,GAAO,SAAA,CAAU,iBAAA;;EAEjB,OAAA;;EAEA,SAAA,GAAY,SAAA,CAAU,iBAAA;;EAEtB,QAAA,GAAW,SAAA,CAAU,iBAAA;;EAErB,SAAA,GAAY,iBAAA;;EAEZ,MAAA,GAAS,iBAAA;;EAET,QAAA,EAAU,cAAA;AAAA;;;;UAMK,gBAAA;EAAA,SACN,EAAA;EACT,IAAA;EACA,IAAA;EACA,cAAA,EAAgB,YAAA;AAAA;;;;UAMD,UAAA;EAAA,SACN,aAAA;EAAA,SACA,EAAA;EACT,IAAA;EACA,gBAAA,EAAkB,cAAA;EAClB,OAAA,EAAS,gBAAA;AAAA;;UAQM,aAAA;EACf,IAAA;EACA,MAAA,EAAQ,eAAA;EACR,aAAA;EACA,U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