source: imaps-frontend/node_modules/nano-css/addon/atoms.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.7 KB
RevLine 
[d565449]1'use strict';
2
3var pos = 'position',
4 t = 'top',
5 r = 'right',
6 b = 'bottom',
7 l = 'left',
8 w = 'width',
9 h = 'height',
10 ov = 'overflow',
11 col = 'color',
12 con = 'content',
13 ovx = ov + '-x',
14 ovy = ov + '-y',
15 fl = 'flex',
16 fld = fl + '-direction',
17 flg = fl + '-grow',
18 fls = fl + '-shrink',
19 flb = fl + '-basis',
20 flw = fl + '-wrap',
21 align = 'align',
22 ai = align + '-items',
23 ac = align + '-' + con,
24 as = align + '-self',
25 mr = 'margin',
26 mrt = mr + '-' + t,
27 mrr = mr + '-' + r,
28 mrb = mr + '-' + b,
29 mrl = mr + '-' + l,
30 pd = 'padding',
31 pdt = pd + '-' + t,
32 pdr = pd + '-' + r,
33 pdb = pd + '-' + b,
34 pdl = pd + '-' + l,
35 bd = 'border',
36 bdt = bd + '-' + t,
37 bdr = bd + '-' + r,
38 bdb = bd + '-' + b,
39 bdl = bd + '-' + l,
40 bdrad = bd + '-radius',
41 bg = 'background',
42 bgc = bg + '-' + col,
43 bgi = bg + '-image',
44 bgr = bg + '-repeat',
45 bga = bg + '-attachment',
46 bgp = bg + '-position',
47 bgs = bg + '-size',
48 bgo = bg + '-origin',
49 bgcl = bg + '-clip',
50 style = 'style',
51 f = 'font',
52 fz = f + '-size',
53 fs = f + '-' + style,
54 fw = f + '-weight',
55 ff = f + '-family',
56 text = 'text',
57 ta = text + '-align',
58 td = text + '-decoration',
59 tt = text + '-transform',
60 ts = text + '-shadow',
61 tov = text + '-overflow',
62 st = 'stroke',
63 stw = st + '-width',
64 stl = st + '-linecap',
65 an = 'animation',
66 ann = an + '-name'
67 ;
68
69var atoms = exports.atoms = {
70 // Positioning
71 pos,
72 t,
73 r,
74 b,
75 l,
76 z: 'z-index',
77
78 // Layout (box model)
79 d: 'display',
80 vis: 'visibility',
81 w,
82 h,
83 minW: 'min-' + w,
84 maxW: 'max-' + w,
85 minH: 'min-' + h,
86 maxH: 'max-' + h,
87 ov,
88 ovx,
89 ovy,
90 bxz: 'box-sizing',
91 cl: 'clip',
92 clp: 'clip-path',
93 clr: 'clear',
94 tbl: 'table-layout',
95
96 // Flexbox
97 fl,
98 fld,
99 flg,
100 fls,
101 flb,
102 flw,
103 jc: 'justify-' + con,
104 ai,
105 ac,
106 as,
107
108 // Margins
109 mr,
110 mrt,
111 mrr,
112 mrb,
113 mrl,
114 mar: mr,
115 mart: mrt,
116 marr: mrr,
117 marb: mrb,
118 marl: mrl,
119
120 // Paddings
121 pd,
122 pdt,
123 pdr,
124 pdb,
125 pdl,
126 pad: pd,
127 padt: pdt,
128 padr: pdr,
129 padb: pdb,
130 padl: pdl,
131
132 // Borders
133 bd,
134 bdt,
135 bdr,
136 bdb,
137 bdl,
138 bdrad,
139 bdc: bd + '-' + col,
140 bds: bd + '-' + style,
141 out: 'outline',
142 bxsh: 'box-shadow',
143
144 // Colors
145 col,
146 op: 'opacity',
147 bg,
148 bgc,
149 bgi,
150 bgr,
151 bga,
152 bgp,
153 bgs,
154 bgo,
155 bgcl,
156 bdfl: 'backdrop-filter',
157 bfvis: 'backface-visibility',
158
159 // Text
160 f,
161 fz,
162 fs,
163 fw,
164 ff,
165 ta,
166 td,
167 tt,
168 ts,
169 tov,
170 ww: 'word-wrap',
171 lts: 'letter-spacing',
172 ws: 'white-space',
173 lh: 'line-' + h,
174 va: 'vertical-' + align,
175
176 // Pointer
177 cur: 'cursor',
178 pe: 'pointer-events',
179 us: 'user-select',
180
181 // Animations
182 an,
183 ann,
184 and: an + '-duration',
185 anf: an + '-fill-mode',
186 anit: an + '-iteration-count',
187 anp: an + '-play-state',
188 ant: an + '-timing-function',
189 trs: 'transition',
190 tr: 'transform',
191
192 // SVG
193 st,
194 stw,
195 stl,
196
197 // Other
198 ls: 'list-' + style,
199 con,
200};
201
202exports.addon = function (renderer) {
203 var originalDecl = renderer.decl;
204 renderer.decl = function (key, value) {
205 return originalDecl(atoms[key] || key, value);
206 };
207};
Note: See TracBrowser for help on using the repository browser.