@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.
- package/L1_Foundation/L1_Foundation.js +13 -0
- package/L1_Foundation/bootstrap/bootstrap.js +11 -0
- package/L1_Foundation/bootstrap/bootstrap_hooks.js +123 -0
- package/L1_Foundation/bootstrap/bootstrap_index.js +15 -0
- package/L1_Foundation/bootstrap/bootstrap_logger.js +135 -0
- package/L1_Foundation/bootstrap/cdn_loader.js +217 -0
- package/L1_Foundation/bootstrap/module_registry.js +102 -0
- package/L1_Foundation/bootstrap/prism_loader.js +164 -0
- package/L1_Foundation/config/client_config.js +110 -0
- package/L1_Foundation/config/config.js +7 -0
- package/L1_Foundation/connection/connection.js +8 -0
- package/L1_Foundation/connection/websocket_connection.js +122 -0
- package/L1_Foundation/constants/bifrost_constants.js +284 -0
- package/L1_Foundation/constants/constants.js +7 -0
- package/L1_Foundation/logger/logger.js +10 -0
- package/L2_Handling/L2_Handling.js +15 -0
- package/L2_Handling/cache/cache.js +22 -0
- package/L2_Handling/cache/cache_constants.js +69 -0
- package/L2_Handling/cache/orchestration/cache_manager.js +299 -0
- package/L2_Handling/cache/orchestration/cache_orchestrator.js +260 -0
- package/L2_Handling/cache/orchestration/orchestration.js +12 -0
- package/L2_Handling/cache/storage/session_manager.js +289 -0
- package/L2_Handling/cache/storage/storage.js +10 -0
- package/L2_Handling/cache/storage/storage_manager.js +590 -0
- package/L2_Handling/display/composite/composite.js +13 -0
- package/L2_Handling/display/composite/dashboard_renderer.js +221 -0
- package/L2_Handling/display/composite/swiper_renderer.js +564 -0
- package/L2_Handling/display/composite/terminal_renderer.js +922 -0
- package/L2_Handling/display/composite/wizard_conditional_renderer.js +274 -0
- package/L2_Handling/display/display.js +30 -0
- package/L2_Handling/display/feedback/feedback.js +11 -0
- package/L2_Handling/display/feedback/progressbar_renderer.js +418 -0
- package/L2_Handling/display/feedback/spinner_renderer.js +246 -0
- package/L2_Handling/display/inputs/button_renderer.js +634 -0
- package/L2_Handling/display/inputs/form_renderer.js +583 -0
- package/L2_Handling/display/inputs/input_renderer.js +658 -0
- package/L2_Handling/display/inputs/inputs.js +12 -0
- package/L2_Handling/display/navigation/menu_renderer.js +206 -0
- package/L2_Handling/display/navigation/navigation.js +11 -0
- package/L2_Handling/display/navigation/navigation_renderer.js +703 -0
- package/L2_Handling/display/orchestration/orchestration.js +11 -0
- package/L2_Handling/display/orchestration/renderer.js +430 -0
- package/L2_Handling/display/orchestration/zdisplay_orchestrator.js +1759 -0
- package/L2_Handling/display/outputs/alert_renderer.js +161 -0
- package/L2_Handling/display/outputs/audio_renderer.js +94 -0
- package/L2_Handling/display/outputs/card_renderer.js +229 -0
- package/L2_Handling/display/outputs/code_renderer.js +66 -0
- package/L2_Handling/display/outputs/dl_renderer.js +131 -0
- package/L2_Handling/display/outputs/header_renderer.js +162 -0
- package/L2_Handling/display/outputs/icon_renderer.js +107 -0
- package/L2_Handling/display/outputs/image_renderer.js +145 -0
- package/L2_Handling/display/outputs/list_renderer.js +190 -0
- package/L2_Handling/display/outputs/outputs.js +19 -0
- package/L2_Handling/display/outputs/table_renderer.js +765 -0
- package/L2_Handling/display/outputs/text_renderer.js +818 -0
- package/L2_Handling/display/outputs/typography_renderer.js +293 -0
- package/L2_Handling/display/outputs/video_renderer.js +116 -0
- package/L2_Handling/display/primitives/document_structure_primitives.js +319 -0
- package/L2_Handling/display/primitives/form_primitives.js +526 -0
- package/L2_Handling/display/primitives/generic_containers.js +109 -0
- package/L2_Handling/display/primitives/interactive_primitives.js +305 -0
- package/L2_Handling/display/primitives/link_primitives.js +552 -0
- package/L2_Handling/display/primitives/lists_primitives.js +262 -0
- package/L2_Handling/display/primitives/media_primitives.js +383 -0
- package/L2_Handling/display/primitives/primitives.js +19 -0
- package/L2_Handling/display/primitives/semantic_element_primitive.js +226 -0
- package/L2_Handling/display/primitives/table_primitives.js +528 -0
- package/L2_Handling/display/primitives/typography_primitives.js +175 -0
- package/L2_Handling/display/specialized/input_request_renderer.js +467 -0
- package/L2_Handling/display/specialized/specialized.js +10 -0
- package/L2_Handling/hooks/hooks.js +9 -0
- package/L2_Handling/hooks/menu_integration.js +57 -0
- package/L2_Handling/hooks/widget_hook_manager.js +292 -0
- package/L2_Handling/message/message.js +8 -0
- package/L2_Handling/message/message_handler.js +701 -0
- package/L2_Handling/navigation/navigation.js +8 -0
- package/L2_Handling/navigation/navigation_manager.js +403 -0
- package/L2_Handling/zhooks/features/cache_live.js +287 -0
- package/L2_Handling/zhooks/features/crumbs_live.js +292 -0
- package/L2_Handling/zhooks/zhooks_manager.js +65 -0
- package/L2_Handling/zvaf/zvaf.js +8 -0
- package/L2_Handling/zvaf/zvaf_manager.js +334 -0
- package/L3_Abstraction/L3_Abstraction.js +12 -0
- package/L3_Abstraction/orchestrator/container_unwrapper.js +101 -0
- package/L3_Abstraction/orchestrator/group_renderer.js +698 -0
- package/L3_Abstraction/orchestrator/input_event_handler.js +797 -0
- package/L3_Abstraction/orchestrator/metadata_processor.js +249 -0
- package/L3_Abstraction/orchestrator/navbar_builder.js +201 -0
- package/L3_Abstraction/orchestrator/orchestrator.js +13 -0
- package/L3_Abstraction/orchestrator/wizard_gate_handler.js +360 -0
- package/L3_Abstraction/renderer/renderer.js +1 -0
- package/L3_Abstraction/session/session.js +1 -0
- package/L4_Orchestration/L4_Orchestration.js +11 -0
- package/L4_Orchestration/client/client.js +1 -0
- package/L4_Orchestration/facade/facade.js +9 -0
- package/L4_Orchestration/facade/manager_registry.js +118 -0
- package/L4_Orchestration/facade/renderer_registry.js +274 -0
- package/L4_Orchestration/lifecycle/asset_loader.js +255 -0
- package/L4_Orchestration/lifecycle/initializer.js +135 -0
- package/L4_Orchestration/lifecycle/lifecycle.js +8 -0
- package/L4_Orchestration/rendering/facade.js +94 -0
- package/L4_Orchestration/rendering/rendering.js +7 -0
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/bifrost_client.js +204 -0
- package/bifrost_core.js +1686 -0
- package/docs/ARCHITECTURE.md +111 -0
- package/docs/PROTOCOL.md +106 -0
- package/docs/RENDERERS.md +101 -0
- package/docs/SECURITY.md +92 -0
- package/package.json +24 -0
- package/syntax/prism-zconfig.js +41 -0
- package/syntax/prism-zenv.js +69 -0
- package/syntax/prism-zolo-theme.css +288 -0
- package/syntax/prism-zolo.js +380 -0
- package/syntax/prism-zschema.js +38 -0
- package/syntax/prism-zspark.js +25 -0
- package/syntax/prism-zui.js +68 -0
- package/zSys/accessibility/accessibility.js +10 -0
- package/zSys/accessibility/emoji_accessibility.js +173 -0
- package/zSys/dom/block_utils.js +122 -0
- package/zSys/dom/container_utils.js +370 -0
- package/zSys/dom/dom.js +13 -0
- package/zSys/dom/dom_utils.js +328 -0
- package/zSys/dom/encoding_utils.js +117 -0
- package/zSys/dom/style_utils.js +71 -0
- package/zSys/errors/error_display.js +299 -0
- package/zSys/errors/errors.js +10 -0
- package/zSys/theme/color_utils.js +274 -0
- package/zSys/theme/dark_mode_utils.js +272 -0
- package/zSys/theme/size_utils.js +256 -0
- package/zSys/theme/spacing_utils.js +405 -0
- package/zSys/theme/theme.js +14 -0
- package/zSys/theme/zbase.css +1735 -0
- package/zSys/theme/zbase_inject.js +161 -0
- package/zSys/theme/ztheme_utils.js +305 -0
- package/zSys/validation/error_boundary.js +201 -0
- package/zSys/validation/validation.js +11 -0
- package/zSys/validation/validation_utils.js +238 -0
- package/zSys/zSys.js +14 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Semantic Element Primitive - Universal _zHTML/semantic Handler
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* SSOT for creating semantic HTML elements with validation.
|
|
7
|
+
* Centralized logic for _zHTML (container-level) and semantic (event-level).
|
|
8
|
+
*
|
|
9
|
+
* @module rendering/semantic_element_primitive
|
|
10
|
+
* @layer 0.0 (RAWEST - semantic primitives)
|
|
11
|
+
* @pattern Pure Factory Functions
|
|
12
|
+
*
|
|
13
|
+
* Philosophy:
|
|
14
|
+
* - Single source of truth for element type validation
|
|
15
|
+
* - Unified allowlist for security (prevent script/iframe/embed injection)
|
|
16
|
+
* - Reused by MetadataProcessor (_zHTML) and TypographyRenderer (semantic)
|
|
17
|
+
* - NO styling, NO classes (dress up later)
|
|
18
|
+
*
|
|
19
|
+
* Dependencies:
|
|
20
|
+
* - utils/dom_utils.js (createElement, setAttributes)
|
|
21
|
+
*
|
|
22
|
+
* Exports:
|
|
23
|
+
* - createSemanticElement(tagName, attributes) → HTMLElement
|
|
24
|
+
* - VALID_SEMANTIC_ELEMENTS: Array<string>
|
|
25
|
+
*
|
|
26
|
+
* Example:
|
|
27
|
+
* ```javascript
|
|
28
|
+
* import { createSemanticElement } from './semantic_element_primitive.js';
|
|
29
|
+
*
|
|
30
|
+
* // Container-level (_zHTML: form)
|
|
31
|
+
* const form = createSemanticElement('form', { id: 'myForm' });
|
|
32
|
+
*
|
|
33
|
+
* // Event-level (semantic: div)
|
|
34
|
+
* const div = createSemanticElement('div', { class: 'content' });
|
|
35
|
+
*
|
|
36
|
+
* // Invalid element → fallback to div
|
|
37
|
+
* const safe = createSemanticElement('script', {}); // → <div>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
// ─────────────────────────────────────────────────────────────────
|
|
42
|
+
// Imports
|
|
43
|
+
// ─────────────────────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
// Layer 2: Utilities
|
|
46
|
+
import { createElement, setAttributes } from '../../../zSys/dom/dom_utils.js';
|
|
47
|
+
|
|
48
|
+
// ─────────────────────────────────────────────────────────────────
|
|
49
|
+
// Constants
|
|
50
|
+
// ─────────────────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Valid semantic elements (SSOT)
|
|
54
|
+
*
|
|
55
|
+
* Security: Excludes dangerous elements (script, iframe, embed, object, style)
|
|
56
|
+
*
|
|
57
|
+
* Categories:
|
|
58
|
+
* - Generic: div, span
|
|
59
|
+
* - Document Structure: header, footer, main, nav, section, article, aside
|
|
60
|
+
* - Forms: form, fieldset, legend, label
|
|
61
|
+
* - Interactive: button, details, summary, dialog
|
|
62
|
+
* - Typography: h1-h6, p, blockquote, pre, code
|
|
63
|
+
*
|
|
64
|
+
* @type {Array<string>}
|
|
65
|
+
*/
|
|
66
|
+
export const VALID_SEMANTIC_ELEMENTS = [
|
|
67
|
+
// Generic containers
|
|
68
|
+
'div',
|
|
69
|
+
'span',
|
|
70
|
+
|
|
71
|
+
// Document structure (HTML5 landmarks)
|
|
72
|
+
'header',
|
|
73
|
+
'footer',
|
|
74
|
+
'main',
|
|
75
|
+
'nav',
|
|
76
|
+
'section',
|
|
77
|
+
'article',
|
|
78
|
+
'aside',
|
|
79
|
+
|
|
80
|
+
// Form elements (container-level)
|
|
81
|
+
'form',
|
|
82
|
+
'fieldset',
|
|
83
|
+
'legend',
|
|
84
|
+
'label',
|
|
85
|
+
|
|
86
|
+
// Interactive elements
|
|
87
|
+
'button',
|
|
88
|
+
'details',
|
|
89
|
+
'summary',
|
|
90
|
+
'dialog',
|
|
91
|
+
|
|
92
|
+
// Typography (block-level)
|
|
93
|
+
'h1',
|
|
94
|
+
'h2',
|
|
95
|
+
'h3',
|
|
96
|
+
'h4',
|
|
97
|
+
'h5',
|
|
98
|
+
'h6',
|
|
99
|
+
'p',
|
|
100
|
+
'blockquote',
|
|
101
|
+
'pre',
|
|
102
|
+
'code',
|
|
103
|
+
|
|
104
|
+
// Additional semantic elements
|
|
105
|
+
'address',
|
|
106
|
+
'figure',
|
|
107
|
+
'figcaption',
|
|
108
|
+
'mark',
|
|
109
|
+
'time',
|
|
110
|
+
'abbr',
|
|
111
|
+
'cite',
|
|
112
|
+
'dfn',
|
|
113
|
+
'kbd',
|
|
114
|
+
'samp',
|
|
115
|
+
'var',
|
|
116
|
+
'sub',
|
|
117
|
+
'sup',
|
|
118
|
+
'small',
|
|
119
|
+
'strong',
|
|
120
|
+
'em',
|
|
121
|
+
'b',
|
|
122
|
+
'i',
|
|
123
|
+
'u',
|
|
124
|
+
's',
|
|
125
|
+
'del',
|
|
126
|
+
'ins'
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
// ─────────────────────────────────────────────────────────────────
|
|
130
|
+
// Core Primitive
|
|
131
|
+
// ─────────────────────────────────────────────────────────────────
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Create a semantic HTML element with validation
|
|
135
|
+
*
|
|
136
|
+
* SSOT for _zHTML (container-level) and semantic (event-level).
|
|
137
|
+
*
|
|
138
|
+
* Security:
|
|
139
|
+
* - Validates tagName against VALID_SEMANTIC_ELEMENTS
|
|
140
|
+
* - Prevents XSS via script/iframe/embed injection
|
|
141
|
+
* - Falls back to 'div' for invalid/dangerous elements
|
|
142
|
+
*
|
|
143
|
+
* @param {string} tagName - Desired HTML element type
|
|
144
|
+
* @param {Object} [attributes={}] - HTML attributes (id, class, data-*, aria-*, etc.)
|
|
145
|
+
* @param {Object} [logger=null] - Optional logger for debugging
|
|
146
|
+
* @returns {HTMLElement} The created element (or div fallback)
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* // Valid semantic element
|
|
150
|
+
* const form = createSemanticElement('form', { id: 'login' });
|
|
151
|
+
*
|
|
152
|
+
* // Invalid element → fallback to div
|
|
153
|
+
* const safe = createSemanticElement('script', {}); // → <div>
|
|
154
|
+
*
|
|
155
|
+
* // With logger (for debugging)
|
|
156
|
+
* const element = createSemanticElement('iframe', {}, console);
|
|
157
|
+
* // Logs warning: "Invalid semantic element: iframe, falling back to div"
|
|
158
|
+
*/
|
|
159
|
+
export function createSemanticElement(tagName, attributes = {}, logger = null) {
|
|
160
|
+
// Normalize tagName (lowercase, trim whitespace)
|
|
161
|
+
const normalizedTag = (tagName || '').toLowerCase().trim();
|
|
162
|
+
|
|
163
|
+
// Validate against allowlist
|
|
164
|
+
const isValid = VALID_SEMANTIC_ELEMENTS.includes(normalizedTag);
|
|
165
|
+
|
|
166
|
+
// Fallback to div for invalid/dangerous elements
|
|
167
|
+
const safeTag = isValid ? normalizedTag : 'div';
|
|
168
|
+
|
|
169
|
+
// Log warning if fallback occurred
|
|
170
|
+
if (!isValid && logger) {
|
|
171
|
+
logger.warn(`[SemanticElementPrimitive] Invalid semantic element: "${tagName}", falling back to div`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Create element
|
|
175
|
+
const element = createElement(safeTag);
|
|
176
|
+
|
|
177
|
+
// Apply attributes
|
|
178
|
+
if (Object.keys(attributes).length > 0) {
|
|
179
|
+
setAttributes(element, attributes);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return element;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ─────────────────────────────────────────────────────────────────
|
|
186
|
+
// Helper: Language-Specific Pre Elements
|
|
187
|
+
// ─────────────────────────────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Create a <pre><code> element for syntax highlighting
|
|
191
|
+
*
|
|
192
|
+
* Handles semantic: pre-html, pre-css, pre-zolo, etc.
|
|
193
|
+
* Creates <pre><code class="language-xxx">...</code></pre> structure for Prism.js
|
|
194
|
+
*
|
|
195
|
+
* @param {string} language - Language identifier (html, css, zolo, js, etc.)
|
|
196
|
+
* @param {string} content - Code content
|
|
197
|
+
* @param {Object} [attributes={}] - HTML attributes for <pre> element
|
|
198
|
+
* @returns {HTMLElement} Pre element with nested code element
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* const codeBlock = createLanguagePre('zolo', 'zMain:\n zDisplay:\n event: text', { class: 'code-block' });
|
|
202
|
+
*/
|
|
203
|
+
export function createLanguagePre(language, content, attributes = {}) {
|
|
204
|
+
const pre = createSemanticElement('pre', attributes);
|
|
205
|
+
const code = createElement('code');
|
|
206
|
+
code.className = `zFont-mono language-${language}`;
|
|
207
|
+
code.textContent = content;
|
|
208
|
+
pre.appendChild(code);
|
|
209
|
+
|
|
210
|
+
// Trigger Prism highlighting if available
|
|
211
|
+
if (typeof window !== 'undefined' && window.Prism) {
|
|
212
|
+
window.Prism.highlightElement(code);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return pre;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ─────────────────────────────────────────────────────────────────
|
|
219
|
+
// Default Export
|
|
220
|
+
// ─────────────────────────────────────────────────────────────────
|
|
221
|
+
|
|
222
|
+
export default {
|
|
223
|
+
createSemanticElement,
|
|
224
|
+
createLanguagePre,
|
|
225
|
+
VALID_SEMANTIC_ELEMENTS
|
|
226
|
+
};
|