Skip to content

Commit

Permalink
$mol_view_tree2 additional hyoo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Dec 16, 2023
1 parent 38cb483 commit 5d7f5db
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions http/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ namespace $ {
}

@ $mol_mem
json< Content >( next? : Content , force? : $mol_mem_force ) : Content {
json< Content >( next? : Content , force? : $mol_mem_force ) {
const next2 = next && JSON.stringify( next , null , '\t' )
return this.response( next2 , force ).json()
return this.response( next2 , force ).json() as Content
}

}
Expand Down
6 changes: 3 additions & 3 deletions image/image.view.tree
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
$mol_image $mol_view
dom_name \img
field *
field *any
^
src <= uri \
alt <= title
loading <= loading \eager
decoding <= decoding \async
crossOrigin <= cors null
attr *
attr *any
^
width <= natural_width? 0
height <= natural_height? 0
event *
event *any
load? <=> load? null
minimal_width 16
minimal_height 16
2 changes: 1 addition & 1 deletion state/shared/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ namespace $ {
send( key: string, next?: readonly $hyoo_crowd_chunk[] ) {

const socket = this.socket()
$mol_wire_sync( this ).wait_connection()
$mol_wire_sync( this ).wait_connection()/* */

if( socket.readyState !== socket.OPEN ) return

Expand Down
9 changes: 8 additions & 1 deletion view/tree2/to/dts/dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ namespace $ {

const val = prop.hack({

'null': val => val.kids[0]?.value ? [ val.kids[0], val.data( ' | null' ) ]: [ val.data( 'any' ) ],
'null': val => {
const kid = val.kids[0]
const kid_data = kid?.type ? kid.data(kid.type) : undefined

return kid_data
? [ kid_data, val.data( ' | null' ) ]
: [ val.data( 'any' ) ]
},

'true': val => [ val.data( 'boolean' ) ],
'false': val => [ val.data( 'boolean' ) ],
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/js/test/ex/simple_typed_null.view.tree
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$mol_view_tree2_to_js_test_ex_simple_typed_null_foo $mol_object
a null \string|number
a null string|number
2 changes: 2 additions & 0 deletions view/tree2/to/js/test/js.simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace $ {
const _foo = $mol_view_tree2_to_js_test_ex_simple_mutable_and_read_only_foo

const foo = _foo.make({ $ })

type assert_ro = $mol_type_assert<ReturnType<typeof foo['readonly']>, any>

$mol_assert_equal(
foo.readonly(),
Expand Down
4 changes: 2 additions & 2 deletions webdav/webdav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace $ {
const data = {} as { [ uri : string ] : Element }

for( let response of responses ) {
const uri = this.resolve( response.querySelector( 'href' ).textContent ).uri()
const uri = this.resolve( response.querySelector( 'href' )?.textContent ?? '' ).uri()

data[ uri ] = response
}
Expand Down Expand Up @@ -86,7 +86,7 @@ namespace $ {
}

prop( prop: string ) {
return this.data_self()[ this.uri() ].querySelector( prop ).textContent
return this.data_self()[ this.uri() ]?.querySelector( prop )?.textContent
}

type() {
Expand Down

0 comments on commit 5d7f5db

Please sign in to comment.