diff --git a/Viewer/features/base.js b/Viewer/features/base.js index 7d87e161..e2644c29 100755 --- a/Viewer/features/base.js +++ b/Viewer/features/base.js @@ -304,12 +304,9 @@ actions.Actions({ clone: ['- File/', function(full){ return function(res){ if(this.data){ - res.data = this.data.clone() - } + res.data = this.data.clone() } if(this.images){ - res.images = this.images.clone() - } - } }], + res.images = this.images.clone() } } }], dataFromURLs: ['- File/', function(lst, base){ diff --git a/Viewer/features/core.js b/Viewer/features/core.js index 5035bb61..641bc68a 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -170,16 +170,14 @@ if(typeof(process) != 'undefined'){ // XXX this will not work directly as we will need to explicitly // require jli... //patchDate(global.Date) - } -} + } } // browser... // NOTE: we're avoiding detecting browser specifics for as long as possible, // this will minimize the headaches of supporting several non-standard // versions of code... if(typeof(window) != 'undefined'){ - runtime.browser = true -} + runtime.browser = true } @@ -596,6 +594,8 @@ var LoggerActions = actions.Actions({ return (this.__logger = this.__logger || this.Logger(this)) }, + set logger(value){ + this.__logger = value }, // XXX move this to console-logger??? // XXX should this be an action??? @@ -1029,7 +1029,8 @@ module.LifeCycle = ImageGridFeatures.Feature({ var SerializationActions = actions.Actions({ clone: ['- System/', - function(full){ return actions.MetaActions.clone.call(this, full) }], + function(full){ + return actions.MetaActions.clone.call(this, full) }], json: ['- System/', function(){ return {} }], load: ['- System/', @@ -2935,6 +2936,51 @@ var TaskActions = actions.Actions({ || this.tasks.Task(name, queue) return queue }), + + + + // isolated tasks (XXX EXPERIMENTAL) + + // XXX would be nice to have an ability to partially clone the instance... + // ...currently we can do a full clone and remove things we do + // not want but that still takes time and memory... + // XXX sould we also do a fast clone or shallow clone??? + __clones: null, + isolate: ['- System/', + function(){ + var clones = this.__clones = this.__clones || [] + + var clone = this.clone(true) + + // reset actions to exclude UI... + // XXX this still has all the ui handlers setup... + clone.__proto__ = ImageGridFeatures.setup([...this.features.input, '-ui']) + + // link clone in... + clone.logger = this.logger.push(['Task', clones.length].join(' ')) + + clones.push(clone) + return clone }], + // Create a new ig instance with the same data... + // + // This will reflect the data changes while when the main index is + // cleared or reloaded this will retain the old data... + __links: null, + link: ['- System/', + function(){ + var that = this + var links = this.__links = this.__links || [] + // XXX we need to only link it part of the data, for example + // ._action_handlers is action-set specific and should + // not be overwritten... + var link = ImageGridFeatures.setup([...this.features.input, '-ui']) + // XXX this is not a clean clone... + return Object.assign( + link, + this) + .run(function(){ + this.logger = that.logger.push(['Task', links.length].join(' ')) + links.push(this) }) }], }) var Tasks = diff --git a/Viewer/features/sharp.js b/Viewer/features/sharp.js index bf8640d1..6b3c9289 100755 --- a/Viewer/features/sharp.js +++ b/Viewer/features/sharp.js @@ -558,6 +558,11 @@ var SharpActions = actions.Actions({ // - we could abort the update if we go away... // - we could clone the index and if index.gid does not // match the main index use the clone to save.... + // ...the cloning approach would be quite simple: + // ig.clone().makePreviews() + // or: + // ig.peer.clone().makePreviews() // hypothetical api... + // the only question here is how to manage this... // XXX change base_path to target path... _makePreviews: ['- Sharp|File/Make image $previews (experimental)', core.queueHandler('Make image previews', diff --git a/Viewer/package-lock.json b/Viewer/package-lock.json index dd466838..72a89d57 100755 --- a/Viewer/package-lock.json +++ b/Viewer/package-lock.json @@ -580,6 +580,15 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, + "copy-anything": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.1.tgz", + "integrity": "sha512-lA57e7viQHOdPQcrytv5jFeudZZOXuyk47lZym279FiDQ8jeZomXiGuVf6ffMKkJ+3TIai3J1J3yi6M+/4U35g==", + "dev": true, + "requires": { + "is-what": "^3.7.1" + } + }, "core-js": { "version": "3.8.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.1.tgz", @@ -813,9 +822,9 @@ "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" }, "errno": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", - "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", + "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", "dev": true, "optional": true, "requires": { @@ -1172,9 +1181,9 @@ "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" }, "ig-actions": { - "version": "3.24.24", - "resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.24.24.tgz", - "integrity": "sha512-WFLV64Zn5KKZLuUz+puPTiZAakF4HuQ0LYYYXFRLMBbKXFb2oZbmuLJQIEYtanlOpW6aBeMYWmeb3Gpg0QgjyA==", + "version": "3.24.28", + "resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.24.28.tgz", + "integrity": "sha512-3Um0eHHg15y6bxpLZV+FB88qtBro9iXXHNcoOvOf64I4eu+VPThSe3HBUkw03V81Qv19dSlmNYIPHXU1LcMbRw==", "requires": { "ig-object": "^5.4.12" } @@ -1188,25 +1197,18 @@ } }, "ig-features": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/ig-features/-/ig-features-3.4.2.tgz", - "integrity": "sha512-vzmxDU/jknxii++h5ldU6f66uFzYvbmMIdk+VaNO3d6ADi5Y0y4NaQPM1NSagfXTlj3FAGMbvloZf5V9+ORIKA==", + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/ig-features/-/ig-features-3.4.5.tgz", + "integrity": "sha512-koFV8Rx5MUmnbwQcGKuO6A62XQB4F/TJ2ZwDwpTGDkeUmNkLLkPaPaW9fwMosUZRZoKCiH6evARqaSW/PX91Ww==", "requires": { - "ig-actions": "^3.24.7", - "ig-object": "^2.2.2" - }, - "dependencies": { - "ig-object": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/ig-object/-/ig-object-2.7.2.tgz", - "integrity": "sha512-oDkhxH2mnrC148nNeLuYbgT1c6XNuJbVWm7j6WStIUZPpOQWR7/XnE4uodKmwjP47GbBKWuWtPhjA+F9pUubaA==" - } + "ig-actions": "^3.24.28", + "ig-object": "^5.4.14" } }, "ig-object": { - "version": "5.4.13", - "resolved": "https://registry.npmjs.org/ig-object/-/ig-object-5.4.13.tgz", - "integrity": "sha512-6qJjoDWZ4VmXJvga3LoFH7/JmUoOZuGC73iG54hC8uvv8CAOAMTwTpMm4c2kKAeZ+HdA1sHfa1cjSPVbElmUTA==" + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/ig-object/-/ig-object-5.4.14.tgz", + "integrity": "sha512-7gSU0Qg4E0rnCPuITu6nJzgr4N73tFN57CISVrQjB+EglixfDI5SwOVRgPtG0EBOgtE8IL4O7fmq/UV87OUYyA==" }, "ig-types": { "version": "6.0.4", @@ -1268,6 +1270,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-what": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.12.0.tgz", + "integrity": "sha512-2ilQz5/f/o9V7WRWJQmpFYNmQFZ9iM+OXRonZKcYgTkCzjb949Vi4h282PD1UfmgHk666rcWonbRJ++KI41VGw==", + "dev": true + }, "is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -1359,11 +1367,12 @@ } }, "less": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/less/-/less-3.13.0.tgz", - "integrity": "sha512-uPhr9uoSGVKKYVGz0rXcYBK1zjwcIWRGcbnSgNt66XuIZYrYPaQiS+LeUOvqedBwrwdBYYaLqSff5ytGYuT7rA==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/less/-/less-3.13.1.tgz", + "integrity": "sha512-SwA1aQXGUvp+P5XdZslUOhhLnClSLIjWvJhmd+Vgib5BFIr9lMNlQwmwUNOjXThF/A0x+MCYYPeWEfeWiLRnTw==", "dev": true, "requires": { + "copy-anything": "^2.0.1", "errno": "^0.1.1", "graceful-fs": "^4.1.2", "image-size": "~0.5.0", diff --git a/Viewer/package.json b/Viewer/package.json index 62188870..74199f65 100755 --- a/Viewer/package.json +++ b/Viewer/package.json @@ -30,10 +30,10 @@ "generic-walk": "^1.4.0", "glob": "^7.1.6", "guarantee-events": "^1.0.0", - "ig-actions": "^3.24.24", + "ig-actions": "^3.24.28", "ig-argv": "^2.16.3", - "ig-features": "^3.4.2", - "ig-object": "^5.4.13", + "ig-features": "^3.4.5", + "ig-object": "^5.4.14", "ig-types": "^6.0.4", "json5": "^2.1.3", "object-run": "^1.0.1", @@ -55,7 +55,7 @@ "devDependencies": { "asar": "^3.0.1", "electron-rebuild": "^1.11.0", - "less": "^3.13.0", + "less": "^3.13.1", "rcedit": "^3.0.0" }, "bin": { diff --git a/Viewer/ui.js b/Viewer/ui.js index b58ffad8..bad762c5 100755 --- a/Viewer/ui.js +++ b/Viewer/ui.js @@ -35,6 +35,7 @@ $(function(){ // setup actions... window.ig = window.ImageGrid = + // XXX should this be core??? viewer.ImageGridFeatures .setup([ 'imagegrid-testing',