@cocreate/unique 1.16.0 → 1.18.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 +19 -0
- package/docs/index.html +10 -12
- package/package.json +3 -3
- package/src/client.js +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [1.18.0](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.17.0...v1.18.0) (2023-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* upgrade dependencies for latest features and fixes ([dc1b88f](https://github.com/CoCreate-app/CoCreate-unique/commit/dc1b88f0f14f162208656ac78ba19c426edf165c))
|
|
7
|
+
|
|
8
|
+
# [1.17.0](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.16.0...v1.17.0) (2023-11-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update nav, edit button and css path ([c25f121](https://github.com/CoCreate-app/CoCreate-unique/commit/c25f1219ade6febd46ea7015154f61fa3e1bca0e))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* upgrade dependencies for latest features and fixes ([265d296](https://github.com/CoCreate-app/CoCreate-unique/commit/265d296a646c5ca0bd018aebff7013fbc0b0b4d9))
|
|
19
|
+
|
|
1
20
|
# [1.16.0](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.15.9...v1.16.0) (2023-11-19)
|
|
2
21
|
|
|
3
22
|
|
package/docs/index.html
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
type="text/css" />
|
|
29
29
|
<link
|
|
30
30
|
rel="stylesheet"
|
|
31
|
-
href="
|
|
31
|
+
href="../index.css"
|
|
32
32
|
array="files"
|
|
33
33
|
object="60888216117c640e7596303f"
|
|
34
34
|
key="src"
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
</head>
|
|
39
39
|
|
|
40
40
|
<body>
|
|
41
|
+
<!-- Navbar -->
|
|
41
42
|
<nav
|
|
42
|
-
class="
|
|
43
|
+
class="width:100% display:flex align-items:center background:transparent padding-top:10px padding-bottom:10px"
|
|
43
44
|
content_id="content"
|
|
44
|
-
scroll="sticky-nav,
|
|
45
|
-
scroll-up="
|
|
46
|
-
scroll-down="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
key="src"></nav>
|
|
45
|
+
scroll="sticky-nav,"
|
|
46
|
+
scroll-up="5"
|
|
47
|
+
scroll-down="5"
|
|
48
|
+
path="../"
|
|
49
|
+
src="../components/navbar.html"></nav>
|
|
50
50
|
<sidenav
|
|
51
51
|
id="menuL"
|
|
52
52
|
class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
|
|
@@ -358,10 +358,8 @@
|
|
|
358
358
|
<button
|
|
359
359
|
href="https://github.com/CoCreate-app/CoCreate-unique/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
|
|
360
360
|
target="_blank"
|
|
361
|
-
class="position:fixed bottom:15px right:15px
|
|
362
|
-
<i
|
|
363
|
-
class="height:20px fill:#505050"
|
|
364
|
-
src="/assets/svg/pencil-alt.svg"></i>
|
|
361
|
+
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)">
|
|
362
|
+
<i class="height:20px" src="../assets/svg/pencil-alt.svg"></i>
|
|
365
363
|
</button>
|
|
366
364
|
</main>
|
|
367
365
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/unique",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "A simple unique component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unique",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/crud-client": "^1.
|
|
62
|
-
"@cocreate/uuid": "^1.
|
|
61
|
+
"@cocreate/crud-client": "^1.31.0",
|
|
62
|
+
"@cocreate/uuid": "^1.9.0"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/client.js
CHANGED
|
@@ -3,15 +3,16 @@ import crud from '@cocreate/crud-client';
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Initializes
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
6
|
+
* Initializes elements to ensure their values are unique. This function targets elements with the 'unique' attribute and uses CRUD operations to check if the element's value already exists.
|
|
7
|
+
* If no elements are provided, it queries and initializes all elements with the 'unique' attribute in the document.
|
|
8
|
+
*
|
|
9
|
+
* @param {(Element|Element[]|null)} [elements] - Optional. A single element, an array of elements, or null.
|
|
10
|
+
* - If a single element or an array of elements is provided, the function checks each element's value for uniqueness.
|
|
11
|
+
* - If null or omitted, all elements in the document with the 'unique' attribute are queried and processed for uniqueness checks.
|
|
12
|
+
*/
|
|
10
13
|
function init(elements) {
|
|
11
|
-
// Returns an array of unique elements
|
|
12
14
|
if (!elements)
|
|
13
15
|
elements = document.querySelectorAll('[unique]')
|
|
14
|
-
// If elements is not an array of elements returns an array of elements.
|
|
15
16
|
else if (!Array.isArray(elements))
|
|
16
17
|
elements = [elements]
|
|
17
18
|
for (let element of elements)
|