-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apps.view.ts
69 lines (53 loc) · 1.4 KB
/
apps.view.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
namespace $.$$ {
export class $hyoo_apps extends $.$hyoo_apps {
app() {
return this.$.$mol_state_arg.value( 'app' )
}
group_name( id: keyof ReturnType<typeof this.groups> ) {
return this.groups()[ id ]
}
@ $mol_mem
group_list() {
return Object.keys( this.groups() ).map( group => this.Group( group ) )
}
@ $mol_mem_key
group_items( group: string ) {
const apps = this.apps()
const filter = this.filter()
return Object.keys( this.apps() )
.filter( app => apps[ app ].target === group )
.filter( $mol_match_text( filter, app => [
app,
apps[ app ].title,
apps[ app ].uri,
] ) )
.map( app => this.Menu_item( app ) )
}
@ $mol_mem
pages() {
const app = this.app()
return [
this.Menu(),
... app ? [ this.App( app ) ] : [],
]
}
app_title( app: string ) {
return this.apps()[ app ].title
}
app_uri_default( app : string, next?: string ) {
return this.apps()[ app ].uri
}
@ $mol_mem_key
app_uri_embed( app: string, next?: string ) {
const lights = this.$.$mol_lights()
if( this.app() === app ) {
const arg = this.$.$mol_state_arg.value( 'uri', next )
if( arg ) return arg.replace( /mol_lights=(true|false)/, `mol_lights=${ lights }` )
}
return this.app_uri_default( app ) + `#mol_lights=${ lights }`
}
app_arg( app: string ) {
return { app, uri: null }
}
}
}