Files
rspade_system/node_modules/@jqhtml/parser/dist/integration.js
root 77b4d10af8 Refactor filename naming system and apply convention-based renames
Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 19:10:02 +00:00

47 lines
2.0 KiB
JavaScript

// JQHTML v2 Template Integration
// Connects compiled templates to Component class
/// <reference path="./types.d.ts" />
import { process_instructions, html, register_template } from './runtime.js';
// Mixin to add template support to any component
export function with_template(ComponentClass, template_name) {
const original_on_render = ComponentClass.prototype.on_render;
ComponentClass.prototype.on_render = async function () {
// Get compiled template from registry
const global_obj = typeof window !== 'undefined' ? window : global;
const template_map = global_obj.jqhtml_components;
if (!template_map || !template_map.has(template_name)) {
throw new Error(`Template not found: ${template_name}`);
}
const template_info = template_map.get(template_name);
const render_fn = template_info.render;
// Call render function with component context
const [instructions] = render_fn.call(this, this.constructor, this.data, this.args, {});
// Process instructions into DOM
const rendered = process_instructions(instructions, this);
// Clear and append to component element
this.$.empty().append(rendered);
// Call original on_render if it exists
if (original_on_render) {
await original_on_render.call(this);
}
};
return ComponentClass;
}
// Register templates from compiled module
export function register_compiled_templates(template_map) {
// Store on global object for now (MVP approach)
const global_obj = typeof window !== 'undefined' ? window : global;
global_obj.jqhtml_components = template_map;
// Also register each template
for (const [name, info] of template_map) {
register_template(name, info.render);
}
}
// Make html function available globally for templates
if (typeof window !== 'undefined') {
window.html = html;
}
else if (typeof global !== 'undefined') {
global.html = html;
}
//# sourceMappingURL=integration.js.map