photolayout 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.npmignore +8 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +41 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bower.json +30 -0
- data/coffeelint.json +5 -0
- data/dist/demo.css +1 -0
- data/dist/demo.js +26633 -0
- data/dist/demo.min.css +1 -0
- data/dist/demo.min.js +28 -0
- data/dist/photolayout.js +615 -0
- data/dist/photolayout.min.js +1 -0
- data/index.html +1 -0
- data/lib/photolayout.rb +53 -0
- data/lib/photolayout/version.rb +3 -0
- data/package.json +49 -0
- data/photolayout.gemspec +26 -0
- data/src/configuration.coffee +37 -0
- data/src/css.coffee +20 -0
- data/src/demo.coffee +64 -0
- data/src/demo.sass +12 -0
- data/src/index.jade +45 -0
- data/src/layout.coffee +90 -0
- data/src/line.coffee +51 -0
- data/src/photolayout.coffee +9 -0
- data/src/responsivelayout.coffee +48 -0
- data/webpack.config.js +29 -0
- metadata +138 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
`import Layout from './layout.coffee'`
|
2
|
+
`import ResponsiveLayout from './responsivelayout.coffee'`
|
3
|
+
`import Css from './css.coffee'`
|
4
|
+
`import Configuration from './configuration.coffee';`
|
5
|
+
photolayout =
|
6
|
+
Layout: Layout
|
7
|
+
ResponsiveLayout: ResponsiveLayout
|
8
|
+
Configuration: Configuration
|
9
|
+
`export default photolayout`
|
@@ -0,0 +1,48 @@
|
|
1
|
+
`import Layout from './layout.coffee'`
|
2
|
+
`import Css from './css.coffee'`
|
3
|
+
`import Configuration from './configuration.coffee';`
|
4
|
+
class ResponsiveLayout
|
5
|
+
constructor: (config)->
|
6
|
+
if config instanceof Configuration
|
7
|
+
@_config = config
|
8
|
+
else
|
9
|
+
@_config = new Configuration(config)
|
10
|
+
@_photos = []
|
11
|
+
@_layouts = undefined
|
12
|
+
getLayouts: ->
|
13
|
+
return @_layouts if @_layouts?
|
14
|
+
@_layouts = {}
|
15
|
+
width = @_config.max_width()
|
16
|
+
while width > @_config.min_width()
|
17
|
+
layout = new Layout(
|
18
|
+
@_config.derivate(
|
19
|
+
zoom: @_config.line_height()/width,
|
20
|
+
margin: @_config.margin()/width*100
|
21
|
+
)
|
22
|
+
)
|
23
|
+
layout.add(@_photos)
|
24
|
+
@_layouts[width] = layout
|
25
|
+
[min, max] = layout.min_max_line_ratio()
|
26
|
+
tolerance = width - width * @_config.tolerance()
|
27
|
+
width -= Math.round(tolerance / min)
|
28
|
+
@_layouts
|
29
|
+
add: (photo)->
|
30
|
+
if photo instanceof Array
|
31
|
+
for p in photo
|
32
|
+
@add(p)
|
33
|
+
return this
|
34
|
+
@_photos.push(photo)
|
35
|
+
@_layouts = undefined
|
36
|
+
return this
|
37
|
+
layout_for: (width)->
|
38
|
+
layout
|
39
|
+
breakpoints: ->
|
40
|
+
Object.keys(@getLayouts()).sort((a,b)->
|
41
|
+
b-a
|
42
|
+
)
|
43
|
+
css: ->
|
44
|
+
css = new Css
|
45
|
+
for width in @breakpoints()
|
46
|
+
css.add_block(@_layouts[width].css(), "@media (max-width: #{width}px)")
|
47
|
+
css.css()
|
48
|
+
`export default ResponsiveLayout`
|
data/webpack.config.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
var webpack = require('webpack');
|
2
|
+
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
3
|
+
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
4
|
+
module.exports = {
|
5
|
+
entry: {
|
6
|
+
photolayout: "./src/photolayout.coffee",
|
7
|
+
"photolayout.min": "./src/photolayout.coffee",
|
8
|
+
"demo": "./src/demo.coffee",
|
9
|
+
"demo.min": "./src/demo.coffee"
|
10
|
+
},
|
11
|
+
output: {
|
12
|
+
path: __dirname,
|
13
|
+
filename: "dist/[name].js",
|
14
|
+
libraryTarget: "umd",
|
15
|
+
library: '[name]'
|
16
|
+
},
|
17
|
+
module: {
|
18
|
+
loaders: [
|
19
|
+
{ test: /\.coffee$/, loaders: ["babel?presets[]=es2015", "coffee-loader" ] },
|
20
|
+
{ test: /\.sass$/, loader: ExtractTextPlugin.extract("style-loader", "css!sass") },
|
21
|
+
{ test: /\.jade$/, loader: "jade"}
|
22
|
+
]
|
23
|
+
},
|
24
|
+
plugins: [
|
25
|
+
new webpack.optimize.UglifyJsPlugin({ include: /\.min\.js$/ }),
|
26
|
+
new HtmlWebpackPlugin({ template: './src/index.jade', inject: false }),
|
27
|
+
new ExtractTextPlugin("dist/[name].css")
|
28
|
+
]
|
29
|
+
};
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: photolayout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luc Boissaye
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: execjs
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.7'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.7.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.7'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.7.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.12'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.12'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: minitest
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '5.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '5.0'
|
75
|
+
description: Photolayout from Evlaa !
|
76
|
+
email:
|
77
|
+
- luc@boissaye.fr
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- ".gitignore"
|
83
|
+
- ".npmignore"
|
84
|
+
- ".travis.yml"
|
85
|
+
- Gemfile
|
86
|
+
- README.md
|
87
|
+
- Rakefile
|
88
|
+
- bin/console
|
89
|
+
- bin/setup
|
90
|
+
- bower.json
|
91
|
+
- coffeelint.json
|
92
|
+
- dist/demo.css
|
93
|
+
- dist/demo.js
|
94
|
+
- dist/demo.min.css
|
95
|
+
- dist/demo.min.js
|
96
|
+
- dist/photolayout.js
|
97
|
+
- dist/photolayout.min.js
|
98
|
+
- index.html
|
99
|
+
- lib/photolayout.rb
|
100
|
+
- lib/photolayout/version.rb
|
101
|
+
- package.json
|
102
|
+
- photolayout.gemspec
|
103
|
+
- src/configuration.coffee
|
104
|
+
- src/css.coffee
|
105
|
+
- src/demo.coffee
|
106
|
+
- src/demo.sass
|
107
|
+
- src/index.jade
|
108
|
+
- src/layout.coffee
|
109
|
+
- src/line.coffee
|
110
|
+
- src/photolayout.coffee
|
111
|
+
- src/responsivelayout.coffee
|
112
|
+
- webpack.config.js
|
113
|
+
homepage: https://github.com/ombr/photolayout
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.5.1
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Photolayout from Evlaa
|
137
|
+
test_files: []
|
138
|
+
has_rdoc:
|