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/image.js
ADDED
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Image extends Animator {
|
|
5
|
+
constructor(url, type, mode, gcs) {
|
|
6
|
+
super();
|
|
7
|
+
this.url = url;
|
|
8
|
+
this.res = null;
|
|
9
|
+
this.code = [];
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/* if (type == "exact" || type == "uncover"){
|
|
13
|
+
this.image(this.url, mode, type, "a", gcs);
|
|
14
|
+
} else {
|
|
15
|
+
this.setup();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if (type === "exact"){ // Has to be there
|
|
20
|
+
const str = `new Image("${this.url}", "exact")`;
|
|
21
|
+
this.code.push(str);
|
|
22
|
+
} else if (type === "uncover"){ // Has to be there
|
|
23
|
+
const str = `new Image("${this.url}", "uncover")`;
|
|
24
|
+
this.code.push(str);
|
|
25
|
+
} else {
|
|
26
|
+
this.code.push(`new Image('${this.url}')`);
|
|
27
|
+
}*/
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
removeQuotesFromFirstWord(jsonString) {
|
|
31
|
+
const modifiedJSON = jsonString.replace(/"([^"]+)":/g, '$1:');
|
|
32
|
+
return modifiedJSON;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setType({url, type, mode}){
|
|
36
|
+
//alert("Thrice?");
|
|
37
|
+
|
|
38
|
+
this.code = [];
|
|
39
|
+
|
|
40
|
+
if (type === "exact"){ // Has to be there
|
|
41
|
+
const str = `new Image("${this.url}", "exact")`;
|
|
42
|
+
this.code.push(str);
|
|
43
|
+
} else if (type === "uncover"){ // Has to be there
|
|
44
|
+
const str = `new Image("${this.url}", "uncover")`;
|
|
45
|
+
this.code.push(str);
|
|
46
|
+
} else {
|
|
47
|
+
this.code.push(`new Image('${this.url}')`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
this.image(this.url, mode, type);
|
|
51
|
+
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
flexOne(){
|
|
56
|
+
this.res.style.flex = "1";
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
hand(){
|
|
61
|
+
this.res.style.cursor = "hand";
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// Just for visual
|
|
68
|
+
setGridWithoutCode(){
|
|
69
|
+
this.res.style.border = "1px solid white";
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
maxWidth(w){
|
|
75
|
+
this.res.style.maxWidth = w;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
getHeight(){
|
|
81
|
+
// // console.log(this.res.height);
|
|
82
|
+
return this.res.height;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getWidth(){
|
|
86
|
+
// // console.log(this.res.width);
|
|
87
|
+
return this.res.width;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getType(){ // 114145 anchor
|
|
91
|
+
return "HTMLImageElement";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/*toCode(){
|
|
95
|
+
return this.code;
|
|
96
|
+
}*/
|
|
97
|
+
|
|
98
|
+
toCode() {
|
|
99
|
+
// Capture the style properties applied to the image
|
|
100
|
+
let styles = this.options;
|
|
101
|
+
if (this.res.style.border) {
|
|
102
|
+
styles.border = this.res.style.border;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const cleanedObj = Object.fromEntries(
|
|
106
|
+
Object.entries(styles).filter(([key, value]) => value !== null)
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Generate the code representation (was styles)
|
|
110
|
+
return [`new Image().set(${JSON.stringify(cleanedObj, null, 2).replace(/"(\w+)"\s*:/g, '$1:')})`];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Utility method to format object strings and remove quotes from keys
|
|
114
|
+
formatObj(obj) {
|
|
115
|
+
// Use JSON.stringify to get a string with indentation
|
|
116
|
+
let jsonString = JSON.stringify(obj, null, 2);
|
|
117
|
+
|
|
118
|
+
// Remove quotes around object keys using regex
|
|
119
|
+
return jsonString.replace(/"(\w+)"\s*:/g, '$1:');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
set(options){
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
let stra = ""
|
|
126
|
+
|
|
127
|
+
this.options = options;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
let type = options.isFull;
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
// options.isFull && (stra += `\n isFull: "${options.isFull}",`);
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if (type){
|
|
140
|
+
this.image(options.url, "exact", type, "a");
|
|
141
|
+
} else {
|
|
142
|
+
this.setup();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
options.url && this.res.setAttribute("src", options.url);
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
// alert("Thrice?");
|
|
150
|
+
|
|
151
|
+
if (type === "exact"){ // Has to be there
|
|
152
|
+
const str = `new Image("${this.url}", "exact")`;
|
|
153
|
+
// this.code.push(str);
|
|
154
|
+
} else if (type === "uncover"){ // Has to be there
|
|
155
|
+
const str = `new Image("${this.url}", "uncover")`;
|
|
156
|
+
//this.code.push(str);
|
|
157
|
+
} else {
|
|
158
|
+
// this.code.push(`new Image('${this.url}')`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
options.vtn && (this.res.style.viewTransitionName = options.vtn);
|
|
178
|
+
this.vtn = options.vtn;
|
|
179
|
+
|
|
180
|
+
options.minHeight && (this.res.style.minHeight = options.minHeight);
|
|
181
|
+
|
|
182
|
+
options.index && super.setIndex(options.index);
|
|
183
|
+
options.index && (this.index = options.index);
|
|
184
|
+
options.index && (stra += `\n index: "${options.index}",`);
|
|
185
|
+
|
|
186
|
+
/*if (options.index === 0){ // condition no fire
|
|
187
|
+
//alert("not written here");
|
|
188
|
+
stra += `\n index: "0",`;
|
|
189
|
+
}*/
|
|
190
|
+
|
|
191
|
+
if (options.centerSelf){
|
|
192
|
+
this.res.style.marginRight = "auto";
|
|
193
|
+
this.res.style.marginLeft = "auto";
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (options.fitContent){
|
|
197
|
+
(this.res.style.width = "100%");
|
|
198
|
+
(this.res.style.height = "100%");
|
|
199
|
+
(this.res.style.marginRight = "auto");
|
|
200
|
+
(this.res.style.marginTop = "auto");
|
|
201
|
+
(this.res.style.objectFit = "cover");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
options.objectFit && (this.res.style.objectFit = /*"cover")*/ options.objectFit);
|
|
205
|
+
options.objectFit && (stra += `\n objectFit: "${options.objectFit}",`);
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
options.as && this.as(options.as);
|
|
209
|
+
|
|
210
|
+
options.onScroll && this.onScroll(options.onScroll);
|
|
211
|
+
// options.fitContent && (this.res.style.objectFit = "contain");
|
|
212
|
+
|
|
213
|
+
options.class && (this.res.setAttribute("class", options.class));
|
|
214
|
+
|
|
215
|
+
options.gpos && (this.gposObject = options.gpos);
|
|
216
|
+
|
|
217
|
+
if (options.gpos){
|
|
218
|
+
this.res.style.gridColumn = options.gpos.col;
|
|
219
|
+
this.res.style.gridRow = options.gpos.row;
|
|
220
|
+
|
|
221
|
+
stra += `\n gpos: ${this.removeQuotesFromFirstWord(JSON.stringify(options.gpos))}, `;
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
// options.gpos && alert(this.gposObject);
|
|
225
|
+
|
|
226
|
+
/*if (Object.keys(options).length > 0){
|
|
227
|
+
this.code.push(`\n .set({ \n}`);
|
|
228
|
+
}*/
|
|
229
|
+
|
|
230
|
+
// console.log(options);
|
|
231
|
+
|
|
232
|
+
//const opts = optsa.filter(el => el.op.name === "blast")[0];
|
|
233
|
+
// let filterObject = this.options.filtera.filter(a => a.op.name === "filter")[0];
|
|
234
|
+
// // console.log(filterObject);
|
|
235
|
+
|
|
236
|
+
if (options.filtera){ // smoke
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
let noiseObject;
|
|
241
|
+
|
|
242
|
+
if (Array.isArray(options.filtera)){
|
|
243
|
+
noiseObject = obj.filtera.filter(a => a.op.name === "filter")[0];
|
|
244
|
+
} else {
|
|
245
|
+
noiseObject = options.filtera;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// console.log("OPTAAA");
|
|
249
|
+
// console.warn(noiseObject);
|
|
250
|
+
// console.log(noiseObject.op.filter);
|
|
251
|
+
|
|
252
|
+
// this.setFilter(noiseObject);
|
|
253
|
+
|
|
254
|
+
let removed = this.removeQuotesFromFirstWord(JSON.stringify(noiseObject));
|
|
255
|
+
(stra += `\n filtera: ${removed}, \n`); // If I comment this out the filter should disappear!
|
|
256
|
+
|
|
257
|
+
// Relief... shadow and span works whe copied, but stroke and filter does not
|
|
258
|
+
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
//options.filter && (this.res.style.filter = options.filter);
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
options.keySet && this.keySet(options.keySet);
|
|
267
|
+
|
|
268
|
+
options.stype && this.setType(options.stype);
|
|
269
|
+
|
|
270
|
+
options.isBackground && (this.isBackground = options.isBackground);
|
|
271
|
+
|
|
272
|
+
options.zIndex && (this.res.style.zIndex = options.zIndex);
|
|
273
|
+
options.zIndex && (stra += `\n zIndex: "${options.zIndex}", \n`);
|
|
274
|
+
|
|
275
|
+
options.id && this.res.setAttribute("id", options.id);
|
|
276
|
+
options.id && (stra += ` id: "${options.id}", \n`);
|
|
277
|
+
this.id = options.id;
|
|
278
|
+
options.area && this.setArea(options.area);
|
|
279
|
+
options.area && (stra += `area: "${options.area}", \n`);
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
options.opacity && (this.res.style.opacity = options.opacity);
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
// alert(options.height);
|
|
286
|
+
options.width && (this.res.style.width = options.width);
|
|
287
|
+
options.width && (stra += `width: "${options.width}", `);
|
|
288
|
+
|
|
289
|
+
options.maxWidth && (this.res.style.maxWidth = options.maxWidth);
|
|
290
|
+
options.maxWidth && (stra += `maxWidth: "${options.maxWidth}", `);
|
|
291
|
+
|
|
292
|
+
options.height && (this.res.style.height = options.height);
|
|
293
|
+
options.height && (stra += `height: "${options.height}", `);
|
|
294
|
+
|
|
295
|
+
options.multimargin && this.makeMultiMargin(options.multimargin);
|
|
296
|
+
//options.multimargin && this.code.push(`multimargin: [\n`);
|
|
297
|
+
options.multimargin && (stra += `multimargin: [ \n`);
|
|
298
|
+
|
|
299
|
+
// Seascape add 12/07/23
|
|
300
|
+
options.arrayMargin && this.arrayMargin(options.arrayMargin.sides, options.arrayMargin.value);
|
|
301
|
+
|
|
302
|
+
if (options.multimargin){
|
|
303
|
+
for (var i = 0; i < options.multimargin.length; i++){
|
|
304
|
+
const mer = options.multimargin[i];
|
|
305
|
+
stra += `{side: "${mer.side}", value: "${mer.value}"}, \n`;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
stra += `], \n`;
|
|
309
|
+
// this.code.push(`], \n`);
|
|
310
|
+
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
options.maxWidth && this.maxWidth(options.maxWidth);
|
|
315
|
+
// options.maxWidth && this.code.push(`maxWidth: "${options.maxWidth}", \n`);
|
|
316
|
+
|
|
317
|
+
options.maxWidth && (stra += `maxWidth: "${options.maxWidth}", \n`);
|
|
318
|
+
|
|
319
|
+
// console.warn(this.res.style.width);
|
|
320
|
+
|
|
321
|
+
options.radius && this.cornerRadius(options.radius);
|
|
322
|
+
// options.radius && this.code.push(`radius: "${options.radius}"`);
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
options.radius && (stra += `radius: "${options.radius}", \n`);
|
|
326
|
+
|
|
327
|
+
if (options.marginOp) {
|
|
328
|
+
let stringified = this.removeQuotesFromFirstWord(JSON.stringify(options.marginOp));
|
|
329
|
+
stra += `\n marginOp: ${stringified},`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
options.clipPath && this.clipPath(options.clipPath);
|
|
333
|
+
options.clipPath && (stra += `clipPath: "${options.clipPath}", \n`);
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
let obj = options;
|
|
337
|
+
// console.log("261");
|
|
338
|
+
// console.warn(obj);
|
|
339
|
+
//----
|
|
340
|
+
if (obj.stroke || obj.gradient || obj.span || obj.backgroundOp || obj.layout || obj.marginOp || obj.shadow || obj.filtera || obj.animation){
|
|
341
|
+
|
|
342
|
+
//alert("P")
|
|
343
|
+
// use obj.range and obj.op
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
let first = obj.gradient;
|
|
348
|
+
|
|
349
|
+
if (obj.gradient){
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
this.globalGradient = obj.gradient.op.gradient;
|
|
354
|
+
// console.log(obj.gradient);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
if (obj.stroke){
|
|
359
|
+
|
|
360
|
+
// console.warn("OAP");
|
|
361
|
+
// console.log(obj.stroke.op.color);
|
|
362
|
+
|
|
363
|
+
//super.setVar("1px yellow");
|
|
364
|
+
super.setAny({globalBlast: `${obj.stroke.op.width} ${obj.stroke.op.color}`});
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
//super.globalBlast = `1px solid yellow`;//`${obj.stroke.op.width} ${obj.stroke.op.color}`;
|
|
368
|
+
// console.warn("GBL")
|
|
369
|
+
// console.warn(super.globalBlast);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
// console.log("what here");
|
|
374
|
+
// console.log(obj.marginOp);
|
|
375
|
+
|
|
376
|
+
// Filter just the elements with layout element
|
|
377
|
+
let ft = [obj.stroke, obj.gradient, obj.animation, obj.span, obj.backgroundOp, obj.layout, obj.marginOp, obj.shadow, obj.filtera, obj.animation]//obj.gradient.filter(el => el.op.name !== "layout");
|
|
378
|
+
// console.log(ft);
|
|
379
|
+
|
|
380
|
+
ft = ft.filter(el => el != undefined);
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
let arr = [];
|
|
386
|
+
|
|
387
|
+
for (var i = 0; i < ft.length; i++){
|
|
388
|
+
// console.log("Hello");
|
|
389
|
+
arr.push({
|
|
390
|
+
range: ft[i].range,
|
|
391
|
+
log: ft[i].op.name,
|
|
392
|
+
target: ft[i].target,
|
|
393
|
+
op: ft[i].op
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Maybe just fill-in dynamically
|
|
398
|
+
/*let queries = [
|
|
399
|
+
{
|
|
400
|
+
range: obj.gradient[1].range, // This is BLAST
|
|
401
|
+
log: "blast"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
range: obj.gradient[2].range, // This is GRADIENT
|
|
405
|
+
log: "gradient"
|
|
406
|
+
}
|
|
407
|
+
];*/
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
// Both only 600-650
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
// REDUNDANT?????
|
|
416
|
+
// window.addEventListener("resize", () => this.react(arr));
|
|
417
|
+
// console.log(arr);
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
// UNCOMMENT THIS !!!
|
|
421
|
+
// this.protoReact(arr, this.options.id);
|
|
422
|
+
|
|
423
|
+
//console.warn("CALLINGA BETA REACT");
|
|
424
|
+
// this.betaReact(arr, this.options.id);
|
|
425
|
+
this.chainReact(arr, this.options.id);
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
//---
|
|
431
|
+
|
|
432
|
+
if (obj.shadow){
|
|
433
|
+
|
|
434
|
+
let noiseObject = obj.shadow;
|
|
435
|
+
let stringified = this.removeQuotesFromFirstWord(JSON.stringify(noiseObject));
|
|
436
|
+
(stra += `\n shadow: ${stringified},`);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (obj.animation){
|
|
440
|
+
|
|
441
|
+
let noiseObject = obj.animation;
|
|
442
|
+
let stringified = this.removeQuotesFromFirstWord(JSON.stringify(noiseObject));
|
|
443
|
+
(stra += `\n animation: ${stringified},`);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
let str = `\n .set({${stra}}) \n \n`;
|
|
448
|
+
|
|
449
|
+
if (Object.keys(options).length > 0){
|
|
450
|
+
this.code.push(str);
|
|
451
|
+
} else {
|
|
452
|
+
this.code.push(",")
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return this;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
setFilter(filter){
|
|
460
|
+
|
|
461
|
+
// console.log("ABBAC------------");
|
|
462
|
+
// console.log(filter);
|
|
463
|
+
let arr = [];
|
|
464
|
+
|
|
465
|
+
let ft = [filter]//obj.gradient.filter(el => el.op.name !== "layout");
|
|
466
|
+
// console.log(ft);
|
|
467
|
+
|
|
468
|
+
ft = ft.filter(el => el != undefined);
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
// let arr = [];
|
|
474
|
+
|
|
475
|
+
for (var i = 0; i < ft.length; i++){
|
|
476
|
+
// console.log("Hello");
|
|
477
|
+
arr.push({
|
|
478
|
+
range: ft[i].range,
|
|
479
|
+
log: ft[i].op.name,
|
|
480
|
+
target: ft[i].target
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
//alert(arr.length);
|
|
485
|
+
|
|
486
|
+
//this.protoReact(arr)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
makeMultiMargin(obj){ // 11:22:52
|
|
490
|
+
// this.res.style.zIndex = "1";
|
|
491
|
+
|
|
492
|
+
for (var i = 0; i < obj.length; i++){
|
|
493
|
+
if (obj[i].side === "left"){
|
|
494
|
+
this.res.style.marginLeft = obj[i].value;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if (obj[i].side === "right"){
|
|
498
|
+
this.res.style.marginRight = obj[i].value;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (obj[i].side === "top"){
|
|
502
|
+
this.res.style.marginTop = obj[i].value;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (obj[i].side === "bottom"){
|
|
506
|
+
this.res.style.marginBottom = obj[i].value;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return this;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
setID(id){
|
|
515
|
+
this.res.setAttribute("id", id);
|
|
516
|
+
return this;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
square(){
|
|
520
|
+
this.res.style.width = "30%";
|
|
521
|
+
this.res.style.paddingBottom = "30%";
|
|
522
|
+
return this;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
opacity(value){
|
|
527
|
+
this.res.style.opacity = `${value}`;
|
|
528
|
+
return this;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
rowCol(row, col){
|
|
533
|
+
this.res.style.gridRow = row;
|
|
534
|
+
this.res.style.gridColumn = col;
|
|
535
|
+
return this;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
setArea(area){
|
|
540
|
+
this.res.style.gridArea = area;
|
|
541
|
+
return this;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
setGridRow(row){
|
|
545
|
+
this.res.style.gridRow = row;
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
setGridCol(col){
|
|
550
|
+
this.res.style.gridColumn = col;
|
|
551
|
+
return this;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
setGrid(){
|
|
555
|
+
this.res.style.gridRow = "span 2";
|
|
556
|
+
this.res.style.gridColumn= "span 3";
|
|
557
|
+
//this.res.style.gridColumn = "span 3";
|
|
558
|
+
return this;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
transform(str){
|
|
562
|
+
this.res.style.transform = str; //"rotate3d(.5,-.866,0,15deg) rotate(60deg)";
|
|
563
|
+
return this;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
offset(){
|
|
567
|
+
this.res.style.marginLeft = "-60px";
|
|
568
|
+
return this;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
offseta(){
|
|
572
|
+
this.res.style.marginLeft = "90px";
|
|
573
|
+
this.res.style.marginTop = "-30px";
|
|
574
|
+
return this;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
borderAround(data){
|
|
578
|
+
this.res.style.border = data;
|
|
579
|
+
return this;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
setClass(name){
|
|
583
|
+
this.res.setAttribute("class", name);
|
|
584
|
+
return this;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
scale(obj){
|
|
588
|
+
|
|
589
|
+
let previousWidth = this.res.style.width;
|
|
590
|
+
|
|
591
|
+
this.res.style.transition= "0.5s all";
|
|
592
|
+
// alert(previousWidth);
|
|
593
|
+
|
|
594
|
+
this.res.addEventListener("mouseover", () => {
|
|
595
|
+
let previousWidth = this.res.style.width;
|
|
596
|
+
this.res.style.transform = "scale(1.04)";
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
this.res.addEventListener("mouseout", () => {
|
|
600
|
+
let previousWidth = this.res.style.width;
|
|
601
|
+
this.res.style.transform = "scale(1.0)";
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
onTap(e) {
|
|
610
|
+
this.res.addEventListener("click", e);
|
|
611
|
+
return this;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
border(corners){
|
|
615
|
+
this.res.style.borderTopLeftRadius = "16px";
|
|
616
|
+
this.res.style.borderTopRightRadius = "16px";
|
|
617
|
+
return this;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
allRound(dimensions){
|
|
621
|
+
this.res.style.borderRadius = dimensions;
|
|
622
|
+
return this;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
mobileWidth(){
|
|
627
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
628
|
+
if (query.matches){
|
|
629
|
+
this.res.style.width = "120%";
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
return this;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
/*
|
|
638
|
+
if (type == "exact" || type == "uncover"){
|
|
639
|
+
this.image(this.url, mode);
|
|
640
|
+
} else {
|
|
641
|
+
this.setup();
|
|
642
|
+
}
|
|
643
|
+
*/
|
|
644
|
+
image(url, mode, type, vtn, gcs){
|
|
645
|
+
//alert(gcs);
|
|
646
|
+
//alert(mode);
|
|
647
|
+
//alert(value);
|
|
648
|
+
// this.el = null;
|
|
649
|
+
let query = window.matchMedia("(max-device-width: 415px)");
|
|
650
|
+
let back = document.createElement("div");
|
|
651
|
+
//alert(vtn);
|
|
652
|
+
back.style.viewTransitionName = vtn;
|
|
653
|
+
//back.style.backgroundColor = "#ecf0f1";
|
|
654
|
+
back.style.width = "100%";
|
|
655
|
+
back.style.height = "200";
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
if (gcs){
|
|
659
|
+
|
|
660
|
+
//alert("P")
|
|
661
|
+
back.style.gridColumn = gcs.gridColumn;
|
|
662
|
+
back.style.gridRow = gcs.gridRow;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (query.matches){
|
|
666
|
+
back.style.height = "500";
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
back.style.backgroundImage = `url(${url})`;
|
|
670
|
+
back.style.backgroundPosition = "center center";
|
|
671
|
+
// back.style.backgroundRepeatX = "no-repeat";
|
|
672
|
+
back.style.backgroundRepeat = "no-repeat";
|
|
673
|
+
|
|
674
|
+
back.style.backgroundSize = "cover";
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
if (type === "uncover"){
|
|
678
|
+
|
|
679
|
+
back.style.backgroundSize = "contain";
|
|
680
|
+
}
|
|
681
|
+
/*back.style.backgroundSize = "cover";
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
if (this.options.cover === false){
|
|
685
|
+
back.style.backgroundSize = "";
|
|
686
|
+
}*/
|
|
687
|
+
|
|
688
|
+
if (mode === "contain"){
|
|
689
|
+
//alert("J")
|
|
690
|
+
back.style.backgroundSize = "contain";
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
//back.style.borderTopLeftRadius = `${value}px`;
|
|
695
|
+
//back.style.borderTopRightRadius = `${value}px`;
|
|
696
|
+
|
|
697
|
+
this.res = back;
|
|
698
|
+
return this;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
arrayPadding(arr, value) {
|
|
702
|
+
if (arr.includes("left")){
|
|
703
|
+
this.res.style.paddingLeft = value;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
if (arr.includes("right")){
|
|
707
|
+
this.res.style.paddingRight = value;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (arr.includes("top")){
|
|
711
|
+
this.res.style.paddingTop = value;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (arr.includes("bottom")){
|
|
715
|
+
this.res.style.paddingBottom = value;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
return this;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
arrayMargin(arr, value) {
|
|
724
|
+
if (arr.includes("left")){
|
|
725
|
+
this.res.style.marginLeft = value;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (arr.includes("right")){
|
|
729
|
+
this.res.style.marginRight = value;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (arr.includes("top")){
|
|
733
|
+
this.res.style.marginTop = value;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (arr.includes("bottom")){
|
|
737
|
+
this.res.style.marginBottom = value;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
return this;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
setup() {
|
|
746
|
+
let img = document.createElement("img");
|
|
747
|
+
img.style.width = "100%";
|
|
748
|
+
//img.style.height = "auto";
|
|
749
|
+
img.src = this.url;
|
|
750
|
+
this.res = img;
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
return this;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
autoW(){
|
|
757
|
+
this.res.style.width = "initial";
|
|
758
|
+
return this;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
float(dir){
|
|
762
|
+
this.res.style.float = `${dir}`;
|
|
763
|
+
return this;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
fillAvailable(){
|
|
767
|
+
this.res.style.height = "-webkit-fill-available";
|
|
768
|
+
return this;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
grayscale(val){
|
|
772
|
+
this.res.style.filter = `grayscale(${val}%)`;
|
|
773
|
+
return this;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
flex(val){
|
|
778
|
+
this.res.style.flex = 1;
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
height(h){
|
|
783
|
+
this.res.style.height = h;
|
|
784
|
+
this.res.style.width = "auto";
|
|
785
|
+
return this;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
expand(obj){
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
const convert = (value) => {
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
var convertedValue = value;
|
|
803
|
+
|
|
804
|
+
if ((value.includes("%")) || value.includes("px")){
|
|
805
|
+
|
|
806
|
+
convertedValue = convertedValue.substr(0, 2);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
if (value.includes("%")){
|
|
812
|
+
return Number(convertedValue / 100 * window.innerWidth);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
if (value.includes("px")){
|
|
816
|
+
return Number(convertedValue);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const check = () => {
|
|
822
|
+
let mq = window.matchMedia(`(min-width: ${obj.at})`);
|
|
823
|
+
|
|
824
|
+
if (mq.matches){
|
|
825
|
+
// alert("MATCH")
|
|
826
|
+
this.res.style.width = `${obj.width}`;
|
|
827
|
+
|
|
828
|
+
let newWidth = window.innerWidth / 2 - convert(obj.width) / 2;
|
|
829
|
+
// alert(newWidth);
|
|
830
|
+
this.res.style.marginLeft = `${newWidth}px`; // `calc(${window.innerWidth}-${obj.width} / 2)`;
|
|
831
|
+
} else {
|
|
832
|
+
this.res.style.width = `100%`;
|
|
833
|
+
this.res.style.marginLeft = `0px`;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
let mqa = window.matchMedia(`(max-device-width: 415px)`);
|
|
838
|
+
if (mqa.matches){
|
|
839
|
+
this.res.style.width = `100%`;
|
|
840
|
+
this.res.style.marginLeft = `0px`;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
check();
|
|
848
|
+
|
|
849
|
+
window.addEventListener("resize", check);
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
return this;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/*center(w){
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
const adj = () => {
|
|
859
|
+
if (this.res.style.width != 0){
|
|
860
|
+
let count = window.innerWidth / 2 - (((w * window.innerWidth) / 100) / 2);
|
|
861
|
+
this.res.style.marginLeft = `${count}px`;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
adj();
|
|
867
|
+
window.onresize = adj();
|
|
868
|
+
return this;
|
|
869
|
+
}*/
|
|
870
|
+
|
|
871
|
+
width(w){
|
|
872
|
+
this.res.style.width = w;
|
|
873
|
+
this.res.style.height = "auto";
|
|
874
|
+
return this;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
toBack(){
|
|
879
|
+
this.res.style.zIndex = "-1";
|
|
880
|
+
return this;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
margin(L, T, R, B) {
|
|
884
|
+
if (L || T || R || B){ // CAUGHT MYSELF
|
|
885
|
+
this.res.style.marginLeft = L;
|
|
886
|
+
this.res.style.marginTop = T;
|
|
887
|
+
this.res.style.marginRight = R;
|
|
888
|
+
this.res.style.marginBottom = B;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
if (!T && !R && !B){
|
|
892
|
+
|
|
893
|
+
if (T !== 0 || R !== 0 || B !== 0){
|
|
894
|
+
// alert("j")
|
|
895
|
+
this.res.style.margin = L;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
return this;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
padding(el){
|
|
906
|
+
this.res.style.padding = el;
|
|
907
|
+
return this;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
size(w, h) {
|
|
911
|
+
if (w && h) {
|
|
912
|
+
this.res.style.width = w;
|
|
913
|
+
this.res.style.height = h;
|
|
914
|
+
} else {
|
|
915
|
+
this.res.style.width = w;
|
|
916
|
+
this.res.style.height = w;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
return this;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
frame(obj) {
|
|
925
|
+
let w = obj.width;
|
|
926
|
+
let h = obj.height;
|
|
927
|
+
|
|
928
|
+
if (w && h) {
|
|
929
|
+
this.res.style.width = w;
|
|
930
|
+
this.res.style.height = h;
|
|
931
|
+
} else {
|
|
932
|
+
this.res.style.width = w;
|
|
933
|
+
this.res.style.height = w;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
return this;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
RSize(w, h, ratio) {
|
|
942
|
+
|
|
943
|
+
let mq = window.matchMedia("(max-device-width: 420px)");
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
if (w && h) {
|
|
947
|
+
|
|
948
|
+
this.res.style.width = mq.matches ? w * ratio : w;
|
|
949
|
+
this.res.style.height = mq.matches ? h * ratio : h;
|
|
950
|
+
} else {
|
|
951
|
+
this.res.style.width = mq.matches ? w * ratio : w;
|
|
952
|
+
this.res.style.height = mq.matches ? w * ratio : w;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
return this;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
shadow(obj){
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
if (obj.type === "mild"){
|
|
968
|
+
this.res.style.boxShadow = `0px 3px 15px rgba(0,0,0,0.2)`;
|
|
969
|
+
} else {
|
|
970
|
+
this.res.style.boxShadow = `${obj.x}px ${obj.y}px ${obj.radius}px ${obj.color}`;
|
|
971
|
+
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
return this;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
clipShape(shape) {
|
|
982
|
+
this.res.style.borderRadius = "50%";
|
|
983
|
+
return this;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
cornerRadius(val){
|
|
987
|
+
this.res.style.borderRadius = val;
|
|
988
|
+
return this;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
clipPath(pathData) {
|
|
992
|
+
// Create a unique ID for the clip path
|
|
993
|
+
|
|
994
|
+
// Apply the clip-path to the element
|
|
995
|
+
this.res.style.clipPath = `path("${pathData}")`; //`path("M 20 240 \
|
|
996
|
+
//C 20 0 300 0 300 240 Z")`;
|
|
997
|
+
|
|
998
|
+
let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
999
|
+
svg.style.display = "block";
|
|
1000
|
+
svg.style.width = "100%";
|
|
1001
|
+
svg.style.height = "100%";
|
|
1002
|
+
svg.style.overflow = "visible";
|
|
1003
|
+
//this.res.style.position = "absolute";
|
|
1004
|
+
|
|
1005
|
+
/*
|
|
1006
|
+
let path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1007
|
+
path.setAttribute("d", pathData);
|
|
1008
|
+
path.setAttribute("fill", "none");
|
|
1009
|
+
path.setAttribute("stroke", "black");
|
|
1010
|
+
path.setAttribute("stroke-width", "7");
|
|
1011
|
+
path.setAttribute("viewBox", "0 0 700 700");
|
|
1012
|
+
path.setAttribute("preserveAspectRatio", "xMidYMid meet");
|
|
1013
|
+
|
|
1014
|
+
svg.appendChild(path);
|
|
1015
|
+
|
|
1016
|
+
document.body.appendChild(svg);*/
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
return this;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
render(el) {
|
|
1023
|
+
let ela = this.res;//document.createElement("div");
|
|
1024
|
+
//ela.style.overflowX = "hidden";
|
|
1025
|
+
//ela.style.overflowY = "hidden";
|
|
1026
|
+
//ela.appendChild(this.res); // cannot move while loading
|
|
1027
|
+
// apply to every element maybe through the
|
|
1028
|
+
|
|
1029
|
+
// let ela = this.res;
|
|
1030
|
+
|
|
1031
|
+
if (el) {
|
|
1032
|
+
document.querySelector(el).appendChild(/*this.res*/ ela);
|
|
1033
|
+
} else {
|
|
1034
|
+
return ela; //this.res;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
export { Image };
|