Add model constant export to JS, rsxapp hydration, on_stop lifecycle

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-10 09:08:20 +00:00
parent 611e269465
commit d047b49d39
58 changed files with 207 additions and 58 deletions

View File

@@ -4,7 +4,7 @@ import { IdeBridgeClient } from './ide_bridge_client';
/**
* JQHTML lifecycle methods that are called automatically by the framework
*/
const JQHTML_LIFECYCLE_METHODS = ['on_render', 'on_create', 'on_load', 'on_ready', 'on_destroy', 'cache_id'];
const JQHTML_LIFECYCLE_METHODS = ['on_render', 'on_create', 'on_load', 'on_ready', 'on_stop', 'cache_id'];
/**
* Convention methods that are called automatically by the RSX framework
@@ -29,7 +29,7 @@ const LIFECYCLE_DOCS: { [key: string]: string } = {
on_create: 'Quick setup after DOM exists. Children complete before parent. DOM manipulation allowed. MUST be synchronous.',
on_load: 'Data loading phase - fetch async data. NO DOM manipulation allowed, only update `this.data`. Template re-renders after load. MUST be async.',
on_ready: 'Final setup phase - all data loaded. Children complete before parent. DOM manipulation allowed. Can be sync or async.',
on_destroy: 'Component destruction phase - cleanup resources. Called before component is removed. MUST be synchronous.',
on_stop: 'Component destruction phase - cleanup resources. Called before component is removed. MUST be synchronous.',
cache_id: 'Returns a unique cache key for this component instance. Used by framework to cache/restore component state. Return null to disable caching.',
};
@@ -299,7 +299,7 @@ export class JqhtmlLifecycleHoverProvider implements vscode.HoverProvider {
const is_async = is_async_method(line);
// Determine if async is required, forbidden, or optional
const must_be_sync = ['on_create', 'on_render', 'on_destroy'].includes(word);
const must_be_sync = ['on_create', 'on_render', 'on_stop'].includes(word);
const must_be_async = word === 'on_load';
const can_be_either = word === 'on_ready';
@@ -440,11 +440,11 @@ export class JqhtmlLifecycleDiagnosticProvider {
vscode.DiagnosticSeverity.Error
)
);
} else if (method_name === 'on_destroy' && is_async) {
} else if (method_name === 'on_stop' && is_async) {
diagnostics.push(
new vscode.Diagnostic(
method_name_range,
`'on_destroy' must be synchronous - remove 'async' keyword`,
`'on_stop' must be synchronous - remove 'async' keyword`,
vscode.DiagnosticSeverity.Error
)
);