moved format-specific config to filesystem.IndexFormat feature...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-26 05:36:28 +03:00
parent 85191b261a
commit 9a487c86e6
3 changed files with 47 additions and 17 deletions

View File

@ -35,6 +35,7 @@ LIB_DIR=lib
EXT_LIB_DIR=ext-lib EXT_LIB_DIR=ext-lib
CSS_DIR=css CSS_DIR=css
FEATURES_DIR=features FEATURES_DIR=features
WORKERS_DIR=workers
NW_PROJECT_FILE=package.json NW_PROJECT_FILE=package.json
JS_FILES := $(wildcard *.js) JS_FILES := $(wildcard *.js)
HTML_FILES := $(wildcard *.html) HTML_FILES := $(wildcard *.html)
@ -111,7 +112,7 @@ $(APP_ZIP): $(CSS_FILES) $(BUILD_DIR) $(NODE_DIR) $(NW_PROJECT_FILE) \
$(JS_FILES) $(CSS_FILES) $(HTML_FILES) $(JS_FILES) $(CSS_FILES) $(HTML_FILES)
zip -r $(APP_ZIP) $(NW_PROJECT_FILE) $(JS_FILES) $(CSS_FILES) \ zip -r $(APP_ZIP) $(NW_PROJECT_FILE) $(JS_FILES) $(CSS_FILES) \
$(HTML_FILES) $(LIB_DIR) $(EXT_LIB_DIR) $(FEATURES_DIR) \ $(HTML_FILES) $(LIB_DIR) $(EXT_LIB_DIR) $(FEATURES_DIR) \
$(CSS_DIR) \ $(WORKERS_DIR) $(CSS_DIR) \
$(NODE_DIR)/app-module-path $(NODE_DIR)/app-module-path
zip: $(APP_ZIP) zip: $(APP_ZIP)

View File

@ -45,6 +45,41 @@ if(typeof(process) != 'undefined'){
/*********************************************************************/
var IndexFormat =
module.IndexFormat = core.ImageGridFeatures.Feature({
title: '',
doc: '',
tag: 'index-format',
config: {
'index-dir': '.ImageGrid',
'preview-sizes': [
75,
150,
350,
900,
1000,
1280,
1920,
],
// Supported fields:
// $INDEX - index directory name
// $RESOLUTION - preview resolution
// $GID - image GID
// $NAME - image name
//
// XXX make this used in loader too...
'preview-path-template': '${INDEX}/${RESOLUTION}px/${GID} - ${NAME}.jpg',
},
})
/*********************************************************************/ /*********************************************************************/
var FileSystemInfoActions = actions.Actions({ var FileSystemInfoActions = actions.Actions({
@ -67,6 +102,7 @@ module.FileSystemInfo = core.ImageGridFeatures.Feature({
tag: 'fs-info', tag: 'fs-info',
depends: [ depends: [
'location', 'location',
'index-format',
], ],
actions: FileSystemInfoActions, actions: FileSystemInfoActions,
@ -84,8 +120,6 @@ module.FileSystemInfo = core.ImageGridFeatures.Feature({
// NOTE: this will also manage .location.from // NOTE: this will also manage .location.from
var FileSystemLoaderActions = actions.Actions({ var FileSystemLoaderActions = actions.Actions({
config: { config: {
'index-dir': '.ImageGrid',
'image-file-pattern': '*+(jpg|jpeg|png|JPG|JPEG|PNG)', 'image-file-pattern': '*+(jpg|jpeg|png|JPG|JPEG|PNG)',
'image-file-read-stat': true, 'image-file-read-stat': true,
@ -1085,7 +1119,6 @@ var FileSystemWriterActions = actions.Actions({
'select', 'select',
], ],
'export-preview-size': 1000,
// XXX add options to indicate: // XXX add options to indicate:
// - long side // - long side
// - short side // - short side
@ -1094,12 +1127,12 @@ var FileSystemWriterActions = actions.Actions({
// - ... // - ...
// XXX this repeats sharp.SharpActions.config['preview-sizes'] // XXX this repeats sharp.SharpActions.config['preview-sizes']
'export-preview-sizes': [ 'export-preview-sizes': [
'500',
'900', '900',
'1000', '1000',
'1280', '1280',
'1920', '1920',
], ],
'export-preview-size': 1000,
}, },
// This can be: // This can be:
@ -1565,7 +1598,8 @@ module.FileSystemWriter = core.ImageGridFeatures.Feature({
tag: 'fs-writer', tag: 'fs-writer',
// NOTE: this is mostly because of the base path handling... // NOTE: this is mostly because of the base path handling...
depends: [ depends: [
'fs-loader' 'fs-loader',
'index-format',
], ],
suggested: [ suggested: [
'ui-fs-writer', 'ui-fs-writer',
@ -1975,6 +2009,7 @@ module.FileSystemWriterUI = core.ImageGridFeatures.Feature({
//--------------------------------------------------------------------- //---------------------------------------------------------------------
core.ImageGridFeatures.Feature('fs', [ core.ImageGridFeatures.Feature('fs', [
'index-format',
'fs-info', 'fs-info',
'fs-loader', 'fs-loader',
'fs-writer', 'fs-writer',

View File

@ -42,19 +42,10 @@ if(typeof(process) != 'undefined'){
var SharpActions = actions.Actions({ var SharpActions = actions.Actions({
config: { config: {
'preview-path-template': '${INDEX}/${RESOLUTION}px/${GID} - ${NAME}.jpg',
'preview-normalized': true, 'preview-normalized': true,
// XXX this repeats filesystem.FileSystemWriterActions.config['export-preview-sizes'] // NOTE: this uses 'preview-sizes' and 'preview-path-template'
'preview-sizes': [ // from filesystem.IndexFormat...
1920,
1280,
900,
350,
150,
75,
]
}, },
// NOTE: post handlers are pushed in .makePreviews(..) // NOTE: post handlers are pushed in .makePreviews(..)
@ -222,6 +213,8 @@ var SharpActions = actions.Actions({
}], }],
}) })
// XXX need to auto-generate previews for very large images...
var Sharp = var Sharp =
module.Sharp = core.ImageGridFeatures.Feature({ module.Sharp = core.ImageGridFeatures.Feature({
title: '', title: '',
@ -230,6 +223,7 @@ module.Sharp = core.ImageGridFeatures.Feature({
tag: 'sharp', tag: 'sharp',
depends: [ depends: [
'location', 'location',
'index-format',
], ],
actions: SharpActions, actions: SharpActions,