fwtoolkit 0.1.0-alpha.3 → 0.1.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,35 @@
1
1
  # fwtoolkit
2
2
 
3
- Fidus Writer Toolkit — small, reusable utilities originally written for
4
- Fidus Writer but usable in any browser or Node-based project.
3
+ Fidus Writer Toolkit — small, reusable utilities, UI helpers and styles
4
+ originally written for Fidus Writer but usable in any browser project.
5
5
 
6
- ## Usage
6
+ ## JavaScript usage
7
7
 
8
8
  ```javascript
9
9
  import {escapeText, addAlert} from "fwtoolkit"
10
10
  import {convertDataURIToBlob} from "fwtoolkit/blob.js"
11
11
  ```
12
12
 
13
+ ## CSS usage
14
+
15
+ The package ships the styles for its UI components under `fwtoolkit/css/`.
16
+ Load at least `colors.css` and the component styles you need:
17
+
18
+ ```html
19
+ <link rel="stylesheet" href="node_modules/fwtoolkit/css/colors.css">
20
+ <link rel="stylesheet" href="node_modules/fwtoolkit/css/dialog.css">
21
+ <link rel="stylesheet" href="node_modules/fwtoolkit/css/buttons.css">
22
+ ```
23
+
24
+ In Fidus Writer the CSS is copied automatically to the static files directory
25
+ by the `copy_fwtoolkit_css` postinstall step.
26
+
13
27
  ## Contents
14
28
 
15
- - `text.js` — text escaping helpers (`escapeText`, `unescapeText`, `noSpaceTmp`)
16
- - `blob.js` — `convertDataURIToBlob`
17
- - `file.js` — file title/path helpers
18
- - `network.js` — small fetch-based HTTP helpers (`get`, `post`, `postJson`)
19
- - `index.js` aggregated exports plus generic UI stubs (`addAlert`, `deactivateWait`)
29
+ - `src/text.js` — text escaping helpers (`escapeText`, `unescapeText`, `noSpaceTmp`)
30
+ - `src/blob.js` — `convertDataURIToBlob`
31
+ - `src/file/` — file title/path helpers and file dialogs
32
+ - `src/network.js` — fetch-based HTTP helpers and `ensureCSS`
33
+ - `src/dialog.js`, `src/content_menu.js`, `src/overview_menu.js`, ... UI components
34
+ - `src/index.js` — aggregated exports
35
+ - `css/` — component styles and a minimal `colors.css`
@@ -0,0 +1,18 @@
1
+ .fw-ar-container {
2
+ display: inline-block;
3
+ width: 338px;
4
+ height: 360px;
5
+ background-color: var(--cs-white-background);
6
+ border: solid 1px var(--cs-white-border);
7
+ vertical-align: middle;
8
+ padding: 20px 14px 0;
9
+ overflow-y: auto;
10
+ margin-bottom: 16px;
11
+ }
12
+
13
+ .fw-ar-button {
14
+ display: inline-block;
15
+ margin: 0 16px;
16
+ vertical-align: middle;
17
+ cursor: pointer;
18
+ }
package/css/alerts.css ADDED
@@ -0,0 +1,69 @@
1
+ #alerts-outer-wrapper {
2
+ position: fixed;
3
+ right: 22px;
4
+ bottom: 10px;
5
+ direction: rtl;
6
+ column-width: 328px;
7
+ z-index: calc(var(--highest-dialog-z-index, 100) + 2);
8
+ }
9
+
10
+ #alerts-wrapper {
11
+ z-index: 1600;
12
+ direction: ltr;
13
+ }
14
+
15
+ #alerts-wrapper li {
16
+ display: block; /* else several of them will stack horizontally. */
17
+ position: relative;
18
+ width: 247px;
19
+ height: auto;
20
+ padding: 20px 20px 20px 60px;
21
+ border: none;
22
+ border-radius: 3px;
23
+ box-shadow: 0 0 5px rgb(var(--alert-box-shadow-color));
24
+ margin-bottom: 5px;
25
+ font-size: 15px;
26
+ line-height: 20px;
27
+ opacity: 0;
28
+ transition: opacity 0.3s;
29
+ -webkit-column-break-inside: avoid;
30
+ }
31
+
32
+ #alerts-wrapper li.visible {
33
+ opacity: 1;
34
+ }
35
+
36
+ #alerts-wrapper li::before {
37
+ position: absolute;
38
+ left: 20px;
39
+ top: 20px;
40
+ font-size: 20px;
41
+ }
42
+
43
+ #alerts-wrapper .alerts-error {
44
+ color: var(--error-text-color);
45
+ background-color: var(--error-background-color);
46
+ }
47
+
48
+ #alerts-wrapper .alerts-warning {
49
+ color: var(--warning-text-color);
50
+ background-color: rgb(var(--warning-background-color));
51
+ }
52
+
53
+ #alerts-wrapper .alerts-info {
54
+ color: var(--info-text-color);
55
+ background-color: rgb(var(--info-background-color));
56
+ }
57
+
58
+ #alerts-wrapper .alerts-success {
59
+ color: var(--success-text-color);
60
+ background-color: rgb(var(--success-background-color));
61
+ }
62
+
63
+ /* A form wasn't filled out correctly and the warning was added to the form. */
64
+ div.warning {
65
+ margin: 0 0 5px;
66
+ border: 1px solid rgb(var(--warning-border-color));
67
+ background-color: rgb(var(--warning-background-color));
68
+ padding: 6px;
69
+ }
@@ -0,0 +1,373 @@
1
+ .fw-button {
2
+ display: inline-block;
3
+ width: auto;
4
+ height: 34px;
5
+ line-height: 34px;
6
+ padding: 0 12px;
7
+ font-size: 14px;
8
+ border-style: solid;
9
+ border-width: 1px;
10
+ border-radius: 3px;
11
+ cursor: pointer;
12
+ text-decoration: none;
13
+ background: none;
14
+ box-shadow: none;
15
+ box-sizing: content-box;
16
+ position: relative;
17
+ }
18
+
19
+ .fw-button label {
20
+ cursor: pointer;
21
+ }
22
+
23
+ .fw-button:focus,
24
+ .fw-button:active {
25
+ outline: 5px solid var(--cs-6-background-focus);
26
+ }
27
+
28
+ .fw-button.fw-uppercase {
29
+ text-transform: uppercase;
30
+ }
31
+
32
+ .fw-button.fw-large {
33
+ height: 40px;
34
+ line-height: 40px;
35
+ padding: 0 10px;
36
+ }
37
+
38
+ .fw-button.fw-small {
39
+ height: 26px;
40
+ line-height: 26px;
41
+ padding: 0 6px;
42
+ }
43
+
44
+ .fw-button.fw-square {
45
+ width: 34px;
46
+ padding: 0;
47
+ text-align: center;
48
+ }
49
+
50
+ .fw-button.fw-large.fw-square {
51
+ width: 40px;
52
+ }
53
+
54
+ .fw-button .fw-button-icon::before {
55
+ line-height: 34px;
56
+ margin: 0;
57
+ }
58
+
59
+ .fw-button.fw-large .fw-button-icon::before {
60
+ line-height: 40px;
61
+ }
62
+
63
+ .fw-button.fw-small .fw-button-icon::before {
64
+ line-height: 26px;
65
+ }
66
+
67
+ .fw-button.fw-large.fw-dropdown {
68
+ padding-right: 22px;
69
+ }
70
+
71
+ .fw-button.fw-large.fw-dropdown .fa-caret-down {
72
+ display: block;
73
+ position: absolute;
74
+ right: 10px;
75
+ top: 12px;
76
+ }
77
+
78
+ .fw-button.fw-light {
79
+ border-color: var(--cs-light-border);
80
+ background-color: var(--cs-light-background);
81
+ color: var(--cs-light-text);
82
+ }
83
+
84
+ .fw-button.fw-white {
85
+ border: 0 none;
86
+ background-color: var(--cs-white-background);
87
+ color: var(--cs-white-text);
88
+ }
89
+
90
+ .fw-button.fw-white.ui-state-active {
91
+ background-color: var(--cs-white-background-selected);
92
+ color: var(--cs-white-selected);
93
+ }
94
+
95
+ .fw-button.fw-white:not(.disabled):hover {
96
+ background-color: var(--cs-white-background-hover);
97
+ color: var(--cs-white-hover);
98
+ }
99
+
100
+ .fw-button.fw-light:not(.disabled):hover,
101
+ .fw-button.fw-light.ui-state-active {
102
+ background-color: var(--cs-light-background-hover);
103
+ color: var(--cs-light-hover);
104
+ }
105
+
106
+ .fw-button.fw-green {
107
+ color: var(--cs-6-text);
108
+ border-color: var(--cs-6-border);
109
+ background-color: var(--cs-6-background);
110
+ }
111
+
112
+ .fw-button.fw-green:not(.disabled):hover {
113
+ background-color: var(--cs-6-background-hover);
114
+ }
115
+
116
+ .fw-button.fw-orange {
117
+ color: var(--cs-3-text);
118
+ background: linear-gradient(
119
+ to bottom left,
120
+ var(--cs-3-background-from),
121
+ var(--cs-3-background-to)
122
+ );
123
+ border-color: var(--cs-3-border);
124
+ }
125
+
126
+ .fw-button.fw-orange:not(.disabled):hover {
127
+ background: var(--cs-3-background-hover);
128
+ }
129
+
130
+ .fw-button.fw-dark {
131
+ color: var(--cs-dark-text);
132
+ background: linear-gradient(
133
+ to bottom left,
134
+ var(--cs-dark-background-from),
135
+ var(--cs-dark-background-to)
136
+ );
137
+ box-shadow: 0 1px 1px 0 var(--cs-dark-box-shadow) inset;
138
+ border-color: var(--cs-dark-border);
139
+ }
140
+
141
+ .fw-button.fw-dark:not(.disabled):hover {
142
+ background: var(--cs-dark-background-hover);
143
+ }
144
+
145
+ .fw-button:disabled {
146
+ background: var(--cs-disabled-background);
147
+ color: var(--cs-disabled);
148
+ border-color: var(--cs-disabled-border);
149
+ }
150
+
151
+ .fw-button.fw-left {
152
+ float: left;
153
+ }
154
+
155
+ .fw-button.fw-strong {
156
+ font-weight: bold;
157
+ }
158
+
159
+ .fw-button.fw-em {
160
+ font-style: italic;
161
+ }
162
+
163
+ .fw-button.fw-smallcaps {
164
+ font-variant: small-caps;
165
+ }
166
+
167
+ .fw-button.fw-socialaccount {
168
+ display: inline-block;
169
+ width: auto;
170
+ height: 38px;
171
+ border-radius: 5px;
172
+ font-size: 15px;
173
+ vertical-align: top;
174
+ line-height: 35px;
175
+ padding: 0;
176
+ background: linear-gradient(
177
+ to bottom left,
178
+ var(--cs-2-background-from),
179
+ var(--cs-2-background-to)
180
+ );
181
+ box-shadow: 0 0 1px 1px var(--cs-2-box-shadow) inset;
182
+ border-color: var(--cs-2-border);
183
+ color: var(--cs-2-text);
184
+ }
185
+
186
+ .fw-button.fw-socialaccount:hover {
187
+ box-shadow: none;
188
+ background: var(--cs-2-background-hover);
189
+ }
190
+
191
+ .fw-button.fw-socialaccount > span {
192
+ display: inline-block;
193
+ width: 37px;
194
+ height: 100%;
195
+ text-align: center;
196
+ font-size: 15px;
197
+ margin-right: 12px;
198
+ line-height: 37px;
199
+ border-right: 1px solid var(--cs-2-border);
200
+ box-shadow: 1px 0 0 0 var(--cs-2-box-shadow);
201
+ }
202
+
203
+ .fw-plain-button {
204
+ display: block;
205
+ font-size: 11px;
206
+ line-height: 24px;
207
+ background-color: var(--cs-light-background);
208
+ font-weight: 700;
209
+ text-align: center;
210
+ }
211
+
212
+ .fw-plain-button:hover {
213
+ background-color: var(--cs-light-background-hover);
214
+ }
215
+
216
+ .fw-button.disabled {
217
+ color: var(--cs-disabled);
218
+ cursor: default;
219
+ }
220
+
221
+ /* The remainder of this file uses application specific colors */
222
+
223
+ .fw-button.fw-facebook {
224
+ background: linear-gradient(to bottom left, #0d78be, #0d63ab);
225
+ box-shadow: 0 0 1px 1px #3c9fdf inset;
226
+ border-color: #0557a1;
227
+ }
228
+
229
+ .fw-button.fw-facebook:hover {
230
+ background: #0d63ab;
231
+ }
232
+
233
+ .fw-button.fw-facebook > span {
234
+ border-right-color: #0557a1;
235
+ box-shadow: 1px 0 0 0 #3c9fdf;
236
+ font-size: 18px;
237
+ }
238
+
239
+ .fw-button.fw-twitter {
240
+ background: linear-gradient(to bottom left, #3ccfff, #17addf);
241
+ box-shadow: 0 0 1px 1px #3dcfff inset;
242
+ border-color: #2498be;
243
+ }
244
+
245
+ .fw-button.fw-twitter:hover {
246
+ background: #17addf;
247
+ }
248
+
249
+ .fw-button.fw-twitter > span {
250
+ border-right-color: #2498be;
251
+ box-shadow: 1px 0 0 0 #8ddffc;
252
+ }
253
+
254
+ .fw-button.fw-google {
255
+ background: linear-gradient(to bottom left, #879ded, #6d84d8);
256
+ box-shadow: 0 0 1px 1px #93a6e6 inset;
257
+ border-color: #6578bb;
258
+ }
259
+
260
+ .fw-button.fw-google:hover {
261
+ background: #6d84d8;
262
+ }
263
+
264
+ .fw-button.fw-google > span {
265
+ border-right-color: #6578bb;
266
+ box-shadow: 1px 0 0 0 #b1c0f2;
267
+ font-size: 18px;
268
+ }
269
+
270
+ .fw-button.fw-soundcloud {
271
+ background: linear-gradient(to bottom left, #f76700, #fa3219);
272
+ box-shadow: 0 0 1px 1px #f79955 inset;
273
+ border-color: #c53421;
274
+ }
275
+
276
+ .fw-button.fw-soundcloud:hover {
277
+ background: #fa1b19;
278
+ }
279
+
280
+ .fw-button.fw-soundcloud > span {
281
+ border-right-color: #c53421;
282
+ box-shadow: 1px 0 0 0 #f79955;
283
+ font-size: 18px;
284
+ }
285
+
286
+ .fw-button.fw-openid {
287
+ background: linear-gradient(to bottom left, #fae719, #fac219);
288
+ box-shadow: 0 0 1px 1px #fad819 inset;
289
+ border-color: #faad19;
290
+ }
291
+
292
+ .fw-button.fw-openid:hover {
293
+ background: #e8c817;
294
+ }
295
+
296
+ .fw-button.fw-openid > span {
297
+ border-right-color: #faad19;
298
+ box-shadow: 1px 0 0 0 #fad819;
299
+ font-size: 18px;
300
+ }
301
+
302
+ .fw-button.fw-persona {
303
+ background: linear-gradient(to bottom left, #17e861, #1bbd54);
304
+ box-shadow: 0 0 1px 1px #29e76c inset;
305
+ border-color: #168e40;
306
+ }
307
+
308
+ .fw-button.fw-persona:hover {
309
+ background: #17a74a;
310
+ }
311
+
312
+ .fw-button.fw-persona > span {
313
+ border-right-color: #168e40;
314
+ box-shadow: 1px 0 0 0 #29e76c;
315
+ font-size: 18px;
316
+ }
317
+
318
+ .fw-button.fw-linkedin {
319
+ background: linear-gradient(to bottom left, #c529e7, #ad22cb);
320
+ box-shadow: 0 0 1px 1px #d648f4 inset;
321
+ border-color: #841c9a;
322
+ }
323
+
324
+ .fw-button.fw-linkedin:hover {
325
+ background: #9720b0;
326
+ }
327
+
328
+ .fw-button.fw-linkedin > span {
329
+ border-right-color: #841c9a;
330
+ box-shadow: 1px 0 0 0 #d648f4;
331
+ font-size: 18px;
332
+ }
333
+
334
+ .fw-button.fw-github {
335
+ background: linear-gradient(to bottom left, #f95858, #f92958);
336
+ box-shadow: 0 0 1px 1px #f87795 inset;
337
+ border-color: #d20e3c;
338
+ }
339
+
340
+ .fw-button.fw-github:hover {
341
+ background: #e32653;
342
+ }
343
+
344
+ .fw-button.fw-github > span {
345
+ border-right-color: #d20e3c;
346
+ box-shadow: 1px 0 0 0 #f87795;
347
+ font-size: 18px;
348
+ }
349
+
350
+ .fw-button.fw-stackexchange {
351
+ background: linear-gradient(to bottom left, #fcff23, #eaed0d);
352
+ box-shadow: 0 0 1px 1px #fdff91 inset;
353
+ border-color: #ced03f;
354
+ color: #585854;
355
+ }
356
+
357
+ .fw-button.fw-stackexchange:hover {
358
+ background: #fcff00;
359
+ }
360
+
361
+ .fw-button.fw-stackexchange > span {
362
+ border-right-color: #ced03f;
363
+ box-shadow: 1px 0 0 0 #fdff91;
364
+ font-size: 18px;
365
+ }
366
+
367
+ .fw-add-button::after {
368
+ margin-left: 10px;
369
+ }
370
+
371
+ #comment-filter-dropdown {
372
+ width: 100px;
373
+ }
package/css/colors.css ADDED
@@ -0,0 +1,118 @@
1
+ :root {
2
+
3
+ --main-text-color: #2c2723;
4
+ --main-background-color: #f2f2f2;
5
+ --overlay-color: 170, 170, 170, 0.3;
6
+ --input-focus-background-color: #fbf9d2;
7
+ --input-background-color: #f3f3f3;
8
+ --input-dialog-border-color: #e0e0e0;
9
+ --wait-active-background-color: 240, 240, 240, 0.7;
10
+ --wait-active-full-background-color: 240, 240, 240, 1;
11
+ --alert-box-shadow-color: 240, 240, 240, 1;
12
+ --dropup-box-shadow-color: 0, 0, 0, 0.11;
13
+ --tooltip-background-color: 38, 38, 38, 0.6;
14
+ --info-text-color: #ffffff;
15
+ --info-background-color: 36, 113, 176, 0.8;
16
+ --success-text-color: #ffffff;
17
+ --success-background-color: 109, 164, 147, 0.8;
18
+ --warning-text-color: #ffffff;
19
+ --warning-background-color: 221, 208, 63, 0.8;
20
+ --warning-border-color: 200, 63, 27, 0.8;
21
+ --error-border-color: #af3515;
22
+ --error-background-color: #cc3f1a;
23
+ --error-text-color: #ffffff;
24
+ --pulldown-header-text-color: #ffffff;
25
+ --pulldown-header-background-color: #2c2723;
26
+ --pulldown-separator-color: #f2f2f2;
27
+ --pulldown-box-shadow-color: 0, 0, 0, 0.2;
28
+ --menu-cursor-border-color: #63ab0d;
29
+
30
+ /* tabs */
31
+ --tabs-border-color: #e0e0e0;
32
+ --tabs-text-inactive: #888888;
33
+ --tabs-text-active: #333333;
34
+ --tabs-indicator-color: #42a061;
35
+
36
+ /* Color Schemes (CS) */
37
+
38
+ /* red text */
39
+ --cs-1-text: #b73717;
40
+ --cs-1-icon: #a7321f;
41
+ --cs-1-hover: #2c2723;
42
+
43
+ /* white on blue */
44
+ --cs-2-background-from: #0d78be;
45
+ --cs-2-background-to: #0d63ab;
46
+ --cs-2-background: #0d78be; /* flat */
47
+ --cs-2-border: #0557a1;
48
+ --cs-2-background-hover: #0d63ab;
49
+ --cs-2-box-shadow: #3c9fdf;
50
+ --cs-2-text: #ffffff;
51
+
52
+ /* white on orange */
53
+ --cs-3-text: #ffffff;
54
+ --cs-3-background-from: #d3421c;
55
+ --cs-3-background-to: #b13615;
56
+ --cs-3-background-hover: #b13615;
57
+ --cs-3-border: #7d331f;
58
+
59
+ /* light green text */
60
+
61
+ /* white on light green */
62
+ --cs-5-background: #4c6860;
63
+
64
+ /* white on dark green */
65
+ --cs-6-text: #ffffff;
66
+ --cs-6-background: #5a7e73;
67
+ --cs-6-border: #7d948e;
68
+ --cs-6-background-focus: #8ab5a6;
69
+ --cs-6-background-hover: #96c6b8;
70
+
71
+ /* white on dark */
72
+ --cs-dark-text: #ffffff;
73
+ --cs-dark-hover: #e0e0e0;
74
+ --cs-dark-border: #4f4d4f;
75
+ --cs-dark-background-hover: #585858;
76
+ --cs-dark-background: #585858; /* flat */
77
+ --cs-dark-background-from: #6a6a6a;
78
+ --cs-dark-background-to: #585858;
79
+ --cs-dark-box-shadow: #7f7f7f;
80
+
81
+ /* dark on white-ish background */
82
+ --cs-light-text: #2c2723;
83
+ --cs-light-hover: #000000;
84
+ --cs-light-text-secondary: #6e6e6e;
85
+ --cs-light-border: #e0e0e0;
86
+ --cs-light-background: #f9f9f9;
87
+ --cs-light-background-hover: #e0e0e0;
88
+ --cs-light-box-shadow: #9e9e9e;
89
+
90
+ /* black on white */
91
+ --cs-white-text: #000000;
92
+ --cs-white-hover: #000000;
93
+ --cs-white-focus: #000000;
94
+ --cs-white-selected: #000000;
95
+ --cs-white-border: #cccccc;
96
+ --cs-white-header-border: #888888;
97
+ --cs-white-text-secondary: #727272;
98
+ --cs-white-placeholder-text: #cecece;
99
+ --cs-white-background: #ffffff;
100
+ --cs-white-background-hover: #cccccc;
101
+ --cs-white-background-focus: #cccccc;
102
+ --cs-white-background-selected: #dddddd;
103
+
104
+ /* disabled */
105
+ --cs-disabled: #a9a9a9;
106
+ --cs-disabled-background: #d3d3d3;
107
+ --cs-disabled-border: #a9a9a9;
108
+ --overview-checkbox-color: #000000;
109
+ --overview-checkbox-background-color-from: 255, 255, 255, 1;
110
+ --overview-checkbox-background-color-to: 255, 255, 255, 0;
111
+ --overview-checkbox-border: #a9a9a9;
112
+
113
+ /* template manager */
114
+
115
+ /* editor */
116
+
117
+ /* feedback tab */
118
+ }