@cocreate/utils 1.34.3 → 1.36.0
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/CHANGELOG.md +26 -0
- package/docs/index.html +319 -319
- package/package.json +1 -1
- package/prettier.config.js +16 -0
- package/src/index.js +144 -81
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# [1.36.0](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.35.0...v1.36.0) (2024-11-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* pretier.config.js and file formating ([70a49d7](https://github.com/CoCreate-app/CoCreate-utils/commit/70a49d750d9431754eda0858367d6db888208430))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add prettier.config.js and format files ([ff9e566](https://github.com/CoCreate-app/CoCreate-utils/commit/ff9e5663151b59d6f3e70c473d84f84561881696))
|
|
12
|
+
* add prettier.config.js and format files ([8b2ce50](https://github.com/CoCreate-app/CoCreate-utils/commit/8b2ce50cefa8de3d21a31d56f054a7c65f4cf242))
|
|
13
|
+
|
|
14
|
+
# [1.35.0](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.34.3...v1.35.0) (2024-11-02)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* assign clickedElementListenerAdded = true and improve eroor catching ([e8caa1d](https://github.com/CoCreate-app/CoCreate-utils/commit/e8caa1d5818eff8b44ba552446faac2533ba1d46))
|
|
20
|
+
* csspathformating and removed dead code ([fb7da92](https://github.com/CoCreate-app/CoCreate-utils/commit/fb7da920947ccb1b12ab56a08e3e755610ee0a92))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* dotNotationToObject improved array support and dynamically create an index with aplha charater to represent the group index [a] ([75c51cf](https://github.com/CoCreate-app/CoCreate-utils/commit/75c51cf4c6e6a0338ca16a8924a07d2e84f5e06d))
|
|
26
|
+
|
|
1
27
|
## [1.34.3](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.34.2...v1.34.3) (2024-07-09)
|
|
2
28
|
|
|
3
29
|
|
package/docs/index.html
CHANGED
|
@@ -1,331 +1,331 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<title>CoCreate-utils Documentation | CoCreateJS</title>
|
|
8
|
+
<link
|
|
9
|
+
rel="icon"
|
|
10
|
+
type="image/png"
|
|
11
|
+
sizes="32x32"
|
|
12
|
+
href="https://cocreate.app/images/favicon.ico"
|
|
13
|
+
/>
|
|
14
|
+
<meta
|
|
15
|
+
name="description"
|
|
16
|
+
content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable."
|
|
17
|
+
/>
|
|
18
|
+
<meta
|
|
19
|
+
name="keywords"
|
|
20
|
+
content="helper classes, utility classes, css framework, css library, inline style classes"
|
|
21
|
+
/>
|
|
22
|
+
<meta name="robots" content="index,follow" />
|
|
23
|
+
<meta
|
|
24
|
+
property="og:image"
|
|
25
|
+
content="https://cdn.cocreate.app/docs/utils.png"
|
|
26
|
+
/>
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
<link
|
|
29
|
+
rel="stylesheet"
|
|
30
|
+
href="../index.css"
|
|
31
|
+
array="files"
|
|
32
|
+
object="60888216117c640e7596303f"
|
|
33
|
+
key="src"
|
|
34
|
+
type="text/css"
|
|
35
|
+
save="true"
|
|
36
|
+
/>
|
|
37
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
38
|
+
</head>
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
share-network="share"
|
|
102
|
-
title="Share on share"
|
|
103
|
-
><i src="/assets/svg/share-alt.svg"></i
|
|
104
|
-
></a>
|
|
105
|
-
</div>
|
|
106
|
-
<a
|
|
107
|
-
href="https://github.com/CoCreate-app/CoCreate-utils"
|
|
108
|
-
target="_blank"
|
|
109
|
-
class="margin-right:15px"
|
|
110
|
-
><i src="/assets/svg/github.svg"></i
|
|
111
|
-
></a>
|
|
112
|
-
</div>
|
|
40
|
+
<body>
|
|
41
|
+
<!-- Navbar -->
|
|
42
|
+
<nav
|
|
43
|
+
class="width:100% display:flex align-items:center background:transparent padding-top:10px padding-bottom:10px"
|
|
44
|
+
content_id="content"
|
|
45
|
+
scroll="sticky-nav,"
|
|
46
|
+
scroll-up="5"
|
|
47
|
+
scroll-down="5"
|
|
48
|
+
path="../"
|
|
49
|
+
src="../components/navbar.html"
|
|
50
|
+
></nav>
|
|
51
|
+
<sidenav
|
|
52
|
+
id="menuL"
|
|
53
|
+
class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
|
|
54
|
+
resizable
|
|
55
|
+
resize-selector="[content_id='content']"
|
|
56
|
+
resize-property="margin-left"
|
|
57
|
+
resize-value="width"
|
|
58
|
+
>
|
|
59
|
+
<menu array="files" object="603717b07de7fb350ae9fec8" key="src"></menu>
|
|
60
|
+
<div resize="right"></div>
|
|
61
|
+
</sidenav>
|
|
62
|
+
<main
|
|
63
|
+
class="padding-top:15px padding:15px@lg@xl"
|
|
64
|
+
content_id="content"
|
|
65
|
+
id="cocreate-utils"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
class="display:flex flex-wrap:wrap justify-content:space-between position:relative margin:10px"
|
|
69
|
+
>
|
|
70
|
+
<div class="display:flex align-items:center">
|
|
71
|
+
<h2>CoCreate-utils</h2>
|
|
72
|
+
</div>
|
|
73
|
+
<div
|
|
74
|
+
class="display:flex align-items:center font-size:20px position:absolute right:0 padding:5px background:white"
|
|
75
|
+
>
|
|
76
|
+
<div
|
|
77
|
+
class="display:flex align-items:center transition:0.3s padding-left:10px"
|
|
78
|
+
share-network="true"
|
|
79
|
+
share-text="Enter decription here"
|
|
80
|
+
share-title="testing im a title"
|
|
81
|
+
share-height="600"
|
|
82
|
+
share-width="700"
|
|
83
|
+
share-media="https://cdn.cocreate.app/docs/utils.png"
|
|
84
|
+
hover="display:block!important"
|
|
85
|
+
hover-selector=".social-networks"
|
|
86
|
+
>
|
|
87
|
+
<div class="display:none social-networks">
|
|
88
|
+
<a
|
|
89
|
+
class="margin-right:15px"
|
|
90
|
+
share-network="twitter"
|
|
91
|
+
title="Share on twitter"
|
|
92
|
+
><i src="/assets/svg/twitter.svg"></i
|
|
93
|
+
></a>
|
|
94
|
+
<a
|
|
95
|
+
class="margin-right:15px"
|
|
96
|
+
share-network="facebook"
|
|
97
|
+
title="Share on Facebook"
|
|
98
|
+
><i src="/assets/svg/facebook.svg"></i
|
|
99
|
+
></a>
|
|
100
|
+
<a
|
|
101
|
+
class="margin-right:15px"
|
|
102
|
+
share-network="instagram"
|
|
103
|
+
title="Share on instagram"
|
|
104
|
+
><i src="/assets/svg/instagram.svg"></i
|
|
105
|
+
></a>
|
|
113
106
|
</div>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
107
|
+
<a
|
|
108
|
+
class="margin-right:15px"
|
|
109
|
+
share-network="share"
|
|
110
|
+
title="Share on share"
|
|
111
|
+
><i src="/assets/svg/share-alt.svg"></i
|
|
112
|
+
></a>
|
|
113
|
+
</div>
|
|
114
|
+
<a
|
|
115
|
+
href="https://github.com/CoCreate-app/CoCreate-utils"
|
|
116
|
+
target="_blank"
|
|
117
|
+
class="margin-right:15px"
|
|
118
|
+
><i src="/assets/svg/github.svg"></i
|
|
119
|
+
></a>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<h1
|
|
123
|
+
class="max-width:500px margin:20px_10px line-height:1.5 font-size:16px font-weight:100"
|
|
124
|
+
>
|
|
125
|
+
A headless vinilla javascript micro component. Easy configuration using
|
|
126
|
+
HTML5 attributes or Javscript api.
|
|
127
|
+
</h1>
|
|
128
|
+
<div id="utils-section" class="display:flex flex-wrap:wrap">
|
|
129
|
+
<div
|
|
130
|
+
class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px"
|
|
131
|
+
>
|
|
132
|
+
<div
|
|
133
|
+
id="utils-install"
|
|
134
|
+
class="border-bottom:1px_solid_lightgrey"
|
|
135
|
+
scroll
|
|
136
|
+
scroll-intersect="color:dodgerblue"
|
|
137
|
+
scroll-selector="#utils-install-section"
|
|
138
|
+
>
|
|
139
|
+
<span
|
|
140
|
+
class="display:flex align-items:center width:fit-content"
|
|
141
|
+
hover="display:block!important"
|
|
142
|
+
hover-selector="[href='#utils-install']"
|
|
143
|
+
>
|
|
144
|
+
<h2 class="padding:5px_0px">Install</h2>
|
|
145
|
+
<a class="margin-left:10px display:none" href="#utils-install"
|
|
146
|
+
><i src="/assets/svg/link.svg"></i
|
|
147
|
+
></a>
|
|
148
|
+
</span>
|
|
149
|
+
</div>
|
|
150
|
+
<pre
|
|
151
|
+
class="margin-top:15px"
|
|
152
|
+
><code class="language-bash">npm i @cocreate/utils</code></pre>
|
|
153
|
+
<p class="padding:10px_0px line-height:1.5">
|
|
154
|
+
Or you can use cdn link:
|
|
155
|
+
</p>
|
|
156
|
+
<pre><code class="language-html"><script>https://cdn.cocreate.app/utils/latest/CoCreate-utils.min.js</script></code></pre>
|
|
146
157
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</p>
|
|
168
|
-
<pre><code class="language-html"><div></div></code></pre>
|
|
158
|
+
<div
|
|
159
|
+
id="utils-usage"
|
|
160
|
+
class="margin-top:80px border-bottom:1px_solid_lightgrey"
|
|
161
|
+
scroll
|
|
162
|
+
scroll-intersect="color:dodgerblue"
|
|
163
|
+
scroll-selector="#utils-usage-section"
|
|
164
|
+
>
|
|
165
|
+
<span
|
|
166
|
+
class="display:flex align-items:center width:fit-content"
|
|
167
|
+
hover="display:block!important"
|
|
168
|
+
hover-selector="[href='#utils-usage']"
|
|
169
|
+
>
|
|
170
|
+
<h2 class="padding:5px_0px">Usage</h2>
|
|
171
|
+
<a class="margin-left:10px display:none" href="#utils-usage"
|
|
172
|
+
><i src="/assets/svg/link.svg"></i
|
|
173
|
+
></a>
|
|
174
|
+
</span>
|
|
175
|
+
</div>
|
|
176
|
+
<p class="padding:10px_0px line-height:1.5">utils usage content</p>
|
|
177
|
+
<pre><code class="language-html"><div></div></code></pre>
|
|
169
178
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
>string</span
|
|
208
|
-
>
|
|
209
|
-
<span class="cocreate-badge warning"
|
|
210
|
-
>optional</span
|
|
211
|
-
>
|
|
212
|
-
</h4>
|
|
213
|
-
<p>utils-attribute</p>
|
|
214
|
-
</li>
|
|
215
|
-
</ul>
|
|
216
|
-
</div>
|
|
179
|
+
<div
|
|
180
|
+
id="utils-attributes"
|
|
181
|
+
class="margin-top:80px border-bottom:1px_solid_lightgrey"
|
|
182
|
+
scroll
|
|
183
|
+
scroll-intersect="color:dodgerblue"
|
|
184
|
+
scroll-selector="#utils-attributes-section"
|
|
185
|
+
>
|
|
186
|
+
<span
|
|
187
|
+
class="display:flex align-items:center width:fit-content"
|
|
188
|
+
hover="display:block!important"
|
|
189
|
+
hover-selector="[href='#utils-attributes']"
|
|
190
|
+
>
|
|
191
|
+
<h2 class="padding:5px_0px">Attributes</h2>
|
|
192
|
+
<a class="margin-left:10px display:none" href="#utils-attributes"
|
|
193
|
+
><i src="/assets/svg/link.svg"></i
|
|
194
|
+
></a>
|
|
195
|
+
</span>
|
|
196
|
+
</div>
|
|
197
|
+
<ul class="list-style-type:none">
|
|
198
|
+
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
199
|
+
<h4>
|
|
200
|
+
<span>utils</span>
|
|
201
|
+
<span class="cocreate-badge success">string</span>
|
|
202
|
+
<span class="cocreate-badge warning">optional</span>
|
|
203
|
+
</h4>
|
|
204
|
+
<p>utils-attribute</p>
|
|
205
|
+
</li>
|
|
206
|
+
<li class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
207
|
+
<h4>
|
|
208
|
+
<span>utils</span>
|
|
209
|
+
<span class="cocreate-badge success">string</span>
|
|
210
|
+
<span class="cocreate-badge warning">optional</span>
|
|
211
|
+
</h4>
|
|
212
|
+
<p>utils-attribute</p>
|
|
213
|
+
</li>
|
|
214
|
+
</ul>
|
|
215
|
+
</div>
|
|
217
216
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
217
|
+
<div
|
|
218
|
+
class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey"
|
|
219
|
+
>
|
|
220
|
+
<!-- SandBox -->
|
|
221
|
+
<div
|
|
222
|
+
id="utils-demo"
|
|
223
|
+
class="border-bottom:1px_solid_lightgrey"
|
|
224
|
+
scroll
|
|
225
|
+
scroll-intersect="color:dodgerblue"
|
|
226
|
+
scroll-selector="#utils-demo-section"
|
|
227
|
+
>
|
|
228
|
+
<span
|
|
229
|
+
class="display:flex align-items:center width:fit-content"
|
|
230
|
+
hover="display:block!important"
|
|
231
|
+
hover-selector="[href='#utils-demo']"
|
|
232
|
+
>
|
|
233
|
+
<h2 class="padding:5px_0px">Demo</h2>
|
|
234
|
+
<a class="margin-left:10px display:none" href="#utils-demo"
|
|
235
|
+
><i src="/assets/svg/link.svg"></i
|
|
236
|
+
></a>
|
|
237
|
+
</span>
|
|
238
|
+
</div>
|
|
239
|
+
<div class="position:sticky top:0 padding:10px_0px height:100vh">
|
|
240
|
+
<!-- SandBox -->
|
|
241
|
+
<div
|
|
242
|
+
class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
|
|
243
|
+
id="playground"
|
|
244
|
+
>
|
|
245
|
+
<div
|
|
246
|
+
id="demo-code"
|
|
247
|
+
resizable
|
|
248
|
+
class="position:relative height:50%"
|
|
249
|
+
>
|
|
250
|
+
<textarea
|
|
251
|
+
type="code"
|
|
252
|
+
lang="html"
|
|
253
|
+
array="demos"
|
|
254
|
+
object=""
|
|
255
|
+
key="demo"
|
|
256
|
+
save="false"
|
|
257
|
+
id="demo"
|
|
258
|
+
input-selector=".demopreview"
|
|
259
|
+
input-attribute="value"
|
|
260
|
+
input-events="input, onload"
|
|
261
|
+
class="height:100% width:100% outline:none border:none resize:none padding:5px"
|
|
262
|
+
></textarea>
|
|
263
|
+
<div resize="bottom" class="background:lightgrey"></div>
|
|
264
|
+
</div>
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
<div
|
|
267
|
+
id="demo-preview"
|
|
268
|
+
class="position:relative overflow:auto background-color:white"
|
|
269
|
+
>
|
|
270
|
+
<div class="demopreview padding:20px"></div>
|
|
271
|
+
</div>
|
|
271
272
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
fullscreen-selector="#playground"></a>
|
|
316
|
-
</div>
|
|
317
|
-
</div>
|
|
318
|
-
<!-- End SandBox -->
|
|
319
|
-
</div>
|
|
320
|
-
</div>
|
|
273
|
+
<div
|
|
274
|
+
class="font-size:20px position:absolute top:10px right:10px opacity:0.6"
|
|
275
|
+
>
|
|
276
|
+
<a
|
|
277
|
+
class="margin-right:10px"
|
|
278
|
+
id="eye"
|
|
279
|
+
show="#eye-slash"
|
|
280
|
+
hide="#eye, #demo-preview"
|
|
281
|
+
toggle="code-height"
|
|
282
|
+
toggle-selector="#demo-code"
|
|
283
|
+
><i class="height:18px" src="/assets/svg/eye.svg"></i
|
|
284
|
+
></a>
|
|
285
|
+
<a
|
|
286
|
+
class="margin-right:10px"
|
|
287
|
+
hidden
|
|
288
|
+
id="eye-slash"
|
|
289
|
+
show="#eye, #demo-preview"
|
|
290
|
+
hide="#eye-slash"
|
|
291
|
+
toggle="code-height"
|
|
292
|
+
toggle-selector="#demo-code"
|
|
293
|
+
><i src="/assets/svg/eye-slash.svg"></i
|
|
294
|
+
></a>
|
|
295
|
+
<a
|
|
296
|
+
class="margin-right:10px"
|
|
297
|
+
id="code"
|
|
298
|
+
show="#code-slash"
|
|
299
|
+
hide="#code, #demo-code"
|
|
300
|
+
><i src="/assets/svg/code.svg"></i
|
|
301
|
+
></a>
|
|
302
|
+
<a
|
|
303
|
+
class="margin-right:10px"
|
|
304
|
+
hidden
|
|
305
|
+
id="code-slash"
|
|
306
|
+
show="#code, #demo-code"
|
|
307
|
+
hide="#code-slash"
|
|
308
|
+
><i class="height:18px" src="/assets/svg/code.svg"></i
|
|
309
|
+
></a>
|
|
310
|
+
<a
|
|
311
|
+
class="margin-right:5px"
|
|
312
|
+
fullscreen
|
|
313
|
+
fullscreen-selector="#playground"
|
|
314
|
+
></a>
|
|
315
|
+
</div>
|
|
321
316
|
</div>
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
317
|
+
<!-- End SandBox -->
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
<button
|
|
322
|
+
href="https://github.com/CoCreate-app/CoCreate-utils/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
|
|
323
|
+
target="_blank"
|
|
324
|
+
class="display:flex justify-content:center align-items:center position:fixed bottom:15px right:15px height:50px width:50px border-radius:50% box-shadow:0px_2px_10px_0px_rgba(0,_0,_0,_0.4)"
|
|
325
|
+
>
|
|
326
|
+
<i src="../assets/svg/pencil-alt.svg"></i>
|
|
327
|
+
</button>
|
|
328
|
+
</main>
|
|
329
|
+
<script src="https://CoCreate.app/dist/CoCreate.js"></script>
|
|
330
|
+
</body>
|
|
331
331
|
</html>
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -17,26 +17,25 @@
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
try {
|
|
20
|
-
let frameDocuments = window.top.frameDocuments;
|
|
21
|
-
if (!frameDocuments) {
|
|
22
|
-
window.top.frameDocuments = new Map();
|
|
23
|
-
frameDocuments = window.top.frameDocuments;
|
|
24
|
-
}
|
|
25
20
|
let frames = document.querySelectorAll('iframe');
|
|
26
21
|
for (let frame of frames) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
try {
|
|
23
|
+
let frameDocument = frame.contentDocument;
|
|
24
|
+
if (!frameDocument.clickedElementListenerAdded) {
|
|
25
|
+
frameDocument.addEventListener('click', e => {
|
|
26
|
+
frameDocument.clickedElement = e.target;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Mark the document to avoid adding duplicate listeners
|
|
30
|
+
frameDocument.clickedElementListenerAdded = true;
|
|
31
|
+
}
|
|
32
|
+
} catch (iframeError) {
|
|
33
|
+
console.log(`Cross-origin frame handling failed for: ${frame}`, iframeError);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
|
|
36
36
|
} catch (e) {
|
|
37
|
-
console.log('
|
|
37
|
+
console.log('Top-level frame document handling failed:', e);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
/**
|
|
@@ -100,42 +99,106 @@
|
|
|
100
99
|
|
|
101
100
|
function dotNotationToObject(data, obj = {}) {
|
|
102
101
|
try {
|
|
102
|
+
let arrayGroup = {}; // Track groups by key paths (e.g., 'messages[a]')
|
|
103
|
+
|
|
103
104
|
for (const key of Object.keys(data)) {
|
|
104
|
-
let value = data[key]
|
|
105
|
-
let newObject = obj
|
|
106
|
-
let oldObject = new Object(obj)
|
|
105
|
+
let value = data[key];
|
|
106
|
+
let newObject = obj;
|
|
107
|
+
let oldObject = new Object(obj);
|
|
107
108
|
let keys = key.split('.');
|
|
108
|
-
let length = keys.length - 1
|
|
109
|
+
let length = keys.length - 1;
|
|
110
|
+
|
|
109
111
|
for (let i = 0; i < keys.length; i++) {
|
|
110
|
-
if
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
newObject[
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
// Check if the key ends with ']', indicating an array or grouping operation
|
|
113
|
+
if (keys[i].endsWith(']')) {
|
|
114
|
+
// Handle array push (e.g., messages[] -> push value)
|
|
115
|
+
if (keys[i].endsWith('[]')) {
|
|
116
|
+
let baseKey = keys[i].slice(0, -2); // Remove '[]'
|
|
117
|
+
|
|
118
|
+
// Initialize newObject[baseKey] as an array if not an array or doesn't exist
|
|
119
|
+
if (!Array.isArray(newObject[baseKey])) {
|
|
120
|
+
newObject[baseKey] = [];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (length == i) {
|
|
124
|
+
// If value is an array, spread the array values into newObject[baseKey]
|
|
125
|
+
if (Array.isArray(value)) {
|
|
126
|
+
newObject[baseKey].push(...value);
|
|
127
|
+
} else {
|
|
128
|
+
// If value is not an array, just push the single value
|
|
129
|
+
newObject[baseKey].push(value);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
123
132
|
}
|
|
124
|
-
|
|
133
|
+
// Check for array index (e.g., messages[0])
|
|
134
|
+
else if (/\[([0-9]+)\]/g.test(keys[i])) {
|
|
135
|
+
let [k, index] = keys[i].split('[');
|
|
136
|
+
index = index.slice(0, -1); // Get the index
|
|
137
|
+
|
|
138
|
+
// Initialize newObject[k] as an array if it doesn't exist or is not an array
|
|
139
|
+
if (!Array.isArray(newObject[k])) {
|
|
140
|
+
newObject[k] = [];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (length == i) {
|
|
144
|
+
if (value === undefined) {
|
|
145
|
+
newObject[k].splice(index, 1); // Remove element if value is undefined
|
|
146
|
+
} else {
|
|
147
|
+
newObject[k][index] = value; // Replace value at specified index
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
newObject[k][index] = oldObject[k][index] || {}; // Initialize inner object
|
|
151
|
+
newObject = newObject[k][index];
|
|
152
|
+
oldObject = oldObject[k][index];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Handle letter-based groupings (e.g., messages[a].role)
|
|
156
|
+
else if (/\[\w\]/g.test(keys[i])) {
|
|
157
|
+
let [k, group] = keys[i].split('[');
|
|
158
|
+
group = group.slice(0, -1); // Get the letter inside []
|
|
159
|
+
|
|
160
|
+
// Initialize newObject[k] as an array if not an array or doesn't exist
|
|
161
|
+
if (!Array.isArray(newObject[k])) {
|
|
162
|
+
newObject[k] = [];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// If there's no object at this group index yet, push a new object
|
|
166
|
+
let index;
|
|
167
|
+
if (arrayGroup[keys.slice(0, i + 1).join('.')]) {
|
|
168
|
+
// Reuse the existing index for the group
|
|
169
|
+
index = arrayGroup[keys.slice(0, i + 1).join('.')];
|
|
170
|
+
} else {
|
|
171
|
+
// Create a new group and track the index
|
|
172
|
+
index = newObject[k].length;
|
|
173
|
+
arrayGroup[keys.slice(0, i + 1).join('.')] = index;
|
|
174
|
+
newObject[k][index] = {};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Move into the newly created or existing object for the group
|
|
178
|
+
if (length == i) {
|
|
179
|
+
newObject[k][index] = value; // Set value in the group
|
|
180
|
+
} else {
|
|
181
|
+
newObject = newObject[k][index]; // Continue with the group object
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Handle regular object keys (non-array keys)
|
|
186
|
+
else {
|
|
125
187
|
if (length == i) {
|
|
126
|
-
if (value === undefined)
|
|
127
|
-
delete newObject[keys[i]]
|
|
128
|
-
else
|
|
129
|
-
newObject[keys[i]] = value;
|
|
188
|
+
if (value === undefined) {
|
|
189
|
+
delete newObject[keys[i]]; // Delete key if value is undefined
|
|
190
|
+
} else {
|
|
191
|
+
newObject[keys[i]] = value; // Set value
|
|
192
|
+
}
|
|
130
193
|
} else {
|
|
131
|
-
newObject[keys[i]] = oldObject[keys[i]] || {};
|
|
132
|
-
newObject = newObject[keys[i]]
|
|
133
|
-
oldObject = oldObject[keys[i]]
|
|
194
|
+
newObject[keys[i]] = oldObject[keys[i]] || {}; // Initialize inner object
|
|
195
|
+
newObject = newObject[keys[i]];
|
|
196
|
+
oldObject = oldObject[keys[i]];
|
|
134
197
|
}
|
|
135
198
|
}
|
|
136
199
|
}
|
|
137
200
|
}
|
|
138
|
-
return obj
|
|
201
|
+
return obj;
|
|
139
202
|
} catch (error) {
|
|
140
203
|
console.log("Error converting dot notation to object", error);
|
|
141
204
|
return false;
|
|
@@ -347,54 +410,42 @@
|
|
|
347
410
|
do {
|
|
348
411
|
if (!node || !node.tagName) return false;
|
|
349
412
|
let pathSplit = node.tagName.toLowerCase();
|
|
350
|
-
|
|
351
|
-
// pathSplit = "[contenteditable]";
|
|
352
|
-
// node = '';
|
|
353
|
-
// }
|
|
413
|
+
|
|
354
414
|
if (node.id) {
|
|
355
415
|
pathSplit += "#" + node.id;
|
|
356
416
|
node = '';
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
417
|
+
} else {
|
|
418
|
+
let eid = node.getAttribute('eid');
|
|
419
|
+
if (eid && !(/{{\s*([\w\W]+)\s*}}/g.test(eid))) {
|
|
420
|
+
pathSplit += `[eid="${eid}"]`;
|
|
421
|
+
node = '';
|
|
422
|
+
} else
|
|
423
|
+
// if (node.classList.length) {
|
|
424
|
+
// node.classList.forEach((item) => {
|
|
425
|
+
// if (item.indexOf(":") === -1) pathSplit += "." + item;
|
|
426
|
+
// });
|
|
427
|
+
// }
|
|
428
|
+
|
|
429
|
+
if (node.parentNode && node.parentNode.children.length > 1) {
|
|
430
|
+
// TODO: improve array logic so ignores javascript generated html??
|
|
431
|
+
let children = []
|
|
432
|
+
for (let child of node.parentNode.children) {
|
|
433
|
+
if (child.tagName == node.tagName)
|
|
434
|
+
children.push(child);
|
|
435
|
+
}
|
|
436
|
+
let index = Array.prototype.indexOf.call(
|
|
437
|
+
children,
|
|
438
|
+
node
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
pathSplit += `:nth-of-type(${index + 1})`;
|
|
382
442
|
}
|
|
383
|
-
let index = Array.prototype.indexOf.call(
|
|
384
|
-
children,
|
|
385
|
-
node
|
|
386
|
-
);
|
|
387
|
-
// if (children.length > 1)
|
|
388
|
-
// pathSplit += `:nth-child(${index + 1})`;
|
|
389
|
-
pathSplit += `:nth-of-type(${index + 1})`;
|
|
390
|
-
}
|
|
391
443
|
|
|
392
|
-
// pathSplits.unshift(pathSplit);
|
|
393
444
|
node = node.parentNode;
|
|
394
|
-
if (node == null || node.tagName == "HTML" || node.tagName == "DOM-PARSER" || node.nodeName == "#document" || node.hasAttribute('contenteditable'))
|
|
445
|
+
if (node == null || node.tagName == "HTML" || node.tagName == "BODY" || node.tagName == "DOM-PARSER" || node.nodeName == "#document" || node.hasAttribute('contenteditable'))
|
|
395
446
|
node = '';
|
|
396
447
|
}
|
|
397
|
-
|
|
448
|
+
|
|
398
449
|
pathSplits.unshift(pathSplit);
|
|
399
450
|
} while (node);
|
|
400
451
|
let path = pathSplits.join(" > ")
|
|
@@ -489,7 +540,19 @@
|
|
|
489
540
|
break;
|
|
490
541
|
default:
|
|
491
542
|
if (k === 0 && type[i] === 'closest')
|
|
492
|
-
|
|
543
|
+
if (specialSelectors[k].includes(' ')) {
|
|
544
|
+
let [firstSelector, ...restSelectors] = specialSelectors[k].split(/ (.+)/);
|
|
545
|
+
queriedElement = queriedElement.closest(firstSelector);
|
|
546
|
+
if (restSelectors.length > 0) {
|
|
547
|
+
if (restSelectors[0].endsWith('[]'))
|
|
548
|
+
queriedElement = queriedElement.querySelectorAll(restSelectors[0].slice(0, -2))
|
|
549
|
+
else
|
|
550
|
+
queriedElement = queriedElement.querySelector(restSelectors[0])
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
// If no space, just use the selector with closest
|
|
554
|
+
queriedElement = queriedElement.closest(specialSelectors[k]);
|
|
555
|
+
}
|
|
493
556
|
else if (specialSelectors[k].endsWith('[]'))
|
|
494
557
|
queriedElement = queriedElement.querySelectorAll(specialSelectors[k].slice(0, -2))
|
|
495
558
|
else
|