@zolomedia/bifrost-client 1.7.74

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 (140) hide show
  1. package/L1_Foundation/L1_Foundation.js +13 -0
  2. package/L1_Foundation/bootstrap/bootstrap.js +11 -0
  3. package/L1_Foundation/bootstrap/bootstrap_hooks.js +123 -0
  4. package/L1_Foundation/bootstrap/bootstrap_index.js +15 -0
  5. package/L1_Foundation/bootstrap/bootstrap_logger.js +135 -0
  6. package/L1_Foundation/bootstrap/cdn_loader.js +217 -0
  7. package/L1_Foundation/bootstrap/module_registry.js +102 -0
  8. package/L1_Foundation/bootstrap/prism_loader.js +164 -0
  9. package/L1_Foundation/config/client_config.js +110 -0
  10. package/L1_Foundation/config/config.js +7 -0
  11. package/L1_Foundation/connection/connection.js +8 -0
  12. package/L1_Foundation/connection/websocket_connection.js +122 -0
  13. package/L1_Foundation/constants/bifrost_constants.js +284 -0
  14. package/L1_Foundation/constants/constants.js +7 -0
  15. package/L1_Foundation/logger/logger.js +10 -0
  16. package/L2_Handling/L2_Handling.js +15 -0
  17. package/L2_Handling/cache/cache.js +22 -0
  18. package/L2_Handling/cache/cache_constants.js +69 -0
  19. package/L2_Handling/cache/orchestration/cache_manager.js +299 -0
  20. package/L2_Handling/cache/orchestration/cache_orchestrator.js +260 -0
  21. package/L2_Handling/cache/orchestration/orchestration.js +12 -0
  22. package/L2_Handling/cache/storage/session_manager.js +289 -0
  23. package/L2_Handling/cache/storage/storage.js +10 -0
  24. package/L2_Handling/cache/storage/storage_manager.js +590 -0
  25. package/L2_Handling/display/composite/composite.js +13 -0
  26. package/L2_Handling/display/composite/dashboard_renderer.js +221 -0
  27. package/L2_Handling/display/composite/swiper_renderer.js +564 -0
  28. package/L2_Handling/display/composite/terminal_renderer.js +922 -0
  29. package/L2_Handling/display/composite/wizard_conditional_renderer.js +274 -0
  30. package/L2_Handling/display/display.js +30 -0
  31. package/L2_Handling/display/feedback/feedback.js +11 -0
  32. package/L2_Handling/display/feedback/progressbar_renderer.js +418 -0
  33. package/L2_Handling/display/feedback/spinner_renderer.js +246 -0
  34. package/L2_Handling/display/inputs/button_renderer.js +634 -0
  35. package/L2_Handling/display/inputs/form_renderer.js +583 -0
  36. package/L2_Handling/display/inputs/input_renderer.js +658 -0
  37. package/L2_Handling/display/inputs/inputs.js +12 -0
  38. package/L2_Handling/display/navigation/menu_renderer.js +206 -0
  39. package/L2_Handling/display/navigation/navigation.js +11 -0
  40. package/L2_Handling/display/navigation/navigation_renderer.js +703 -0
  41. package/L2_Handling/display/orchestration/orchestration.js +11 -0
  42. package/L2_Handling/display/orchestration/renderer.js +430 -0
  43. package/L2_Handling/display/orchestration/zdisplay_orchestrator.js +1759 -0
  44. package/L2_Handling/display/outputs/alert_renderer.js +161 -0
  45. package/L2_Handling/display/outputs/audio_renderer.js +94 -0
  46. package/L2_Handling/display/outputs/card_renderer.js +229 -0
  47. package/L2_Handling/display/outputs/code_renderer.js +66 -0
  48. package/L2_Handling/display/outputs/dl_renderer.js +131 -0
  49. package/L2_Handling/display/outputs/header_renderer.js +162 -0
  50. package/L2_Handling/display/outputs/icon_renderer.js +107 -0
  51. package/L2_Handling/display/outputs/image_renderer.js +145 -0
  52. package/L2_Handling/display/outputs/list_renderer.js +190 -0
  53. package/L2_Handling/display/outputs/outputs.js +19 -0
  54. package/L2_Handling/display/outputs/table_renderer.js +765 -0
  55. package/L2_Handling/display/outputs/text_renderer.js +818 -0
  56. package/L2_Handling/display/outputs/typography_renderer.js +293 -0
  57. package/L2_Handling/display/outputs/video_renderer.js +116 -0
  58. package/L2_Handling/display/primitives/document_structure_primitives.js +319 -0
  59. package/L2_Handling/display/primitives/form_primitives.js +526 -0
  60. package/L2_Handling/display/primitives/generic_containers.js +109 -0
  61. package/L2_Handling/display/primitives/interactive_primitives.js +305 -0
  62. package/L2_Handling/display/primitives/link_primitives.js +552 -0
  63. package/L2_Handling/display/primitives/lists_primitives.js +262 -0
  64. package/L2_Handling/display/primitives/media_primitives.js +383 -0
  65. package/L2_Handling/display/primitives/primitives.js +19 -0
  66. package/L2_Handling/display/primitives/semantic_element_primitive.js +226 -0
  67. package/L2_Handling/display/primitives/table_primitives.js +528 -0
  68. package/L2_Handling/display/primitives/typography_primitives.js +175 -0
  69. package/L2_Handling/display/specialized/input_request_renderer.js +467 -0
  70. package/L2_Handling/display/specialized/specialized.js +10 -0
  71. package/L2_Handling/hooks/hooks.js +9 -0
  72. package/L2_Handling/hooks/menu_integration.js +57 -0
  73. package/L2_Handling/hooks/widget_hook_manager.js +292 -0
  74. package/L2_Handling/message/message.js +8 -0
  75. package/L2_Handling/message/message_handler.js +701 -0
  76. package/L2_Handling/navigation/navigation.js +8 -0
  77. package/L2_Handling/navigation/navigation_manager.js +403 -0
  78. package/L2_Handling/zhooks/features/cache_live.js +287 -0
  79. package/L2_Handling/zhooks/features/crumbs_live.js +292 -0
  80. package/L2_Handling/zhooks/zhooks_manager.js +65 -0
  81. package/L2_Handling/zvaf/zvaf.js +8 -0
  82. package/L2_Handling/zvaf/zvaf_manager.js +334 -0
  83. package/L3_Abstraction/L3_Abstraction.js +12 -0
  84. package/L3_Abstraction/orchestrator/container_unwrapper.js +101 -0
  85. package/L3_Abstraction/orchestrator/group_renderer.js +698 -0
  86. package/L3_Abstraction/orchestrator/input_event_handler.js +797 -0
  87. package/L3_Abstraction/orchestrator/metadata_processor.js +249 -0
  88. package/L3_Abstraction/orchestrator/navbar_builder.js +201 -0
  89. package/L3_Abstraction/orchestrator/orchestrator.js +13 -0
  90. package/L3_Abstraction/orchestrator/wizard_gate_handler.js +360 -0
  91. package/L3_Abstraction/renderer/renderer.js +1 -0
  92. package/L3_Abstraction/session/session.js +1 -0
  93. package/L4_Orchestration/L4_Orchestration.js +11 -0
  94. package/L4_Orchestration/client/client.js +1 -0
  95. package/L4_Orchestration/facade/facade.js +9 -0
  96. package/L4_Orchestration/facade/manager_registry.js +118 -0
  97. package/L4_Orchestration/facade/renderer_registry.js +274 -0
  98. package/L4_Orchestration/lifecycle/asset_loader.js +255 -0
  99. package/L4_Orchestration/lifecycle/initializer.js +135 -0
  100. package/L4_Orchestration/lifecycle/lifecycle.js +8 -0
  101. package/L4_Orchestration/rendering/facade.js +94 -0
  102. package/L4_Orchestration/rendering/rendering.js +7 -0
  103. package/LICENSE +21 -0
  104. package/README.md +82 -0
  105. package/bifrost_client.js +204 -0
  106. package/bifrost_core.js +1686 -0
  107. package/docs/ARCHITECTURE.md +111 -0
  108. package/docs/PROTOCOL.md +106 -0
  109. package/docs/RENDERERS.md +101 -0
  110. package/docs/SECURITY.md +92 -0
  111. package/package.json +24 -0
  112. package/syntax/prism-zconfig.js +41 -0
  113. package/syntax/prism-zenv.js +69 -0
  114. package/syntax/prism-zolo-theme.css +288 -0
  115. package/syntax/prism-zolo.js +380 -0
  116. package/syntax/prism-zschema.js +38 -0
  117. package/syntax/prism-zspark.js +25 -0
  118. package/syntax/prism-zui.js +68 -0
  119. package/zSys/accessibility/accessibility.js +10 -0
  120. package/zSys/accessibility/emoji_accessibility.js +173 -0
  121. package/zSys/dom/block_utils.js +122 -0
  122. package/zSys/dom/container_utils.js +370 -0
  123. package/zSys/dom/dom.js +13 -0
  124. package/zSys/dom/dom_utils.js +328 -0
  125. package/zSys/dom/encoding_utils.js +117 -0
  126. package/zSys/dom/style_utils.js +71 -0
  127. package/zSys/errors/error_display.js +299 -0
  128. package/zSys/errors/errors.js +10 -0
  129. package/zSys/theme/color_utils.js +274 -0
  130. package/zSys/theme/dark_mode_utils.js +272 -0
  131. package/zSys/theme/size_utils.js +256 -0
  132. package/zSys/theme/spacing_utils.js +405 -0
  133. package/zSys/theme/theme.js +14 -0
  134. package/zSys/theme/zbase.css +1735 -0
  135. package/zSys/theme/zbase_inject.js +161 -0
  136. package/zSys/theme/ztheme_utils.js +305 -0
  137. package/zSys/validation/error_boundary.js +201 -0
  138. package/zSys/validation/validation.js +11 -0
  139. package/zSys/validation/validation_utils.js +238 -0
  140. package/zSys/zSys.js +14 -0
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Validation Utilities for Bifrost Forms and Inputs
3
+ *
4
+ * Provides reusable validation functions for frontend input validation.
5
+ * These complement backend validation by providing immediate UX feedback.
6
+ *
7
+ * Validation Philosophy:
8
+ * - Frontend: UX feedback, basic checks (required, format, range)
9
+ * - Backend: Security, business logic, data integrity
10
+ *
11
+ * @module validation_utils
12
+ */
13
+
14
+ /**
15
+ * Validate required field
16
+ * @param {string} value - Field value
17
+ * @param {string} fieldName - Field name for error message
18
+ * @returns {Object} { valid: boolean, message: string }
19
+ */
20
+ export function validateRequired(value, fieldName = 'Field') {
21
+ if (!value || value.trim() === '') {
22
+ return {
23
+ valid: false,
24
+ message: `${fieldName} is required`
25
+ };
26
+ }
27
+ return { valid: true, message: '' };
28
+ }
29
+
30
+ /**
31
+ * Validate email format
32
+ * @param {string} email - Email address
33
+ * @returns {Object} { valid: boolean, message: string }
34
+ */
35
+ export function validateEmail(email) {
36
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
37
+
38
+ if (!email || email.trim() === '') {
39
+ return { valid: false, message: 'Email is required' };
40
+ }
41
+
42
+ if (!emailRegex.test(email)) {
43
+ return { valid: false, message: 'Please enter a valid email address' };
44
+ }
45
+
46
+ return { valid: true, message: '' };
47
+ }
48
+
49
+ /**
50
+ * Validate minimum length
51
+ * @param {string} value - Field value
52
+ * @param {number} minLength - Minimum length
53
+ * @param {string} fieldName - Field name for error message
54
+ * @returns {Object} { valid: boolean, message: string }
55
+ */
56
+ export function validateMinLength(value, minLength, fieldName = 'Field') {
57
+ if (!value || value.length < minLength) {
58
+ return {
59
+ valid: false,
60
+ message: `${fieldName} must be at least ${minLength} characters`
61
+ };
62
+ }
63
+ return { valid: true, message: '' };
64
+ }
65
+
66
+ /**
67
+ * Validate maximum length
68
+ * @param {string} value - Field value
69
+ * @param {number} maxLength - Maximum length
70
+ * @param {string} fieldName - Field name for error message
71
+ * @returns {Object} { valid: boolean, message: string }
72
+ */
73
+ export function validateMaxLength(value, maxLength, fieldName = 'Field') {
74
+ if (value && value.length > maxLength) {
75
+ return {
76
+ valid: false,
77
+ message: `${fieldName} must not exceed ${maxLength} characters`
78
+ };
79
+ }
80
+ return { valid: true, message: '' };
81
+ }
82
+
83
+ /**
84
+ * Validate numeric value
85
+ * @param {string} value - Field value
86
+ * @param {string} fieldName - Field name for error message
87
+ * @returns {Object} { valid: boolean, message: string }
88
+ */
89
+ export function validateNumeric(value, fieldName = 'Field') {
90
+ if (!value || value.trim() === '') {
91
+ return { valid: false, message: `${fieldName} is required` };
92
+ }
93
+
94
+ if (isNaN(value)) {
95
+ return { valid: false, message: `${fieldName} must be a number` };
96
+ }
97
+
98
+ return { valid: true, message: '' };
99
+ }
100
+
101
+ /**
102
+ * Validate numeric range
103
+ * @param {string|number} value - Field value
104
+ * @param {number} min - Minimum value (inclusive)
105
+ * @param {number} max - Maximum value (inclusive)
106
+ * @param {string} fieldName - Field name for error message
107
+ * @returns {Object} { valid: boolean, message: string }
108
+ */
109
+ export function validateRange(value, min, max, fieldName = 'Field') {
110
+ const num = parseFloat(value);
111
+
112
+ if (isNaN(num)) {
113
+ return { valid: false, message: `${fieldName} must be a number` };
114
+ }
115
+
116
+ if (num < min || num > max) {
117
+ return {
118
+ valid: false,
119
+ message: `${fieldName} must be between ${min} and ${max}`
120
+ };
121
+ }
122
+
123
+ return { valid: true, message: '' };
124
+ }
125
+
126
+ /**
127
+ * Validate URL format
128
+ * @param {string} url - URL string
129
+ * @returns {Object} { valid: boolean, message: string }
130
+ */
131
+ export function validateURL(url) {
132
+ if (!url || url.trim() === '') {
133
+ return { valid: false, message: 'URL is required' };
134
+ }
135
+
136
+ try {
137
+ new URL(url);
138
+ return { valid: true, message: '' };
139
+ } catch (error) {
140
+ return { valid: false, message: 'Please enter a valid URL' };
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Validate password strength
146
+ * @param {string} password - Password string
147
+ * @param {Object} options - Validation options
148
+ * @param {number} options.minLength - Minimum length (default: 8)
149
+ * @param {boolean} options.requireUppercase - Require uppercase letter (default: false)
150
+ * @param {boolean} options.requireLowercase - Require lowercase letter (default: false)
151
+ * @param {boolean} options.requireNumber - Require number (default: false)
152
+ * @param {boolean} options.requireSpecial - Require special character (default: false)
153
+ * @returns {Object} { valid: boolean, message: string }
154
+ */
155
+ export function validatePassword(password, options = {}) {
156
+ const {
157
+ minLength = 8,
158
+ requireUppercase = false,
159
+ requireLowercase = false,
160
+ requireNumber = false,
161
+ requireSpecial = false
162
+ } = options;
163
+
164
+ if (!password || password.trim() === '') {
165
+ return { valid: false, message: 'Password is required' };
166
+ }
167
+
168
+ if (password.length < minLength) {
169
+ return {
170
+ valid: false,
171
+ message: `Password must be at least ${minLength} characters`
172
+ };
173
+ }
174
+
175
+ if (requireUppercase && !/[A-Z]/.test(password)) {
176
+ return {
177
+ valid: false,
178
+ message: 'Password must contain at least one uppercase letter'
179
+ };
180
+ }
181
+
182
+ if (requireLowercase && !/[a-z]/.test(password)) {
183
+ return {
184
+ valid: false,
185
+ message: 'Password must contain at least one lowercase letter'
186
+ };
187
+ }
188
+
189
+ if (requireNumber && !/\d/.test(password)) {
190
+ return { valid: false, message: 'Password must contain at least one number' };
191
+ }
192
+
193
+ if (requireSpecial && !/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
194
+ return {
195
+ valid: false,
196
+ message: 'Password must contain at least one special character'
197
+ };
198
+ }
199
+
200
+ return { valid: true, message: '' };
201
+ }
202
+
203
+ /**
204
+ * Validate pattern match (regex)
205
+ * @param {string} value - Field value
206
+ * @param {RegExp} pattern - Regular expression pattern
207
+ * @param {string} fieldName - Field name for error message
208
+ * @param {string} patternDescription - Description of expected pattern
209
+ * @returns {Object} { valid: boolean, message: string }
210
+ */
211
+ export function validatePattern(value, pattern, fieldName = 'Field', patternDescription = 'valid format') {
212
+ if (!value || value.trim() === '') {
213
+ return { valid: false, message: `${fieldName} is required` };
214
+ }
215
+
216
+ if (!pattern.test(value)) {
217
+ return {
218
+ valid: false,
219
+ message: `${fieldName} must match ${patternDescription}`
220
+ };
221
+ }
222
+
223
+ return { valid: true, message: '' };
224
+ }
225
+
226
+ /**
227
+ * Combine multiple validation results
228
+ * @param {...Object} validations - Validation result objects
229
+ * @returns {Object} { valid: boolean, message: string } - First error or success
230
+ */
231
+ export function combineValidations(...validations) {
232
+ for (const validation of validations) {
233
+ if (!validation.valid) {
234
+ return validation;
235
+ }
236
+ }
237
+ return { valid: true, message: '' };
238
+ }
package/zSys/zSys.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * zSys - System Utilities Layer
3
+ *
4
+ * Cross-cutting concerns, shared utilities.
5
+ * No layer dependencies (can be used by any layer).
6
+ * Provides: DOM helpers, Validation, Theme utils, Accessibility, Errors, Syntax
7
+ */
8
+
9
+ // Export subdirectories (will be populated in Step 6)
10
+ export * from './dom/dom.js';
11
+ export * from './validation/validation.js';
12
+ export * from './theme/theme.js';
13
+ export * from './accessibility/accessibility.js';
14
+ export * from './errors/errors.js';