quantum-framework 0.9.0__py3-none-any.whl
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.
- quantum/__init__.py +1 -0
- quantum/cli/__init__.py +2 -0
- quantum/cli/commands/__init__.py +15 -0
- quantum/cli/commands/build.py +417 -0
- quantum/cli/commands/dev.py +185 -0
- quantum/cli/commands/docs.py +329 -0
- quantum/cli/commands/lint.py +523 -0
- quantum/cli/commands/migrate.py +527 -0
- quantum/cli/commands/new.py +622 -0
- quantum/cli/commands/serve.py +190 -0
- quantum/cli/commands/test.py +193 -0
- quantum/cli/deploy.py +810 -0
- quantum/cli/hot_reload.py +951 -0
- quantum/cli/jobs.py +356 -0
- quantum/cli/mq.py +582 -0
- quantum/cli/pkg.py +390 -0
- quantum/cli/runner.py +547 -0
- quantum/cli/server_process.py +159 -0
- quantum/cli/utils.py +334 -0
- quantum/compiler/__init__.py +30 -0
- quantum/compiler/base_generator.py +367 -0
- quantum/compiler/cli.py +295 -0
- quantum/compiler/expression_transformer.py +444 -0
- quantum/compiler/javascript/__init__.py +10 -0
- quantum/compiler/javascript/generator.py +659 -0
- quantum/compiler/optimizer.py +270 -0
- quantum/compiler/python/__init__.py +10 -0
- quantum/compiler/python/generator.py +883 -0
- quantum/compiler/python/runtime.py +863 -0
- quantum/compiler/transpiler.py +330 -0
- quantum/core/__init__.py +3 -0
- quantum/core/ast_nodes.py +2611 -0
- quantum/core/expression_diagnostics.py +87 -0
- quantum/core/expression_stdlib.py +148 -0
- quantum/core/expressions.py +591 -0
- quantum/core/features/agents/src/__init__.py +30 -0
- quantum/core/features/agents/src/ast_node.py +540 -0
- quantum/core/features/conditionals/src/__init__.py +8 -0
- quantum/core/features/conditionals/src/ast_node.py +68 -0
- quantum/core/features/data_fetching/src/__init__.py +21 -0
- quantum/core/features/data_fetching/src/ast_node.py +312 -0
- quantum/core/features/data_fetching/src/desktop_adapter.py +351 -0
- quantum/core/features/data_fetching/src/html_adapter.py +474 -0
- quantum/core/features/data_fetching/src/parser.py +225 -0
- quantum/core/features/data_import/src/__init__.py +0 -0
- quantum/core/features/data_import/src/ast_node.py +291 -0
- quantum/core/features/data_import/src/runtime.py +538 -0
- quantum/core/features/dump/src/__init__.py +12 -0
- quantum/core/features/dump/src/ast_node.py +106 -0
- quantum/core/features/dump/src/parser.py +61 -0
- quantum/core/features/dump/src/runtime.py +246 -0
- quantum/core/features/functions/src/__init__.py +8 -0
- quantum/core/features/functions/src/ast_node.py +149 -0
- quantum/core/features/game_engine_2d/src/__init__.py +19 -0
- quantum/core/features/game_engine_2d/src/ast_nodes.py +1719 -0
- quantum/core/features/game_engine_2d/src/parser.py +983 -0
- quantum/core/features/invocation/src/__init__.py +0 -0
- quantum/core/features/invocation/src/ast_node.py +146 -0
- quantum/core/features/invocation/src/runtime.py +327 -0
- quantum/core/features/knowledge_base/src/__init__.py +6 -0
- quantum/core/features/knowledge_base/src/ast_node.py +113 -0
- quantum/core/features/knowledge_base/src/parser.py +82 -0
- quantum/core/features/logging/src/__init__.py +12 -0
- quantum/core/features/logging/src/ast_node.py +111 -0
- quantum/core/features/logging/src/parser.py +50 -0
- quantum/core/features/logging/src/runtime.py +190 -0
- quantum/core/features/loops/src/__init__.py +8 -0
- quantum/core/features/loops/src/ast_node.py +60 -0
- quantum/core/features/query/src/__init__.py +0 -0
- quantum/core/features/query/src/database_service.py +322 -0
- quantum/core/features/query/src/query_validators.py +20 -0
- quantum/core/features/state_management/src/__init__.py +11 -0
- quantum/core/features/state_management/src/ast_node.py +228 -0
- quantum/core/features/terminal_engine/src/__init__.py +21 -0
- quantum/core/features/terminal_engine/src/ast_nodes.py +560 -0
- quantum/core/features/terminal_engine/src/parser.py +361 -0
- quantum/core/features/testing_engine/src/__init__.py +41 -0
- quantum/core/features/testing_engine/src/ast_nodes.py +1212 -0
- quantum/core/features/testing_engine/src/parser.py +604 -0
- quantum/core/features/theming/src/__init__.py +48 -0
- quantum/core/features/theming/src/ast_node.py +137 -0
- quantum/core/features/theming/src/presets.py +405 -0
- quantum/core/features/ui_engine/src/__init__.py +20 -0
- quantum/core/features/ui_engine/src/ast_nodes.py +1854 -0
- quantum/core/features/ui_engine/src/parser.py +1106 -0
- quantum/core/features/websocket/src/__init__.py +24 -0
- quantum/core/features/websocket/src/ast_node.py +247 -0
- quantum/core/html_compat.py +299 -0
- quantum/core/parser.py +1235 -0
- quantum/core/parser_registry.py +213 -0
- quantum/core/parsers/__init__.py +76 -0
- quantum/core/parsers/ai/__init__.py +12 -0
- quantum/core/parsers/ai/agent_parser.py +106 -0
- quantum/core/parsers/ai/knowledge_parser.py +86 -0
- quantum/core/parsers/ai/llm_parser.py +78 -0
- quantum/core/parsers/ai/team_parser.py +88 -0
- quantum/core/parsers/base.py +322 -0
- quantum/core/parsers/composition/__init__.py +10 -0
- quantum/core/parsers/composition/import_parser.py +50 -0
- quantum/core/parsers/composition/slot_parser.py +48 -0
- quantum/core/parsers/control_flow/__init__.py +11 -0
- quantum/core/parsers/control_flow/if_parser.py +68 -0
- quantum/core/parsers/control_flow/loop_parser.py +105 -0
- quantum/core/parsers/control_flow/set_parser.py +89 -0
- quantum/core/parsers/data/__init__.py +12 -0
- quantum/core/parsers/data/data_parser.py +217 -0
- quantum/core/parsers/data/invoke_parser.py +116 -0
- quantum/core/parsers/data/query_parser.py +188 -0
- quantum/core/parsers/data/transaction_parser.py +77 -0
- quantum/core/parsers/events/__init__.py +9 -0
- quantum/core/parsers/events/dispatch_event_parser.py +44 -0
- quantum/core/parsers/forms/__init__.py +11 -0
- quantum/core/parsers/forms/action_parser.py +54 -0
- quantum/core/parsers/forms/flash_parser.py +34 -0
- quantum/core/parsers/forms/redirect_parser.py +33 -0
- quantum/core/parsers/functions/__init__.py +11 -0
- quantum/core/parsers/functions/function_parser.py +137 -0
- quantum/core/parsers/functions/param_parser.py +66 -0
- quantum/core/parsers/functions/return_parser.py +31 -0
- quantum/core/parsers/html/__init__.py +10 -0
- quantum/core/parsers/html/component_call_parser.py +130 -0
- quantum/core/parsers/html/html_parser.py +115 -0
- quantum/core/parsers/jobs/__init__.py +11 -0
- quantum/core/parsers/jobs/job_parser.py +71 -0
- quantum/core/parsers/jobs/schedule_parser.py +62 -0
- quantum/core/parsers/jobs/thread_parser.py +57 -0
- quantum/core/parsers/messaging/__init__.py +17 -0
- quantum/core/parsers/messaging/message_ack_parser.py +30 -0
- quantum/core/parsers/messaging/message_nack_parser.py +30 -0
- quantum/core/parsers/messaging/message_parser.py +114 -0
- quantum/core/parsers/messaging/queue_parser.py +61 -0
- quantum/core/parsers/messaging/websocket_parser.py +121 -0
- quantum/core/parsers/persistence/__init__.py +9 -0
- quantum/core/parsers/persistence/persist_parser.py +64 -0
- quantum/core/parsers/routing/__init__.py +9 -0
- quantum/core/parsers/routing/route_parser.py +41 -0
- quantum/core/parsers/scripting/__init__.py +12 -0
- quantum/core/parsers/scripting/pyclass_parser.py +62 -0
- quantum/core/parsers/scripting/pydecorator_parser.py +68 -0
- quantum/core/parsers/scripting/pyimport_parser.py +52 -0
- quantum/core/parsers/scripting/python_parser.py +49 -0
- quantum/core/parsers/services/__init__.py +12 -0
- quantum/core/parsers/services/dump_parser.py +52 -0
- quantum/core/parsers/services/file_parser.py +48 -0
- quantum/core/parsers/services/log_parser.py +46 -0
- quantum/core/parsers/services/mail_parser.py +65 -0
- quantum/core/tiers.py +82 -0
- quantum/packages/__init__.py +28 -0
- quantum/packages/manager.py +413 -0
- quantum/packages/manifest.py +351 -0
- quantum/packages/registry.py +399 -0
- quantum/packages/resolver.py +336 -0
- quantum/plugins/__init__.py +33 -0
- quantum/plugins/hooks.py +329 -0
- quantum/plugins/loader.py +479 -0
- quantum/plugins/manifest.py +336 -0
- quantum/plugins/registry.py +371 -0
- quantum/runtime/__init__.py +28 -0
- quantum/runtime/action_handler.py +443 -0
- quantum/runtime/adapters/__init__.py +88 -0
- quantum/runtime/adapters/memory_adapter.py +690 -0
- quantum/runtime/adapters/rabbitmq_adapter.py +715 -0
- quantum/runtime/adapters/redis_adapter.py +582 -0
- quantum/runtime/adapters/sqlite_adapter.py +414 -0
- quantum/runtime/agent_service.py +1133 -0
- quantum/runtime/api_server.py +86 -0
- quantum/runtime/ast_cache.py +506 -0
- quantum/runtime/auth_service.py +267 -0
- quantum/runtime/component.py +990 -0
- quantum/runtime/component_composer.py +319 -0
- quantum/runtime/component_resolver.py +174 -0
- quantum/runtime/database_service.py +598 -0
- quantum/runtime/email_service.py +162 -0
- quantum/runtime/error_handler.py +295 -0
- quantum/runtime/execution_context.py +286 -0
- quantum/runtime/executor_registry.py +171 -0
- quantum/runtime/executors/__init__.py +71 -0
- quantum/runtime/executors/ai/__init__.py +12 -0
- quantum/runtime/executors/ai/agent_executor.py +217 -0
- quantum/runtime/executors/ai/knowledge_executor.py +114 -0
- quantum/runtime/executors/ai/llm_executor.py +153 -0
- quantum/runtime/executors/ai/team_executor.py +171 -0
- quantum/runtime/executors/base.py +262 -0
- quantum/runtime/executors/control_flow/__init__.py +11 -0
- quantum/runtime/executors/control_flow/if_executor.py +93 -0
- quantum/runtime/executors/control_flow/loop_executor.py +307 -0
- quantum/runtime/executors/control_flow/set_executor.py +412 -0
- quantum/runtime/executors/data/__init__.py +12 -0
- quantum/runtime/executors/data/data_executor.py +145 -0
- quantum/runtime/executors/data/invoke_executor.py +176 -0
- quantum/runtime/executors/data/query_executor.py +256 -0
- quantum/runtime/executors/data/transaction_executor.py +91 -0
- quantum/runtime/executors/jobs/__init__.py +11 -0
- quantum/runtime/executors/jobs/job_executor.py +190 -0
- quantum/runtime/executors/jobs/schedule_executor.py +132 -0
- quantum/runtime/executors/jobs/thread_executor.py +127 -0
- quantum/runtime/executors/messaging/__init__.py +17 -0
- quantum/runtime/executors/messaging/message_ack_executor.py +51 -0
- quantum/runtime/executors/messaging/message_executor.py +174 -0
- quantum/runtime/executors/messaging/queue_executor.py +103 -0
- quantum/runtime/executors/messaging/websocket_executor.py +197 -0
- quantum/runtime/executors/scripting/__init__.py +11 -0
- quantum/runtime/executors/scripting/pyclass_executor.py +90 -0
- quantum/runtime/executors/scripting/pyimport_executor.py +81 -0
- quantum/runtime/executors/scripting/python_executor.py +249 -0
- quantum/runtime/executors/services/__init__.py +12 -0
- quantum/runtime/executors/services/dump_executor.py +72 -0
- quantum/runtime/executors/services/file_executor.py +89 -0
- quantum/runtime/executors/services/log_executor.py +77 -0
- quantum/runtime/executors/services/mail_executor.py +81 -0
- quantum/runtime/expression_cache.py +498 -0
- quantum/runtime/file_upload_service.py +326 -0
- quantum/runtime/function_registry.py +118 -0
- quantum/runtime/game_builder.py +166 -0
- quantum/runtime/game_code_generator.py +2371 -0
- quantum/runtime/game_templates.py +2006 -0
- quantum/runtime/godot_code_generator.py +4681 -0
- quantum/runtime/godot_templates.py +1449 -0
- quantum/runtime/job_executor.py +1599 -0
- quantum/runtime/knowledge_service.py +500 -0
- quantum/runtime/llm_cache.py +100 -0
- quantum/runtime/llm_providers.py +704 -0
- quantum/runtime/llm_service.py +287 -0
- quantum/runtime/logging_setup.py +140 -0
- quantum/runtime/message_broker.py +364 -0
- quantum/runtime/message_queue_service.py +571 -0
- quantum/runtime/param_validation.py +184 -0
- quantum/runtime/pypy_compat.py +315 -0
- quantum/runtime/python_bridge.py +698 -0
- quantum/runtime/query_validators.py +304 -0
- quantum/runtime/renderer.py +733 -0
- quantum/runtime/service_container.py +444 -0
- quantum/runtime/terminal_builder.py +76 -0
- quantum/runtime/terminal_code_generator.py +607 -0
- quantum/runtime/terminal_templates.py +243 -0
- quantum/runtime/testing_builder.py +77 -0
- quantum/runtime/testing_code_generator.py +833 -0
- quantum/runtime/testing_templates.py +85 -0
- quantum/runtime/ui_builder.py +188 -0
- quantum/runtime/ui_desktop_adapter.py +1730 -0
- quantum/runtime/ui_desktop_templates.py +307 -0
- quantum/runtime/ui_html_adapter.py +2691 -0
- quantum/runtime/ui_html_templates.py +2297 -0
- quantum/runtime/ui_mobile_adapter.py +1832 -0
- quantum/runtime/ui_mobile_templates.py +1003 -0
- quantum/runtime/ui_textual_adapter.py +1866 -0
- quantum/runtime/ui_textual_templates.py +45 -0
- quantum/runtime/ui_tokens.py +465 -0
- quantum/runtime/ui_validator.py +365 -0
- quantum/runtime/validators.py +256 -0
- quantum/runtime/web_server.py +1766 -0
- quantum/runtime/websocket_adapter.py +501 -0
- quantum/runtime/websocket_service.py +585 -0
- quantum/runtime/websocket_transport.py +289 -0
- quantum/runtime/wsgi.py +101 -0
- quantum/utils/__init__.py +1 -0
- quantum_framework-0.9.0.dist-info/METADATA +244 -0
- quantum_framework-0.9.0.dist-info/RECORD +262 -0
- quantum_framework-0.9.0.dist-info/WHEEL +5 -0
- quantum_framework-0.9.0.dist-info/entry_points.txt +2 -0
- quantum_framework-0.9.0.dist-info/licenses/LICENSE +21 -0
- quantum_framework-0.9.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1003 @@
|
|
|
1
|
+
"""
|
|
2
|
+
UI Engine - React Native Mobile Templates
|
|
3
|
+
|
|
4
|
+
Provides templates for React Native mobile apps:
|
|
5
|
+
- REACT_NATIVE_APP_TEMPLATE: Complete App.js template
|
|
6
|
+
- COMPONENT_TEMPLATE: Individual component template
|
|
7
|
+
- STYLE_HELPERS: Helper functions for StyleSheet generation
|
|
8
|
+
- IMPORTS_MAP: Mapping of UI components to RN imports
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from typing import Dict, Set
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# ==========================================================================
|
|
15
|
+
# React Native Component Imports
|
|
16
|
+
# ==========================================================================
|
|
17
|
+
|
|
18
|
+
# Map Quantum UI components to React Native imports
|
|
19
|
+
RN_IMPORTS = {
|
|
20
|
+
'View': 'react-native',
|
|
21
|
+
'Text': 'react-native',
|
|
22
|
+
'TouchableOpacity': 'react-native',
|
|
23
|
+
'TextInput': 'react-native',
|
|
24
|
+
'ScrollView': 'react-native',
|
|
25
|
+
'FlatList': 'react-native',
|
|
26
|
+
'Image': 'react-native',
|
|
27
|
+
'Switch': 'react-native',
|
|
28
|
+
'ActivityIndicator': 'react-native',
|
|
29
|
+
'Button': 'react-native',
|
|
30
|
+
'SafeAreaView': 'react-native',
|
|
31
|
+
'StatusBar': 'react-native',
|
|
32
|
+
'StyleSheet': 'react-native',
|
|
33
|
+
'Pressable': 'react-native',
|
|
34
|
+
'Modal': 'react-native',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def generate_imports(components_used: Set[str]) -> str:
|
|
39
|
+
"""Generate React Native import statements.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
components_used: Set of RN component names used in the app.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
Import statements as string.
|
|
46
|
+
"""
|
|
47
|
+
# Always include core imports
|
|
48
|
+
core_imports = {'View', 'Text', 'StyleSheet', 'SafeAreaView', 'StatusBar'}
|
|
49
|
+
all_components = core_imports | components_used
|
|
50
|
+
|
|
51
|
+
# Group by source
|
|
52
|
+
rn_components = sorted([c for c in all_components if c in RN_IMPORTS])
|
|
53
|
+
|
|
54
|
+
imports = [
|
|
55
|
+
"import React, { useState, useCallback } from 'react';",
|
|
56
|
+
f"import {{ {', '.join(rn_components)} }} from 'react-native';",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
return '\n'.join(imports)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# ==========================================================================
|
|
63
|
+
# JavaScript Code Builder
|
|
64
|
+
# ==========================================================================
|
|
65
|
+
|
|
66
|
+
class JsBuilder:
|
|
67
|
+
"""Builds well-formatted JavaScript/JSX with proper indentation."""
|
|
68
|
+
|
|
69
|
+
def __init__(self, indent_size: int = 2):
|
|
70
|
+
self._lines: list = []
|
|
71
|
+
self._indent: int = 0
|
|
72
|
+
self._indent_size: int = indent_size
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def _pad(self) -> str:
|
|
76
|
+
return ' ' * (self._indent * self._indent_size)
|
|
77
|
+
|
|
78
|
+
def line(self, code: str = '') -> 'JsBuilder':
|
|
79
|
+
self._lines.append(f"{self._pad}{code}" if code else '')
|
|
80
|
+
return self
|
|
81
|
+
|
|
82
|
+
def raw(self, code: str) -> 'JsBuilder':
|
|
83
|
+
for ln in code.split('\n'):
|
|
84
|
+
self._lines.append(f"{self._pad}{ln}")
|
|
85
|
+
return self
|
|
86
|
+
|
|
87
|
+
def blank(self) -> 'JsBuilder':
|
|
88
|
+
self._lines.append('')
|
|
89
|
+
return self
|
|
90
|
+
|
|
91
|
+
def indent(self) -> 'JsBuilder':
|
|
92
|
+
self._indent += 1
|
|
93
|
+
return self
|
|
94
|
+
|
|
95
|
+
def dedent(self) -> 'JsBuilder':
|
|
96
|
+
self._indent = max(0, self._indent - 1)
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
def comment(self, text: str) -> 'JsBuilder':
|
|
100
|
+
self.line(f'// {text}')
|
|
101
|
+
return self
|
|
102
|
+
|
|
103
|
+
def jsx_open(self, tag: str, attrs: Dict[str, str] = None,
|
|
104
|
+
self_closing: bool = False) -> 'JsBuilder':
|
|
105
|
+
"""Open a JSX tag with optional attributes."""
|
|
106
|
+
attr_str = ''
|
|
107
|
+
if attrs:
|
|
108
|
+
parts = []
|
|
109
|
+
for k, v in attrs.items():
|
|
110
|
+
if v is True:
|
|
111
|
+
parts.append(k)
|
|
112
|
+
elif v is not None and v is not False:
|
|
113
|
+
# Check if value is already a JSX expression (starts with {)
|
|
114
|
+
if isinstance(v, str) and v.startswith('{') and v.endswith('}'):
|
|
115
|
+
# Already wrapped in braces, use as-is
|
|
116
|
+
parts.append(f'{k}={v}')
|
|
117
|
+
elif isinstance(v, str) and (v.startswith('styles.') or v.startswith('[')):
|
|
118
|
+
# Style reference or array - wrap in braces
|
|
119
|
+
parts.append(f'{k}={{{v}}}')
|
|
120
|
+
else:
|
|
121
|
+
parts.append(f'{k}="{v}"')
|
|
122
|
+
if parts:
|
|
123
|
+
attr_str = ' ' + ' '.join(parts)
|
|
124
|
+
|
|
125
|
+
if self_closing:
|
|
126
|
+
self.line(f'<{tag}{attr_str} />')
|
|
127
|
+
else:
|
|
128
|
+
self.line(f'<{tag}{attr_str}>')
|
|
129
|
+
return self
|
|
130
|
+
|
|
131
|
+
def jsx_close(self, tag: str) -> 'JsBuilder':
|
|
132
|
+
self.line(f'</{tag}>')
|
|
133
|
+
return self
|
|
134
|
+
|
|
135
|
+
def jsx_text(self, content: str) -> 'JsBuilder':
|
|
136
|
+
"""Add text content, wrapping in Text component if needed."""
|
|
137
|
+
self.line(content)
|
|
138
|
+
return self
|
|
139
|
+
|
|
140
|
+
def build(self) -> str:
|
|
141
|
+
return '\n'.join(self._lines)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# ==========================================================================
|
|
145
|
+
# StyleSheet Helpers
|
|
146
|
+
# ==========================================================================
|
|
147
|
+
|
|
148
|
+
def js_string(s: str) -> str:
|
|
149
|
+
"""Escape string for JavaScript."""
|
|
150
|
+
if s is None:
|
|
151
|
+
return "''"
|
|
152
|
+
escaped = s.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n')
|
|
153
|
+
return f"'{escaped}'"
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def js_number(s: str) -> str:
|
|
157
|
+
"""Convert to JS number, returning string if not a number."""
|
|
158
|
+
if s is None:
|
|
159
|
+
return 'undefined'
|
|
160
|
+
try:
|
|
161
|
+
# Try integer
|
|
162
|
+
return str(int(s))
|
|
163
|
+
except ValueError:
|
|
164
|
+
try:
|
|
165
|
+
# Try float
|
|
166
|
+
return str(float(s))
|
|
167
|
+
except ValueError:
|
|
168
|
+
return js_string(s)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# ==========================================================================
|
|
172
|
+
# Spacing/Sizing Token Conversion for RN
|
|
173
|
+
# ==========================================================================
|
|
174
|
+
|
|
175
|
+
SPACING_RN = {
|
|
176
|
+
'none': '0',
|
|
177
|
+
'xs': '4',
|
|
178
|
+
'sm': '8',
|
|
179
|
+
'md': '16',
|
|
180
|
+
'lg': '24',
|
|
181
|
+
'xl': '32',
|
|
182
|
+
'2xl': '48',
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
SIZE_RN = {
|
|
186
|
+
'auto': "'auto'",
|
|
187
|
+
'fill': "'100%'",
|
|
188
|
+
'full': "'100%'",
|
|
189
|
+
'1/2': "'50%'",
|
|
190
|
+
'1/3': "'33.33%'",
|
|
191
|
+
'1/4': "'25%'",
|
|
192
|
+
'2/3': "'66.66%'",
|
|
193
|
+
'3/4': "'75%'",
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
# Semantic colors for RN
|
|
197
|
+
COLOR_RN = {
|
|
198
|
+
'primary': "'#3b82f6'",
|
|
199
|
+
'secondary': "'#64748b'",
|
|
200
|
+
'success': "'#22c55e'",
|
|
201
|
+
'danger': "'#ef4444'",
|
|
202
|
+
'warning': "'#f59e0b'",
|
|
203
|
+
'info': "'#06b6d4'",
|
|
204
|
+
'light': "'#f8fafc'",
|
|
205
|
+
'dark': "'#1e293b'",
|
|
206
|
+
'text': "'#1e293b'",
|
|
207
|
+
'background': "'#ffffff'",
|
|
208
|
+
'border': "'#e2e8f0'",
|
|
209
|
+
'muted': "'#64748b'",
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
FONT_SIZE_RN = {
|
|
213
|
+
'xs': '12',
|
|
214
|
+
'sm': '14',
|
|
215
|
+
'md': '16',
|
|
216
|
+
'lg': '20',
|
|
217
|
+
'xl': '24',
|
|
218
|
+
'2xl': '32',
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def rn_spacing(value: str) -> str:
|
|
223
|
+
"""Convert spacing token to RN value."""
|
|
224
|
+
if not value:
|
|
225
|
+
return '0'
|
|
226
|
+
value_lower = value.lower().strip()
|
|
227
|
+
if value_lower in SPACING_RN:
|
|
228
|
+
return SPACING_RN[value_lower]
|
|
229
|
+
# Raw value
|
|
230
|
+
if value.endswith('px'):
|
|
231
|
+
return value[:-2]
|
|
232
|
+
try:
|
|
233
|
+
int(value)
|
|
234
|
+
return value
|
|
235
|
+
except ValueError:
|
|
236
|
+
return '0'
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def rn_size(value: str) -> str:
|
|
240
|
+
"""Convert size token to RN value."""
|
|
241
|
+
if not value:
|
|
242
|
+
return 'undefined'
|
|
243
|
+
value_lower = value.lower().strip()
|
|
244
|
+
if value_lower in SIZE_RN:
|
|
245
|
+
return SIZE_RN[value_lower]
|
|
246
|
+
# Raw value
|
|
247
|
+
if value.endswith('%'):
|
|
248
|
+
return f"'{value}'"
|
|
249
|
+
if value.endswith('px'):
|
|
250
|
+
return value[:-2]
|
|
251
|
+
try:
|
|
252
|
+
int(value)
|
|
253
|
+
return value
|
|
254
|
+
except ValueError:
|
|
255
|
+
return 'undefined'
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def rn_color(value: str) -> str:
|
|
259
|
+
"""Convert color token to RN value."""
|
|
260
|
+
if not value:
|
|
261
|
+
return "'#000000'"
|
|
262
|
+
value_lower = value.lower().strip()
|
|
263
|
+
if value_lower in COLOR_RN:
|
|
264
|
+
return COLOR_RN[value_lower]
|
|
265
|
+
# Raw hex or color name
|
|
266
|
+
return f"'{value}'"
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def rn_font_size(value: str) -> str:
|
|
270
|
+
"""Convert font size token to RN value."""
|
|
271
|
+
if not value:
|
|
272
|
+
return '16'
|
|
273
|
+
value_lower = value.lower().strip()
|
|
274
|
+
if value_lower in FONT_SIZE_RN:
|
|
275
|
+
return FONT_SIZE_RN[value_lower]
|
|
276
|
+
# Raw value
|
|
277
|
+
if value.endswith('px'):
|
|
278
|
+
return value[:-2]
|
|
279
|
+
try:
|
|
280
|
+
int(value)
|
|
281
|
+
return value
|
|
282
|
+
except ValueError:
|
|
283
|
+
return '16'
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def rn_align(value: str) -> str:
|
|
287
|
+
"""Convert align token to RN alignItems value."""
|
|
288
|
+
mapping = {
|
|
289
|
+
'start': "'flex-start'",
|
|
290
|
+
'center': "'center'",
|
|
291
|
+
'end': "'flex-end'",
|
|
292
|
+
'stretch': "'stretch'",
|
|
293
|
+
}
|
|
294
|
+
return mapping.get(value, "'stretch'")
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def rn_justify(value: str) -> str:
|
|
298
|
+
"""Convert justify token to RN justifyContent value."""
|
|
299
|
+
mapping = {
|
|
300
|
+
'start': "'flex-start'",
|
|
301
|
+
'center': "'center'",
|
|
302
|
+
'end': "'flex-end'",
|
|
303
|
+
'between': "'space-between'",
|
|
304
|
+
'around': "'space-around'",
|
|
305
|
+
}
|
|
306
|
+
return mapping.get(value, "'flex-start'")
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
# ==========================================================================
|
|
310
|
+
# App Template
|
|
311
|
+
# ==========================================================================
|
|
312
|
+
|
|
313
|
+
REACT_NATIVE_APP_TEMPLATE = """\
|
|
314
|
+
/**
|
|
315
|
+
* Quantum UI - React Native Mobile App
|
|
316
|
+
*
|
|
317
|
+
* Generated by the Quantum UI Engine.
|
|
318
|
+
* This file can be used as App.js in a React Native project.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
{imports}
|
|
322
|
+
|
|
323
|
+
{state_declarations}
|
|
324
|
+
|
|
325
|
+
{function_declarations}
|
|
326
|
+
|
|
327
|
+
export default function App() {{
|
|
328
|
+
return (
|
|
329
|
+
<SafeAreaView style={{styles.safeArea}}>
|
|
330
|
+
<StatusBar barStyle="dark-content" />
|
|
331
|
+
{jsx_content}
|
|
332
|
+
</SafeAreaView>
|
|
333
|
+
);
|
|
334
|
+
}}
|
|
335
|
+
|
|
336
|
+
const styles = StyleSheet.create({{
|
|
337
|
+
safeArea: {{
|
|
338
|
+
flex: 1,
|
|
339
|
+
backgroundColor: '#ffffff',
|
|
340
|
+
}},
|
|
341
|
+
{styles_content}
|
|
342
|
+
}});
|
|
343
|
+
"""
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
# ==========================================================================
|
|
347
|
+
# Component Templates
|
|
348
|
+
# ==========================================================================
|
|
349
|
+
|
|
350
|
+
# Base styles for common components
|
|
351
|
+
BASE_STYLES = {
|
|
352
|
+
'container': """\
|
|
353
|
+
container: {
|
|
354
|
+
flex: 1,
|
|
355
|
+
backgroundColor: '#ffffff',
|
|
356
|
+
},""",
|
|
357
|
+
|
|
358
|
+
'hbox': """\
|
|
359
|
+
hbox: {
|
|
360
|
+
flexDirection: 'row',
|
|
361
|
+
alignItems: 'center',
|
|
362
|
+
},""",
|
|
363
|
+
|
|
364
|
+
'vbox': """\
|
|
365
|
+
vbox: {
|
|
366
|
+
flexDirection: 'column',
|
|
367
|
+
},""",
|
|
368
|
+
|
|
369
|
+
'panel': """\
|
|
370
|
+
panel: {
|
|
371
|
+
backgroundColor: '#ffffff',
|
|
372
|
+
borderRadius: 6,
|
|
373
|
+
borderWidth: 1,
|
|
374
|
+
borderColor: '#e2e8f0',
|
|
375
|
+
padding: 16,
|
|
376
|
+
shadowColor: '#000',
|
|
377
|
+
shadowOffset: { width: 0, height: 1 },
|
|
378
|
+
shadowOpacity: 0.1,
|
|
379
|
+
shadowRadius: 3,
|
|
380
|
+
elevation: 2,
|
|
381
|
+
},
|
|
382
|
+
panelTitle: {
|
|
383
|
+
fontSize: 18,
|
|
384
|
+
fontWeight: '600',
|
|
385
|
+
marginBottom: 12,
|
|
386
|
+
color: '#1e293b',
|
|
387
|
+
borderBottomWidth: 1,
|
|
388
|
+
borderBottomColor: '#e2e8f0',
|
|
389
|
+
paddingBottom: 8,
|
|
390
|
+
},""",
|
|
391
|
+
|
|
392
|
+
'button': """\
|
|
393
|
+
button: {
|
|
394
|
+
backgroundColor: '#3b82f6',
|
|
395
|
+
paddingVertical: 10,
|
|
396
|
+
paddingHorizontal: 16,
|
|
397
|
+
borderRadius: 6,
|
|
398
|
+
alignItems: 'center',
|
|
399
|
+
justifyContent: 'center',
|
|
400
|
+
},
|
|
401
|
+
buttonText: {
|
|
402
|
+
color: '#ffffff',
|
|
403
|
+
fontWeight: '500',
|
|
404
|
+
fontSize: 16,
|
|
405
|
+
},
|
|
406
|
+
buttonSecondary: {
|
|
407
|
+
backgroundColor: '#64748b',
|
|
408
|
+
},
|
|
409
|
+
buttonDanger: {
|
|
410
|
+
backgroundColor: '#ef4444',
|
|
411
|
+
},
|
|
412
|
+
buttonSuccess: {
|
|
413
|
+
backgroundColor: '#22c55e',
|
|
414
|
+
},
|
|
415
|
+
buttonDisabled: {
|
|
416
|
+
opacity: 0.5,
|
|
417
|
+
},""",
|
|
418
|
+
|
|
419
|
+
'input': """\
|
|
420
|
+
input: {
|
|
421
|
+
borderWidth: 1,
|
|
422
|
+
borderColor: '#e2e8f0',
|
|
423
|
+
borderRadius: 6,
|
|
424
|
+
paddingVertical: 8,
|
|
425
|
+
paddingHorizontal: 12,
|
|
426
|
+
fontSize: 16,
|
|
427
|
+
backgroundColor: '#ffffff',
|
|
428
|
+
},
|
|
429
|
+
inputFocused: {
|
|
430
|
+
borderColor: '#3b82f6',
|
|
431
|
+
},""",
|
|
432
|
+
|
|
433
|
+
'text': """\
|
|
434
|
+
text: {
|
|
435
|
+
fontSize: 16,
|
|
436
|
+
color: '#1e293b',
|
|
437
|
+
},
|
|
438
|
+
textBold: {
|
|
439
|
+
fontWeight: 'bold',
|
|
440
|
+
},""",
|
|
441
|
+
|
|
442
|
+
'header': """\
|
|
443
|
+
header: {
|
|
444
|
+
backgroundColor: '#1e293b',
|
|
445
|
+
paddingVertical: 12,
|
|
446
|
+
paddingHorizontal: 16,
|
|
447
|
+
},
|
|
448
|
+
headerText: {
|
|
449
|
+
color: '#ffffff',
|
|
450
|
+
fontSize: 18,
|
|
451
|
+
fontWeight: '600',
|
|
452
|
+
},""",
|
|
453
|
+
|
|
454
|
+
'footer': """\
|
|
455
|
+
footer: {
|
|
456
|
+
backgroundColor: '#f8fafc',
|
|
457
|
+
paddingVertical: 12,
|
|
458
|
+
paddingHorizontal: 16,
|
|
459
|
+
borderTopWidth: 1,
|
|
460
|
+
borderTopColor: '#e2e8f0',
|
|
461
|
+
},
|
|
462
|
+
footerText: {
|
|
463
|
+
color: '#64748b',
|
|
464
|
+
fontSize: 14,
|
|
465
|
+
},""",
|
|
466
|
+
|
|
467
|
+
'badge': """\
|
|
468
|
+
badge: {
|
|
469
|
+
paddingVertical: 2,
|
|
470
|
+
paddingHorizontal: 8,
|
|
471
|
+
borderRadius: 12,
|
|
472
|
+
backgroundColor: '#f8fafc',
|
|
473
|
+
},
|
|
474
|
+
badgeText: {
|
|
475
|
+
fontSize: 12,
|
|
476
|
+
fontWeight: '600',
|
|
477
|
+
color: '#1e293b',
|
|
478
|
+
},
|
|
479
|
+
badgePrimary: {
|
|
480
|
+
backgroundColor: '#3b82f6',
|
|
481
|
+
},
|
|
482
|
+
badgeSuccess: {
|
|
483
|
+
backgroundColor: '#22c55e',
|
|
484
|
+
},
|
|
485
|
+
badgeDanger: {
|
|
486
|
+
backgroundColor: '#ef4444',
|
|
487
|
+
},
|
|
488
|
+
badgeWarning: {
|
|
489
|
+
backgroundColor: '#f59e0b',
|
|
490
|
+
},
|
|
491
|
+
badgePrimaryText: {
|
|
492
|
+
color: '#ffffff',
|
|
493
|
+
},""",
|
|
494
|
+
|
|
495
|
+
'loading': """\
|
|
496
|
+
loading: {
|
|
497
|
+
flexDirection: 'row',
|
|
498
|
+
alignItems: 'center',
|
|
499
|
+
gap: 8,
|
|
500
|
+
},
|
|
501
|
+
loadingText: {
|
|
502
|
+
color: '#64748b',
|
|
503
|
+
},""",
|
|
504
|
+
|
|
505
|
+
'progress': """\
|
|
506
|
+
progressContainer: {
|
|
507
|
+
height: 8,
|
|
508
|
+
backgroundColor: '#f8fafc',
|
|
509
|
+
borderRadius: 4,
|
|
510
|
+
overflow: 'hidden',
|
|
511
|
+
},
|
|
512
|
+
progressBar: {
|
|
513
|
+
height: '100%',
|
|
514
|
+
backgroundColor: '#3b82f6',
|
|
515
|
+
borderRadius: 4,
|
|
516
|
+
},""",
|
|
517
|
+
|
|
518
|
+
'switch': """\
|
|
519
|
+
switchRow: {
|
|
520
|
+
flexDirection: 'row',
|
|
521
|
+
alignItems: 'center',
|
|
522
|
+
gap: 8,
|
|
523
|
+
},""",
|
|
524
|
+
|
|
525
|
+
'image': """\
|
|
526
|
+
image: {
|
|
527
|
+
width: '100%',
|
|
528
|
+
resizeMode: 'contain',
|
|
529
|
+
},""",
|
|
530
|
+
|
|
531
|
+
'list': """\
|
|
532
|
+
listItem: {
|
|
533
|
+
paddingVertical: 10,
|
|
534
|
+
paddingHorizontal: 12,
|
|
535
|
+
borderBottomWidth: 1,
|
|
536
|
+
borderBottomColor: '#e2e8f0',
|
|
537
|
+
},""",
|
|
538
|
+
|
|
539
|
+
'form': """\
|
|
540
|
+
form: {
|
|
541
|
+
gap: 16,
|
|
542
|
+
},
|
|
543
|
+
formItem: {
|
|
544
|
+
flexDirection: 'row',
|
|
545
|
+
alignItems: 'center',
|
|
546
|
+
gap: 12,
|
|
547
|
+
},
|
|
548
|
+
formLabel: {
|
|
549
|
+
minWidth: 100,
|
|
550
|
+
fontWeight: '500',
|
|
551
|
+
color: '#1e293b',
|
|
552
|
+
},""",
|
|
553
|
+
|
|
554
|
+
'tab': """\
|
|
555
|
+
tabHeader: {
|
|
556
|
+
flexDirection: 'row',
|
|
557
|
+
borderBottomWidth: 2,
|
|
558
|
+
borderBottomColor: '#e2e8f0',
|
|
559
|
+
},
|
|
560
|
+
tabButton: {
|
|
561
|
+
paddingVertical: 10,
|
|
562
|
+
paddingHorizontal: 20,
|
|
563
|
+
borderBottomWidth: 2,
|
|
564
|
+
borderBottomColor: 'transparent',
|
|
565
|
+
marginBottom: -2,
|
|
566
|
+
},
|
|
567
|
+
tabButtonActive: {
|
|
568
|
+
borderBottomColor: '#3b82f6',
|
|
569
|
+
},
|
|
570
|
+
tabButtonText: {
|
|
571
|
+
color: '#64748b',
|
|
572
|
+
fontWeight: '500',
|
|
573
|
+
},
|
|
574
|
+
tabButtonTextActive: {
|
|
575
|
+
color: '#3b82f6',
|
|
576
|
+
},
|
|
577
|
+
tabContent: {
|
|
578
|
+
padding: 16,
|
|
579
|
+
},""",
|
|
580
|
+
|
|
581
|
+
'select': """\
|
|
582
|
+
select: {
|
|
583
|
+
borderWidth: 1,
|
|
584
|
+
borderColor: '#e2e8f0',
|
|
585
|
+
borderRadius: 6,
|
|
586
|
+
paddingVertical: 8,
|
|
587
|
+
paddingHorizontal: 12,
|
|
588
|
+
backgroundColor: '#ffffff',
|
|
589
|
+
},""",
|
|
590
|
+
|
|
591
|
+
'scrollbox': """\
|
|
592
|
+
scrollbox: {
|
|
593
|
+
flex: 1,
|
|
594
|
+
},""",
|
|
595
|
+
|
|
596
|
+
'rule': """\
|
|
597
|
+
rule: {
|
|
598
|
+
height: 1,
|
|
599
|
+
backgroundColor: '#e2e8f0',
|
|
600
|
+
marginVertical: 8,
|
|
601
|
+
},""",
|
|
602
|
+
|
|
603
|
+
'link': """\
|
|
604
|
+
link: {
|
|
605
|
+
color: '#3b82f6',
|
|
606
|
+
},""",
|
|
607
|
+
|
|
608
|
+
'checkbox': """\
|
|
609
|
+
checkboxRow: {
|
|
610
|
+
flexDirection: 'row',
|
|
611
|
+
alignItems: 'center',
|
|
612
|
+
gap: 8,
|
|
613
|
+
},
|
|
614
|
+
checkbox: {
|
|
615
|
+
width: 20,
|
|
616
|
+
height: 20,
|
|
617
|
+
borderWidth: 1,
|
|
618
|
+
borderColor: '#e2e8f0',
|
|
619
|
+
borderRadius: 4,
|
|
620
|
+
alignItems: 'center',
|
|
621
|
+
justifyContent: 'center',
|
|
622
|
+
},
|
|
623
|
+
checkboxChecked: {
|
|
624
|
+
backgroundColor: '#3b82f6',
|
|
625
|
+
borderColor: '#3b82f6',
|
|
626
|
+
},
|
|
627
|
+
checkboxLabel: {
|
|
628
|
+
fontSize: 16,
|
|
629
|
+
color: '#1e293b',
|
|
630
|
+
},""",
|
|
631
|
+
|
|
632
|
+
'accordion': """\
|
|
633
|
+
section: {
|
|
634
|
+
borderWidth: 1,
|
|
635
|
+
borderColor: '#e2e8f0',
|
|
636
|
+
borderRadius: 6,
|
|
637
|
+
marginBottom: 4,
|
|
638
|
+
overflow: 'hidden',
|
|
639
|
+
},
|
|
640
|
+
sectionHeader: {
|
|
641
|
+
padding: 12,
|
|
642
|
+
backgroundColor: '#f8fafc',
|
|
643
|
+
borderBottomWidth: 1,
|
|
644
|
+
borderBottomColor: '#e2e8f0',
|
|
645
|
+
},
|
|
646
|
+
sectionHeaderText: {
|
|
647
|
+
fontWeight: '500',
|
|
648
|
+
color: '#1e293b',
|
|
649
|
+
},
|
|
650
|
+
sectionContent: {
|
|
651
|
+
padding: 12,
|
|
652
|
+
},""",
|
|
653
|
+
|
|
654
|
+
'spacer': """\
|
|
655
|
+
spacer: {
|
|
656
|
+
flex: 1,
|
|
657
|
+
},""",
|
|
658
|
+
|
|
659
|
+
'menu': """\
|
|
660
|
+
menu: {
|
|
661
|
+
flexDirection: 'row',
|
|
662
|
+
gap: 4,
|
|
663
|
+
},
|
|
664
|
+
menuItem: {
|
|
665
|
+
paddingVertical: 8,
|
|
666
|
+
paddingHorizontal: 16,
|
|
667
|
+
borderRadius: 6,
|
|
668
|
+
},
|
|
669
|
+
menuItemText: {
|
|
670
|
+
color: '#1e293b',
|
|
671
|
+
},""",
|
|
672
|
+
|
|
673
|
+
'card': """\
|
|
674
|
+
card: {
|
|
675
|
+
backgroundColor: '#ffffff',
|
|
676
|
+
borderRadius: 8,
|
|
677
|
+
borderWidth: 1,
|
|
678
|
+
borderColor: '#e2e8f0',
|
|
679
|
+
shadowColor: '#000',
|
|
680
|
+
shadowOffset: { width: 0, height: 2 },
|
|
681
|
+
shadowOpacity: 0.1,
|
|
682
|
+
shadowRadius: 4,
|
|
683
|
+
elevation: 3,
|
|
684
|
+
overflow: 'hidden',
|
|
685
|
+
},
|
|
686
|
+
cardHeader: {
|
|
687
|
+
padding: 16,
|
|
688
|
+
borderBottomWidth: 1,
|
|
689
|
+
borderBottomColor: '#e2e8f0',
|
|
690
|
+
},
|
|
691
|
+
cardBody: {
|
|
692
|
+
padding: 16,
|
|
693
|
+
},
|
|
694
|
+
cardFooter: {
|
|
695
|
+
padding: 16,
|
|
696
|
+
backgroundColor: '#f8fafc',
|
|
697
|
+
borderTopWidth: 1,
|
|
698
|
+
borderTopColor: '#e2e8f0',
|
|
699
|
+
},""",
|
|
700
|
+
|
|
701
|
+
'modal': """\
|
|
702
|
+
modalOverlay: {
|
|
703
|
+
flex: 1,
|
|
704
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
705
|
+
justifyContent: 'center',
|
|
706
|
+
alignItems: 'center',
|
|
707
|
+
},
|
|
708
|
+
modalContent: {
|
|
709
|
+
backgroundColor: '#ffffff',
|
|
710
|
+
borderRadius: 8,
|
|
711
|
+
padding: 20,
|
|
712
|
+
width: '90%',
|
|
713
|
+
maxHeight: '80%',
|
|
714
|
+
},
|
|
715
|
+
modalTitle: {
|
|
716
|
+
fontSize: 18,
|
|
717
|
+
fontWeight: '600',
|
|
718
|
+
marginBottom: 16,
|
|
719
|
+
color: '#1e293b',
|
|
720
|
+
},
|
|
721
|
+
modalClose: {
|
|
722
|
+
position: 'absolute',
|
|
723
|
+
top: 12,
|
|
724
|
+
right: 12,
|
|
725
|
+
padding: 8,
|
|
726
|
+
},""",
|
|
727
|
+
|
|
728
|
+
'alert': """\
|
|
729
|
+
alert: {
|
|
730
|
+
padding: 16,
|
|
731
|
+
borderRadius: 6,
|
|
732
|
+
borderWidth: 1,
|
|
733
|
+
},
|
|
734
|
+
alertInfo: {
|
|
735
|
+
backgroundColor: '#eff6ff',
|
|
736
|
+
borderColor: '#3b82f6',
|
|
737
|
+
},
|
|
738
|
+
alertSuccess: {
|
|
739
|
+
backgroundColor: '#f0fdf4',
|
|
740
|
+
borderColor: '#22c55e',
|
|
741
|
+
},
|
|
742
|
+
alertWarning: {
|
|
743
|
+
backgroundColor: '#fffbeb',
|
|
744
|
+
borderColor: '#f59e0b',
|
|
745
|
+
},
|
|
746
|
+
alertDanger: {
|
|
747
|
+
backgroundColor: '#fef2f2',
|
|
748
|
+
borderColor: '#ef4444',
|
|
749
|
+
},
|
|
750
|
+
alertTitle: {
|
|
751
|
+
fontWeight: '600',
|
|
752
|
+
marginBottom: 4,
|
|
753
|
+
color: '#1e293b',
|
|
754
|
+
},
|
|
755
|
+
alertText: {
|
|
756
|
+
color: '#1e293b',
|
|
757
|
+
},""",
|
|
758
|
+
|
|
759
|
+
'avatar': """\
|
|
760
|
+
avatar: {
|
|
761
|
+
width: 40,
|
|
762
|
+
height: 40,
|
|
763
|
+
borderRadius: 20,
|
|
764
|
+
backgroundColor: '#3b82f6',
|
|
765
|
+
justifyContent: 'center',
|
|
766
|
+
alignItems: 'center',
|
|
767
|
+
},
|
|
768
|
+
avatarText: {
|
|
769
|
+
color: '#ffffff',
|
|
770
|
+
fontWeight: '600',
|
|
771
|
+
},""",
|
|
772
|
+
|
|
773
|
+
'dropdown': """\
|
|
774
|
+
dropdownTrigger: {
|
|
775
|
+
paddingVertical: 10,
|
|
776
|
+
paddingHorizontal: 16,
|
|
777
|
+
backgroundColor: '#f8fafc',
|
|
778
|
+
borderRadius: 6,
|
|
779
|
+
borderWidth: 1,
|
|
780
|
+
borderColor: '#e2e8f0',
|
|
781
|
+
},
|
|
782
|
+
dropdownMenu: {
|
|
783
|
+
position: 'absolute',
|
|
784
|
+
top: '100%',
|
|
785
|
+
left: 0,
|
|
786
|
+
right: 0,
|
|
787
|
+
backgroundColor: '#ffffff',
|
|
788
|
+
borderRadius: 6,
|
|
789
|
+
borderWidth: 1,
|
|
790
|
+
borderColor: '#e2e8f0',
|
|
791
|
+
shadowColor: '#000',
|
|
792
|
+
shadowOffset: { width: 0, height: 2 },
|
|
793
|
+
shadowOpacity: 0.1,
|
|
794
|
+
shadowRadius: 4,
|
|
795
|
+
elevation: 3,
|
|
796
|
+
zIndex: 100,
|
|
797
|
+
},""",
|
|
798
|
+
|
|
799
|
+
'toast': """\
|
|
800
|
+
toastContainer: {
|
|
801
|
+
position: 'absolute',
|
|
802
|
+
top: 50,
|
|
803
|
+
right: 16,
|
|
804
|
+
zIndex: 1000,
|
|
805
|
+
},
|
|
806
|
+
toast: {
|
|
807
|
+
padding: 16,
|
|
808
|
+
borderRadius: 8,
|
|
809
|
+
marginBottom: 8,
|
|
810
|
+
shadowColor: '#000',
|
|
811
|
+
shadowOffset: { width: 0, height: 2 },
|
|
812
|
+
shadowOpacity: 0.1,
|
|
813
|
+
shadowRadius: 4,
|
|
814
|
+
elevation: 3,
|
|
815
|
+
},
|
|
816
|
+
toastInfo: {
|
|
817
|
+
backgroundColor: '#3b82f6',
|
|
818
|
+
},
|
|
819
|
+
toastSuccess: {
|
|
820
|
+
backgroundColor: '#22c55e',
|
|
821
|
+
},
|
|
822
|
+
toastWarning: {
|
|
823
|
+
backgroundColor: '#f59e0b',
|
|
824
|
+
},
|
|
825
|
+
toastDanger: {
|
|
826
|
+
backgroundColor: '#ef4444',
|
|
827
|
+
},
|
|
828
|
+
toastTitle: {
|
|
829
|
+
fontWeight: '600',
|
|
830
|
+
color: '#ffffff',
|
|
831
|
+
marginBottom: 4,
|
|
832
|
+
},
|
|
833
|
+
toastText: {
|
|
834
|
+
color: '#ffffff',
|
|
835
|
+
},""",
|
|
836
|
+
|
|
837
|
+
'carousel': """\
|
|
838
|
+
carousel: {
|
|
839
|
+
flexDirection: 'row',
|
|
840
|
+
},
|
|
841
|
+
slide: {
|
|
842
|
+
width: '100%',
|
|
843
|
+
},""",
|
|
844
|
+
|
|
845
|
+
'stepper': """\
|
|
846
|
+
stepItem: {
|
|
847
|
+
alignItems: 'center',
|
|
848
|
+
flex: 1,
|
|
849
|
+
},
|
|
850
|
+
stepCircle: {
|
|
851
|
+
width: 32,
|
|
852
|
+
height: 32,
|
|
853
|
+
borderRadius: 16,
|
|
854
|
+
backgroundColor: '#e2e8f0',
|
|
855
|
+
justifyContent: 'center',
|
|
856
|
+
alignItems: 'center',
|
|
857
|
+
},
|
|
858
|
+
stepCircleActive: {
|
|
859
|
+
backgroundColor: '#3b82f6',
|
|
860
|
+
},
|
|
861
|
+
stepCircleComplete: {
|
|
862
|
+
backgroundColor: '#22c55e',
|
|
863
|
+
},
|
|
864
|
+
stepNumber: {
|
|
865
|
+
color: '#ffffff',
|
|
866
|
+
fontWeight: '600',
|
|
867
|
+
},
|
|
868
|
+
stepLabel: {
|
|
869
|
+
marginTop: 8,
|
|
870
|
+
fontSize: 12,
|
|
871
|
+
color: '#64748b',
|
|
872
|
+
},
|
|
873
|
+
stepContent: {
|
|
874
|
+
padding: 16,
|
|
875
|
+
},""",
|
|
876
|
+
|
|
877
|
+
'calendar': """\
|
|
878
|
+
calendar: {
|
|
879
|
+
padding: 16,
|
|
880
|
+
backgroundColor: '#ffffff',
|
|
881
|
+
borderRadius: 8,
|
|
882
|
+
borderWidth: 1,
|
|
883
|
+
borderColor: '#e2e8f0',
|
|
884
|
+
},
|
|
885
|
+
calendarPlaceholder: {
|
|
886
|
+
color: '#64748b',
|
|
887
|
+
textAlign: 'center',
|
|
888
|
+
},
|
|
889
|
+
datePickerContainer: {
|
|
890
|
+
flexDirection: 'row',
|
|
891
|
+
alignItems: 'center',
|
|
892
|
+
},""",
|
|
893
|
+
|
|
894
|
+
'animate': """\
|
|
895
|
+
animate: {
|
|
896
|
+
flex: 1,
|
|
897
|
+
},""",
|
|
898
|
+
|
|
899
|
+
'chart': """\
|
|
900
|
+
chart: {
|
|
901
|
+
padding: 16,
|
|
902
|
+
backgroundColor: '#ffffff',
|
|
903
|
+
borderRadius: 8,
|
|
904
|
+
borderWidth: 1,
|
|
905
|
+
borderColor: '#e2e8f0',
|
|
906
|
+
minHeight: 200,
|
|
907
|
+
justifyContent: 'center',
|
|
908
|
+
alignItems: 'center',
|
|
909
|
+
},
|
|
910
|
+
chartPlaceholder: {
|
|
911
|
+
color: '#64748b',
|
|
912
|
+
textAlign: 'center',
|
|
913
|
+
},""",
|
|
914
|
+
|
|
915
|
+
'tooltip': """\
|
|
916
|
+
tooltipContainer: {
|
|
917
|
+
position: 'relative',
|
|
918
|
+
},
|
|
919
|
+
tooltip: {
|
|
920
|
+
position: 'absolute',
|
|
921
|
+
backgroundColor: '#1e293b',
|
|
922
|
+
padding: 8,
|
|
923
|
+
borderRadius: 4,
|
|
924
|
+
top: -40,
|
|
925
|
+
left: 0,
|
|
926
|
+
},
|
|
927
|
+
tooltipText: {
|
|
928
|
+
color: '#ffffff',
|
|
929
|
+
fontSize: 12,
|
|
930
|
+
},""",
|
|
931
|
+
|
|
932
|
+
'breadcrumb': """\
|
|
933
|
+
breadcrumb: {
|
|
934
|
+
flexDirection: 'row',
|
|
935
|
+
alignItems: 'center',
|
|
936
|
+
gap: 8,
|
|
937
|
+
},
|
|
938
|
+
breadcrumbItem: {
|
|
939
|
+
paddingVertical: 4,
|
|
940
|
+
paddingHorizontal: 8,
|
|
941
|
+
},
|
|
942
|
+
breadcrumbItemActive: {
|
|
943
|
+
paddingVertical: 4,
|
|
944
|
+
paddingHorizontal: 8,
|
|
945
|
+
backgroundColor: '#e2e8f0',
|
|
946
|
+
borderRadius: 4,
|
|
947
|
+
},
|
|
948
|
+
breadcrumbText: {
|
|
949
|
+
color: '#3b82f6',
|
|
950
|
+
fontSize: 14,
|
|
951
|
+
},""",
|
|
952
|
+
|
|
953
|
+
'pagination': """\
|
|
954
|
+
pagination: {
|
|
955
|
+
flexDirection: 'row',
|
|
956
|
+
justifyContent: 'center',
|
|
957
|
+
alignItems: 'center',
|
|
958
|
+
gap: 16,
|
|
959
|
+
padding: 16,
|
|
960
|
+
},
|
|
961
|
+
paginationButton: {
|
|
962
|
+
padding: 8,
|
|
963
|
+
backgroundColor: '#e2e8f0',
|
|
964
|
+
borderRadius: 4,
|
|
965
|
+
},
|
|
966
|
+
paginationText: {
|
|
967
|
+
fontSize: 14,
|
|
968
|
+
color: '#1e293b',
|
|
969
|
+
},""",
|
|
970
|
+
|
|
971
|
+
'skeleton': """\
|
|
972
|
+
skeleton: {
|
|
973
|
+
backgroundColor: '#e2e8f0',
|
|
974
|
+
borderRadius: 4,
|
|
975
|
+
height: 16,
|
|
976
|
+
width: '100%',
|
|
977
|
+
},
|
|
978
|
+
skeletonCircle: {
|
|
979
|
+
width: 40,
|
|
980
|
+
height: 40,
|
|
981
|
+
borderRadius: 20,
|
|
982
|
+
},
|
|
983
|
+
skeletonRect: {
|
|
984
|
+
height: 100,
|
|
985
|
+
borderRadius: 8,
|
|
986
|
+
},""",
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
def get_base_styles(styles_used: Set[str]) -> str:
|
|
991
|
+
"""Generate StyleSheet entries for used component types.
|
|
992
|
+
|
|
993
|
+
Args:
|
|
994
|
+
styles_used: Set of style keys that were used.
|
|
995
|
+
|
|
996
|
+
Returns:
|
|
997
|
+
StyleSheet entries as string.
|
|
998
|
+
"""
|
|
999
|
+
entries = []
|
|
1000
|
+
for style_key in sorted(styles_used):
|
|
1001
|
+
if style_key in BASE_STYLES:
|
|
1002
|
+
entries.append(BASE_STYLES[style_key])
|
|
1003
|
+
return '\n'.join(entries)
|