From f35ee8c5573ba2ad68bdc5fbc69458d5521440a5 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Fri, 7 Apr 2023 02:15:00 +1100 Subject: [PATCH 01/13] source page: hor scroll instead of wrap --- studio.view.css.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/studio.view.css.ts b/studio.view.css.ts index c735022..0ee4d68 100644 --- a/studio.view.css.ts +++ b/studio.view.css.ts @@ -53,6 +53,9 @@ namespace $.$$ { flex: { basis: rem( 40 ), }, + Body: { + flexDirection: 'row', + }, }, Preview: { From a3a1b06a79314cbc7f57eb98ad2d7eedd44b5524 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Fri, 7 Apr 2023 02:36:17 +1100 Subject: [PATCH 02/13] localizable text props --- prop/prop.view.tree | 4 ++++ prop/prop.view.ts | 21 +++++++++++++++++++++ value/value.view.tree | 4 ---- value/value.view.ts | 24 +++++------------------- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/prop/prop.view.tree b/prop/prop.view.tree index 5ea8131..ce2ff10 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -16,6 +16,10 @@ $hyoo_studio_prop $mol_view expanded? <=> expanded? false Tools <= Prop_tools $mol_view sub <= prop_tools / + <= Locale $mol_check_icon + hint @ \Multilingual + Icon <= Locale_icon $mol_icon_translate + checked?next <=> locale?next false <= Type $hyoo_studio_prop_type tree? <=> value? type? => type? diff --git a/prop/prop.view.ts b/prop/prop.view.ts index e7525b0..d83b303 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -36,6 +36,10 @@ namespace $.$$ { return Boolean( sign_obj.next ) } + prop_tools() { + return this.type() == 'text' ? super.prop_tools() : [ this.Type(), this.Key(), this.Next() ] + } + prop_content() { return this.type() == 'object' ? [ this.Object() ] : [ this.Value() ] } @@ -114,6 +118,23 @@ namespace $.$$ { } return val.kids[ index ]?.kids[ 0 ] } + + @ $mol_mem + locale( next?: boolean ) { + + const val = this.value() + + if( next === undefined ) return '@' === val.type + + this.value( + next + ? val.struct( '@', [ + val.data( val.text() || val.type ) + ] ) + : val.data( val.text() || val.type ) + ) + return next + } } } diff --git a/value/value.view.tree b/value/value.view.tree index 23515c1..7d4e0c0 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -12,10 +12,6 @@ $hyoo_studio_value $mol_list bind_options <= bind_options * <= Str $mol_textarea value?next <=> str?next \ - <= Locale $mol_check_icon - hint @ \Multilingual - Icon <= Locale_icon $mol_icon_translate - checked?next <=> locale?next false <= Numb $mol_number value?next <=> numb?next +NaN <= Over_prop_name $mol_select diff --git a/value/value.view.ts b/value/value.view.ts index 6eb169b..640940e 100644 --- a/value/value.view.ts +++ b/value/value.view.ts @@ -42,29 +42,15 @@ namespace $.$$ { @ $mol_mem str( next?: string ) { + + const val = this.tree() + if (next !== undefined){ - this.tree(this.tree().data( next )) + this.tree( val.type == '@' ? val.struct( '@', [ val.data(next) ] ) : val.data(next) ) return next } - return this.tree().text() - } - - @ $mol_mem - locale( next?: boolean ) { - - const val = this.tree() - - if( next === undefined ) return '@' === val.type - - this.tree( - next - ? val.struct( '@', [ - val.data( val.text() || val.type ) - ] ) - : val.data( val.text() || val.type ) - ) - return next + return val.text() } @ $mol_mem From ac6ae5113b10b5b31a8e491975891b8647f23f78 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:07:23 +1100 Subject: [PATCH 03/13] integrate class-picker in type-picker --- prop/prop.view.css.ts | 1 + prop/prop.view.tree | 28 +++++++------------- prop/prop.view.ts | 8 ++++-- prop/type/type.view.css.ts | 8 +++++- prop/type/type.view.tree | 35 +++++++++++++++++------- prop/type/type.view.ts | 54 ++++++++++++++++++++++++-------------- value/value.view.css.ts | 2 +- value/value.view.tree | 2 +- value/value.view.ts | 4 --- 9 files changed, 84 insertions(+), 58 deletions(-) diff --git a/prop/prop.view.css.ts b/prop/prop.view.css.ts index d1576ec..6b2fafd 100644 --- a/prop/prop.view.css.ts +++ b/prop/prop.view.css.ts @@ -50,6 +50,7 @@ namespace $.$$ { }, Label: { + position: 'relative', //for type picker bubble positioning background: { color: $mol_theme.card, }, diff --git a/prop/prop.view.tree b/prop/prop.view.tree index ce2ff10..15635ae 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -23,6 +23,13 @@ $hyoo_studio_prop $mol_view <= Type $hyoo_studio_prop_type tree? <=> value? type? => type? + class_list <= class_list /string + <= Over_add $mol_select + hint @ \Add Override + align_hor \left + Trigger_icon <= Over_add_icon $mol_icon_wrench_outline + value?next <=> over_add?next \ + options <= over_prop_options /string <= Key $mol_check_icon hint @ \Multiple values by key Icon <= Key_icon $mol_icon_key_change @@ -32,25 +39,8 @@ $hyoo_studio_prop $mol_view Icon <= Next_icon $mol_icon_atom_variant checked? <=> changeable? false content <= prop_content / - <= Object $mol_view - sub / - <= Object_head $mol_view - sub <= object_head / - <= Obj $mol_select - hint @ \Class - align_hor \right - value?next <=> obj?next \$mol_view - options <= class_list /string - Trigger_icon null - <= Over_add $mol_select - hint @ \Add Override - align_hor \left - Trigger_icon <= Over_add_icon $mol_icon_wrench_outline - value?next <=> over_add?next \ - options <= over_prop_options /string - <= Inner $mol_view sub <= inner / - <= Over_props $mol_list - sub <= overs / + <= Over_props $mol_list + sub <= overs / <= Value $hyoo_studio_value Type null tree? <=> value? $mol_tree2_empty diff --git a/prop/prop.view.ts b/prop/prop.view.ts index d83b303..5fa79cb 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -37,11 +37,15 @@ namespace $.$$ { } prop_tools() { - return this.type() == 'text' ? super.prop_tools() : [ this.Type(), this.Key(), this.Next() ] + switch( this.type() ) { + case 'text': return [ this.Type(), this.Locale(), this.Key(), this.Next() ] + case 'object': return [ this.Type(), this.Over_add(), this.Key(), this.Next() ] + default: return [ this.Type(), this.Key(), this.Next() ] + } } prop_content() { - return this.type() == 'object' ? [ this.Object() ] : [ this.Value() ] + return this.type() == 'object' ? [ this.Over_props() ] : [ this.Value() ] } @ $mol_mem diff --git a/prop/type/type.view.css.ts b/prop/type/type.view.css.ts index 9015bd8..205686e 100644 --- a/prop/type/type.view.css.ts +++ b/prop/type/type.view.css.ts @@ -8,7 +8,13 @@ namespace $.$$ { padding: $mol_gap.space, }, - Menu_item_control: { + Object_options: { + flex: 'none', + }, + + position: 'static', //because pop_bubble should be relative to prop card + + Control: { border: { top: { color: $mol_theme.line, diff --git a/prop/type/type.view.tree b/prop/type/type.view.tree index 11cb20b..eea2973 100644 --- a/prop/type/type.view.tree +++ b/prop/type/type.view.tree @@ -4,29 +4,44 @@ $hyoo_studio_prop_type $mol_pick <= Value $mol_paragraph title <= type_display \ bubble_content / <= Options_content $mol_list rows / - <= Menu_item_unit $mol_switch - value? <=> unit? \ + <= Unit_options $mol_switch + value? <=> switch_type? \ options <= unit_options * null \null boolean_false \false boolean_true \true - <= Menu_item_number $mol_switch - value? <=> number? \ + <= Number_options $mol_switch + value? <=> switch_type? \ options <= number_options * number \number number_nan \NaN number_infinity_negative \-Infinity number_infinity_positive \+Infinity - <= Menu_item_object $mol_switch - value? <=> object? \ - options <= object_options * - <= Menu_item_bind $mol_switch - value? <=> bind? \ + <= Object_group $mol_view + sub / + <= Object_options $mol_switch + value? <=> switch_type? \ + options <= object_options * + <= Object $mol_check + title \object + click <= show_obj_select null + checked? <= obj_checked? false + <= Bind_options $mol_switch + value? <=> switch_type? \ options <= bind_options * - <= Menu_item_control $mol_view sub / + <= Control $mol_view sub / <= Menu_item_delete $mol_button_minor style * color \red click? <=> drop? null sub / <= menu_item_delete_icon $mol_icon_trash_can_outline <= menu_item_delete_label \Drop + Object_select $mol_select + hint @ \Class + align_hor \right + value?next <=> selected_obj?next \$mol_view + options <= class_list /string + Trigger_icon null + bubble_content => Obj_bubble_content + obj_select_showed? false + align_hor \center diff --git a/prop/type/type.view.ts b/prop/type/type.view.ts index 4b420e4..0c7e6a4 100644 --- a/prop/type/type.view.ts +++ b/prop/type/type.view.ts @@ -2,42 +2,39 @@ namespace $.$$ { export class $hyoo_studio_prop_type extends $.$hyoo_studio_prop_type { - object_options(): Partial<{ text: 'text', list: 'list', dict: 'dict', object: 'object' }> { - return { text: 'text', list: 'list', dict: 'dict', object: 'object' } + object_options(): Partial<{ text: 'text', list: 'list', dict: 'dict' }> { + return { text: 'text', list: 'list', dict: 'dict' } } bind_options(): Partial<{ bind: '<=>', get: '<=', put: '=>' }> { return { bind: '<=>', get: '<=', put: '=>' } } - unit(next?: string) { + switch_type(next?: string) { return this.type(next) } - number(next?: string) { - return this.type(next) - } - - object(next?: string) { - return this.type(next) + drop() { + this.type('') } - bind(next?: string) { - return this.type(next) + bubble_content() { + return this.obj_select_showed()? this.Obj_bubble_content() : super.bubble_content() } - drop() { - this.type('') + obj_checked( next?: any ): boolean { + return this.type() == 'object'? true : false } @ $mol_mem type_display() { - const value = this.type() + const type = this.type() - if (this.unit_options()[value]) return this.unit_options()[value] - if (this.number_options()[value]) return this.number_options()[value] - if (this.object_options()[value]) return this.object_options()[value] - if (this.bind_options()[value]) return this.bind_options()[value] + if (type == 'object') { return this.selected_obj() } + if (this.unit_options()[type]) return this.unit_options()[type] + if (this.number_options()[type]) return this.number_options()[type] + if (this.object_options()[type]) return this.object_options()[type] + if (this.bind_options()[type]) return this.bind_options()[type] return '' } @@ -46,7 +43,7 @@ namespace $.$$ { type( next? : string ): string { if( next !== undefined ) { - + switch( next ) { case '' : this.tree(null); break case 'null' : this.tree( this.tree().struct('null') ); break @@ -59,12 +56,14 @@ namespace $.$$ { case 'text': this.tree( this.tree().data('') ); break case 'list': this.tree( this.tree().struct( '/' ) ); break case 'dict': this.tree( this.tree().struct( '*' ) ); break - case 'object': this.tree( this.tree().struct( '$mol_view' ) ); break + case 'object': this.tree( this.tree().struct( '$mol_view', [ this.tree().kids[0] ?? this.tree().data( '' ) ] ) ); break case 'bind': this.tree( this.tree().struct( '<=>', [ this.tree().kids[0] ?? this.tree().data( '' ) ] ) ); break case 'get': this.tree( this.tree().struct( '<=', [ this.tree().kids[0] ?? this.tree().data( '' ) ] ) ); break case 'put': this.tree( this.tree().struct( '=>', [ this.tree().kids[0] ?? this.tree().data( '' ) ] ) ); break default : $mol_fail( new TypeError( `Unsupported type: ${ next }` ) ) } + + this.showed(false) } const val = this.tree() @@ -89,6 +88,21 @@ namespace $.$$ { return type } + show_obj_select() { + this.obj_select_showed(true) + } + + @ $mol_mem + selected_obj(next?: string) { + + if ( next !== undefined ) { + this.showed(false) + return this.tree(this.tree().struct( next )).type + } + + return this.tree().type + } + } } diff --git a/value/value.view.css.ts b/value/value.view.css.ts index 94a5b54..8afd83b 100644 --- a/value/value.view.css.ts +++ b/value/value.view.css.ts @@ -9,6 +9,7 @@ namespace $.$$ { grow: 1, }, alignItems: 'flex-start', + position: 'relative', //for type picker bubble positioning }, Type: { @@ -30,7 +31,6 @@ namespace $.$$ { grow: 1, shrink: 1, }, - maxWidth: rem(30), }, Item_type: { diff --git a/value/value.view.tree b/value/value.view.tree index 7d4e0c0..e727455 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -8,8 +8,8 @@ $hyoo_studio_value $mol_list <= Type $hyoo_studio_prop_type tree? <=> tree? type => type - object_options <= object_options * bind_options <= bind_options * + Object null <= Str $mol_textarea value?next <=> str?next \ <= Numb $mol_number diff --git a/value/value.view.ts b/value/value.view.ts index 640940e..0e771fb 100644 --- a/value/value.view.ts +++ b/value/value.view.ts @@ -168,10 +168,6 @@ namespace $.$$ { return { bind: '<=>', get: '<=', put: '=>' } } - object_options(): ReturnType<$hyoo_studio_prop_type[ 'object_options' ]> { - return { text: 'text', list: 'list', dict: 'dict' } - } - } } From 5de6b066bee02ec44c7e28ec8108da1a9ebdb090 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sun, 9 Apr 2023 01:57:51 +1100 Subject: [PATCH 04/13] draft readme-page --- studio.view.css.ts | 17 +++++++++++++++ studio.view.tree | 52 ++++++++++++++++++++++++++++++++-------------- studio.view.ts | 1 + 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/studio.view.css.ts b/studio.view.css.ts index 0ee4d68..047c99b 100644 --- a/studio.view.css.ts +++ b/studio.view.css.ts @@ -26,8 +26,25 @@ namespace $.$$ { flex: { wrap: 'wrap', }, + margin: $mol_gap.block, + padding: $mol_gap.block, + overflow: 'visible', + }, + Self_field: { + alignItems: 'center', + padding: 0, + }, + Self_field_name: { + color: $mol_theme.shade + }, + Base_field: { + alignItems: 'center', + padding: 0, + }, + Base_field_name: { + color: $mol_theme.shade }, $mol_form_field: { diff --git a/studio.view.tree b/studio.view.tree index 6845e80..87e4aef 100644 --- a/studio.view.tree +++ b/studio.view.tree @@ -27,25 +27,40 @@ $hyoo_studio $mol_book2 body / <= Edit_form $mol_list rows <= form_sections / - <= Pack_field $mol_form_field - name @ \Components Donor App - control <= Pack $mol_string - hint <= pack - value?val <=> pack?val \https://mol.hyoo.ru + <= Donor_expander $mol_expander + label @ \Components Donor App + content / + <= Pack_field $mol_form_field + name @ \Donor App website + control <= Pack $mol_search + query? <=> pack? \https://mol.hyoo.ru + suggests <= suggests / + \https://mol.hyoo.ru + \https://todomvc.hyoo.ru + <= Repo_field $mol_form_field + name @ \Donor App repo + control <= Repo $mol_string + hint <= repo + value? <=> repo? \hyoo-ru/mam_mol <= Config $mol_list rows / - <= Classes $mol_view + <= Classes $mol_card sub / - <= Self_field $mol_form_field - name @ \Component Name - control <= Self $mol_string - hint \$hyoo_studio_example - value?val <=> self?val \ - <= Base_field $mol_form_field - name @ \Base Class - control <= Base $mol_select - value?val <=> base?val \ - options <= base_options /string + <= Self_field $mol_row + sub / + <= Self_field_name $mol_paragraph + title @ \Component + <= Self $mol_string + hint \$hyoo_studio_example + value?val <=> self?val \ + <= Base_field $mol_row + sub / + <= Base_field_name $mol_paragraph + title @ \Base class + <= Base $mol_select + value?val <=> base?val \ + options <= base_options /string + - align \bottom - <= Props_inherited_field $mol_form_field name @ \Display inherited properties control <= Props_inherited_control $mol_check_list @@ -66,6 +81,11 @@ $hyoo_studio $mol_book2 <= Prop_add_icon $mol_icon_plus <= Props $mol_list rows <= props /$hyoo_studio_prop + <= Readme_page $mol_app_demo_readme + repo <= repo + opened? <=> readme_show? false + module <= module /string + source_link <= source_link \ <= Source_page $mol_page title @ \Raw Code body / diff --git a/studio.view.ts b/studio.view.ts index 23541d4..3d6de50 100644 --- a/studio.view.ts +++ b/studio.view.ts @@ -18,6 +18,7 @@ namespace $.$$ { pages() { return [ this.Edit(), + ... this.readme_show() ? [ this.Readme_page() ] : [], ... this.code_show() ? [ this.Source_page() ] : [], ... this.inspector_show() ? [ this.Inspect() ] : [], ... this.preview_show() ? [ this.Preview() ] : [], From 6b9311ecd085a4c7460febe9f335c0e3b8209be4 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sun, 9 Apr 2023 01:59:10 +1100 Subject: [PATCH 05/13] refactor: split value into classes --- prop/prop.view.css.ts | 34 ++---- prop/prop.view.tree | 38 ++---- prop/prop.view.ts | 146 +++++++++-------------- {prop/type => type}/type.view.css.ts | 12 +- {prop/type => type}/type.view.tree | 13 ++- {prop/type => type}/type.view.ts | 18 ++- value/bound/bound.view.css.ts | 15 +++ value/bound/bound.view.tree | 23 ++++ value/bound/bound.view.ts | 61 ++++++++++ value/dict/dict.view.css.ts | 44 +++++++ value/dict/dict.view.tree | 30 +++++ value/dict/dict.view.ts | 48 ++++++++ value/list/list.view.css.ts | 36 ++++++ value/list/list.view.tree | 29 +++++ value/list/list.view.ts | 27 +++++ value/number/number.view.css.ts | 15 +++ value/number/number.view.tree | 9 ++ value/number/number.view.ts | 18 +++ value/object/object.view.css.ts | 43 +++++++ value/object/object.view.tree | 3 + value/object/object.view.ts | 7 ++ value/string/string.view.tree | 10 ++ value/string/string.view.ts | 20 ++++ value/tools/tools.view.css.ts | 21 ++++ value/tools/tools.view.tree | 28 +++++ value/tools/tools.view.ts | 115 ++++++++++++++++++ value/value.view.css.ts | 55 +-------- value/value.view.tree | 98 +++++++++------- value/value.view.ts | 169 ++------------------------- 29 files changed, 773 insertions(+), 412 deletions(-) rename {prop/type => type}/type.view.css.ts (71%) rename {prop/type => type}/type.view.tree (84%) rename {prop/type => type}/type.view.ts (85%) create mode 100644 value/bound/bound.view.css.ts create mode 100644 value/bound/bound.view.tree create mode 100644 value/bound/bound.view.ts create mode 100644 value/dict/dict.view.css.ts create mode 100644 value/dict/dict.view.tree create mode 100644 value/dict/dict.view.ts create mode 100644 value/list/list.view.css.ts create mode 100644 value/list/list.view.tree create mode 100644 value/list/list.view.ts create mode 100644 value/number/number.view.css.ts create mode 100644 value/number/number.view.tree create mode 100644 value/number/number.view.ts create mode 100644 value/object/object.view.css.ts create mode 100644 value/object/object.view.tree create mode 100644 value/object/object.view.ts create mode 100644 value/string/string.view.tree create mode 100644 value/string/string.view.ts create mode 100644 value/tools/tools.view.css.ts create mode 100644 value/tools/tools.view.tree create mode 100644 value/tools/tools.view.ts diff --git a/prop/prop.view.css.ts b/prop/prop.view.css.ts index 6b2fafd..38507b5 100644 --- a/prop/prop.view.css.ts +++ b/prop/prop.view.css.ts @@ -19,26 +19,6 @@ namespace $.$$ { }, }, - Type: { - Trigger: { - color: $mol_theme.special, - }, - }, - - Over_props: { - gap: $mol_gap.space, - flex: { - grow: 1, - }, - padding: { - left: $mol_gap.block, - }, - }, - - Over_add: { - marginLeft: 'auto', - }, - Object: { flexDirection: 'column', }, @@ -51,12 +31,6 @@ namespace $.$$ { Label: { position: 'relative', //for type picker bubble positioning - background: { - color: $mol_theme.card, - }, - border: { - radius: $mol_gap.round, - }, }, Label_content: { @@ -72,8 +46,14 @@ namespace $.$$ { }, }, + Expander_title: { + color: $mol_theme.control, + }, + Prop_tools: { - marginLeft: 'auto', + flex: { + shrink: 1, + }, }, Key: { diff --git a/prop/prop.view.tree b/prop/prop.view.tree index 15635ae..d319946 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -8,28 +8,23 @@ $hyoo_studio_prop $mol_view <= Label_content $mol_view sub <= label_sub / <= Trigger $mol_check_expand - checked?val <=> expanded?val false + checked? <=> expanded? false expandable <= expandable true - label / - <= expander_title <= name \ + label <= trigger_label / + <= Expander_title $mol_paragraph + title <= name \ <= Prop_tools - expanded? <=> expanded? false + expanded? <=> expanded? Tools <= Prop_tools $mol_view sub <= prop_tools / - <= Locale $mol_check_icon - hint @ \Multilingual - Icon <= Locale_icon $mol_icon_translate - checked?next <=> locale?next false - <= Type $hyoo_studio_prop_type + <= Type $hyoo_studio_type tree? <=> value? type? => type? class_list <= class_list /string - <= Over_add $mol_select - hint @ \Add Override - align_hor \left - Trigger_icon <= Over_add_icon $mol_icon_wrench_outline - value?next <=> over_add?next \ - options <= over_prop_options /string + <= Value_tools $hyoo_studio_value_tools + tree? <=> value? + type? <= type? + props_of!klass <= props_of!klass <= Key $mol_check_icon hint @ \Multiple values by key Icon <= Key_icon $mol_icon_key_change @@ -39,20 +34,11 @@ $hyoo_studio_prop $mol_view Icon <= Next_icon $mol_icon_atom_variant checked? <=> changeable? false content <= prop_content / - <= Over_props $mol_list - sub <= overs / <= Value $hyoo_studio_value Type null + Value_tools null tree? <=> value? $mol_tree2_empty type? <= type? props_of!klass <= props_of!klass $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty - Bound_prop* <= Bound_prop* - Over_prop* $hyoo_studio_value - parent_type \object - tree? <=> over_value*? $mol_tree2_empty - name? <= over_prop_name*? \ - props_of!klass <= props_of!klass $mol_tree2_empty - props_bindable <= props_bindable $mol_tree2_empty - class_list <= class_list /string - Bound_prop* <= Bound_prop* $hyoo_studio_prop + Bound_prop* <= Bound_prop* null diff --git a/prop/prop.view.ts b/prop/prop.view.ts index 5fa79cb..67228cc 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -13,7 +13,6 @@ namespace $.$$ { if( next !== undefined ) { const new_sign = $mol_view_tree2_prop_signature.generate( { ...sign_obj, key: next ? '*' : '' } )! - console.log( new_sign ) this.sign( new_sign ) return next } @@ -23,122 +22,89 @@ namespace $.$$ { @ $mol_mem changeable( next?: any ): boolean { + const sign_obj = [ ...this.sign().matchAll( $mol_view_tree2_prop_signature ) ][ 0 ]?.groups ?? { name: '', key: '', next: '', } + if( next !== undefined ) { const new_sign = $mol_view_tree2_prop_signature.generate( { ...sign_obj, next: next ? '?' : '' } )! this.sign( new_sign ) return next } + return Boolean( sign_obj.next ) } - prop_tools() { - switch( this.type() ) { - case 'text': return [ this.Type(), this.Locale(), this.Key(), this.Next() ] - case 'object': return [ this.Type(), this.Over_add(), this.Key(), this.Next() ] - default: return [ this.Type(), this.Key(), this.Next() ] - } - } - prop_content() { - return this.type() == 'object' ? [ this.Over_props() ] : [ this.Value() ] - } - - @ $mol_mem - value( next?: $mol_tree2 ) { - let val = this.tree() - if( next !== undefined ) { - val = this.tree( next && val.clone( [ next ] ) ) - return next + switch (this.type()) { + case 'object': return [ this.Value() ] + case 'text': return [ this.Value() ] + case 'number': return [ this.Value() ] + case 'list': return [ this.Value() ] + case 'dict': return [ this.Value() ] + case 'bind': return [ this.Value() ] + case 'get': return [ this.Value() ] + case 'put': return [ this.Value() ] + default: return [] } - - return val?.kids[ 0 ] } @ $mol_mem - prop_name_list() { - return this.props_bindable().kids.map( prop => prop.type ) - } - - @ $mol_mem - obj( next?: string ) { - return this.value( - next === undefined - ? undefined - : this.value().struct( next ) - ).type + expandable() { + switch (this.type()) { + case 'object': return true + case 'text': return true + case 'number': return true + case 'list': return true + case 'dict': return true + default: return false + } } @ $mol_mem - overs() { - return this.value().kids.map( ( _, i ) => this.Over_prop( i ) ) - } - - @ $mol_mem - over_prop_options() { - return this.props_of( this.obj() ).kids.map( prop => prop.type ) - } - - @ $mol_mem_key - over_prop_name( index: number, next?: string ) { - let val = this.value() - if( next !== undefined ) { - val = this.value( - val.insert( val.struct( next, val.kids[ index ].kids ), index ) - ) + expanded(next?: boolean): boolean { + + if ( next !== undefined ) return next as never + + let expanded: boolean | undefined = $mol_wire_probe( () => this.expanded() ) + const type = this.type() + + if ( !expanded ) { + switch (type) { + case 'object': + case 'list': + case 'dict': + return this.value().kids.length > 0 ? false : true + case 'text': return this.value().text().length > 40 ? false : true + case 'null' : return true + case 'boolean_true' : return true + case 'boolean_false' : return true + case 'number' : return true + case 'number_nan' : return true + case 'number_infinity_negative' : return true + case 'number_infinity_positive' : return true + } + return false } - return val.kids[ index ].type - } - - over_add( next: string ) { - - if( !next ) return '' - - const tree = this.value() - - this.value( - tree.clone( [ - ...tree.kids, - tree.struct( next, [ - tree.struct( 'null' ), - ] ), - ] ) - ) - - return next + + return expanded } - @ $mol_mem_key - over_value( index: number, next?: $mol_tree2 ) { - let val = this.value() + @ $mol_mem + value( next?: $mol_tree2 ) { + + let val = this.tree() + if( next !== undefined ) { - val = this.value( - val.insert( next && val.kids[ index ].clone( [ next ] ), index ) - ) + val = this.tree( next && val.clone( [ next ] ) ) + return next } - return val.kids[ index ]?.kids[ 0 ] - } - - @ $mol_mem - locale( next?: boolean ) { - - const val = this.value() - - if( next === undefined ) return '@' === val.type - this.value( - next - ? val.struct( '@', [ - val.data( val.text() || val.type ) - ] ) - : val.data( val.text() || val.type ) - ) - - return next + return val?.kids[ 0 ] } + } } diff --git a/prop/type/type.view.css.ts b/type/type.view.css.ts similarity index 71% rename from prop/type/type.view.css.ts rename to type/type.view.css.ts index 205686e..ebd86cc 100644 --- a/prop/type/type.view.css.ts +++ b/type/type.view.css.ts @@ -2,18 +2,26 @@ namespace $.$$ { const { px } = $mol_style_unit - $mol_style_define( $.$hyoo_studio_prop_type, { + $mol_style_define( $.$hyoo_studio_type, { + + flex: { + grow: 0, + }, Options_content: { padding: $mol_gap.space, }, - Object_options: { + Other_options: { flex: 'none', }, position: 'static', //because pop_bubble should be relative to prop card + Value: { + color: $mol_theme.special, + }, + Control: { border: { top: { diff --git a/prop/type/type.view.tree b/type/type.view.tree similarity index 84% rename from prop/type/type.view.tree rename to type/type.view.tree index eea2973..37ad700 100644 --- a/prop/type/type.view.tree +++ b/type/type.view.tree @@ -1,4 +1,4 @@ -$hyoo_studio_prop_type $mol_pick +$hyoo_studio_type $mol_pick tree?val $mol_tree2_empty trigger_content / <= Value $mol_paragraph title <= type_display \ @@ -17,12 +17,15 @@ $hyoo_studio_prop_type $mol_pick number_nan \NaN number_infinity_negative \-Infinity number_infinity_positive \+Infinity - <= Object_group $mol_view + <= Other_options_group $mol_view sub / - <= Object_options $mol_switch + <= Other_options $mol_switch value? <=> switch_type? \ - options <= object_options * - <= Object $mol_check + options <= other_options * + text \text + list \list + dict \dict + <= Object_option $mol_check title \object click <= show_obj_select null checked? <= obj_checked? false diff --git a/prop/type/type.view.ts b/type/type.view.ts similarity index 85% rename from prop/type/type.view.ts rename to type/type.view.ts index 0c7e6a4..753c983 100644 --- a/prop/type/type.view.ts +++ b/type/type.view.ts @@ -1,10 +1,6 @@ namespace $.$$ { - export class $hyoo_studio_prop_type extends $.$hyoo_studio_prop_type { - - object_options(): Partial<{ text: 'text', list: 'list', dict: 'dict' }> { - return { text: 'text', list: 'list', dict: 'dict' } - } + export class $hyoo_studio_type extends $.$hyoo_studio_type { bind_options(): Partial<{ bind: '<=>', get: '<=', put: '=>' }> { return { bind: '<=>', get: '<=', put: '=>' } @@ -23,17 +19,17 @@ namespace $.$$ { } obj_checked( next?: any ): boolean { - return this.type() == 'object'? true : false + return this.type() === 'object'? true : false } @ $mol_mem type_display() { const type = this.type() - if (type == 'object') { return this.selected_obj() } + if (type === 'object') { return this.selected_obj() } if (this.unit_options()[type]) return this.unit_options()[type] if (this.number_options()[type]) return this.number_options()[type] - if (this.object_options()[type]) return this.object_options()[type] + if (this.other_options()[type]) return this.other_options()[type] if (this.bind_options()[type]) return this.bind_options()[type] return '' @@ -79,10 +75,10 @@ namespace $.$$ { if (type === 'null') return 'null' if (type === 'bool') return val.type === 'true' ? 'boolean_true' : 'boolean_false' if (type === 'number') return 'number' - if( type === 'locale' ) return 'text' + if (type === 'locale' ) return 'text' if (type === 'string') return 'text' - if( type === 'get' ) return 'get' - if( type === 'put' ) return 'put' + if (type === 'get' ) return 'get' + if (type === 'put' ) return 'put' if (type === 'bind') return 'bind' return type diff --git a/value/bound/bound.view.css.ts b/value/bound/bound.view.css.ts new file mode 100644 index 0000000..d14768e --- /dev/null +++ b/value/bound/bound.view.css.ts @@ -0,0 +1,15 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_bound, { + + Bound_prop_name: { + Option_label: { + padding: 0, + } + }, + + } ) + +} diff --git a/value/bound/bound.view.tree b/value/bound/bound.view.tree new file mode 100644 index 0000000..7adf90e --- /dev/null +++ b/value/bound/bound.view.tree @@ -0,0 +1,23 @@ +$hyoo_studio_value_bound $mol_view + tree? $mol_tree2_empty + guid \ + Opened_bound_prop $hyoo_studio_prop + head / + sub <= self / + ^ head + <= Type $hyoo_studio_type + tree? <=> tree? + type => type + bind_options <= bind_options * + Object_option null + <= Bound_prop_name $mol_select + hint @ \Bound Property + value?next <=> bound_prop_name?next null + options <= prop_name_list /string + Trigger_icon null + <= Bound_prop_expand $mol_check_expand + checked? <=> bound_expanded? false + Bound_prop* null + props_of!klass $mol_tree2_empty + props_bindable $mol_tree2_empty + class_list /string diff --git a/value/bound/bound.view.ts b/value/bound/bound.view.ts new file mode 100644 index 0000000..4c782e9 --- /dev/null +++ b/value/bound/bound.view.ts @@ -0,0 +1,61 @@ +namespace $.$$ { + + export class $hyoo_studio_value_bound extends $.$hyoo_studio_value_bound { + + @ $mol_mem + guid() { + return $mol_guid() + } + + @ $mol_mem + self() { + return this.bound_expanded() ? [ this.Opened_bound_prop() ] : super.self() + } + + @ $mol_mem + bound_expanded(next?: any) { + return this.Opened_bound_prop().expanded( + next !== undefined ? + next : + undefined + ) + } + + @ $mol_mem + Opened_bound_prop() { + const prop = this.Bound_prop( this.bound_prop_name() + ':' + this.guid() ) + prop.trigger_label = () => [] + prop.label_sub = () => [ + ...this.head(), this.Type(), this.Bound_prop_name(), prop.Trigger(), prop.Prop_tools() + ] + return prop + } + + @ $mol_mem + prop_name_list() { + return this.props_bindable().kids.map( prop => prop.type ) + } + + @ $mol_mem + bound_prop_name( next?: string ) { + + const val = this.tree() + + if( next === undefined ) { + return this.$.$mol_view_tree2_prop_split( val.kids[ 0 ] ).name.text() || '...' + } + + this.tree( + val.insert( val.struct( next ), null ) + ) + + return next || '...' + } + + bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { + return { bind: '<=>', get: '<=', put: '=>' } + } + + } + +} diff --git a/value/dict/dict.view.css.ts b/value/dict/dict.view.css.ts new file mode 100644 index 0000000..a687da1 --- /dev/null +++ b/value/dict/dict.view.css.ts @@ -0,0 +1,44 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_dict, { + + Key_values: { + flex: { + grow: 1, + }, + gap: $mol_gap.space, + margin: { + left: $mol_gap.block, + }, + padding: { + left: $mol_gap.block, + }, + }, + + Item_name: { + flex: { + grow: 0, + }, + }, + + Self: { + flex: { + grow: 1, + }, + alignItems: 'flex-start', + position: 'relative', //for type picker bubble positioning + }, + + Item: { + flex: { + grow: 1, + }, + alignItems: 'flex-start', + position: 'relative', //for type picker bubble positioning + }, + + } ) + +} diff --git a/value/dict/dict.view.tree b/value/dict/dict.view.tree new file mode 100644 index 0000000..80c87a2 --- /dev/null +++ b/value/dict/dict.view.tree @@ -0,0 +1,30 @@ +$hyoo_studio_value_dict $mol_list + tree? $mol_tree2_empty + head / + rows / + <= Self $mol_view + sub <= self / + ^ head + <= Type $hyoo_studio_type + tree? <=> tree? + type => type + bind_options <= bind_options * + Object_option null + <= Value_tools $hyoo_studio_value_tools + tree? <=> tree? + type <= type + props_of!klass <= props_of!klass + <= Key_values $mol_list + rows <= list / + Item* $mol_view + sub / + <= Item_name* $mol_textarea + value? <=> item_key*? \ + <= Value* $hyoo_studio_value + tree? <=> item_value*? $mol_tree2_empty + props_of!klass <= props_of!klass $mol_tree2_empty + props_bindable <= props_bindable $mol_tree2_empty + class_list <= class_list /string + Bound_prop* <= Bound_prop* null + head / + <= Item_name* diff --git a/value/dict/dict.view.ts b/value/dict/dict.view.ts new file mode 100644 index 0000000..fecba26 --- /dev/null +++ b/value/dict/dict.view.ts @@ -0,0 +1,48 @@ +namespace $.$$ { + + export class $hyoo_studio_value_dict extends $.$hyoo_studio_value_dict { + + @ $mol_mem + list() { + return this.tree().kids.map( (_,i)=> this.Item( i ) ) + } + + @ $mol_mem_key + item_key( index: number, next?: string ) { + + if( next && /\s/.test( next ) ) { + $mol_fail( new SyntaxError( `Item key mustn't have any space chars` ) ) + } + + let tree = this.tree() + + if( next !== undefined ) { + tree = this.tree( + tree.insert( tree.struct( next, tree.kids[ index ].kids ), index ) + ) + } + + return tree.kids[ index ].type + } + + @ $mol_mem_key + item_value( index: number, next?: $mol_tree2 ) { + + let tree = this.tree() + + if( next !== undefined ) { + tree = this.tree( + tree.insert( next && tree.kids[ index ].clone( [ next ] ), index ) + ) + } + + return tree.kids[ index ]?.kids[ 0 ] + } + + bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { + return { get: '<=' } + } + + } + +} diff --git a/value/list/list.view.css.ts b/value/list/list.view.css.ts new file mode 100644 index 0000000..8d2eeff --- /dev/null +++ b/value/list/list.view.css.ts @@ -0,0 +1,36 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_list, { + + List_values: { + flex: { + grow: 1, + }, + gap: $mol_gap.space, + margin: { + left: $mol_gap.block, + }, + padding: { + left: $mol_gap.block, + }, + }, + + List_value: { + border: { + radius: $mol_gap.round, + }, + }, + + Self: { + flex: { + grow: 1, + }, + alignItems: 'flex-start', + position: 'relative', //for type picker bubble positioning + }, + + } ) + +} diff --git a/value/list/list.view.tree b/value/list/list.view.tree new file mode 100644 index 0000000..4253fe7 --- /dev/null +++ b/value/list/list.view.tree @@ -0,0 +1,29 @@ +$hyoo_studio_value_list $mol_list + tree? $mol_tree2_empty + head / + rows / + <= Self $mol_view + sub <= self / + ^ head + <= Type $hyoo_studio_type + tree? <=> tree? + type => type + bind_options <= bind_options * + Object_option null + <= Value_tools $hyoo_studio_value_tools + tree? <=> tree? + type <= type + <= List_values $mol_list + rows <= list / + List_value* $hyoo_studio_value + tree? <=> list_value*? $mol_tree2_empty + props_of!klass <= props_of!klass $mol_tree2_empty + props_bindable <= props_bindable $mol_tree2_empty + class_list <= class_list /string + Bound_prop* <= Bound_prop* null + bind_options * + get \<= + Bound_prop* null + props_of!klass $mol_tree2_empty + props_bindable $mol_tree2_empty + class_list /string diff --git a/value/list/list.view.ts b/value/list/list.view.ts new file mode 100644 index 0000000..954e915 --- /dev/null +++ b/value/list/list.view.ts @@ -0,0 +1,27 @@ +namespace $.$$ { + + export class $hyoo_studio_value_list extends $.$hyoo_studio_value_list { + + @ $mol_mem + list() { + return this.tree().kids.map( (_,i)=> this.List_value( i ) ) + } + + @ $mol_mem_key + list_value( index: number, next?: $mol_tree2 ) { + + let tree = this.tree() + if( next !== undefined ) { + tree = this.tree( tree.insert( next, index ) ) + } + + return tree.kids[ index ] + } + + bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { + return { bind: '<=>', get: '<=', put: '=>' } + } + + } + +} diff --git a/value/number/number.view.css.ts b/value/number/number.view.css.ts new file mode 100644 index 0000000..0fe820d --- /dev/null +++ b/value/number/number.view.css.ts @@ -0,0 +1,15 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_number, { + + Numb: { + flex: { + grow: 1, + }, + } + + } ) + +} diff --git a/value/number/number.view.tree b/value/number/number.view.tree new file mode 100644 index 0000000..022b541 --- /dev/null +++ b/value/number/number.view.tree @@ -0,0 +1,9 @@ +$hyoo_studio_value_number $mol_view + tree? $mol_tree2_empty + sub <= self / + <= Type $hyoo_studio_type + tree? <=> tree? + type => type + bind_options <= bind_options * + Object_option null + <= Numb $mol_number diff --git a/value/number/number.view.ts b/value/number/number.view.ts new file mode 100644 index 0000000..9bee262 --- /dev/null +++ b/value/number/number.view.ts @@ -0,0 +1,18 @@ +namespace $.$$ { + + export class $hyoo_studio_value_number extends $.$hyoo_studio_value_number { + + @ $mol_mem + numb( next?: number ) { + + return Number( this.tree( + next === undefined + ? undefined + : this.tree().struct( String( next ) ) + ).type ) + + } + + } + +} diff --git a/value/object/object.view.css.ts b/value/object/object.view.css.ts new file mode 100644 index 0000000..16634fe --- /dev/null +++ b/value/object/object.view.css.ts @@ -0,0 +1,43 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_object, { + + Key_values: { + flex: { + grow: 1, + }, + gap: $mol_gap.space, + margin: { + left: $mol_gap.block, + }, + }, + + Item_name: { + alignSelf: 'center', + color: $mol_theme.shade, + padding: { + left: $mol_gap.block, + }, + }, + + Self: { + flex: { + grow: 1, + }, + alignItems: 'flex-start', + position: 'relative', //for type picker bubble positioning + }, + + Item: { + flex: { + grow: 1, + }, + alignItems: 'flex-start', + position: 'relative', //for type picker bubble positioning + }, + + } ) + +} diff --git a/value/object/object.view.tree b/value/object/object.view.tree new file mode 100644 index 0000000..4b92cf4 --- /dev/null +++ b/value/object/object.view.tree @@ -0,0 +1,3 @@ +$hyoo_studio_value_object $hyoo_studio_value_dict + Item_name* $mol_paragraph + title <= item_key*? diff --git a/value/object/object.view.ts b/value/object/object.view.ts new file mode 100644 index 0000000..f2b05f2 --- /dev/null +++ b/value/object/object.view.ts @@ -0,0 +1,7 @@ +namespace $.$$ { + + export class $hyoo_studio_value_object extends $.$hyoo_studio_value_object { + + } + +} diff --git a/value/string/string.view.tree b/value/string/string.view.tree new file mode 100644 index 0000000..cb90d13 --- /dev/null +++ b/value/string/string.view.tree @@ -0,0 +1,10 @@ +$hyoo_studio_value_string $mol_view + tree? $mol_tree2_empty + sub <= self / + <= Type $hyoo_studio_type + tree? <=> tree? + type => type + bind_options <= bind_options * + Object_option null + <= Str $mol_textarea + value?next <=> str?next \ diff --git a/value/string/string.view.ts b/value/string/string.view.ts new file mode 100644 index 0000000..64d470e --- /dev/null +++ b/value/string/string.view.ts @@ -0,0 +1,20 @@ +namespace $.$$ { + + export class $hyoo_studio_value_string extends $.$hyoo_studio_value_string { + + @ $mol_mem + str( next?: string ) { + + const val = this.tree() + + if (next !== undefined){ + this.tree( val.type == '@' ? val.struct( '@', [ val.data(next) ] ) : val.data(next) ) + return next + } + + return val.text() + } + + } + +} diff --git a/value/tools/tools.view.css.ts b/value/tools/tools.view.css.ts new file mode 100644 index 0000000..d98f196 --- /dev/null +++ b/value/tools/tools.view.css.ts @@ -0,0 +1,21 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_tools, { + + flex: { + grow: 1, + shrink: 1, + }, + + List_items_type: { + width: rem(7), + padding: 0, + color: $mol_theme.special, + textAlign: 'center', + }, + + } ) + +} diff --git a/value/tools/tools.view.tree b/value/tools/tools.view.tree new file mode 100644 index 0000000..878bea2 --- /dev/null +++ b/value/tools/tools.view.tree @@ -0,0 +1,28 @@ +$hyoo_studio_value_tools $mol_view + tree? $mol_tree2_empty + type \ + sub <= tools / + <= List_items_type $mol_string_button + hint @ \Item Type + value?next <=> list_items_type?next \any + <= List_item_add $mol_button_minor + hint @ \Add Item + sub / + <= List_add_icon $mol_icon_plus + click? <=> list_item_add? null + <= Key_item_add $mol_button_minor + hint @ \Add Key + sub / + <= Key_add_icon $mol_icon_plus + click? <=> dict_item_add? null + <= Over_prop_add $mol_select + hint @ \Add Override + align_hor \left + Trigger_icon <= Over_add_icon $mol_icon_wrench_outline + value? <=> over_prop_add? \ + options <= over_prop_options /string + <= Locale $mol_check_icon + hint @ \Multilingual + Icon <= Locale_icon $mol_icon_translate + checked? <=> locale? false + props_of!klass $mol_tree2_empty diff --git a/value/tools/tools.view.ts b/value/tools/tools.view.ts new file mode 100644 index 0000000..d0c50a5 --- /dev/null +++ b/value/tools/tools.view.ts @@ -0,0 +1,115 @@ +namespace $.$$ { + + export class $hyoo_studio_value_tools extends $.$hyoo_studio_value_tools { + + @ $mol_mem + tools() { + switch( this.type() ) { + case 'text': return [ this.Locale() ] + case 'number': return [] + case 'bind': return [] + case 'object': return [ this.Over_prop_add() ] + case 'get': return [] + case 'put': return [] + case 'list': return [ this.List_items_type(), this.List_item_add() ] + case 'dict': return [ this.Key_item_add() ] + } + return [] + } + + @ $mol_mem + value( next?: $mol_tree2 ) { + + let val = this.tree() + + if( next !== undefined ) { + val = this.tree( next && val.clone( [ next ] ) ) + return next + } + + return val?.kids[ 0 ] + } + + dict_item_add() { + const tree = this.tree() + this.tree( + tree.clone([ + ... tree.kids, + tree.struct('key', [tree.struct('null')]), + ]) + ) + } + + list_item_add() { + const tree = this.tree() + this.tree( + tree.clone([ + ... tree.kids, + tree.struct( 'null' ), + ]) + ) + } + + over_prop_add( next: string ) { + + if( !next ) return '' + + const tree = this.tree() + + this.tree( + tree.clone( [ + ...tree.kids, + tree.struct( next, [ + tree.struct( 'null' ), + ] ), + ] ) + ) + + return next + } + + @ $mol_mem + over_prop_options() { + return this.props_of( this.tree().type ).kids.map( prop => prop.type ) + } + + + @ $mol_mem + list_items_type( next?: string ) { + + if( next && /\s/.test( next ) ) { + $mol_fail( new SyntaxError( `Item type mustn't have any space chars` ) ) + } + + const from_tree = this.tree( + next === undefined + ? undefined + : this.tree().struct( '/' + next, this.tree().kids ) + ).type.slice( 1 ) + + const focused = this.List_items_type().focused() + + return (from_tree) || (focused? '' : 'any') + + } + + @ $mol_mem + locale( next?: boolean ) { + + const val = this.tree() + + if( next === undefined ) return '@' === val.type + + this.tree( + next + ? val.struct( '@', [ + val.data( val.text() || val.type ) + ] ) + : val.data( val.text() || val.type ) + ) + + return next + } + } + +} diff --git a/value/value.view.css.ts b/value/value.view.css.ts index 8afd83b..f15a3f7 100644 --- a/value/value.view.css.ts +++ b/value/value.view.css.ts @@ -3,58 +3,11 @@ namespace $.$$ { const { px, rem } = $mol_style_unit $mol_style_define( $hyoo_studio_value, { - - Self: { - flex: { - grow: 1, - }, - alignItems: 'flex-start', - position: 'relative', //for type picker bubble positioning - }, - - Type: { - Trigger: { - color: $mol_theme.special, - }, - }, - - - Numb: { - flex: { - grow: 1, - shrink: 1, - }, - }, - - Str: { - flex: { - grow: 1, - shrink: 1, - }, - }, - - Item_type: { - width: 0, - }, - - List_values: { - flex: { - grow: 1, - }, - gap: $mol_gap.space, - margin: { - left: $mol_gap.block, - }, - padding: { - left: $mol_gap.block, - }, - }, - - List_value: { - border: { - radius: $mol_gap.round, - }, + + flex: { + grow: 1, }, + position: 'relative', //for type picker bubble positioning } ) diff --git a/value/value.view.tree b/value/value.view.tree index e727455..7942107 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -1,47 +1,61 @@ -$hyoo_studio_value $mol_list +$hyoo_studio_value $mol_ghost tree? $mol_tree2_empty - guid \ - parent_type \ - rows / - <= Self $mol_view - sub <= self / - <= Type $hyoo_studio_prop_type - tree? <=> tree? - type => type - bind_options <= bind_options * - Object null - <= Str $mol_textarea - value?next <=> str?next \ - <= Numb $mol_number - value?next <=> numb?next +NaN - <= Over_prop_name $mol_select - hint @ \Overrided Property - value?next <=> name?next \ - options <= prop_name_list - Trigger_icon null - <= Bound_prop_expand $mol_check_expand - checked? <=> bound_expanded? false - <= Bound_prop_name $mol_select - hint @ \Bound Property - value?next <=> bound_prop_name?next null - options <= prop_name_list /string - Trigger_icon null - <= Item_type $mol_string_button - hint @ \Item Type - value?next <=> item_type?next \any - <= List_add $mol_button_minor - hint @ \Add Item - sub / - <= List_add_icon $mol_icon_plus - click?next <=> list_add?next null - <= List_values $mol_list - rows <= list / - List_value* $hyoo_studio_value - parent_type \list - tree? <=> list_value*? $mol_tree2_empty + Bound $hyoo_studio_value_bound + Type <= Type + type? <=> type? + tree? <=> tree? + Value_tools <= Value_tools props_of!klass <= props_of!klass $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty class_list <= class_list /string Bound_prop* <= Bound_prop* null - bind_options * - get \<= + head <= head / + List $hyoo_studio_value_list + Type <= Type + type? <=> type? + tree? <=> tree? + Value_tools <= Value_tools + props_of!klass <= props_of!klass + props_bindable <= props_bindable + class_list <= class_list + Bound_prop* <= Bound_prop* + head <= head / + Dict $hyoo_studio_value_dict + Type <= Type + type? <=> type? + tree? <=> tree? + Value_tools <= Value_tools + props_of!klass <= props_of!klass + props_bindable <= props_bindable + class_list <= class_list + Bound_prop* <= Bound_prop* + head <= head / + Object $hyoo_studio_value_object + Type <= Type + type? <=> type? + tree? <=> tree? + Value_tools <= Value_tools + props_of!klass <= props_of!klass + props_bindable <= props_bindable + class_list <= class_list + Bound_prop* <= Bound_prop* + head <= head / + String $hyoo_studio_value_string + Type <= Type + type? <=> type? + tree? <=> tree? + Number $hyoo_studio_value_number + Type <= Type + type? <=> type? + tree? <=> tree? + Unit $mol_view + sub / <= Type + Type $hyoo_studio_type + tree? <=> tree? + type? => type? + bind_options <= bind_options * + Object_option null + Value_tools $hyoo_studio_value_tools + tree? <=> tree? + type? <= type? + props_of!klass <= props_of!klass diff --git a/value/value.view.ts b/value/value.view.ts index 0e771fb..a280e6f 100644 --- a/value/value.view.ts +++ b/value/value.view.ts @@ -3,168 +3,21 @@ namespace $.$$ { export class $hyoo_studio_value extends $.$hyoo_studio_value { @ $mol_mem - self() { - const Head = this.parent_type() == 'object'? [this.Over_prop_name(), this.Type()] : [this.Type()] + Sub() { switch( this.type() ) { - case 'null': return [ ...Head, ] - case 'boolean_true': return [ ...Head, ] - case 'boolean_false': return [ ...Head, ] - case 'number_nan': return [ ...Head, ] - case 'number_infinity_negative': return [ ...Head, ] - case 'number_infinity_positive': return [ ...Head, ] - case 'text': return [ ...Head, this.Str() ] - case 'number': return [ ...Head, this.Numb(), ] - case 'bind': return this.bound_expanded() ? [ this.Opened_bound_prop() ] : [ ...Head, this.Bound_prop_name(), this.Bound_prop_expand(), ] - case 'get': return this.bound_expanded() ? [ this.Opened_bound_prop() ] : [ ...Head, this.Bound_prop_name(), this.Bound_prop_expand() ] - case 'put': return this.bound_expanded() ? [ this.Opened_bound_prop() ] : [ ...Head, this.Bound_prop_name(), this.Bound_prop_expand(), ] - case 'list': return [ ...Head, this.Item_type(), this.List_add() ] - case 'dict': return [ ...Head, ] - default: return [] + case 'text': return this.String() + case 'number': return this.Number() + case 'bind': return this.Bound() + case 'object': return this.Object() + case 'get': return this.Bound() + case 'put': return this.Bound() + case 'list': return this.List() + case 'dict': return this.Dict() } - } - - @ $mol_mem - guid() { - return $mol_guid() - } - - @ $mol_mem - Opened_bound_prop() { - const prop = this.Bound_prop( this.bound_prop_name() + ':' + this.guid() ) - prop.expanded = ( next?: boolean ) => this.bound_expanded( next ) - prop.expander_title = () => '' - prop.label_sub = () => [ - ...(this.parent_type() == 'object'? [this.Over_prop_name()]: []), - this.Type(), this.Bound_prop_name(), prop.Trigger(), prop.Prop_tools() - ] - return prop - } - - @ $mol_mem - str( next?: string ) { - - const val = this.tree() - - if (next !== undefined){ - this.tree( val.type == '@' ? val.struct( '@', [ val.data(next) ] ) : val.data(next) ) - return next - } - - return val.text() - } - - @ $mol_mem - prop_bind( next?: '<=' | '<=>' | '=>' ) { - - const val = this.tree() - - if( next === undefined ) return val.type - - this.tree( - val.struct( next, val.kids ) - ) - - return next - } - - @ $mol_mem - prop_name_list() { - return this.props_bindable().kids.map( prop => prop.type ) - } - - @ $mol_mem - bound_prop_name( next?: string ) { - - const val = this.tree() - - if( next === undefined ) { - return this.$.$mol_view_tree2_prop_split( val.kids[ 0 ] ).name.text() || '...' - } - - this.tree( - val.insert( val.struct( next ), null ) - ) - - return next || '...' - } - - @ $mol_mem - numb( next?: number ) { - - return Number( this.tree( - next === undefined - ? undefined - : this.tree().struct( String( next ) ) - ).type ) - - } - - @ $mol_mem - unit( next?: string ) { - - return this.tree( - next === undefined - ? undefined - : this.tree().struct( next ) - ).type - - } - - @ $mol_mem - obj( next?: string ) { - - return this.tree( - next === undefined - ? undefined - : this.tree().struct( next ) - ).type - - } - - @ $mol_mem - list() { - return this.type() == 'list' ? this.tree().kids.map( (_,i)=> this.List_value( i ) ) : [] - } - - @ $mol_mem - item_type( next?: string ) { - - if( next && /\s/.test( next ) ) { - $mol_fail( new SyntaxError( `Item type mustn't have any space chars` ) ) - } - - const from_tree = this.tree( - next === undefined - ? undefined - : this.tree().struct( '/' + next, this.tree().kids ) - ).type.slice( 1 ) - - const focused = this.Item_type().focused() - - return (from_tree) || (focused? '' : 'any') - - } - - list_add() { - const tree = this.tree() - this.tree( - tree.clone([ - ... tree.kids, - tree.struct( 'null' ), - ]) - ) - } - - @ $mol_mem_key - list_value( index: number, next?: $mol_tree2 ) { - let val = this.tree() - if( next !== undefined ) { - val = this.tree( val.insert( next, index ) ) - } - return val.kids[ index ] + return this.Unit() } - bind_options(): ReturnType<$hyoo_studio_prop_type[ 'bind_options' ]> { + bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { return { bind: '<=>', get: '<=', put: '=>' } } From 43519ea89738a28c687c2cc847ee1afef3cb2820 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Mon, 10 Apr 2023 02:09:25 +1100 Subject: [PATCH 06/13] $hyoo_studio_value_unit - base value class --- prop/prop.view.css.ts | 20 +++-- prop/prop.view.tree | 21 +++-- prop/prop.view.ts | 69 ++++++++++------ studio.locale=ru.json | 14 ++-- studio.view.css.ts | 30 ++----- studio.view.tree | 56 +++++++------ studio.view.ts | 141 ++++++++++++++++++++------------ type/type.view.css.ts | 28 +++++-- type/type.view.tree | 12 +-- type/type.view.ts | 100 ++++++++++++++++------ value/bound/bound.view.css.ts | 15 ++++ value/bound/bound.view.tree | 18 +--- value/bound/bound.view.ts | 7 +- value/dict/dict.view.css.ts | 17 +--- value/dict/dict.view.tree | 52 ++++++------ value/dict/dict.view.ts | 11 ++- value/list/list.view.css.ts | 9 +- value/list/list.view.tree | 47 +++++------ value/list/list.view.ts | 12 ++- value/number/number.view.css.ts | 11 ++- value/number/number.view.tree | 11 +-- value/object/object.view.css.ts | 28 +------ value/object/object.view.tree | 23 +++++- value/object/object.view.ts | 27 ++++++ value/string/string.view.css.ts | 32 ++++++++ value/string/string.view.tree | 16 ++-- value/string/string.view.ts | 23 ++++++ value/tools/tools.view.css.ts | 21 ----- value/tools/tools.view.tree | 28 ------- value/tools/tools.view.ts | 115 -------------------------- value/value.view.css.ts | 1 - value/value.view.tree | 84 +++++++------------ value/value.view.ts | 58 ++++++++++--- 33 files changed, 593 insertions(+), 564 deletions(-) create mode 100644 value/string/string.view.css.ts delete mode 100644 value/tools/tools.view.css.ts delete mode 100644 value/tools/tools.view.tree delete mode 100644 value/tools/tools.view.ts diff --git a/prop/prop.view.css.ts b/prop/prop.view.css.ts index 38507b5..00e13dd 100644 --- a/prop/prop.view.css.ts +++ b/prop/prop.view.css.ts @@ -3,6 +3,7 @@ namespace $.$$ { const { px, rem, per } = $mol_style_unit $mol_style_define( $hyoo_studio_prop, { + flex: { grow: 1, }, @@ -17,6 +18,17 @@ namespace $.$$ { flex: { grow: 1, }, + padding: { + bottom: $mol_gap.space, + left: $mol_gap.space, + }, + Bound: { + Self: { + padding: { + left: $mol_gap.block, + }, + }, + }, }, Object: { @@ -29,10 +41,6 @@ namespace $.$$ { }, }, - Label: { - position: 'relative', //for type picker bubble positioning - }, - Label_content: { flex: { wrap: 'wrap', @@ -56,10 +64,6 @@ namespace $.$$ { }, }, - Key: { - marginLeft: 'auto', - }, - } ) } diff --git a/prop/prop.view.tree b/prop/prop.view.tree index d319946..82b4c37 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -17,14 +17,8 @@ $hyoo_studio_prop $mol_view expanded? <=> expanded? Tools <= Prop_tools $mol_view sub <= prop_tools / - <= Type $hyoo_studio_type - tree? <=> value? - type? => type? - class_list <= class_list /string - <= Value_tools $hyoo_studio_value_tools - tree? <=> value? - type? <= type? - props_of!klass <= props_of!klass + <= Value_tools $mol_view + sub <= value_tools <= Key $mol_check_icon hint @ \Multiple values by key Icon <= Key_icon $mol_icon_key_change @@ -35,10 +29,15 @@ $hyoo_studio_prop $mol_view checked? <=> changeable? false content <= prop_content / <= Value $hyoo_studio_value - Type null - Value_tools null + hide_tools true + value_tools => value_tools + belong_to \prop tree? <=> value? $mol_tree2_empty - type? <= type? props_of!klass <= props_of!klass $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty + class_list <= class_list /string Bound_prop* <= Bound_prop* null + focus_class? null + event * + ^ + click? <=> show_info? null diff --git a/prop/prop.view.ts b/prop/prop.view.ts index 67228cc..c196efa 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -39,28 +39,32 @@ namespace $.$$ { } prop_content() { - switch (this.type()) { - case 'object': return [ this.Value() ] - case 'text': return [ this.Value() ] - case 'number': return [ this.Value() ] - case 'list': return [ this.Value() ] - case 'dict': return [ this.Value() ] - case 'bind': return [ this.Value() ] - case 'get': return [ this.Value() ] - case 'put': return [ this.Value() ] - default: return [] + switch (this.Value().type()) { + case 'object': + case 'text': + case 'number': + case 'list': + case 'dict': + case 'bind': + case 'get': + case 'put': + return [ this.Value() ] + default: + return [] } } @ $mol_mem expandable() { - switch (this.type()) { - case 'object': return true - case 'text': return true - case 'number': return true - case 'list': return true - case 'dict': return true - default: return false + switch (this.Value().type()) { + case 'object': + case 'text': + case 'number': + case 'list': + case 'dict': + return true + default: + return false } } @@ -70,7 +74,8 @@ namespace $.$$ { if ( next !== undefined ) return next as never let expanded: boolean | undefined = $mol_wire_probe( () => this.expanded() ) - const type = this.type() + + const type = this.Value().type() if ( !expanded ) { switch (type) { @@ -78,14 +83,19 @@ namespace $.$$ { case 'list': case 'dict': return this.value().kids.length > 0 ? false : true - case 'text': return this.value().text().length > 40 ? false : true - case 'null' : return true - case 'boolean_true' : return true - case 'boolean_false' : return true - case 'number' : return true - case 'number_nan' : return true - case 'number_infinity_negative' : return true - case 'number_infinity_positive' : return true + case 'text': + return this.value().text().length > 40 ? false : true + case 'null' : + case 'boolean_true' : + case 'boolean_false' : + case 'number' : + case 'number_nan' : + case 'number_infinity_negative' : + case 'number_infinity_positive' : + case 'bind': + case 'get': + case 'put': + return true } return false } @@ -100,11 +110,18 @@ namespace $.$$ { if( next !== undefined ) { val = this.tree( next && val.clone( [ next ] ) ) + this.expanded( true ) return next } return val?.kids[ 0 ] } + @ $mol_mem + show_info(event?: Event) { + event?.stopPropagation() + this.focus_class( this.Value().selected_obj() ) + } + } } diff --git a/studio.locale=ru.json b/studio.locale=ru.json index 5a28637..ebe1b90 100644 --- a/studio.locale=ru.json +++ b/studio.locale=ru.json @@ -2,9 +2,11 @@ "$hyoo_studio_Source_page_title": "Сырой код", "$hyoo_studio_Inspector_open_hint": "Инспектор", "$hyoo_studio_Preview_open_hint": "Предпросмотр", - "$hyoo_studio_Pack_field_name": "Приложение донор компонентов", - "$hyoo_studio_Base_field_name": "Базовый класс", - "$hyoo_studio_Self_field_name": "Имя компонента", + "$hyoo_studio_Pack_field_name": "Сайт приложения", + "$hyoo_studio_Repo_field_name": "GitHub репозиторий", + "$hyoo_studio_Donor_expander_title": "Приложение донор компонентов", + "$hyoo_studio_component_head_Self_field_name": "Имя компонента", + "$hyoo_studio_component_head_Base_field_name": "Базовый класс", "$hyoo_studio_Prop_filter_hint": "Искать свойство или Добавить новое..", "$hyoo_studio_Prop_add_hint": "Добавить это свойство", "$hyoo_studio_Source_field_name": "View.Tree Исходник", @@ -13,5 +15,7 @@ "$hyoo_studio_Inspect_depth_title": "Мин. глубина", "$hyoo_studio_Inspect_stat_vert_title": "кол-во", "$hyoo_studio_Inspect_stat_hor_title": "глубина", - "$hyoo_studio_Inspect_title": "Инспектор" -} \ No newline at end of file + "$hyoo_studio_Inspect_title": "Инспектор", + "$hyoo_studio_component_head_Self_field_name_title": "Имя компонента", + "$hyoo_studio_component_head_Base_field_name_title": "Базовый класс" +} diff --git a/studio.view.css.ts b/studio.view.css.ts index 047c99b..f3d68a7 100644 --- a/studio.view.css.ts +++ b/studio.view.css.ts @@ -4,6 +4,13 @@ namespace $.$$ { $mol_style_define( $hyoo_studio, { + Donor_expander: { + padding: { + top: $mol_gap.block, + bottom: $mol_gap.block, + }, + }, + Edit: { flex: { @@ -22,29 +29,10 @@ namespace $.$$ { }, Classes: { - flex: { wrap: 'wrap', }, - margin: $mol_gap.block, - padding: $mol_gap.block, overflow: 'visible', - - }, - - Self_field: { - alignItems: 'center', - padding: 0, - }, - Self_field_name: { - color: $mol_theme.shade - }, - Base_field: { - alignItems: 'center', - padding: 0, - }, - Base_field_name: { - color: $mol_theme.shade }, $mol_form_field: { @@ -53,10 +41,6 @@ namespace $.$$ { }, }, - Base: { - alignSelf: 'stretch', - }, - Props_controls: { padding: $mol_gap.block, }, diff --git a/studio.view.tree b/studio.view.tree index 87e4aef..8e8004b 100644 --- a/studio.view.tree +++ b/studio.view.tree @@ -9,6 +9,11 @@ $hyoo_studio $mol_book2 <= Source_link $mol_link_source uri \https://github.com/hyoo-ru/studio.hyoo.ru <= Lights $mol_lights_toggle + <= Readme_open $mol_check_icon + hint @ \Components Readme + checked? <=> readme_show? false + sub / + <= Readme_toggle_icon $mol_icon_information_outline <= Code_open $mol_check_icon hint @ \Show Editor checked? <=> code_show? false @@ -28,7 +33,7 @@ $hyoo_studio $mol_book2 <= Edit_form $mol_list rows <= form_sections / <= Donor_expander $mol_expander - label @ \Components Donor App + title @ \Components Donor App content / <= Pack_field $mol_form_field name @ \Donor App website @@ -36,31 +41,18 @@ $hyoo_studio $mol_book2 query? <=> pack? \https://mol.hyoo.ru suggests <= suggests / \https://mol.hyoo.ru - \https://todomvc.hyoo.ru <= Repo_field $mol_form_field - name @ \Donor App repo - control <= Repo $mol_string + name @ \Donor GitHub repo + control <= Repo $mol_textarea hint <= repo value? <=> repo? \hyoo-ru/mam_mol <= Config $mol_list rows / - <= Classes $mol_card - sub / - <= Self_field $mol_row - sub / - <= Self_field_name $mol_paragraph - title @ \Component - <= Self $mol_string - hint \$hyoo_studio_example - value?val <=> self?val \ - <= Base_field $mol_row - sub / - <= Base_field_name $mol_paragraph - title @ \Base class - <= Base $mol_select - value?val <=> base?val \ - options <= base_options /string - - align \bottom + <= Classes $hyoo_studio_component_head + self? <=> self? \ + base? <=> base? \ + base_options <= base_options /string + focus_class? <=> readme_module_name? - <= Props_inherited_field $mol_form_field name @ \Display inherited properties control <= Props_inherited_control $mol_check_list @@ -83,9 +75,9 @@ $hyoo_studio $mol_book2 rows <= props /$hyoo_studio_prop <= Readme_page $mol_app_demo_readme repo <= repo - opened? <=> readme_show? false - module <= module /string + module? <= readme_module? /string source_link <= source_link \ + opened? <=> readme_show? <= Source_page $mol_page title @ \Raw Code body / @@ -118,6 +110,7 @@ $hyoo_studio $mol_book2 value <= inspect_graph null Prop* $hyoo_studio_prop name <= prop_name* \default + focus_class? <=> readme_module_name? \ sign? <=> prop_sign*? \ tree? <=> prop_tree!tree_node_str? $mol_tree2_empty props_of!klass <= props_of!klass $mol_tree2_empty @@ -125,3 +118,20 @@ $hyoo_studio $mol_book2 class_list <= class_list /string Bound_prop* <= Bound_prop* $hyoo_studio_prop Placeholder null + +$hyoo_studio_component_head $mol_view + sub / + <= Self_field $mol_form_field + name @ \Component Name + control <= Self $mol_string + hint \$hyoo_studio_example + value?val <=> self?val \ + <= Base_field $mol_form_field + name @ \Base Class + control <= Base $mol_select + value?val <=> base?val \ + options <= base_options /string + focus_class? null + event * + ^ + click? <=> show_info? null diff --git a/studio.view.ts b/studio.view.ts index 3d6de50..54adb06 100644 --- a/studio.view.ts +++ b/studio.view.ts @@ -13,6 +13,10 @@ namespace $.$$ { code_show( next?: boolean ) { return this.$.$mol_state_arg.value( 'raw', next?.valueOf && ( next ? '' : null ) ) !== null } + + readme_show( next?: boolean ) { + return this.$.$mol_state_arg.value( 'readme', next?.valueOf && ( next ? '' : null ) ) !== null + } @ $mol_mem pages() { @@ -34,7 +38,80 @@ namespace $.$$ { source( next?: string ): string { return this.$.$mol_state_arg.value( 'source', next ) ?? super.source() } + + @ $mol_mem + preview_html() { + + const self = this.self() + const script = new URL( 'web.js', this.pack() ).toString() + const theme = this.Theme().theme() + + return ` + +
+ + + + + + ` + + } + + @ $mol_mem + preview_window() { + this.$.$mol_wait_rest() + this.preview_html() + this.preview_show() + return super.preview_window() + } + @ $mol_mem + inspect_graph() { + + const win = this.preview_window() + + try { + win['$mol_view'].autobind() + return $mol_wire_graph( win['$mol_view']['autobind()'] ) + } catch( error: any ) { + if( 'then' in error ) return $mol_fail_hidden( new Promise( ( done, fail )=> error.then( done, fail ) ) ) + $mol_fail_hidden( new Error( error.message ) ) + } + + } + + @ $mol_mem + inspect_stat() { + return this.inspect_graph().group_depth_min.map( nodes => nodes.length ) + } + + inspect_stat_depth() { + return Object.keys( this.inspect_stat() ).map( Number ) + } + + @ $mol_mem + readme_module( next?: any ) { + + const split = this.readme_module_name().replace( /_demo.*$/ , '' ).split('_') + + return split.slice(1) + } + + @ $mol_mem + source_link() { + + const pieces = this.readme_module_name().split('_').slice(1) + + return `https://github.com/${this.repo()}/tree/master/${pieces.join('/')}` + + } + + @ $mol_mem + base_class_readme( next?: any ) { + this.readme_module_name(this.base()) + } + @ $mol_mem library() { const uri = new URL( 'web.view.tree', this.pack() ).toString() @@ -95,57 +172,6 @@ namespace $.$$ { return next } - @ $mol_mem - preview_html() { - - const self = this.self() - const script = new URL( 'web.js', this.pack() ).toString() - const theme = this.Theme().theme() - - return ` - - - - - - - - ` - - } - - @ $mol_mem - preview_window() { - this.$.$mol_wait_rest() - this.preview_html() - this.preview_show() - return super.preview_window() - } - - @ $mol_mem - inspect_graph() { - - const win = this.preview_window() - - try { - win['$mol_view'].autobind() - return $mol_wire_graph( win['$mol_view']['autobind()'] ) - } catch( error: any ) { - if( 'then' in error ) return $mol_fail_hidden( new Promise( ( done, fail )=> error.then( done, fail ) ) ) - $mol_fail_hidden( new Error( error.message ) ) - } - - } - - @ $mol_mem - inspect_stat() { - return this.inspect_graph().group_depth_min.map( nodes => nodes.length ) - } - - inspect_stat_depth() { - return Object.keys( this.inspect_stat() ).map( Number ) - } - @ $mol_mem self_code() { @@ -294,6 +320,7 @@ namespace $.$$ { obj.props_of = ( klass: any ) => this.props_of( klass ) obj.props_bindable = () => this.props_all() obj.class_list = () => this.class_list() + obj.focus_class = ( next?: any ) => this.readme_module_name( next ) obj.Bound_prop = ( id: any ) => this.Bound_prop( id ) return obj } @@ -310,7 +337,17 @@ namespace $.$$ { return this.props_all().select( sign ).kids[0] ?? null } - + } + + + export class $hyoo_studio_component_head extends $.$hyoo_studio_component_head { + + @ $mol_mem + show_info(event?: Event) { + event?.stopPropagation() + this.focus_class( this.base() ) + } + } } diff --git a/type/type.view.css.ts b/type/type.view.css.ts index ebd86cc..8485b51 100644 --- a/type/type.view.css.ts +++ b/type/type.view.css.ts @@ -16,20 +16,30 @@ namespace $.$$ { flex: 'none', }, - position: 'static', //because pop_bubble should be relative to prop card - Value: { color: $mol_theme.special, }, + List_items_type: { + flex: { + grow: 0, + }, + View: { + Rows: { + flexDirection: 'row', + '::after': { + content: '"[]"', + }, + }, + }, + Edit: { + boxShadow: 'none', + }, + color: $mol_theme.current, + }, + Control: { - border: { - top: { - color: $mol_theme.line, - style: 'solid', - width: px(1), - } - } + borderTop: 'solid 1px var(--mol_theme_line)', } } ) diff --git a/type/type.view.tree b/type/type.view.tree index 37ad700..ce67a92 100644 --- a/type/type.view.tree +++ b/type/type.view.tree @@ -1,5 +1,6 @@ $hyoo_studio_type $mol_pick tree?val $mol_tree2_empty + belong_to \ trigger_content / <= Value $mol_paragraph title <= type_display \ bubble_content / @@ -10,21 +11,20 @@ $hyoo_studio_type $mol_pick null \null boolean_false \false boolean_true \true + number_nan \NaN <= Number_options $mol_switch value? <=> switch_type? \ options <= number_options * number \number - number_nan \NaN number_infinity_negative \-Infinity number_infinity_positive \+Infinity <= Other_options_group $mol_view - sub / + sub <= other_options_group / <= Other_options $mol_switch value? <=> switch_type? \ options <= other_options * - text \text - list \list - dict \dict + <= List_items_type $mol_textarea + value? <=> list_items_type? \ <= Object_option $mol_check title \object click <= show_obj_select null @@ -47,4 +47,4 @@ $hyoo_studio_type $mol_pick Trigger_icon null bubble_content => Obj_bubble_content obj_select_showed? false - align_hor \center + list_type_showed? false diff --git a/type/type.view.ts b/type/type.view.ts index 753c983..e4e5c13 100644 --- a/type/type.view.ts +++ b/type/type.view.ts @@ -2,8 +2,39 @@ namespace $.$$ { export class $hyoo_studio_type extends $.$hyoo_studio_type { + belong_to(): 'prop' | 'subprop' | 'list' | 'dict' | string { + return 'prop' + } + bind_options(): Partial<{ bind: '<=>', get: '<=', put: '=>' }> { - return { bind: '<=>', get: '<=', put: '=>' } + switch (this.belong_to()) { + case 'prop': return { bind: '<=>', get: '<=', put: '=>' } + case 'subprop': return { bind: '<=>', get: '<=', put: '=>' } + case 'list': return { get: '<='} + case 'dict': return { get: '<='} + default: return { bind: '<=>', get: '<=', put: '=>' } + } + } + + other_options(): Partial<{ text: 'text', dict: 'dict', list: 'list' }> { + return { + text: 'text', dict: 'dict', + ...(this.list_type_showed() ? {} : {list: 'list'}) + } + } + + @ $mol_mem + other_options_group(){ + return [ + this.Other_options(), + ...(this.list_type_showed() ? [this.List_items_type()] : []), + ...(this.belong_to() === 'prop'? [this.Object_option()] : []), + ] + } + + @ $mol_mem + list_type_showed() { + return this.type() === 'list' ? true : false } switch_type(next?: string) { @@ -26,6 +57,9 @@ namespace $.$$ { type_display() { const type = this.type() + if (type === 'list') { + return `${this.list_items_type() === 'any'? '': this.list_items_type()} list` + } if (type === 'object') { return this.selected_obj() } if (this.unit_options()[type]) return this.unit_options()[type] if (this.number_options()[type]) return this.number_options()[type] @@ -59,29 +93,10 @@ namespace $.$$ { default : $mol_fail( new TypeError( `Unsupported type: ${ next }` ) ) } - this.showed(false) + this.showed(false) } - const val = this.tree() - - if( !val ) return '' - - if (val.type === '+NaN') return 'number_nan' - if (val.type === '+Infinity') return 'number_infinity_positive' - if (val.type === '-Infinity') return 'number_infinity_negative' - - const type = this.$.$mol_view_tree2_value_type( val ) - - if (type === 'null') return 'null' - if (type === 'bool') return val.type === 'true' ? 'boolean_true' : 'boolean_false' - if (type === 'number') return 'number' - if (type === 'locale' ) return 'text' - if (type === 'string') return 'text' - if (type === 'get' ) return 'get' - if (type === 'put' ) return 'put' - if (type === 'bind') return 'bind' - - return type + return $hyoo_studio_type_value(this.tree()) } show_obj_select() { @@ -96,9 +111,48 @@ namespace $.$$ { return this.tree(this.tree().struct( next )).type } - return this.tree().type + return this.tree()?.type + } + + @ $mol_mem + list_items_type(next?: string) { + + if( next && /\s/.test( next ) ) { + $mol_fail( new SyntaxError( `Item type mustn't have any space chars` ) ) + } + + const from_tree = this.tree( + next === undefined + ? undefined + : this.tree().struct( '/' + next, this.tree().kids ) + ).type.slice( 1 ) + + const focused = this.List_items_type().focused() + + return (from_tree) || (focused? '' : 'any') } } + export function $hyoo_studio_type_value(val: $mol_tree2_empty) { + if( !val ) return '' + + if (val.type === '+NaN') return 'number_nan' + if (val.type === '+Infinity') return 'number_infinity_positive' + if (val.type === '-Infinity') return 'number_infinity_negative' + + const type = $$.$mol_view_tree2_value_type( val ) + + if (type === 'null') return 'null' + if (type === 'bool') return val.type === 'true' ? 'boolean_true' : 'boolean_false' + if (type === 'number') return 'number' + if (type === 'locale' ) return 'text' + if (type === 'string') return 'text' + if (type === 'get' ) return 'get' + if (type === 'put' ) return 'put' + if (type === 'bind') return 'bind' + + return type + } + } diff --git a/value/bound/bound.view.css.ts b/value/bound/bound.view.css.ts index d14768e..e91bc76 100644 --- a/value/bound/bound.view.css.ts +++ b/value/bound/bound.view.css.ts @@ -7,9 +7,24 @@ namespace $.$$ { Bound_prop_name: { Option_label: { padding: 0, + }, + Menu: { + padding: { + left: $mol_gap.block, + right: $mol_gap.block, + }, + }, + Trigger: { + justifyContent: 'center', } }, + Self: { + flex: { + grow: 1, + }, + }, + } ) } diff --git a/value/bound/bound.view.tree b/value/bound/bound.view.tree index 7adf90e..04bf37b 100644 --- a/value/bound/bound.view.tree +++ b/value/bound/bound.view.tree @@ -1,15 +1,7 @@ -$hyoo_studio_value_bound $mol_view - tree? $mol_tree2_empty - guid \ - Opened_bound_prop $hyoo_studio_prop - head / - sub <= self / +$hyoo_studio_value_bound $hyoo_studio_value_unit + self / ^ head - <= Type $hyoo_studio_type - tree? <=> tree? - type => type - bind_options <= bind_options * - Object_option null + <= Value_tools <= Bound_prop_name $mol_select hint @ \Bound Property value?next <=> bound_prop_name?next null @@ -17,7 +9,3 @@ $hyoo_studio_value_bound $mol_view Trigger_icon null <= Bound_prop_expand $mol_check_expand checked? <=> bound_expanded? false - Bound_prop* null - props_of!klass $mol_tree2_empty - props_bindable $mol_tree2_empty - class_list /string diff --git a/value/bound/bound.view.ts b/value/bound/bound.view.ts index 4c782e9..15c0ccc 100644 --- a/value/bound/bound.view.ts +++ b/value/bound/bound.view.ts @@ -26,7 +26,7 @@ namespace $.$$ { const prop = this.Bound_prop( this.bound_prop_name() + ':' + this.guid() ) prop.trigger_label = () => [] prop.label_sub = () => [ - ...this.head(), this.Type(), this.Bound_prop_name(), prop.Trigger(), prop.Prop_tools() + ...this.head(), this.Value_tools(), this.Bound_prop_name(), prop.Trigger(), prop.Prop_tools() ] return prop } @@ -51,11 +51,6 @@ namespace $.$$ { return next || '...' } - - bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { - return { bind: '<=>', get: '<=', put: '=>' } - } - } } diff --git a/value/dict/dict.view.css.ts b/value/dict/dict.view.css.ts index a687da1..59be579 100644 --- a/value/dict/dict.view.css.ts +++ b/value/dict/dict.view.css.ts @@ -9,9 +9,6 @@ namespace $.$$ { grow: 1, }, gap: $mol_gap.space, - margin: { - left: $mol_gap.block, - }, padding: { left: $mol_gap.block, }, @@ -21,22 +18,16 @@ namespace $.$$ { flex: { grow: 0, }, - }, - - Self: { - flex: { - grow: 1, + Edit: { + boxShadow: 'none', }, - alignItems: 'flex-start', - position: 'relative', //for type picker bubble positioning }, - Item: { + Self: { flex: { grow: 1, + direction: 'column', }, - alignItems: 'flex-start', - position: 'relative', //for type picker bubble positioning }, } ) diff --git a/value/dict/dict.view.tree b/value/dict/dict.view.tree index 80c87a2..2cc4792 100644 --- a/value/dict/dict.view.tree +++ b/value/dict/dict.view.tree @@ -1,30 +1,28 @@ -$hyoo_studio_value_dict $mol_list - tree? $mol_tree2_empty - head / - rows / - <= Self $mol_view - sub <= self / +$hyoo_studio_value_dict $hyoo_studio_value_unit + self / + <= Head $mol_view + sub / ^ head - <= Type $hyoo_studio_type - tree? <=> tree? - type => type - bind_options <= bind_options * - Object_option null - <= Value_tools $hyoo_studio_value_tools - tree? <=> tree? - type <= type - props_of!klass <= props_of!klass + <= Value_tools <= Key_values $mol_list rows <= list / - Item* $mol_view - sub / - <= Item_name* $mol_textarea - value? <=> item_key*? \ - <= Value* $hyoo_studio_value - tree? <=> item_value*? $mol_tree2_empty - props_of!klass <= props_of!klass $mol_tree2_empty - props_bindable <= props_bindable $mol_tree2_empty - class_list <= class_list /string - Bound_prop* <= Bound_prop* null - head / - <= Item_name* + <= Item*0 $mol_view + sub / + <= Item_name* $mol_textarea + value? <=> item_key*? \ + <= Value* $hyoo_studio_value + tree? <=> item_value*? $mol_tree2_empty + belong_to \dict + props_of!klass <= props_of!klass $mol_tree2_empty + props_bindable <= props_bindable $mol_tree2_empty + class_list <= class_list /string + Bound_prop* <= Bound_prop* null + head / + <= Item_name* + tools / + <= Type + <= Key_item_add $mol_button_minor + hint @ \Add Key + sub / + <= Key_add_icon $mol_icon_plus + click? <=> dict_item_add? null diff --git a/value/dict/dict.view.ts b/value/dict/dict.view.ts index fecba26..e24bb7a 100644 --- a/value/dict/dict.view.ts +++ b/value/dict/dict.view.ts @@ -39,10 +39,15 @@ namespace $.$$ { return tree.kids[ index ]?.kids[ 0 ] } - bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { - return { get: '<=' } + dict_item_add() { + const tree = this.tree() + this.tree( + tree.clone([ + ... tree.kids, + tree.struct('key', [tree.struct('null')]), + ]) + ) } - } } diff --git a/value/list/list.view.css.ts b/value/list/list.view.css.ts index 8d2eeff..38d94f3 100644 --- a/value/list/list.view.css.ts +++ b/value/list/list.view.css.ts @@ -16,19 +16,12 @@ namespace $.$$ { left: $mol_gap.block, }, }, - - List_value: { - border: { - radius: $mol_gap.round, - }, - }, Self: { flex: { grow: 1, + direction: 'column', }, - alignItems: 'flex-start', - position: 'relative', //for type picker bubble positioning }, } ) diff --git a/value/list/list.view.tree b/value/list/list.view.tree index 4253fe7..56a8fac 100644 --- a/value/list/list.view.tree +++ b/value/list/list.view.tree @@ -1,29 +1,22 @@ -$hyoo_studio_value_list $mol_list - tree? $mol_tree2_empty - head / - rows / - <= Self $mol_view - sub <= self / +$hyoo_studio_value_list $hyoo_studio_value_unit + self / + <= Head $mol_view + sub / ^ head - <= Type $hyoo_studio_type - tree? <=> tree? - type => type - bind_options <= bind_options * - Object_option null - <= Value_tools $hyoo_studio_value_tools - tree? <=> tree? - type <= type + <= Value_tools <= List_values $mol_list - rows <= list / - List_value* $hyoo_studio_value - tree? <=> list_value*? $mol_tree2_empty - props_of!klass <= props_of!klass $mol_tree2_empty - props_bindable <= props_bindable $mol_tree2_empty - class_list <= class_list /string - Bound_prop* <= Bound_prop* null - bind_options * - get \<= - Bound_prop* null - props_of!klass $mol_tree2_empty - props_bindable $mol_tree2_empty - class_list /string + rows <= list / + <= List_value*0 $hyoo_studio_value + tree? <=> list_value*? $mol_tree2_empty + belong_to \list + props_of!klass <= props_of!klass $mol_tree2_empty + props_bindable <= props_bindable $mol_tree2_empty + class_list <= class_list /string + Bound_prop* <= Bound_prop* null + tools / + <= Type + <= List_item_add $mol_button_minor + hint @ \Add Item + sub / + <= List_add_icon $mol_icon_plus + click? <=> list_item_add? null diff --git a/value/list/list.view.ts b/value/list/list.view.ts index 954e915..b6ecfa9 100644 --- a/value/list/list.view.ts +++ b/value/list/list.view.ts @@ -18,10 +18,16 @@ namespace $.$$ { return tree.kids[ index ] } - bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { - return { bind: '<=>', get: '<=', put: '=>' } + list_item_add() { + const tree = this.tree() + this.tree( + tree.clone([ + ... tree.kids, + tree.struct( 'null' ), + ]) + ) } - + } } diff --git a/value/number/number.view.css.ts b/value/number/number.view.css.ts index 0fe820d..7d2f1bc 100644 --- a/value/number/number.view.css.ts +++ b/value/number/number.view.css.ts @@ -4,11 +4,20 @@ namespace $.$$ { $mol_style_define( $hyoo_studio_value_number, { + Self: { + flex: { + grow: 1, + }, + }, + Numb: { flex: { grow: 1, }, - } + String: { + boxShadow: 'none', + }, + }, } ) diff --git a/value/number/number.view.tree b/value/number/number.view.tree index 022b541..8a739de 100644 --- a/value/number/number.view.tree +++ b/value/number/number.view.tree @@ -1,9 +1,4 @@ -$hyoo_studio_value_number $mol_view - tree? $mol_tree2_empty - sub <= self / - <= Type $hyoo_studio_type - tree? <=> tree? - type => type - bind_options <= bind_options * - Object_option null +$hyoo_studio_value_number $hyoo_studio_value_unit + self / <= Numb $mol_number + value?next <=> numb?next +NaN diff --git a/value/object/object.view.css.ts b/value/object/object.view.css.ts index 16634fe..48a2a63 100644 --- a/value/object/object.view.css.ts +++ b/value/object/object.view.css.ts @@ -4,39 +4,13 @@ namespace $.$$ { $mol_style_define( $hyoo_studio_value_object, { - Key_values: { - flex: { - grow: 1, - }, - gap: $mol_gap.space, - margin: { - left: $mol_gap.block, - }, - }, - - Item_name: { + Over_prop_name: { alignSelf: 'center', color: $mol_theme.shade, padding: { left: $mol_gap.block, }, }, - - Self: { - flex: { - grow: 1, - }, - alignItems: 'flex-start', - position: 'relative', //for type picker bubble positioning - }, - - Item: { - flex: { - grow: 1, - }, - alignItems: 'flex-start', - position: 'relative', //for type picker bubble positioning - }, } ) diff --git a/value/object/object.view.tree b/value/object/object.view.tree index 4b92cf4..d45a962 100644 --- a/value/object/object.view.tree +++ b/value/object/object.view.tree @@ -1,3 +1,22 @@ $hyoo_studio_value_object $hyoo_studio_value_dict - Item_name* $mol_paragraph - title <= item_key*? + tools / + <= Type + <= Over_prop_add $mol_select + hint @ \Add Override + align_hor \left + Trigger_icon <= Over_add_icon $mol_icon_wrench_outline + value? <=> over_prop_add? \ + options <= over_prop_options /string + Item* $mol_view + sub / + <= Over_prop_name* $mol_paragraph + title <= item_key*? + <= Value* $hyoo_studio_value + tree? <=> item_value*? + belong_to \subprop + props_of!klass <= props_of!klass + props_bindable <= props_bindable + class_list <= class_list + Bound_prop* <= Bound_prop* + head / + <= Over_prop_name* diff --git a/value/object/object.view.ts b/value/object/object.view.ts index f2b05f2..d1cbe1e 100644 --- a/value/object/object.view.ts +++ b/value/object/object.view.ts @@ -2,6 +2,33 @@ namespace $.$$ { export class $hyoo_studio_value_object extends $.$hyoo_studio_value_object { + over_prop_add( next: string ) { + + if( !next ) return '' + + const tree = this.tree() + + this.tree( + tree.clone( [ + ...tree.kids, + tree.struct( next, [ + tree.struct( 'null' ), + ] ), + ] ) + ) + + return next + } + + @ $mol_mem + over_prop_options() { + return this.props_of( this.tree().type ).kids.map( prop => prop.type ) + } + + @ $mol_mem + prop_name_list() { + return this.props_bindable().kids.map( prop => prop.type ) + } } } diff --git a/value/string/string.view.css.ts b/value/string/string.view.css.ts new file mode 100644 index 0000000..528b820 --- /dev/null +++ b/value/string/string.view.css.ts @@ -0,0 +1,32 @@ +namespace $.$$ { + + const { px, rem } = $mol_style_unit + + $mol_style_define( $hyoo_studio_value_string, { + + padding: { + right: $mol_gap.space, + }, + + Value_tools: { + flex: { + grow: 0, + }, + }, + + Self: { + flex: { + grow: 1, + }, + }, + + Str: { + maxWidth: rem(40), + Edit: { + boxShadow: 'none', + }, + }, + + } ) + +} diff --git a/value/string/string.view.tree b/value/string/string.view.tree index cb90d13..01c592d 100644 --- a/value/string/string.view.tree +++ b/value/string/string.view.tree @@ -1,10 +1,10 @@ -$hyoo_studio_value_string $mol_view - tree? $mol_tree2_empty - sub <= self / - <= Type $hyoo_studio_type - tree? <=> tree? - type => type - bind_options <= bind_options * - Object_option null +$hyoo_studio_value_string $hyoo_studio_value_unit + self / <= Str $mol_textarea value?next <=> str?next \ + tools / + <= Type + <= Locale $mol_check_icon + hint @ \Multilingual + Icon <= Locale_icon $mol_icon_translate + checked? <=> locale? false diff --git a/value/string/string.view.ts b/value/string/string.view.ts index 64d470e..69fecc8 100644 --- a/value/string/string.view.ts +++ b/value/string/string.view.ts @@ -15,6 +15,29 @@ namespace $.$$ { return val.text() } + @ $mol_mem + locale( next?: boolean ) { + + const val = this.tree() + + if( next === undefined ) return '@' === val.type + + this.tree( + next + ? val.struct( '@', [ + val.data( val.text() || val.type ) + ] ) + : val.data( val.text() || val.type ) + ) + + return next + } + + @ $mol_mem + visible_tools(){ + return this.belong_to() === 'prop'? [] : [ this.Type() ] + } + } } diff --git a/value/tools/tools.view.css.ts b/value/tools/tools.view.css.ts deleted file mode 100644 index d98f196..0000000 --- a/value/tools/tools.view.css.ts +++ /dev/null @@ -1,21 +0,0 @@ -namespace $.$$ { - - const { px, rem } = $mol_style_unit - - $mol_style_define( $hyoo_studio_value_tools, { - - flex: { - grow: 1, - shrink: 1, - }, - - List_items_type: { - width: rem(7), - padding: 0, - color: $mol_theme.special, - textAlign: 'center', - }, - - } ) - -} diff --git a/value/tools/tools.view.tree b/value/tools/tools.view.tree deleted file mode 100644 index 878bea2..0000000 --- a/value/tools/tools.view.tree +++ /dev/null @@ -1,28 +0,0 @@ -$hyoo_studio_value_tools $mol_view - tree? $mol_tree2_empty - type \ - sub <= tools / - <= List_items_type $mol_string_button - hint @ \Item Type - value?next <=> list_items_type?next \any - <= List_item_add $mol_button_minor - hint @ \Add Item - sub / - <= List_add_icon $mol_icon_plus - click? <=> list_item_add? null - <= Key_item_add $mol_button_minor - hint @ \Add Key - sub / - <= Key_add_icon $mol_icon_plus - click? <=> dict_item_add? null - <= Over_prop_add $mol_select - hint @ \Add Override - align_hor \left - Trigger_icon <= Over_add_icon $mol_icon_wrench_outline - value? <=> over_prop_add? \ - options <= over_prop_options /string - <= Locale $mol_check_icon - hint @ \Multilingual - Icon <= Locale_icon $mol_icon_translate - checked? <=> locale? false - props_of!klass $mol_tree2_empty diff --git a/value/tools/tools.view.ts b/value/tools/tools.view.ts deleted file mode 100644 index d0c50a5..0000000 --- a/value/tools/tools.view.ts +++ /dev/null @@ -1,115 +0,0 @@ -namespace $.$$ { - - export class $hyoo_studio_value_tools extends $.$hyoo_studio_value_tools { - - @ $mol_mem - tools() { - switch( this.type() ) { - case 'text': return [ this.Locale() ] - case 'number': return [] - case 'bind': return [] - case 'object': return [ this.Over_prop_add() ] - case 'get': return [] - case 'put': return [] - case 'list': return [ this.List_items_type(), this.List_item_add() ] - case 'dict': return [ this.Key_item_add() ] - } - return [] - } - - @ $mol_mem - value( next?: $mol_tree2 ) { - - let val = this.tree() - - if( next !== undefined ) { - val = this.tree( next && val.clone( [ next ] ) ) - return next - } - - return val?.kids[ 0 ] - } - - dict_item_add() { - const tree = this.tree() - this.tree( - tree.clone([ - ... tree.kids, - tree.struct('key', [tree.struct('null')]), - ]) - ) - } - - list_item_add() { - const tree = this.tree() - this.tree( - tree.clone([ - ... tree.kids, - tree.struct( 'null' ), - ]) - ) - } - - over_prop_add( next: string ) { - - if( !next ) return '' - - const tree = this.tree() - - this.tree( - tree.clone( [ - ...tree.kids, - tree.struct( next, [ - tree.struct( 'null' ), - ] ), - ] ) - ) - - return next - } - - @ $mol_mem - over_prop_options() { - return this.props_of( this.tree().type ).kids.map( prop => prop.type ) - } - - - @ $mol_mem - list_items_type( next?: string ) { - - if( next && /\s/.test( next ) ) { - $mol_fail( new SyntaxError( `Item type mustn't have any space chars` ) ) - } - - const from_tree = this.tree( - next === undefined - ? undefined - : this.tree().struct( '/' + next, this.tree().kids ) - ).type.slice( 1 ) - - const focused = this.List_items_type().focused() - - return (from_tree) || (focused? '' : 'any') - - } - - @ $mol_mem - locale( next?: boolean ) { - - const val = this.tree() - - if( next === undefined ) return '@' === val.type - - this.tree( - next - ? val.struct( '@', [ - val.data( val.text() || val.type ) - ] ) - : val.data( val.text() || val.type ) - ) - - return next - } - } - -} diff --git a/value/value.view.css.ts b/value/value.view.css.ts index f15a3f7..74268c1 100644 --- a/value/value.view.css.ts +++ b/value/value.view.css.ts @@ -7,7 +7,6 @@ namespace $.$$ { flex: { grow: 1, }, - position: 'relative', //for type picker bubble positioning } ) diff --git a/value/value.view.tree b/value/value.view.tree index 7942107..8863a10 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -1,61 +1,39 @@ $hyoo_studio_value $mol_ghost tree? $mol_tree2_empty Bound $hyoo_studio_value_bound - Type <= Type - type? <=> type? - tree? <=> tree? - Value_tools <= Value_tools - props_of!klass <= props_of!klass $mol_tree2_empty - props_bindable <= props_bindable $mol_tree2_empty - class_list <= class_list /string - Bound_prop* <= Bound_prop* null - head <= head / List $hyoo_studio_value_list - Type <= Type - type? <=> type? - tree? <=> tree? - Value_tools <= Value_tools - props_of!klass <= props_of!klass - props_bindable <= props_bindable - class_list <= class_list - Bound_prop* <= Bound_prop* - head <= head / Dict $hyoo_studio_value_dict - Type <= Type - type? <=> type? - tree? <=> tree? - Value_tools <= Value_tools - props_of!klass <= props_of!klass - props_bindable <= props_bindable - class_list <= class_list - Bound_prop* <= Bound_prop* - head <= head / Object $hyoo_studio_value_object - Type <= Type - type? <=> type? - tree? <=> tree? - Value_tools <= Value_tools - props_of!klass <= props_of!klass - props_bindable <= props_bindable - class_list <= class_list - Bound_prop* <= Bound_prop* - head <= head / String $hyoo_studio_value_string - Type <= Type - type? <=> type? - tree? <=> tree? Number $hyoo_studio_value_number - Type <= Type - type? <=> type? - tree? <=> tree? - Unit $mol_view - sub / <= Type - Type $hyoo_studio_type - tree? <=> tree? - type? => type? - bind_options <= bind_options * - Object_option null - Value_tools $hyoo_studio_value_tools - tree? <=> tree? - type? <= type? - props_of!klass <= props_of!klass + Unit $hyoo_studio_value_unit + value_tools / + type \ + selected_obj \ + head / + belong_to \prop + hide_tools false + props_of!klass $mol_tree2_empty + props_bindable $mol_tree2_empty + class_list /string + Bound_prop* null + +$hyoo_studio_value_unit $mol_view + head / + belong_to \prop + hide_tools false + props_of!klass $mol_tree2_empty + props_bindable $mol_tree2_empty + class_list /string + Bound_prop* null + sub / + ^ head + <= Value_tools $mol_view + sub <= visible_tools <= tools / + <= Type $hyoo_studio_type + tree? <=> tree? $mol_tree2_empty + type? => type? + belong_to <= belong_to + class_list <= class_list /string + <= Self $mol_view + sub <= self / diff --git a/value/value.view.ts b/value/value.view.ts index a280e6f..850e952 100644 --- a/value/value.view.ts +++ b/value/value.view.ts @@ -4,21 +4,55 @@ namespace $.$$ { @ $mol_mem Sub() { - switch( this.type() ) { - case 'text': return this.String() - case 'number': return this.Number() - case 'bind': return this.Bound() - case 'object': return this.Object() - case 'get': return this.Bound() - case 'put': return this.Bound() - case 'list': return this.List() - case 'dict': return this.Dict() + + let obj = this.Unit() + + switch( this.$.$hyoo_studio_type_value(this.tree()) ) { + case 'text': obj = this.String(); break; + case 'number': obj = this.Number(); break; + case 'bind': obj = this.Bound(); break; + case 'object': obj = this.Object(); break; + case 'get': obj = this.Bound(); break; + case 'put': obj = this.Bound(); break; + case 'list': obj = this.List(); break; + case 'dict': obj = this.Dict(); break; } - return this.Unit() + + obj.hide_tools = () => this.hide_tools() + obj.belong_to = () => this.belong_to() + obj.tree = (next?: any) => this.tree(next) + obj.props_of = (id: any) => this.props_of(id) + obj.props_bindable = () => this.props_bindable() + obj.class_list = () => this.class_list() + obj.Bound_prop = (id: any) => this.Bound_prop(id) + obj.head = () => this.head() + + return obj } + + @ $mol_mem + value_tools(): readonly any[] { + return this.Sub().tools() + } + + @ $mol_mem + type(): string { + return this.Sub().Type().type() + } + + @ $mol_mem + selected_obj(): string { + return this.Sub().Type().selected_obj() + } + + } + + + export class $hyoo_studio_value_unit extends $.$hyoo_studio_value_unit { - bind_options(): ReturnType<$hyoo_studio_type[ 'bind_options' ]> { - return { bind: '<=>', get: '<=', put: '=>' } + @ $mol_mem + visible_tools() { + return this.hide_tools() ? [] : this.tools() } } From 54bdb8176b7c4e1223c4f99ba822e0e5763417bd Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 15 Apr 2023 12:21:55 +1100 Subject: [PATCH 07/13] rename: selected_obj -> selected_class --- prop/prop.view.ts | 2 +- type/type.view.tree | 2 +- type/type.view.ts | 2 +- value/value.view.tree | 2 +- value/value.view.ts | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/prop/prop.view.ts b/prop/prop.view.ts index c196efa..10ef819 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -120,7 +120,7 @@ namespace $.$$ { @ $mol_mem show_info(event?: Event) { event?.stopPropagation() - this.focus_class( this.Value().selected_obj() ) + this.focus_class( this.Value().selected_class() ) } } diff --git a/type/type.view.tree b/type/type.view.tree index ce67a92..20bf632 100644 --- a/type/type.view.tree +++ b/type/type.view.tree @@ -42,7 +42,7 @@ $hyoo_studio_type $mol_pick Object_select $mol_select hint @ \Class align_hor \right - value?next <=> selected_obj?next \$mol_view + value?next <=> selected_class?next \$mol_view options <= class_list /string Trigger_icon null bubble_content => Obj_bubble_content diff --git a/type/type.view.ts b/type/type.view.ts index e4e5c13..df24d57 100644 --- a/type/type.view.ts +++ b/type/type.view.ts @@ -104,7 +104,7 @@ namespace $.$$ { } @ $mol_mem - selected_obj(next?: string) { + selected_class(next?: string) { if ( next !== undefined ) { this.showed(false) diff --git a/value/value.view.tree b/value/value.view.tree index 8863a10..fbda9c5 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -9,7 +9,7 @@ $hyoo_studio_value $mol_ghost Unit $hyoo_studio_value_unit value_tools / type \ - selected_obj \ + selected_class \ head / belong_to \prop hide_tools false diff --git a/value/value.view.ts b/value/value.view.ts index 850e952..d24ee5d 100644 --- a/value/value.view.ts +++ b/value/value.view.ts @@ -41,8 +41,8 @@ namespace $.$$ { } @ $mol_mem - selected_obj(): string { - return this.Sub().Type().selected_obj() + selected_class(): string { + return this.Sub().Type().selected_class() } } From 6efafd49d73e1693fa1a7570ad34d67c8a0fdc52 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 15 Apr 2023 12:28:37 +1100 Subject: [PATCH 08/13] no donor expander --- studio.locale=ru.json | 12 +++------ studio.view.css.ts | 32 ++++++++++++------------ studio.view.tree | 57 +++++++++++++++---------------------------- studio.view.ts | 23 +---------------- 4 files changed, 39 insertions(+), 85 deletions(-) diff --git a/studio.locale=ru.json b/studio.locale=ru.json index ebe1b90..41b5670 100644 --- a/studio.locale=ru.json +++ b/studio.locale=ru.json @@ -2,11 +2,9 @@ "$hyoo_studio_Source_page_title": "Сырой код", "$hyoo_studio_Inspector_open_hint": "Инспектор", "$hyoo_studio_Preview_open_hint": "Предпросмотр", - "$hyoo_studio_Pack_field_name": "Сайт приложения", - "$hyoo_studio_Repo_field_name": "GitHub репозиторий", - "$hyoo_studio_Donor_expander_title": "Приложение донор компонентов", - "$hyoo_studio_component_head_Self_field_name": "Имя компонента", - "$hyoo_studio_component_head_Base_field_name": "Базовый класс", + "$hyoo_studio_Pack_field_name": "Приложение донор компонентов", + "$hyoo_studio_Base_field_name": "Базовый класс", + "$hyoo_studio_Self_field_name": "Имя компонента", "$hyoo_studio_Prop_filter_hint": "Искать свойство или Добавить новое..", "$hyoo_studio_Prop_add_hint": "Добавить это свойство", "$hyoo_studio_Source_field_name": "View.Tree Исходник", @@ -15,7 +13,5 @@ "$hyoo_studio_Inspect_depth_title": "Мин. глубина", "$hyoo_studio_Inspect_stat_vert_title": "кол-во", "$hyoo_studio_Inspect_stat_hor_title": "глубина", - "$hyoo_studio_Inspect_title": "Инспектор", - "$hyoo_studio_component_head_Self_field_name_title": "Имя компонента", - "$hyoo_studio_component_head_Base_field_name_title": "Базовый класс" + "$hyoo_studio_Inspect_title": "Инспектор" } diff --git a/studio.view.css.ts b/studio.view.css.ts index f3d68a7..951e2a3 100644 --- a/studio.view.css.ts +++ b/studio.view.css.ts @@ -4,13 +4,6 @@ namespace $.$$ { $mol_style_define( $hyoo_studio, { - Donor_expander: { - padding: { - top: $mol_gap.block, - bottom: $mol_gap.block, - }, - }, - Edit: { flex: { @@ -25,31 +18,36 @@ namespace $.$$ { }, Edit_form: { + padding: $mol_gap.block, + gap: $mol_gap.block, display: 'flex', }, - Classes: { - flex: { - wrap: 'wrap', - }, - overflow: 'visible', - }, - $mol_form_field: { flex: { grow: 1, }, }, - Props_controls: { - padding: $mol_gap.block, + Pack: { + width: per (100), + }, + + Config: { + gap: $mol_gap.block, }, Props: { - padding: $mol_gap.block, gap: $mol_gap.block, }, + Props_controls: { + padding: { + top: $mol_gap.block, + bottom: $mol_gap.block, + }, + }, + Source_page: { flex: { basis: rem( 40 ), diff --git a/studio.view.tree b/studio.view.tree index 8e8004b..e920898 100644 --- a/studio.view.tree +++ b/studio.view.tree @@ -32,27 +32,26 @@ $hyoo_studio $mol_book2 body / <= Edit_form $mol_list rows <= form_sections / - <= Donor_expander $mol_expander - title @ \Components Donor App - content / - <= Pack_field $mol_form_field - name @ \Donor App website - control <= Pack $mol_search - query? <=> pack? \https://mol.hyoo.ru - suggests <= suggests / - \https://mol.hyoo.ru - <= Repo_field $mol_form_field - name @ \Donor GitHub repo - control <= Repo $mol_textarea - hint <= repo - value? <=> repo? \hyoo-ru/mam_mol + <= Pack_field $mol_form_field + name @ \Components Donor App + Content <= Pack $mol_search + query? <=> pack? \https://mol.hyoo.ru + suggests <= suggests / + \https://mol.hyoo.ru <= Config $mol_list rows / - <= Classes $hyoo_studio_component_head - self? <=> self? \ - base? <=> base? \ - base_options <= base_options /string - focus_class? <=> readme_module_name? + <= Classes $mol_view + sub / + <= Self_field $mol_form_field + name @ \Component Name + Content <= Self $mol_string + hint \$hyoo_studio_example + value?val <=> self?val \ + <= Base_field $mol_form_field + name @ \Base Class + Content <= Base $mol_select + value?val <=> base?val \ + options <= base_options /string - <= Props_inherited_field $mol_form_field name @ \Display inherited properties control <= Props_inherited_control $mol_check_list @@ -74,9 +73,8 @@ $hyoo_studio $mol_book2 <= Props $mol_list rows <= props /$hyoo_studio_prop <= Readme_page $mol_app_demo_readme - repo <= repo + repo <= repo \hyoo-ru/mam_mol module? <= readme_module? /string - source_link <= source_link \ opened? <=> readme_show? <= Source_page $mol_page title @ \Raw Code @@ -118,20 +116,3 @@ $hyoo_studio $mol_book2 class_list <= class_list /string Bound_prop* <= Bound_prop* $hyoo_studio_prop Placeholder null - -$hyoo_studio_component_head $mol_view - sub / - <= Self_field $mol_form_field - name @ \Component Name - control <= Self $mol_string - hint \$hyoo_studio_example - value?val <=> self?val \ - <= Base_field $mol_form_field - name @ \Base Class - control <= Base $mol_select - value?val <=> base?val \ - options <= base_options /string - focus_class? null - event * - ^ - click? <=> show_info? null diff --git a/studio.view.ts b/studio.view.ts index 54adb06..6601d2d 100644 --- a/studio.view.ts +++ b/studio.view.ts @@ -93,20 +93,11 @@ namespace $.$$ { @ $mol_mem readme_module( next?: any ) { - const split = this.readme_module_name().replace( /_demo.*$/ , '' ).split('_') + const split = this.readme_module_name().split('_') return split.slice(1) } - @ $mol_mem - source_link() { - - const pieces = this.readme_module_name().split('_').slice(1) - - return `https://github.com/${this.repo()}/tree/master/${pieces.join('/')}` - - } - @ $mol_mem base_class_readme( next?: any ) { this.readme_module_name(this.base()) @@ -338,16 +329,4 @@ namespace $.$$ { return this.props_all().select( sign ).kids[0] ?? null } } - - - export class $hyoo_studio_component_head extends $.$hyoo_studio_component_head { - - @ $mol_mem - show_info(event?: Event) { - event?.stopPropagation() - this.focus_class( this.base() ) - } - - } - } From 0451e2c3470d10a01c2cc2edd52c5ec678e3f219 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 15 Apr 2023 12:46:07 +1100 Subject: [PATCH 09/13] bind option arrow icons --- prop/prop.view.css.ts | 3 +++ prop/prop.view.tree | 12 +++++----- type/type.view.css.ts | 9 ++++++++ type/type.view.tree | 7 ++++++ type/type.view.ts | 46 +++++++++++++++++++++++++++++++++------ value/bound/bound.view.ts | 4 ++-- value/value.view.tree | 4 ++-- 7 files changed, 69 insertions(+), 16 deletions(-) diff --git a/prop/prop.view.css.ts b/prop/prop.view.css.ts index 00e13dd..38ce763 100644 --- a/prop/prop.view.css.ts +++ b/prop/prop.view.css.ts @@ -62,6 +62,9 @@ namespace $.$$ { flex: { shrink: 1, }, + margin: { + left: 'auto', + }, }, } ) diff --git a/prop/prop.view.tree b/prop/prop.view.tree index 82b4c37..dcc7fdb 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -8,14 +8,16 @@ $hyoo_studio_prop $mol_view <= Label_content $mol_view sub <= label_sub / <= Trigger $mol_check_expand - checked? <=> expanded? false - expandable <= expandable true - label <= trigger_label / + Icon => Trigger_icon + sub <= trigger_sub / <= Expander_title $mol_paragraph title <= name \ + <= Trigger_icon + checked? <=> expanded? false + expandable <= expandable true <= Prop_tools expanded? <=> expanded? - Tools <= Prop_tools $mol_view + Tools <= Prop_tools $mol_view sub <= prop_tools / <= Value_tools $mol_view sub <= value_tools @@ -36,7 +38,7 @@ $hyoo_studio_prop $mol_view props_of!klass <= props_of!klass $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty class_list <= class_list /string - Bound_prop* <= Bound_prop* null + Bound_prop* <= Bound_prop* $hyoo_studio_prop focus_class? null event * ^ diff --git a/type/type.view.css.ts b/type/type.view.css.ts index 8485b51..b121165 100644 --- a/type/type.view.css.ts +++ b/type/type.view.css.ts @@ -19,6 +19,15 @@ namespace $.$$ { Value: { color: $mol_theme.special, }, + Take_put_hack_icon: { + color: $mol_theme.special, + }, + Take_hack_icon: { + color: $mol_theme.special, + }, + Alias_icon: { + color: $mol_theme.special, + }, List_items_type: { flex: { diff --git a/type/type.view.tree b/type/type.view.tree index 20bf632..744d8fa 100644 --- a/type/type.view.tree +++ b/type/type.view.tree @@ -3,6 +3,9 @@ $hyoo_studio_type $mol_pick belong_to \ trigger_content / <= Value $mol_paragraph title <= type_display \ + <= Take_put_hack_icon $mol_icon_arrow_left_right_bold_outline + <= Take_hack_icon $mol_icon_arrow_left_bold_outline + <= Alias_icon $mol_icon_arrow_right_bold_outline bubble_content / <= Options_content $mol_list rows / <= Unit_options $mol_switch @@ -31,6 +34,10 @@ $hyoo_studio_type $mol_pick checked? <= obj_checked? false <= Bind_options $mol_switch value? <=> switch_type? \ + option_label* <= bind_option_label* / + <= Take_put_hack_option $mol_icon_arrow_left_right_bold_outline + <= Take_hack_option $mol_icon_arrow_left_bold_outline + <= Alias_option $mol_icon_arrow_right_bold_outline options <= bind_options * <= Control $mol_view sub / <= Menu_item_delete $mol_button_minor diff --git a/type/type.view.ts b/type/type.view.ts index df24d57..45e30b9 100644 --- a/type/type.view.ts +++ b/type/type.view.ts @@ -53,24 +53,56 @@ namespace $.$$ { return this.type() === 'object'? true : false } + bind_option_label(bind_option: keyof ReturnType<$hyoo_studio_type["bind_options"]>){ + switch (bind_option) { + case 'bind': return [ this.Take_put_hack_option() ] + case 'get': return [ this.Take_hack_option() ] + case 'put': return [ this.Alias_option() ] + } + return [] + } + + bind_option_label_display(bind_option: keyof ReturnType<$hyoo_studio_type["bind_options"]>){ + switch (bind_option) { + case 'bind': return [ this.Take_put_hack_icon() ] + case 'get': return [ this.Take_hack_icon() ] + case 'put': return [ this.Alias_icon() ] + } + return [] + } + + trigger_content(){ + const type = this.type() + + const bind_option = this.bind_options()[type as keyof ReturnType<$hyoo_studio_type["bind_options"]>] + + return bind_option ? + this.bind_option_label_display(type as keyof ReturnType<$hyoo_studio_type["bind_options"]>) : + [ this.Value() ] + } + @ $mol_mem - type_display() { + type_display(): string { const type = this.type() if (type === 'list') { return `${this.list_items_type() === 'any'? '': this.list_items_type()} list` } - if (type === 'object') { return this.selected_obj() } - if (this.unit_options()[type]) return this.unit_options()[type] - if (this.number_options()[type]) return this.number_options()[type] - if (this.other_options()[type]) return this.other_options()[type] - if (this.bind_options()[type]) return this.bind_options()[type] + if (type === 'object') { return this.selected_class() } + if (this.unit_options()[type as keyof ReturnType<$hyoo_studio_type["unit_options"]>]) + return this.unit_options()[type as keyof ReturnType<$hyoo_studio_type["unit_options"]>] + if (this.number_options()[type as keyof ReturnType<$hyoo_studio_type["number_options"]>]) + return this.number_options()[type as keyof ReturnType<$hyoo_studio_type["number_options"]>] + if (this.other_options()[type as keyof ReturnType<$hyoo_studio_type["other_options"]>]) + return this.other_options()[type as keyof ReturnType<$hyoo_studio_type["other_options"]>] || '' return '' } + + @ $mol_mem - type( next? : string ): string { + type( next? : string ) { if( next !== undefined ) { diff --git a/value/bound/bound.view.ts b/value/bound/bound.view.ts index 15c0ccc..a231400 100644 --- a/value/bound/bound.view.ts +++ b/value/bound/bound.view.ts @@ -24,9 +24,9 @@ namespace $.$$ { @ $mol_mem Opened_bound_prop() { const prop = this.Bound_prop( this.bound_prop_name() + ':' + this.guid() ) - prop.trigger_label = () => [] + prop.trigger_sub = () => [] prop.label_sub = () => [ - ...this.head(), this.Value_tools(), this.Bound_prop_name(), prop.Trigger(), prop.Prop_tools() + ...this.head(), this.Value_tools(), this.Bound_prop_name(), this.Bound_prop_expand(), prop.Prop_tools() ] return prop } diff --git a/value/value.view.tree b/value/value.view.tree index fbda9c5..215ef03 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -16,7 +16,7 @@ $hyoo_studio_value $mol_ghost props_of!klass $mol_tree2_empty props_bindable $mol_tree2_empty class_list /string - Bound_prop* null + Bound_prop* $hyoo_studio_prop $hyoo_studio_value_unit $mol_view head / @@ -25,7 +25,7 @@ $hyoo_studio_value_unit $mol_view props_of!klass $mol_tree2_empty props_bindable $mol_tree2_empty class_list /string - Bound_prop* null + Bound_prop* $hyoo_studio_prop sub / ^ head <= Value_tools $mol_view From 22e32355fd0cb84c88008d03b67cfa4b9cecac00 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 15 Apr 2023 13:49:31 +1100 Subject: [PATCH 10/13] Readme_page from $mol_app_demo --- prop/prop.view.tree | 5 +---- prop/prop.view.ts | 7 ------- studio.view.css.ts | 4 ++++ studio.view.tree | 30 ++++++++++++++++-------------- studio.view.ts | 16 +++++++++++----- value/bound/bound.view.ts | 2 +- 6 files changed, 33 insertions(+), 31 deletions(-) diff --git a/prop/prop.view.tree b/prop/prop.view.tree index dcc7fdb..f75a82c 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -39,7 +39,4 @@ $hyoo_studio_prop $mol_view props_bindable <= props_bindable $mol_tree2_empty class_list <= class_list /string Bound_prop* <= Bound_prop* $hyoo_studio_prop - focus_class? null - event * - ^ - click? <=> show_info? null + selected_class? null diff --git a/prop/prop.view.ts b/prop/prop.view.ts index 10ef819..1858467 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -116,12 +116,5 @@ namespace $.$$ { return val?.kids[ 0 ] } - - @ $mol_mem - show_info(event?: Event) { - event?.stopPropagation() - this.focus_class( this.Value().selected_class() ) - } - } } diff --git a/studio.view.css.ts b/studio.view.css.ts index 951e2a3..5d1d999 100644 --- a/studio.view.css.ts +++ b/studio.view.css.ts @@ -33,6 +33,10 @@ namespace $.$$ { width: per (100), }, + Readme_open: { + marginLeft: 'auto', + }, + Config: { gap: $mol_gap.block, }, diff --git a/studio.view.tree b/studio.view.tree index e920898..1cbd604 100644 --- a/studio.view.tree +++ b/studio.view.tree @@ -2,6 +2,9 @@ $hyoo_studio $mol_book2 comp $hyoo_studio_component plugins / <= Theme $mol_theme_auto + Demo $mol_app_demo + Readme_page => Readme_page + meta_bundle_base <= pack pages / <= Edit $mol_page title @ \$mol Studio @@ -9,11 +12,6 @@ $hyoo_studio $mol_book2 <= Source_link $mol_link_source uri \https://github.com/hyoo-ru/studio.hyoo.ru <= Lights $mol_lights_toggle - <= Readme_open $mol_check_icon - hint @ \Components Readme - checked? <=> readme_show? false - sub / - <= Readme_toggle_icon $mol_icon_information_outline <= Code_open $mol_check_icon hint @ \Show Editor checked? <=> code_show? false @@ -46,12 +44,19 @@ $hyoo_studio $mol_book2 name @ \Component Name Content <= Self $mol_string hint \$hyoo_studio_example - value?val <=> self?val \ + value? <=> self? \ <= Base_field $mol_form_field name @ \Base Class - Content <= Base $mol_select - value?val <=> base?val \ - options <= base_options /string + Content <= Base_content $mol_view + sub / + <= Base $mol_select + value? <=> base? \ + options <= base_options /string + <= Readme_open $mol_check_icon + hint @ \Readme + checked? <=> readme_show? false + sub / + <= Readme_toggle_icon $mol_icon_information_outline - <= Props_inherited_field $mol_form_field name @ \Display inherited properties control <= Props_inherited_control $mol_check_list @@ -72,10 +77,7 @@ $hyoo_studio $mol_book2 <= Prop_add_icon $mol_icon_plus <= Props $mol_list rows <= props /$hyoo_studio_prop - <= Readme_page $mol_app_demo_readme - repo <= repo \hyoo-ru/mam_mol - module? <= readme_module? /string - opened? <=> readme_show? + <= Readme_page <= Source_page $mol_page title @ \Raw Code body / @@ -108,7 +110,7 @@ $hyoo_studio $mol_book2 value <= inspect_graph null Prop* $hyoo_studio_prop name <= prop_name* \default - focus_class? <=> readme_module_name? \ + selected_class? <=> readme_module_name? \ sign? <=> prop_sign*? \ tree? <=> prop_tree!tree_node_str? $mol_tree2_empty props_of!klass <= props_of!klass $mol_tree2_empty diff --git a/studio.view.ts b/studio.view.ts index 6601d2d..b6bcb54 100644 --- a/studio.view.ts +++ b/studio.view.ts @@ -15,7 +15,7 @@ namespace $.$$ { } readme_show( next?: boolean ) { - return this.$.$mol_state_arg.value( 'readme', next?.valueOf && ( next ? '' : null ) ) !== null + return this.Demo().readme_page( next ) } @ $mol_mem @@ -99,8 +99,9 @@ namespace $.$$ { } @ $mol_mem - base_class_readme( next?: any ) { - this.readme_module_name(this.base()) + readme_module_name(next?: any) { + if ( next !== undefined ) return $mol_state_arg.value( 'demo', next ) as never + return "" } @ $mol_mem @@ -152,7 +153,12 @@ namespace $.$$ { const self = this.tree() const base = this.$.$mol_view_tree2_class_super( self ) - if( !next ) return base.type + + if( !next ) { + this.readme_module_name( base.type ) + return base.type + } + this.readme_module_name( next ) this.tree( self.clone([ @@ -311,7 +317,7 @@ namespace $.$$ { obj.props_of = ( klass: any ) => this.props_of( klass ) obj.props_bindable = () => this.props_all() obj.class_list = () => this.class_list() - obj.focus_class = ( next?: any ) => this.readme_module_name( next ) + obj.selected_class = ( next?: any ) => this.readme_module_name( next ) obj.Bound_prop = ( id: any ) => this.Bound_prop( id ) return obj } diff --git a/value/bound/bound.view.ts b/value/bound/bound.view.ts index a231400..a34b354 100644 --- a/value/bound/bound.view.ts +++ b/value/bound/bound.view.ts @@ -4,7 +4,7 @@ namespace $.$$ { @ $mol_mem guid() { - return $mol_guid() + return this.toString() } @ $mol_mem From c345e62e9a37622e9acb6f80144330a009e1a7e4 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 15 Apr 2023 23:45:53 +1100 Subject: [PATCH 11/13] readme_selected --- studio.view.tree | 9 ++++----- studio.view.ts | 24 +++++------------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/studio.view.tree b/studio.view.tree index 1cbd604..155f3dd 100644 --- a/studio.view.tree +++ b/studio.view.tree @@ -69,10 +69,10 @@ $hyoo_studio $mol_book2 sub <= props_controls / <= Prop_filter $mol_search hint @ \Search property or Add one.. - query?next <=> prop_filter?next \ + query? <=> prop_filter? \ <= Prop_add $mol_button_minor hint @ \Add this property - click?next <=> prop_add?next null + click? <=> prop_add? null sub / <= Prop_add_icon $mol_icon_plus <= Props $mol_list @@ -110,10 +110,9 @@ $hyoo_studio $mol_book2 value <= inspect_graph null Prop* $hyoo_studio_prop name <= prop_name* \default - selected_class? <=> readme_module_name? \ sign? <=> prop_sign*? \ - tree? <=> prop_tree!tree_node_str? $mol_tree2_empty - props_of!klass <= props_of!klass $mol_tree2_empty + tree? <=> prop_tree*? $mol_tree2_empty + props_of* <= props_of* $mol_tree2_empty props_bindable <= props_all $mol_tree2_empty class_list <= class_list /string Bound_prop* <= Bound_prop* $hyoo_studio_prop diff --git a/studio.view.ts b/studio.view.ts index b6bcb54..2bdbcdd 100644 --- a/studio.view.ts +++ b/studio.view.ts @@ -15,6 +15,7 @@ namespace $.$$ { } readme_show( next?: boolean ) { + if ( next ) this.readme_selected( this.base() ) return this.Demo().readme_page( next ) } @@ -90,18 +91,8 @@ namespace $.$$ { return Object.keys( this.inspect_stat() ).map( Number ) } - @ $mol_mem - readme_module( next?: any ) { - - const split = this.readme_module_name().split('_') - - return split.slice(1) - } - - @ $mol_mem - readme_module_name(next?: any) { - if ( next !== undefined ) return $mol_state_arg.value( 'demo', next ) as never - return "" + readme_selected( next?: string ) { + return $mol_state_arg.value( 'demo', next ) ?? '' } @ $mol_mem @@ -154,11 +145,7 @@ namespace $.$$ { const self = this.tree() const base = this.$.$mol_view_tree2_class_super( self ) - if( !next ) { - this.readme_module_name( base.type ) - return base.type - } - this.readme_module_name( next ) + if( !next ) return base.type this.tree( self.clone([ @@ -166,7 +153,7 @@ namespace $.$$ { ]) ) - return next + return this.readme_selected( next ) } @ $mol_mem @@ -317,7 +304,6 @@ namespace $.$$ { obj.props_of = ( klass: any ) => this.props_of( klass ) obj.props_bindable = () => this.props_all() obj.class_list = () => this.class_list() - obj.selected_class = ( next?: any ) => this.readme_module_name( next ) obj.Bound_prop = ( id: any ) => this.Bound_prop( id ) return obj } From a52260a63d0a29f32b071f2b4cd4820a86661fca Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sat, 15 Apr 2023 23:59:31 +1100 Subject: [PATCH 12/13] no old view.tree syntax --- prop/prop.view.tree | 3 +-- type/type.view.tree | 2 +- value/bound/bound.view.tree | 2 +- value/dict/dict.view.tree | 2 +- value/list/list.view.tree | 2 +- value/number/number.view.tree | 2 +- value/object/object.view.tree | 2 +- value/string/string.view.tree | 2 +- value/value.view.tree | 5 ++--- value/value.view.ts | 5 ----- 10 files changed, 10 insertions(+), 17 deletions(-) diff --git a/prop/prop.view.tree b/prop/prop.view.tree index f75a82c..3d89e5d 100644 --- a/prop/prop.view.tree +++ b/prop/prop.view.tree @@ -35,8 +35,7 @@ $hyoo_studio_prop $mol_view value_tools => value_tools belong_to \prop tree? <=> value? $mol_tree2_empty - props_of!klass <= props_of!klass $mol_tree2_empty + props_of* <= props_of* $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty class_list <= class_list /string Bound_prop* <= Bound_prop* $hyoo_studio_prop - selected_class? null diff --git a/type/type.view.tree b/type/type.view.tree index 744d8fa..6c811ee 100644 --- a/type/type.view.tree +++ b/type/type.view.tree @@ -49,7 +49,7 @@ $hyoo_studio_type $mol_pick Object_select $mol_select hint @ \Class align_hor \right - value?next <=> selected_class?next \$mol_view + value? <=> selected_class? \$mol_view options <= class_list /string Trigger_icon null bubble_content => Obj_bubble_content diff --git a/value/bound/bound.view.tree b/value/bound/bound.view.tree index 04bf37b..da1199b 100644 --- a/value/bound/bound.view.tree +++ b/value/bound/bound.view.tree @@ -4,7 +4,7 @@ $hyoo_studio_value_bound $hyoo_studio_value_unit <= Value_tools <= Bound_prop_name $mol_select hint @ \Bound Property - value?next <=> bound_prop_name?next null + value? <=> bound_prop_name? null options <= prop_name_list /string Trigger_icon null <= Bound_prop_expand $mol_check_expand diff --git a/value/dict/dict.view.tree b/value/dict/dict.view.tree index 2cc4792..248637a 100644 --- a/value/dict/dict.view.tree +++ b/value/dict/dict.view.tree @@ -13,7 +13,7 @@ $hyoo_studio_value_dict $hyoo_studio_value_unit <= Value* $hyoo_studio_value tree? <=> item_value*? $mol_tree2_empty belong_to \dict - props_of!klass <= props_of!klass $mol_tree2_empty + props_of* <= props_of* $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty class_list <= class_list /string Bound_prop* <= Bound_prop* null diff --git a/value/list/list.view.tree b/value/list/list.view.tree index 56a8fac..7d68197 100644 --- a/value/list/list.view.tree +++ b/value/list/list.view.tree @@ -9,7 +9,7 @@ $hyoo_studio_value_list $hyoo_studio_value_unit <= List_value*0 $hyoo_studio_value tree? <=> list_value*? $mol_tree2_empty belong_to \list - props_of!klass <= props_of!klass $mol_tree2_empty + props_of* <= props_of* $mol_tree2_empty props_bindable <= props_bindable $mol_tree2_empty class_list <= class_list /string Bound_prop* <= Bound_prop* null diff --git a/value/number/number.view.tree b/value/number/number.view.tree index 8a739de..18fda7a 100644 --- a/value/number/number.view.tree +++ b/value/number/number.view.tree @@ -1,4 +1,4 @@ $hyoo_studio_value_number $hyoo_studio_value_unit self / <= Numb $mol_number - value?next <=> numb?next +NaN + value? <=> numb? +NaN diff --git a/value/object/object.view.tree b/value/object/object.view.tree index d45a962..919ab30 100644 --- a/value/object/object.view.tree +++ b/value/object/object.view.tree @@ -14,7 +14,7 @@ $hyoo_studio_value_object $hyoo_studio_value_dict <= Value* $hyoo_studio_value tree? <=> item_value*? belong_to \subprop - props_of!klass <= props_of!klass + props_of* <= props_of* props_bindable <= props_bindable class_list <= class_list Bound_prop* <= Bound_prop* diff --git a/value/string/string.view.tree b/value/string/string.view.tree index 01c592d..1ee1939 100644 --- a/value/string/string.view.tree +++ b/value/string/string.view.tree @@ -1,7 +1,7 @@ $hyoo_studio_value_string $hyoo_studio_value_unit self / <= Str $mol_textarea - value?next <=> str?next \ + value? <=> str? \ tools / <= Type <= Locale $mol_check_icon diff --git a/value/value.view.tree b/value/value.view.tree index 215ef03..d738599 100644 --- a/value/value.view.tree +++ b/value/value.view.tree @@ -9,11 +9,10 @@ $hyoo_studio_value $mol_ghost Unit $hyoo_studio_value_unit value_tools / type \ - selected_class \ head / belong_to \prop hide_tools false - props_of!klass $mol_tree2_empty + props_of* $mol_tree2_empty props_bindable $mol_tree2_empty class_list /string Bound_prop* $hyoo_studio_prop @@ -22,7 +21,7 @@ $hyoo_studio_value_unit $mol_view head / belong_to \prop hide_tools false - props_of!klass $mol_tree2_empty + props_of* $mol_tree2_empty props_bindable $mol_tree2_empty class_list /string Bound_prop* $hyoo_studio_prop diff --git a/value/value.view.ts b/value/value.view.ts index d24ee5d..2ac2def 100644 --- a/value/value.view.ts +++ b/value/value.view.ts @@ -39,11 +39,6 @@ namespace $.$$ { type(): string { return this.Sub().Type().type() } - - @ $mol_mem - selected_class(): string { - return this.Sub().Type().selected_class() - } } From 5725b815c96d53b3c534007b9a5655225ac87211 Mon Sep 17 00:00:00 2001 From: stan-donarise <111230475+stan-donarise@users.noreply.github.com> Date: Sun, 16 Apr 2023 00:00:07 +1100 Subject: [PATCH 13/13] bind props not expanded --- prop/prop.view.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prop/prop.view.ts b/prop/prop.view.ts index 1858467..2218114 100644 --- a/prop/prop.view.ts +++ b/prop/prop.view.ts @@ -62,6 +62,9 @@ namespace $.$$ { case 'number': case 'list': case 'dict': + case 'bind': + case 'get': + case 'put': return true default: return false @@ -92,9 +95,6 @@ namespace $.$$ { case 'number_nan' : case 'number_infinity_negative' : case 'number_infinity_positive' : - case 'bind': - case 'get': - case 'put': return true } return false