Skip to content

Commit 7fb0b33

Browse files
feat: enable $ binding inside ::attrs with proper render order
- Apply renderTemplate before assigning DOM attributes - Fix $ state binding for input value, placeholder, boolean attrs - Normalize attrs handling across properties and attributes - Complete attrs rendering pipeline in NeoCore This enables reactive attribute binding using $ syntax and fixes incorrect raw value assignment.
1 parent e374762 commit 7fb0b33

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

MyNeoApp/core/NeoCore.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ export class NeoCore {
88
}
99

1010
if (data.attrs && typeof data.attrs === 'object') {
11-
for (const [key, value] of Object.entries(data.attrs)) {
11+
for (const [key, rawValue] of Object.entries(data.attrs)) {
1212

13-
// boolean attr
14-
if (typeof value === 'boolean') {
15-
el[key] = value;
13+
// ⭐ 핵심: 먼저 렌더링
14+
const value = NeoCore.renderTemplate(String(rawValue));
15+
16+
// boolean attribute
17+
if (value === 'true' || value === 'false') {
18+
el[key] = value === 'true';
1619
continue;
1720
}
1821

19-
// input 관련 핵심 property
22+
// input / textarea / select property
2023
if (
2124
el instanceof HTMLInputElement ||
2225
el instanceof HTMLTextAreaElement ||
@@ -28,8 +31,8 @@ export class NeoCore {
2831
}
2932
}
3033

31-
// fallback: 일반 attribute
32-
el.setAttribute(key, String(value));
34+
// fallback attribute
35+
el.setAttribute(key, value);
3336
}
3437
}
3538

MyNeoApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@junnyontop-pixel/neo-app",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "나만의 커스텀 프레임워크 Neo",
55
"main": "core/NeoCore.js",
66
"type": "module",

MyNeoApp/src/App.neo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@input:input [hello] {
2828
::attrs: {
2929
type: "text",
30-
placeholder: "Neo"
30+
placeholder: $Store.count
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)