ideas and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-04 01:53:01 +03:00
parent 4846a5d69d
commit 5549a688fe
3 changed files with 40 additions and 9 deletions

View File

@ -91,7 +91,7 @@ object.Constructor('BasePage', {
// XXX EXPERIMENTAL...
path_vars: {
NOW: function(){
return Date.now() },
return Date.timeStamp() },
PATH: function(){
return this.path },
NAME: function(){
@ -135,9 +135,16 @@ object.Constructor('BasePage', {
// events...
//
//__beforenavigate__: function(location){ .. },
//
//__navigate__: function(){ .. },
//
// XXX revise naming...
// XXX should this be able to prevent navigation???
onBeforeNavigate: types.event.Event('beforeNavigate'),
onBeforeNavigate: types.event.Event('beforeNavigate',
function(_, location){
'__beforenavigate__' in this
&& this.__beforenavigate__(location) }),
onNavigate: types.event.Event('navigate',
function(handle, location){
this.onBeforeNavigate(location)
@ -154,6 +161,8 @@ object.Constructor('BasePage', {
path),
pwpath.obj2args(args)))
// trigger handlers...
'__navigate__' in this
&& this.__navigate__()
handle() }),
// .path is a proxy to .location
@ -1543,6 +1552,23 @@ object.Constructor('CachedPage', Page, {
return getCachedProp(this, 'text') },
set text(value){
return setCachedProp(this, 'text', value) },
/*/ XXX PREVIEW EXPERIMENTAL...
// ...this can be usefull for partial rendering and then on the
// js level filling in the details...
__preview_size__: 100,
get preview(){
var text = this.text
if(text instanceof Promise){
text.then(function(text){
this.onPreviewReady() })
// return a placeholder for the upcoming data...
return '...' }
return text.slice(0, this.__preview_size__ || 100) },
onPreviewReady: types.event.Event('onPreviewReady'),
//*/
})
@ -1693,7 +1719,7 @@ module.System = {
<slot name="header">
<a href="#/list">&#9776</a>
@source(./path/!)
<a href="#@source(./path/!)/_edit">(edit)</a>
<a href="#@source(./path/!)/_edit">&#9998;</a>
</slot>
<hr>
<slot name="content"></slot>

View File

@ -178,10 +178,7 @@ require(['./browser'], function(browser){
// that will push an extra history item...
history.replaceState(
{path: this.location},
// XXX TITLE .title must be sync as history will not wait for
// the value even it await is given...
//this.title,
this.path,
'',
'#'+this.location
+(this.hash ?
'#'+this.hash
@ -196,7 +193,7 @@ require(['./browser'], function(browser){
.onLoad(function(evt){
var that = this
// handle title...
document.querySelector('title').innerHTML = this.title
document.querySelector('title').innerHTML = this.path
// scroll to anchor element...
this.hash
&& this.dom

View File

@ -1,6 +1,15 @@
/**********************************************************************
*
*
* XXX might be fun to push the async parts of the render to the dom...
* ...i.e. return a partially rendered DOM with handlers to fill
* in the blanks wen they are ready...
* XXX UI/UX: add a cached/sync page.preview with ready events...
* XXX Q: empty title???
* - special default name
* a timestamp or some thing similar
* this can be hidden until changed by user
* XXX FILE prevent paths from using reserved chars like: ":", "#", ...
* XXX do we need something like /System/Actions/.. for fast actions called
* in the same way as direct page actions???
* XXX FEATURE tags and accompanying API...
@ -27,7 +36,6 @@
* XXX TITLE revise how title is handled...
* ...do we need a separate title and path???
* XXX revise/update sort...
* XXX prevent paths from using reserved chars like: ":", "#", ...
* XXX ASAP: MetaStore: need to correctly integrate the following store
* methods:
* .get(..) -- DONE