diff --git a/audio/demo/vibe/vibe.web.view.tree b/audio/demo/vibe/vibe.web.view.tree index 2676dbc9c1f..ddb8a6317ee 100644 --- a/audio/demo/vibe/vibe.web.view.tree +++ b/audio/demo/vibe/vibe.web.view.tree @@ -28,7 +28,7 @@ $mol_audio_demo_vibe $mol_example_small Filter null value? <=> shape? null options /$mol_audio_vibe_shape - \sine + \sine \square \sawtooth \triangle diff --git a/drag/drag.view.ts b/drag/drag.view.ts index 0828ee6f748..250350e3c98 100644 --- a/drag/drag.view.ts +++ b/drag/drag.view.ts @@ -14,7 +14,7 @@ namespace $.$$ { const transfer = this.transfer() for( let type in transfer ) { - event.dataTransfer!.setData( type , transfer[ type ] ) + event.dataTransfer!.setData( type , transfer[ type as keyof typeof transfer] ) } event.dataTransfer!.setDragImage( this.image() , 0 , -32 ) diff --git a/map/yandex/mark/mark.view.tree b/map/yandex/mark/mark.view.tree index 7c73494e432..664567bc5d5 100644 --- a/map/yandex/mark/mark.view.tree +++ b/map/yandex/mark/mark.view.tree @@ -1,12 +1,12 @@ $mol_map_yandex_mark $mol_object - pos $mol_vector_2d / + pos $mol_vector_2d / 0 0 - box $mol_vector_2d / - <= box_lat $mol_vector_range / + box $mol_vector_2d<$mol_vector_range> / + <= box_lat $mol_vector_range / 0 0 - <= box_lon $mol_vector_range / + <= box_lon $mol_vector_range / 0 0 hint \ diff --git a/plot/graph/graph.view.tree b/plot/graph/graph.view.tree index 1df249eb83a..9a0aa229e8e 100644 --- a/plot/graph/graph.view.tree +++ b/plot/graph/graph.view.tree @@ -10,11 +10,11 @@ $mol_plot_graph $mol_svg_group ^ color <= color \ - - viewport $mol_vector_2d / - <= viewport_x $mol_vector_range / + viewport $mol_vector_2d<$mol_vector_range> / + <= viewport_x $mol_vector_range / Infinity -Infinity - <= viewport_y $mol_vector_range / + <= viewport_y $mol_vector_range / Infinity -Infinity shift /number @@ -23,31 +23,31 @@ $mol_plot_graph $mol_svg_group scale /number 1 1 - cursor_position $mol_vector_2d / + cursor_position $mol_vector_2d / NaN NaN - dimensions_pane $mol_vector_2d / - <= dimensions_pane_x $mol_vector_range / + dimensions_pane $mol_vector_2d<$mol_vector_range> / + <= dimensions_pane_x $mol_vector_range / Infinity -Infinity - <= dimensions_pane_y $mol_vector_range / + <= dimensions_pane_y $mol_vector_range / Infinity -Infinity - dimensions $mol_vector_2d / - <= dimensions_x $mol_vector_range / + dimensions $mol_vector_2d<$mol_vector_range> / + <= dimensions_x $mol_vector_range / Infinity -Infinity - <= dimensions_y $mol_vector_range / + <= dimensions_y $mol_vector_range / Infinity -Infinity - size_real $mol_vector_2d / + size_real $mol_vector_2d / 0 0 - gap $mol_vector_2d / - <= gap_x $mol_vector_range / + gap $mol_vector_2d<$mol_vector_range> / + <= gap_x $mol_vector_range / 0 0 - <= gap_y $mol_vector_range / + <= gap_y $mol_vector_range / 0 0 repos_x* 0 diff --git a/plot/mark/cross/cross.view.tree b/plot/mark/cross/cross.view.tree index a4ac9f4656d..f33d045b2c3 100644 --- a/plot/mark/cross/cross.view.tree +++ b/plot/mark/cross/cross.view.tree @@ -4,11 +4,11 @@ $mol_plot_mark_cross $mol_plot_graph title_y_gap 22 threshold 16 graphs /$mol_plot_graph - dimensions $mol_vector_2d / - <= dimensions_x $mol_vector_range / + dimensions $mol_vector_2d<$mol_vector_range> / + <= dimensions_x $mol_vector_range / Infinity -Infinity - <= dimensions_y $mol_vector_range / + <= dimensions_y $mol_vector_range / Infinity -Infinity sub / diff --git a/plot/pane/pane.view.tree b/plot/pane/pane.view.tree index 1eb76334618..6a1569fa965 100644 --- a/plot/pane/pane.view.tree +++ b/plot/pane/pane.view.tree @@ -10,60 +10,60 @@ $mol_plot_pane $mol_svg_root gap_right <= gap_hor gap_top <= gap_vert gap_bottom <= gap_vert - gap $mol_vector_2d / - <= gap_x $mol_vector_range / + gap $mol_vector_2d<$mol_vector_range> / + <= gap_x $mol_vector_range / <= gap_left <= gap_right - <= gap_y $mol_vector_range / + <= gap_y $mol_vector_range / <= gap_bottom <= gap_top - - shift_limit $mol_vector_2d / - <= shift_limit_x $mol_vector_range / + shift_limit $mol_vector_2d<$mol_vector_range> / + <= shift_limit_x $mol_vector_range / 0 0 - <= shift_limit_y $mol_vector_range / + <= shift_limit_y $mol_vector_range / 0 0 - shift_default $mol_vector_2d / + shift_default $mol_vector_2d / 0 0 - shift? $mol_vector_2d / + shift? $mol_vector_2d / 0 0 - scale_limit $mol_vector_2d / - <= scale_limit_x $mol_vector_range / + scale_limit $mol_vector_2d<$mol_vector_range> / + <= scale_limit_x $mol_vector_range / 0 Infinity - <= scale_limit_y $mol_vector_range / + <= scale_limit_y $mol_vector_range / 0 -Infinity - scale_default $mol_vector_2d / + scale_default $mol_vector_2d / 0 0 - scale? $mol_vector_2d / + scale? $mol_vector_2d / 1 -1 scale_x? 1 scale_y? -1 - size $mol_vector_2d / + size $mol_vector_2d / 0 0 - size_real $mol_vector_2d / + size_real $mol_vector_2d / 1 1 - dimensions $mol_vector_2d / - <= dimensions_x $mol_vector_range / + dimensions $mol_vector_2d<$mol_vector_range> / + <= dimensions_x $mol_vector_range / Infinity -Infinity - <= dimensions_y $mol_vector_range / + <= dimensions_y $mol_vector_range / Infinity -Infinity - dimensions_viewport $mol_vector_2d / - <= dimensions_viewport_x $mol_vector_range / + dimensions_viewport $mol_vector_2d<$mol_vector_range> / + <= dimensions_viewport_x $mol_vector_range / Infinity -Infinity - <= dimensions_viewport_y $mol_vector_range / + <= dimensions_viewport_y $mol_vector_range / Infinity -Infinity - diff --git a/plot/ruler/ruler.view.tree b/plot/ruler/ruler.view.tree index 4a487aca6ad..f9d00575c61 100644 --- a/plot/ruler/ruler.view.tree +++ b/plot/ruler/ruler.view.tree @@ -3,10 +3,10 @@ $mol_plot_ruler $mol_plot_graph scale_axis 1 scale_step 1 shift_axis 1 - dimensions_axis $mol_vector_range / + dimensions_axis $mol_vector_range / Infinity -Infinity - viewport_axis $mol_vector_range / + viewport_axis $mol_vector_range / Infinity -Infinity axis_points /number diff --git a/select/list/demo/demo.view.tree b/select/list/demo/demo.view.tree index 27b3772f75f..a5f944470a8 100644 --- a/select/list/demo/demo.view.tree +++ b/select/list/demo/demo.view.tree @@ -5,7 +5,7 @@ $mol_select_list_demo $mol_example_small rows / <= Friends $mol_select_list value? <=> friends? / - dictionary <= suggestions * + dictionary <= suggestions *string jocker \Jocker harley \Harley Quinn penguin \Penguin diff --git a/textarea/textarea.view.tree b/textarea/textarea.view.tree index 665176e7b2c..7c50e358b77 100644 --- a/textarea/textarea.view.tree +++ b/textarea/textarea.view.tree @@ -23,7 +23,7 @@ $mol_textarea $mol_stack row_numb* <= row_numb* 0 sidebar_showed <= sidebar_showed highlight <= highlight \ - symbols_alt * + symbols_alt *string comma \< period \> dash \− @@ -46,9 +46,9 @@ $mol_textarea $mol_stack bracketOpen \[ bracketClose \] slashBack \| - symbols_alt_ctrl * + symbols_alt_ctrl *string space \  - symbols_alt_shift * + symbols_alt_shift *string V \✅ X \❌ O \⭕ diff --git a/touch/touch.view.tree b/touch/touch.view.tree index 30f73b50104..77164136514 100644 --- a/touch/touch.view.tree +++ b/touch/touch.view.tree @@ -6,17 +6,17 @@ $mol_touch $mol_plugin allow_pan true allow_zoom true action_type? \ - action_point? $mol_vector_2d / + action_point? $mol_vector_2d / NaN NaN - start_pan? / 0 0 - pan? $mol_vector_2d / + pan? $mol_vector_2d / 0 0 - pointer_center $mol_vector_2d / + pointer_center $mol_vector_2d / NaN NaN - diff --git a/video/camera/camera.view.ts b/video/camera/camera.view.ts index 79aa65b925d..639b0cc33e2 100644 --- a/video/camera/camera.view.ts +++ b/video/camera/camera.view.ts @@ -35,10 +35,10 @@ namespace $.$$ { } - } else if( settings[ param ] !== null ) { + } else if( settings[ param as keyof typeof settings ] !== null ) { try { - track.applyConstraints({ [ param ]: settings[ param ] }) + track.applyConstraints({ [ param ]: settings[ param as keyof typeof settings ] }) } catch( error ) { $mol_fail_log( error ) } diff --git a/view/tree2/to/dts/dts.ts b/view/tree2/to/dts/dts.ts index c698d76c149..1db0c74a7b2 100644 --- a/view/tree2/to/dts/dts.ts +++ b/view/tree2/to/dts/dts.ts @@ -190,44 +190,44 @@ namespace $ { } if( input.type[0] === '/' ) { - const dups = new Set() - - const infered = input.kids.map( (kid, index) => { - const result = kid.hack_self(belt, context) as $mol_tree2[] - const val = result[0].value + const array_type = [ + input.type.length > 1 + ? input.data(input.type.slice(1)) + : input.data('any') + ] - if (val === 'number' || val === 'string' || val === 'boolean') { - if (dups.has(val)) return [] - dups.add(val) - } + if (array_type[0].value === 'any') { + return readonly_arr.call(this, input, array_type) + } - if (index !== 0) result.unshift(kid.data('| ')) - if (kid.type[0] === '^') result.push((kid.kids[0] ?? prop).data('[number]')) + for (const kid of input.kids) { + let result = kid.hack_self(belt, context) as $mol_tree2[] - return kid.struct('line', result) - } ) + const val = result[0].value - const array_type = input.type.length > 1 ? input.data(input.type.slice(1)) : undefined + if (val === 'string') { + result = kid.value.includes('`') + ? [ kid.data(JSON.stringify(kid.value))] + : [ kid.data('`'), kid , kid.data('`') ] + } else if (val === 'boolean') result = [ kid.data(kid.type) ] + else if (kid.type[0] === '^') { + result.push((kid.kids[0] ?? prop).data('[number]')) + } else continue - if (infered.length && array_type) { types.push( type_enforce.call( this, input.data(`${ klass.type }_${prop.type.replace(/[\?\*]*/g, '')}`), - readonly_arr.call(this, input, infered), - readonly_arr.call(this, input, [ array_type ]), + result, + array_type ) ) } - const result = array_type || ! infered.length - ? [ array_type ?? input.data('any') ] - : infered - - return readonly_arr.call(this, input, result) + return readonly_arr.call(this, input, array_type) } - if( input.type !== 'NaN' && /^[$A-Z]/.test( input.type ) ) { + if( input.type !== 'NaN' && input.type !== 'Infinity' && /^[$A-Z]/.test( input.type ) ) { const first = input.kids[0] if( first?.type[0] === '/' ) { @@ -241,7 +241,7 @@ namespace $ { types.push( type_enforce.call( this, - first.data(`${ input.type }`), + first.data(`${ input.type.replace(/<.*>$/, '') }`), [ first.data('[ '), ...args, diff --git a/view/tree2/to/js/js.ts b/view/tree2/to/js/js.ts index 6976126bd8d..437002cf695 100644 --- a/view/tree2/to/js/js.ts +++ b/view/tree2/to/js/js.ts @@ -223,7 +223,7 @@ namespace $ { input.data( '$' ), ]), input.struct('[]', [ - input.data( input.type ), + input.data( input.type.replace(/<.+>$/, '') ), ]), input.struct( '(,)', input.select( '/', null ).hack( belt ) ), ] ), diff --git a/view/tree2/to/js/test/ex/array_constructor_tuple.view.tree b/view/tree2/to/js/test/ex/array_constructor_tuple.view.tree index 8341bb8c61e..c76b9b077e2 100644 --- a/view/tree2/to/js/test/ex/array_constructor_tuple.view.tree +++ b/view/tree2/to/js/test/ex/array_constructor_tuple.view.tree @@ -1,6 +1,6 @@ $mol_view_tree2_to_js_test_ex_array_constructor_tuple_foo $mol_object blobs / - <= text_blob? $mol_view_tree2_to_js_test_ex_klass_tuple / + <= text_blob? $mol_view_tree2_to_js_test_ex_klass_tuple / /string <= text \123 * type \text/plain diff --git a/view/tree2/to/js/test/ex/array_union.view.tree b/view/tree2/to/js/test/ex/array_union.view.tree new file mode 100644 index 00000000000..b6b8e6e9b99 --- /dev/null +++ b/view/tree2/to/js/test/ex/array_union.view.tree @@ -0,0 +1,5 @@ +$mol_view_tree2_to_js_test_ex_array_union_foo $mol_object + bar /$mol_view_tree2_to_js_test_ex_klass_tuple_type + \a + <= foo \c + \b diff --git a/view/tree2/to/js/test/ex/klass.ts b/view/tree2/to/js/test/ex/klass.ts index 7bf525e6cde..7defd7909d3 100644 --- a/view/tree2/to/js/test/ex/klass.ts +++ b/view/tree2/to/js/test/ex/klass.ts @@ -1,7 +1,8 @@ namespace $ { + export type $mol_view_tree2_to_js_test_ex_klass_tuple_type = 'a' | 'b' | 'c' - export class $mol_view_tree2_to_js_test_ex_klass_tuple extends $mol_object { - constructor(readonly tuple: readonly string[] = [], readonly some?: { type: string }) { + export class $mol_view_tree2_to_js_test_ex_klass_tuple extends $mol_object { + constructor(readonly tuple: readonly string[] = [], readonly some?: { type: V }) { super() } } diff --git a/view/tree2/to/js/test/ex/simple_nan.view.tree b/view/tree2/to/js/test/ex/simple_nan.view.tree index 7bdebeb7519..887473dc578 100644 --- a/view/tree2/to/js/test/ex/simple_nan.view.tree +++ b/view/tree2/to/js/test/ex/simple_nan.view.tree @@ -4,3 +4,5 @@ $mol_view_tree2_to_js_test_ex_simple_nan_foo $mol_object c -NaN d +Infinity e -Infinity + f Infinity + diff --git a/view/tree2/to/js/test/js.array.test.ts b/view/tree2/to/js/test/js.array.test.ts index 2d6abf9355f..dedbc2481a9 100644 --- a/view/tree2/to/js/test/js.array.test.ts +++ b/view/tree2/to/js/test/js.array.test.ts @@ -17,7 +17,7 @@ namespace $ { const _foo = $mol_view_tree2_to_js_test_ex_array_number_foo const foo = _foo.make({ $ }) - type a1 = $mol_type_assert, readonly number[]> + type a1 = $mol_type_assert, any /* readonly number[] */ > $mol_assert_like( foo.bar(), @@ -88,6 +88,13 @@ namespace $ { $mol_assert_like(foo.slot(1), [ 't2' ]) }, + 'Array union' ($) { + const _foo = $mol_view_tree2_to_js_test_ex_array_union_foo + const foo = _foo.make({ $ }) + type assert_tag = $mol_type_assert[number], $mol_view_tree2_to_js_test_ex_klass_tuple_type> + $mol_assert_like(foo.bar(), [ 'a', 'c', 'b' ]) + }, + 'Array constructor tuple'($) { const _foo = $mol_view_tree2_to_js_test_ex_array_constructor_tuple_foo const foo = _foo.make({ $ }) @@ -99,7 +106,8 @@ namespace $ { type a1 = $mol_type_assert< ReturnType, - readonly $mol_view_tree2_to_js_test_ex_klass_tuple[] + readonly any[] + // readonly $mol_view_tree2_to_js_test_ex_klass_tuple[] > $mol_assert_like( diff --git a/view/tree2/to/js/test/js.simple.test.ts b/view/tree2/to/js/test/js.simple.test.ts index 989c07e18d1..ae390fb9968 100644 --- a/view/tree2/to/js/test/js.simple.test.ts +++ b/view/tree2/to/js/test/js.simple.test.ts @@ -128,9 +128,11 @@ namespace $ { const foo = _foo.make({ $ }) type assert_a = $mol_type_assert, number> type assert_d = $mol_type_assert, number> + type assert_f = $mol_type_assert, number> $mol_assert_equal(foo.a(), foo.b(), foo.c(), NaN) $mol_assert_equal(foo.d(), Infinity) $mol_assert_equal(foo.e(), -Infinity) + $mol_assert_equal(foo.f(), Infinity) }, 'simple typed null'($) {