diff --git a/packages/components/src/global.d.ts b/packages/components/src/global.d.ts new file mode 100644 index 000000000..1129a9ae4 --- /dev/null +++ b/packages/components/src/global.d.ts @@ -0,0 +1,27 @@ +/** + * ObjectUI + * Copyright (c) 2024-present ObjectStack Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// CSS Module declarations +declare module '*.css' { + const content: Record; + export default content; +} + +// Process environment for React components +declare namespace NodeJS { + interface ProcessEnv { + NODE_ENV: 'development' | 'production' | 'test'; + } +} + +// Global process for browser environments +declare const process: { + env: { + NODE_ENV: string; + }; +}; diff --git a/packages/components/src/ui/chart.tsx b/packages/components/src/ui/chart.tsx index cb53947de..f2df6688d 100644 --- a/packages/components/src/ui/chart.tsx +++ b/packages/components/src/ui/chart.tsx @@ -112,14 +112,20 @@ const ChartTooltip = RechartsPrimitive.Tooltip const ChartTooltipContent = React.forwardRef< HTMLDivElement, - React.ComponentProps & - React.ComponentProps<"div"> & { - hideLabel?: boolean - hideIndicator?: boolean - indicator?: "line" | "dot" | "dashed" - nameKey?: string - labelKey?: string - } + React.ComponentProps<"div"> & { + active?: boolean + payload?: any[] + label?: string + hideLabel?: boolean + hideIndicator?: boolean + indicator?: "line" | "dot" | "dashed" + nameKey?: string + labelKey?: string + labelFormatter?: (value: any, payload: any[]) => React.ReactNode + labelClassName?: string + formatter?: (value: any, name?: any, item?: any, index?: number, payload?: any) => React.ReactNode + color?: string + } >( ( { @@ -270,11 +276,12 @@ const ChartLegend = RechartsPrimitive.Legend const ChartLegendContent = React.forwardRef< HTMLDivElement, - React.ComponentProps<"div"> & - Pick & { - hideIcon?: boolean - nameKey?: string - } + React.ComponentProps<"div"> & { + payload?: any[] + verticalAlign?: "top" | "bottom" + hideIcon?: boolean + nameKey?: string + } >( ( { className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, diff --git a/packages/data-objectstack/package.json b/packages/data-objectstack/package.json index 8709ce3ce..74039b70d 100644 --- a/packages/data-objectstack/package.json +++ b/packages/data-objectstack/package.json @@ -20,8 +20,8 @@ "README.md" ], "scripts": { - "build": "tsup src/index.ts --format cjs,esm --dts", - "dev": "tsup src/index.ts --format cjs,esm --dts --watch", + "build": "tsup", + "dev": "tsup --watch", "clean": "rm -rf dist", "type-check": "tsc --noEmit", "test": "vitest run", diff --git a/packages/data-objectstack/tsconfig.json b/packages/data-objectstack/tsconfig.json index 039e0b4d1..93452da68 100644 --- a/packages/data-objectstack/tsconfig.json +++ b/packages/data-objectstack/tsconfig.json @@ -1,7 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "dist" + "outDir": "dist", + "composite": true, + "declaration": true, + "noEmit": false }, - "include": ["src"] + "include": ["src/**/*"], + "references": [ + { "path": "../types" }, + { "path": "../core" } + ] } diff --git a/packages/data-objectstack/tsup.config.ts b/packages/data-objectstack/tsup.config.ts new file mode 100644 index 000000000..ba0659e12 --- /dev/null +++ b/packages/data-objectstack/tsup.config.ts @@ -0,0 +1,26 @@ +/** + * ObjectUI + * Copyright (c) 2024-present ObjectStack Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + dts: { + compilerOptions: { + // Override composite to false for DTS generation + composite: false, + // Don't follow references during DTS build + skipLibCheck: true, + }, + }, + clean: true, + sourcemap: false, + skipNodeModulesBundle: true, + external: ['@object-ui/types', '@object-ui/core', '@objectstack/client'], +}); diff --git a/packages/plugin-chatbot/src/useObjectChat.ts b/packages/plugin-chatbot/src/useObjectChat.ts index 6a1ad1361..ecc17fb22 100644 --- a/packages/plugin-chatbot/src/useObjectChat.ts +++ b/packages/plugin-chatbot/src/useObjectChat.ts @@ -189,7 +189,7 @@ export function useObjectChat(options: UseObjectChatOptions = {}): UseObjectChat } : undefined, maxToolRoundtrips: isApiMode ? maxToolRoundtrips : undefined, onError: isApiMode ? (err: Error) => { onError?.(err); } : undefined, - }); + } as any); // --- Local/legacy mode state --- const [localMessages, setLocalMessages] = useState( diff --git a/packages/plugin-dashboard/src/global.d.ts b/packages/plugin-dashboard/src/global.d.ts new file mode 100644 index 000000000..c8d698fb7 --- /dev/null +++ b/packages/plugin-dashboard/src/global.d.ts @@ -0,0 +1,5 @@ +// CSS Module declarations +declare module '*.css' { + const content: Record; + export default content; +} diff --git a/packages/plugin-kanban/src/ObjectKanban.tsx b/packages/plugin-kanban/src/ObjectKanban.tsx index a2de62fd5..b35a33cc0 100644 --- a/packages/plugin-kanban/src/ObjectKanban.tsx +++ b/packages/plugin-kanban/src/ObjectKanban.tsx @@ -34,7 +34,7 @@ export const ObjectKanban: React.FC = ({ loading: externalLoading, onRowClick, onCardClick, - ...props + ..._props }) => { // When a parent (e.g. ListView) pre-fetches data and passes it via the `data` prop, // we must not trigger a second fetch. Detect external data by checking if externalData diff --git a/packages/plugin-list/src/ListView.tsx b/packages/plugin-list/src/ListView.tsx index 91fa2517a..ccecf43bf 100644 --- a/packages/plugin-list/src/ListView.tsx +++ b/packages/plugin-list/src/ListView.tsx @@ -345,7 +345,7 @@ export const ListView = React.forwardRef(({ const [showSort, setShowSort] = React.useState(false); const [currentSort, setCurrentSort] = React.useState(() => { if (schema.sort && schema.sort.length > 0) { - return schema.sort.map(s => { + return schema.sort.map((s: any) => { // Support legacy string format "field desc" if (typeof s === 'string') { const parts = s.trim().split(/\s+/); @@ -376,7 +376,7 @@ export const ListView = React.forwardRef(({ // Tab State const [activeTab, setActiveTab] = React.useState(() => { if (!schema.tabs || schema.tabs.length === 0) return undefined; - const defaultTab = schema.tabs.find(t => t.isDefault); + const defaultTab = schema.tabs.find((t: any) => t.isDefault); return defaultTab?.name ?? schema.tabs[0]?.name; }); @@ -420,7 +420,7 @@ export const ListView = React.forwardRef(({ // subscribing to dataSource mutations to avoid double refreshes. React.useEffect(() => { if (!dataSource?.onMutation || !schema.objectName || schema.refreshTrigger) return; - const unsub = dataSource.onMutation((event) => { + const unsub = dataSource.onMutation((event: any) => { if (event.resource === schema.objectName) { setRefreshKey(k => k + 1); } @@ -449,7 +449,7 @@ export const ListView = React.forwardRef(({ // Quick Filters State const [activeQuickFilters, setActiveQuickFilters] = React.useState>(() => { const defaults = new Set(); - schema.quickFilters?.forEach(qf => { + schema.quickFilters?.forEach((qf: any) => { const normalized = normalizeQuickFilter(qf); if (normalized.defaultActive) defaults.add(normalized.id); }); @@ -724,7 +724,7 @@ export const ListView = React.forwardRef(({ const availableViews = React.useMemo(() => { // If appearance.allowedVisualizations is set, use it as whitelist if (schema.appearance?.allowedVisualizations && schema.appearance.allowedVisualizations.length > 0) { - return schema.appearance.allowedVisualizations.filter(v => + return schema.appearance.allowedVisualizations.filter((v: any) => ['grid', 'kanban', 'gallery', 'calendar', 'timeline', 'gantt', 'map'].includes(v) ) as ViewType[]; } @@ -833,12 +833,12 @@ export const ListView = React.forwardRef(({ // Apply field order if (schema.fieldOrder && schema.fieldOrder.length > 0) { - const orderMap = new Map(schema.fieldOrder.map((f, i) => [f, i])); + const orderMap = new Map(schema.fieldOrder.map((f: any, i: number) => [f, i])); fields = [...fields].sort((a: any, b: any) => { const nameA = typeof a === 'string' ? a : (a?.name || a?.fieldName || a?.field); const nameB = typeof b === 'string' ? b : (b?.name || b?.fieldName || b?.field); - const orderA = orderMap.get(nameA) ?? Infinity; - const orderB = orderMap.get(nameB) ?? Infinity; + const orderA: number = orderMap.get(nameA) ?? Infinity; + const orderB: number = orderMap.get(nameB) ?? Infinity; return orderA - orderB; }); } @@ -1176,7 +1176,7 @@ export const ListView = React.forwardRef(({ )}
- {allFields.map(field => ( + {allFields.map((field: any) => (
- {allFields.map(field => { - const isGrouped = groupingConfig?.fields?.some(f => f.field === field.name); + {allFields.map((field: any) => { + const isGrouped = groupingConfig?.fields?.some((f: any) => f.field === field.name); return (