mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
update: types,packages,lua (3 files)
This commit is contained in:
129
packages/dashboard/seed/scripts/types.lua
Normal file
129
packages/dashboard/seed/scripts/types.lua
Normal file
@@ -0,0 +1,129 @@
|
||||
-- Type definitions for dashboard package
|
||||
-- Central types file consolidating all module types
|
||||
-- @meta
|
||||
|
||||
-- Re-export module types
|
||||
local stats_types = require("stats.types")
|
||||
local layout_types = require("layout.types")
|
||||
|
||||
---@alias TrendDirection "up"|"down"|"flat"
|
||||
|
||||
---@alias StatVariant "default"|"primary"|"success"|"warning"|"error"|"info"
|
||||
|
||||
---@alias ChartType "line"|"bar"|"area"|"pie"|"donut"|"gauge"
|
||||
|
||||
---@class StatValue
|
||||
---@field current number|string Current value
|
||||
---@field previous? number Previous value for comparison
|
||||
---@field change? number Percentage change
|
||||
---@field trend? TrendDirection Trend direction
|
||||
|
||||
---@class StatCardConfig
|
||||
---@field id string Unique stat identifier
|
||||
---@field label string Display label
|
||||
---@field value StatValue|number|string Stat value
|
||||
---@field icon? string Icon name from fakemui icons
|
||||
---@field variant? StatVariant Card color variant
|
||||
---@field format? "number"|"currency"|"percentage"|"compact" Value format
|
||||
---@field precision? number Decimal precision
|
||||
---@field prefix? string Value prefix (e.g., "$")
|
||||
---@field suffix? string Value suffix (e.g., "%")
|
||||
---@field href? string Link when clicked
|
||||
---@field loading? boolean Loading state
|
||||
---@field sparkline? number[] Mini chart data
|
||||
|
||||
---@class StatGridConfig
|
||||
---@field columns? number Number of columns (1-6)
|
||||
---@field gap? number Gap between cards
|
||||
---@field stats StatCardConfig[] Stats to display
|
||||
|
||||
---@class ChartDataPoint
|
||||
---@field x string|number X-axis value
|
||||
---@field y number Y-axis value
|
||||
---@field label? string Point label
|
||||
---@field color? string Point color
|
||||
|
||||
---@class ChartSeries
|
||||
---@field id string Series identifier
|
||||
---@field name string Series display name
|
||||
---@field data ChartDataPoint[] Series data points
|
||||
---@field color? string Series color
|
||||
---@field type? ChartType Override chart type for series
|
||||
|
||||
---@class ChartConfig
|
||||
---@field id string Chart identifier
|
||||
---@field title? string Chart title
|
||||
---@field type ChartType Chart type
|
||||
---@field series ChartSeries[] Chart data series
|
||||
---@field xAxis? AxisConfig X-axis configuration
|
||||
---@field yAxis? AxisConfig Y-axis configuration
|
||||
---@field legend? LegendConfig Legend configuration
|
||||
---@field tooltip? TooltipConfig Tooltip configuration
|
||||
---@field height? number Chart height in pixels
|
||||
---@field loading? boolean Loading state
|
||||
---@field animate? boolean Enable animations
|
||||
|
||||
---@class AxisConfig
|
||||
---@field label? string Axis label
|
||||
---@field min? number Minimum value
|
||||
---@field max? number Maximum value
|
||||
---@field format? string Value format
|
||||
---@field ticks? number Number of ticks
|
||||
---@field gridLines? boolean Show grid lines
|
||||
|
||||
---@class LegendConfig
|
||||
---@field show boolean Show legend
|
||||
---@field position "top"|"bottom"|"left"|"right" Legend position
|
||||
---@field align "start"|"center"|"end" Legend alignment
|
||||
|
||||
---@class TooltipConfig
|
||||
---@field show boolean Show tooltips
|
||||
---@field format? fun(value: number, series: string): string Custom format function
|
||||
|
||||
---@class DashboardWidget
|
||||
---@field id string Widget identifier
|
||||
---@field type "stats"|"chart"|"table"|"custom" Widget type
|
||||
---@field title? string Widget title
|
||||
---@field config StatGridConfig|ChartConfig|table Widget configuration
|
||||
---@field layout WidgetLayout Widget layout
|
||||
---@field refreshInterval? number Auto-refresh interval in seconds
|
||||
---@field loading? boolean Loading state
|
||||
---@field error? string Error message
|
||||
|
||||
---@class WidgetLayout
|
||||
---@field x number Grid column position
|
||||
---@field y number Grid row position
|
||||
---@field w number Width in grid units
|
||||
---@field h number Height in grid units
|
||||
---@field minW? number Minimum width
|
||||
---@field minH? number Minimum height
|
||||
---@field maxW? number Maximum width
|
||||
---@field maxH? number Maximum height
|
||||
---@field static? boolean Prevent dragging/resizing
|
||||
|
||||
---@class DashboardConfig
|
||||
---@field id string Dashboard identifier
|
||||
---@field title string Dashboard title
|
||||
---@field description? string Dashboard description
|
||||
---@field widgets DashboardWidget[] Dashboard widgets
|
||||
---@field columns number Grid columns
|
||||
---@field rowHeight number Grid row height
|
||||
---@field gap number Gap between widgets
|
||||
---@field editable? boolean Allow editing layout
|
||||
---@field refreshAll? number Global refresh interval
|
||||
|
||||
---@class DashboardState
|
||||
---@field config DashboardConfig Current configuration
|
||||
---@field editing boolean Edit mode active
|
||||
---@field selectedWidget string|nil Selected widget ID
|
||||
---@field loading table<string, boolean> Widget loading states
|
||||
---@field errors table<string, string> Widget error states
|
||||
---@field data table<string, any> Widget data cache
|
||||
|
||||
---@class UIComponent
|
||||
---@field type string Component type
|
||||
---@field props? table Component props
|
||||
---@field children? UIComponent[] Child components
|
||||
|
||||
-- Export all types (no runtime exports, types only)
|
||||
return {}
|
||||
113
packages/data_table/seed/scripts/types.lua
Normal file
113
packages/data_table/seed/scripts/types.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
-- Type definitions for data_table package
|
||||
-- Central types file consolidating all module types
|
||||
-- @meta
|
||||
|
||||
-- Re-export module types
|
||||
local filtering_types = require("filtering.types")
|
||||
local sorting_types = require("sorting.types")
|
||||
local selection_types = require("selection.types")
|
||||
|
||||
---@alias SortDirection "asc"|"desc"|nil
|
||||
|
||||
---@alias FilterOperator "equals"|"contains"|"startsWith"|"endsWith"|"gt"|"lt"|"gte"|"lte"|"between"|"in"|"notIn"|"isNull"|"isNotNull"
|
||||
|
||||
---@alias ColumnAlign "left"|"center"|"right"
|
||||
|
||||
---@alias ColumnType "string"|"number"|"boolean"|"date"|"datetime"|"currency"|"percentage"|"custom"
|
||||
|
||||
---@class ColumnDefinition
|
||||
---@field id string Unique column identifier
|
||||
---@field header string Column header text
|
||||
---@field accessor string|fun(row: table): any Data accessor (field name or function)
|
||||
---@field type ColumnType Column data type for formatting
|
||||
---@field width? number|string Column width (px or %)
|
||||
---@field minWidth? number Minimum column width
|
||||
---@field maxWidth? number Maximum column width
|
||||
---@field align? ColumnAlign Text alignment
|
||||
---@field sortable? boolean Whether column is sortable
|
||||
---@field filterable? boolean Whether column is filterable
|
||||
---@field resizable? boolean Whether column is resizable
|
||||
---@field hidden? boolean Whether column is hidden
|
||||
---@field pinned? "left"|"right"|nil Pin column to side
|
||||
---@field render? fun(value: any, row: table): UIComponent Custom render function
|
||||
---@field format? string Format string for type-based formatting
|
||||
---@field filterOperators? FilterOperator[] Available filter operators
|
||||
|
||||
---@class RowData
|
||||
---@field id string|number Unique row identifier
|
||||
---@field [string] any Row data fields
|
||||
|
||||
---@class Filter
|
||||
---@field columnId string Column identifier to filter
|
||||
---@field operator FilterOperator Filter operator
|
||||
---@field value any Filter value (single value or {min, max} for between)
|
||||
---@field active boolean Whether filter is active
|
||||
|
||||
---@class FilterState
|
||||
---@field filters Filter[] Active filters
|
||||
---@field globalSearch string Global search term
|
||||
|
||||
---@class SortConfig
|
||||
---@field columnId string Column to sort by
|
||||
---@field direction SortDirection Sort direction
|
||||
|
||||
---@class SelectionState
|
||||
---@field selectedIds table<string|number, boolean> Map of selected row IDs
|
||||
---@field selectAll boolean Whether all rows are selected
|
||||
---@field invertSelection boolean Whether selection is inverted
|
||||
|
||||
---@class PaginationState
|
||||
---@field page number Current page (1-indexed)
|
||||
---@field pageSize number Items per page
|
||||
---@field totalItems number Total number of items
|
||||
---@field totalPages number Total number of pages
|
||||
|
||||
---@class DataTableConfig
|
||||
---@field columns ColumnDefinition[] Table columns
|
||||
---@field data RowData[] Table data
|
||||
---@field sortable? boolean Enable sorting
|
||||
---@field filterable? boolean Enable filtering
|
||||
---@field selectable? boolean Enable row selection
|
||||
---@field paginated? boolean Enable pagination
|
||||
---@field pageSize? number Default page size
|
||||
---@field pageSizeOptions? number[] Available page sizes
|
||||
---@field loading? boolean Loading state
|
||||
---@field error? string Error message
|
||||
---@field emptyMessage? string Message when no data
|
||||
---@field stickyHeader? boolean Sticky header
|
||||
---@field virtualized? boolean Enable virtualization for large datasets
|
||||
---@field rowHeight? number Row height for virtualization
|
||||
---@field onRowClick? fun(row: RowData): void Row click handler
|
||||
---@field onSelectionChange? fun(selected: RowData[]): void Selection change handler
|
||||
---@field onSortChange? fun(sort: SortConfig): void Sort change handler
|
||||
---@field onFilterChange? fun(filters: FilterState): void Filter change handler
|
||||
---@field onPageChange? fun(pagination: PaginationState): void Page change handler
|
||||
|
||||
---@class ExportOptions
|
||||
---@field format "csv"|"json"|"xlsx" Export format
|
||||
---@field filename string Output filename
|
||||
---@field columns? string[] Columns to export (nil = all)
|
||||
---@field includeHeaders boolean Include column headers
|
||||
---@field selectedOnly boolean Export only selected rows
|
||||
|
||||
---@class ExportResult
|
||||
---@field success boolean Whether export succeeded
|
||||
---@field data string|nil Exported data string
|
||||
---@field error string|nil Error message
|
||||
|
||||
---@class DataTableState
|
||||
---@field data RowData[] Current data
|
||||
---@field filteredData RowData[] Data after filtering
|
||||
---@field displayData RowData[] Data for current page
|
||||
---@field sorting SortConfig|nil Current sort configuration
|
||||
---@field filters FilterState Filter state
|
||||
---@field selection SelectionState Selection state
|
||||
---@field pagination PaginationState Pagination state
|
||||
|
||||
---@class UIComponent
|
||||
---@field type string Component type
|
||||
---@field props? table Component props
|
||||
---@field children? UIComponent[] Child components
|
||||
|
||||
-- Export all types (no runtime exports, types only)
|
||||
return {}
|
||||
104
packages/nav_menu/seed/scripts/types.lua
Normal file
104
packages/nav_menu/seed/scripts/types.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
-- Type definitions for nav_menu package
|
||||
-- Central types file for navigation menu construction
|
||||
-- @meta
|
||||
|
||||
---@alias NavItemType "link"|"group"|"divider"|"header"|"custom"
|
||||
|
||||
---@alias BadgeVariant "default"|"primary"|"secondary"|"success"|"warning"|"error"|"info"
|
||||
|
||||
---@class NavBadge
|
||||
---@field text string|number Badge text or count
|
||||
---@field variant? BadgeVariant Badge color variant
|
||||
---@field max? number Max value before showing "99+"
|
||||
|
||||
---@class NavItemBase
|
||||
---@field id string Unique item identifier
|
||||
---@field type NavItemType Item type
|
||||
---@field visible? boolean Whether item is visible
|
||||
---@field disabled? boolean Whether item is disabled
|
||||
---@field minLevel? number Minimum permission level required
|
||||
|
||||
---@class NavLink : NavItemBase
|
||||
---@field type "link"
|
||||
---@field label string Display label
|
||||
---@field href string Navigation URL
|
||||
---@field icon? string Icon name from fakemui icons
|
||||
---@field badge? NavBadge Optional badge
|
||||
---@field external? boolean Open in new tab
|
||||
---@field active? boolean Whether link is active
|
||||
---@field exact? boolean Match exact path only
|
||||
|
||||
---@class NavGroup : NavItemBase
|
||||
---@field type "group"
|
||||
---@field label string Group label
|
||||
---@field icon? string Group icon
|
||||
---@field children NavItem[] Child items
|
||||
---@field collapsible? boolean Whether group can be collapsed
|
||||
---@field defaultOpen? boolean Default open state
|
||||
---@field badge? NavBadge Optional badge
|
||||
|
||||
---@class NavDivider : NavItemBase
|
||||
---@field type "divider"
|
||||
---@field label? string Optional divider label
|
||||
|
||||
---@class NavHeader : NavItemBase
|
||||
---@field type "header"
|
||||
---@field label string Header text
|
||||
---@field icon? string Header icon
|
||||
|
||||
---@alias NavItem NavLink|NavGroup|NavDivider|NavHeader
|
||||
|
||||
---@class NavMenuConfig
|
||||
---@field items NavItem[] Menu items
|
||||
---@field collapsed? boolean Sidebar collapsed state
|
||||
---@field collapsible? boolean Whether sidebar can collapse
|
||||
---@field width? number Sidebar width in pixels
|
||||
---@field collapsedWidth? number Collapsed sidebar width
|
||||
---@field position? "left"|"right" Sidebar position
|
||||
---@field sticky? boolean Sticky positioning
|
||||
---@field showLabels? boolean Show labels in collapsed state
|
||||
---@field theme? "light"|"dark"|"auto" Menu theme
|
||||
|
||||
---@class SidebarConfig
|
||||
---@field header? SidebarHeader Header configuration
|
||||
---@field footer? SidebarFooter Footer configuration
|
||||
---@field navigation NavMenuConfig Navigation configuration
|
||||
---@field user? UserInfo Current user info
|
||||
|
||||
---@class SidebarHeader
|
||||
---@field logo? string Logo URL or icon name
|
||||
---@field title? string Application title
|
||||
---@field subtitle? string Application subtitle
|
||||
---@field showInCollapsed? boolean Show in collapsed state
|
||||
|
||||
---@class SidebarFooter
|
||||
---@field items? NavItem[] Footer items
|
||||
---@field version? string App version
|
||||
---@field showInCollapsed? boolean Show in collapsed state
|
||||
|
||||
---@class UserInfo
|
||||
---@field id string|number User ID
|
||||
---@field name string User display name
|
||||
---@field email? string User email
|
||||
---@field avatar? string Avatar URL
|
||||
---@field role? string User role label
|
||||
---@field level number Permission level (0-6)
|
||||
|
||||
---@class NavMenuState
|
||||
---@field activeItem string|nil Currently active item ID
|
||||
---@field expandedGroups table<string, boolean> Expanded group IDs
|
||||
---@field collapsed boolean Sidebar collapsed state
|
||||
---@field hoveredItem string|nil Currently hovered item ID
|
||||
|
||||
---@class NavMenuCallbacks
|
||||
---@field onNavigate? fun(item: NavLink): void Navigation callback
|
||||
---@field onToggleCollapse? fun(collapsed: boolean): void Collapse toggle callback
|
||||
---@field onToggleGroup? fun(groupId: string, open: boolean): void Group toggle callback
|
||||
|
||||
---@class UIComponent
|
||||
---@field type string Component type
|
||||
---@field props? table Component props
|
||||
---@field children? UIComponent[] Child components
|
||||
|
||||
-- Export all types (no runtime exports, types only)
|
||||
return {}
|
||||
Reference in New Issue
Block a user