Skip to content

Commit 2646c7b

Browse files
committed
Reactive Mastro fixes
1 parent d62389c commit 2646c7b

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"exports": {
55
".": "./src/core/index.ts",
66
"./generator": "./src/generator.ts",
7+
"./html": "./src/core/html.ts",
78
"./server": "./src/server.ts"
89
},
910
"compilerOptions": {

examples/reactive-mastro/components/Layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const Layout = (props: Props) =>
1616
<script type="importmap">
1717
{
1818
"imports": {
19-
"mastro/reactive": "https://esm.sh/jsr/@mastrojs/[email protected].0?bundle"
19+
"@mastrojs/reactive": "https://esm.sh/jsr/@mastrojs/[email protected].1?bundle"
2020
}
2121
}
2222
</script>

examples/reactive-mastro/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"compilerOptions": {
77
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
88
},
9-
"links": ["../../", "../../../reactive"]
9+
"links": ["../../"]
1010
}

src/core/html.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* This module contains a simple, selfcontained way to construct and properly escape
3+
* HTML using JavaScript tagged template literals.
4+
* It is exported separately for use in `@mastrojs/reactive`
5+
* @module
6+
*/
7+
18
/**
29
* HTML primitive values like strings and numbers.
310
*
@@ -59,9 +66,7 @@ export const html = (strings: TemplateStringsArray, ...params: Html[]): Html[] =
5966
* or React's `dangerouslySetInnerHTML`.
6067
*/
6168
export const unsafeInnerHtml = (str: string): Html =>
62-
// we're using a string object to mark something as HTML
63-
// (as opposed to a string that still needs to be escaped)
64-
// we could also use a plain object like `{ type: 'html', str }`
69+
// Alternatively, we could also use a plain object like `{ type: 'html', str }`
6570
// but the String object's `.toString()` and `.valueOf()` behaviour are handy.
6671
new String(str);
6772

0 commit comments

Comments
 (0)