mosaico 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +7 -0
- data/LICENSE +680 -0
- data/README.md +179 -0
- data/Rakefile +5 -0
- data/app/assets/images/mosaico/logo_transparent.png +0 -0
- data/app/assets/javascripts/mosaico/application.js.erb +51 -0
- data/app/assets/javascripts/mosaico/plugins/debug.js.erb +10 -0
- data/app/assets/javascripts/mosaico/plugins/logo.js.erb +10 -0
- data/app/assets/javascripts/mosaico/plugins/preview.js +85 -0
- data/app/assets/javascripts/mosaico/plugins/save.js.erb +72 -0
- data/app/assets/javascripts/mosaico/plugins/template_path.js.erb +22 -0
- data/app/assets/javascripts/mosaico/plugins/translations.js +10 -0
- data/app/assets/javascripts/mosaico/utilities.js +25 -0
- data/app/assets/stylesheets/mosaico/application.css +6 -0
- data/app/controllers/mosaico/application_controller.rb +17 -0
- data/app/controllers/mosaico/images_controller.rb +142 -0
- data/app/controllers/mosaico/projects_controller.rb +31 -0
- data/app/controllers/mosaico/templates_controller.rb +8 -0
- data/app/helpers/mosaico/application_helper.rb +7 -0
- data/app/models/mosaico/image.rb +9 -0
- data/app/models/mosaico/placeholder_image.rb +9 -0
- data/app/models/mosaico/project.rb +13 -0
- data/app/models/mosaico/uploaded_image.rb +26 -0
- data/app/views/layouts/mosaico/application.html.erb +13 -0
- data/app/views/mosaico/projects/new.html.erb +1 -0
- data/app/views/mosaico/projects/show.html.erb +1 -0
- data/app/views/mosaico/shared/_metadata.html.erb +12 -0
- data/config/routes.rb +12 -0
- data/db/migrate/20170817202255_add_images.rb +14 -0
- data/db/migrate/20170824233755_add_projects.rb +11 -0
- data/lib/mosaico.rb +100 -0
- data/lib/mosaico/engine.rb +72 -0
- data/lib/mosaico/local_backend.rb +23 -0
- data/lib/mosaico/local_image_backend.rb +7 -0
- data/lib/mosaico/local_placeholder_backend.rb +7 -0
- data/lib/mosaico/placeholder.png +0 -0
- data/lib/mosaico/template.rb +89 -0
- data/lib/mosaico/versafix_template.rb +43 -0
- data/lib/mosaico/version.rb +4 -0
- data/lib/tasks/makeThumbs.js.erb +57 -0
- data/lib/tasks/thumbs.rake +35 -0
- data/mosaico.gemspec +22 -0
- data/screenshot.png +0 -0
- data/vendor/assets/fonts/LiberationSans-Regular.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.jsbeautifyrc +6 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.jshintrc +8 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.travis.yml +6 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/CONTRIBUTING.md +37 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/Dockerfile +21 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/Gruntfile.js +241 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/LICENSE +680 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/NOTICE.txt +87 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/README.md +73 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/backend/README.txt +23 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/backend/main.js +162 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/bower.json +76 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico-material.css +7425 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.css +7133 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.debug.js +1517 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.js +12828 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/templates.js +15 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.svg +685 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/byvoxmail.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-badge.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-v.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico32.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaicologo.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot-orig.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/README.md +26 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-de.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-en.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-es.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-fr.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-it.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-nl.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-sv.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js +1517 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js.map +147 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/canvas-to-blob.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.css +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.js +13 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-image.js +324 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-process.js +175 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-validate.js +122 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload.js +1482 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.iframe-transport.js +217 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.js +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.ui.touch-punch.min.js +11 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout-jqueryui.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/load-image.all.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/stylesheet.css +9 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.js +55 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.js +204 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.js +162 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.js +165 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.js +462 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js +60 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/css/prism.css +138 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.js +1319 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.js +112 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.js +100 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.js +64 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js +65 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.js +490 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.js +154 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.js +30 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.js +630 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.js +2944 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.js +273 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.js +121 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.js +225 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.js +208 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.js +403 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.js +965 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/moxieplayer.swf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.js +879 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.js +53 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.js +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.js +1844 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.js +32 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.js +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.js +609 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.js +1031 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.js +120 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.js +4400 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.js +276 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.js +297 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.js +268 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/css/visualblocks.css +135 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.js +86 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.js +69 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/Variables.less +196 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/readme.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.json +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.svg +129 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.js +1828 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.js +934 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/tinymce.min.js +14 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/editor.html +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/favicon.ico +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/index.html +368 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/package.json +92 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/byvoxmail.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-badge.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-v.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico32.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaicologo.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot-orig.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/README.md +26 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-de.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-en.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-es.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-fr.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-it.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-nl.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-sv.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/Variables.less +196 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/readme.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.json +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/server-config.js +12 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/converter-spec.js +115 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/data/template-versafix-1.model.json +137 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/declarations-spec.js +282 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/mensch-spec.js +114 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/model-spec.js +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/stylesheet-spec.js +177 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone.less +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone_material.less +350 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/safarihack.css +17 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements.less +497 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_jquery.less +344 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_mixins.less +406 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_moxie.less +130 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico.less +529 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_content.less +391 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_tools.less +1043 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_reset.less +45 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_variables.less +156 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/app.js +167 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/bind-iframe.js +64 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/blocks.js +118 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/choose-template.js +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/colorpicker.js +58 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/csstext.js +16 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/droppable.js +87 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/eventable.js +33 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extender-pagination.js +60 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extsortables.js +103 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/fileupload.js +373 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/if-subs.js +110 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js +31 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-tabs.js +17 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/script-template.js +30 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollfix.js +48 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollintoview.js +83 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/string-template.js +76 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/tooltips.js +36 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/validated-value.js +40 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/virtuals.js +102 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/wysiwygs.js +304 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/checkmodel.js +114 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/declarations.js +279 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/domutils.js +93 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/editor.js +411 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/main.js +42 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/model.js +536 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/parser.js +485 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/stylesheet.js +205 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/utils.js +156 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/wrapper.js +308 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/color.js +53 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/inliner.js +35 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/localstorage.js +100 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ko-bindings.js +22 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/template-loader.js +446 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/timed-call.js +31 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undomain.js +49 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undoserializer.js +120 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/viewmodel.js +595 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/array.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-show.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-wysiwyg.tmpl.html +18 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-show.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-wysiwyg.tmpl.html +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/customstyle.tmpl.html +3 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/empty.tmpl.html +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/error.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/gallery-images.tmpl.html +16 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/img-wysiwyg.tmpl.html +43 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/main.tmpl.html +102 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/toolbox.tmpl.html +111 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/combineKOTemplates.js +24 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/lib/phantom-thumbnailer-editor.js +168 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/makeThumbs.js +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/README.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/footerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/headerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/heroBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/socialBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/threetwoBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/twoColumnBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/template-tedc15.html +567 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/HeaderAndText.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/fixedlist.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.md +335 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.pdf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_384.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_385.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_386.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_387.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_407.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_408.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/template-tutorial.html +68 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/buttonBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleImageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/hrBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/imageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/logoBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/sideArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/singleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/socialBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/spacerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/textBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/titleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleImageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/sponsor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/template-versafix-1.html +1531 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/uploads/README.md +1 -0
- metadata +536 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// Parses CSS/stylesheets declarations -ko-blockdefs/-ko-themes
|
4
|
+
// It returns KO bindings but doesn't depend on KO
|
5
|
+
// Needs a bindingProvider
|
6
|
+
// Also uses a blockDefsUpdater to update definitions while parsing the stylesheet.
|
7
|
+
|
8
|
+
var cssParse = require("mensch/lib/parser.js");
|
9
|
+
var console = require("console");
|
10
|
+
var converterUtils = require("./utils.js");
|
11
|
+
var elaborateDeclarations = require("./declarations.js");
|
12
|
+
|
13
|
+
/* Temporary experimental code not used
|
14
|
+
var _processStyleSheetRules_processThemes = function (bindingProvider, themeUpdater, rules) {
|
15
|
+
var sels, decls, i, j, k;
|
16
|
+
for( i = 0; i < rules.length; i++) {
|
17
|
+
if (rules[i].type == 'rule') {
|
18
|
+
sels = rules[i].selectors;
|
19
|
+
decls = rules[i].declarations;
|
20
|
+
for (j = 0; j < sels.length; j++) {
|
21
|
+
for (k = 0; k < decls.length; k++) if (decls[k].type == 'property') {
|
22
|
+
try {
|
23
|
+
var bindVal = bindingProvider('$'+decls[k].name);
|
24
|
+
themeUpdater(sels[j], decls[k].name, decls[k].value, bindVal);
|
25
|
+
} catch (e) {
|
26
|
+
console.log("Exception setting theme for", decls[k].name, decls[k].value, e);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
};
|
33
|
+
*/
|
34
|
+
|
35
|
+
var _processStyleSheetRules_processBlockDef = function(blockDefsUpdater, rules) {
|
36
|
+
var properties, namedProps, decls;
|
37
|
+
// name, contextName, globalStyle, themeOverride, extend, min, max, widget, options, category, variant, help, blockDescription, version,
|
38
|
+
for (var i = 0; i < rules.length; i++) {
|
39
|
+
if (rules[i].type == 'rule') {
|
40
|
+
var sels = rules[i].selectors;
|
41
|
+
var hasDeclarations = false;
|
42
|
+
var hasPreviews = false;
|
43
|
+
for (var j = 0; j < sels.length; j++) {
|
44
|
+
if (sels[j].match(/:preview$/)) {
|
45
|
+
hasPreviews = true;
|
46
|
+
} else {
|
47
|
+
hasDeclarations = true;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
if (hasPreviews && hasDeclarations) {
|
51
|
+
console.log("cannot mix selectors type (:preview and declarations) in @supports -ko-blockdefs ", sels);
|
52
|
+
throw "Cannot mix selectors type (:preview and declarations) in @supports -ko-blockdefs";
|
53
|
+
}
|
54
|
+
if (!hasPreviews && !hasDeclarations) {
|
55
|
+
console.log("cannot find known selectors in @supports -ko-blockdefs ", sels);
|
56
|
+
throw "Cannot find known selectors in @supports -ko-blockdefs";
|
57
|
+
}
|
58
|
+
if (hasDeclarations) {
|
59
|
+
properties = '';
|
60
|
+
namedProps = {};
|
61
|
+
|
62
|
+
/*
|
63
|
+
name = undefined;
|
64
|
+
contextName = undefined;
|
65
|
+
globalStyle = undefined;
|
66
|
+
themeOverride = undefined;
|
67
|
+
extend = undefined;
|
68
|
+
max = undefined;
|
69
|
+
min = undefined;
|
70
|
+
widget = undefined;
|
71
|
+
options = undefined;
|
72
|
+
category = undefined;
|
73
|
+
variant = undefined;
|
74
|
+
help = undefined;
|
75
|
+
blockDescription = undefined;
|
76
|
+
version = undefined;
|
77
|
+
*/
|
78
|
+
decls = rules[i].declarations;
|
79
|
+
for (var k = 0; k < decls.length; k++) if (decls[k].type == 'property') {
|
80
|
+
if (decls[k].name == 'label') namedProps.name = decls[k].value;
|
81
|
+
else if (decls[k].name == 'context') namedProps.contextName = decls[k].value;
|
82
|
+
else if (decls[k].name == 'properties') properties = decls[k].value;
|
83
|
+
else if (decls[k].name == 'theme') namedProps.globalStyle = '_theme_.' + decls[k].value;
|
84
|
+
else if (decls[k].name == 'themeOverride') namedProps.themeOverride = String(decls[k].value).toLowerCase() == 'true';
|
85
|
+
// else if (decls[k].name == 'extend') extend = decls[k].value;
|
86
|
+
|
87
|
+
// else if (decls[k].name == 'max') max = decls[k].value;
|
88
|
+
// else if (decls[k].name == 'min') min = decls[k].value;
|
89
|
+
// else if (decls[k].name == 'options') options = decls[k].value;
|
90
|
+
|
91
|
+
// else if (decls[k].name == 'widget') widget = decls[k].value;
|
92
|
+
// else if (decls[k].name == 'category') category = decls[k].value;
|
93
|
+
// else if (decls[k].name == 'variant') variant = decls[k].value;
|
94
|
+
// else if (decls[k].name == 'help') help = decls[k].value;
|
95
|
+
// else if (decls[k].name == 'blockDescription') blockDescription = decls[k].value;
|
96
|
+
// else if (decls[k].name == 'version') version = decls[k].value;
|
97
|
+
else {
|
98
|
+
namedProps[decls[k].name] = decls[k].value;
|
99
|
+
// TODO in past we detected unsupported properties, while now we simple push every declaration in a namedProperty.
|
100
|
+
// This make it harder to spot errors in declarations.
|
101
|
+
// console.warn("Unknown property processing @supports -ko-blockdefs ", decls[k], sels);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
for (var l = 0; l < sels.length; l++) {
|
105
|
+
blockDefsUpdater(sels[l], properties, namedProps);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
if (hasPreviews) {
|
109
|
+
for (var m = 0; m < sels.length; m++) {
|
110
|
+
var localBlockName = sels[m].substr(0, sels[m].indexOf(':'));
|
111
|
+
var previewBindings = rules[i].declarations;
|
112
|
+
blockDefsUpdater(localBlockName, undefined, { previewBindings: previewBindings });
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
} else {
|
117
|
+
// Ignoring comments or other content
|
118
|
+
}
|
119
|
+
}
|
120
|
+
};
|
121
|
+
|
122
|
+
var processStylesheetRules = function(style, rules, localWithBindingProvider, blockDefsUpdater, themeUpdater, templateUrlConverter, rootModelName, templateName) {
|
123
|
+
var newStyle = style;
|
124
|
+
var lastStart = null;
|
125
|
+
|
126
|
+
if (typeof rules == 'undefined') {
|
127
|
+
var styleSheet = cssParse(style, {
|
128
|
+
comments: true,
|
129
|
+
position: true
|
130
|
+
});
|
131
|
+
if (styleSheet.type != 'stylesheet' || typeof styleSheet.stylesheet == 'undefined') {
|
132
|
+
console.log("unable to process styleSheet", styleSheet);
|
133
|
+
throw "Unable to parse stylesheet";
|
134
|
+
}
|
135
|
+
rules = styleSheet.stylesheet.rules;
|
136
|
+
}
|
137
|
+
|
138
|
+
// WARN currenlty this parses rules in reverse order so that string replacements works using input "positions"
|
139
|
+
// otherwise it should compute new offsets on every replacement.
|
140
|
+
// But this create issues because of definitions being parsed in reverse order, so this is not a good idea.
|
141
|
+
// Sometimes, to work around this issues, you need to create 2 different <style> blocks.
|
142
|
+
var bindingProvider;
|
143
|
+
|
144
|
+
for (var i = rules.length - 1; i >= 0; i--) {
|
145
|
+
if (rules[i].type == 'supports' && rules[i].name == '-ko-blockdefs') {
|
146
|
+
_processStyleSheetRules_processBlockDef(blockDefsUpdater, rules[i].rules);
|
147
|
+
newStyle = converterUtils.removeStyle(newStyle, rules[i].position.start, lastStart, 0, 0, 0, '');
|
148
|
+
/* temporary experimental code not used
|
149
|
+
} else if (rules[i].type == 'supports' && rules[i].name == '-ko-themes') {
|
150
|
+
bindingProvider = localWithBindingProvider.bind(this, 'theme', '');
|
151
|
+
_processStyleSheetRules_processThemes(bindingProvider, themeUpdater, rules[i].rules);
|
152
|
+
newStyle = converterUtils.removeStyle(newStyle, rules[i].position.start, lastStart, 0, 0, 0, '');
|
153
|
+
*/
|
154
|
+
} else if (rules[i].type == 'media' || rules[i].type == 'supports') {
|
155
|
+
newStyle = processStylesheetRules(newStyle, rules[i].rules, localWithBindingProvider, blockDefsUpdater, themeUpdater, templateUrlConverter, rootModelName, templateName);
|
156
|
+
} else if (rules[i].type == 'comment') {
|
157
|
+
// ignore comments
|
158
|
+
} else if (rules[i].type == 'rule') {
|
159
|
+
var sels = rules[i].selectors;
|
160
|
+
var newSel = "";
|
161
|
+
var foundBlockMatch = null;
|
162
|
+
for (var j = 0; j < sels.length; j++) {
|
163
|
+
if (newSel.length > 0) newSel += ", ";
|
164
|
+
var match = sels[j].match(/\[data-ko-block=([^ ]*)\]/);
|
165
|
+
if (match !== null) {
|
166
|
+
if (foundBlockMatch !== null && foundBlockMatch != match[1]) throw "Found multiple block-match attribute selectors: cannot translate it (" + foundBlockMatch + " vs " + match[1] + ")";
|
167
|
+
foundBlockMatch = match[1];
|
168
|
+
}
|
169
|
+
newSel += '<!-- ko text: templateMode ==\'wysiwyg\' ? \'#main-wysiwyg-area \' : \'\' --><!-- /ko -->' + sels[j];
|
170
|
+
}
|
171
|
+
if (foundBlockMatch) {
|
172
|
+
var loopPrefix = '<!-- ko foreach: $root.findObjectsOfType($data, \'' + foundBlockMatch + '\') -->';
|
173
|
+
var loopPostfix = '<!-- /ko -->';
|
174
|
+
var end = lastStart;
|
175
|
+
var spacing = " ";
|
176
|
+
if (rules[i].declarations.length > 0) {
|
177
|
+
if (rules[i].declarations[0].position.start.line != rules[i].position.end.line) {
|
178
|
+
spacing = "\n" + (new Array(rules[i].position.start.col)).join(" ");
|
179
|
+
}
|
180
|
+
end = rules[i].declarations[rules[i].declarations.length - 1].position.end;
|
181
|
+
}
|
182
|
+
if (end === null) newStyle += spacing + loopPostfix;
|
183
|
+
else if (end == lastStart) newStyle = converterUtils.removeStyle(newStyle, end, lastStart, 0, 0, 0, spacing + loopPostfix);
|
184
|
+
else newStyle = converterUtils.removeStyle(newStyle, end, lastStart, 0, 0, 0, spacing + '}' + spacing + loopPostfix);
|
185
|
+
newSel = loopPrefix + spacing + newSel.replace(new RegExp('\\[data-ko-block=' + foundBlockMatch + '\\]', 'g'), '<!-- ko text: \'#\'+id() -->' + foundBlockMatch + '<!-- /ko -->');
|
186
|
+
|
187
|
+
blockDefsUpdater(foundBlockMatch, '', { contextName: 'block' });
|
188
|
+
}
|
189
|
+
// TODO mensch update (using original mensch library we needed this line, while the patched one doesn't need this code)
|
190
|
+
// newSel += " {";
|
191
|
+
var localBlockName = foundBlockMatch ? foundBlockMatch : templateName;
|
192
|
+
bindingProvider = localWithBindingProvider.bind(this, localBlockName, '');
|
193
|
+
var elaboratedStyle = elaborateDeclarations(newStyle, rules[i].declarations, templateUrlConverter, bindingProvider);
|
194
|
+
if (elaboratedStyle !== null) newStyle = elaboratedStyle;
|
195
|
+
|
196
|
+
newStyle = converterUtils.removeStyle(newStyle, rules[i].position.start, rules[i].position.end, 0, 0, 0, newSel);
|
197
|
+
} else {
|
198
|
+
console.log("Unknown rule type", rules[i].type, "while parsing <style> rules");
|
199
|
+
}
|
200
|
+
lastStart = rules[i].position.start;
|
201
|
+
}
|
202
|
+
return newStyle;
|
203
|
+
};
|
204
|
+
|
205
|
+
module.exports = processStylesheetRules;
|
@@ -0,0 +1,156 @@
|
|
1
|
+
"use strict";
|
2
|
+
var console = require('console');
|
3
|
+
var jsep = require('jsep');
|
4
|
+
|
5
|
+
jsep.addBinaryOp("or", 1);
|
6
|
+
jsep.addBinaryOp("and", 2);
|
7
|
+
jsep.addBinaryOp("eq", 6);
|
8
|
+
jsep.addBinaryOp("neq", 6);
|
9
|
+
jsep.addBinaryOp("lt", 7);
|
10
|
+
jsep.addBinaryOp("lte", 7);
|
11
|
+
jsep.addBinaryOp("gt", 7);
|
12
|
+
jsep.addBinaryOp("gte", 7);
|
13
|
+
|
14
|
+
var addSlashes = function(str) {
|
15
|
+
return str.replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
|
16
|
+
};
|
17
|
+
|
18
|
+
var removeStyle = function(style, startPos, endPos, skipRows, startOffset, endOffset, insert) {
|
19
|
+
var styleRows = style.split("\n");
|
20
|
+
var start = startOffset;
|
21
|
+
var end = endOffset;
|
22
|
+
for (var r = 1 + skipRows; r < startPos.line; r++) start += styleRows[r - 1 - skipRows].length + 1;
|
23
|
+
start += startPos.col;
|
24
|
+
if (endPos !== null) {
|
25
|
+
for (var r2 = 1 + skipRows; r2 < endPos.line; r2++) end += styleRows[r2 - 1 - skipRows].length + 1;
|
26
|
+
end += endPos.col;
|
27
|
+
} else end += style.length + 1;
|
28
|
+
var newStyle = style.substr(0, start - 1) + insert + style.substr(end - 1);
|
29
|
+
return newStyle;
|
30
|
+
};
|
31
|
+
|
32
|
+
var expressionGenerator = function(node, bindingProvider, defVal) {
|
33
|
+
function mapOperator(op) {
|
34
|
+
switch (op) {
|
35
|
+
case 'or':
|
36
|
+
return '||';
|
37
|
+
case 'and':
|
38
|
+
return '&&';
|
39
|
+
case 'lt':
|
40
|
+
return '<';
|
41
|
+
case 'lte':
|
42
|
+
return '<=';
|
43
|
+
case 'gt':
|
44
|
+
return '>';
|
45
|
+
case 'gte':
|
46
|
+
return '>=';
|
47
|
+
case 'eq':
|
48
|
+
return '==';
|
49
|
+
case 'neq':
|
50
|
+
return '!=';
|
51
|
+
default:
|
52
|
+
return op;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
function gen(node, bindingProvider, lookupmember, defVal) {
|
57
|
+
if (typeof lookupmember == 'undefined') lookupmember = true;
|
58
|
+
|
59
|
+
if (typeof defVal !== 'undefined' && node.type !== "Identifier" && node.type !== "MemberExpression") console.log("Cannot apply default value to variable when using expressions");
|
60
|
+
|
61
|
+
if (node.type === "BinaryExpression" || node.type === "LogicalExpression") {
|
62
|
+
return '(' + gen(node.left, bindingProvider, lookupmember) + ' ' + mapOperator(node.operator) + ' ' + gen(node.right, bindingProvider, lookupmember) + ')';
|
63
|
+
} else if (node.type === 'CallExpression') {
|
64
|
+
var args = node.arguments.map(function(n) {
|
65
|
+
return gen(n, bindingProvider, lookupmember);
|
66
|
+
});
|
67
|
+
return gen(node.callee, bindingProvider, lookupmember) + '(' + args.join(', ') + ')';
|
68
|
+
} else if (node.type === "UnaryExpression") {
|
69
|
+
return node.operator + gen(node.argument, bindingProvider, lookupmember);
|
70
|
+
} else if (node.type == 'MemberExpression' && node.computed) {
|
71
|
+
throw "Unexpected computed member expression";
|
72
|
+
// return gen(node.object) + '[' + gen(node.property) + ']';
|
73
|
+
} else if (node.type == 'MemberExpression' && !node.computed) {
|
74
|
+
var me = gen(node.object, bindingProvider, false) + '.' + gen(node.property, bindingProvider, false);
|
75
|
+
if (lookupmember && node.object.name !== 'Math' && node.object.name !== 'Color') return bindingProvider(me, defVal) + '()';
|
76
|
+
return me;
|
77
|
+
} else if (node.type === "Literal") {
|
78
|
+
return node.raw;
|
79
|
+
} else if (node.type === 'Identifier') {
|
80
|
+
var id = node.name;
|
81
|
+
if (lookupmember) return bindingProvider(id, defVal) + '()';
|
82
|
+
else return id;
|
83
|
+
} else if (node.type === 'ConditionalExpression') {
|
84
|
+
return '(' + gen(node.test, bindingProvider, lookupmember) + ' ? ' + gen(node.consequent, bindingProvider, lookupmember) + ' : ' + gen(node.alternate, bindingProvider, lookupmember) + ')';
|
85
|
+
} else if (node.type === 'Compound') {
|
86
|
+
throw "Syntax error in expression: operator expected after " + gen(node.body[0], bindingProvider, false);
|
87
|
+
} else {
|
88
|
+
throw "Found an unsupported expression type: " + node.type;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
return gen(node, bindingProvider, undefined, defVal);
|
93
|
+
};
|
94
|
+
|
95
|
+
var expressionBinding = function(expression, bindingProvider, defaultValue) {
|
96
|
+
var matches;
|
97
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== null) {
|
98
|
+
var check = expression.trim().replace(/@\[([^\]]+)\]|@([a-zA-Z0-9\._]+)\b/g, '###var###');
|
99
|
+
check = check.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
100
|
+
if (check == '###var###') matches = [null, defaultValue];
|
101
|
+
else {
|
102
|
+
check = '^' + check.replace(/###var###/g, '(.+)') + '$';
|
103
|
+
matches = defaultValue.trim().match(new RegExp(check));
|
104
|
+
if (!matches) {
|
105
|
+
// TODO throw error?
|
106
|
+
console.log("Cannot find matches", matches, "for", defaultValue, expression, check, expression);
|
107
|
+
throw "Cannot find default value for " + expression + " in " + defaultValue;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
try {
|
112
|
+
var vars = 0;
|
113
|
+
var result = "'" + expression.replace(/@\[([^\]]+)\]|@([a-zA-Z0-9\._]+)\b|(')/g, function(match, p1, p2, p3) {
|
114
|
+
// escaping..
|
115
|
+
if (p3) return "\\" + p3;
|
116
|
+
vars++;
|
117
|
+
var varName = p1 || p2;
|
118
|
+
var defVal;
|
119
|
+
if (matches) {
|
120
|
+
if (typeof matches[vars] !== 'undefined') {
|
121
|
+
defVal = matches[vars].trim();
|
122
|
+
} else {
|
123
|
+
console.log("ABZZZ Cannot find default value for", varName, "in", matches, "as", vars);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
// in case we found p1 we are in a @[sequence] so we start an expression parser
|
127
|
+
if (p1) {
|
128
|
+
var parsetree = jsep(p1);
|
129
|
+
var gentree = expressionGenerator(parsetree, bindingProvider, defVal);
|
130
|
+
return "'+" + gentree + "+'";
|
131
|
+
}
|
132
|
+
return "'+" + bindingProvider(varName, defVal) + "()+'";
|
133
|
+
}) + "'";
|
134
|
+
result = result.replace(/(^|[^\\])''\+/g, '$1').replace(/\+''/g, '');
|
135
|
+
|
136
|
+
if (vars === 0 && result !== 'false' && result !== 'true') {
|
137
|
+
console.error("Unexpected expression with no valid @variable references", expression);
|
138
|
+
}
|
139
|
+
return result;
|
140
|
+
} catch (e) {
|
141
|
+
throw "Exception parsing expression " + expression + " " + e;
|
142
|
+
}
|
143
|
+
};
|
144
|
+
|
145
|
+
var conditionBinding = function(condition, bindingProvider) {
|
146
|
+
var parsetree = jsep(condition);
|
147
|
+
var gentree = expressionGenerator(parsetree, bindingProvider);
|
148
|
+
return gentree;
|
149
|
+
};
|
150
|
+
|
151
|
+
module.exports = {
|
152
|
+
addSlashes: addSlashes,
|
153
|
+
removeStyle: removeStyle,
|
154
|
+
conditionBinding: conditionBinding,
|
155
|
+
expressionBinding: expressionBinding
|
156
|
+
};
|
@@ -0,0 +1,308 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// This is complex code to handle "live" model instrumentation and dependency tracking.
|
4
|
+
// This adds _wrap and _unwrap methods to the model and also instrument the block list so to automatically
|
5
|
+
// wrap/upwrap objects on simple array methods (push, splice)
|
6
|
+
|
7
|
+
var ko = require("knockout");
|
8
|
+
var kowrap = require("knockout.wrap");
|
9
|
+
var console = require("console");
|
10
|
+
|
11
|
+
var _getOptionsObject = function(options) {
|
12
|
+
var optionsCouples = options.split('|');
|
13
|
+
var opts = {};
|
14
|
+
for (var i = 0; i < optionsCouples.length; i++) {
|
15
|
+
var opt = optionsCouples[i].split('=');
|
16
|
+
opts[opt[0]] = opt.length > 1 ? opt[1] : opt[0];
|
17
|
+
}
|
18
|
+
return opts;
|
19
|
+
};
|
20
|
+
|
21
|
+
// generate a computed variable handling the fallback to theme variable
|
22
|
+
var _makeComputed = function(target, def, nullIfEqual, schemeSelector, themePath, themes) {
|
23
|
+
var res = ko.computed({
|
24
|
+
'read': function() {
|
25
|
+
var val = target();
|
26
|
+
if (val === null) {
|
27
|
+
var scheme = ko.utils.unwrapObservable(schemeSelector);
|
28
|
+
if (typeof scheme == 'undefined' || scheme == 'custom') {
|
29
|
+
return ko.utils.unwrapObservable(def);
|
30
|
+
} else {
|
31
|
+
return themes[scheme][themePath];
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
return val;
|
35
|
+
}
|
36
|
+
},
|
37
|
+
'write': function(value) {
|
38
|
+
var scheme = ko.utils.unwrapObservable(schemeSelector);
|
39
|
+
var defVal;
|
40
|
+
if (typeof scheme == 'undefined' || scheme == 'custom') {
|
41
|
+
defVal = ko.utils.peekObservable(def);
|
42
|
+
} else {
|
43
|
+
defVal = themes[scheme][themePath];
|
44
|
+
}
|
45
|
+
|
46
|
+
if (!!nullIfEqual) {
|
47
|
+
if (value == defVal) target(null);
|
48
|
+
else target(value);
|
49
|
+
} else {
|
50
|
+
var current = ko.utils.peekObservable(target);
|
51
|
+
if (value != defVal || current !== null) target(value);
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
55
|
+
});
|
56
|
+
return res;
|
57
|
+
};
|
58
|
+
|
59
|
+
var _nextVariantFunction = function(ko, prop, variants) {
|
60
|
+
var currentValue = ko.utils.unwrapObservable(prop);
|
61
|
+
var variantValue;
|
62
|
+
|
63
|
+
for (var i = 0; i < variants.length; i++) {
|
64
|
+
variantValue = ko.utils.peekObservable(variants[i]);
|
65
|
+
if (variantValue == currentValue) break;
|
66
|
+
}
|
67
|
+
|
68
|
+
if (i == variants.length) {
|
69
|
+
console.warn("Didn't find a variant!", prop, currentValue, variants);
|
70
|
+
i = variants.length - 1;
|
71
|
+
}
|
72
|
+
|
73
|
+
var nextVariant = i + 1;
|
74
|
+
if (nextVariant == variants.length) nextVariant = 0;
|
75
|
+
var nextValue = ko.utils.peekObservable(variants[nextVariant]);
|
76
|
+
|
77
|
+
prop(nextValue);
|
78
|
+
};
|
79
|
+
|
80
|
+
var _getVariants = function(def) {
|
81
|
+
var variantProp = def._variant;
|
82
|
+
var variantOptions;
|
83
|
+
if (typeof def[variantProp] !== 'object' || typeof def[variantProp]._widget === 'undefined' || (typeof def[variantProp]._options !== 'string' && def[variantProp]._widget !== 'boolean')) {
|
84
|
+
console.error("Unexpected variant declaration", variantProp, def[variantProp]);
|
85
|
+
throw "Unexpected variant declaration: cannot find property " + variantProp + " or its _options string and it is not a boolean";
|
86
|
+
}
|
87
|
+
// TODO I read the "keys" but this is not 100% correct because they are not garanteed to be sorted as in declaration
|
88
|
+
if (typeof def[variantProp]._options == 'string') {
|
89
|
+
variantOptions = Object.keys(_getOptionsObject(def[variantProp]._options));
|
90
|
+
} else {
|
91
|
+
variantOptions = [true, false];
|
92
|
+
}
|
93
|
+
return variantOptions;
|
94
|
+
};
|
95
|
+
|
96
|
+
var _makeComputedFunction = function(def, defs, thms, ko, contentModel, isContent, t) {
|
97
|
+
if (typeof def == 'undefined') {
|
98
|
+
if (typeof ko.utils.unwrapObservable(t).type === 'undefined') {
|
99
|
+
console.log("TODO ERROR Found a non-typed def ", def, t);
|
100
|
+
throw "Found a non-typed def " + def;
|
101
|
+
}
|
102
|
+
var type = ko.utils.unwrapObservable(ko.utils.unwrapObservable(t).type);
|
103
|
+
def = defs[type];
|
104
|
+
if (typeof def !== 'object') console.log("TODO ERROR Found a non-object def ", def, "for", type);
|
105
|
+
}
|
106
|
+
|
107
|
+
if (typeof contentModel == 'undefined' && typeof isContent != 'undefined' && isContent) {
|
108
|
+
contentModel = t;
|
109
|
+
}
|
110
|
+
|
111
|
+
var selfPath = '$root.content().';
|
112
|
+
|
113
|
+
var pp = def._globalStyles;
|
114
|
+
if (typeof pp != 'undefined')
|
115
|
+
for (var p in pp)
|
116
|
+
if (pp.hasOwnProperty(p)) {
|
117
|
+
var schemePathOrig = '$root.content().theme().scheme';
|
118
|
+
var schemePath, vm, path;
|
119
|
+
|
120
|
+
if (pp[p].substr(0, selfPath.length) == selfPath) {
|
121
|
+
path = pp[p].substr(selfPath.length);
|
122
|
+
vm = contentModel;
|
123
|
+
} else {
|
124
|
+
throw "UNEXPECTED globalStyle path (" + pp[p] + ") outside selfPath (" + selfPath + ")";
|
125
|
+
}
|
126
|
+
if (schemePathOrig.substr(0, selfPath.length) == selfPath) {
|
127
|
+
schemePath = schemePathOrig.substr(selfPath.length);
|
128
|
+
} else {
|
129
|
+
console.log("IS THIS CORRECT?", schemePathOrig, selfPath);
|
130
|
+
schemePath = schemePathOrig;
|
131
|
+
}
|
132
|
+
|
133
|
+
var schemeSelector = vm;
|
134
|
+
|
135
|
+
var pathParts = path.split('().');
|
136
|
+
var themePath = '';
|
137
|
+
var skip = true;
|
138
|
+
for (var i = 0; i < pathParts.length; i++) {
|
139
|
+
vm = ko.utils.unwrapObservable(vm)[pathParts[i]];
|
140
|
+
// ugly thing to find the path to the schema color property (sometimes we have theme.bodyTheme, some other we have content.theme.bodyTheme...)
|
141
|
+
if (skip) {
|
142
|
+
if (pathParts[i] == 'theme') skip = false;
|
143
|
+
} else {
|
144
|
+
if (themePath.length > 0) themePath += '.';
|
145
|
+
themePath += pathParts[i];
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
var schemeParts = schemePath.split('().');
|
150
|
+
for (var i3 = 0; i3 < schemeParts.length; i3++) {
|
151
|
+
schemeSelector = ko.utils.unwrapObservable(schemeSelector)[schemeParts[i3]];
|
152
|
+
}
|
153
|
+
|
154
|
+
var nullIfEqual = true;
|
155
|
+
var tParts = p.split('.');
|
156
|
+
var target = t;
|
157
|
+
for (var i2 = 0; i2 < tParts.length; i2++) {
|
158
|
+
target = ko.utils.unwrapObservable(target)[tParts[i2]];
|
159
|
+
}
|
160
|
+
|
161
|
+
if (!ko.isObservable(target)) throw "Unexpected non observable target " + p + "/" + themePath;
|
162
|
+
|
163
|
+
target._defaultComputed = _makeComputed(target, vm, nullIfEqual, schemeSelector, themePath, thms);
|
164
|
+
}
|
165
|
+
|
166
|
+
if (typeof def._variant != 'undefined') {
|
167
|
+
var pParts = def._variant.split('.');
|
168
|
+
// looks in t and not contentModel because variants are declared on single blocks.
|
169
|
+
var pTarget = t;
|
170
|
+
var pParent = ko.utils.unwrapObservable(t);
|
171
|
+
for (var i4 = 0; i4 < pParts.length; i4++) {
|
172
|
+
pTarget = ko.utils.unwrapObservable(pTarget)[pParts[i4]];
|
173
|
+
}
|
174
|
+
if (typeof pTarget._defaultComputed != 'undefined') {
|
175
|
+
console.log("Found variant on a style property: beware variants should be only used on content properties because they don't match the theme fallback behaviour", def._variant);
|
176
|
+
pTarget = pTarget._defaultComputed;
|
177
|
+
}
|
178
|
+
if (typeof pTarget == 'undefined') {
|
179
|
+
console.log("ERROR looking for variant target", def._variant, t);
|
180
|
+
throw "ERROR looking for variant target " + def._variant;
|
181
|
+
}
|
182
|
+
pParent._nextVariant = _nextVariantFunction.bind(pTarget, ko, pTarget, _getVariants(def));
|
183
|
+
}
|
184
|
+
|
185
|
+
for (var prop2 in def)
|
186
|
+
if (def.hasOwnProperty(prop2)) {
|
187
|
+
var val = def[prop2];
|
188
|
+
if (typeof val == 'object' && val !== null && typeof val._context != 'undefined' && val._context == 'block') {
|
189
|
+
var propVm = contentModel[prop2]();
|
190
|
+
var newVm = _makeComputedFunction(defs[prop2], defs, thms, ko, contentModel, isContent, propVm);
|
191
|
+
t[prop2](newVm);
|
192
|
+
} else if (typeof val == 'object' && val !== null && val.type == 'blocks') {
|
193
|
+
var mainVm = contentModel[prop2]();
|
194
|
+
var blocksVm = mainVm.blocks();
|
195
|
+
var oldBlock, blockType, newBlock;
|
196
|
+
for (var ib = 0; ib < blocksVm.length; ib++) {
|
197
|
+
oldBlock = ko.utils.unwrapObservable(blocksVm[ib]);
|
198
|
+
blockType = ko.utils.unwrapObservable(oldBlock.type);
|
199
|
+
newBlock = _makeComputedFunction(defs[blockType], defs, thms, ko, contentModel, isContent, oldBlock);
|
200
|
+
blocksVm[ib](newBlock);
|
201
|
+
}
|
202
|
+
|
203
|
+
var blocksObs = mainVm.blocks;
|
204
|
+
|
205
|
+
_augmentBlocksObservable(blocksObs, _blockInstrumentFunction.bind(mainVm, undefined, defs, thms, ko, undefined, contentModel, isContent));
|
206
|
+
|
207
|
+
contentModel[prop2]._wrap = _makeBlocksWrap.bind(contentModel[prop2], blocksObs._instrumentBlock);
|
208
|
+
contentModel[prop2]._unwrap = _unwrap.bind(contentModel[prop2]);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
return t;
|
213
|
+
};
|
214
|
+
|
215
|
+
var _augmentBlocksObservable = function(blocksObs, instrument) {
|
216
|
+
blocksObs._instrumentBlock = instrument;
|
217
|
+
if (typeof blocksObs.origPush == 'undefined') {
|
218
|
+
blocksObs.origPush = blocksObs.push;
|
219
|
+
blocksObs.push = _makePush.bind(blocksObs);
|
220
|
+
blocksObs.origSplice = blocksObs.splice;
|
221
|
+
blocksObs.splice = _makeSplice.bind(blocksObs);
|
222
|
+
}
|
223
|
+
};
|
224
|
+
|
225
|
+
var _makeBlocksWrap = function(instrument, inputModel) {
|
226
|
+
var model = ko.toJS(inputModel);
|
227
|
+
var input = model.blocks;
|
228
|
+
model.blocks = [];
|
229
|
+
var res = kowrap.fromJS(model, undefined, true)();
|
230
|
+
_augmentBlocksObservable(res.blocks, instrument);
|
231
|
+
for (var i = 0; i < input.length; i++) {
|
232
|
+
var obj = ko.toJS(input[i]);
|
233
|
+
// console.log("_makeBlocksWrap set blockId", obj.id, 'block_'+i);
|
234
|
+
obj.id = 'block_' + i;
|
235
|
+
res.blocks.push(obj);
|
236
|
+
}
|
237
|
+
this(res);
|
238
|
+
};
|
239
|
+
|
240
|
+
var _makePush = function() {
|
241
|
+
if (arguments.length > 1) throw "Array push with multiple arguments not implemented";
|
242
|
+
// unwrap observable blocks, otherwise visibility (dependency) handling breaks
|
243
|
+
if (arguments.length > 0 && ko.isObservable(arguments[0])) {
|
244
|
+
if (typeof arguments[0]._unwrap == 'function') {
|
245
|
+
arguments[0] = arguments[0]._unwrap();
|
246
|
+
} else {
|
247
|
+
console.log("WARN: pushing observable with no _unwrap function (TODO remove me, expected condition)");
|
248
|
+
}
|
249
|
+
}
|
250
|
+
if (!ko.isObservable(arguments[0])) {
|
251
|
+
var instrumented = this._instrumentBlock(arguments[0]);
|
252
|
+
return this.origPush.apply(this, [instrumented]);
|
253
|
+
} else {
|
254
|
+
return this.origPush.apply(this, arguments);
|
255
|
+
}
|
256
|
+
};
|
257
|
+
|
258
|
+
var _makeSplice = function() {
|
259
|
+
if (arguments.length > 3) throw "Array splice with multiple objects not implemented";
|
260
|
+
if (arguments.length > 2 && ko.isObservable(arguments[2])) {
|
261
|
+
if (typeof arguments[2]._unwrap == 'function') {
|
262
|
+
arguments[2] = arguments[2]._unwrap();
|
263
|
+
} else {
|
264
|
+
console.log("WARN: splicing observable with no _unwrap function (TODO remove me, expected condition)");
|
265
|
+
}
|
266
|
+
}
|
267
|
+
if (arguments.length > 2 && !ko.isObservable(arguments[2])) {
|
268
|
+
var instrumented = this._instrumentBlock(arguments[2]);
|
269
|
+
return this.origSplice.apply(this, [arguments[0], arguments[1], instrumented]);
|
270
|
+
} else {
|
271
|
+
return this.origSplice.apply(this, arguments);
|
272
|
+
}
|
273
|
+
};
|
274
|
+
|
275
|
+
// def, defs and themes are bound in "_modelInstrument" while the next parameters are exposed by this module
|
276
|
+
var _blockInstrumentFunction = function(def, defs, themes, knockout, self, modelContent, isContent, self2) {
|
277
|
+
// ugly: sometimes we have to bind content but not self, so we repeat self at the end as "self2"
|
278
|
+
if (typeof self == 'undefined') self = self2;
|
279
|
+
|
280
|
+
var computedFunctions;
|
281
|
+
computedFunctions = {
|
282
|
+
'': _makeComputedFunction.bind(self, def, defs, themes, knockout, modelContent, isContent)
|
283
|
+
};
|
284
|
+
|
285
|
+
var res = kowrap.fromJS(self, computedFunctions, true);
|
286
|
+
res._unwrap = _unwrap.bind(res);
|
287
|
+
return res;
|
288
|
+
};
|
289
|
+
|
290
|
+
var _wrap = function(instrument, unwrapped) {
|
291
|
+
var newContent = ko.utils.unwrapObservable(instrument(ko, unwrapped, undefined, true));
|
292
|
+
this(newContent);
|
293
|
+
};
|
294
|
+
|
295
|
+
var _unwrap = function() {
|
296
|
+
return ko.toJS(this);
|
297
|
+
};
|
298
|
+
|
299
|
+
var _modelInstrument = function(model, modelDef, defs) {
|
300
|
+
var _instrument = _blockInstrumentFunction.bind(undefined, modelDef, defs, defs['themes']);
|
301
|
+
var res = _instrument(ko, model, undefined, true);
|
302
|
+
// res._instrument = _instrument;
|
303
|
+
res._wrap = _wrap.bind(res, _instrument);
|
304
|
+
res._unwrap = _unwrap.bind(res);
|
305
|
+
return res;
|
306
|
+
};
|
307
|
+
|
308
|
+
module.exports = _modelInstrument;
|