2022-04-12 01:31:28 +03:00
|
|
|
/**********************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
2022-09-17 17:13:23 +03:00
|
|
|
* XXX ASAP start writing docs in pwiki
|
2022-11-03 23:48:53 +03:00
|
|
|
* - transparent sync/backup
|
2022-10-09 17:38:47 +03:00
|
|
|
* - fs store/export in browser or a simple way to export/import...
|
|
|
|
|
* ...can't seem to get it to work without asking for permission
|
|
|
|
|
* on every startup (one more thing left to try, keeping the
|
|
|
|
|
* handler live in a service worker, but the hopes are low)...
|
2022-10-27 01:39:34 +03:00
|
|
|
* - pouchdb-couchdb sync -
|
|
|
|
|
* - pouchdb-pouchdb sync (p2p via webrtc) - XXX
|
2022-11-15 14:32:07 +03:00
|
|
|
* - images - XXX
|
|
|
|
|
* - WYSIWYG markdown editor/viewer (ASAP) - XXX
|
|
|
|
|
* - need a UI a-la milkdown
|
|
|
|
|
* ...milkdown is good but 500mb dev-env and (apparently)
|
|
|
|
|
* no AMD support are problems -- need more testing...
|
|
|
|
|
* - minimal/functional editor - DONE
|
|
|
|
|
* ...<pre> sometimes ties formatting while <textarea>/<input type=text>
|
|
|
|
|
* handle resizing in a really odd way...
|
2022-10-27 01:39:34 +03:00
|
|
|
* - tags - DONE
|
2022-11-04 15:32:04 +03:00
|
|
|
* - search - DONE
|
2022-10-27 01:39:34 +03:00
|
|
|
* - GUI -
|
2022-11-09 14:14:04 +03:00
|
|
|
* general UI/UX
|
2022-11-15 14:32:07 +03:00
|
|
|
* drag-n-drop
|
2022-11-24 03:52:41 +03:00
|
|
|
* live search, render, ...etc.
|
2022-10-27 01:39:34 +03:00
|
|
|
* - CLI -
|
2022-11-09 14:14:04 +03:00
|
|
|
* - server / replication target
|
|
|
|
|
* - management
|
2022-09-18 20:45:55 +03:00
|
|
|
*
|
2022-11-13 14:33:07 +03:00
|
|
|
*
|
|
|
|
|
*
|
2022-11-03 23:48:53 +03:00
|
|
|
* XXX things that will help:
|
|
|
|
|
* - async render (infinite scroll + search + large pages)
|
|
|
|
|
* unresolved -> dom placeholder
|
|
|
|
|
* iterator prepends to placeholder
|
|
|
|
|
* when resolved/done remove placeholder
|
|
|
|
|
* -
|
|
|
|
|
*
|
2022-09-18 20:45:55 +03:00
|
|
|
*
|
2022-11-27 13:43:40 +03:00
|
|
|
*
|
2022-12-07 15:59:23 +03:00
|
|
|
* XXX ASAP make parser's .expand(..) (tesing on ._expand(..)) sync/async...
|
2022-12-09 18:05:26 +03:00
|
|
|
* ...still different...
|
2022-12-11 22:35:54 +03:00
|
|
|
* render time seems to be the same so we are rendering the whole
|
|
|
|
|
* thing down, but we seem to either be losing the return value(s)
|
|
|
|
|
* or context in the new code along the return path...
|
|
|
|
|
* getting pages "raw" seems to work fine...
|
|
|
|
|
* /moo/_raw (single page, no expansion) -- OK
|
|
|
|
|
* /tree/_text (macro + expansion) -- OK
|
|
|
|
|
* /* /path/_text (multipage + expansion) -- OK
|
|
|
|
|
* ...this breaks down when we use _view!
|
|
|
|
|
* ...potential causes:
|
|
|
|
|
* - not handling one or more of the new return types up the parser
|
|
|
|
|
* .resolve(..)
|
|
|
|
|
* .parse(..)
|
|
|
|
|
* - not handling the return value correctly in one or more macros
|
2022-12-12 22:46:11 +03:00
|
|
|
* seems to be an issue with slots (content) not being filled...
|
|
|
|
|
* could this be an issue with sequencing, i.e. trying to fill
|
|
|
|
|
* the slot BEFORE it got a value???
|
|
|
|
|
* ...but if this is the case, how could we have reached a point
|
|
|
|
|
* where we reached a point where something is needed after it
|
|
|
|
|
* is introduced but before it had a change to run???
|
|
|
|
|
* (looks like the definition of what Promise.iter(..) is supposed
|
|
|
|
|
* to do -> we need a way to carefully wait for all the prior
|
|
|
|
|
* stuff to finish before filling slots)
|
|
|
|
|
* XXX this is an interesting question, we need to maintain
|
|
|
|
|
* the "illusion" lexical scope (i.e. code order) regardless
|
|
|
|
|
* of actual order of execution...
|
|
|
|
|
* ...this has to be done in both directions, i.e. we need to
|
|
|
|
|
* wait for what came before and what comes after must
|
|
|
|
|
* wait for us...
|
|
|
|
|
* ...one simple way out of this is to do a less general
|
|
|
|
|
* Promise.orderedIter(..) that will always execute in
|
|
|
|
|
* order... (seems the simplest, we'll try this first)
|
|
|
|
|
* ...this also feels a fundamental enough feature to
|
|
|
|
|
* be implemented in ig-types
|
2022-12-06 23:40:57 +03:00
|
|
|
* XXX BUG: for some reason editing the root page ('/') hangs /tree...
|
|
|
|
|
* ...the problem is most likely is in that tree appends tree to
|
|
|
|
|
* each path in the list and '/' + '/tree' is ....
|
|
|
|
|
* ...why aren't we catching the recursion here???
|
2022-12-02 13:06:16 +03:00
|
|
|
* XXX BUG: seems that page caching stopped working...
|
|
|
|
|
* ...are we over-refreshing???
|
2022-12-02 02:43:36 +03:00
|
|
|
* XXX .parse(..): should we handle pattern paths and lists of text???
|
2022-11-19 04:26:13 +03:00
|
|
|
* XXX parser: error handling: add line number + context... (???)
|
2022-11-15 14:32:07 +03:00
|
|
|
* XXX BUG: parser:
|
|
|
|
|
* This will break:
|
|
|
|
|
* await pwiki.parse('<macro src=../tags join=", ">@source(.)</macro>')
|
|
|
|
|
* This will not:
|
|
|
|
|
* await pwiki.parse('<macro src="../tags" join=", ">@source(.)</macro>')
|
2022-11-22 02:26:28 +03:00
|
|
|
* XXX might be a good idea to add a default template to draw a list...
|
2022-11-21 03:04:48 +03:00
|
|
|
* XXX FEATURE: make the pwiki "widget" work bot as an element and as a
|
|
|
|
|
* full page (current)...
|
|
|
|
|
* ...would need to handle stuff like history, url, nav locally...
|
|
|
|
|
* see: pwiki2.html
|
2022-11-15 14:32:07 +03:00
|
|
|
* XXX ASAP test: can we store the file handler with permissions in a ServiceWorker??
|
2022-11-20 13:11:30 +03:00
|
|
|
* XXX macros: Q: do we need macros for printing errors and the like???
|
2022-11-15 14:32:07 +03:00
|
|
|
* XXX the parser should handle all action return values, including:
|
|
|
|
|
* - lists -- XXX
|
|
|
|
|
* - strings -- DONE
|
|
|
|
|
* - numbers -- DONE
|
|
|
|
|
* - misc:
|
|
|
|
|
* dates -- ???
|
|
|
|
|
* note that an action returning a list is not the same as a list
|
|
|
|
|
* stoted in <data>.text -- since we can't identify what an action
|
|
|
|
|
* returns without calling it, and we only call actions on
|
|
|
|
|
* .raw/.text/.parse(..), we can't iterate over such results.
|
|
|
|
|
* Q: can we make a list reder as a list of pages??
|
|
|
|
|
* ...likely no...
|
|
|
|
|
* ...would depend on where we iterate pages and on whether
|
|
|
|
|
* we can/should reach that spot from within the parser...
|
|
|
|
|
* XXX ASAP: MetaStore: need to correctly integrate the following store
|
|
|
|
|
* methods:
|
|
|
|
|
* .get(..) -- DONE
|
|
|
|
|
* .metadata(..) --
|
|
|
|
|
* .delete(..)
|
|
|
|
|
* XXX deleting something in .next will break stuff...
|
|
|
|
|
* ...
|
|
|
|
|
* XXX FEATURE images...
|
2022-11-18 03:34:06 +03:00
|
|
|
* XXX BUG?: count does not appear to affect /Test/list/generator and /Test/list/static...
|
|
|
|
|
* ...do we need to support this???
|
2022-11-13 14:33:07 +03:00
|
|
|
* XXX index: need to disable index persistence on memory stores...
|
|
|
|
|
* XXX index: would be nice to somehow persistently auto-generate index id's...
|
|
|
|
|
* ...maybe: "<prefix>:<path>" or something similar...
|
|
|
|
|
* ...would be nice to have store ids...
|
2022-11-14 17:48:06 +03:00
|
|
|
* XXX index: journal: might be a fun idea to try a simple sync file store
|
|
|
|
|
* - a json format simply appending elements in the format:
|
|
|
|
|
* ',\n\t[ ... ]'
|
|
|
|
|
* - appending a '\n}' on exit
|
2022-11-13 14:33:07 +03:00
|
|
|
* XXX <store>.journal: needed to break the update recursion -- i.e. decouple
|
|
|
|
|
* index .update(..) handlers from stored page updates by first
|
|
|
|
|
* updating the journal and on a timer updating the .cache/<index> page...
|
2022-11-12 19:55:46 +03:00
|
|
|
* XXX BUG: indexedDB: .deleteDatabase(..) does not actually delete the
|
|
|
|
|
* database from the list until reload.
|
|
|
|
|
* this breaks trying to open a database with the same name again...
|
2022-11-07 17:06:46 +03:00
|
|
|
* XXX FEATURE: would be nice to have a buffered store (mixin)...
|
|
|
|
|
* - state stored in memory
|
|
|
|
|
* - get state from memory (sync)
|
|
|
|
|
* - background updates (async)
|
|
|
|
|
* - update strategy
|
|
|
|
|
* - asap
|
|
|
|
|
* - timer -- save grouped changes
|
|
|
|
|
* (changed paths + removed paths)
|
|
|
|
|
* - idle
|
|
|
|
|
* - ...
|
|
|
|
|
* - state query -- pending/saved/...
|
2022-11-06 22:38:34 +03:00
|
|
|
* XXX Q: can we get state and update in one go???
|
2022-11-15 14:32:07 +03:00
|
|
|
* ...usefull where we need to get state to update...
|
2022-11-05 15:22:00 +03:00
|
|
|
* XXX macro: macro:count / macro:index vars can be overridden by count/index
|
|
|
|
|
* attributes....
|
2022-11-15 14:32:07 +03:00
|
|
|
* ...this can be usefull but this needs testing...
|
2022-11-05 01:49:39 +03:00
|
|
|
* XXX should @macro(..) handle offset in the same manner as count???
|
2022-11-01 01:56:22 +03:00
|
|
|
* XXX FEATURE store: mirror (slave) -- a way to hold data in one store
|
|
|
|
|
* and to mirror everything (async) to a separate store...
|
|
|
|
|
* example:
|
|
|
|
|
* PouchDB (main) -- FileSore (export)
|
2022-11-15 14:32:07 +03:00
|
|
|
* XXX Q: do we need a way to index/access a list item via path???
|
2022-10-30 16:50:08 +03:00
|
|
|
* XXX STYLE: should style loading be done via the event mechanics
|
|
|
|
|
* (see: pwiki2.html) or via the base templates (see: pwiki/page.js:_view
|
|
|
|
|
* template)???
|
2022-10-26 17:06:06 +03:00
|
|
|
* XXX TAGS
|
|
|
|
|
* - add tags to page -- macro/filter
|
|
|
|
|
* - <page>.text -> <page>.tags (cached on .update(..))
|
2022-10-26 20:51:14 +03:00
|
|
|
* - ???
|
2022-10-28 01:34:58 +03:00
|
|
|
* - manual/API - DONE
|
|
|
|
|
* - editor -
|
2022-10-26 20:51:14 +03:00
|
|
|
* - a way to list tags -- folder like? - DONE
|
2022-10-26 17:06:06 +03:00
|
|
|
* - tag cache <store>.tags - DONE
|
|
|
|
|
* - tag-path filtering... - DONE
|
|
|
|
|
* XXX TAGS add a more advanced query -- e.g. "/**:tagged=y,z:untagged=x" ???
|
2022-10-22 15:31:36 +03:00
|
|
|
* XXX INDEX DOC can index validation be async???
|
|
|
|
|
* ...likely no
|
|
|
|
|
* XXX INDEX add option to set default action (get/lazy/cached)
|
2022-11-15 14:32:07 +03:00
|
|
|
* XXX BUG: CachedStore seems to be broken (see: pwiki/store/base.js:837)
|
2022-10-12 21:51:37 +03:00
|
|
|
* XXX might be a good idea to create memory store (sandbox) from the
|
|
|
|
|
* page API -- action??
|
2022-10-10 01:10:32 +03:00
|
|
|
* XXX Chrome started spamming CORS error:
|
|
|
|
|
* Access to manifest at 'file:///L:/work/pWiki/manifest.json'
|
|
|
|
|
* from origin 'null' ...
|
|
|
|
|
* not sure why...
|
2022-10-12 21:51:37 +03:00
|
|
|
* (switched off in console filter for now)
|
2022-10-04 18:11:22 +03:00
|
|
|
* XXX might be a good idea to wrap the wysiwig editor into a separate template
|
2022-10-07 13:02:09 +03:00
|
|
|
* and use it in the main edit template to make it user-selectable...
|
|
|
|
|
* XXX generalize html/dom api...
|
|
|
|
|
* ...see refresh() in pwiki2.html
|
2022-10-01 23:45:24 +03:00
|
|
|
* XXX test pouchdb latency at scale in browser...
|
2022-10-07 13:02:09 +03:00
|
|
|
* XXX macros: .depends: need fast path pattern matching...
|
2022-09-30 15:00:11 +03:00
|
|
|
* XXX macros / CACHE: convert a /path/* dependency to /path/** if a script
|
|
|
|
|
* is recursive...
|
2022-10-07 13:02:09 +03:00
|
|
|
* XXX might also be a good idea to investigate a .tree directory index
|
|
|
|
|
* as a supplement to .paths()
|
|
|
|
|
* XXX CACHE need to explicitly prevent caching of some actions/pages...
|
2022-09-10 12:38:30 +03:00
|
|
|
* XXX async/live render...
|
|
|
|
|
* might be fun to push the async parts of the render to the dom...
|
2022-09-04 03:20:47 +03:00
|
|
|
* ...i.e. return a partially rendered DOM with handlers to fill
|
|
|
|
|
* in the blanks wen they are ready...
|
|
|
|
|
* something like:
|
|
|
|
|
* place placeholder element
|
|
|
|
|
* -> on visible / close to visible
|
|
|
|
|
* -> trigger load (set id)
|
|
|
|
|
* -> on load
|
|
|
|
|
* -> fill content (on id)
|
|
|
|
|
* example:
|
|
|
|
|
* @include(./path ..)
|
|
|
|
|
* -> <span pwiki="@include(/full/path ..)"/>
|
2022-09-04 11:06:19 +03:00
|
|
|
* XXX prevent paths from using reserved chars like: ":", "#", ...
|
2022-09-10 12:38:30 +03:00
|
|
|
* XXX OPTIMIZE CACHE catch page creation -- match pattern path...
|
2022-09-04 03:20:47 +03:00
|
|
|
* 1) explicit subpath matching -- same as .match(..)
|
|
|
|
|
* 2) identify recursive patterns -- same as **
|
|
|
|
|
* XXX do we need something like /System/Actions/.. for fast actions called
|
|
|
|
|
* in the same way as direct page actions???
|
2022-09-10 12:38:30 +03:00
|
|
|
* ...experiment??
|
2022-09-03 13:52:30 +03:00
|
|
|
* XXX fs: handle odd file names...
|
|
|
|
|
* - we need '*' and '**'
|
|
|
|
|
* - would be nice to be able to name files without
|
|
|
|
|
* any resyrictions other than the internally reserved
|
|
|
|
|
* cars...
|
|
|
|
|
* (currently: '#', and ':')
|
2022-08-31 15:46:51 +03:00
|
|
|
* XXX ENERGETIC: Q: do we need to make this a path syntax thing???
|
|
|
|
|
* ...i.e.
|
|
|
|
|
* /some/path/action/! (current)
|
|
|
|
|
* vs.
|
|
|
|
|
* /some/path/!action
|
|
|
|
|
* ..."!" is removed before the <store>.__<name>__(..) calls...
|
2022-09-10 12:38:30 +03:00
|
|
|
* XXX OPTIMIZE load pages in packs...
|
|
|
|
|
* might be a good idea to move stuff down the stack to Store:
|
2022-09-01 11:12:13 +03:00
|
|
|
* .each() -> .store.each(<path>)
|
2022-09-10 12:38:30 +03:00
|
|
|
* ...this will enable us to optimize page loading on a store
|
2022-09-01 11:12:13 +03:00
|
|
|
* level...
|
|
|
|
|
* ...another approach would be to make .get(..) accept a list of
|
|
|
|
|
* paths and return an iterator...
|
2022-08-28 16:34:46 +03:00
|
|
|
* XXX OPTIMIZE MATCH limit candidates to actual page name matches -- this will
|
2022-08-24 23:13:24 +03:00
|
|
|
* limit the number of requests to actual number of pages with that
|
|
|
|
|
* name...
|
|
|
|
|
* e.g. when searching for xxx/tree the only "tree" available is
|
|
|
|
|
* System/tree, and if it is overloaded it's now a question of
|
|
|
|
|
* picking one out of two and not out of tens generated by .paths()
|
2022-09-10 12:38:30 +03:00
|
|
|
* XXX OPTIMIZE CACHE track store (external) changes...
|
2022-08-28 16:34:46 +03:00
|
|
|
* XXX OPTIMIZE CACHE/DEPENDS might be a good idea to add a dependencyUpdated event...
|
2022-08-22 19:23:06 +03:00
|
|
|
* ...and use it for cache invalidation...
|
2022-08-28 16:34:46 +03:00
|
|
|
* XXX OPTIMIZE NORMCACHE .normalize(..) cache normalized strings...
|
|
|
|
|
* ...seems to have little impact...
|
2022-08-23 11:27:20 +03:00
|
|
|
* XXX OPTIMIZE: the actions that depend on lots of tiny requests (/tree)
|
|
|
|
|
* can get really slow...
|
|
|
|
|
* ...it feels like one reason is the async/await ping-pong...
|
|
|
|
|
* problems:
|
|
|
|
|
* - too many async requests
|
|
|
|
|
* micro cache?
|
|
|
|
|
* pack requests?
|
|
|
|
|
* - redundant path normalization (RENORMALIZE)
|
|
|
|
|
* mark the normalized string and return it as-is on
|
|
|
|
|
* renormalization...
|
|
|
|
|
* ...initial experiment made things slower...
|
2022-08-28 16:34:46 +03:00
|
|
|
* XXX FEATURE self-doc:
|
|
|
|
|
* - some thing lile Action(<name>, <doc>, <func>|<str>)
|
|
|
|
|
* - System/doc -- show <doc> for action...
|
2022-08-18 10:50:14 +03:00
|
|
|
* XXX GENERATOR make pattern path parsing a generator...
|
|
|
|
|
* ...experiment with a controllable iterator/range thing...
|
|
|
|
|
* This would require:
|
|
|
|
|
* 1) the rendering infrastructure to support generation and
|
|
|
|
|
* partial rendering starting from .expand(..) and up...
|
|
|
|
|
* input output
|
2022-08-18 11:09:57 +03:00
|
|
|
* .expand(..) DONE DONE
|
|
|
|
|
* .resolve(..) partial DONE
|
|
|
|
|
* XXX for-await-of (vs. for-of-await) breaks things
|
|
|
|
|
* (see: /test_slots, ..?)
|
|
|
|
|
* .parse(..) DONE NO
|
|
|
|
|
* XXX with the current implementation of filters
|
|
|
|
|
* this can't work as a generator...
|
|
|
|
|
* ...might be a good idea to make filters local only...
|
2022-08-19 16:02:45 +03:00
|
|
|
* XXX slots/macros might also pose a problem...
|
2022-08-19 20:31:37 +03:00
|
|
|
* 2) all the macros that can source pages to produce generators (DONE)
|
2022-08-25 11:28:01 +03:00
|
|
|
* XXX might be a good idea to parse a page into an executable/function
|
|
|
|
|
* that would render self in a given context...
|
2022-08-19 19:40:28 +03:00
|
|
|
* XXX add support for <join> tag in include/source/quote???
|
2022-08-19 16:02:45 +03:00
|
|
|
* XXX introspection:
|
2022-09-10 12:38:30 +03:00
|
|
|
* /stores -- DONE
|
2022-08-19 16:02:45 +03:00
|
|
|
* list stores...
|
2022-09-10 12:38:30 +03:00
|
|
|
* /info -- DONE?
|
2022-08-19 16:02:45 +03:00
|
|
|
* list page/store info
|
2022-09-10 12:38:30 +03:00
|
|
|
* /storage -- XXX
|
2022-08-19 16:02:45 +03:00
|
|
|
* list storage usage / limits
|
2022-11-15 14:32:07 +03:00
|
|
|
* /time -- DONE
|
|
|
|
|
* time page load/render
|
2022-08-15 17:32:07 +03:00
|
|
|
* XXX BUG: FF: conflict between object.run and PouchDB...
|
2022-10-07 13:02:09 +03:00
|
|
|
* ...seems to be a race, also affects chrome sometimes...
|
2022-11-15 14:32:07 +03:00
|
|
|
* XXX add a way to indicate and reset overloaded (bootstrap/.next) pages...
|
2022-08-07 08:44:01 +03:00
|
|
|
* - per page
|
|
|
|
|
* - global
|
2022-09-18 20:12:18 +03:00
|
|
|
* XXX should render templates (_view and the like) be a special case
|
|
|
|
|
* or render as any other page???
|
|
|
|
|
* ...currently they are rendered in the context of the page and
|
|
|
|
|
* not in their own context...
|
2022-11-15 14:32:07 +03:00
|
|
|
* ...document this
|
2022-10-31 03:01:10 +03:00
|
|
|
* XXX macros: add @defmacro(<name> ..) to be exactly as @macro(<name> ..)
|
|
|
|
|
* but defines a @<name>(..) macro...
|
|
|
|
|
* ...this would be useful for things like:
|
|
|
|
|
* <pw:delete src="."/>
|
|
|
|
|
* or:
|
|
|
|
|
* <pw:info src="."/>
|
|
|
|
|
* generating delete and info buttons...
|
|
|
|
|
* ...this is not possible because:
|
|
|
|
|
* - we statically set the macro name list (regexp) parser.lex(..)
|
|
|
|
|
* - we need this list to parser.group(..)
|
2022-11-20 13:26:48 +03:00
|
|
|
* ...i.e. it would require changing the regexp during and async parse,
|
|
|
|
|
* potentially reparsing parsed sections agead of definition... this is
|
|
|
|
|
* fixable (more general macro name pattern + ns matching) but I'm not
|
|
|
|
|
* sure if this is worth it
|
|
|
|
|
* ...see: <page>.defmacro(..)
|
2022-11-30 21:02:51 +03:00
|
|
|
* XXX parser: error handling: revise page quoting...
|
|
|
|
|
* ...need a standard mechanism to quote urls, url-args and paths...
|
2022-11-29 18:49:04 +03:00
|
|
|
* XXX sort: revise how we store order...
|
|
|
|
|
* .metadata.order = [ .. ]
|
|
|
|
|
* .metadata.order_<name> = [ .. ]
|
|
|
|
|
* ...
|
|
|
|
|
* or:
|
|
|
|
|
* .metadata.order = {
|
|
|
|
|
* 'default': [ .. ],
|
|
|
|
|
* <name>: [ .. ]
|
|
|
|
|
* ...
|
|
|
|
|
* }
|
|
|
|
|
* ...this would make updating order more complicated (i.e. require a fetch)
|
|
|
|
|
* Q: will it be a good idea to use the cache/index api???
|
|
|
|
|
* XXX sort: aliases (a-la imagegrid)???
|
|
|
|
|
* XXX sort/cache: might be a good idea to pre-sort (index) all the pages and
|
|
|
|
|
* simply reference that for sorts...
|
|
|
|
|
* ...this needs thought and weighing...
|
2022-09-17 17:13:23 +03:00
|
|
|
* XXX EXPERIMENTAL DOC INHERIT_ARGS added a special-case...
|
|
|
|
|
* as basename will get appended :$ARGS if no args are given...
|
|
|
|
|
* ...this only applies to paths referring to the current context
|
|
|
|
|
* page, i.e.:
|
|
|
|
|
* await pwiki
|
|
|
|
|
* .get('/page:x:y:z')
|
|
|
|
|
* // this will get the args...
|
|
|
|
|
* .parse('@source(./location)')
|
|
|
|
|
*
|
|
|
|
|
* await pwiki
|
|
|
|
|
* .get('/page:x:y:z')
|
|
|
|
|
* // this will not get the args -- different page...
|
|
|
|
|
* .parse('@source(./x/location)')
|
|
|
|
|
*
|
|
|
|
|
* await pwiki
|
|
|
|
|
* .get('/page:x:y:z')
|
|
|
|
|
* // this will get explicitly given empty args...
|
|
|
|
|
* .parse('@source(./location:)')
|
|
|
|
|
*
|
|
|
|
|
* special args that auto-inherit are given in .actions_inherit_args
|
|
|
|
|
* XXX this is currently implemented on the level of macro parsing,
|
|
|
|
|
* should this be in a more general way???
|
|
|
|
|
* XXX should this be done when isolated???
|
|
|
|
|
* ...yes (current)
|
2022-08-07 08:44:01 +03:00
|
|
|
*
|
2022-08-04 19:47:08 +03:00
|
|
|
*
|
|
|
|
|
*
|
2022-08-04 11:00:21 +03:00
|
|
|
* XXX ROADMAP:
|
|
|
|
|
* - run in browser
|
2022-08-04 14:29:25 +03:00
|
|
|
* - basics, loading -- DONE
|
2022-10-07 13:02:09 +03:00
|
|
|
* - localStorage / sessionStorage -- DONE
|
|
|
|
|
* - pouchdb -- DONE
|
2022-08-04 19:47:08 +03:00
|
|
|
* - render page -- DONE
|
2022-08-08 12:29:02 +03:00
|
|
|
* - navigation -- DONE
|
2022-08-04 19:47:08 +03:00
|
|
|
* - hash/anchor -- DONE
|
2022-11-15 14:32:07 +03:00
|
|
|
* - action redirects (see: System/delete) -- ??? (unify api)
|
2022-08-14 03:00:06 +03:00
|
|
|
* - basic editor and interactivity -- DONE
|
|
|
|
|
* - export
|
|
|
|
|
* - json -- DONE
|
2022-08-15 14:29:45 +03:00
|
|
|
* - zip (json/tree) --
|
2022-10-07 13:02:09 +03:00
|
|
|
* - sync (auto) -- XXX
|
2022-11-15 14:32:07 +03:00
|
|
|
* - page actions -- DONE
|
2022-08-19 16:02:45 +03:00
|
|
|
* - migrate/rewrite bootstrap --
|
2022-08-28 16:34:46 +03:00
|
|
|
* - store topology -- DONE
|
2022-11-15 14:32:07 +03:00
|
|
|
* - config???
|
|
|
|
|
* - images XXX
|
2022-08-15 17:32:07 +03:00
|
|
|
* - get --
|
|
|
|
|
* - download --
|
|
|
|
|
* - upload --
|
2022-09-01 00:04:13 +03:00
|
|
|
* - tags
|
2022-10-27 01:39:34 +03:00
|
|
|
* - get tags from page -- DONE
|
|
|
|
|
* - show tagged pages -- DONE
|
2022-08-18 10:50:14 +03:00
|
|
|
* - search
|
2022-11-04 15:32:04 +03:00
|
|
|
* - paths -- ???
|
|
|
|
|
* - text -- DONE
|
2022-08-11 10:39:55 +03:00
|
|
|
* - markdown -- DONE
|
2022-08-10 15:29:45 +03:00
|
|
|
* - WikiWord -- DONE
|
2022-08-10 18:21:00 +03:00
|
|
|
* - dom filter mechanics -- DONE
|
2022-08-19 16:02:45 +03:00
|
|
|
* - filters
|
|
|
|
|
* - markdown (???) -- ???
|
2022-08-10 18:21:00 +03:00
|
|
|
* this can be done in one of two ways:
|
|
|
|
|
* - wrapping blocks in elemens
|
|
|
|
|
* ...requires negative filter calls, either on -wikiword
|
|
|
|
|
* or a different filter like nowikiwords...
|
|
|
|
|
* - tags (current)
|
2022-08-15 14:29:45 +03:00
|
|
|
* - raw / code -- DONE?
|
2022-08-19 16:02:45 +03:00
|
|
|
* - nl2br --
|
|
|
|
|
* - nowhitespace --
|
|
|
|
|
* clear extra whitespace from text elements
|
|
|
|
|
* - dom filters:
|
2022-08-10 15:29:45 +03:00
|
|
|
* - editor
|
2022-08-19 16:02:45 +03:00
|
|
|
* basic -- DONE
|
|
|
|
|
* see: /System/edit
|
2022-10-07 13:02:09 +03:00
|
|
|
* MediumEditor (markdown-plugin) -- REJECTED XXX
|
2022-08-13 14:57:53 +03:00
|
|
|
* https://github.com/yabwe/medium-editor
|
|
|
|
|
* https://github.com/IonicaBizau/medium-editor-markdown
|
|
|
|
|
* - heavy-ish markdown plugin
|
|
|
|
|
* ToastUI (markdown)
|
|
|
|
|
* https://github.com/nhn/tui.editor
|
|
|
|
|
* - quite heavy
|
|
|
|
|
* Pen (markdown)
|
|
|
|
|
* https://github.com/sofish/pen
|
|
|
|
|
* - no npm module
|
|
|
|
|
* - not sure if it works on mobile
|
|
|
|
|
* + small
|
|
|
|
|
* tiptap (no-markdown, investigate y.js)
|
2022-08-19 16:02:45 +03:00
|
|
|
* - wikiword / path2link --
|
|
|
|
|
* ..do we need to be able to control this???
|
|
|
|
|
* - templates
|
|
|
|
|
* - all (tree) -- DONE
|
2022-08-08 12:29:02 +03:00
|
|
|
* - configuration
|
2022-10-07 13:02:09 +03:00
|
|
|
* - defaults --
|
|
|
|
|
* - System/config (global) --
|
2022-08-04 19:47:08 +03:00
|
|
|
* - pwa
|
2022-10-07 13:02:09 +03:00
|
|
|
* - service worker -- ???
|
2022-08-08 12:29:02 +03:00
|
|
|
* ...handle relative urls (???)
|
2022-10-07 13:02:09 +03:00
|
|
|
* - fs access (external sync) -- ???
|
2022-08-06 02:07:46 +03:00
|
|
|
* - cli
|
|
|
|
|
* - basic wiki manipulations (1:1 methods)
|
|
|
|
|
* - import/export/sync
|
|
|
|
|
* - introspection/repl
|
2022-10-07 13:02:09 +03:00
|
|
|
* - archive old code --
|
|
|
|
|
* - update docs --
|
2022-08-04 11:00:21 +03:00
|
|
|
* - refactor and cleanup
|
2022-08-08 12:29:02 +03:00
|
|
|
* - module structure -- REVISE
|
2022-10-07 13:02:09 +03:00
|
|
|
* - package
|
|
|
|
|
* - pwa -- ???
|
|
|
|
|
* - electron --
|
|
|
|
|
* - android -- ???
|
|
|
|
|
* - iOS -- ???
|
2022-08-04 11:00:21 +03:00
|
|
|
*
|
|
|
|
|
*
|
2022-08-04 14:29:25 +03:00
|
|
|
*
|
|
|
|
|
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
*
|
|
|
|
|
* Architecture:
|
2022-09-10 12:38:30 +03:00
|
|
|
*
|
2022-10-07 13:02:09 +03:00
|
|
|
* store <-> index
|
2022-11-13 14:33:07 +03:00
|
|
|
* ^ ^
|
|
|
|
|
* | |
|
|
|
|
|
* +---------+
|
2022-09-10 12:38:30 +03:00
|
|
|
* |
|
|
|
|
|
* page <--> renderer
|
|
|
|
|
* ^
|
|
|
|
|
* |
|
2022-11-13 14:33:07 +03:00
|
|
|
* |
|
2022-09-10 12:38:30 +03:00
|
|
|
* client
|
|
|
|
|
*
|
|
|
|
|
*
|
2022-08-04 14:29:25 +03:00
|
|
|
*
|
|
|
|
|
* Modules:
|
2022-09-10 12:38:30 +03:00
|
|
|
* pwiki/
|
|
|
|
|
* page - base pages and page APIs
|
|
|
|
|
* parser - pWiki macro parser
|
|
|
|
|
* path - base path API
|
|
|
|
|
* store/ - stores
|
|
|
|
|
* base - memory store and store API and utils
|
|
|
|
|
* file - file store
|
|
|
|
|
* localstorage - localStorage / sessionStorage stores
|
|
|
|
|
* pouchdb - PouchDB store
|
|
|
|
|
* ...
|
|
|
|
|
* filter/ - page filters
|
|
|
|
|
* base - base filters incl. wikiword
|
|
|
|
|
* markdown - markdown renderer
|
|
|
|
|
* ...
|
|
|
|
|
* pwiki2 - main cli / node entry point
|
|
|
|
|
* browser - browser entry point
|
|
|
|
|
* pwiki2-test - testing and experimenting (XXX move to test.js)
|
2022-08-04 14:29:25 +03:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Q: can we make this a single module with +/- some plugins??
|
|
|
|
|
* ...this would make things quite a bit simpler but will negate the
|
|
|
|
|
* use of high level libs like types...
|
|
|
|
|
*
|
|
|
|
|
*
|
2022-08-11 10:56:11 +03:00
|
|
|
* XXX DOC:
|
2022-12-02 03:19:16 +03:00
|
|
|
* - .../quote/! is not the same as .../!/quote
|
|
|
|
|
* this is because actions are called right to left...
|
2022-10-29 01:40:27 +03:00
|
|
|
* - macro isolation in relation to slots...
|
2022-08-11 10:56:11 +03:00
|
|
|
* - paths in pWiki behave a bit differently than traditional
|
|
|
|
|
* file-system paths, this is due to one key distinction:
|
|
|
|
|
* in pWiki there is no distinction between a file and a
|
|
|
|
|
* directory
|
|
|
|
|
* i.e. each path can both contain data as a file and at the same
|
|
|
|
|
* time support sub-paths etc.
|
|
|
|
|
* for this reason behaviour of some APIs will differ, all paths
|
|
|
|
|
* within a page (a-la file) are relative to its children and not
|
|
|
|
|
* to it's siblings. For example, for page "/a/b/c" a link to "./x"
|
|
|
|
|
* will resolve to "/a/b/c/x" and this is independent of whether
|
|
|
|
|
* the base path is given as "/a/b/c/" or "/a/b/c"
|
|
|
|
|
*
|
|
|
|
|
* NOTE: implementing things in a traditional manner would
|
|
|
|
|
* introduce lots of edge-cases and subtle ways to make
|
|
|
|
|
* mistakes, bugs and inconsistencies.
|
2022-08-17 11:46:50 +03:00
|
|
|
* - types of recursion
|
|
|
|
|
* (see: pwiki/page.js: Page.macros.include(..) notes)
|
2022-08-19 13:13:17 +03:00
|
|
|
* - slot <content/> order --
|
|
|
|
|
* (see: page.js: Page's .macros.slot(..) notes)
|
2022-09-10 04:14:54 +03:00
|
|
|
* - arguments in macros that contain macros must be in quotes, e.g.
|
|
|
|
|
* @include("./*:@(all)")
|
|
|
|
|
* otherwise the macro will end on the first ')'...
|
|
|
|
|
* - :all argument to all pattern paths...
|
2022-08-11 10:56:11 +03:00
|
|
|
*
|
|
|
|
|
*
|
2022-07-11 18:14:11 +03:00
|
|
|
* XXX weaknesses to review:
|
|
|
|
|
* - <store>.paths() as an index...
|
|
|
|
|
* + decouples the search logic from the store backend
|
|
|
|
|
* - requires the whole list of pages to be in memory
|
|
|
|
|
* ...need to be independent of the number of pages if at
|
|
|
|
|
* all possible -- otherwise this will hinder long-term use...
|
2022-08-06 11:12:52 +03:00
|
|
|
* .paths() should be cached to make all path searches away from
|
|
|
|
|
* async waits as we can test quite a number of paths before we
|
|
|
|
|
* find a page...
|
|
|
|
|
* ...another solution is to offload the search to the store backend
|
|
|
|
|
* but this would require the stores to reimplement most of pwiki/path
|
2022-07-11 18:14:11 +03:00
|
|
|
* -
|
2022-08-06 21:28:52 +03:00
|
|
|
*
|
|
|
|
|
*
|
2022-08-07 08:44:01 +03:00
|
|
|
* TODO?:
|
2022-07-11 18:14:11 +03:00
|
|
|
* - <page>.then() -- resolve when all pending write operations done ???
|
2022-07-25 23:58:23 +03:00
|
|
|
* - an async REPL???
|
2022-08-04 19:47:08 +03:00
|
|
|
* - custom element???
|
2022-08-07 08:44:01 +03:00
|
|
|
* - might be a good idea to try signature based security:
|
2022-04-16 10:53:41 +03:00
|
|
|
* - sign changes
|
|
|
|
|
* - sign sync session
|
|
|
|
|
* - refuse changes with wrong signatures
|
|
|
|
|
* - public keys available on client and on server
|
|
|
|
|
* - check signatures localy
|
|
|
|
|
* - check signatures remotely
|
|
|
|
|
* - private key available only with author
|
|
|
|
|
* - keep both the last signed and superceding unsigned version
|
|
|
|
|
* - on sync ask to overwrite unsigned with signed
|
|
|
|
|
* - check if we can use the same mechanics as ssh...
|
|
|
|
|
* - in this view a user in the system is simply a set of keys and
|
|
|
|
|
* a signature (a page =))
|
2022-04-12 01:31:28 +03:00
|
|
|
*
|
2022-08-10 18:21:00 +03:00
|
|
|
* XXX RELATIVE relative urls are a bit odd...
|
|
|
|
|
* Path/to/page opens Moo -> Path/to/Page/Moo
|
|
|
|
|
* should be (???):
|
|
|
|
|
* Path/to/page opens Moo -> Path/to/Moo
|
|
|
|
|
* this boils down to how path.relative(..) works, treating the base
|
|
|
|
|
* as a directory always (current) vs. only if '/' is at the end, on
|
|
|
|
|
* one hand the current approach is more uniform with less subtle ways
|
|
|
|
|
* to make mistakes but on the other hand this may introduce a lot
|
|
|
|
|
* of complexity to the user writing links, e.g. how should the
|
|
|
|
|
* following be interpreted?
|
|
|
|
|
* page: /SomePage
|
|
|
|
|
* link: SomeOtherPage
|
|
|
|
|
* -> /SomeOtherPage
|
|
|
|
|
* -> /SomePage/SomeOtherPage (current)
|
|
|
|
|
* the current approach does not seem to be intuitive...
|
|
|
|
|
* can this be fixed uniformly across the whole system???
|
|
|
|
|
* XXX document this!
|
|
|
|
|
*
|
2022-05-17 17:36:42 +03:00
|
|
|
* XXX need to think about search -- page function argument syntax???
|
2022-05-17 01:26:39 +03:00
|
|
|
*
|
|
|
|
|
* XXX might need to get all the links (macro-level) from a page...
|
|
|
|
|
* ...would be useful for caching...
|
|
|
|
|
*
|
2022-05-04 18:26:02 +03:00
|
|
|
*
|
|
|
|
|
*
|
2022-04-12 01:31:28 +03:00
|
|
|
**********************************************************************/
|
|
|
|
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
|
|
|
|
(function(require){ var module={} // make module AMD/node compatible...
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
2022-04-21 18:33:08 +03:00
|
|
|
// XXX
|
|
|
|
|
//var object = require('lib/object')
|
|
|
|
|
var object = require('ig-object')
|
2022-04-25 16:00:12 +03:00
|
|
|
var types = require('ig-types')
|
2022-04-21 18:33:08 +03:00
|
|
|
|
2022-08-06 11:09:25 +03:00
|
|
|
var pwpath =
|
|
|
|
|
module.path =
|
|
|
|
|
require('./pwiki/path')
|
2022-08-05 18:21:18 +03:00
|
|
|
var page = require('./pwiki/page')
|
2022-04-12 01:31:28 +03:00
|
|
|
|
2022-08-05 18:21:18 +03:00
|
|
|
var basestore = require('./pwiki/store/base')
|
2022-08-28 16:34:46 +03:00
|
|
|
var pouchdbstore = require('./pwiki/store/pouchdb')
|
2022-04-13 03:14:21 +03:00
|
|
|
|
|
|
|
|
|
2022-04-13 12:18:13 +03:00
|
|
|
|
2022-04-13 03:14:21 +03:00
|
|
|
//---------------------------------------------------------------------
|
2022-05-11 15:36:35 +03:00
|
|
|
// Basic setup...
|
|
|
|
|
//
|
|
|
|
|
//
|
2022-05-11 16:46:27 +03:00
|
|
|
// Store topology:
|
2022-08-28 16:34:46 +03:00
|
|
|
// XXX
|
2022-05-11 15:36:35 +03:00
|
|
|
//
|
2022-04-22 12:00:48 +03:00
|
|
|
|
2022-05-10 23:58:13 +03:00
|
|
|
var store =
|
2022-08-28 16:34:46 +03:00
|
|
|
module.store = {
|
|
|
|
|
// XXX base localstorage...
|
|
|
|
|
__proto__: pouchdbstore.PouchDBStore,
|
|
|
|
|
/*/
|
|
|
|
|
__proto__: basestore.MetaStore,
|
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
next: { __proto__: basestore.MetaStore },
|
|
|
|
|
}
|
2022-05-10 23:58:13 +03:00
|
|
|
|
2022-05-11 15:27:15 +03:00
|
|
|
|
2022-08-16 11:00:23 +03:00
|
|
|
// XXX these are async...
|
|
|
|
|
// ...see browser.js for a way to deal with this...
|
2022-06-12 12:04:44 +03:00
|
|
|
// XXX note sure how to organize the system actions -- there can be two
|
2022-05-11 15:27:15 +03:00
|
|
|
// options:
|
|
|
|
|
// - a root ram store with all the static stuff and nest the rest
|
|
|
|
|
// - a nested store (as is the case here)
|
|
|
|
|
// XXX nested system store...
|
2022-08-28 16:34:46 +03:00
|
|
|
module.setup =
|
|
|
|
|
Promise.all([
|
2022-09-17 17:13:23 +03:00
|
|
|
//store.next.update('System',
|
|
|
|
|
store.next.update(
|
|
|
|
|
pwpath.sanitize(pwpath.SYSTEM_PATH),
|
2022-08-28 16:34:46 +03:00
|
|
|
Object.create(basestore.BaseStore).load(page.System)),
|
2022-09-22 03:27:02 +03:00
|
|
|
store.next.update('.templates',
|
|
|
|
|
Object.create(basestore.BaseStore).load(page.Templates)),
|
2022-09-18 20:45:55 +03:00
|
|
|
store.update('.config',
|
|
|
|
|
Object.create(basestore.BaseStore).load(page.Config)),
|
2022-08-28 16:34:46 +03:00
|
|
|
])
|
2022-08-14 03:00:06 +03:00
|
|
|
|
2022-07-28 22:35:41 +03:00
|
|
|
|
2022-05-10 23:58:13 +03:00
|
|
|
|
2022-04-23 10:56:24 +03:00
|
|
|
// NOTE: in general the root wiki api is simply a page instance.
|
2022-05-03 16:47:43 +03:00
|
|
|
// XXX not yet sure how to organize the actual client -- UI, hooks, .. etc
|
2022-04-25 20:53:20 +03:00
|
|
|
var pwiki =
|
2022-04-22 12:00:48 +03:00
|
|
|
module.pwiki =
|
2022-08-22 12:31:19 +03:00
|
|
|
//page.Page('/', '/', store)
|
|
|
|
|
page.CachedPage('/', '/', store)
|
2022-04-13 12:18:13 +03:00
|
|
|
|
2022-04-13 03:14:21 +03:00
|
|
|
|
2022-05-11 15:36:35 +03:00
|
|
|
//---------------------------------------------------------------------
|
2022-08-04 11:00:21 +03:00
|
|
|
// comandline...
|
2022-05-11 15:36:35 +03:00
|
|
|
|
2022-08-04 11:00:21 +03:00
|
|
|
if(typeof(__filename) != 'undefined'
|
|
|
|
|
&& __filename == (require.main || {}).filename){
|
2022-05-11 15:36:35 +03:00
|
|
|
|
|
|
|
|
|
2022-04-25 20:53:20 +03:00
|
|
|
|
2022-08-04 11:00:21 +03:00
|
|
|
}
|
2022-04-25 20:53:20 +03:00
|
|
|
|
2022-04-12 01:31:28 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2022-04-28 14:12:02 +03:00
|
|
|
* vim:set ts=4 sw=4 nowrap : */ return module })
|