@matthesketh/utopia-compiler 0.7.0 → 0.7.1
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/dist/index.cjs +10 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -1
- package/package.json +5 -5
- package/LICENSE +0 -21
package/dist/index.cjs
CHANGED
|
@@ -418,7 +418,7 @@ function classifyDirective(name, value) {
|
|
|
418
418
|
return null;
|
|
419
419
|
}
|
|
420
420
|
function isDirectiveKind(s) {
|
|
421
|
-
return s === "on" || s === "bind" || s === "if" || s === "else" || s === "else-if" || s === "for" || s === "model" || s === "transition";
|
|
421
|
+
return s === "on" || s === "bind" || s === "if" || s === "else" || s === "else-if" || s === "for" || s === "model" || s === "html" || s === "transition";
|
|
422
422
|
}
|
|
423
423
|
var CodeGenerator = class {
|
|
424
424
|
constructor(options) {
|
|
@@ -547,6 +547,9 @@ ${fnBody}
|
|
|
547
547
|
case "model":
|
|
548
548
|
this.genModel(elVar, dir, scope);
|
|
549
549
|
break;
|
|
550
|
+
case "html":
|
|
551
|
+
this.genHtml(elVar, dir, scope);
|
|
552
|
+
break;
|
|
550
553
|
case "transition":
|
|
551
554
|
this.genTransition(elVar, dir);
|
|
552
555
|
break;
|
|
@@ -598,6 +601,12 @@ ${fnBody}
|
|
|
598
601
|
this.emit(`createEffect(() => setAttr(${elVar}, 'value', ${signalRef}()))`);
|
|
599
602
|
this.emit(`addEventListener(${elVar}, 'input', (e) => ${signalRef}.set(e.target.value))`);
|
|
600
603
|
}
|
|
604
|
+
// ---- u-html ---------------------------------------------------------------
|
|
605
|
+
genHtml(elVar, dir, scope) {
|
|
606
|
+
this.helpers.add("setHtml");
|
|
607
|
+
const expr = this.resolveExpression(dir.expression, scope);
|
|
608
|
+
this.emit(`setHtml(${elVar}, () => ${expr})`);
|
|
609
|
+
}
|
|
601
610
|
// ---- u-transition ---------------------------------------------------------
|
|
602
611
|
genTransition(elVar, dir) {
|
|
603
612
|
this.helpers.add("createTransition");
|
package/dist/index.d.cts
CHANGED
|
@@ -85,7 +85,7 @@ interface Directive {
|
|
|
85
85
|
expression: string;
|
|
86
86
|
modifiers: string[];
|
|
87
87
|
}
|
|
88
|
-
type DirectiveKind = 'on' | 'bind' | 'if' | 'else' | 'else-if' | 'for' | 'model' | 'transition';
|
|
88
|
+
type DirectiveKind = 'on' | 'bind' | 'if' | 'else' | 'else-if' | 'for' | 'model' | 'html' | 'transition';
|
|
89
89
|
/** Exported for testing — parse a template string into an AST. */
|
|
90
90
|
declare function parseTemplate(source: string): TemplateNode[];
|
|
91
91
|
|
package/dist/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ interface Directive {
|
|
|
85
85
|
expression: string;
|
|
86
86
|
modifiers: string[];
|
|
87
87
|
}
|
|
88
|
-
type DirectiveKind = 'on' | 'bind' | 'if' | 'else' | 'else-if' | 'for' | 'model' | 'transition';
|
|
88
|
+
type DirectiveKind = 'on' | 'bind' | 'if' | 'else' | 'else-if' | 'for' | 'model' | 'html' | 'transition';
|
|
89
89
|
/** Exported for testing — parse a template string into an AST. */
|
|
90
90
|
declare function parseTemplate(source: string): TemplateNode[];
|
|
91
91
|
|
package/dist/index.js
CHANGED
|
@@ -385,7 +385,7 @@ function classifyDirective(name, value) {
|
|
|
385
385
|
return null;
|
|
386
386
|
}
|
|
387
387
|
function isDirectiveKind(s) {
|
|
388
|
-
return s === "on" || s === "bind" || s === "if" || s === "else" || s === "else-if" || s === "for" || s === "model" || s === "transition";
|
|
388
|
+
return s === "on" || s === "bind" || s === "if" || s === "else" || s === "else-if" || s === "for" || s === "model" || s === "html" || s === "transition";
|
|
389
389
|
}
|
|
390
390
|
var CodeGenerator = class {
|
|
391
391
|
constructor(options) {
|
|
@@ -514,6 +514,9 @@ ${fnBody}
|
|
|
514
514
|
case "model":
|
|
515
515
|
this.genModel(elVar, dir, scope);
|
|
516
516
|
break;
|
|
517
|
+
case "html":
|
|
518
|
+
this.genHtml(elVar, dir, scope);
|
|
519
|
+
break;
|
|
517
520
|
case "transition":
|
|
518
521
|
this.genTransition(elVar, dir);
|
|
519
522
|
break;
|
|
@@ -565,6 +568,12 @@ ${fnBody}
|
|
|
565
568
|
this.emit(`createEffect(() => setAttr(${elVar}, 'value', ${signalRef}()))`);
|
|
566
569
|
this.emit(`addEventListener(${elVar}, 'input', (e) => ${signalRef}.set(e.target.value))`);
|
|
567
570
|
}
|
|
571
|
+
// ---- u-html ---------------------------------------------------------------
|
|
572
|
+
genHtml(elVar, dir, scope) {
|
|
573
|
+
this.helpers.add("setHtml");
|
|
574
|
+
const expr = this.resolveExpression(dir.expression, scope);
|
|
575
|
+
this.emit(`setHtml(${elVar}, () => ${expr})`);
|
|
576
|
+
}
|
|
568
577
|
// ---- u-transition ---------------------------------------------------------
|
|
569
578
|
genTransition(elVar, dir) {
|
|
570
579
|
this.helpers.add("createTransition");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matthesketh/utopia-compiler",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Compiler for .utopia single-file components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@matthesketh/utopia-core": "0.7.0"
|
|
43
|
-
},
|
|
44
41
|
"scripts": {
|
|
45
42
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
46
43
|
"dev": "tsup src/index.ts --format esm,cjs --dts --watch"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@matthesketh/utopia-core": "^0.7.0"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Matt Hesketh
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|