experimenting and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-08-20 09:37:05 +03:00
parent 4b9d8e9d78
commit f8e5b88a09
3 changed files with 67 additions and 11 deletions

View File

@ -33,10 +33,12 @@ module.setup =
Promise.all([ Promise.all([
// static stores... // static stores...
// //
store.update('System',
Object.create(basestore.BaseStore).load(page.System)),
store.update('Settings', store.update('Settings',
Object.create(basestore.BaseStore).load(page.Settings)), Object.create(basestore.BaseStore).load(page.Settings)),
store.update('System',
Object.create(basestore.BaseStore).load(page.System)),
store.update('Test',
Object.create(basestore.BaseStore).load(page.Test)),
// persistent stores... // persistent stores...
// //

View File

@ -1435,7 +1435,6 @@ module.System = {
return this.get('..').path }, return this.get('..').path },
location: function(){ location: function(){
return this.get('..').path }, return this.get('..').path },
// XXX this can be a list for pattern paths...
resolved: async function(){ resolved: async function(){
return this.get('..').resolve() }, return this.get('..').resolve() },
dir: function(){ dir: function(){
@ -1460,10 +1459,10 @@ module.System = {
// XXX // XXX
return '' }, return '' },
// XXX links to pages... // XXX links to pages...
to: function(){ LinksTo: function(){
return (this.get('..').data || {}).to ?? [] }, return (this.get('..').data || {}).to ?? [] },
// XXX pages linking to us... // XXX pages linking to us...
'from': function(){ LinksFrom: function(){
return (this.get('..').data || {})['from'] ?? [] }, return (this.get('..').data || {})['from'] ?? [] },
@ -1480,16 +1479,68 @@ module.System = {
// show info about the delete operation... // show info about the delete operation...
return target.get('DeletingPage').text }, return target.get('DeletingPage').text },
// XXX EXPERIMENTAL
// move page one level up...
moveUp: function(){
var target = this.get('..')
var to = '../../'+target.name
target.move(to)
// redirect...
this.render_root
&& (this.render_root.location = to)
// show info about the move operation...
return this.render_root.path },
// moves page to current location...
// Example
// /path/to/page/moveDown
// /path/page -> /path/to/page
moveDown: function(){
var to = this.get('..')
var target = to.get('../../'+ to.name)
target.move(to.path)
// redirect...
this.render_root
&& (this.render_root.location = to.path)
return this.render_root.path },
// syntax:
// /<path-from>/to:<path-to>/move
//
// XXX the syntax works, but there are problems with .move(..) method...
move: async function(){
var [from, to] = this.get('..').path.split(/\/to:/)
// can't move...
if(!from || !to){
console.warn(`move: can't move: "${from}" -> "${to}"`)
return '' }
await this.get(from).move(to)
// redirect...
this.render_root
&& (this.render_root.location = to)
return '' },
// XXX System/back // XXX System/back
// XXX System/forward // XXX System/forward
// XXX System/sort // XXX System/sort
// XXX System/reverse // XXX System/reverse
// XXX broken... }
test_list: function(){
return 'abcdef'.split('') }, var Test =
test_slots: { module.Test = {
'list/action': function(){
return [...'abcdef'] },
'list/statuc': {
text: [...'abcdef'] },
slots: {
text: object.doc` text: object.doc`
Sequential: Sequential:
<slot name="sequential">unfilled</slot> <slot name="sequential">unfilled</slot>

View File

@ -1,8 +1,6 @@
/********************************************************************** /**********************************************************************
* *
* *
* XXX does @macro(..) have to follow the same overloading rules as @slot(..)???
* ...does it??
* XXX GENERATOR make pattern path parsing a generator... * XXX GENERATOR make pattern path parsing a generator...
* ...experiment with a controllable iterator/range thing... * ...experiment with a controllable iterator/range thing...
* This would require: * This would require:
@ -19,6 +17,11 @@
* ...might be a good idea to make filters local only... * ...might be a good idea to make filters local only...
* XXX slots/macros might also pose a problem... * XXX slots/macros might also pose a problem...
* 2) all the macros that can source pages to produce generators (DONE) * 2) all the macros that can source pages to produce generators (DONE)
* XXX BUG: .move(..) behaves in an odd way...
* see: System/move page action
* ...deletes the original and moves an empty page -- sync error???
* XXX does @macro(..) have to follow the same overloading rules as @slot(..)???
* ...does it??
* XXX ranges in pattern paths -- page-size=X page=Y | from=X to=Y / ... * XXX ranges in pattern paths -- page-size=X page=Y | from=X to=Y / ...
* ...url syntax??? * ...url syntax???
* XXX differenced in behaviour between _abc and abc, either need to make * XXX differenced in behaviour between _abc and abc, either need to make