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,183 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
class SideBar {
|
|
4
|
+
constructor(els, obj){
|
|
5
|
+
this.ele = null;
|
|
6
|
+
this.width = "16em";
|
|
7
|
+
this.height = "100vh";
|
|
8
|
+
|
|
9
|
+
this.els = els;
|
|
10
|
+
|
|
11
|
+
// this.setup(obj);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
setup(obj){
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if (obj.width){
|
|
27
|
+
this.width = obj.width;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (obj.height){
|
|
31
|
+
this.height = obj.height;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
let outer = document.createElement("div");
|
|
38
|
+
|
|
39
|
+
outer.style.position = "absolute";
|
|
40
|
+
|
|
41
|
+
let btn = document.createElement("button");
|
|
42
|
+
btn.style.position = "absolute";
|
|
43
|
+
btn.style.background = "white";
|
|
44
|
+
btn.style.opacity = 0.80;
|
|
45
|
+
btn.style.border = "none";
|
|
46
|
+
btn.width = "1.5em";
|
|
47
|
+
btn.height = "1.5em";
|
|
48
|
+
btn.style.borderRadius = "50%";
|
|
49
|
+
btn.style.zIndex = 2;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
let node = document.createTextNode("☰");
|
|
57
|
+
btn.appendChild(node);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
btn.style.fontSize = "2em";
|
|
61
|
+
|
|
62
|
+
if (window.matchMedia("(max-device-width: 400px)").matches){
|
|
63
|
+
btn.style.fontSize = "6em";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if (window.matchMedia("(max-device-width: 400px)").matches){
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if (obj.fullMobile){
|
|
71
|
+
this.width = "100vw";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
outer.appendChild(btn);
|
|
76
|
+
|
|
77
|
+
//alert(this.width);
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
let el = document.createElement("div");
|
|
81
|
+
|
|
82
|
+
el.style.position = "absolute";
|
|
83
|
+
el.style.backgroundColor = "#fff";
|
|
84
|
+
el.style.flexDirection = "column";
|
|
85
|
+
el.style.display = "flex";
|
|
86
|
+
// el.style.justifyContent = "space-around";
|
|
87
|
+
el.style.alignItems = "center";
|
|
88
|
+
el.style.margin = 0;
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
el.style.padding = 0;
|
|
92
|
+
el.style.width = this.width; //"16em";
|
|
93
|
+
|
|
94
|
+
//-------------DEFAULT STYLING----------
|
|
95
|
+
el.style.margin = 0;
|
|
96
|
+
// el.style.zIndex = -1;
|
|
97
|
+
el.style.marginTop = "-10px";
|
|
98
|
+
el.style.paddingTop = "1em";
|
|
99
|
+
el.style.paddingBottom = "1em";
|
|
100
|
+
el.style.height = `${this.height}`;
|
|
101
|
+
el.style.transform = `translateX(-${this.width})`;
|
|
102
|
+
el.style.transition = "all 0.80s";
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
outer.appendChild(el);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
this.hidden = false;
|
|
113
|
+
|
|
114
|
+
btn.addEventListener("click", () => {
|
|
115
|
+
this.hidden = !this.hidden;
|
|
116
|
+
|
|
117
|
+
for (var i = 0; i < el.children.length; i++){
|
|
118
|
+
if (el.textContent !== "☰"){
|
|
119
|
+
|
|
120
|
+
if (this.hidden){
|
|
121
|
+
el.style.transform = "translateX(0em)";
|
|
122
|
+
// el.style.display = "flex";
|
|
123
|
+
} else {
|
|
124
|
+
// el.style.display = "none";
|
|
125
|
+
el.style.transform = `translateX(-${this.width})`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
this.ele = outer;
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
// window.addEventListener("resize", this.adjust.bind(this));
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if (this.els){
|
|
141
|
+
this.items(this.els);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return this;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
// DO NOT CHANGE WIDTH AFTER
|
|
152
|
+
|
|
153
|
+
background(obj){
|
|
154
|
+
this.ele.children[1].style.backgroundColor = obj.color;
|
|
155
|
+
this.ele.children[1].style.opacity = obj.opacity;
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
items(items){
|
|
160
|
+
this.itemCount = items.length;
|
|
161
|
+
for (var i = 0; i < items.length; i++){
|
|
162
|
+
this.ele.children[1].appendChild(items[i].render());
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// this.adjust();
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
/*--------------------------------------------------ADJUST--------------------------------------------------*/
|
|
171
|
+
render(div){
|
|
172
|
+
if (div){
|
|
173
|
+
document.querySelector(div).style.padding = 0;
|
|
174
|
+
document.querySelector(div).style.margin = 0;
|
|
175
|
+
document.querySelector(div).appendChild(this.ele);
|
|
176
|
+
} else {
|
|
177
|
+
return this.ele;
|
|
178
|
+
}
|
|
179
|
+
return this.ele;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export { SideBar };
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
class SideNav extends Animator {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
setup(obj) {
|
|
9
|
+
this.obj = obj; // this.obj.animate || true LOL this.obj.animate ? this.obj.animate : true
|
|
10
|
+
this.animate = this.obj.animate !== undefined ? this.obj.animate : true; // could be never false
|
|
11
|
+
this.res = this.createSideNav(obj);
|
|
12
|
+
this.res.style.position = "relative";
|
|
13
|
+
this.res.style.zIndex = 3;
|
|
14
|
+
this.closed = true; // Set to true initially, so it's closed by default
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
toggleSideNav(button) {
|
|
19
|
+
this.closed = !this.closed;
|
|
20
|
+
let sideNavWrapper = this.res.children[0];
|
|
21
|
+
let duration = 300; // 3000
|
|
22
|
+
|
|
23
|
+
if (this.closed) { // Began 13/11/24
|
|
24
|
+
sideNavWrapper.style.overflowX = "hidden";
|
|
25
|
+
button.style.opacity = 1; // Show toggle button
|
|
26
|
+
|
|
27
|
+
if (this.animate) {
|
|
28
|
+
// Animate hiding with translateX
|
|
29
|
+
sideNavWrapper.animate([{ transform: 'translateX(0)' }, { transform: 'translateX(100%)' }], {
|
|
30
|
+
duration: duration,
|
|
31
|
+
fill: 'forwards'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
let idx = -1;
|
|
35
|
+
|
|
36
|
+
for (let childa of sideNavWrapper.children) {
|
|
37
|
+
idx += 1;
|
|
38
|
+
|
|
39
|
+
// THIS CONTROLS CLOSING
|
|
40
|
+
|
|
41
|
+
if (this.masterEL[idx]){
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
for (let child of childa.children) {
|
|
45
|
+
let anna = this.masterEL[idx].options.animation;
|
|
46
|
+
if (anna && this.mappedIDS.includes(child.id)) {
|
|
47
|
+
child.animate(anna.op.keyframesClose, anna.op.closeOptions);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
sideNavWrapper.style.display = "none"; // Hide navigation immediately
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// THIS BLOCK CONTROLE APPEARING !!!!!!!!!
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
sideNavWrapper.style.overflowX = "none";
|
|
62
|
+
sideNavWrapper.children[1].style.border = "1px solid orange";
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
let idx = -1;
|
|
66
|
+
|
|
67
|
+
for (let childa of sideNavWrapper.children) {
|
|
68
|
+
idx += 1;
|
|
69
|
+
|
|
70
|
+
for (let child of childa.children) {
|
|
71
|
+
if (this.mappedIDS.includes(child.id)) {
|
|
72
|
+
|
|
73
|
+
if (this.masterEL[0] !== undefined){
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
let anna = this.masterEL[idx].options.animation;
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if (anna){
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
console.log("OPEN KEYFRAMES");
|
|
83
|
+
console.log(anna.op.keyframesOpen);
|
|
84
|
+
|
|
85
|
+
let opts = anna.op.openOptions;
|
|
86
|
+
|
|
87
|
+
/// FIX
|
|
88
|
+
if (!opts.delay){
|
|
89
|
+
opts.delay = 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!opts.duration){
|
|
93
|
+
opts.duration = 300;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
console.log(opts);
|
|
97
|
+
|
|
98
|
+
// Why does duration affect navigation appearing????
|
|
99
|
+
//THIS BLOCK CONTROLS APPEARING !!!!
|
|
100
|
+
/*let protoOps = {
|
|
101
|
+
duration: 300,
|
|
102
|
+
fill: 'forwards',
|
|
103
|
+
delay: 1000 // 1000 why does 3000 work during open but not during close??
|
|
104
|
+
};*/
|
|
105
|
+
|
|
106
|
+
child.animate(anna.op.keyframesOpen, opts);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
button.style.opacity = 0;
|
|
118
|
+
if (this.animate) {
|
|
119
|
+
sideNavWrapper.style.display = "flex"; // Ensure it's visible
|
|
120
|
+
sideNavWrapper.animate([{ transform: 'translateX(100%)' }, { transform: 'translateX(0)' }], {
|
|
121
|
+
duration: duration,
|
|
122
|
+
fill: 'forwards'
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
sideNavWrapper.style.display = "flex"; // Show navigation immediately
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
createToggleButton(color) {
|
|
131
|
+
const button = document.createElement("button");
|
|
132
|
+
button.innerText = "☰";
|
|
133
|
+
button.style.padding = "10px 20px";
|
|
134
|
+
button.style.backgroundColor = "transparent";
|
|
135
|
+
button.style.color = color ?? "#3498db";
|
|
136
|
+
button.style.border = "none";
|
|
137
|
+
button.style.borderRadius = "5px";
|
|
138
|
+
button.style.cursor = "pointer";
|
|
139
|
+
button.style.zIndex = 1;
|
|
140
|
+
button.style.fontSize = "1.6rem";
|
|
141
|
+
return button;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
createCloseButton(color) {
|
|
145
|
+
const button = document.createElement("button");
|
|
146
|
+
button.innerText = "×";
|
|
147
|
+
button.style.fontSize = "1.6rem";
|
|
148
|
+
button.style.padding = "10px 20px";
|
|
149
|
+
button.style.backgroundColor = "transparent";
|
|
150
|
+
button.style.color = color ?? "black";
|
|
151
|
+
button.style.border = "none";
|
|
152
|
+
button.style.borderRadius = "5px";
|
|
153
|
+
button.style.cursor = "pointer";
|
|
154
|
+
button.style.zIndex = 1;
|
|
155
|
+
button.style.alignSelf = "flex-end"; // Align close button to the right
|
|
156
|
+
return button;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
createSideNav(obj) {
|
|
160
|
+
const megaWrapper = document.createElement("div");
|
|
161
|
+
megaWrapper.style.display = "flex";
|
|
162
|
+
megaWrapper.style.justifyContent = "flex-end";
|
|
163
|
+
|
|
164
|
+
const sideNavWrapper = document.createElement("div");
|
|
165
|
+
sideNavWrapper.style.display = "none";
|
|
166
|
+
sideNavWrapper.style.background = this.obj.background || "#1abc9c";
|
|
167
|
+
sideNavWrapper.style.height = "100%";
|
|
168
|
+
|
|
169
|
+
let mobileMedia = window.matchMedia(`(max-device-width: 415px)`);
|
|
170
|
+
if (mobileMedia.matches) {
|
|
171
|
+
sideNavWrapper.style.width = "100%";
|
|
172
|
+
} else {
|
|
173
|
+
sideNavWrapper.style.width = this.obj.width || "400px"; // or width
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
sideNavWrapper.style.position = "fixed";
|
|
177
|
+
sideNavWrapper.style.right = 0;
|
|
178
|
+
if (this.animate) {
|
|
179
|
+
sideNavWrapper.style.transform = "translateX(100%)"; // Start off-screen
|
|
180
|
+
}
|
|
181
|
+
sideNavWrapper.style.flexDirection = "column";
|
|
182
|
+
sideNavWrapper.style.justifyContent = "flex-start";
|
|
183
|
+
|
|
184
|
+
const toggleBtn = this.createToggleButton(this.obj.hamColour.opened);
|
|
185
|
+
const closeBtn = this.createCloseButton(this.obj.hamColour.closed);
|
|
186
|
+
|
|
187
|
+
toggleBtn.addEventListener("click", () => this.toggleSideNav(toggleBtn));
|
|
188
|
+
closeBtn.addEventListener("click", () => this.toggleSideNav(toggleBtn));
|
|
189
|
+
|
|
190
|
+
sideNavWrapper.appendChild(closeBtn);
|
|
191
|
+
megaWrapper.appendChild(sideNavWrapper);
|
|
192
|
+
megaWrapper.appendChild(toggleBtn);
|
|
193
|
+
return megaWrapper;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
items(it) {
|
|
197
|
+
this.masterEL = it.items.filter(it => it.link !== undefined);
|
|
198
|
+
|
|
199
|
+
console.log("EXTRACT IDs");
|
|
200
|
+
console.log(it);
|
|
201
|
+
|
|
202
|
+
let mappedIDS = it.items
|
|
203
|
+
.filter(it => it.items === undefined)
|
|
204
|
+
.map(id => id.id);
|
|
205
|
+
|
|
206
|
+
this.mappedIDS = mappedIDS;
|
|
207
|
+
this.item = it;
|
|
208
|
+
this.res.children[0].appendChild(it.render());
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
if (this.masterEL[0] !== undefined){
|
|
212
|
+
|
|
213
|
+
console.log("ANNAX");
|
|
214
|
+
console.log(this.masterEL[0]);
|
|
215
|
+
|
|
216
|
+
let anna = this.masterEL[0].options.animation;
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
// Set initialState from animation here
|
|
221
|
+
if (anna) {
|
|
222
|
+
for (let childa of this.res.children[0].children) {
|
|
223
|
+
for (let child of childa.children) {
|
|
224
|
+
if (this.mappedIDS.includes(child.id)) {
|
|
225
|
+
|
|
226
|
+
let resetDelay = anna.op.closeOptions;
|
|
227
|
+
resetDelay.delay = 0;
|
|
228
|
+
|
|
229
|
+
console.log("ANNAX");
|
|
230
|
+
console.log("SETTING INITIAL STATE ZEROING THE DELAY");
|
|
231
|
+
console.log(anna.op.keyframesClose);
|
|
232
|
+
console.log(resetDelay);
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
// OPEN KEYFRAMES LOG IS FROM FUNCTION THAT HAS COMMENTE OUT ACXTION!!!
|
|
239
|
+
// MATCH CLOSE OBJECT
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
/* child.animate([
|
|
243
|
+
{ transform: 'translate(0%)', opacity: 1 },
|
|
244
|
+
{ transform: 'translate(100%, 10%)', opacity: 0 }
|
|
245
|
+
], { duration: 1,
|
|
246
|
+
fill: 'forwards',
|
|
247
|
+
delay: 0 // hide immediatelly even before the nav shows
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
child.animate(anna.op.keyframesClose, anna.op.closeOptions);
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
// child.animate(anna.op.keyframesOpen, resetDelay);
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* toCode() {
|
|
274
|
+
let codeStr = `new SideNav().setup(${JSON.stringify(this.obj, null, 2)}, ${this.animate})`;
|
|
275
|
+
if (this.item) {
|
|
276
|
+
let itemCode = this.item.toCode ? this.item.toCode().join("") : JSON.stringify(this.item);
|
|
277
|
+
itemCode = itemCode.replace(/,\s*(\.set\(|\.add\()/g, "\n $1");
|
|
278
|
+
codeStr += `.items(${itemCode})`;
|
|
279
|
+
}
|
|
280
|
+
return codeStr;
|
|
281
|
+
}*/
|
|
282
|
+
|
|
283
|
+
toCode() {
|
|
284
|
+
// Convert object to string with JSON.stringify
|
|
285
|
+
let codeStr = `new SideNav().setup(${this.formatObj(this.obj)}, ${this.animate})`;
|
|
286
|
+
|
|
287
|
+
if (this.item) {
|
|
288
|
+
let itemCode = this.item.toCode ? this.item.toCode().join("") : this.formatObj(this.item);
|
|
289
|
+
itemCode = itemCode.replace(/,\s*(\.set\(|\.add\()/g, "\n $1");
|
|
290
|
+
codeStr += `.items(${itemCode})`;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return codeStr;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Utility method to format object strings and remove quotes from keys
|
|
297
|
+
formatObj(obj) {
|
|
298
|
+
// Use JSON.stringify to get a string with indentation
|
|
299
|
+
let jsonString = JSON.stringify(obj, null, 2);
|
|
300
|
+
|
|
301
|
+
// Remove quotes around object keys using regex
|
|
302
|
+
return jsonString.replace(/"(\w+)"\s*:/g, '$1:');
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
render(mount) {
|
|
306
|
+
if (mount) {
|
|
307
|
+
document.querySelector(mount).appendChild(this.res);
|
|
308
|
+
}
|
|
309
|
+
return this.res;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export { SideNav };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Animator} from "./animator.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SimpleBar extends Animator {
|
|
5
|
+
constructor(){
|
|
6
|
+
super();
|
|
7
|
+
this.res = document.createElement("div");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
items(arr){
|
|
11
|
+
for (var i = 0; i < arr.length; i++){
|
|
12
|
+
this.res.appendChild(arr[i].render());
|
|
13
|
+
}
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
render(div){
|
|
18
|
+
if (div){
|
|
19
|
+
document.querySelector(div).appendChild(this.res);
|
|
20
|
+
}
|
|
21
|
+
return this.res;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { SimpleBar };
|