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
|
@@ -0,0 +1,1005 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Wrapper extends Animator { // 12:10:02 found grep 06/03
|
|
6
|
+
constructor(obj) {
|
|
7
|
+
super();
|
|
8
|
+
this.res = null;
|
|
9
|
+
this.setup(obj); // 21:29:32 09/03/2024 Take on me!
|
|
10
|
+
this.code = [];
|
|
11
|
+
this.isLast = false;
|
|
12
|
+
|
|
13
|
+
this.code.push("\n new Wrapper() \n");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
isLasta(){
|
|
17
|
+
this.isLast = true;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toCode(){
|
|
22
|
+
return this.code;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
getType(){
|
|
27
|
+
return "LayoutWrapperElement"; // 224647
|
|
28
|
+
}
|
|
29
|
+
// 220543§§§§§§§§§§§§§§§§§§§§¨ú
|
|
30
|
+
setArea(area){
|
|
31
|
+
this.res.style.gridArea = area;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
removeQuotesFromFirstWord(jsonString) {
|
|
36
|
+
const modifiedJSON = jsonString.replace(/"([^"]+)":/g, '$1:');
|
|
37
|
+
return modifiedJSON;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
clicked(handler){
|
|
41
|
+
this.res.addEventListener("click", handler);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
gpos(obj){
|
|
46
|
+
//alert(obj.col);
|
|
47
|
+
this.res.style.gridColumn = obj.col;
|
|
48
|
+
this.res.style.gridRow = obj.row;
|
|
49
|
+
//this.res.style.border = "1px solid green";
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set(obj){
|
|
54
|
+
|
|
55
|
+
let stra = ".set({";
|
|
56
|
+
|
|
57
|
+
// ------
|
|
58
|
+
//obj.mc && (this.res.style.height = "minmax(400px, 1fr)");
|
|
59
|
+
//obj.mc && (this.res.style.height = "fit-content");
|
|
60
|
+
//obj.mc && (this.res.style.height = "max-content");
|
|
61
|
+
//obj.mc && (this.res.style.minHeight = "400px");
|
|
62
|
+
obj.pad && this.pad(obj.pad);
|
|
63
|
+
obj.arrpad && (stra += `pad: {sides: [${obj.arrpad.sides.map(x => `"${x}"`).join(", ")}], value: "${obj.arrpad.value}"}, `); // 2345 06/03
|
|
64
|
+
|
|
65
|
+
obj.gpos && this.gpos(obj.gpos);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
//const obj = options;
|
|
69
|
+
if (obj && obj.id && obj.stroke || obj && obj.id && obj.gradient || obj && obj.id && obj.span || obj && obj.id && obj.layout ){
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// use obj.range and obj.op
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
let first = obj.gradient;
|
|
77
|
+
|
|
78
|
+
if (obj.gradient){
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
this.globalGradient = obj.gradient.op.gradient;
|
|
83
|
+
// console.log(obj.gradient);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if (obj.stroke){
|
|
88
|
+
|
|
89
|
+
// console.warn("OAP");
|
|
90
|
+
// console.log(obj.stroke.op.color);
|
|
91
|
+
|
|
92
|
+
//super.setVar("1px yellow");
|
|
93
|
+
super.setAny({globalBlast: `${obj.stroke.op.width} ${obj.stroke.op.color}`});
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
//super.globalBlast = `1px solid yellow`;//`${obj.stroke.op.width} ${obj.stroke.op.color}`;
|
|
97
|
+
// console.warn("GBL")
|
|
98
|
+
// console.warn(super.globalBlast);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Filter just the elements with layout element
|
|
102
|
+
let ft = [obj.stroke, obj.gradient, obj.animation, obj.span, obj.layout]//obj.gradient.filter(el => el.op.name !== "layout");
|
|
103
|
+
// console.log(ft);
|
|
104
|
+
|
|
105
|
+
ft = ft.filter(el => el != undefined);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
let arr = [];
|
|
111
|
+
|
|
112
|
+
for (var i = 0; i < ft.length; i++){
|
|
113
|
+
// console.log("Hello");
|
|
114
|
+
arr.push({
|
|
115
|
+
range: ft[i].range,
|
|
116
|
+
log: ft[i].op.name,
|
|
117
|
+
target: ft[i].target
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Maybe just fill-in dynamically
|
|
122
|
+
/*let queries = [
|
|
123
|
+
{
|
|
124
|
+
range: obj.gradient[1].range, // This is BLAST
|
|
125
|
+
log: "blast"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
range: obj.gradient[2].range, // This is GRADIENT
|
|
129
|
+
log: "gradient"
|
|
130
|
+
}
|
|
131
|
+
];*/
|
|
132
|
+
|
|
133
|
+
// console.log("-----RDA----");
|
|
134
|
+
// console.log(arr);
|
|
135
|
+
// console.log(obj.id);
|
|
136
|
+
this.res.setAttribute("id", obj.id);
|
|
137
|
+
this.betaReact(arr, obj.id);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//-----
|
|
141
|
+
|
|
142
|
+
if (obj.socenter ){
|
|
143
|
+
this.res.style.display = "flex";
|
|
144
|
+
this.res.style.flexDirection = "column";
|
|
145
|
+
this.res.style.alignItems = "center";
|
|
146
|
+
|
|
147
|
+
obj.socenter && (stra += `socenter: ${obj.socenter},`); // 2345 06/03
|
|
148
|
+
|
|
149
|
+
// alert("P")
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
obj.mboth && (this.res.style.marginRight = "auto") && (this.res.style.marginLeft = "auto" );
|
|
153
|
+
|
|
154
|
+
obj.mar && this.mar(obj.mar); // has to be here
|
|
155
|
+
|
|
156
|
+
obj.sticky && this.sticky();
|
|
157
|
+
|
|
158
|
+
obj.transition && (this.res.style.transition = obj.transition);
|
|
159
|
+
|
|
160
|
+
obj.class && this.res.setAttribute("class", obj.class);
|
|
161
|
+
|
|
162
|
+
obj.ga && (this.res.style.gridArea = obj.ga);
|
|
163
|
+
|
|
164
|
+
if (obj.opacity) {
|
|
165
|
+
obj.opacity == 0 && (this.res.style.opacity = 0);
|
|
166
|
+
obj.opacity && (this.res.style.opacity = obj.opacity);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
obj.maxHeight && (this.res.style.maxHeight = obj.maxHeight);
|
|
170
|
+
|
|
171
|
+
obj.id && this.res.setAttribute("id", obj.id);
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
obj.arrpad && this.arrayPadding(obj.arrpad.sides, obj.arrpad.value);
|
|
175
|
+
obj.arrpad && (stra += `arrpad: {sides: [${obj.arrpad.sides.map(x => `"${x}"`).join(", ")}], value: "${obj.arrpad.value}"}, `); // 2345 06/03
|
|
176
|
+
|
|
177
|
+
obj.arrayMargin && this.arrayMargin(obj.arrayMargin.sides, obj.arrayMargin.value);
|
|
178
|
+
obj.arrayMargin && (stra += `\n arrayMargin: {sides: ["${obj.arrayMargin.sides}"], value: "${obj.arrayMargin.value}"},`); // 2345 06/03
|
|
179
|
+
// obj.arrpad && (stra += `arrpad: {sides: ["${obj.arrpad.sides}"], value: "${obj.arrpad.value}"}, `); // 2345 06/03
|
|
180
|
+
|
|
181
|
+
// COMMENTED OUT 08/01/2025
|
|
182
|
+
// obj.grow && (this.res.style.flexGrow = 1);
|
|
183
|
+
|
|
184
|
+
obj.center && this.toCenter(obj.center);
|
|
185
|
+
obj.center && (stra += `center: "${obj.center}",`);
|
|
186
|
+
|
|
187
|
+
obj.simpleCenter && this.simpleCenter();
|
|
188
|
+
obj.simpleCenter && (stra += `center: "${obj.simpleCenter}",`);
|
|
189
|
+
|
|
190
|
+
obj.filter && (this.res.style.backdropFilter = "blur(3px)"); // 002506 21/05 002945
|
|
191
|
+
obj.radius && this.corner(obj.radius);
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
obj.radius && (stra += `\n radius: "${obj.radius}",`);
|
|
195
|
+
obj.border && this.border(obj.border);
|
|
196
|
+
|
|
197
|
+
obj.simpleBorder && (this.res.style.border = obj.simpleBorder);
|
|
198
|
+
|
|
199
|
+
obj.width && this.width(obj.width);
|
|
200
|
+
obj.width && (stra += `\n width: "${obj.width}",`);
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
obj.overflow && (this.res.style.overflow = "hidden");
|
|
204
|
+
obj.overflow && (stra += `\n overflow: "${obj.overflow}",`);
|
|
205
|
+
|
|
206
|
+
obj.height && this.heightNoAuto(obj.height);
|
|
207
|
+
obj.height && (stra += `\n height: "${obj.height}",`);
|
|
208
|
+
|
|
209
|
+
obj.align && this.flexAlign(obj.align);
|
|
210
|
+
obj.align && (stra += `\n align: "${obj.align}",`);
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
if (obj.borderObj){
|
|
215
|
+
this.res.style.borderRight = `${obj.borderObj.width} solid ${obj.borderObj.color}`
|
|
216
|
+
this.res.style.borderRadius = obj.borderObj.radius;
|
|
217
|
+
|
|
218
|
+
/*borderObj: {
|
|
219
|
+
side: "all",
|
|
220
|
+
width: "3px",
|
|
221
|
+
color: "rgba(236, 227, 215, 0.5)"
|
|
222
|
+
},*/
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (obj.borderObja){
|
|
226
|
+
this.res.style.border = `${obj.borderObja.width} solid ${obj.borderObja.color}`
|
|
227
|
+
this.res.style.borderRadius = obj.borderObja.radius;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
obj.font && this.font(obj.font);
|
|
231
|
+
obj.font && (stra += `font: "${obj.font}",`);
|
|
232
|
+
obj.maxWidth && this.maxWidth(obj.maxWidth);
|
|
233
|
+
obj.flexCenter && this.flexc(obj.flexCenter);
|
|
234
|
+
obj.multipad && this.makeMultiPad(obj.multipad);
|
|
235
|
+
obj.multimargin && this.makeMultiMargin(obj.multimargin);
|
|
236
|
+
obj.color && this.color(obj.color);
|
|
237
|
+
obj.background && this.background(obj.background);
|
|
238
|
+
obj.background && (stra += `background: "${obj.background}",`);
|
|
239
|
+
|
|
240
|
+
obj.weight && this.weight(obj.weight);
|
|
241
|
+
obj.paddings && this.paddingo(obj.paddings);
|
|
242
|
+
|
|
243
|
+
obj.area && this.setArea(obj.area);
|
|
244
|
+
obj.area && (stra += `area: "${obj.area}"`);
|
|
245
|
+
obj.column && this.makeCol();
|
|
246
|
+
obj.column && (stra += `\n column: "${obj.column}",`);
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
obj.alignIts && (this.res.style.background = "gray");
|
|
250
|
+
obj.alignIts && (this.res.style.alignItems = "flex-start"/*obj.alignIts*/);
|
|
251
|
+
obj.alignIts && (this.res.style.justifyItems = "flex-start"/*obj.alignIts*/);
|
|
252
|
+
|
|
253
|
+
obj.customAlign && (this.res.style.alignItems = obj.customAlign);
|
|
254
|
+
obj.customJustify && (this.res.style.justifyItems = obj.customJustify);
|
|
255
|
+
obj.disp && (this.res.style.display = obj.disp);
|
|
256
|
+
obj.flexDir && (this.res.style.flexDirection = obj.flexDir);
|
|
257
|
+
obj.flexDir && (this.res.style.display = "flex");
|
|
258
|
+
obj.flexDir && (stra += `\n flexDir: "${obj.flexDir}",`)
|
|
259
|
+
|
|
260
|
+
obj.zIndex && (this.res.style.zIndex = obj.zIndex);
|
|
261
|
+
|
|
262
|
+
// obj.makeResponsiveBehaviour && obj.makeResponsiveBehaviour !== "undefined" && this.makeResponsiveBehaviour(obj.makeResponsiveBehaviour);
|
|
263
|
+
obj.name && (this.name = obj.name)
|
|
264
|
+
obj.responsive && this.rsp(obj.responsive);
|
|
265
|
+
|
|
266
|
+
/*if (obj.makeResponsiveBehaviour){
|
|
267
|
+
stra += `\n makeResponsiveBehaviour: "${obj.makeResponsiveBehaviour}",`
|
|
268
|
+
}*/ // 08/01/2025 COMEMMENTED OUT
|
|
269
|
+
|
|
270
|
+
if (obj.stretch){
|
|
271
|
+
obj.stretch && this.stretch(obj.stretch);
|
|
272
|
+
let stringified = this.removeQuotesFromFirstWord(JSON.stringify(obj.stretch));
|
|
273
|
+
stra += `\n stretch: ${stringified},`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
for (let prop in obj) {
|
|
280
|
+
if (prop === 'margin') {
|
|
281
|
+
let paddingValues = obj[prop];
|
|
282
|
+
if (Array.isArray(paddingValues) && paddingValues.length > 0) {
|
|
283
|
+
|
|
284
|
+
for (let pado of paddingValues){
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
let paddingObject = pado;// paddingValues[0]; // Assuming only one object in the array
|
|
288
|
+
if (paddingObject.hasOwnProperty('top')) {
|
|
289
|
+
this.res.style.marginTop = paddingObject['top'];
|
|
290
|
+
}
|
|
291
|
+
if (paddingObject.hasOwnProperty('right')) {
|
|
292
|
+
//alert("P")
|
|
293
|
+
this.res.style.marginRight = paddingObject['right'];
|
|
294
|
+
}
|
|
295
|
+
if (paddingObject.hasOwnProperty('bottom')) {
|
|
296
|
+
// alert("P")
|
|
297
|
+
this.res.style.marginBottom = paddingObject['bottom'];
|
|
298
|
+
}
|
|
299
|
+
if (paddingObject.hasOwnProperty('left')) {
|
|
300
|
+
this.res.style.marginLeft = paddingObject['left'];
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
stra += "})\n";
|
|
312
|
+
|
|
313
|
+
if (stra.length === 8){
|
|
314
|
+
stra = "";
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
this.code.push(stra);
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* after(obj){ DEAD CODE 08/01/2025
|
|
322
|
+
|
|
323
|
+
const res = () => {
|
|
324
|
+
let id = document.querySelector(obj.move.id);
|
|
325
|
+
let to = document.querySelector(obj.move.to);
|
|
326
|
+
|
|
327
|
+
if (window.innerWidth >= 700){
|
|
328
|
+
to.appendChild(id);
|
|
329
|
+
//alert("O")
|
|
330
|
+
} else {
|
|
331
|
+
let parent = document.querySelector("#inner");
|
|
332
|
+
let subtitle = document.querySelector("#subtitle");
|
|
333
|
+
let title = document.querySelector("#title");
|
|
334
|
+
console.warn(parent);
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
parent.insertBefore(title, subtitle); // 21:13:39 23/03/24 Nice!!!
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
window.addEventListener("resize", res);
|
|
343
|
+
res();
|
|
344
|
+
}*/
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
rsp(obj){
|
|
348
|
+
|
|
349
|
+
this.res.style.display = "flex";
|
|
350
|
+
|
|
351
|
+
let split = obj.sequence.split("-"); // obj.split("-");
|
|
352
|
+
//console.log("Hello " + this.name);
|
|
353
|
+
//console.log(split);
|
|
354
|
+
|
|
355
|
+
// They should switch colours
|
|
356
|
+
const react = () => { // 22/03/2024 21:34:11 Nice!!!
|
|
357
|
+
let queries = obj.ranges; //["0px", "700px", "1200px", "1400px"];
|
|
358
|
+
//this.res.style.alignItems = "";
|
|
359
|
+
//this.res.style.justifyContent = "";
|
|
360
|
+
|
|
361
|
+
if (queries[0] !== "0px"){
|
|
362
|
+
queries.unshift("0px");
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
//console.log("QAB");
|
|
367
|
+
//console.log(queries);
|
|
368
|
+
|
|
369
|
+
for (var i = 0; i < queries.length - 1; i++) { // this has two elements
|
|
370
|
+
let mq = window.matchMedia(`(min-width: ${queries[i]}) and (max-width: ${queries[i + 1]})`).matches;
|
|
371
|
+
|
|
372
|
+
if (mq) {
|
|
373
|
+
// console.log("AFTER REFRESH MATCH " + split[i] + "AT: " + queries[i] + " - " + queries[i + 1]);
|
|
374
|
+
|
|
375
|
+
if (split[i] === "row"){
|
|
376
|
+
this.res.style.flexDirection = "row";
|
|
377
|
+
///this.res.style.alignItems = "flex-end";
|
|
378
|
+
this.res.style.border = "3px solid green";
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (split[i] === "col"){
|
|
382
|
+
this.res.style.flexDirection = "column";
|
|
383
|
+
// this.res.style.justifyContent = "flex-start";
|
|
384
|
+
this.res.style.border = "3px solid purple";
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
} else {
|
|
388
|
+
let allQ = window.matchMedia(`(min-width: ${queries[queries.length - 1]})`);
|
|
389
|
+
if (allQ.matches){
|
|
390
|
+
// alert("OKAY");
|
|
391
|
+
|
|
392
|
+
if (split[i] === "row"){
|
|
393
|
+
this.res.style.flexDirection = "row";
|
|
394
|
+
///this.res.style.alignItems = "flex-end";
|
|
395
|
+
this.res.style.border = "3px solid green";
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (split[i] === "col"){
|
|
399
|
+
this.res.style.flexDirection = "column";
|
|
400
|
+
// this.res.style.justifyContent = "flex-start";
|
|
401
|
+
this.res.style.border = "3px solid purple";
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
window.addEventListener("resize", react);
|
|
410
|
+
react();
|
|
411
|
+
}
|
|
412
|
+
// 08/01/2025 COMMENTED OUT
|
|
413
|
+
/* makeResponsiveBehaviour(obj){ // 16:20:05 21/03/24 it works!!! CHECK THIS !!!
|
|
414
|
+
console.log("LOOK");
|
|
415
|
+
console.warn(obj);
|
|
416
|
+
let split = obj.split("-");
|
|
417
|
+
|
|
418
|
+
console.log(split);
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
// Just call responsiveBehaviour and JSON.stringfy(obj) and add to code
|
|
422
|
+
const react = () => {
|
|
423
|
+
|
|
424
|
+
let queries = ["700px", "1200px", "1400px"];
|
|
425
|
+
for (var i = 0; i < queries.length; i++) { // this has two elements
|
|
426
|
+
//console.log("SI: " + split[i]);
|
|
427
|
+
|
|
428
|
+
console.log("AFTER REFRESH")
|
|
429
|
+
let mq = window.matchMedia(`(max-width: ${queries[i]})`).matches;
|
|
430
|
+
// query = 700px;
|
|
431
|
+
|
|
432
|
+
// for (var j = 0; j < split.length; j++) {
|
|
433
|
+
|
|
434
|
+
console.log("Working... " + queries[i] + " " + split[i] + " ms " + mq);
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
// If we are under 700px use the first query
|
|
439
|
+
if (mq) {
|
|
440
|
+
console.log("AFTER REFRESH MATCH")
|
|
441
|
+
if (split[i] === "row"){ // can be a row
|
|
442
|
+
//alert("PP");
|
|
443
|
+
console.warn("Going to row");
|
|
444
|
+
this.res.style.display = "flex";
|
|
445
|
+
this.res.style.flexDirection = "column";
|
|
446
|
+
this.res.style.border = "3px solid pink";
|
|
447
|
+
this.res.style.background = "pink";
|
|
448
|
+
this.res.style.alignItems = "flex-end";
|
|
449
|
+
} else { // or a column
|
|
450
|
+
console.warn("Going to column");
|
|
451
|
+
this.res.style.display = "flex";
|
|
452
|
+
this.res.style.flexDirection = "row";
|
|
453
|
+
this.res.style.background = "green";
|
|
454
|
+
this.res.style.border = "3px solid yellow";
|
|
455
|
+
this.res.style.justifyContent = "flex-end";
|
|
456
|
+
this.res.style.alignItems = "flex-start";
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
this.res.style.display = "flex";
|
|
460
|
+
this.res.style.flexDirection = "row";
|
|
461
|
+
this.res.style.background = "green";
|
|
462
|
+
this.res.style.border = "3px solid orange";
|
|
463
|
+
this.res.style.justifyContent = "flex-start";
|
|
464
|
+
this.res.style.alignItems = "flex-start";
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
window.addEventListener("resize", react);
|
|
470
|
+
react();
|
|
471
|
+
|
|
472
|
+
return this;
|
|
473
|
+
} */
|
|
474
|
+
|
|
475
|
+
sticky(){ // keep both!
|
|
476
|
+
this.res.style.position = "sticky";
|
|
477
|
+
this.res.style.top = 0;
|
|
478
|
+
return this;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
toSticky(){ // keep both!
|
|
482
|
+
this.res.style.position = "sticky";
|
|
483
|
+
this.res.style.top = "0";
|
|
484
|
+
return this;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
stretch(obj){
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
const match = () => {
|
|
491
|
+
|
|
492
|
+
let query = window.matchMedia(`(max-width: ${obj.at})`);
|
|
493
|
+
if (query.matches){
|
|
494
|
+
//alert("IN");
|
|
495
|
+
this.res.style.width = "auto";
|
|
496
|
+
} else {
|
|
497
|
+
|
|
498
|
+
let mobileMedia = window.matchMedia(`(max-device-width: 415px)`);
|
|
499
|
+
|
|
500
|
+
if (mobileMedia.matches){
|
|
501
|
+
this.res.style.width = "100%"; //"30%"; // 120446 back
|
|
502
|
+
// Okay 14:43:30
|
|
503
|
+
} else {
|
|
504
|
+
this.res.style.width = obj.backTo; //"30%"; // 120446 back
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
match();
|
|
511
|
+
window.addEventListener("resize", match);
|
|
512
|
+
// last
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
makeCol(){
|
|
517
|
+
this.res.style.display = "flex";
|
|
518
|
+
this.res.style.flexDirection = "column";
|
|
519
|
+
this.res.style.alignItems = "flex-start";
|
|
520
|
+
return this;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/*
|
|
524
|
+
align(val){
|
|
525
|
+
alert("KK");
|
|
526
|
+
this.res.style.display = "flex";
|
|
527
|
+
this.res.style.flexDirection = "column";
|
|
528
|
+
this.res.style.alignItems = "center";
|
|
529
|
+
return this;
|
|
530
|
+
}*/
|
|
531
|
+
|
|
532
|
+
paddingo(el){
|
|
533
|
+
this.res.style.padding = el;
|
|
534
|
+
return this;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
toCenter(dir){
|
|
539
|
+
this.res.style.display = "flex";
|
|
540
|
+
this.res.style.flexDirection = "column";
|
|
541
|
+
this.res.style.justifyContent = "center";
|
|
542
|
+
|
|
543
|
+
if (dir === "both"){
|
|
544
|
+
this.res.style.alignItems = "center";
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return this;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
simpleCenter(){
|
|
551
|
+
this.res.style.justifyContent = "center";
|
|
552
|
+
this.res.style.justifyItems = "center";
|
|
553
|
+
this.res.style.alignContent = "center";
|
|
554
|
+
this.res.style.alignItems = "center";
|
|
555
|
+
return this;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
color(cl){
|
|
561
|
+
this.res.style.color = cl;
|
|
562
|
+
return this;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
weight(w){
|
|
566
|
+
this.res.style.fontWeight = w;
|
|
567
|
+
return this;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
makeMultiPad(obj){
|
|
571
|
+
|
|
572
|
+
for (var i = 0; i < obj.length; i++){
|
|
573
|
+
if (obj[i].side === "left"){
|
|
574
|
+
|
|
575
|
+
this.res.style.paddingLeft = obj[i].value;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (obj[i].side === "right"){
|
|
579
|
+
this.res.style.paddingRight = obj[i].value;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return this;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
makeMultiMargin(obj){ // 11:22:52
|
|
587
|
+
this.res.style.zIndex = "1";
|
|
588
|
+
|
|
589
|
+
for (var i = 0; i < obj.length; i++){
|
|
590
|
+
if (obj[i].side === "left"){
|
|
591
|
+
this.res.style.marginLeft = obj[i].value;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (obj[i].side === "right"){
|
|
595
|
+
this.res.style.marginRight = obj[i].value;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (obj[i].side === "top"){
|
|
599
|
+
this.res.style.marginTop = obj[i].value;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (obj[i].side === "bottom"){
|
|
603
|
+
this.res.style.marginBottom = obj[i].value;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
flexc(obj){
|
|
611
|
+
this.res.style.display = "flex";
|
|
612
|
+
this.res.style.flexDirection = "column";
|
|
613
|
+
this.res.style.justifyContent = "center";
|
|
614
|
+
return this;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
maxWidth(w){
|
|
618
|
+
this.res.style.maxWidth = w;
|
|
619
|
+
return this;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
font(font){
|
|
623
|
+
this.res.style.fontFamily = font;
|
|
624
|
+
return this;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
flexAlign(perc){
|
|
628
|
+
this.res.style.display = "flex";
|
|
629
|
+
this.res.style.justifyContent = "flex-start";
|
|
630
|
+
this.res.style.alignItems = "flex-start";
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
if (perc === "center"){
|
|
634
|
+
|
|
635
|
+
this.res.style.display = "flex";
|
|
636
|
+
this.res.style.flexDirection = "column";
|
|
637
|
+
this.res.style.alignItems = "center";
|
|
638
|
+
return this;
|
|
639
|
+
|
|
640
|
+
}
|
|
641
|
+
return this;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
width(perc){
|
|
645
|
+
this.res.style.width = perc;
|
|
646
|
+
return this;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
heightNoAuto(perc){
|
|
650
|
+
this.res.style.height = perc;
|
|
651
|
+
return this;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
border(obj){
|
|
655
|
+
this.res.style.borderRadius = `${obj.radius}px`;
|
|
656
|
+
this.res.style.padding = "0.25em";
|
|
657
|
+
this.res.style.border = `${obj.width}px solid ${obj.color}`;
|
|
658
|
+
return this;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
toCol(){
|
|
663
|
+
this.res.style.display = "flex";
|
|
664
|
+
this.res.style.flexDirection = "column";
|
|
665
|
+
this.res.style.justifyContent = "center";
|
|
666
|
+
this.res.style.alignItems = "center";
|
|
667
|
+
return this;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
add(els){
|
|
672
|
+
this.items = els;
|
|
673
|
+
this.code.push(".add([ \n");
|
|
674
|
+
|
|
675
|
+
/*console.log("TOCODER")
|
|
676
|
+
console.log(els);
|
|
677
|
+
console.log(els.map(e => e.toCode));
|
|
678
|
+
console.log(els.filter(e => e.toCode != undefined));
|
|
679
|
+
*/
|
|
680
|
+
// let finalCodea = els.filter(el => el.toCode != undefined);
|
|
681
|
+
let finalCode = els//finalCodea
|
|
682
|
+
.map((el, i) => el
|
|
683
|
+
.toCode()
|
|
684
|
+
.flatMap(l => l)
|
|
685
|
+
.join("") + (i < els.length - 1 ? "," : ""))
|
|
686
|
+
|
|
687
|
+
.join("");
|
|
688
|
+
|
|
689
|
+
this.code.push(finalCode);
|
|
690
|
+
|
|
691
|
+
for (var i = 0; i < els.length; i++){
|
|
692
|
+
if (els[i] !== undefined && els[i].toCode !== undefined){
|
|
693
|
+
let item = els[i].render();//.render();
|
|
694
|
+
this.res.appendChild(item);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
//122616 06/03 Houdini M2 chip
|
|
699
|
+
this.code.push("])");
|
|
700
|
+
return this;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
arrayPadding(arr, value) {
|
|
706
|
+
|
|
707
|
+
if (arr.includes("left")){
|
|
708
|
+
this.res.style.paddingLeft = value;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
if (arr.includes("right")){
|
|
712
|
+
this.res.style.paddingRight = value;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
if (arr.includes("top")){
|
|
716
|
+
this.res.style.paddingTop = value;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if (arr.includes("bottom")){
|
|
720
|
+
|
|
721
|
+
this.res.style.paddingBottom = value;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
return this;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
arrayMargin(arr, value) {
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
if (!value){ // LTRB
|
|
734
|
+
this.res.style.marginLeft = `${arr[0]}px`;
|
|
735
|
+
this.res.style.marginTop = `${arr[1]}px`;
|
|
736
|
+
this.res.style.marginRight = `${arr[2]}px`;
|
|
737
|
+
this.res.style.marginBottom = `${arr[3]}px`;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
if (arr.includes("left")){
|
|
743
|
+
this.res.style.marginLeft = value;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (arr.includes("right")){
|
|
747
|
+
this.res.style.marginRight = value;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (arr.includes("top")){
|
|
751
|
+
this.res.style.marginTop = value;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (arr.includes("bottom")){
|
|
755
|
+
this.res.style.marginBottom = value;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
return this;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
setWidth(w){
|
|
765
|
+
this.res.style.width = "100vw";
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
setHeight(w){
|
|
769
|
+
this.res.style.height = `${w}`;
|
|
770
|
+
return this;
|
|
771
|
+
}
|
|
772
|
+
// 2 commas with 1 not here
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
/*toZStack(){
|
|
776
|
+
this.res.style.display = "grid";
|
|
777
|
+
let st = this.res.style;
|
|
778
|
+
|
|
779
|
+
this.res.style.display = "flex";
|
|
780
|
+
st.justifyContent = "center";
|
|
781
|
+
st.alignItems = "center";
|
|
782
|
+
}*/
|
|
783
|
+
|
|
784
|
+
setup(options) {
|
|
785
|
+
// console.log("ILS");
|
|
786
|
+
// console.log(options);
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
let container = options ? document.createElement(options.isLink ? "a" : "div") :document.createElement("div") ;
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
if (options && options.isLink){
|
|
793
|
+
container.style.textDecoration = "none";
|
|
794
|
+
container.setAttribute("href", options.child);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
this.res = container;
|
|
798
|
+
this.res.style.margin = 0;
|
|
799
|
+
this.res.style.padding = 0;
|
|
800
|
+
|
|
801
|
+
if (options && options.hideOverflow === true){
|
|
802
|
+
this.res.style.overflow = "hidden";
|
|
803
|
+
this.res.style.overflowY = "scroll";
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
if (options && options.center === true){
|
|
807
|
+
this.res.style.display = "flex";
|
|
808
|
+
this.res.style.flexDirection = "column";
|
|
809
|
+
this.res.style.justifyContent = "center";
|
|
810
|
+
this.res.style.alignItems = "center";
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
if (options && options.align === "left"){
|
|
814
|
+
this.res.style.alignItems = "flex-start";
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (options && options.align === "right"){
|
|
818
|
+
this.res.style.alignItems = "flex-end";
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
if (options && options.height){
|
|
822
|
+
this.res.style.height = options.height;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
if (options && options.width) {
|
|
827
|
+
this.res.style.width = options.width;
|
|
828
|
+
this.res.style.marginLeft = "auto";
|
|
829
|
+
this.res.style.marginRight = "auto";
|
|
830
|
+
|
|
831
|
+
let phone = window.matchMedia("(max-device-width: 415px)");
|
|
832
|
+
|
|
833
|
+
if (phone.matches) {
|
|
834
|
+
this.res.style.width = "95%";
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
return this;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
// 22:39:02 15/03/2024 window.addEveventListener("resize", () => {}, "immediatelly");
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
height(h){
|
|
846
|
+
this.res.style.width = "auto";
|
|
847
|
+
this.res.style.height = `${h}`;
|
|
848
|
+
return this;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
size(w, h){
|
|
852
|
+
this.w = w;
|
|
853
|
+
this.h = h;
|
|
854
|
+
|
|
855
|
+
if (this.w){
|
|
856
|
+
this.res.style.width = this.w;
|
|
857
|
+
} else {
|
|
858
|
+
this.res.style.width = window.innerWidth;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if (this.h){
|
|
862
|
+
this.res.style.height = this.h;
|
|
863
|
+
} else {
|
|
864
|
+
this.res.style.height = window.innerHeight;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
return this;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
background(color) {
|
|
872
|
+
this.res.style.background = color;
|
|
873
|
+
return this;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
corner(corner) {
|
|
877
|
+
// alert("Corner!");
|
|
878
|
+
this.res.style.borderRadius = corner;
|
|
879
|
+
return this;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
padding(L, T, R, B){
|
|
883
|
+
this.res.style.paddingLeft = L;
|
|
884
|
+
this.res.style.paddingTop = T;
|
|
885
|
+
this.res.style.paddingRight = R;
|
|
886
|
+
this.res.style.paddingBottom = B;
|
|
887
|
+
return this;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
margin(L, T, R, B){
|
|
891
|
+
this.res.style.marginLeft = L;
|
|
892
|
+
this.res.style.marginTop = T;
|
|
893
|
+
this.res.style.marginRight = R;
|
|
894
|
+
this.res.style.marginBottom = B;
|
|
895
|
+
return this;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
itemWidth(w){
|
|
899
|
+
for (var i = 0; i < this.res.childNodes.length; i++){
|
|
900
|
+
let el = this.res.childNodes[i];
|
|
901
|
+
el.style.width = w;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
return this;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
apply(arr) {
|
|
909
|
+
const goThroughStyles = () => {
|
|
910
|
+
for (var i = 0; i < arr.length; i++) {
|
|
911
|
+
let el = arr[i];
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
let query = window.matchMedia(`(max-width: ${el.width}px)`);
|
|
916
|
+
if (el.device){
|
|
917
|
+
query = window.matchMedia(`(max-device-width: ${el.width}px)`);
|
|
918
|
+
alert(el.device);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
if (query.matches) {
|
|
924
|
+
Object.assign(this.res.style, el.styles);
|
|
925
|
+
// alert(el.style.styles.color);
|
|
926
|
+
} else {
|
|
927
|
+
//Object.assign(this.res.style, arr[0].styles);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// setFirst
|
|
933
|
+
let query = window.matchMedia(`(max-width: ${arr[0].width}px)`);
|
|
934
|
+
|
|
935
|
+
if (arr[0].device){
|
|
936
|
+
query = window.matchMedia(`(max-device-width: ${arr[0].width}px)`);
|
|
937
|
+
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
if (!query.matches){
|
|
941
|
+
Object.assign(this.res.style, arr[0].styles);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
goThroughStyles();
|
|
945
|
+
window.addEventListener("resize", goThroughStyles);
|
|
946
|
+
return this;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
/*intoJSXO(obj){
|
|
958
|
+
return <div ref={ref => {
|
|
959
|
+
ref && ref.appendChild(obj)
|
|
960
|
+
}} />;
|
|
961
|
+
return this;
|
|
962
|
+
}*/
|
|
963
|
+
|
|
964
|
+
mount(el){
|
|
965
|
+
document.querySelector(el).appendChild(this.res);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
render(el) {
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
/* if (this.isLast){
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
// this.code.push("]);\n");
|
|
976
|
+
this.code.push(`.render("#mount"); \n`);
|
|
977
|
+
|
|
978
|
+
} else {
|
|
979
|
+
this.code.push(",\n");
|
|
980
|
+
}
|
|
981
|
+
*/
|
|
982
|
+
|
|
983
|
+
if (el) {
|
|
984
|
+
let r = document.querySelector("#mount");
|
|
985
|
+
|
|
986
|
+
document.querySelector(el).appendChild(this.res);
|
|
987
|
+
return this;
|
|
988
|
+
} else {
|
|
989
|
+
return this.res;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
export { Wrapper };
|