Framework updates

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-03-12 19:09:07 +00:00
parent 3294fc7337
commit daa9bb2fb1
47 changed files with 2495 additions and 525 deletions

View File

@@ -524,8 +524,9 @@ For mechanical thinkers who see structure, not visuals. Write `<User_Card>` not
**Interpolation**: `<%= escaped %>` | `<%!= unescaped %>` | `<%br= newlines %>` | `<% javascript %>`
**Conditional Attributes** `<input <% if (this.args.required) { %>required="required"<% } %> />`
**Child Content**: `<%= content() %>` - Renders whatever the caller puts between opening/closing tags. Essential for wrapper components: `<Define:Card tag="div" class="card"><%= content() %></Define:Card>` then `<Card><p>Hello</p></Card>`. Distinct from named `<Slot:name>` — content() is the default/unnamed slot.
**Inline Logic**: `<% this.handler = () => action(); %>` then `@click=this.handler` - No JS file needed for simple components
**Event Handlers**: `@click=this.method` (unquoted) - Methods defined inline or in companion .js
**Event Handlers**: `@click=this.method` (unquoted) - Methods defined inline or in companion .js. **Placement**: works on child HTML elements inside the template (`<button @click=this.handler>`), does NOT work on `<Define>` itself (Define attributes are component args, not DOM attributes). To bind the root element: `<% this.$.click(() => { ... }); %>` in an inline `<% %>` block.
**Validation**: `<% if (!this.args.required) throw new Error('Missing arg'); %>` - Fail loud in template
### Simple Components (No JS File)
@@ -732,6 +733,8 @@ this.$sid('result_container').component('My_Component', {
- `this.state` for UI state, `this.args` + `reload()` for refetch
- `Controller.method()` not `$.ajax()` - #[Ajax_Endpoint] auto-callable
- `on_create/render/stop` sync; `this.sid()` → component, `$(el).component()` → component
- `@click` goes on child elements, NOT on `<Define>` — for root element clicks use `<% this.$.click(() => {}); %>`
- Wrapper components use `<%= content() %>` to render caller's child content
---
@@ -754,6 +757,15 @@ Pattern recognition:
Built-in dialogs: `Modal.alert()`, `Modal.confirm()`, `Modal.prompt()`, `Modal.select()`, `Modal.error()`.
**ARGUMENT OVERLOADING**: 1 arg = body only (default title). 2+ args = first arg is TITLE, second is BODY. Easy to get backwards.
```javascript
await Modal.alert('Message'); // body only (title defaults)
await Modal.alert('Title', 'Message body'); // title + body
await Modal.confirm('Delete this?'); // body only
await Modal.confirm('Delete', 'Are you sure?'); // title + body
```
Form modals: `Modal.form({title, component, on_submit})` - component must implement `vals()`.
Reusable modals: Extend `Modal_Abstract`, implement static `show()`.