Skip to content

Commit

Permalink
$mol_task bases $mol_dom_jsx. Bundle relative $mol_file base.
Browse files Browse the repository at this point in the history
  • Loading branch information
nin--jin committed Dec 6, 2017
1 parent f121e84 commit a2e9ac8
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/bench/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">

<script src="-/web.js"></script>
<script src="bench/-/web.js"></script>
<link rel="stylesheet" href="-/web.css" />

<body mol_view_root="$mol_app_bench">
2 changes: 1 addition & 1 deletion app/bench/list/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
} ,
'tsx' : {
title : { 'en' : '$mol_dom_jsx' } ,
weight : '2.8 KB' ,
weight : '3.4 KB' ,
} ,
'react' : {
title : { 'en' : 'ReactJS 16.0.0' } ,
Expand Down
2 changes: 1 addition & 1 deletion app/bench/list/tsx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace $ {
this.render()
}

@ $mol_task
static render() {
return (
<div id="list" className="list">
Expand All @@ -36,7 +37,6 @@ namespace $ {
<div
id={ 'list-item#' + item.id + '-content' }
className="list-item-content"
childNodes={[ item.content ]}
>
{ item.content }
</div>
Expand Down
8 changes: 4 additions & 4 deletions app/quine/quine.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $mol_app_quine $mol_page
text <= content \
-
paths /
\-/mol/app/quine/quine.view.tree
\-/mol/app/quine/quine.view.ts
\-/mol/app/quine/index.html
\-/mol/app/quine/quine.locale=ru.json
\mol/app/quine/quine.view.tree
\mol/app/quine/quine.view.ts
\mol/app/quine/index.html
\mol/app/quine/quine.locale=ru.json
5 changes: 3 additions & 2 deletions dom/jsx/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ namespace JSX {

namespace $ {

export function $mol_dom_jsx< Props >(
export const $mol_dom_jsx = $mol_task_wrap( function $mol_dom_jsx< Props >(
Elem : string | { ( props : Props ) : Element } | { new( props : Props ) : { render() : Element } } ,
props : Props ,
...children : Array< Node | string >
) {

let node : Element
if( typeof Elem === 'string' ) {

Expand All @@ -33,6 +34,6 @@ namespace $ {
}

return node
}
} )

}
7 changes: 3 additions & 4 deletions file/file.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ namespace $ {
}

static relative( path : string ) : $mol_file {
const resolver = $mol_dom_context.document.createElement( 'a' )
resolver.href = path

return this.absolute( resolver.href )
return this.absolute( new URL( path , this.base ).toString() )
}

static base = new URL( '.' , document.currentScript['src'] ).toString()

path() {
return '.'
Expand Down
2 changes: 1 addition & 1 deletion locale/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace $ {

@ $mol_mem_key
static source( lang : string ) {
return JSON.parse( $mol_file.relative( `-/web.locale=${ lang }.json` ).content() )
return JSON.parse( $mol_file.relative( `web.locale=${ lang }.json` ).content() )
}

@ $mol_mem_key
Expand Down

0 comments on commit a2e9ac8

Please sign in to comment.