mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
update: types,packages,lua (2 files)
This commit is contained in:
115
packages/stats_grid/seed/scripts/types.lua
Normal file
115
packages/stats_grid/seed/scripts/types.lua
Normal file
@@ -0,0 +1,115 @@
|
||||
-- Type definitions for stats_grid package
|
||||
-- Central types file consolidating all module types
|
||||
-- @meta
|
||||
|
||||
-- Re-export module types
|
||||
local stats_types = require("stats.types")
|
||||
|
||||
---@alias StatColor "white"|"red"|"yellow"|"blue"|"green"|"orange"|"purple"|"gray"|"primary"|"secondary"|"success"|"warning"|"error"|"info"
|
||||
|
||||
---@alias FormatType "number"|"currency"|"percentage"|"compact"|"duration"|"bytes"|"custom"
|
||||
|
||||
---@alias TrendDirection "up"|"down"|"flat"
|
||||
|
||||
---@class StatValue
|
||||
---@field current number|string Current value
|
||||
---@field previous? number Previous value for comparison
|
||||
---@field target? number Target/goal value
|
||||
---@field min? number Minimum value for range
|
||||
---@field max? number Maximum value for range
|
||||
|
||||
---@class StatTrend
|
||||
---@field direction TrendDirection Trend direction
|
||||
---@field value number Change value
|
||||
---@field percentage number Change percentage
|
||||
---@field period string Comparison period (e.g., "day", "week", "month")
|
||||
|
||||
---@class StatItem
|
||||
---@field id string Unique stat identifier
|
||||
---@field key string Data key
|
||||
---@field label string Display label
|
||||
---@field value StatValue|number Stat value
|
||||
---@field color? StatColor Card color
|
||||
---@field icon? string Icon name from fakemui icons
|
||||
---@field trend? StatTrend Trend information
|
||||
---@field format? FormatType Value format type
|
||||
---@field formatOptions? FormatOptions Format configuration
|
||||
---@field href? string Link when clicked
|
||||
---@field tooltip? string Hover tooltip
|
||||
---@field loading? boolean Loading state
|
||||
---@field error? string Error message
|
||||
---@field sparkline? number[] Mini chart data points
|
||||
|
||||
---@class FormatOptions
|
||||
---@field locale? string Locale for formatting (e.g., "en-US")
|
||||
---@field currency? string Currency code (e.g., "USD")
|
||||
---@field precision? number Decimal places
|
||||
---@field prefix? string Value prefix
|
||||
---@field suffix? string Value suffix
|
||||
---@field compact? boolean Use compact notation
|
||||
---@field custom? fun(value: number): string Custom format function
|
||||
|
||||
---@class GridLayout
|
||||
---@field columns number Number of columns (1-6)
|
||||
---@field gap? number Gap between cards in pixels
|
||||
---@field responsive? ResponsiveLayout Responsive breakpoints
|
||||
|
||||
---@class ResponsiveLayout
|
||||
---@field xs? number Columns at xs breakpoint
|
||||
---@field sm? number Columns at sm breakpoint
|
||||
---@field md? number Columns at md breakpoint
|
||||
---@field lg? number Columns at lg breakpoint
|
||||
---@field xl? number Columns at xl breakpoint
|
||||
|
||||
---@class StatCardStyle
|
||||
---@field variant? "default"|"outlined"|"elevated" Card variant
|
||||
---@field size? "small"|"medium"|"large" Card size
|
||||
---@field showIcon? boolean Show icon
|
||||
---@field showTrend? boolean Show trend indicator
|
||||
---@field showSparkline? boolean Show sparkline chart
|
||||
---@field iconPosition? "left"|"right"|"top" Icon position
|
||||
---@field valuePosition? "left"|"center"|"right" Value alignment
|
||||
|
||||
---@class StatsGridConfig
|
||||
---@field id string Grid identifier
|
||||
---@field title? string Grid title
|
||||
---@field description? string Grid description
|
||||
---@field stats StatItem[] Stats to display
|
||||
---@field layout? GridLayout Layout configuration
|
||||
---@field style? StatCardStyle Card style configuration
|
||||
---@field refreshInterval? number Auto-refresh interval in seconds
|
||||
---@field emptyMessage? string Message when no stats
|
||||
---@field loading? boolean Overall loading state
|
||||
|
||||
---@class StatsData
|
||||
---@field [string] number|StatValue Raw stats data
|
||||
|
||||
---@class StatConfig
|
||||
---@field key string Data key to match
|
||||
---@field label string Display label
|
||||
---@field color? StatColor Card color
|
||||
---@field icon? string Icon name
|
||||
---@field format? FormatType Value format
|
||||
---@field priority? number Display order priority
|
||||
|
||||
---@class StatsGridProps
|
||||
---@field stats StatsData Stats data object
|
||||
---@field config? StatConfig[] Configuration per stat
|
||||
---@field layout? GridLayout Layout configuration
|
||||
---@field style? StatCardStyle Card style
|
||||
---@field className? string Additional CSS class
|
||||
---@field onStatClick? fun(stat: StatItem): void Stat click handler
|
||||
---@field onRefresh? fun(): void Refresh callback
|
||||
|
||||
---@class GridConfig
|
||||
---@field defaultGridClass string Default grid CSS class
|
||||
---@field defaultCardClass string Default card CSS class
|
||||
---@field colorClasses table<StatColor, string> Color to CSS class mapping
|
||||
|
||||
---@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 {}
|
||||
150
packages/workflow_editor/seed/scripts/types.lua
Normal file
150
packages/workflow_editor/seed/scripts/types.lua
Normal file
@@ -0,0 +1,150 @@
|
||||
-- Type definitions for workflow_editor package
|
||||
-- Central types file for visual workflow editing
|
||||
-- @meta
|
||||
|
||||
-- Re-export module types
|
||||
local editor_types = require("editor.types")
|
||||
|
||||
---@alias NodeType "trigger"|"action"|"condition"|"loop"|"delay"|"parallel"|"end"|"custom"
|
||||
|
||||
---@alias ExecutionStatus "pending"|"running"|"completed"|"failed"|"skipped"|"cancelled"
|
||||
|
||||
---@alias TriggerType "manual"|"schedule"|"webhook"|"event"|"database"
|
||||
|
||||
---@class Position
|
||||
---@field x number X coordinate on canvas
|
||||
---@field y number Y coordinate on canvas
|
||||
|
||||
---@class NodeSize
|
||||
---@field width number Node width in pixels
|
||||
---@field height number Node height in pixels
|
||||
|
||||
---@class WorkflowNode
|
||||
---@field id string Unique node identifier
|
||||
---@field type NodeType Node type
|
||||
---@field name string Display name
|
||||
---@field description? string Node description
|
||||
---@field position Position Canvas position
|
||||
---@field size? NodeSize Optional custom size
|
||||
---@field config table<string, any> Node-specific configuration
|
||||
---@field inputs string[] Input port names
|
||||
---@field outputs string[] Output port names
|
||||
---@field disabled? boolean Whether node is disabled
|
||||
---@field validation? ValidationResult Last validation result
|
||||
|
||||
---@class TriggerNode : WorkflowNode
|
||||
---@field type "trigger"
|
||||
---@field triggerType TriggerType Type of trigger
|
||||
---@field schedule? string Cron expression for scheduled triggers
|
||||
---@field webhookUrl? string Webhook URL for webhook triggers
|
||||
---@field eventName? string Event name for event triggers
|
||||
|
||||
---@class ActionNode : WorkflowNode
|
||||
---@field type "action"
|
||||
---@field actionType string Type of action (e.g., "http", "email", "database")
|
||||
---@field retryCount? number Number of retries on failure
|
||||
---@field retryDelay? number Delay between retries in ms
|
||||
---@field timeout? number Timeout in ms
|
||||
|
||||
---@class ConditionNode : WorkflowNode
|
||||
---@field type "condition"
|
||||
---@field expression string Condition expression
|
||||
---@field trueOutput string Output for true condition
|
||||
---@field falseOutput string Output for false condition
|
||||
|
||||
---@class LoopNode : WorkflowNode
|
||||
---@field type "loop"
|
||||
---@field collection string Variable name containing items
|
||||
---@field itemVariable string Variable name for current item
|
||||
---@field maxIterations? number Maximum iterations
|
||||
|
||||
---@class Connection
|
||||
---@field id string Connection identifier
|
||||
---@field source string Source node ID
|
||||
---@field sourceOutput string Source output port
|
||||
---@field target string Target node ID
|
||||
---@field targetInput string Target input port
|
||||
---@field condition? string Optional condition expression
|
||||
---@field label? string Connection label
|
||||
|
||||
---@class Workflow
|
||||
---@field id string Workflow identifier
|
||||
---@field name string Workflow name
|
||||
---@field description? string Workflow description
|
||||
---@field version string Workflow version
|
||||
---@field nodes WorkflowNode[] Workflow nodes
|
||||
---@field connections Connection[] Node connections
|
||||
---@field variables table<string, any> Workflow variables
|
||||
---@field enabled boolean Whether workflow is enabled
|
||||
---@field createdAt number Creation timestamp
|
||||
---@field updatedAt number Last update timestamp
|
||||
|
||||
---@class WorkflowExecution
|
||||
---@field id string Execution identifier
|
||||
---@field workflowId string Workflow being executed
|
||||
---@field status ExecutionStatus Overall execution status
|
||||
---@field startedAt number Start timestamp
|
||||
---@field finishedAt? number Finish timestamp
|
||||
---@field nodeStates table<string, NodeExecutionState> State per node
|
||||
---@field variables table<string, any> Runtime variables
|
||||
---@field error? string Error message if failed
|
||||
---@field triggeredBy string What triggered this execution
|
||||
|
||||
---@class NodeExecutionState
|
||||
---@field nodeId string Node identifier
|
||||
---@field status ExecutionStatus Node execution status
|
||||
---@field startedAt? number Start timestamp
|
||||
---@field finishedAt? number Finish timestamp
|
||||
---@field input? table Input data
|
||||
---@field output? table Output data
|
||||
---@field error? string Error message if failed
|
||||
---@field attempts number Number of execution attempts
|
||||
|
||||
---@class WorkflowEditorConfig
|
||||
---@field workflow Workflow Workflow being edited
|
||||
---@field readonly? boolean Read-only mode
|
||||
---@field showMinimap? boolean Show minimap
|
||||
---@field showToolbar? boolean Show toolbar
|
||||
---@field snapToGrid? boolean Snap nodes to grid
|
||||
---@field gridSize? number Grid size in pixels
|
||||
---@field canvasWidth? number Canvas width
|
||||
---@field canvasHeight? number Canvas height
|
||||
---@field zoom? number Initial zoom level
|
||||
---@field onSave? fun(workflow: Workflow): void Save callback
|
||||
---@field onExecute? fun(workflow: Workflow): void Execute callback
|
||||
---@field onCancel? fun(): void Cancel callback
|
||||
|
||||
---@class WorkflowEditorState
|
||||
---@field workflow Workflow Current workflow state
|
||||
---@field selectedNodes string[] Selected node IDs
|
||||
---@field selectedConnection string|nil Selected connection ID
|
||||
---@field clipboard WorkflowNode[] Copied nodes
|
||||
---@field undoStack Workflow[] Undo history
|
||||
---@field redoStack Workflow[] Redo history
|
||||
---@field zoom number Current zoom level
|
||||
---@field pan Position Canvas pan offset
|
||||
---@field isDirty boolean Has unsaved changes
|
||||
|
||||
---@class ValidationResult
|
||||
---@field valid boolean Whether node is valid
|
||||
---@field errors string[] Validation errors
|
||||
---@field warnings string[] Validation warnings
|
||||
|
||||
---@class NodePalette
|
||||
---@field category string Category name
|
||||
---@field nodes NodeTemplate[] Available node templates
|
||||
|
||||
---@class NodeTemplate
|
||||
---@field type NodeType Node type
|
||||
---@field name string Display name
|
||||
---@field description string Template description
|
||||
---@field icon string Icon name
|
||||
---@field defaultConfig table Default configuration
|
||||
|
||||
---@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