From 43b7c879ed8da464eb836d5c90a878e115cc0529 Mon Sep 17 00:00:00 2001 From: Stefan Zerkalica Date: Thu, 14 Nov 2024 18:30:51 +0300 Subject: [PATCH 1/4] $mol_view_tre2_to_dts fix idempotency, this? fix --- view/tree2/to/dts/dts.ts | 10 ++++++++-- view/tree2/to/js/js.ts | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/view/tree2/to/dts/dts.ts b/view/tree2/to/dts/dts.ts index 5329b1c06b0..4882c314c37 100644 --- a/view/tree2/to/dts/dts.ts +++ b/view/tree2/to/dts/dts.ts @@ -85,9 +85,9 @@ namespace $ { ] } - function type_enforce(this: $, name: $mol_tree2, a: readonly $mol_tree2[], b: readonly $mol_tree2[]) { + function type_enforce(this: $, name: $mol_tree2, type_suffix: number, a: readonly $mol_tree2[], b: readonly $mol_tree2[]) { return name.struct('line', [ - name.data(`type ${ name.value.replace(/<.*>/g, '') }__${ this.$mol_guid() } = $mol_type_enforce<` ), + name.data(`type ${ name.value.replace(/<.*>/g, '') }__${ type_suffix } = $mol_type_enforce<` ), name.struct( 'indent', [ a[0].struct('line', a), a[0].data(','), @@ -102,6 +102,7 @@ namespace $ { const descr = $mol_view_tree2_classes( tree ) const types = [] as $mol_tree2[] + let assert_count = 0 for( const klass of descr.kids ) { @@ -177,6 +178,7 @@ namespace $ { types.push( type_enforce.call( this, method, + ++assert_count, parameters.call(this, main, prop, 0), parameters.call(this, second_main, second_key, 0), ) ) @@ -186,6 +188,7 @@ namespace $ { types.push( type_enforce.call( this, method, + ++assert_count, parameters.call(this, main, prop, prop_parts.key ? 1 : 0), parameters.call(this, second_main, second_key, (left_parts.next ? left_parts : right_parts).key ? 1 : 0), ) ) @@ -280,6 +283,7 @@ namespace $ { type_enforce.call( this, input.data(`${ klass.type }_${prop.type.replace(/[\?\*]*/g, '')}`), + ++assert_count, result, array_type ) @@ -304,6 +308,7 @@ namespace $ { type_enforce.call( this, first.data(input.type), + ++assert_count, [ first.data('[ '), ...args, @@ -328,6 +333,7 @@ namespace $ { type_enforce.call( this, over.data(`${ input.type }__${ name.value }`), + ++assert_count, over.hack( belt ), return_type.call( this, diff --git a/view/tree2/to/js/js.ts b/view/tree2/to/js/js.ts index 5bf140ec4d6..68912fdb0b8 100644 --- a/view/tree2/to/js/js.ts +++ b/view/tree2/to/js/js.ts @@ -34,8 +34,8 @@ namespace $ { } - function call_method_name(this: $, child: $mol_tree2) { - return child.struct( '?.[]', [ + function call_method_name(this: $, child: $mol_tree2, optional: boolean) { + return child.struct( optional ? '?.[]' : '[]', [ child.data( name_of.call( this, child ) ) ] ) } @@ -51,7 +51,7 @@ namespace $ { for (const child of bind.kids) { chain.push( - call_method_name.call(this, child), + call_method_name.call(this, child, chain.length > 1), args_of.call(this, child, bidi), ) } @@ -133,11 +133,11 @@ namespace $ { '=': bind => [ bind.struct( '()', [ bind.struct( 'this' ), - ... bind.hack({ '': ( method, belt )=> [ - call_method_name.call( this, method ), + ... bind.hack({ '': ( method, belt, ctx )=> [ + call_method_name.call( this, method, (ctx.item_index++) > 0 ), args_of.call( this, method ), ... method.hack( belt ), - ] }), + ] }, { item_index: 0 }), ] ) ], '': ( input, belt, context )=> { From 2224835388b6f6daeb4e5b56a90285bd831dc45e Mon Sep 17 00:00:00 2001 From: Stefan Zerkalica Date: Thu, 14 Nov 2024 19:31:34 +0300 Subject: [PATCH 2/4] $mol_view_tree2_to_dts fix unique prefix --- view/tree2/to/dts/dts.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/view/tree2/to/dts/dts.ts b/view/tree2/to/dts/dts.ts index 4882c314c37..168353655c6 100644 --- a/view/tree2/to/dts/dts.ts +++ b/view/tree2/to/dts/dts.ts @@ -85,7 +85,7 @@ namespace $ { ] } - function type_enforce(this: $, name: $mol_tree2, type_suffix: number, a: readonly $mol_tree2[], b: readonly $mol_tree2[]) { + function type_enforce(this: $, name: $mol_tree2, type_suffix: string, a: readonly $mol_tree2[], b: readonly $mol_tree2[]) { return name.struct('line', [ name.data(`type ${ name.value.replace(/<.*>/g, '') }__${ type_suffix } = $mol_type_enforce<` ), name.struct( 'indent', [ @@ -102,10 +102,10 @@ namespace $ { const descr = $mol_view_tree2_classes( tree ) const types = [] as $mol_tree2[] - let assert_count = 0 for( const klass of descr.kids ) { + let assert_count = 0 const parent = this.$mol_view_tree2_child(klass) const props = this.$mol_view_tree2_class_props(klass) const aliases = [] as $mol_tree2[] @@ -178,7 +178,7 @@ namespace $ { types.push( type_enforce.call( this, method, - ++assert_count, + `${klass.type}_${++assert_count}`, parameters.call(this, main, prop, 0), parameters.call(this, second_main, second_key, 0), ) ) @@ -188,7 +188,7 @@ namespace $ { types.push( type_enforce.call( this, method, - ++assert_count, + `${klass.type}_${++assert_count}`, parameters.call(this, main, prop, prop_parts.key ? 1 : 0), parameters.call(this, second_main, second_key, (left_parts.next ? left_parts : right_parts).key ? 1 : 0), ) ) @@ -283,7 +283,7 @@ namespace $ { type_enforce.call( this, input.data(`${ klass.type }_${prop.type.replace(/[\?\*]*/g, '')}`), - ++assert_count, + `${klass.type}_${++assert_count}`, result, array_type ) @@ -308,7 +308,7 @@ namespace $ { type_enforce.call( this, first.data(input.type), - ++assert_count, + `${klass.type}_${++assert_count}`, [ first.data('[ '), ...args, @@ -333,7 +333,7 @@ namespace $ { type_enforce.call( this, over.data(`${ input.type }__${ name.value }`), - ++assert_count, + `${klass.type}_${++assert_count}`, over.hack( belt ), return_type.call( this, From a89d30839ff77a3f54a36ab10e2866a619e1957a Mon Sep 17 00:00:00 2001 From: Stefan Zerkalica Date: Thu, 14 Nov 2024 20:16:22 +0300 Subject: [PATCH 3/4] $mol_view_tree2_to_dts fix simplify args --- view/tree2/to/dts/dts.ts | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/view/tree2/to/dts/dts.ts b/view/tree2/to/dts/dts.ts index 168353655c6..a68edfc4481 100644 --- a/view/tree2/to/dts/dts.ts +++ b/view/tree2/to/dts/dts.ts @@ -85,9 +85,9 @@ namespace $ { ] } - function type_enforce(this: $, name: $mol_tree2, type_suffix: string, a: readonly $mol_tree2[], b: readonly $mol_tree2[]) { + function type_enforce(this: $, name: $mol_tree2, a: readonly $mol_tree2[], b: readonly $mol_tree2[]) { return name.struct('line', [ - name.data(`type ${ name.value.replace(/<.*>/g, '') }__${ type_suffix } = $mol_type_enforce<` ), + name.data(`type ${ name.value.replace(/<.*>/g, '') } = $mol_type_enforce<` ), name.struct( 'indent', [ a[0].struct('line', a), a[0].data(','), @@ -110,6 +110,7 @@ namespace $ { const props = this.$mol_view_tree2_class_props(klass) const aliases = [] as $mol_tree2[] const context = { objects: [] as $mol_tree2[] } + const klass_name = klass.type.slice(1) types.push( klass.struct( 'line', [ klass.data( 'export class ' ), @@ -177,8 +178,7 @@ namespace $ { if (prop_parts.key) { types.push( type_enforce.call( this, - method, - `${klass.type}_${++assert_count}`, + method.data(`${method.type}_${klass_name}_${++assert_count}`), parameters.call(this, main, prop, 0), parameters.call(this, second_main, second_key, 0), ) ) @@ -187,8 +187,7 @@ namespace $ { if (prop_parts.next) { types.push( type_enforce.call( this, - method, - `${klass.type}_${++assert_count}`, + method.data(`${method.type}_${klass_name}_${++assert_count}`), parameters.call(this, main, prop, prop_parts.key ? 1 : 0), parameters.call(this, second_main, second_key, (left_parts.next ? left_parts : right_parts).key ? 1 : 0), ) ) @@ -282,8 +281,7 @@ namespace $ { types.push( type_enforce.call( this, - input.data(`${ klass.type }_${prop.type.replace(/[\?\*]*/g, '')}`), - `${klass.type}_${++assert_count}`, + input.data(`${ klass.type }_${prop.type.replace(/[\?\*]*/g, '')}_${++assert_count}`), result, array_type ) @@ -307,8 +305,7 @@ namespace $ { types.push( type_enforce.call( this, - first.data(input.type), - `${klass.type}_${++assert_count}`, + first.data(`${input.type}_${klass_name}_${++assert_count}`), [ first.data('[ '), ...args, @@ -332,8 +329,7 @@ namespace $ { types.push( type_enforce.call( this, - over.data(`${ input.type }__${ name.value }`), - `${klass.type}_${++assert_count}`, + over.data(`${ input.type }__${ name.value }_${klass_name}_${++assert_count}`), over.hack( belt ), return_type.call( this, From 5d34990e914d3853147c12fcffa81625b14551ae Mon Sep 17 00:00:00 2001 From: jin Date: Fri, 15 Nov 2024 02:29:11 +0300 Subject: [PATCH 4/4] Fixed navi --- book2/catalog/catalog.view.tree | 1 + state/arg/arg.node.ts | 2 +- state/arg/arg.web.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/book2/catalog/catalog.view.tree b/book2/catalog/catalog.view.tree index c185fe8506f..f8cbf9d4558 100644 --- a/book2/catalog/catalog.view.tree +++ b/book2/catalog/catalog.view.tree @@ -25,6 +25,7 @@ $mol_book2_catalog $mol_book2 <= Menu_filter $mol_search query? <=> menu_filter? \ <= Menu_links $mol_list + Empty <= Menu_links_empty $mol_view rows <= menu_links / <= Menu_link*0 $mol_link arg <= arg* * diff --git a/state/arg/arg.node.ts b/state/arg/arg.node.ts index 55cdf426794..8dd43b4c476 100644 --- a/state/arg/arg.node.ts +++ b/state/arg/arg.node.ts @@ -70,7 +70,7 @@ namespace $ { @ $mol_action static go( next : { [ key : string ] : string | null } ) { - this.href( this.make_link( next ) ) + this.href( this.link( next ) ) } constructor( public prefix = '' ) { diff --git a/state/arg/arg.web.ts b/state/arg/arg.web.ts index f3facbfa1a0..19f112ed760 100644 --- a/state/arg/arg.web.ts +++ b/state/arg/arg.web.ts @@ -105,7 +105,7 @@ namespace $ { @ $mol_action static go( next : { [ key : string ] : string | null } ) { - $mol_dom_context.location.href = this.make_link( next ) + $mol_dom_context.location.href = this.link( next ) } static encode( str : string ) {