(http://jonathantneal.com)",
44 | "license": "MIT",
45 | "bugs": "https://github.com/jonathantneal/flexibility/issues",
46 | "homepage": "https://github.com/jonathantneal/flexibility#readme",
47 | "watch": {
48 | "compile-w-map": {
49 | "patterns": [
50 | "lib",
51 | "test"
52 | ],
53 | "extensions": "js",
54 | "quiet": "true"
55 | }
56 | },
57 | "scripts": {
58 | "compile": "browserify lib/index.js --standalone flexibility --outfile flexibility.js",
59 | "compile-w-map": "browserify lib/index.js --debug --standalone flexibility --outfile flexibility.js",
60 | "compress": "uglifyjs flexibility.js --compress --mangle --output flexibility.js",
61 | "compress-w-map": "uglifyjs flexibility.js --compress --mangle --source-map flexibility.js.map --output flexibility.js",
62 | "build": "npm run compile && npm run compress",
63 | "eslint": "eslint ./lib/",
64 | "prepublish": "npm run build",
65 | "test": "npm run eslint",
66 | "watch": "npm-watch"
67 | },
68 | "dependencies": {},
69 | "devDependencies": {
70 | "ava": "^0.25.0",
71 | "browserify": "^16.2.2",
72 | "eslint": "^5.2.0",
73 | "eslint-config-dev": "^2.0.0",
74 | "npm-watch": "^0.3.0",
75 | "uglify-js": "^3.4.6"
76 | },
77 | "engines": {
78 | "node": ">=0.12.0"
79 | },
80 | "eslintConfig": {
81 | "extends": "dev"
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/test/flex-direction-column.control.html:
--------------------------------------------------------------------------------
1 |
2 | control - flex-direction: column
3 |
4 |
5 |
6 |
7 | control - flex-direction: column
8 |
9 |
--------------------------------------------------------------------------------
/test/flex-direction-column.html:
--------------------------------------------------------------------------------
1 |
2 | test - flex-direction: column
3 |
4 |
5 |
6 |
7 | test - flex-direction: column
8 |
9 |
--------------------------------------------------------------------------------
/test/flex-direction-row.control.html:
--------------------------------------------------------------------------------
1 |
2 | control - flex-direction: row
3 |
4 |
5 |
6 |
7 | control - flex-direction: row
8 |
9 |
--------------------------------------------------------------------------------
/test/flex-direction-row.html:
--------------------------------------------------------------------------------
1 |
2 | test - flex-direction: row
3 |
4 |
5 |
6 |
7 | test - flex-direction: row
8 |
9 |
--------------------------------------------------------------------------------
/test/flex-within-flex.html:
--------------------------------------------------------------------------------
1 |
2 | test - flexbox within flexbox
3 |
4 |
5 |
6 |
7 | test - flexbox within flexbox
8 |
9 |
--------------------------------------------------------------------------------
/test/negative-margin.control.html:
--------------------------------------------------------------------------------
1 |
2 | control - negative margin
3 |
4 |
5 |
6 |
7 | control - negative margin
8 |
9 |
--------------------------------------------------------------------------------
/test/negative-margin.html:
--------------------------------------------------------------------------------
1 |
2 | test - negative margin
3 |
4 |
5 |
6 |
7 | test - negative margin
8 |
9 |
--------------------------------------------------------------------------------
/test/shared/flex-direction-column.html:
--------------------------------------------------------------------------------
1 |
2 | justify-content: space-around
3 |
4 | a1
5 | a2
6 | a3
7 |
8 |
9 | a1; height: 30px
10 | a2; height: 30px
11 | a3; height: 30px
12 |
13 |
14 | a1; flex-basis: 30px
15 | a2; flex-basis: 30px
16 | a3; flex-basis: 30px
17 |
18 |
19 |
20 |
21 | flex-grow: 1
22 |
23 | a1
24 | a2; flex-grow: 1
25 |
26 |
27 | a1; flex-grow: 1
28 | a2; flex-grow: 1
29 |
30 |
31 | a1; flex-grow: 1
32 | a2; flex-grow: 3
33 | a3; flex-grow: 1
34 |
35 |
36 |
37 |
38 | margin: auto
39 |
40 | a1; margin: 0 auto
41 | a2; margin: 0 auto
42 |
43 |
44 | a1; margin: 0 auto
45 | a2; margin: 0
46 |
47 |
48 | a1; margin: 0
49 | a2; margin: 0 auto
50 |
51 |
52 | a1; margin: 0 auto
53 | a2; margin: 0 auto
54 | a3; margin: 0 auto
55 |
56 |
57 |
58 |
59 | align-items: flex-end; justify-content: flex-end
60 |
61 | a1
62 | a2
63 |
64 |
65 |
66 |
67 | order: 1
68 |
69 | a1; order: 1
70 | a2; order: 0
71 |
72 |
73 |
--------------------------------------------------------------------------------
/test/shared/flex-direction-row.html:
--------------------------------------------------------------------------------
1 |
2 | justify-content: space-around
3 |
4 | a1
5 | a3
6 | a3
7 |
8 |
9 | a1; width: 250px
10 | a2; width: 250px
11 | a3; width: 250px
12 |
13 |
14 | a1; flex-basis: 250px
15 | a2; flex-basis: 250px
16 | a3; flex-basis: 250px
17 |
18 |
19 | a1; width: 250px
20 | a2; width: 250px
21 | a3; width: 250px
22 |
23 |
24 | a1; width: 250px
25 | a2; width: 250px
26 | a3; width: 250px
27 |
28 |
29 | width: 250px
30 | width: 250px
31 | width: 250px
32 |
33 |
34 | width: 250px; height: 30px
35 | width: 250px
36 | width: 250px
37 |
38 |
39 |
40 |
41 | flex-grow: 1
42 |
43 | item
44 | flex-grow: 1
45 |
46 |
47 | flex-grow: 1
48 | flex-grow: 1
49 |
50 |
51 | flex-grow: 1
52 | flex-grow: 3
53 | flex-grow: 1
54 |
55 |
56 |
57 |
58 | margin: auto
59 |
60 | margin: 0 auto
61 | margin: 0 auto
62 |
63 |
64 | margin: 0 auto
65 | margin: 0
66 |
67 |
68 | margin: 0
69 | margin: 0 auto
70 |
71 |
72 | margin: auto
73 | margin: auto
74 | margin: auto
75 | margin: auto
76 | margin: auto
77 |
78 |
79 |
80 |
81 | align-items: flex-end; justify-content: flex-end
82 |
83 | item
84 | item
85 |
86 |
87 |
88 |
89 | order: 1
90 |
91 | order: 1
92 | order: 0
93 |
94 |
95 |
--------------------------------------------------------------------------------
/test/shared/flex-within-flex.html:
--------------------------------------------------------------------------------
1 |
2 | display: flex;
3 |
4 |
5 | a1
6 |
7 |
8 | b1
9 | b2
10 |
11 |
12 | c1
13 | c2
14 | c3
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/test/shared/negative-margin.html:
--------------------------------------------------------------------------------
1 |
2 | justify-content: space-around
3 |
16 |
17 |
--------------------------------------------------------------------------------
/test/shared/script.js:
--------------------------------------------------------------------------------
1 | document.createElement('section');
2 |
3 | function test(name) {
4 | var xhr = new XMLHttpRequest();
5 |
6 | xhr.open('GET', 'shared/' + name + '.html?' + new Date().getTime());
7 |
8 | xhr.onreadystatechange = function () {
9 | if (xhr.readyState === 4) {
10 | var frag = document.createDocumentFragment();
11 | var html = frag.appendChild(document.createElement('x'));
12 |
13 | if (frag.createElement) {
14 | frag.createElement('section');
15 | }
16 |
17 | html.innerHTML = xhr.responseText;
18 |
19 | while (html.childNodes.length) {
20 | frag.appendChild(html.firstChild);
21 | }
22 |
23 | frag.removeChild(html);
24 |
25 | document.body.appendChild(frag);
26 |
27 | flexibility(document.body);
28 | }
29 | }
30 |
31 | xhr.send();
32 | }
33 |
34 | function control(name) {
35 | var xhr = new XMLHttpRequest();
36 |
37 | xhr.open('GET', 'shared/' + name + '.html?' + new Date().getTime());
38 |
39 | xhr.onreadystatechange = function () {
40 | if (xhr.readyState === 4) {
41 | var frag = document.createDocumentFragment();
42 | var html = frag.appendChild(document.createElement('x'));
43 |
44 | if (frag.createElement) {
45 | frag.createElement('section');
46 | }
47 |
48 | html.innerHTML = xhr.responseText.replace(/data-style/g, 'data-style style');
49 |
50 | while (html.childNodes.length) {
51 | frag.appendChild(html.firstChild);
52 | }
53 |
54 | frag.removeChild(html);
55 |
56 | document.body.appendChild(frag);
57 | }
58 | }
59 |
60 | xhr.send();
61 | }
62 |
63 | function editableTest(name) {
64 | var xhr = new XMLHttpRequest();
65 |
66 | xhr.open('GET', 'shared/' + name + '.html?' + new Date().getTime());
67 |
68 | xhr.onreadystatechange = function () {
69 | if (xhr.readyState === 4) {
70 | var frag = document.createDocumentFragment();
71 | var html = frag.appendChild(document.createElement('x'));
72 |
73 | if (frag.createElement) {
74 | frag.createElement('section');
75 | }
76 |
77 | html.innerHTML = xhr.responseText;
78 |
79 | while (html.childNodes.length) {
80 | frag.appendChild(html.firstChild);
81 | }
82 |
83 | frag.removeChild(html);
84 |
85 | document.body.appendChild(frag);
86 |
87 | var container = document.getElementById('container');
88 |
89 | var textarea = document.createElement('textarea');
90 |
91 | textarea.setAttribute('style', 'font-family:monospace,monospace;font-size:100%');
92 | textarea.setAttribute('cols', 40);
93 | textarea.setAttribute('rows', 8);
94 | textarea.value = container.getAttribute('data-style').replace(/;\s*/g, ';\n');
95 |
96 | document.body.appendChild(textarea);
97 |
98 | var onresizeTimeout;
99 |
100 | function onresize() {
101 | window.onresize = null;
102 | textarea.onkeyup = null;
103 |
104 | if (!onresizeTimeout) {
105 | onresizeTimeout = setTimeout(function () {
106 | onresizeTimeout = null;
107 |
108 | var index = -1;
109 | var elements = container.querySelectorAll('[style]');
110 | var element;
111 |
112 | while (element = elements[++index]) {
113 | element.removeAttribute('style');
114 | }
115 |
116 | var style = textarea.value.replace(/\s+/, ' ');
117 |
118 | container.setAttribute('style', style);
119 | container.setAttribute('data-style', style);
120 |
121 | try {
122 | flexibility(container);
123 | } catch (error) {}
124 |
125 | window.onresize = onresize;
126 | textarea.onkeyup = onresize;
127 | }, 67);
128 | }
129 | }
130 |
131 | onresize();
132 | }
133 | }
134 |
135 | xhr.send();
136 | }
137 |
--------------------------------------------------------------------------------
/test/shared/style.css:
--------------------------------------------------------------------------------
1 | * { margin: 0; }
2 |
3 | html { font: 100%/1 sans-serif; }
4 | body { margin: 20px; }
5 | section { display: block; margin-top: 20px; }
6 | h1, h3 { margin: 40px 0 20px; }
7 | h3 { font-size: 100%; }
8 |
9 | .wrap { background-color: #73a75c; border: 1px solid #3a542f; margin-top: 20px; padding: 10px; }
10 | .item { background-color: #8fb97c; border: 1px solid #c7ddbd; padding: 10px; }
11 |
12 | /* section > div[data-style] { background-color: #f9f9f9; border: 1px solid #eeeeee; margin-top: 10px; padding: 10px; }
13 | div[data-style] span { background-color: #f4f3f0; border: 1px solid #cccccc; padding: 10px; }
14 | div[data-style] span { background-color: #8fb97c; border: 1px solid #c7ddbd; color: #000000; display: inline-block; font-size: 14px; line-height: 15px; padding: 10px; text-align: center; } */
15 |
16 |
--------------------------------------------------------------------------------
/test/shared/svg.html:
--------------------------------------------------------------------------------
1 |
2 | 3 SVGs
3 |
4 |
10 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/test/svg.control.html:
--------------------------------------------------------------------------------
1 |
2 | control - SVG
3 |
4 |
5 |
6 |
7 | control - SVG
8 |
9 |
--------------------------------------------------------------------------------
/test/svg.html:
--------------------------------------------------------------------------------
1 |
2 | test - SVG
3 |
4 |
5 |
6 |
7 | test - SVG
8 |
9 |
--------------------------------------------------------------------------------