express-sweet 1.0.16 → 1.0.19

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +40 -2
  2. package/INSTALL-Redis.md +51 -0
  3. package/README.md +13 -44
  4. package/dist/build.common.js +19 -11
  5. package/dist/build.esm.js +19 -11
  6. package/docs/{styles/docs.css → docs.css} +99 -100
  7. package/docs/docs.js +41 -0
  8. package/docs/{images → img/associations}/belongs-to-many.png +0 -0
  9. package/docs/{images → img/associations}/belongs-to.png +0 -0
  10. package/docs/{images → img/associations}/has-many.png +0 -0
  11. package/docs/{images → img/associations}/has-one.png +0 -0
  12. package/docs/img/demos/login&users.jfif +0 -0
  13. package/docs/img/hero.svg +1 -0
  14. package/docs/{images → img}/logo.svg +0 -0
  15. package/docs/index.html +2552 -3144
  16. package/docs/templates/cjs/authentication.js +96 -0
  17. package/docs/templates/cjs/config.js +78 -0
  18. package/docs/templates/cjs/database.js +35 -0
  19. package/docs/templates/cjs/view.js +36 -0
  20. package/docs/templates/esm/authentication.js +96 -0
  21. package/docs/templates/esm/config.js +78 -0
  22. package/docs/templates/esm/database.js +35 -0
  23. package/docs/templates/esm/view.js +36 -0
  24. package/package.json +9 -6
  25. package/types/database/Model.d.ts +8 -8
  26. package/types/handlebars_helpers/date.d.ts +14 -0
  27. package/types/handlebars_helpers/index.d.ts +2 -1
  28. package/types/handlebars_helpers/string.d.ts +20 -0
  29. package/types/interfaces/AuthenticationOptions.d.ts +13 -0
  30. package/types/middlewares/CORS.d.ts +1 -1
  31. package/types/package.d.ts +3 -0
  32. package/types/services/AWSRekognitionClient.d.ts +2 -2
  33. package/types/services/RedisClient.d.ts +1 -1
  34. package/types/utils/Types.d.ts +8 -0
  35. package/types/utils/index.d.ts +7 -2
  36. package/types/utils/isArray.d.ts +8 -0
  37. package/types/utils/isAsyncFunction.d.ts +12 -0
  38. package/types/utils/isObject.d.ts +8 -0
  39. package/types/utils/isString.d.ts +8 -0
  40. package/docs/images/all.jpg +0 -0
  41. package/docs/images/edit-user.png +0 -0
  42. package/docs/images/home.png +0 -0
  43. package/docs/images/login.png +0 -0
  44. package/docs/images/logo-dark.svg +0 -12
  45. package/docs/images/new-user.png +0 -0
  46. package/docs/images/user-list.png +0 -0
  47. package/docs/scripts/docs.js +0 -23
@@ -13,7 +13,7 @@ export default class {
13
13
  /**
14
14
  * Constructs a rekognition client object.
15
15
  */
16
- constructor(opts: RekognitionOptions);
16
+ constructor(options: RekognitionOptions);
17
17
  /**
18
18
  * Detects faces within an image that is provided as input.
19
19
  * For each face detected, the operation returns a bounding box of the face.
@@ -268,7 +268,7 @@ export default class {
268
268
  * If options.maxFaces is 2 or more, the list of face information found is returned.
269
269
  * Returns null if no face is found.
270
270
  */
271
- searchFaces(collectionId: string, img: string, opts?: {
271
+ searchFaces(collectionId: string, img: string, options?: {
272
272
  minConfidence?: number;
273
273
  maxFaces?: number;
274
274
  }): Promise<FaceMatch[] | FaceMatch | null>;
@@ -76,5 +76,5 @@ export default class extends IORedis.Redis {
76
76
  * const unixSocketRedis = new RedisClient({path: "/tmp/echo.sock"});
77
77
  * const redis = new RedisClient({host: 'localhost', port: 6379});
78
78
  */
79
- constructor(opts: IORedis.IRedisOptions);
79
+ constructor(options: IORedis.IRedisOptions);
80
80
  }
@@ -13,4 +13,12 @@ export default class {
13
13
  * @return {boolean}
14
14
  */
15
15
  static isAsyncFunction(value: Function): boolean;
16
+ /**
17
+ * Return true if `val` is a non-empty string.
18
+ *
19
+ * @param {any} `val` The value to check
20
+ * @return {Boolean}
21
+ * @api public
22
+ */
23
+ static isString(value: any): boolean;
16
24
  }
@@ -1,2 +1,7 @@
1
- import Types from './Types';
2
- export { Types };
1
+ declare const _default: {
2
+ isAsyncFunction: (value: Function) => boolean;
3
+ isString: (value: any) => boolean;
4
+ isObject: (value: any) => boolean;
5
+ isArray: (value: any) => boolean;
6
+ };
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: (value: any) => boolean;
2
+ /**
3
+ * Check if param is an array.
4
+ *
5
+ * @param {any} value
6
+ * @returns {boolean}
7
+ */
8
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: (value: Function) => boolean;
2
+ /**
3
+ * Returns true for asynchronous functions, false otherwise.
4
+ *
5
+ * @example
6
+ * utils.isAsyncFunction(async () => {});// true
7
+ * utils.isAsyncFunction(() => {});// false
8
+ *
9
+ * @param {Function} value
10
+ * @return {boolean}
11
+ */
12
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: (value: any) => boolean;
2
+ /**
3
+ * Check if param is an object.
4
+ *
5
+ * @param {any} value Character strings, arrays, objects, etc. to be checked.
6
+ * @returns {boolean} Returns true if it is an object.
7
+ */
8
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: (value: any) => boolean;
2
+ /**
3
+ * Return true if `val` is a non-empty string.
4
+ *
5
+ * @param {any} `val` The value to check
6
+ * @return {boolean}
7
+ */
8
+ export default _default;
Binary file
Binary file
Binary file
Binary file
@@ -1,12 +0,0 @@
1
- <svg width="512" height="294" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet">
2
- <!-- <svg width="512" height="145" viewBox="0 0 512 145" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet"> -->
3
- <g>
4
- <g fill="#83CD29" id="svg_1">
5
- <path d="m471.05,51.611c-1.244,0 -2.454,0.257 -3.525,0.863l-33.888,19.57c-2.193,1.264 -3.526,3.65 -3.526,6.189l0,39.069c0,2.537 1.333,4.92 3.526,6.187l8.85,5.109c4.3,2.119 5.885,2.086 7.842,2.086c6.366,0 10.001,-3.863 10.001,-10.576l0,-38.566c0,-0.545 -0.472,-0.935 -1.007,-0.935l-4.245,0c-0.544,0 -1.007,0.39 -1.007,0.935l0,38.566c0,2.975 -3.1,5.968 -8.13,3.453l-9.21,-5.396c-0.326,-0.177 -0.576,-0.49 -0.576,-0.863l0,-39.07c0,-0.37 0.247,-0.747 0.576,-0.935l33.816,-19.497a0.998,0.998 0 0 1 1.007,0l33.817,19.498c0.322,0.194 0.576,0.553 0.576,0.936l0,39.069c0,0.373 -0.188,0.755 -0.504,0.935l-33.889,19.498c-0.29,0.173 -0.69,0.173 -1.007,0l-8.706,-5.18a0.905,0.905 0 0 0 -0.863,0c-2.403,1.362 -2.855,1.52 -5.109,2.302c-0.555,0.194 -1.398,0.495 0.288,1.44l11.368,6.69a6.995,6.995 0 0 0 3.526,0.936a6.949,6.949 0 0 0 3.525,-0.935l33.889,-19.499c2.193,-1.275 3.525,-3.65 3.525,-6.187l0,-39.07c0,-2.538 -1.332,-4.92 -3.525,-6.187l-33.889,-19.57c-1.062,-0.607 -2.28,-0.864 -3.525,-0.864l-0.001,-0.001z" id="svg_2"/>
6
- <path d="m480.116,79.528c-9.65,0 -15.397,4.107 -15.397,10.937c0,7.408 5.704,9.444 14.966,10.36c11.08,1.085 11.943,2.712 11.943,4.893c0,3.783 -3.016,5.396 -10.144,5.396c-8.957,0 -10.925,-2.236 -11.584,-6.691c-0.078,-0.478 -0.447,-0.864 -0.936,-0.864l-4.389,0c-0.54,0 -1.007,0.466 -1.007,1.008c0,5.703 3.102,12.447 17.916,12.447c10.723,0 16.908,-4.209 16.908,-11.584c0,-7.31 -4.996,-9.273 -15.398,-10.648c-10.51,-1.391 -11.512,-2.072 -11.512,-4.533c0,-2.032 0.85,-4.75 8.634,-4.75c6.954,0 9.524,1.5 10.577,6.189c0.092,0.44 0.48,0.791 0.935,0.791l4.39,0c0.27,0 0.532,-0.166 0.719,-0.36c0.184,-0.207 0.314,-0.44 0.288,-0.719c-0.68,-8.074 -6.064,-11.872 -16.909,-11.872z" id="svg_3"/>
7
- </g>
8
- <path d="m271.821,0.383a2.181,2.181 0 0 0 -1.08,0.287a2.18,2.18 0 0 0 -1.079,1.871l0,55.042c0,0.54 -0.251,1.024 -0.719,1.295a1.501,1.501 0 0 1 -1.511,0l-8.994,-5.18a4.31,4.31 0 0 0 -4.317,0l-35.903,20.721c-1.342,0.775 -2.158,2.264 -2.158,3.814l0,41.443c0,1.548 0.817,2.966 2.158,3.741l35.903,20.722a4.3,4.3 0 0 0 4.317,0l35.903,-20.722a4.308,4.308 0 0 0 2.159,-3.741l0,-103.32a4.386,4.386 0 0 0 -2.23,-3.814l-21.37,-11.944c-0.335,-0.187 -0.707,-0.22 -1.079,-0.215zm-230.96,51.732c-0.684,0.027 -1.328,0.147 -1.942,0.503l-35.904,20.722a4.3,4.3 0 0 0 -2.158,3.741l0.072,55.619c0,0.773 0.399,1.492 1.079,1.87a2.096,2.096 0 0 0 2.159,0l21.297,-12.231c1.349,-0.802 2.23,-2.196 2.23,-3.742l0,-25.974c0,-1.55 0.815,-2.972 2.159,-3.742l9.065,-5.252a4.251,4.251 0 0 1 2.159,-0.576c0.74,0 1.5,0.185 2.158,0.576l9.066,5.252a4.296,4.296 0 0 1 2.159,3.742l0,25.973c0,1.546 0.89,2.95 2.23,3.742l21.297,12.232a2.096,2.096 0 0 0 2.159,0a2.164,2.164 0 0 0 1.08,-1.871l0.07,-55.618a4.28,4.28 0 0 0 -2.158,-3.741l-35.903,-20.722c-0.607,-0.356 -1.253,-0.475 -1.942,-0.503l-0.432,0zm322.624,0.503c-0.75,0 -1.485,0.19 -2.158,0.576l-35.903,20.722a4.306,4.306 0 0 0 -2.159,3.741l0,41.443c0,1.559 0.878,2.971 2.23,3.742l35.616,20.29c1.315,0.75 2.921,0.807 4.245,0.07l21.585,-12.015c0.685,-0.38 1.148,-1.09 1.151,-1.87a2.126,2.126 0 0 0 -1.079,-1.871l-36.119,-20.722c-0.676,-0.386 -1.151,-1.167 -1.151,-1.943l0,-12.95c0,-0.775 0.48,-1.485 1.151,-1.871l11.224,-6.476a2.155,2.155 0 0 1 2.159,0l11.223,6.476a2.152,2.152 0 0 1 1.08,1.87l0,10.217a2.15,2.15 0 0 0 1.079,1.87c0.673,0.389 1.487,0.39 2.158,0l21.514,-12.517a4.325,4.325 0 0 0 2.159,-3.742l0,-10c0,-1.545 -0.82,-2.966 -2.159,-3.742l-35.687,-20.722a4.279,4.279 0 0 0 -2.159,-0.575l0,-0.001zm-107.35,30.939c0.188,0 0.408,0.046 0.576,0.143l12.304,7.123c0.334,0.193 0.576,0.55 0.576,0.935l0,14.246c0,0.387 -0.24,0.743 -0.576,0.936l-12.304,7.123a1.088,1.088 0 0 1 -1.079,0l-12.303,-7.123c-0.335,-0.194 -0.576,-0.549 -0.576,-0.936l0,-14.246c0,-0.386 0.242,-0.74 0.576,-0.935l12.303,-7.122a0.948,0.948 0 0 1 0.504,-0.143l0,-0.001l-0.001,0z" fill="#fff" id="svg_4"/>
9
- <path d="m148.714,52.402c-0.748,0 -1.488,0.19 -2.158,0.576l-35.903,20.65c-1.343,0.773 -2.159,2.265 -2.159,3.813l0,41.443c0,1.55 0.817,2.966 2.159,3.742l35.903,20.721a4.297,4.297 0 0 0 4.317,0l35.903,-20.721a4.308,4.308 0 0 0 2.158,-3.742l0,-41.443c0,-1.55 -0.816,-3.04 -2.158,-3.813l-35.903,-20.65a4.297,4.297 0 0 0 -2.159,-0.576zm214.699,36.983c-0.143,0 -0.302,0 -0.431,0.072l-6.907,4.029a0.84,0.84 0 0 0 -0.432,0.72l0,7.914c0,0.298 0.172,0.571 0.432,0.72l6.907,3.957c0.259,0.15 0.535,0.15 0.791,0l6.907,-3.958a0.846,0.846 0 0 0 0.432,-0.719l0,-7.915a0.846,0.846 0 0 0 -0.432,-0.719l-6.907,-4.03c-0.128,-0.075 -0.216,-0.07 -0.36,-0.07l0,-0.001z" fill="#83CD29" id="svg_5"/>
10
- <path d="m3.332,260.629l0,-56.981l71.144,0l0,-3.333l-71.144,0l0,-51.983l75.642,0l0,-3.332l-78.974,0l0,118.961l79.64,0l0,-3.332l-76.307,0l-0.001,0zm140.455,-82.307l-29.49,38.821l-28.825,-38.82l-4.332,0l31.157,41.32l-34.157,44.317l3.999,0l32.156,-41.82l32.323,41.82l4.165,0l-34.322,-44.319l31.323,-41.32l-3.998,0l0.001,0.001zm16.994,114.963l0,-53.315l0.333,0c2,7.775 5.943,14.023 11.83,18.744c5.887,4.72 13.384,7.081 22.492,7.081c5.887,0 11.108,-1.194 15.662,-3.582s8.358,-5.637 11.413,-9.747c3.054,-4.11 5.387,-8.886 6.998,-14.329c1.61,-5.442 2.416,-11.163 2.416,-17.16c0,-6.443 -0.834,-12.386 -2.5,-17.828c-1.666,-5.443 -4.082,-10.164 -7.247,-14.162c-3.166,-3.999 -6.998,-7.11 -11.497,-9.33c-4.498,-2.222 -9.58,-3.333 -15.245,-3.333c-4.332,0 -8.358,0.639 -12.079,1.916c-3.721,1.278 -7.025,3.082 -9.913,5.415a36.674,36.674 0 0 0 -7.498,8.247c-2.11,3.166 -3.721,6.637 -4.832,10.414l-0.333,0l0,-23.994l-3.332,0l0,114.963l3.332,0zm34.655,-30.657c-10.44,0 -18.827,-3.582 -25.158,-10.746c-6.331,-7.164 -9.497,-17.467 -9.497,-30.907c0,-5.554 0.778,-10.83 2.333,-15.828c1.555,-4.998 3.804,-9.386 6.747,-13.162c2.944,-3.777 6.582,-6.776 10.913,-8.997c4.332,-2.222 9.22,-3.333 14.662,-3.333c5.554,0 10.414,1.111 14.579,3.333c4.165,2.221 7.609,5.248 10.33,9.08s4.776,8.22 6.165,13.162c1.388,4.943 2.082,10.191 2.082,15.745c0,4.999 -0.638,9.97 -1.916,14.912c-1.277,4.943 -3.249,9.386 -5.915,13.33c-2.665,3.942 -6.08,7.163 -10.246,9.663c-4.166,2.499 -9.192,3.748 -15.079,3.748zm54.816,1.333l0,-48.484c0,-4.665 0.666,-9.22 2,-13.662c1.332,-4.443 3.387,-8.359 6.164,-11.746c2.777,-3.388 6.303,-6.054 10.58,-7.998c4.276,-1.944 9.358,-2.749 15.245,-2.416l0,-3.332c-5.11,-0.11 -9.58,0.444 -13.412,1.666c-3.833,1.222 -7.137,2.888 -9.914,4.999c-2.777,2.11 -4.998,4.581 -6.664,7.414a33.15,33.15 0 0 0 -3.666,9.08l-0.333,0l0,-21.16l-3.332,0l0,85.64l3.332,0l0,-0.001zm38.154,-42.153l71.643,0c0.223,-5.887 -0.36,-11.551 -1.749,-16.994c-1.388,-5.443 -3.61,-10.275 -6.664,-14.495c-3.055,-4.221 -6.998,-7.609 -11.83,-10.164c-4.832,-2.555 -10.58,-3.832 -17.244,-3.832c-4.777,0 -9.442,1 -13.996,3c-4.554,1.999 -8.553,4.914 -11.996,8.746c-3.443,3.832 -6.22,8.525 -8.33,14.08c-2.11,5.553 -3.166,11.884 -3.166,18.993c0,6.331 0.722,12.246 2.166,17.744c1.444,5.498 3.665,10.275 6.664,14.329c3,4.054 6.86,7.192 11.58,9.413c4.72,2.222 10.413,3.277 17.078,3.166c9.774,0 17.994,-2.75 24.658,-8.247c6.665,-5.499 10.608,-13.246 11.83,-23.243l-3.332,0c-1.444,9.442 -5.138,16.523 -11.08,21.243c-5.943,4.721 -13.412,7.081 -22.41,7.081c-6.109,0 -11.274,-1.055 -15.495,-3.165c-4.22,-2.11 -7.664,-4.999 -10.33,-8.664c-2.665,-3.666 -4.637,-7.97 -5.914,-12.913c-1.278,-4.942 -1.972,-10.302 -2.083,-16.078zm68.311,-3.332l-68.31,0c0.332,-5.998 1.443,-11.385 3.331,-16.161c1.889,-4.777 4.36,-8.859 7.415,-12.246c3.054,-3.388 6.609,-5.97 10.663,-7.748c4.054,-1.777 8.414,-2.666 13.079,-2.666c5.554,0 10.44,1.028 14.662,3.083c4.22,2.055 7.747,4.86 10.58,8.414c2.832,3.554 4.97,7.692 6.414,12.412c1.444,4.721 2.166,9.692 2.166,14.912zm72.477,-14.828l3.332,0c0,-9.553 -2.777,-16.495 -8.33,-20.827c-5.555,-4.332 -13.108,-6.498 -22.66,-6.498c-5.332,0 -9.83,0.667 -13.496,2c-3.665,1.332 -6.664,3.054 -8.997,5.164c-2.332,2.11 -3.998,4.443 -4.998,6.998c-1,2.555 -1.5,4.999 -1.5,7.331c0,4.665 0.833,8.386 2.5,11.163c1.666,2.777 4.276,4.943 7.83,6.498c2.444,1.11 5.22,2.11 8.331,3c3.11,0.888 6.72,1.832 10.83,2.831c3.665,0.89 7.275,1.778 10.83,2.666c3.554,0.889 6.692,2.083 9.413,3.582c2.722,1.5 4.943,3.416 6.665,5.749c1.721,2.332 2.582,5.387 2.582,9.163c0,3.666 -0.86,6.776 -2.582,9.33a20.815,20.815 0 0 1 -6.581,6.249c-2.666,1.61 -5.638,2.776 -8.914,3.498c-3.277,0.722 -6.47,1.083 -9.58,1.083c-10.108,0 -17.856,-2.249 -23.243,-6.747c-5.387,-4.499 -8.08,-11.58 -8.08,-21.244l-3.333,0c0,10.775 2.916,18.661 8.747,23.66c5.832,4.998 14.468,7.497 25.909,7.497c3.665,0 7.358,-0.417 11.08,-1.25c3.72,-0.833 7.053,-2.193 9.996,-4.082a22.592,22.592 0 0 0 7.164,-7.33c1.833,-3 2.75,-6.665 2.75,-10.997c0,-4.11 -0.806,-7.442 -2.416,-9.997c-1.611,-2.554 -3.721,-4.665 -6.332,-6.331c-2.61,-1.666 -5.553,-2.971 -8.83,-3.915a516.08,516.08 0 0 0 -9.914,-2.75a1726.675,1726.675 0 0 0 -12.246,-3.165c-3.498,-0.889 -6.747,-1.944 -9.746,-3.166c-2.888,-1.222 -5.193,-2.971 -6.915,-5.248c-1.722,-2.277 -2.582,-5.526 -2.582,-9.747c0,-0.777 0.222,-2.166 0.666,-4.165c0.444,-2 1.5,-4.027 3.166,-6.082c1.666,-2.054 4.22,-3.887 7.664,-5.498c3.443,-1.61 8.164,-2.416 14.162,-2.416c4.11,0 7.858,0.445 11.246,1.333c3.388,0.889 6.304,2.305 8.747,4.249c2.444,1.944 4.332,4.415 5.665,7.414c1.333,3 2,6.665 2,10.997zm77.141,0l3.332,0c0,-9.553 -2.776,-16.495 -8.33,-20.827c-5.554,-4.332 -13.107,-6.498 -22.66,-6.498c-5.331,0 -9.83,0.667 -13.495,2c-3.666,1.332 -6.665,3.054 -8.997,5.164c-2.333,2.11 -3.999,4.443 -4.999,6.998c-1,2.555 -1.499,4.999 -1.499,7.331c0,4.665 0.833,8.386 2.5,11.163c1.665,2.777 4.276,4.943 7.83,6.498c2.444,1.11 5.22,2.11 8.33,3c3.11,0.888 6.72,1.832 10.83,2.831c3.666,0.89 7.276,1.778 10.83,2.666c3.555,0.889 6.692,2.083 9.414,3.582c2.721,1.5 4.943,3.416 6.664,5.749c1.722,2.332 2.583,5.387 2.583,9.163c0,3.666 -0.861,6.776 -2.583,9.33a20.815,20.815 0 0 1 -6.58,6.249c-2.667,1.61 -5.638,2.776 -8.915,3.498c-3.276,0.722 -6.47,1.083 -9.58,1.083c-10.108,0 -17.855,-2.249 -23.242,-6.747c-5.388,-4.499 -8.081,-11.58 -8.081,-21.244l-3.332,0c0,10.775 2.915,18.661 8.747,23.66c5.831,4.998 14.467,7.497 25.908,7.497c3.666,0 7.359,-0.417 11.08,-1.25c3.72,-0.833 7.053,-2.193 9.997,-4.082a22.592,22.592 0 0 0 7.164,-7.33c1.833,-3 2.749,-6.665 2.749,-10.997c0,-4.11 -0.805,-7.442 -2.416,-9.997c-1.61,-2.554 -3.72,-4.665 -6.331,-6.331c-2.61,-1.666 -5.554,-2.971 -8.83,-3.915a516.071,516.071 0 0 0 -9.914,-2.75a1726.65,1726.65 0 0 0 -12.246,-3.165c-3.499,-0.889 -6.748,-1.944 -9.747,-3.166c-2.888,-1.222 -5.193,-2.971 -6.914,-5.248c-1.722,-2.277 -2.583,-5.526 -2.583,-9.747c0,-0.777 0.222,-2.166 0.667,-4.165c0.444,-2 1.5,-4.027 3.165,-6.082c1.666,-2.054 4.221,-3.887 7.664,-5.498c3.444,-1.61 8.164,-2.416 14.163,-2.416c4.11,0 7.858,0.445 11.246,1.333c3.388,0.889 6.303,2.305 8.747,4.249c2.444,1.944 4.332,4.415 5.665,7.414c1.333,3 2,6.665 2,10.997l-0.001,0z" fill="#fff" id="svg_6"/>
11
- </g>
12
- </svg>
Binary file
Binary file
@@ -1,23 +0,0 @@
1
- (() => {
2
- // Highlight the code block.
3
- document.querySelectorAll('pre code').forEach((block) =>
4
- hljs.highlightBlock(block));
5
-
6
- // Overlay when the sidebar opens.
7
- const sidebar = document.querySelector('#sidebar');
8
- const body = document.body;
9
- const sidebarCollapse = new bootstrap.Collapse(sidebar, {toggle: false});
10
-
11
- // Show overlay when opening sidebar.
12
- sidebar.addEventListener('shown.bs.collapse', () =>
13
- body.setAttribute('data-offcanvas-sidebar', 'on'));
14
-
15
- // Hide the overlay when you close the sidebar.
16
- sidebar.addEventListener('hidden.bs.collapse', () =>
17
- body.removeAttribute('data-offcanvas-sidebar'));
18
-
19
- // Close the sidebar when the overlay is clicked.
20
- const sidebarOverlay = document.querySelector('.sidebar-overlay');
21
- sidebarOverlay.addEventListener('click', () =>
22
- sidebarCollapse.hide());
23
- })();