From 796bd4d8cb9e18628e09b2650ca65e46ae4f7ab4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 15 May 2017 17:26:30 +0300 Subject: [PATCH] starting refactoring of the ui/render/access... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/all.js | 5 +++ ui (gen4)/features/core.js | 2 +- ui (gen4)/features/filesystem.js | 2 +- ui (gen4)/features/meta.js | 5 +++ ui (gen4)/features/ui-partial-ribbons-vdom.js | 4 +- ui (gen4)/features/ui-react.js | 42 ++++++++++++++++++ ui (gen4)/features/ui-ribbons.js | 42 ++++++++++++++++++ ui (gen4)/features/ui-virtual-dom.js | 44 +++++++++++++++++++ ui (gen4)/ig.js | 3 ++ ui (gen4)/package.json | 2 + 10 files changed, 148 insertions(+), 3 deletions(-) create mode 100755 ui (gen4)/features/ui-react.js create mode 100755 ui (gen4)/features/ui-ribbons.js create mode 100755 ui (gen4)/features/ui-virtual-dom.js diff --git a/ui (gen4)/features/all.js b/ui (gen4)/features/all.js index 790713f4..a92b960b 100755 --- a/ui (gen4)/features/all.js +++ b/ui (gen4)/features/all.js @@ -20,6 +20,11 @@ require('features/history') require('features/app') require('features/peer') require('features/ui') +// XXX +require('features/ui-ribbons') +require('features/ui-virtual-dom') +require('features/ui-react') +// XXX require('features/ui-partial-ribbons-precache') require('features/ui-partial-ribbons') require('features/ui-partial-ribbons-2') diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index e4ddb5e1..da25f0d4 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -629,7 +629,7 @@ var JournalActions = actions.Actions({ var handler = function(action){ return function(){ var cur = this.current - var args = args2array(arguments) + var args = util.args2array(arguments) var data = { type: 'basic', diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index 41bc181a..4c6cd8ac 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -1311,7 +1311,7 @@ module.FileSystemSaveHistory = core.ImageGridFeatures.Feature({ ['saveIndex', function(res){ var that = this - var comments = this.comments.save + var comments = this.comments && this.comments.save if(comments && comments.current){ res diff --git a/ui (gen4)/features/meta.js b/ui (gen4)/features/meta.js index 4b6a64c6..9f54f4f2 100755 --- a/ui (gen4)/features/meta.js +++ b/ui (gen4)/features/meta.js @@ -66,6 +66,11 @@ core.ImageGridFeatures.Feature('viewer-testing', [ 'ui', 'keyboard', + // XXX + 'ui-ribbons-render', + 'ui-vdom-render', + 'ui-react-render', + // features... 'ui-cursor', 'ui-animation', diff --git a/ui (gen4)/features/ui-partial-ribbons-vdom.js b/ui (gen4)/features/ui-partial-ribbons-vdom.js index 8a7dc996..5015ebdc 100755 --- a/ui (gen4)/features/ui-partial-ribbons-vdom.js +++ b/ui (gen4)/features/ui-partial-ribbons-vdom.js @@ -41,7 +41,9 @@ var core = require('features/core') //--------------------------------------------------------------------- // XXX DEBUG: remove when not needed... -window.vdom = vdom +if(typeof(window) != 'undefined'){ + window.vdom = vdom +} //--------------------------------------------------------------------- diff --git a/ui (gen4)/features/ui-react.js b/ui (gen4)/features/ui-react.js new file mode 100755 index 00000000..8c08493d --- /dev/null +++ b/ui (gen4)/features/ui-react.js @@ -0,0 +1,42 @@ +/********************************************************************** +* +* +* +**********************************************************************/ +((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define) +(function(require){ var module={} // make module AMD/node compatible... +/*********************************************************************/ + +var actions = require('lib/actions') +var features = require('lib/features') + +var core = require('features/core') + + + +/*********************************************************************/ + +var ReactActions = actions.Actions({ +}) + +var React = +module.React = core.ImageGridFeatures.Feature({ + title: '', + doc: '', + + tag: 'ui-react-render', + exclusive: ['ui-render'], + depends: [ + // XXX + ], + + actions: ReactActions, + + handlers: [], +}) + + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ return module }) diff --git a/ui (gen4)/features/ui-ribbons.js b/ui (gen4)/features/ui-ribbons.js new file mode 100755 index 00000000..c7c2e0ab --- /dev/null +++ b/ui (gen4)/features/ui-ribbons.js @@ -0,0 +1,42 @@ +/********************************************************************** +* +* +* +**********************************************************************/ +((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define) +(function(require){ var module={} // make module AMD/node compatible... +/*********************************************************************/ + +var actions = require('lib/actions') +var features = require('lib/features') + +var core = require('features/core') + + + +/*********************************************************************/ + +var RibbonsActions = actions.Actions({ +}) + +var Ribbons = +module.Ribbons = core.ImageGridFeatures.Feature({ + title: '', + doc: '', + + tag: 'ui-ribbons-render', + exclusive: ['ui-render'], + depends: [ + // XXX + ], + + actions: RibbonsActions, + + handlers: [], +}) + + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ return module }) diff --git a/ui (gen4)/features/ui-virtual-dom.js b/ui (gen4)/features/ui-virtual-dom.js new file mode 100755 index 00000000..f89d50f0 --- /dev/null +++ b/ui (gen4)/features/ui-virtual-dom.js @@ -0,0 +1,44 @@ +/********************************************************************** +* +* +* +**********************************************************************/ +((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define) +(function(require){ var module={} // make module AMD/node compatible... +/*********************************************************************/ + +var vdom = require('ext-lib/virtual-dom') + +var actions = require('lib/actions') +var features = require('lib/features') + +var core = require('features/core') + + + +/*********************************************************************/ + +var VirtualDomActions = actions.Actions({ +}) + +var VirtualDom = +module.VirtualDom = core.ImageGridFeatures.Feature({ + title: '', + doc: '', + + tag: 'ui-vdom-render', + exclusive: ['ui-render'], + depends: [ + // XXX + ], + + actions: VirtualDomActions, + + handlers: [], +}) + + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ return module }) diff --git a/ui (gen4)/ig.js b/ui (gen4)/ig.js index 82d0d4f8..832daaae 100644 --- a/ui (gen4)/ig.js +++ b/ui (gen4)/ig.js @@ -19,6 +19,9 @@ requirejs.config({ paths: { //text: 'node_modules/requirejs-plugins/lib/text', //json: 'node_modules/requirejs-plugins/src/json', + + //react: 'node_modules/react/dist/react-with-addons.min.js', + //'react-dom': 'node_modules/react-dom/dist/react-dom.min.js', 'lib/object': 'node_modules/ig-object/object', 'lib/actions': 'node_modules/ig-actions/actions', diff --git a/ui (gen4)/package.json b/ui (gen4)/package.json index decac9b3..73dfd71a 100755 --- a/ui (gen4)/package.json +++ b/ui (gen4)/package.json @@ -26,6 +26,8 @@ "ig-features": "^2.0.0", "ig-object": "^1.0.1", "openseadragon": "^2.1.0", + "react": "^15.5.4", + "react-dom": "^15.5.4", "requirejs": "^2.1.23", "requirejs-plugins": "^1.0.2", "sharp": "^0.17.0",