nodality 1.0.0-beta.1
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/dist/animator.cjs.js +1 -0
- package/dist/animator.esm.js +1 -0
- package/dist/audionew.cjs.js +1 -0
- package/dist/audionew.esm.js +1 -0
- package/dist/base.cjs.js +1 -0
- package/dist/base.esm.js +1 -0
- package/dist/betaDesktopBar.esm.js +1 -0
- package/dist/betaMobileBar.esm.js +1 -0
- package/dist/bundle.umd.js +1 -0
- package/dist/button.cjs.js +1 -0
- package/dist/button.esm.js +1 -0
- package/dist/cardGetter.cjs.js +1 -0
- package/dist/cardGetter.esm.js +1 -0
- package/dist/center.cjs.js +1 -0
- package/dist/center.esm.js +1 -0
- package/dist/checkbox.cjs.js +1 -0
- package/dist/checkbox.esm.js +1 -0
- package/dist/code.cjs.js +1 -0
- package/dist/code.esm.js +1 -0
- package/dist/container.cjs.js +1 -0
- package/dist/container.esm.js +1 -0
- package/dist/datalist.cjs.js +1 -0
- package/dist/datalist.esm.js +1 -0
- package/dist/designer.cjs.js +1 -0
- package/dist/designer.esm.js +1 -0
- package/dist/dropdown.cjs.js +1 -0
- package/dist/dropdown.esm.js +1 -0
- package/dist/elementMapper.cjs.js +1 -0
- package/dist/elementMapper.esm.js +1 -0
- package/dist/finalresult.esm.js +1 -0
- package/dist/flexCard.cjs.js +1 -0
- package/dist/flexCard.esm.js +1 -0
- package/dist/flexGrid.cjs.js +1 -0
- package/dist/flexGrid.esm.js +1 -0
- package/dist/flexRow.cjs.js +1 -0
- package/dist/flexRow.esm.js +1 -0
- package/dist/floatingInput.cjs.js +1 -0
- package/dist/floatingInput.esm.js +1 -0
- package/dist/free.cjs.js +1 -0
- package/dist/free.esm.js +1 -0
- package/dist/horizontalScroller.esm.js +1 -0
- package/dist/image.cjs.js +1 -0
- package/dist/image.esm.js +1 -0
- package/dist/imagePicker.cjs.js +1 -0
- package/dist/imagePicker.esm.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.esm.js +1 -0
- package/dist/link.cjs.js +1 -0
- package/dist/link.esm.js +1 -0
- package/dist/linkGetter.cjs.js +1 -0
- package/dist/linkGetter.esm.js +1 -0
- package/dist/metaAdder.cjs.js +1 -0
- package/dist/metaAdder.esm.js +1 -0
- package/dist/modal2025.cjs.js +1 -0
- package/dist/modal2025.esm.js +1 -0
- package/dist/multiswitchers.esm.js +1 -0
- package/dist/newNavBar.cjs.js +1 -0
- package/dist/newNavBar.esm.js +1 -0
- package/dist/picker.cjs.js +1 -0
- package/dist/picker.esm.js +1 -0
- package/dist/progress.cjs.js +1 -0
- package/dist/progress.esm.js +1 -0
- package/dist/radio.cjs.js +1 -0
- package/dist/radio.esm.js +1 -0
- package/dist/range.cjs.js +1 -0
- package/dist/range.esm.js +1 -0
- package/dist/sideBar.cjs.js +1 -0
- package/dist/sideBar.esm.js +1 -0
- package/dist/sideNavBar.cjs.js +1 -0
- package/dist/sideNavBar.esm.js +1 -0
- package/dist/simpleBar.cjs.js +1 -0
- package/dist/simpleBar.esm.js +1 -0
- package/dist/stack.cjs.js +1 -0
- package/dist/stack.esm.js +1 -0
- package/dist/table.cjs.js +1 -0
- package/dist/table.esm.js +1 -0
- package/dist/text.cjs.js +1 -0
- package/dist/text.esm.js +1 -0
- package/dist/textField.cjs.js +1 -0
- package/dist/textField.esm.js +1 -0
- package/dist/wrap.cjs.js +1 -0
- package/dist/wrap.esm.js +1 -0
- package/dist/zoomCard.cjs.js +1 -0
- package/dist/zoomCard.esm.js +1 -0
- package/layout/<head> +59 -0
- package/layout/DEADJOE +49 -0
- package/layout/DEPRECATED-PARAGRAPH.js +103 -0
- package/layout/animator.js +1915 -0
- package/layout/audio.js +145 -0
- package/layout/audionew.js +70 -0
- package/layout/base-2.js +92 -0
- package/layout/base.js +161 -0
- package/layout/betaDesktopBar.js +126 -0
- package/layout/betaMobileBar.js +293 -0
- package/layout/box.js +29 -0
- package/layout/button.js +516 -0
- package/layout/cards.js +136 -0
- package/layout/center.js +143 -0
- package/layout/checkbox.js +183 -0
- package/layout/cleanRow.js +775 -0
- package/layout/code.js +60 -0
- package/layout/container.js +1005 -0
- package/layout/custom.js +289 -0
- package/layout/divImage.js +209 -0
- package/layout/dropdown.js +154 -0
- package/layout/dropdown2025.js +152 -0
- package/layout/edit.sh +39 -0
- package/layout/emptyElement.js +21 -0
- package/layout/externalStylesheet.js +19 -0
- package/layout/flexCard.js +220 -0
- package/layout/flexGrid.js +192 -0
- package/layout/flexrow.js +866 -0
- package/layout/footer.js +83 -0
- package/layout/formComponents/custom.js +0 -0
- package/layout/formComponents/dataList.js +183 -0
- package/layout/formComponents/edit.sh +39 -0
- package/layout/formComponents/floatingInput.js +163 -0
- package/layout/formComponents/form-all.js +161 -0
- package/layout/formComponents/form.js +76 -0
- package/layout/formComponents/imagePicker.js +266 -0
- package/layout/formComponents/picker.js +208 -0
- package/layout/formComponents/radio.js +231 -0
- package/layout/formComponents/radiogroup.js +231 -0
- package/layout/formComponents/range.js +158 -0
- package/layout/free.js +232 -0
- package/layout/grid-new.js +299 -0
- package/layout/grid.js +190 -0
- package/layout/gridSwitcher.js +188 -0
- package/layout/group.js +163 -0
- package/layout/header.js +175 -0
- package/layout/hello.html +126 -0
- package/layout/horizontalScroller.js +222 -0
- package/layout/image-old.js +487 -0
- package/layout/image.js +1039 -0
- package/layout/index.js +183 -0
- package/layout/label.js +50 -0
- package/layout/link.js +1085 -0
- package/layout/list-OLD.js +0 -0
- package/layout/list.js +127 -0
- package/layout/metaAdder.js +17 -0
- package/layout/modal2025.js +142 -0
- package/layout/modernwrap.js +92 -0
- package/layout/multiswitcher.js +224 -0
- package/layout/multiswitcherBeta.js +63 -0
- package/layout/navBar-OLD.js +261 -0
- package/layout/navBar.js +371 -0
- package/layout/navFactor/customDiv.js +60 -0
- package/layout/navFactor/edit.sh +39 -0
- package/layout/newFlatAdder.js +41 -0
- package/layout/newNavBar copy 2.js +915 -0
- package/layout/newNavBar copy.js +774 -0
- package/layout/newNavBar.js +925 -0
- package/layout/offsetContainer.js +395 -0
- package/layout/progress.js +111 -0
- package/layout/remWin.sh +20 -0
- package/layout/row.js +208 -0
- package/layout/savedNewNavBar.js +437 -0
- package/layout/scrollvideo.js +120 -0
- package/layout/sideBar.js +183 -0
- package/layout/sideNavBar.js +313 -0
- package/layout/simpleBar.js +25 -0
- package/layout/slider2025.js +198 -0
- package/layout/spacer.js +44 -0
- package/layout/stack.js +76 -0
- package/layout/styler.js +113 -0
- package/layout/switcher.js +102 -0
- package/layout/table.js +155 -0
- package/layout/text.js +1685 -0
- package/layout/textField.js +282 -0
- package/layout/ulist.js +147 -0
- package/layout/video.js +70 -0
- package/layout/withoutNew.js +60 -0
- package/layout/wrap.js +140 -0
- package/layout/zoomCard.js +219 -0
- package/lib/cardGetter.js +80 -0
- package/lib/designer.js +875 -0
- package/lib/elementMapper.js +1428 -0
- package/lib/linkGetter.js +202 -0
- package/package.json +33 -0
package/layout/text.js
ADDED
|
@@ -0,0 +1,1685 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
// 13:28 07/04/2020 - BEGIN NOTHING GONNA STOP US NOW Lets go!
|
|
4
|
+
|
|
5
|
+
// 22:29:11
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Text extends Animator {
|
|
9
|
+
constructor(text, obj) {
|
|
10
|
+
super();
|
|
11
|
+
this.text = text;
|
|
12
|
+
this.res = null;
|
|
13
|
+
this.setup(obj);
|
|
14
|
+
this.code = [];
|
|
15
|
+
this.elCSS = [];
|
|
16
|
+
this.html = [];
|
|
17
|
+
this.react = [];
|
|
18
|
+
this.code.push(`new Text("${this.text}")`);
|
|
19
|
+
// this.setRandom();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
flexOne(){
|
|
25
|
+
this.res.style.flex = "1";
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// Just for visual
|
|
34
|
+
setGridWithoutCode(){
|
|
35
|
+
this.res.style.border = "1px solid white";
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
setArea(area){
|
|
43
|
+
this.res.style.gridArea = area;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
toCodea(){ // 163953
|
|
52
|
+
if (this.excludeFromCodeTrue){
|
|
53
|
+
// this.code = ["new Text('').set({})"];
|
|
54
|
+
this.code = [""];
|
|
55
|
+
}
|
|
56
|
+
return this.code;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
toCode(){
|
|
60
|
+
|
|
61
|
+
if (this.excludeFromCodeTrue){
|
|
62
|
+
// this.code = ["new Text('').set({})"];
|
|
63
|
+
return [""];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const cleanedObj = Object.fromEntries(
|
|
67
|
+
Object.entries(this.options).filter(([key, value]) => value !== null)
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const objString = JSON
|
|
71
|
+
.stringify(cleanedObj, null, 4)
|
|
72
|
+
.replace(/"([^"]+)":/g, '$1:');
|
|
73
|
+
|
|
74
|
+
console.log("OCO")
|
|
75
|
+
console.log(objString);
|
|
76
|
+
return [`new Text("${this.text}").set(${objString})`];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
toCSS(){
|
|
80
|
+
return this.css;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
toHTMLA(){
|
|
84
|
+
return this.html;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
toElCSS(){
|
|
88
|
+
this.elCSS = this.elCSS.map(el => " " + el);
|
|
89
|
+
this.preffersId ? this.elCSS.unshift(this.res.id + " { \n") : (this.elCSS.unshift("." + this.class + " { \n"));
|
|
90
|
+
this.elCSS.push(" } \n \n");
|
|
91
|
+
// console.warn("OI")
|
|
92
|
+
// console.log(this.elCSS);
|
|
93
|
+
return this.elCSS;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getType(){ // 114145
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// if (this.opt)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if (this.options.fluidc === "S1"){
|
|
104
|
+
return "HTMLHeaderElement";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return "HTMLParagraphElement";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
gradientOptions(optsa) {
|
|
113
|
+
|
|
114
|
+
//// console.log(optsa);
|
|
115
|
+
if (optsa.length === 0) {
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const opts = optsa.filter(el => el.op.name === "gradient")[0];
|
|
120
|
+
// Work here in Berlin ----------------------------
|
|
121
|
+
|
|
122
|
+
//// console.log(opts);
|
|
123
|
+
if (opts === undefined) {
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const options = opts.op;
|
|
128
|
+
const breakpoint = opts.point;
|
|
129
|
+
|
|
130
|
+
if (breakpoint) {
|
|
131
|
+
//// console.log(breakpoint);
|
|
132
|
+
|
|
133
|
+
const check = () => {
|
|
134
|
+
// 22:59:59 Yes!!!
|
|
135
|
+
// 02/10/23
|
|
136
|
+
// let matches = window.matchMedia(`(max-width: ${opts.point})`).matches;
|
|
137
|
+
let matches = window.matchMedia(`(min-width: ${opts.range[0]}) and (max-width: ${opts.range[1]})`).matches;
|
|
138
|
+
if (matches) {
|
|
139
|
+
// // console.log(this.res.style.color.toString());
|
|
140
|
+
// alert();
|
|
141
|
+
|
|
142
|
+
this.prevBackground = this.res.style.color.toString();
|
|
143
|
+
this.res.style.background = options.gradient; //`linear-gradient(to right, ${color1}, ${color2})`;
|
|
144
|
+
this.res.style.WebkitBackgroundClip = 'text';
|
|
145
|
+
}/* else {
|
|
146
|
+
// this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
147
|
+
//alert("O")
|
|
148
|
+
// Do not remove stroke, after gradient disappears here
|
|
149
|
+
|
|
150
|
+
// alert("Hello");
|
|
151
|
+
// console.log(this.res.style.color.toString());
|
|
152
|
+
//this.res.style.color = "transparent"; //this.prevBackground;
|
|
153
|
+
//this.res.style['-webkit-text-stroke'] = `1px orange`;
|
|
154
|
+
// 17:53:44 Nice!
|
|
155
|
+
}*/
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
check();
|
|
159
|
+
window.addEventListener("resize", check);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
strokeOptions(optsa) { // 22:55:04 21/08/23
|
|
165
|
+
|
|
166
|
+
// console.log(optsa);
|
|
167
|
+
if (optsa.length === 0) {
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const opts = optsa.filter(el => el.op.name === "blast")[0];
|
|
172
|
+
// Work here in Berlin ----------------------------
|
|
173
|
+
|
|
174
|
+
if (opts === undefined) {
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
console.log("DEL");
|
|
178
|
+
const options = opts.op;
|
|
179
|
+
const breakpoint = opts.point;
|
|
180
|
+
|
|
181
|
+
if (breakpoint) {
|
|
182
|
+
// // console.log(breakpoint);
|
|
183
|
+
|
|
184
|
+
const check = () => {
|
|
185
|
+
|
|
186
|
+
// let matches = window.matchMedia(`(max-width: ${opts.point})`).matches;
|
|
187
|
+
|
|
188
|
+
let matches = window.matchMedia(`(min-width: ${opts.range[0]}) and (max-width: ${opts.range[1]})`).matches;
|
|
189
|
+
if (matches) {
|
|
190
|
+
|
|
191
|
+
// console.log(opts);
|
|
192
|
+
if (options.color) {
|
|
193
|
+
this.res.style['-webkit-text-stroke'] = `${options.width ? options.width : "1px"} ${options.color}`;
|
|
194
|
+
} else {
|
|
195
|
+
this.res.style['-webkit-text-stroke'] = `1px orange`;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Not working, gradient modifier prevents this
|
|
199
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
200
|
+
} /*else {
|
|
201
|
+
//this.res.style.color = "transparent";
|
|
202
|
+
//this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
203
|
+
//alert("removes stroke")
|
|
204
|
+
//this.res.style['-webkit-text-stroke'] = "";
|
|
205
|
+
this.res.style['-webkit-text-fill-color'] = ""; // ""
|
|
206
|
+
// 17:53:44 Nice!
|
|
207
|
+
}*/
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
check();
|
|
211
|
+
window.addEventListener("resize", check);
|
|
212
|
+
} else {
|
|
213
|
+
// console.log(opts);
|
|
214
|
+
if (options.color) {
|
|
215
|
+
this.res.style['-webkit-text-stroke'] = `${options.width ? options.width : "1px"} ${options.color}`;
|
|
216
|
+
} /*else if (this.options.color){
|
|
217
|
+
this.res.style['-webkit-text-stroke'] = `1px ${this.options.color}`;
|
|
218
|
+
}*/
|
|
219
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// 11:10:22
|
|
223
|
+
|
|
224
|
+
// 22:56:40 yes!
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
stroke(){
|
|
228
|
+
this.res.style['-webkit-text-stroke'] = '3px orange';
|
|
229
|
+
return this; // 02/03/23
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
fill(){
|
|
233
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
234
|
+
return this;
|
|
235
|
+
// 235326 02/03/23
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
rowCol(row, col){
|
|
239
|
+
this.res.style.gridRow = row;
|
|
240
|
+
this.res.style.gridColumn = col;
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
setGridRow(row){
|
|
245
|
+
this.res.style.gridRow = row;
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
setGridCol(col){
|
|
250
|
+
this.res.style.gridColumn = col;
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
toHTML(){
|
|
255
|
+
return this.res;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
onTap(e){
|
|
260
|
+
this.res.addEventListener("click", e);
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
setClass(name){
|
|
265
|
+
this.res.setAttribute("class", name);
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
setRandom(){
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
var result = "LAYOUT-";
|
|
273
|
+
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
274
|
+
|
|
275
|
+
for (var i = 90; i > 0; --i) {
|
|
276
|
+
result += chars[Math.floor(Math.random() * chars.length)];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
result += new Date().getTime();
|
|
280
|
+
this.res.setAttribute("class", result);
|
|
281
|
+
|
|
282
|
+
return this;
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
styled(obj) {
|
|
287
|
+
this.set(obj);
|
|
288
|
+
return this;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
removeQuotesFromFirstWord(jsonString) {
|
|
292
|
+
const modifiedJSON = jsonString.replace(/"([^"]+)":/g, '$1:');
|
|
293
|
+
return modifiedJSON;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
set(obj){
|
|
298
|
+
this.resCopy = this.res;
|
|
299
|
+
this.options = obj;
|
|
300
|
+
super.setPrevText(this.text);
|
|
301
|
+
let stra = "";
|
|
302
|
+
|
|
303
|
+
obj.maxWidth && (this.res.style.maxWidth = obj.maxWidth);
|
|
304
|
+
|
|
305
|
+
obj.cursor && (this.res.style.cursor = "hand");
|
|
306
|
+
|
|
307
|
+
obj.gpos && this.gpos(obj.gpos);
|
|
308
|
+
|
|
309
|
+
obj.vtn && (this.res.style.viewTransitionName = obj.vtn);
|
|
310
|
+
|
|
311
|
+
obj.index && super.setIndex(obj.index);
|
|
312
|
+
obj.index && (this.index = obj.index);
|
|
313
|
+
|
|
314
|
+
obj.preffersId && (this.preffersId = obj.preffersId);
|
|
315
|
+
|
|
316
|
+
super.setPref(obj.preffersId);
|
|
317
|
+
|
|
318
|
+
obj.removeDecoration && (this.res.style.textDecoration = "none");
|
|
319
|
+
obj.block && (this.res.style.display = "block");
|
|
320
|
+
obj.area && this.setArea(obj.area);
|
|
321
|
+
|
|
322
|
+
if (obj.icon){
|
|
323
|
+
this.addIcon(obj.icon);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
obj.color && this.color(obj.color);
|
|
327
|
+
obj.color &&(this.elCSS.push(`color: ${obj.color}; \n`));
|
|
328
|
+
|
|
329
|
+
obj.class && this.setClass(obj.class);
|
|
330
|
+
|
|
331
|
+
obj.size && this.fluidCopy(obj.size);
|
|
332
|
+
obj.fluidc && this.fluidCopy(obj.fluidc);
|
|
333
|
+
//obj.fluidc && (stra += `\n fluidc: "${obj.fluidc}",`); // 233559, correct collon 23:35:35 06/03
|
|
334
|
+
|
|
335
|
+
obj.initLetter && this.initLetter(obj.initLetter);
|
|
336
|
+
|
|
337
|
+
obj.onTap && (this.onTap(obj.onTap)); //this.onTap(obj.onTap);
|
|
338
|
+
|
|
339
|
+
if (obj.fluidc === "S6"){
|
|
340
|
+
obj.fluidc && (this.elCSS.push(`font-size: calc(1.1rem + 2.075vw); \n`));
|
|
341
|
+
} else {
|
|
342
|
+
obj.fluidc && (this.elCSS.push(`font-size: calc(1.625rem + 5.075vw); \n`));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
this.options.id && this.res.setAttribute("id", this.options.id);
|
|
346
|
+
super.setID(this.options.id);
|
|
347
|
+
|
|
348
|
+
this.options.class && this.res.setAttribute("class", this.options.class);
|
|
349
|
+
|
|
350
|
+
super.setClass(this.options.class);
|
|
351
|
+
obj.clampc && this.clampCopy(obj.clampc);
|
|
352
|
+
obj.arrpad && this.arrayPadding(obj.arrpad.sides, obj.arrpad.value);
|
|
353
|
+
obj.pad && this.pad(obj.pad);
|
|
354
|
+
obj.respad && this.respad(obj.respad);
|
|
355
|
+
obj.resmar && this.resmar(obj.resmar);
|
|
356
|
+
|
|
357
|
+
// stra += // 2345 06/03
|
|
358
|
+
obj.mar && this.mar(obj.mar);
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
obj.exact && (this.res.style.fontSize = obj.exact);
|
|
362
|
+
obj.zIndex && (this.res.style.zIndex = obj.zIndex);
|
|
363
|
+
obj.absolute && (this.res.style.position = "absolute");
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
obj.arrayMargin && this.arrayMargin(obj.arrayMargin.sides, obj.arrayMargin.value);
|
|
367
|
+
obj.em && this.em(obj.em);
|
|
368
|
+
|
|
369
|
+
if (obj.fluid){
|
|
370
|
+
this.fluid(obj.fluid);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
obj.font && this.font(obj.font);
|
|
374
|
+
obj.fluidc && (this.elCSS.push(`font-family: ${obj.font}; \n`));
|
|
375
|
+
obj.align && (this.res.style.textAlign = obj.align);
|
|
376
|
+
|
|
377
|
+
obj.weight && (this.res.style.fontWeight = obj.weight);
|
|
378
|
+
obj.padding && this.padding(obj.padding);
|
|
379
|
+
obj.breakWord && (this.res.style.wordWrap = "break-word");
|
|
380
|
+
obj.center && (this.res.style.marginRight = "auto");
|
|
381
|
+
obj.center && (this.res.style.marginLeft = "auto");
|
|
382
|
+
obj.width && (this.res.style.width = obj.width);
|
|
383
|
+
obj.height && (this.res.style.height = obj.height);
|
|
384
|
+
obj.background && (this.res.style.backgroundColor = obj.background);
|
|
385
|
+
obj.radius && (this.res.style.borderRadius = obj.radius);
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
obj.italic && this.italic();
|
|
389
|
+
// stra += 17:01:43 11/11/24
|
|
390
|
+
|
|
391
|
+
obj.responsive && this.responsive(); // Where I solve blast, make full width?
|
|
392
|
+
|
|
393
|
+
obj.border && (this.res.style.border = `${obj.border}`);
|
|
394
|
+
|
|
395
|
+
obj.onScroll && this.onScroll(obj.onScroll);
|
|
396
|
+
|
|
397
|
+
obj.keySet && this.keySet(obj.keySet);
|
|
398
|
+
|
|
399
|
+
obj.maxHeight && (this.res.style.maxHeight = obj.maxHeight);
|
|
400
|
+
|
|
401
|
+
obj.transform && this.reactOnTransform(obj.transform); // remove obj.op.duration
|
|
402
|
+
|
|
403
|
+
/*if (obj.transform.op.values){
|
|
404
|
+
alert("P");
|
|
405
|
+
}*/
|
|
406
|
+
|
|
407
|
+
console.log("OGA");
|
|
408
|
+
console.log(obj);
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
let arr = [];
|
|
413
|
+
|
|
414
|
+
if (obj.stroke || obj.gradient || obj.span || obj.backgroundOp || obj.layout || obj.shadow || obj.animation || obj.filtera || obj.transform){
|
|
415
|
+
if (obj.gradient){
|
|
416
|
+
this.globalGradient = obj.gradient.op.gradient;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
if (obj.stroke){
|
|
421
|
+
super.setAny({globalBlast: `${obj.stroke.op.width} ${obj.stroke.op.color}`});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (obj.span){
|
|
425
|
+
obj.span.prevText = this.text;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
let ft = [obj.stroke, obj.gradient, obj.animation, obj.span, obj.backgroundOp, obj.layout, obj.marginOp, obj.shadow, /*obj.animation || obj.filtera*/obj.animation, obj.filtera, obj.transform];
|
|
430
|
+
ft = ft.filter(el => el != undefined);
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
for (var i = 0; i < ft.length; i++){
|
|
435
|
+
arr.push({
|
|
436
|
+
range: ft[i].range,
|
|
437
|
+
log: ft[i].op.name,
|
|
438
|
+
target: ft[i].target,
|
|
439
|
+
op: ft[i].op
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
let keep = [];
|
|
444
|
+
|
|
445
|
+
if (obj.borderObj){
|
|
446
|
+
keep.push("border");
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (obj.background){
|
|
450
|
+
keep.push("background");
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (obj.mar){
|
|
454
|
+
keep.push("margin");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (obj.animation){
|
|
458
|
+
keep.push("animation");
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (obj.span){
|
|
462
|
+
keep.push("span");
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* if (obj.transform){
|
|
466
|
+
keep.push("transform");
|
|
467
|
+
}*/
|
|
468
|
+
|
|
469
|
+
this.chainReact(arr, this.options.id, keep);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
//this.code.push(str); // 14:04:10 06/03
|
|
474
|
+
|
|
475
|
+
return this;
|
|
476
|
+
} // 114522 you can hit tab
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
// ------------------------------------------INDIVIDUAL METHODS-------------------------------
|
|
483
|
+
excludeFromCode(){
|
|
484
|
+
this.excludeFromCodeTrue = true;
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
// Works, but allow overlaps
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
addIcon(obj){
|
|
493
|
+
//alert("PPP")
|
|
494
|
+
let img = document.createElement("img");
|
|
495
|
+
img.style.width = "20px";
|
|
496
|
+
img.style.marginLeft = "10px";
|
|
497
|
+
img.style.height = "auto";
|
|
498
|
+
img.setAttribute("src", obj.url);
|
|
499
|
+
this.res.appendChild(img);
|
|
500
|
+
return this;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
checkForAnimation(queries){
|
|
505
|
+
|
|
506
|
+
// Sort the queries based on the starting range value in ascending order
|
|
507
|
+
queries.sort((a, b) => parseInt(a.range[0]) - parseInt(b.range[0]));
|
|
508
|
+
|
|
509
|
+
const screenSize = window.innerWidth;
|
|
510
|
+
|
|
511
|
+
for (const query of queries) {
|
|
512
|
+
const [startRange, endRange] = query.range;
|
|
513
|
+
const startSize = parseInt(startRange);
|
|
514
|
+
const endSize = parseInt(endRange);
|
|
515
|
+
|
|
516
|
+
if (screenSize >= startSize && screenSize <= endSize) {
|
|
517
|
+
if (query.log === "animation"){ // 23:18:48 Nice!!! 31/10/2023
|
|
518
|
+
|
|
519
|
+
// Create a keyframes object
|
|
520
|
+
const keyframes = [
|
|
521
|
+
{ opacity: 0, transform: 'translateY(100px)' }, // Starting position
|
|
522
|
+
{ opacity: 1, transform: 'translateY(0)' } // Ending position
|
|
523
|
+
];
|
|
524
|
+
|
|
525
|
+
this.res.animate(keyframes, {
|
|
526
|
+
duration: 1000, // Animation duration in milliseconds
|
|
527
|
+
easing: 'ease' // Easing function
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
// Do reset text, even when ranges may overlap
|
|
539
|
+
// reset all => apply relevant, => .....
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
resetSmall(){ // reset to default properties, allow overlaps
|
|
544
|
+
//this.res.style.color = "gray";
|
|
545
|
+
this.res.style['-webkit-text-stroke'] = "";
|
|
546
|
+
this.res.style['-webkit-text-fill-color'] = "";
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
resetGradient(){
|
|
551
|
+
this.res.style.WebkitBackgroundClip = "text";
|
|
552
|
+
this.res.style.background = "transparent";
|
|
553
|
+
return this;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
resetStroke(){ // was commented out
|
|
558
|
+
this.res.style['-webkit-text-stroke'] = "";
|
|
559
|
+
this.res.style['-webkit-text-fill-color'] = "";
|
|
560
|
+
// this.res.style.color = "orange";
|
|
561
|
+
|
|
562
|
+
//this.res.style['-webkit-text-stroke'] = "3px yellow";
|
|
563
|
+
//this.res.style['-webkit-text-fill-color'] = "transparent";
|
|
564
|
+
//this.res.style.color = "orange";
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
innerStroke(options){
|
|
568
|
+
if (options.color) {
|
|
569
|
+
this.res.style['-webkit-text-stroke'] = `${options.width ? options.width : "1px"} ${options.color}`;
|
|
570
|
+
} else {
|
|
571
|
+
this.res.style['-webkit-text-stroke'] = `1px orange`;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// Not working, gradient modifier prevents this
|
|
575
|
+
this.res.style['-webkit-text-fill-color'] = 'transparent';
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
innerGradient(options){
|
|
580
|
+
|
|
581
|
+
//// console.log(options.gradient);
|
|
582
|
+
//alert(options.gradient);
|
|
583
|
+
// this.res.style['-webkit-text-fill-color'] = '';
|
|
584
|
+
this.res.style.background = `linear-gradient(45deg, #ff0000, #00ff00)`;//options.gradient;
|
|
585
|
+
this.res.style['-webkit-background-clip'] = 'text';
|
|
586
|
+
// this.res.style.WebkitBackgroundClip = 'text';
|
|
587
|
+
//this.res.style.color = "transparent";
|
|
588
|
+
// // console.log(options);
|
|
589
|
+
|
|
590
|
+
/*this.prevBackground = this.res.style.color.toString();
|
|
591
|
+
this.res.style.background = options.gradient; //`linear-gradient(to right, ${color1}, ${color2})`;
|
|
592
|
+
this.res.style.WebkitBackgroundClip = 'text';*/
|
|
593
|
+
|
|
594
|
+
//this.res.style.color = "green";
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
arrayMargin(arr, value) { // 224857 redefined earlier
|
|
600
|
+
|
|
601
|
+
if (!value){ // LTRB
|
|
602
|
+
this.res.style.marginLeft = `${arr[0]}px`;
|
|
603
|
+
this.res.style.marginTop = `${arr[1]}px`;
|
|
604
|
+
this.res.style.marginRight = `${arr[2]}px`;
|
|
605
|
+
this.res.style.marginBottom = `${arr[3]}px`;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
if (value === "7rem"){
|
|
610
|
+
// The text does not react to margin changes
|
|
611
|
+
// alert(arr);
|
|
612
|
+
// alert(value);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
// // console.log(arr);
|
|
618
|
+
if (arr.includes("left")){
|
|
619
|
+
this.res.style.marginLeft = value;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
if (arr.includes("right")){
|
|
623
|
+
this.res.style.marginRight = value;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if (arr.includes("top")){
|
|
627
|
+
this.res.style.marginTop = value;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (arr.includes("bottom")){
|
|
631
|
+
this.res.style.marginBottom = value;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
if (!value){
|
|
635
|
+
this.res.style.marginBottom = arr;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
return this;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
clampExperiment(){
|
|
642
|
+
|
|
643
|
+
this.res.style.fontSize = "clamp(1rem, calc(1rem * 10rem), 3rem)";
|
|
644
|
+
// this.res.style.fontSize = "clamp(1.125rem, calc(1.125rem + (1.25 - 1.125) * ((100vw - 20rem) / (96 - 20))), 1.25rem)"; // "clamp(1rem, 4rem * 20vw, 7rem)";
|
|
645
|
+
return this;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
/*
|
|
650
|
+
|
|
651
|
+
between(name){
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
if (name === "S1"){
|
|
655
|
+
this.res.style.fontSize = "clamp(2rem, 8vw, 2.5rem)";
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
if (name === "S2"){
|
|
659
|
+
this.res.style.fontSize = "clamp(4rem, 8vw, 5rem)";
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (name === "S3"){
|
|
663
|
+
this.res.style.fontSize = "clamp(2rem, 5vw, 2.5rem)";
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
if (name === "S4"){
|
|
668
|
+
this.res.style.fontSize = "clamp(1.5rem, 2vw, 1.6rem)";
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
if (name === "S5"){
|
|
672
|
+
this.res.style.fontSize = "clamp(1.2rem, 2vw, 1.3rem)";
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (name === "S6"){
|
|
676
|
+
this.res.style.fontSize = "clamp(1rem, 2vw, 1.3rem)";
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
return this;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
*/
|
|
685
|
+
|
|
686
|
+
between(name){
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
if (name === "S1"){
|
|
690
|
+
this.res.style.fontSize = "clamp(2rem, 8vw, 2.5rem)";
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (name === "S2"){
|
|
694
|
+
this.res.style.fontSize = "clamp(4rem, 8vw, 5rem)";
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if (name === "S3"){
|
|
698
|
+
this.res.style.fontSize = "clamp(2rem, 5vw, 2.5rem)";
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
if (name === "S4"){
|
|
703
|
+
this.res.style.fontSize = "clamp(1.5rem, 2vw, 1.6rem)";
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
if (name === "S5"){
|
|
707
|
+
this.res.style.fontSize = "clamp(1.2rem, 2vw, 1.3rem)";
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (name === "S6"){
|
|
711
|
+
this.res.style.fontSize = "clamp(1rem, 2vw, 1.3rem)";
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
return this;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
betweenCopy(name){
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
if (name === "S1"){
|
|
724
|
+
this.res.style.fontSize = "clamp(2rem, 8vw, 2.5rem)";
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
if (name === "S2"){
|
|
728
|
+
this.res.style.fontSize = "clamp(4rem, 8vw, 5rem)";
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
if (name === "S3"){
|
|
732
|
+
this.res.style.fontSize = "clamp(2rem, 5vw, 2.5rem)";
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
if (name === "S4"){
|
|
737
|
+
this.res.style.fontSize = "clamp(1.5rem, 2vw, 1.6rem)";
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (name === "S5"){
|
|
741
|
+
this.res.style.fontSize = "clamp(1.2rem, 2vw, 1.3rem)";
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
if (name === "S6"){
|
|
745
|
+
this.res.style.fontSize = "clamp(1rem, 2vw, 1.3rem)";
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
return this;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
stringGen(len) {
|
|
754
|
+
var text = "";
|
|
755
|
+
|
|
756
|
+
var charset = "abcdefghijklmnopqrstuvwxyz";
|
|
757
|
+
|
|
758
|
+
for (var i = 0; i < len; i++)
|
|
759
|
+
text += charset.charAt(Math.floor(Math.random() * charset.length));
|
|
760
|
+
|
|
761
|
+
return text;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
initLetter(n){
|
|
765
|
+
let el = document.createElement("style");
|
|
766
|
+
document.body.appendChild(el);
|
|
767
|
+
|
|
768
|
+
// let rand = new Rans
|
|
769
|
+
// this.res.
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
let randID = Math.random();
|
|
774
|
+
|
|
775
|
+
let str = this.stringGen(1000); //randID.toString().substr(3, 6);
|
|
776
|
+
this.res.setAttribute("id", str);
|
|
777
|
+
// // console.log();
|
|
778
|
+
|
|
779
|
+
document.styleSheets[0].insertRule(`#${str}::first-letter { color: green; font-size: 3em; padding: 0.1em }`, 0);
|
|
780
|
+
// this.res.style.initialLetter = n;
|
|
781
|
+
return this;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
constant(name){
|
|
790
|
+
const display1 = "1.625rem";
|
|
791
|
+
|
|
792
|
+
if (name === "S1"){
|
|
793
|
+
this.jumbotron();
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (name === "S2"){
|
|
797
|
+
this.large();
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (name === "S3"){
|
|
801
|
+
this.medium();
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/*const display4= "1.200rem";
|
|
805
|
+
|
|
806
|
+
if (name === "S4"){
|
|
807
|
+
this.res.style.fontSize = display4;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
const display5= "1.000rem";
|
|
811
|
+
|
|
812
|
+
if (name === "S5"){
|
|
813
|
+
this.res.style.fontSize = display5;
|
|
814
|
+
}
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
return this;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
minusMargin(){
|
|
822
|
+
this.res.style.marginRight = "-3.1em";
|
|
823
|
+
return this;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
fluid(name){
|
|
830
|
+
|
|
831
|
+
const display1 = "calc(1.625rem + 4.3vw)";
|
|
832
|
+
|
|
833
|
+
if (name === "S1"){
|
|
834
|
+
this.res = document.createElement("h1");
|
|
835
|
+
let node = document.createTextNode(this.text);
|
|
836
|
+
this.res.appendChild(node);
|
|
837
|
+
this.res.style.fontSize = display1;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
const display2 = "calc(1.525rem + 3.525vw)";
|
|
842
|
+
|
|
843
|
+
if (name === "S2"){
|
|
844
|
+
this.res = document.createElement("h2");
|
|
845
|
+
let node = document.createTextNode(this.text);
|
|
846
|
+
this.res.appendChild(node);
|
|
847
|
+
this.res.style.fontSize = display2;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
const display3 = "calc(1.375rem + 2.75vw)";
|
|
852
|
+
|
|
853
|
+
if (name === "S3"){
|
|
854
|
+
this.res = document.createElement("h3");
|
|
855
|
+
let node = document.createTextNode(this.text);
|
|
856
|
+
this.res.appendChild(node);
|
|
857
|
+
this.res.style.fontSize = display3;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
const display4 = "calc(1.275rem + 1.975vw)";
|
|
861
|
+
|
|
862
|
+
if (name === "S4"){
|
|
863
|
+
this.res = document.createElement("h4");
|
|
864
|
+
let node = document.createTextNode(this.text);
|
|
865
|
+
this.res.appendChild(node);
|
|
866
|
+
this.res.style.fontSize = display4;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
const display5 = "calc(1.1rem + 1.2vw)";
|
|
870
|
+
|
|
871
|
+
if (name === "S5"){
|
|
872
|
+
//this.res = document.createElement("p");
|
|
873
|
+
//let node = document.createTextNode(this.text);
|
|
874
|
+
// this.res.appendChild(node);
|
|
875
|
+
// alert("K")
|
|
876
|
+
this.res.style.fontSize = display5;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
return this;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
getClampValue(name){
|
|
886
|
+
if (name === "S7"){
|
|
887
|
+
//alert("NEOM")
|
|
888
|
+
return "clamp(1.45rem, 2vw + 1.5rem, 1.69rem)";
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
if (name === "S6"){
|
|
892
|
+
return "clamp(2.25rem, 2vw+1.5rem, 3.25rem)";
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
if (name === "S5"){
|
|
896
|
+
return "clamp(2.75rem, 2vw + 1.5rem, 3.25rem)";
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
if (name === "S4"){
|
|
900
|
+
return "clamp(3.5rem, 2vw + 1.5rem, 3.25rem)";
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
if (name === "S3"){
|
|
904
|
+
return "clamp(4.25rem, 2vw + 1.5rem, 3.25rem)";
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
if (name === "S2"){
|
|
908
|
+
return "clamp(5rem, 2vw + 1.5rem, 3.25rem)";
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
if (name === "S1"){
|
|
912
|
+
return "clamp(6rem, 2vw + 1.5rem, 3.25rem)";
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
clampCopy(name){
|
|
917
|
+
this.res.style.fontSize = this.getClampValue(name)
|
|
918
|
+
return this;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
fluidCopy(name){
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
if (name instanceof Object){
|
|
925
|
+
this.prevStylex = this.res.style;
|
|
926
|
+
this.res = document.createElement("h1");
|
|
927
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
928
|
+
let node = document.createTextNode(this.text);
|
|
929
|
+
this.res.appendChild(node);
|
|
930
|
+
this.res.style.fontSize = name.exact;
|
|
931
|
+
|
|
932
|
+
// alert(name.exact);
|
|
933
|
+
|
|
934
|
+
return this;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
const display1 = "calc(1.625rem + 5.075vw)";
|
|
938
|
+
|
|
939
|
+
if (name === "S1"){
|
|
940
|
+
this.prevStylex = this.res.style;
|
|
941
|
+
this.res = document.createElement("h1");
|
|
942
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
943
|
+
let node = document.createTextNode(this.text);
|
|
944
|
+
this.res.appendChild(node);
|
|
945
|
+
this.res.style.fontSize = display1;
|
|
946
|
+
|
|
947
|
+
/* if (this.options.preffersId === false){
|
|
948
|
+
this.html.push(`<h1 class="${this.options.class}">${this.text}</h1> \n \n`);
|
|
949
|
+
} else if (this.options.id) {
|
|
950
|
+
this.html.push(`<h1 id="${this.options.id.substr(1)}">${this.text}</h1> \n \n`);
|
|
951
|
+
}*/
|
|
952
|
+
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
const display2 = "calc(1.500rem + 4.3vw)";
|
|
956
|
+
|
|
957
|
+
if (name === "S2"){
|
|
958
|
+
this.prevStylex = this.res.style;
|
|
959
|
+
this.res = document.createElement("h2");
|
|
960
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
961
|
+
let node = document.createTextNode(this.text);
|
|
962
|
+
this.res.appendChild(node);
|
|
963
|
+
this.res.style.fontSize = display2;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
const display3 = "calc(1.375rem + 3.525vw)";
|
|
968
|
+
|
|
969
|
+
if (name === "S3"){
|
|
970
|
+
this.prevStylex = this.res.style;
|
|
971
|
+
this.res = document.createElement("h3");
|
|
972
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
973
|
+
let node = document.createTextNode(this.text);
|
|
974
|
+
this.res.appendChild(node);
|
|
975
|
+
this.res.style.fontSize = display3;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
const display4 = "calc(1.250rem + 2.75vw)";
|
|
979
|
+
|
|
980
|
+
if (name === "S4"){
|
|
981
|
+
this.prevStylex = this.res.style;
|
|
982
|
+
this.res = document.createElement("h4");
|
|
983
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
984
|
+
let node = document.createTextNode(this.text);
|
|
985
|
+
this.res.appendChild(node);
|
|
986
|
+
this.res.style.fontSize = display4;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const display5 = "calc(1.125rem + 1.975vw)";
|
|
990
|
+
|
|
991
|
+
if (name === "S5"){
|
|
992
|
+
this.prevStylex = this.res.style;
|
|
993
|
+
this.res = document.createElement("h5");
|
|
994
|
+
this.res.style.cssText = this.prevStylex.cssText;
|
|
995
|
+
let node = document.createTextNode(this.text);
|
|
996
|
+
this.res.appendChild(node);
|
|
997
|
+
this.res.style.fontSize = display5;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
const display6 = "calc(1rem + 0.5vw)"; // calc(1rem + 1.2vw)
|
|
1003
|
+
|
|
1004
|
+
if (name === "S6"){
|
|
1005
|
+
if (this.options && this.options.preffersId === false){
|
|
1006
|
+
this.html.push(`<p class="${this.options.class}">${this.text}</p> \n \n`);
|
|
1007
|
+
} else if (this.options && this.options.id) {
|
|
1008
|
+
this.html.push(`<p id="${this.options.id.substr(1)}">${this.text}</p> \n \n`);
|
|
1009
|
+
}
|
|
1010
|
+
this.res.style.fontSize = display6;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
return this;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
toReactComponent(){
|
|
1018
|
+
this.react.push("function Godzilla() { \n");
|
|
1019
|
+
//if (this.options.preffersId === false){
|
|
1020
|
+
this.react.push(`return <h1 class="${this.options.class}">${this.text}</h1> \n`);
|
|
1021
|
+
// } else {
|
|
1022
|
+
// this.react.push(`return <h1 id="${this.options.id.substr(1)}">${this.text}</h1> \n`);
|
|
1023
|
+
// }
|
|
1024
|
+
this.react.push("} \n \n");
|
|
1025
|
+
|
|
1026
|
+
// console.warn("i...")
|
|
1027
|
+
// console.log(this.react.join(""));
|
|
1028
|
+
return this.react;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
myself(obj) {
|
|
1043
|
+
const adj = () => {
|
|
1044
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1045
|
+
if (query.matches) {
|
|
1046
|
+
this.res.style.fontSize = obj.desktop;
|
|
1047
|
+
} else {
|
|
1048
|
+
this.res.style.fontSize = obj.phone;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
adj();
|
|
1053
|
+
window.addEventListener("resize", adj);
|
|
1054
|
+
return this;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
jumbotron() {
|
|
1060
|
+
const adj = () => {
|
|
1061
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1062
|
+
if (query.matches) {
|
|
1063
|
+
this.res.style.fontSize = '8rem';
|
|
1064
|
+
} else {
|
|
1065
|
+
this.res.style.fontSize = '6rem';
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
adj();
|
|
1070
|
+
window.addEventListener("resize", adj);
|
|
1071
|
+
return this;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
large() {
|
|
1076
|
+
const adj = () => {
|
|
1077
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1078
|
+
if (query.matches) {
|
|
1079
|
+
this.res.style.fontSize = '7rem';
|
|
1080
|
+
} else {
|
|
1081
|
+
this.res.style.fontSize = '5rem';
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
adj();
|
|
1086
|
+
window.addEventListener("resize", adj);
|
|
1087
|
+
return this;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
frame(obj){
|
|
1093
|
+
this.res.style.width = obj.width;
|
|
1094
|
+
this.res.style.height = obj.height;
|
|
1095
|
+
return this;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
vw(val, o, maxMin){
|
|
1101
|
+
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
responsive(base){
|
|
1107
|
+
this.set = false;
|
|
1108
|
+
this.setB = false;
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
const adapt = () => {
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
if (window.innerWidth < base.minw){
|
|
1116
|
+
this.setB = false;
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
// *Â window.innerWidth);
|
|
1120
|
+
// // console.log(base.baseVW / 100 * window.innerWidth);
|
|
1121
|
+
// CONVERT CURRENT base.VW to pixels
|
|
1122
|
+
|
|
1123
|
+
if (!this.set){
|
|
1124
|
+
|
|
1125
|
+
this.res.style.color = "#3498db";
|
|
1126
|
+
this.res.style.fontSize = `${base.baseVW / 100 * window.innerWidth}px`;
|
|
1127
|
+
this.set = true;
|
|
1128
|
+
}
|
|
1129
|
+
} else if (window.innerWidth > base.maxw){
|
|
1130
|
+
this.set = false;
|
|
1131
|
+
if (!this.setB){
|
|
1132
|
+
//alert("ON REFRESH");
|
|
1133
|
+
this.res.style.color = "orange";
|
|
1134
|
+
this.res.style.fontSize = `${base.baseVW / 100 * base.maxw}px`;
|
|
1135
|
+
//this.res.style.fontSize = `${base.maxFont}px`;
|
|
1136
|
+
this.setB = true;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
} else {
|
|
1142
|
+
this.set = false;
|
|
1143
|
+
this.setB = false;
|
|
1144
|
+
this.res.style.color = "black";
|
|
1145
|
+
this.res.style.fontSize = `${base.baseVW}vw`;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
/*let query = window.matchMedia(`(max-device-width: ${o.w}px)`);
|
|
1151
|
+
if (query.matches) {
|
|
1152
|
+
alert("joa")
|
|
1153
|
+
this.res.style.fontSize = `${o.size}vw`;
|
|
1154
|
+
}*/
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
adapt();
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
window.addEventListener("resize", adapt);
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
// this.res.style.fontSize = `calc(${base}px + 1vw)`;
|
|
1170
|
+
return this;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
xlarge() {
|
|
1174
|
+
const adj = () => {
|
|
1175
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1176
|
+
if (query.matches) {
|
|
1177
|
+
this.res.style.fontSize = '6.5rem';
|
|
1178
|
+
} else {
|
|
1179
|
+
this.res.style.fontSize = '8.5rem';
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
adj();
|
|
1184
|
+
window.addEventListener("resize", adj);
|
|
1185
|
+
return this;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
medium() {
|
|
1189
|
+
const adj = () => {
|
|
1190
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1191
|
+
/* let query = window.matchMedia("(max-device-width: 415px)");
|
|
1192
|
+
if (window.innerWidth < h || query.matches) {
|
|
1193
|
+
} */
|
|
1194
|
+
|
|
1195
|
+
if (query.matches) {
|
|
1196
|
+
this.res.style.fontSize = '2.25rem';
|
|
1197
|
+
} else {
|
|
1198
|
+
this.res.style.fontSize = '1.5em';
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
adj();
|
|
1203
|
+
window.addEventListener("resize", adj);
|
|
1204
|
+
return this;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
auto() {
|
|
1208
|
+
const adj = () => {
|
|
1209
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1210
|
+
if (query.matches) {
|
|
1211
|
+
this.res.style.fontSize = '2rem';
|
|
1212
|
+
} else {
|
|
1213
|
+
this.res.style.fontSize = '1rem';
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
adj();
|
|
1218
|
+
window.addEventListener("resize", adj);
|
|
1219
|
+
return this;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
small() {
|
|
1223
|
+
const adj = () => {
|
|
1224
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
1225
|
+
/* let query = window.matchMedia("(max-device-width: 415px)");
|
|
1226
|
+
if (window.innerWidth < h || query.matches) {
|
|
1227
|
+
} */
|
|
1228
|
+
|
|
1229
|
+
if (query.matches) {
|
|
1230
|
+
this.res.style.fontSize = '1.5em';
|
|
1231
|
+
} else {
|
|
1232
|
+
this.res.style.fontSize = '1em';
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
adj();
|
|
1237
|
+
window.addEventListener("resize", adj);
|
|
1238
|
+
return this;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
sizes(arra) {
|
|
1242
|
+
this.res.style.fontSize = `${arra[0].size}rem`;
|
|
1243
|
+
|
|
1244
|
+
const adj = () => {
|
|
1245
|
+
|
|
1246
|
+
for (var i = 0; i < arra.length; i++) {
|
|
1247
|
+
if (arra[i].width) {
|
|
1248
|
+
let mq = window.matchMedia(`(min-width: ${arra[i].width}px)`);
|
|
1249
|
+
if (mq.matches) {
|
|
1250
|
+
// alert("Matches");
|
|
1251
|
+
// console.warn(`----------${arra[i].size}`);
|
|
1252
|
+
this.res.style.fontSize = `${arra[i].size}`;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
let isMobile = window.matchMedia(`(max-device-width: 415px)`);
|
|
1259
|
+
|
|
1260
|
+
if (isMobile.matches) {
|
|
1261
|
+
this.res.style.fontSize = `${arra[arra.length - 1].mobile}`;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
}
|
|
1265
|
+
adj();
|
|
1266
|
+
window.addEventListener("resize", adj);
|
|
1267
|
+
return this;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
setup(obj) {
|
|
1271
|
+
let el;
|
|
1272
|
+
|
|
1273
|
+
if (obj){
|
|
1274
|
+
// alert(obj.type);
|
|
1275
|
+
el = document.createElement(obj.type);
|
|
1276
|
+
el.setAttribute("id", obj.id);
|
|
1277
|
+
if (obj.type === "span"){
|
|
1278
|
+
//el.style.display = "block";
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
} else {
|
|
1282
|
+
el = document.createElement("p");
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
let node = document.createTextNode( /*this.text.replace("$", obj)*/ this.text);
|
|
1287
|
+
el.appendChild(node);
|
|
1288
|
+
|
|
1289
|
+
this.res = el;
|
|
1290
|
+
this.res.style.padding = 0;
|
|
1291
|
+
this.res.style.margin = 0;
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
return this;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
hide() {
|
|
1298
|
+
this.res.style.visibility = "hidden";
|
|
1299
|
+
return this;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
font(font) {
|
|
1303
|
+
this.res.style.fontFamily = font;
|
|
1304
|
+
return this;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
center() {
|
|
1308
|
+
this.res.style.textAlign = "center";
|
|
1309
|
+
return this;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
size(s) {
|
|
1313
|
+
this.res.style.fontSize = s;
|
|
1314
|
+
return this;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
em(e) {
|
|
1318
|
+
this.res.style.fontSize = `${e}em`;
|
|
1319
|
+
//alert("h")
|
|
1320
|
+
return this;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
color(color) {
|
|
1324
|
+
this.res.style.color = color;
|
|
1325
|
+
//this.code.push(`.color(${color}),`);
|
|
1326
|
+
//this.code.push(`.color(${color})`);
|
|
1327
|
+
return this;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
align(direction) {
|
|
1331
|
+
this.res.style.textAlign = `${direction}`;
|
|
1332
|
+
return this;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
weight(weight) {
|
|
1336
|
+
this.res.style.fontWeight = weight;
|
|
1337
|
+
return this;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
bold() {
|
|
1341
|
+
this.res.style.fontWeight = "bold";
|
|
1342
|
+
return this;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
italic() {
|
|
1346
|
+
this.res.style.fontStyle = "italic";
|
|
1347
|
+
return this;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/*padding(val){
|
|
1351
|
+
this.res.style.padding = val;
|
|
1352
|
+
return this;
|
|
1353
|
+
}*/
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
width(w, shouldCenter){
|
|
1358
|
+
this.res.style.width = w;
|
|
1359
|
+
|
|
1360
|
+
if (shouldCenter){
|
|
1361
|
+
this.res.style.marginLeft = "auto";
|
|
1362
|
+
this.res.style.marginRight = "auto";
|
|
1363
|
+
}
|
|
1364
|
+
return this;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
offset(obj){
|
|
1369
|
+
/*this.res.style.marginLeft = "-390px";
|
|
1370
|
+
this.res.style.marginTop = "-360px";
|
|
1371
|
+
this.res.style.color = "green";*/
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
this.res.style.gridRow = 2;
|
|
1375
|
+
this.res.style.gridColumn = 2;
|
|
1376
|
+
|
|
1377
|
+
this.res.style.marginLeft = "-60px";
|
|
1378
|
+
|
|
1379
|
+
return this;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
|
|
1383
|
+
border(color, w) {
|
|
1384
|
+
this.res.style.border = `${w}px solid ${color}`;
|
|
1385
|
+
return this;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
padding(L, T, R, B) {
|
|
1389
|
+
if (L || T || R || B){ // CAUGHT MYSELF
|
|
1390
|
+
this.res.style.paddingLeft = L;
|
|
1391
|
+
this.res.style.paddingTop = T;
|
|
1392
|
+
this.res.style.paddingRight = R;
|
|
1393
|
+
this.res.style.paddingBottom = B;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
if (!T && !R && !B){
|
|
1397
|
+
//alert("j")
|
|
1398
|
+
this.res.style.padding = L;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
return this;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
arrayPadding(arr, value) {
|
|
1408
|
+
|
|
1409
|
+
if (arr.includes("left")){
|
|
1410
|
+
this.res.style.paddingLeft = value;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
// console.log("PAD");
|
|
1414
|
+
// console.log(this.res.style.paddingLeft);
|
|
1415
|
+
// console.log(arr);
|
|
1416
|
+
// console.log(value);
|
|
1417
|
+
|
|
1418
|
+
if (arr.includes("right")){
|
|
1419
|
+
this.res.style.paddingRight = value;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
if (arr.includes("top")){
|
|
1423
|
+
this.res.style.paddingTop = value;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
if (arr.includes("bottom")){
|
|
1427
|
+
this.res.style.paddingBottom = value;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
if (!value){
|
|
1431
|
+
this.res.style.paddingBottom = arr;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
return this;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
margin(L, T, R, B) {
|
|
1439
|
+
if (L || T || R || B){ // CAUGHT MYSELF
|
|
1440
|
+
this.res.style.marginLeft = L;
|
|
1441
|
+
this.res.style.marginTop = T;
|
|
1442
|
+
this.res.style.marginRight = R;
|
|
1443
|
+
this.res.style.marginBottom = B;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
if (!T && !R && !B){
|
|
1447
|
+
// alert("j")
|
|
1448
|
+
this.res.style.margin = L;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
return this;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
margin(direction, value){
|
|
1456
|
+
if (direction == "top"){
|
|
1457
|
+
this.res.style.marginTop = value;
|
|
1458
|
+
} else if (direction == "bottom"){
|
|
1459
|
+
this.res.style.marginBottom = value;
|
|
1460
|
+
}else if (direction == "left"){
|
|
1461
|
+
this.res.style.marginLeft = value;
|
|
1462
|
+
}else if (direction == "right"){
|
|
1463
|
+
this.res.style.marginRight = value;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
return this;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
headline() {
|
|
1470
|
+
this.em(4)
|
|
1471
|
+
this.font("Arial")
|
|
1472
|
+
this.bold()
|
|
1473
|
+
return this;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
caption() {
|
|
1477
|
+
this.bold();
|
|
1478
|
+
this.res.style.fontFamily = "Arial";
|
|
1479
|
+
this.color("gray");
|
|
1480
|
+
this.padding("top", 20);
|
|
1481
|
+
|
|
1482
|
+
this.res.style.fontSize = "1em";
|
|
1483
|
+
|
|
1484
|
+
// responsive font size
|
|
1485
|
+
|
|
1486
|
+
let mq = window.matchMedia("(max-device-width: 415px)");
|
|
1487
|
+
|
|
1488
|
+
if (mq.matches){
|
|
1489
|
+
this.res.style.fontSize = "2em";
|
|
1490
|
+
} else {
|
|
1491
|
+
this.res.style.fontSize = "1em";
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
return this;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
updating(obj, key) {
|
|
1499
|
+
|
|
1500
|
+
var copy = this.res;
|
|
1501
|
+
var txt = this.text;
|
|
1502
|
+
|
|
1503
|
+
Object.defineProperty(obj, key, {
|
|
1504
|
+
set(newVal) {
|
|
1505
|
+
// 22:01
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
// this.text
|
|
1509
|
+
// let node = document.createTextNode(`Pressed ${newVal}`);
|
|
1510
|
+
let node = document.createTextNode(txt.replace("$", newVal))
|
|
1511
|
+
copy.replaceChild(node, copy.childNodes[0]);
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
return this;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
style(st) {
|
|
1520
|
+
this.res.style.color = st.styles.color;
|
|
1521
|
+
this.res.style.fontWeight = st.styles.fontWeight;
|
|
1522
|
+
|
|
1523
|
+
this.res.style.paddingLeft = st.styles.padding[0];
|
|
1524
|
+
this.res.style.paddingTop = st.styles.padding[1];
|
|
1525
|
+
this.res.style.paddingRight = st.styles.padding[2];
|
|
1526
|
+
this.res.style.paddingBottom = st.styles.padding[3];
|
|
1527
|
+
|
|
1528
|
+
this.res.style.marginLeft = st.styles.margin[0];
|
|
1529
|
+
this.res.style.paddingTop = st.styles.margin[1];
|
|
1530
|
+
this.res.style.paddingRight = st.styles.margin[2];
|
|
1531
|
+
this.res.style.paddingBottom = st.styles.margin[3];
|
|
1532
|
+
|
|
1533
|
+
this.res.style.opacity = st.styles.opacity;
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
return this;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
applyStyle(w, style){
|
|
1541
|
+
|
|
1542
|
+
let query = window.matchMedia(`(max-width: ${w}px)`);
|
|
1543
|
+
if (query.matches){
|
|
1544
|
+
Object.assign(this.res.style, style.styles);
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
// // console.log(style.styles);
|
|
1548
|
+
return this;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
nextApply(arr){
|
|
1556
|
+
let queries = [];
|
|
1557
|
+
|
|
1558
|
+
let initStyle = this.res.style;
|
|
1559
|
+
|
|
1560
|
+
const change = (query) => {
|
|
1561
|
+
|
|
1562
|
+
if (queries[0].matches){
|
|
1563
|
+
//alert("FIRST")
|
|
1564
|
+
Object.assign(this.res.style, arr[0].styles);
|
|
1565
|
+
// // console.log("FIRST !");
|
|
1566
|
+
} else if (queries[1].matches){
|
|
1567
|
+
//alert("SECOND")
|
|
1568
|
+
Object.assign(this.res.style, arr[1].styles);
|
|
1569
|
+
// // console.log("SECOND !");
|
|
1570
|
+
} else {
|
|
1571
|
+
// alert("NO QUERY")
|
|
1572
|
+
Object.assign(this.res.style, arr[arr.length - 1].styles);
|
|
1573
|
+
// // console.log("NO MATCH !");
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
for (var i = 0; i < arr.length; i++) {
|
|
1579
|
+
let el = arr[i];
|
|
1580
|
+
|
|
1581
|
+
let query = window.matchMedia(`(min-width: ${el.min}px) and (max-width: ${el.max}px)`);
|
|
1582
|
+
queries.push(query);
|
|
1583
|
+
|
|
1584
|
+
queries[i].addListener(change)
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
change();
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
return this;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
apply(arr) {
|
|
1599
|
+
|
|
1600
|
+
var initStyle = this.res.styles;
|
|
1601
|
+
|
|
1602
|
+
const goThroughStyles = () => {
|
|
1603
|
+
for (var i = 0; i < arr.length; i++) {
|
|
1604
|
+
let el = arr[i];
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
if (el.min && el.max){
|
|
1608
|
+
let query = window.matchMedia(`(min-width: ${el.min}px) and (max-width: ${el.max}px)`);
|
|
1609
|
+
if (query.matches) {
|
|
1610
|
+
Object.assign(this.res.style, el.styles);
|
|
1611
|
+
} else {
|
|
1612
|
+
alert("YES min max, but does not match");
|
|
1613
|
+
Object.assign(this.res.style, initStyle);
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
} else {
|
|
1617
|
+
let query = window.matchMedia(`(max-width: ${el.max}px)`);
|
|
1618
|
+
if (query.matches) {
|
|
1619
|
+
Object.assign(this.res.style, el.styles);
|
|
1620
|
+
} else {
|
|
1621
|
+
//alert("nij")
|
|
1622
|
+
alert("NO min max, and does not match");
|
|
1623
|
+
Object.assign(this.res.style, initStyle);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
// setFirst
|
|
1630
|
+
/*let query = window.matchMedia(`(max-width: ${arr[0].width}px)`);
|
|
1631
|
+
if (!query.matches){
|
|
1632
|
+
Object.assign(this.res.style, arr[0].styles);
|
|
1633
|
+
}*/
|
|
1634
|
+
|
|
1635
|
+
goThroughStyles();
|
|
1636
|
+
window.addEventListener("resize", goThroughStyles); // never use "on" here. Will get overrwritten !
|
|
1637
|
+
return this;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
render(div) {
|
|
1641
|
+
|
|
1642
|
+
/*console.log("FINAL CSS");
|
|
1643
|
+
console.log(this.css[0].range);
|
|
1644
|
+
console.log(this.css[0].rules);
|
|
1645
|
+
console.log(this.elCSS);
|
|
1646
|
+
*/
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
/*
|
|
1650
|
+
render(el) {
|
|
1651
|
+
Array.from(this.res.children).forEach(e => e.style.padding = 0);
|
|
1652
|
+
Array.from(this.res.children).forEach(e => e.style.margin = 0);
|
|
1653
|
+
|
|
1654
|
+
if (el) {
|
|
1655
|
+
document.querySelector(el).appendChild(this.res);
|
|
1656
|
+
} else {
|
|
1657
|
+
return this.res;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
*/
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
//Array.from(this.res.children).forEach(e => e.style.padding = 0);
|
|
1665
|
+
//Array.from(this.res.children).forEach(e => e.style.margin = 0);
|
|
1666
|
+
|
|
1667
|
+
if (div) {
|
|
1668
|
+
if (this.options && this.options.id){
|
|
1669
|
+
this.res.setAttribute("id", this.options.id);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
document.querySelector(div).appendChild(this.res);
|
|
1673
|
+
} else {
|
|
1674
|
+
|
|
1675
|
+
return this.res;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
}
|
|
1685
|
+
export { Text };
|