@alanizcreative/formation-static 0.0.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.
Files changed (329) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +145 -0
  3. package/cjs/actions/actions.d.ts +8 -0
  4. package/cjs/actions/actions.js +1 -0
  5. package/cjs/actions/actionsTypes.d.ts +10 -0
  6. package/cjs/actions/actionsTypes.js +1 -0
  7. package/cjs/components/Navigation/Navigation.d.ts +14 -0
  8. package/cjs/components/Navigation/Navigation.js +1 -0
  9. package/cjs/components/Navigation/NavigationTypes.d.ts +88 -0
  10. package/cjs/components/Navigation/NavigationTypes.js +1 -0
  11. package/cjs/components/Pagination/Pagination.d.ts +3 -0
  12. package/cjs/components/Pagination/Pagination.js +1 -0
  13. package/cjs/components/Pagination/PaginationTypes.d.ts +54 -0
  14. package/cjs/components/Pagination/PaginationTypes.js +1 -0
  15. package/cjs/config/config.d.ts +5 -0
  16. package/cjs/config/config.js +1 -0
  17. package/cjs/config/configTypes.d.ts +66 -0
  18. package/cjs/config/configTypes.js +1 -0
  19. package/cjs/contentful/contentfulData.d.ts +5 -0
  20. package/cjs/contentful/contentfulData.js +1 -0
  21. package/cjs/contentful/contentfulDataNormal.d.ts +4 -0
  22. package/cjs/contentful/contentfulDataNormal.js +1 -0
  23. package/cjs/contentful/contentfulDataTypes.d.ts +78 -0
  24. package/cjs/contentful/contentfulDataTypes.js +1 -0
  25. package/cjs/filters/filters.d.ts +8 -0
  26. package/cjs/filters/filters.js +1 -0
  27. package/cjs/filters/filtersTypes.d.ts +60 -0
  28. package/cjs/filters/filtersTypes.js +1 -0
  29. package/cjs/global/globalTypes.d.ts +34 -0
  30. package/cjs/global/globalTypes.js +1 -0
  31. package/cjs/layouts/Column/Column.d.ts +3 -0
  32. package/cjs/layouts/Column/Column.js +1 -0
  33. package/cjs/layouts/Column/ColumnTypes.d.ts +16 -0
  34. package/cjs/layouts/Column/ColumnTypes.js +1 -0
  35. package/cjs/layouts/Container/Container.d.ts +3 -0
  36. package/cjs/layouts/Container/Container.js +1 -0
  37. package/cjs/layouts/Container/ContainerTypes.d.ts +15 -0
  38. package/cjs/layouts/Container/ContainerTypes.js +1 -0
  39. package/cjs/local/localData.d.ts +5 -0
  40. package/cjs/local/localData.js +1 -0
  41. package/cjs/local/localDataNormal.d.ts +3 -0
  42. package/cjs/local/localDataNormal.js +1 -0
  43. package/cjs/local/localDataTypes.d.ts +14 -0
  44. package/cjs/local/localDataTypes.js +1 -0
  45. package/cjs/objects/Form/Form.d.ts +3 -0
  46. package/cjs/objects/Form/Form.js +1 -0
  47. package/cjs/objects/Form/FormField.d.ts +3 -0
  48. package/cjs/objects/Form/FormField.js +1 -0
  49. package/cjs/objects/Form/FormOption.d.ts +3 -0
  50. package/cjs/objects/Form/FormOption.js +1 -0
  51. package/cjs/objects/Form/FormTypes.d.ts +76 -0
  52. package/cjs/objects/Form/FormTypes.js +1 -0
  53. package/cjs/package.json +1 -0
  54. package/cjs/redirects/redirects.d.ts +4 -0
  55. package/cjs/redirects/redirects.js +1 -0
  56. package/cjs/redirects/redirectsFile.d.ts +2 -0
  57. package/cjs/redirects/redirectsFile.js +1 -0
  58. package/cjs/render/render.d.ts +11 -0
  59. package/cjs/render/render.js +1 -0
  60. package/cjs/render/renderInline.d.ts +4 -0
  61. package/cjs/render/renderInline.js +1 -0
  62. package/cjs/render/renderTypes.d.ts +197 -0
  63. package/cjs/render/renderTypes.js +1 -0
  64. package/cjs/scripts/scripts.d.ts +8 -0
  65. package/cjs/scripts/scripts.js +1 -0
  66. package/cjs/scripts/scriptsTypes.d.ts +15 -0
  67. package/cjs/scripts/scriptsTypes.js +1 -0
  68. package/cjs/serverless/Contact/Contact.d.ts +3 -0
  69. package/cjs/serverless/Contact/Contact.js +1 -0
  70. package/cjs/serverless/Contact/ContactTypes.d.ts +13 -0
  71. package/cjs/serverless/Contact/ContactTypes.js +1 -0
  72. package/cjs/serverless/serverless.d.ts +12 -0
  73. package/cjs/serverless/serverless.js +1 -0
  74. package/cjs/serverless/serverlessTypes.d.ts +41 -0
  75. package/cjs/serverless/serverlessTypes.js +1 -0
  76. package/cjs/shortcodes/shortcodes.d.ts +10 -0
  77. package/cjs/shortcodes/shortcodes.js +1 -0
  78. package/cjs/shortcodes/shortcodesTypes.d.ts +20 -0
  79. package/cjs/shortcodes/shortcodesTypes.js +1 -0
  80. package/cjs/store/store.d.ts +9 -0
  81. package/cjs/store/store.js +1 -0
  82. package/cjs/store/storeFiles.d.ts +2 -0
  83. package/cjs/store/storeFiles.js +1 -0
  84. package/cjs/store/storeTypes.d.ts +28 -0
  85. package/cjs/store/storeTypes.js +1 -0
  86. package/cjs/text/RichText/RichText.d.ts +4 -0
  87. package/cjs/text/RichText/RichText.js +1 -0
  88. package/cjs/text/RichText/RichTextTypes.d.ts +54 -0
  89. package/cjs/text/RichText/RichTextTypes.js +1 -0
  90. package/cjs/utils/ResponseError/ResponseError.d.ts +5 -0
  91. package/cjs/utils/ResponseError/ResponseError.js +1 -0
  92. package/cjs/utils/archive/archive.d.ts +10 -0
  93. package/cjs/utils/archive/archive.js +1 -0
  94. package/cjs/utils/archive/archiveTypes.d.ts +29 -0
  95. package/cjs/utils/archive/archiveTypes.js +1 -0
  96. package/cjs/utils/array/array.d.ts +3 -0
  97. package/cjs/utils/array/array.js +1 -0
  98. package/cjs/utils/boolean/boolean.d.ts +2 -0
  99. package/cjs/utils/boolean/boolean.js +1 -0
  100. package/cjs/utils/contentType/contentType.d.ts +2 -0
  101. package/cjs/utils/contentType/contentType.js +1 -0
  102. package/cjs/utils/dataSource/dataSource.d.ts +3 -0
  103. package/cjs/utils/dataSource/dataSource.js +1 -0
  104. package/cjs/utils/dataSource/dataSourceTypes.d.ts +9 -0
  105. package/cjs/utils/dataSource/dataSourceTypes.js +1 -0
  106. package/cjs/utils/escape/escape.d.ts +2 -0
  107. package/cjs/utils/escape/escape.js +1 -0
  108. package/cjs/utils/excerpt/excerpt.d.ts +3 -0
  109. package/cjs/utils/excerpt/excerpt.js +1 -0
  110. package/cjs/utils/excerpt/excerptTypes.d.ts +14 -0
  111. package/cjs/utils/excerpt/excerptTypes.js +1 -0
  112. package/cjs/utils/file/file.d.ts +3 -0
  113. package/cjs/utils/file/file.js +1 -0
  114. package/cjs/utils/file/filePath.d.ts +2 -0
  115. package/cjs/utils/file/filePath.js +1 -0
  116. package/cjs/utils/function/function.d.ts +3 -0
  117. package/cjs/utils/function/function.js +1 -0
  118. package/cjs/utils/heading/heading.d.ts +2 -0
  119. package/cjs/utils/heading/heading.js +1 -0
  120. package/cjs/utils/image/image.d.ts +5 -0
  121. package/cjs/utils/image/image.js +1 -0
  122. package/cjs/utils/image/imageLocal.d.ts +3 -0
  123. package/cjs/utils/image/imageLocal.js +1 -0
  124. package/cjs/utils/image/imageRemote.d.ts +3 -0
  125. package/cjs/utils/image/imageRemote.js +1 -0
  126. package/cjs/utils/image/imageTypes.d.ts +69 -0
  127. package/cjs/utils/image/imageTypes.js +1 -0
  128. package/cjs/utils/json/json.d.ts +3 -0
  129. package/cjs/utils/json/json.js +1 -0
  130. package/cjs/utils/link/link.d.ts +6 -0
  131. package/cjs/utils/link/link.js +1 -0
  132. package/cjs/utils/link/linkShare.d.ts +3 -0
  133. package/cjs/utils/link/linkShare.js +1 -0
  134. package/cjs/utils/link/linkTypes.d.ts +28 -0
  135. package/cjs/utils/link/linkTypes.js +1 -0
  136. package/cjs/utils/map/map.d.ts +2 -0
  137. package/cjs/utils/map/map.js +1 -0
  138. package/cjs/utils/minify/minify.d.ts +2 -0
  139. package/cjs/utils/minify/minify.js +1 -0
  140. package/cjs/utils/number/number.d.ts +2 -0
  141. package/cjs/utils/number/number.js +1 -0
  142. package/cjs/utils/object/object.d.ts +4 -0
  143. package/cjs/utils/object/object.js +1 -0
  144. package/cjs/utils/object/objectUtils.d.ts +2 -0
  145. package/cjs/utils/object/objectUtils.js +1 -0
  146. package/cjs/utils/path/path.d.ts +3 -0
  147. package/cjs/utils/path/path.js +1 -0
  148. package/cjs/utils/print/print.d.ts +2 -0
  149. package/cjs/utils/print/print.js +1 -0
  150. package/cjs/utils/set/set.d.ts +3 -0
  151. package/cjs/utils/set/set.js +1 -0
  152. package/cjs/utils/string/string.d.ts +3 -0
  153. package/cjs/utils/string/string.js +1 -0
  154. package/cjs/utils/tag/tag.d.ts +4 -0
  155. package/cjs/utils/tag/tag.js +1 -0
  156. package/cjs/utils/tag/tagTypes.d.ts +6 -0
  157. package/cjs/utils/tag/tagTypes.js +1 -0
  158. package/cjs/utils/year/year.d.ts +2 -0
  159. package/cjs/utils/year/year.js +1 -0
  160. package/cjs/wordpress/wordpressData.d.ts +6 -0
  161. package/cjs/wordpress/wordpressData.js +1 -0
  162. package/cjs/wordpress/wordpressDataNormal.d.ts +9 -0
  163. package/cjs/wordpress/wordpressDataNormal.js +1 -0
  164. package/cjs/wordpress/wordpressDataTypes.d.ts +208 -0
  165. package/cjs/wordpress/wordpressDataTypes.js +1 -0
  166. package/lib/actions/actions.d.ts +8 -0
  167. package/lib/actions/actions.js +1 -0
  168. package/lib/actions/actionsTypes.d.ts +10 -0
  169. package/lib/actions/actionsTypes.js +1 -0
  170. package/lib/components/Navigation/Navigation.d.ts +14 -0
  171. package/lib/components/Navigation/Navigation.js +1 -0
  172. package/lib/components/Navigation/NavigationTypes.d.ts +88 -0
  173. package/lib/components/Navigation/NavigationTypes.js +1 -0
  174. package/lib/components/Pagination/Pagination.d.ts +3 -0
  175. package/lib/components/Pagination/Pagination.js +1 -0
  176. package/lib/components/Pagination/PaginationTypes.d.ts +54 -0
  177. package/lib/components/Pagination/PaginationTypes.js +1 -0
  178. package/lib/config/config.d.ts +5 -0
  179. package/lib/config/config.js +1 -0
  180. package/lib/config/configTypes.d.ts +66 -0
  181. package/lib/config/configTypes.js +1 -0
  182. package/lib/contentful/contentfulData.d.ts +5 -0
  183. package/lib/contentful/contentfulData.js +1 -0
  184. package/lib/contentful/contentfulDataNormal.d.ts +4 -0
  185. package/lib/contentful/contentfulDataNormal.js +1 -0
  186. package/lib/contentful/contentfulDataTypes.d.ts +78 -0
  187. package/lib/contentful/contentfulDataTypes.js +1 -0
  188. package/lib/filters/filters.d.ts +8 -0
  189. package/lib/filters/filters.js +1 -0
  190. package/lib/filters/filtersTypes.d.ts +60 -0
  191. package/lib/filters/filtersTypes.js +1 -0
  192. package/lib/global/globalTypes.d.ts +34 -0
  193. package/lib/global/globalTypes.js +1 -0
  194. package/lib/layouts/Column/Column.d.ts +3 -0
  195. package/lib/layouts/Column/Column.js +1 -0
  196. package/lib/layouts/Column/ColumnTypes.d.ts +16 -0
  197. package/lib/layouts/Column/ColumnTypes.js +1 -0
  198. package/lib/layouts/Container/Container.d.ts +3 -0
  199. package/lib/layouts/Container/Container.js +1 -0
  200. package/lib/layouts/Container/ContainerTypes.d.ts +15 -0
  201. package/lib/layouts/Container/ContainerTypes.js +1 -0
  202. package/lib/local/localData.d.ts +5 -0
  203. package/lib/local/localData.js +1 -0
  204. package/lib/local/localDataNormal.d.ts +3 -0
  205. package/lib/local/localDataNormal.js +1 -0
  206. package/lib/local/localDataTypes.d.ts +14 -0
  207. package/lib/local/localDataTypes.js +1 -0
  208. package/lib/objects/Form/Form.d.ts +3 -0
  209. package/lib/objects/Form/Form.js +1 -0
  210. package/lib/objects/Form/FormField.d.ts +3 -0
  211. package/lib/objects/Form/FormField.js +1 -0
  212. package/lib/objects/Form/FormOption.d.ts +3 -0
  213. package/lib/objects/Form/FormOption.js +1 -0
  214. package/lib/objects/Form/FormTypes.d.ts +76 -0
  215. package/lib/objects/Form/FormTypes.js +1 -0
  216. package/lib/package.json +1 -0
  217. package/lib/redirects/redirects.d.ts +4 -0
  218. package/lib/redirects/redirects.js +1 -0
  219. package/lib/redirects/redirectsFile.d.ts +2 -0
  220. package/lib/redirects/redirectsFile.js +1 -0
  221. package/lib/render/render.d.ts +11 -0
  222. package/lib/render/render.js +1 -0
  223. package/lib/render/renderInline.d.ts +4 -0
  224. package/lib/render/renderInline.js +1 -0
  225. package/lib/render/renderTypes.d.ts +197 -0
  226. package/lib/render/renderTypes.js +1 -0
  227. package/lib/scripts/scripts.d.ts +8 -0
  228. package/lib/scripts/scripts.js +1 -0
  229. package/lib/scripts/scriptsTypes.d.ts +15 -0
  230. package/lib/scripts/scriptsTypes.js +1 -0
  231. package/lib/serverless/Contact/Contact.d.ts +3 -0
  232. package/lib/serverless/Contact/Contact.js +1 -0
  233. package/lib/serverless/Contact/ContactTypes.d.ts +13 -0
  234. package/lib/serverless/Contact/ContactTypes.js +1 -0
  235. package/lib/serverless/serverless.d.ts +12 -0
  236. package/lib/serverless/serverless.js +1 -0
  237. package/lib/serverless/serverlessTypes.d.ts +41 -0
  238. package/lib/serverless/serverlessTypes.js +1 -0
  239. package/lib/shortcodes/shortcodes.d.ts +10 -0
  240. package/lib/shortcodes/shortcodes.js +1 -0
  241. package/lib/shortcodes/shortcodesTypes.d.ts +20 -0
  242. package/lib/shortcodes/shortcodesTypes.js +1 -0
  243. package/lib/store/store.d.ts +9 -0
  244. package/lib/store/store.js +1 -0
  245. package/lib/store/storeFiles.d.ts +2 -0
  246. package/lib/store/storeFiles.js +1 -0
  247. package/lib/store/storeTypes.d.ts +28 -0
  248. package/lib/store/storeTypes.js +1 -0
  249. package/lib/text/RichText/RichText.d.ts +4 -0
  250. package/lib/text/RichText/RichText.js +1 -0
  251. package/lib/text/RichText/RichTextTypes.d.ts +54 -0
  252. package/lib/text/RichText/RichTextTypes.js +1 -0
  253. package/lib/utils/ResponseError/ResponseError.d.ts +5 -0
  254. package/lib/utils/ResponseError/ResponseError.js +1 -0
  255. package/lib/utils/archive/archive.d.ts +10 -0
  256. package/lib/utils/archive/archive.js +1 -0
  257. package/lib/utils/archive/archiveTypes.d.ts +29 -0
  258. package/lib/utils/archive/archiveTypes.js +1 -0
  259. package/lib/utils/array/array.d.ts +3 -0
  260. package/lib/utils/array/array.js +1 -0
  261. package/lib/utils/boolean/boolean.d.ts +2 -0
  262. package/lib/utils/boolean/boolean.js +1 -0
  263. package/lib/utils/contentType/contentType.d.ts +2 -0
  264. package/lib/utils/contentType/contentType.js +1 -0
  265. package/lib/utils/dataSource/dataSource.d.ts +3 -0
  266. package/lib/utils/dataSource/dataSource.js +1 -0
  267. package/lib/utils/dataSource/dataSourceTypes.d.ts +9 -0
  268. package/lib/utils/dataSource/dataSourceTypes.js +1 -0
  269. package/lib/utils/escape/escape.d.ts +2 -0
  270. package/lib/utils/escape/escape.js +1 -0
  271. package/lib/utils/excerpt/excerpt.d.ts +3 -0
  272. package/lib/utils/excerpt/excerpt.js +1 -0
  273. package/lib/utils/excerpt/excerptTypes.d.ts +14 -0
  274. package/lib/utils/excerpt/excerptTypes.js +1 -0
  275. package/lib/utils/file/file.d.ts +3 -0
  276. package/lib/utils/file/file.js +1 -0
  277. package/lib/utils/file/filePath.d.ts +2 -0
  278. package/lib/utils/file/filePath.js +1 -0
  279. package/lib/utils/function/function.d.ts +3 -0
  280. package/lib/utils/function/function.js +1 -0
  281. package/lib/utils/heading/heading.d.ts +2 -0
  282. package/lib/utils/heading/heading.js +1 -0
  283. package/lib/utils/image/image.d.ts +5 -0
  284. package/lib/utils/image/image.js +1 -0
  285. package/lib/utils/image/imageLocal.d.ts +3 -0
  286. package/lib/utils/image/imageLocal.js +1 -0
  287. package/lib/utils/image/imageRemote.d.ts +3 -0
  288. package/lib/utils/image/imageRemote.js +1 -0
  289. package/lib/utils/image/imageTypes.d.ts +69 -0
  290. package/lib/utils/image/imageTypes.js +1 -0
  291. package/lib/utils/json/json.d.ts +3 -0
  292. package/lib/utils/json/json.js +1 -0
  293. package/lib/utils/link/link.d.ts +6 -0
  294. package/lib/utils/link/link.js +1 -0
  295. package/lib/utils/link/linkShare.d.ts +3 -0
  296. package/lib/utils/link/linkShare.js +1 -0
  297. package/lib/utils/link/linkTypes.d.ts +28 -0
  298. package/lib/utils/link/linkTypes.js +1 -0
  299. package/lib/utils/map/map.d.ts +2 -0
  300. package/lib/utils/map/map.js +1 -0
  301. package/lib/utils/minify/minify.d.ts +2 -0
  302. package/lib/utils/minify/minify.js +1 -0
  303. package/lib/utils/number/number.d.ts +2 -0
  304. package/lib/utils/number/number.js +1 -0
  305. package/lib/utils/object/object.d.ts +4 -0
  306. package/lib/utils/object/object.js +1 -0
  307. package/lib/utils/object/objectUtils.d.ts +2 -0
  308. package/lib/utils/object/objectUtils.js +1 -0
  309. package/lib/utils/path/path.d.ts +3 -0
  310. package/lib/utils/path/path.js +1 -0
  311. package/lib/utils/print/print.d.ts +2 -0
  312. package/lib/utils/print/print.js +1 -0
  313. package/lib/utils/set/set.d.ts +3 -0
  314. package/lib/utils/set/set.js +1 -0
  315. package/lib/utils/string/string.d.ts +3 -0
  316. package/lib/utils/string/string.js +1 -0
  317. package/lib/utils/tag/tag.d.ts +4 -0
  318. package/lib/utils/tag/tag.js +1 -0
  319. package/lib/utils/tag/tagTypes.d.ts +6 -0
  320. package/lib/utils/tag/tagTypes.js +1 -0
  321. package/lib/utils/year/year.d.ts +2 -0
  322. package/lib/utils/year/year.js +1 -0
  323. package/lib/wordpress/wordpressData.d.ts +6 -0
  324. package/lib/wordpress/wordpressData.js +1 -0
  325. package/lib/wordpress/wordpressDataNormal.d.ts +9 -0
  326. package/lib/wordpress/wordpressDataNormal.js +1 -0
  327. package/lib/wordpress/wordpressDataTypes.d.ts +208 -0
  328. package/lib/wordpress/wordpressDataTypes.js +1 -0
  329. package/package.json +96 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Graciela Alaniz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # Formation Static
2
+
3
+ Minimal static-site HTML renderer from JSON, Contentful, or WordPress data. No file output, just HTML strings.
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ npm install -D @alanizcreative/formation-static
9
+ ```
10
+
11
+ ## Index
12
+ <details>
13
+ <summary>Actions</summary>
14
+
15
+ - <a href="/src/actions/README.md">Actions</a>
16
+
17
+ </details>
18
+ <details>
19
+ <summary>Components</summary>
20
+
21
+ - <a href="/src/components/Navigation/README.md">Navigation</a>
22
+ - <a href="/src/components/Pagination/README.md">Pagination</a>
23
+
24
+ </details>
25
+ <details>
26
+ <summary>Config</summary>
27
+
28
+ - <a href="/src/config/README.md">Config</a>
29
+
30
+ </details>
31
+ <details>
32
+ <summary>Contentful</summary>
33
+
34
+ - <a href="/src/contentful/README.md">Contentful</a>
35
+
36
+ </details>
37
+ <details>
38
+ <summary>Filters</summary>
39
+
40
+ - <a href="/src/filters/README.md">Filters</a>
41
+
42
+ </details>
43
+ <details>
44
+ <summary>Global</summary>
45
+
46
+ - <a href="/src/global/README.md">Global</a>
47
+
48
+ </details>
49
+ <details>
50
+ <summary>Layouts</summary>
51
+
52
+ - <a href="/src/layouts/Column/README.md">Column</a>
53
+ - <a href="/src/layouts/Container/README.md">Container</a>
54
+
55
+ </details>
56
+ <details>
57
+ <summary>Local</summary>
58
+
59
+ - <a href="/src/local/README.md">Local</a>
60
+
61
+ </details>
62
+ <details>
63
+ <summary>Objects</summary>
64
+
65
+ - <a href="/src/objects/Form/README.md">Form</a>
66
+
67
+ </details>
68
+ <details>
69
+ <summary>Redirects</summary>
70
+
71
+ - <a href="/src/redirects/README.md">Redirects</a>
72
+
73
+ </details>
74
+ <details>
75
+ <summary>Render</summary>
76
+
77
+ - <a href="/src/render/README.md">Render</a>
78
+
79
+ </details>
80
+ <details>
81
+ <summary>Scripts</summary>
82
+
83
+ - <a href="/src/scripts/README.md">Scripts</a>
84
+
85
+ </details>
86
+ <details>
87
+ <summary>Serverless</summary>
88
+
89
+ - <a href="/src/serverless/Contact/README.md">Contact</a>
90
+ - <a href="/src/serverless/README.md">Serverless</a>
91
+
92
+ </details>
93
+ <details>
94
+ <summary>Shortcodes</summary>
95
+
96
+ - <a href="/src/shortcodes/README.md">Shortcodes</a>
97
+
98
+ </details>
99
+ <details>
100
+ <summary>Store</summary>
101
+
102
+ - <a href="/src/store/README.md">Store</a>
103
+
104
+ </details>
105
+ <details>
106
+ <summary>Text</summary>
107
+
108
+ - <a href="/src/text/RichText/README.md">Rich Text</a>
109
+
110
+ </details>
111
+ <details>
112
+ <summary>Utils</summary>
113
+
114
+ - <a href="/src/utils/archive/README.md">Archive</a>
115
+ - <a href="/src/utils/array/README.md">Array</a>
116
+ - <a href="/src/utils/boolean/README.md">Boolean</a>
117
+ - <a href="/src/utils/contentType/README.md">Content Type</a>
118
+ - <a href="/src/utils/dataSource/README.md">Data Source</a>
119
+ - <a href="/src/utils/escape/README.md">Escape</a>
120
+ - <a href="/src/utils/excerpt/README.md">Excerpt</a>
121
+ - <a href="/src/utils/file/README.md">File</a>
122
+ - <a href="/src/utils/function/README.md">Function</a>
123
+ - <a href="/src/utils/heading/README.md">Heading</a>
124
+ - <a href="/src/utils/image/README.md">Image</a>
125
+ - <a href="/src/utils/json/README.md">Json</a>
126
+ - <a href="/src/utils/link/README.md">Link</a>
127
+ - <a href="/src/utils/map/README.md">Map</a>
128
+ - <a href="/src/utils/minify/README.md">Minify</a>
129
+ - <a href="/src/utils/number/README.md">Number</a>
130
+ - <a href="/src/utils/object/README.md">Object</a>
131
+ - <a href="/src/utils/path/README.md">Path</a>
132
+ - <a href="/src/utils/print/README.md">Print</a>
133
+ - <a href="/src/utils/ResponseError/README.md">Response Error</a>
134
+ - <a href="/src/utils/set/README.md">Set</a>
135
+ - <a href="/src/utils/string/README.md">String</a>
136
+ - <a href="/src/utils/tag/README.md">Tag</a>
137
+ - <a href="/src/utils/year/README.md">Year</a>
138
+
139
+ </details>
140
+ <details>
141
+ <summary>WordPress</summary>
142
+
143
+ - <a href="/src/wordpress/README.md">WordPress</a>
144
+
145
+ </details>
@@ -0,0 +1,8 @@
1
+ import type { Actions, ActionMap, ActionReturnType } from './actionsTypes.js';
2
+ declare let actions: ActionMap;
3
+ declare const addAction: <T extends keyof Actions>(name: T, action: Actions[T]) => boolean;
4
+ declare const removeAction: <T extends keyof Actions>(name: T, action: Actions[T]) => boolean;
5
+ declare const doActions: <V extends boolean = false>(name: string, args?: unknown, isAsync?: V) => ActionReturnType<V>;
6
+ declare const resetActions: () => void;
7
+ declare const setActions: (args: Partial<Actions>) => boolean;
8
+ export { actions, addAction, removeAction, doActions, resetActions, setActions };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setActions=exports.resetActions=exports.doActions=exports.removeAction=exports.addAction=exports.actions=void 0;const set_js_1=require("../utils/set/set.js"),string_js_1=require("../utils/string/string.js"),object_js_1=require("../utils/object/object.js"),function_js_1=require("../utils/function/function.js");let actions=new Map([["renderStart",new Set],["renderEnd",new Set],["renderItemStart",new Set],["renderItemEnd",new Set]]);exports.actions=actions;const addAction=(name,action)=>!(!(0,string_js_1.isStringStrict)(name)||!(0,function_js_1.isFunction)(action))&&((0,set_js_1.isSet)(actions.get(name))||actions.set(name,new Set),actions.get(name)?.add(action),!0);exports.addAction=addAction;const removeAction=(name,action)=>{if(!(0,string_js_1.isStringStrict)(name)||!(0,function_js_1.isFunction)(action))return!1;const actionSet=actions.get(name);return!!(0,set_js_1.isSet)(actionSet)&&actionSet.delete(action)};exports.removeAction=removeAction;const doSequentially=async(callbacks,args)=>{for(const callback of callbacks)await callback(args)},doActions=(name,args,isAsync=!1)=>{const actionSet=actions.get(name);if(!(0,set_js_1.isSetStrict)(actionSet))return;const callbacks=[];for(const callback of actionSet.values())isAsync?callbacks.push(callback):callback(args);isAsync&&doSequentially(callbacks,args).then(result=>result).catch(()=>{})};exports.doActions=doActions;const resetActions=()=>{exports.actions=actions=new Map([["renderStart",new Set],["renderEnd",new Set],["renderItemStart",new Set],["renderItemEnd",new Set]])};exports.resetActions=resetActions;const setActions=args=>{if(!(0,object_js_1.isObjectStrict)(args))return!1;const newActions=Object.entries(args);return!!newActions.length&&(resetActions(),newActions.forEach(([name,action])=>{action&&addAction(name,action)}),!0)};exports.setActions=setActions;
@@ -0,0 +1,10 @@
1
+ import type { GenericFunction } from '../global/globalTypes.js';
2
+ import type { RenderStartAction, RenderEndAction, RenderItemStartAction, RenderItemEndAction } from '../render/renderTypes.js';
3
+ export interface Actions extends Record<string, GenericFunction> {
4
+ renderStart: RenderStartAction;
5
+ renderEnd: RenderEndAction;
6
+ renderItemStart: RenderItemStartAction;
7
+ renderItemEnd: RenderItemEndAction;
8
+ }
9
+ export type ActionMap = Map<string, Set<GenericFunction>> & Map<'renderStart' | 'renderEnd' | 'renderItemStart' | 'renderItemEnd', Set<RenderStartAction | RenderEndAction | RenderItemStartAction | RenderItemEndAction>>;
10
+ export type ActionReturnType<V extends false | true> = V extends true ? Promise<void> : undefined;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,14 @@
1
+ import type { NavigationProps, NavigationList, NavigationByLocation, NavigationItem, NavigationItemsById, NavigationBreadcrumbItem, NavigationOutputArgs, NavigationBreadcrumbOutputArgs, NavigationByLocationItem } from './NavigationTypes.js';
2
+ declare class Navigation<L extends string = string> {
3
+ #private;
4
+ navigations: NavigationList[];
5
+ items: NavigationItem[];
6
+ init: boolean;
7
+ constructor(props: NavigationProps);
8
+ getOutput(location: L, args?: NavigationOutputArgs, maxDepth?: number): string;
9
+ getBreadcrumbs(items: NavigationBreadcrumbItem[], args?: NavigationBreadcrumbOutputArgs): string;
10
+ getItemsById(): NavigationItemsById;
11
+ getNavigationsByLocation(): NavigationByLocation<L>;
12
+ getNavigationByLocation(location: L): NavigationByLocationItem | undefined;
13
+ }
14
+ export { Navigation };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Navigation=void 0;const link_js_1=require("../../utils/link/link.js"),array_js_1=require("../../utils/array/array.js"),object_js_1=require("../../utils/object/object.js"),string_js_1=require("../../utils/string/string.js"),function_js_1=require("../../utils/function/function.js"),number_js_1=require("../../utils/number/number.js"),contentType_js_1=require("../../utils/contentType/contentType.js"),archive_js_1=require("../../utils/archive/archive.js");class Navigation{navigations=[];items=[];init=!1;#itemsById=new Map;#navigationsByLocation=new Map;constructor(props){this.init=this.#initialize(props)}#initialize(props){if(!(0,object_js_1.isObjectStrict)(props))return!1;const{navigations:navigations,items:items}=props;return!(!(0,array_js_1.isArrayStrict)(navigations)||!(0,array_js_1.isArrayStrict)(items))&&(this.navigations=navigations,this.items=items,this.items.forEach(item=>{(0,object_js_1.isObjectStrict)(item)&&this.#itemsById.set(item.id,item)}),this.navigations.forEach(nav=>{if(!(0,object_js_1.isObjectStrict)(nav))return;const{title:title,location:location,items:items=[]}=nav,locations=(0,array_js_1.isArrayStrict)(location)?location:[location];(0,string_js_1.isStringStrict)(title)&&(0,array_js_1.isArrayStrict)(items)&&locations.forEach(loc=>{this.#navigationsByLocation.set(loc,{title:title,items:items})})}),!0)}#recurseItemChildren(children,output,currentLink="",currentType=[]){let childCurrent=!1;return children.forEach(child=>{const newItem=this.#getItem(this.#itemsById.get(child?.id||""),currentLink,currentType);if(!newItem)return;const{current:current,archiveCurrent:archiveCurrent}=newItem;(current||archiveCurrent)&&(childCurrent=!0),output.push(newItem)}),childCurrent}#getItem(item,currentLink,currentType=[]){if(!(0,object_js_1.isObjectStrict)(item))return;const{id:id,title:title,link:link,internalLink:internalLink,externalLink:externalLink,children:children}=item;let external=!1;(0,string_js_1.isStringStrict)(externalLink)&&(external=!0);const newLink=(0,string_js_1.isStringStrict)(link)?link:(0,link_js_1.getLink)(internalLink,externalLink),newItem={...item,id:id,title:title,link:newLink,external:external};newLink&&!external&&(newItem.current=newLink===currentLink);const internalId=internalLink?.id;if((0,string_js_1.isStringStrict)(internalId)){let archiveCurrent=!1;for(const type of currentType){if(internalId===(0,archive_js_1.getArchiveMeta)(type,internalLink?.locale).id){archiveCurrent=!0;break}}newItem.archiveCurrent=archiveCurrent}let descendentCurrent=!1;if((0,array_js_1.isArrayStrict)(children)){const newChildren=[];descendentCurrent=this.#recurseItemChildren(children,newChildren,currentLink,currentType),newItem.children=newChildren}return descendentCurrent&&(newItem.descendentCurrent=descendentCurrent),newItem}#getItems(items=[],currentLink,currentType){const resItems=[];return items.forEach(item=>{const newItem=this.#getItem(this.#itemsById.get(item?.id||""),currentLink,currentType);newItem&&resItems.push(newItem)}),resItems}#recurseOutput=(items,output,args,depth=0,maxDepth)=>{if((0,number_js_1.isNumber)(maxDepth)&&depth>maxDepth)return;const dataAttr=(0,string_js_1.isStringStrict)(args.dataAttr)?args.dataAttr:"data-nav",depthAttr=args.depthAttr?` ${dataAttr}-depth="${depth}"`:"",listFilterArgs={args:args,output:output,items:items,depth:depth};(0,function_js_1.isFunction)(args.filterBeforeList)&&args.filterBeforeList(listFilterArgs);const listClasses=(0,string_js_1.isStringStrict)(args.listClass)?` class="${args.listClass}"`:"",listAttrs=(0,string_js_1.isStringStrict)(args.listAttr)?` ${args.listAttr}`:"",listTag=(0,string_js_1.isStringStrict)(args.listTag)?args.listTag:"ul";output.ref+=`<${listTag}${depthAttr}${listClasses}${listAttrs}>`,items.forEach((item,index)=>{const filterArgs={args:args,item:item,output:output,index:index,items:items,depth:depth};(0,function_js_1.isFunction)(args.filterBeforeItem)&&args.filterBeforeItem(filterArgs);const{title:title,link:link,external:external=!1,children:children,current:current=!1,descendentCurrent:descendentCurrent=!1,archiveCurrent:archiveCurrent=!1}=item,itemClasses=(0,string_js_1.isStringStrict)(args.itemClass)?` class="${args.itemClass}"`:"",itemTag=(0,string_js_1.isStringStrict)(args.itemTag)?args.itemTag:"li";let itemAttrs=(0,string_js_1.isStringStrict)(args.itemAttr)?` ${args.itemAttr}`:"";current&&(itemAttrs+=` ${dataAttr}-current`),descendentCurrent&&(itemAttrs+=` ${dataAttr}-descendent-current`),archiveCurrent&&(itemAttrs+=` ${dataAttr}-archive-current`),output.ref+=`<${itemTag}${depthAttr}${itemClasses}${itemAttrs}>`,(0,function_js_1.isFunction)(args.filterBeforeLink)&&args.filterBeforeLink(filterArgs);const linkClassesArr=[];(0,string_js_1.isStringStrict)(args.linkClass)&&linkClassesArr.push(args.linkClass),!external&&(0,string_js_1.isStringStrict)(args.internalLinkClass)&&linkClassesArr.push(args.internalLinkClass);const hasLink=(0,string_js_1.isStringStrict)(link),linkClasses=linkClassesArr.length?` class="${linkClassesArr.join(" ")}"`:"",linkAttrsArr=[hasLink?`href="${link}"`:'type="button"'];(0,string_js_1.isStringStrict)(args.linkAttr)&&linkAttrsArr.push(args.linkAttr),current&&(linkAttrsArr.push(`${dataAttr}-current`),hasLink&&linkAttrsArr.push('aria-current="page"')),descendentCurrent&&linkAttrsArr.push(`${dataAttr}-descendent-current`),archiveCurrent&&linkAttrsArr.push(`${dataAttr}-archive-current`);const linkAttrs=` ${linkAttrsArr.join(" ")}`,linkTag=hasLink?"a":"button";output.ref+=`<${linkTag}${depthAttr}${linkClasses}${linkAttrs}>`,(0,function_js_1.isFunction)(args.filterBeforeLinkText)&&args.filterBeforeLinkText(filterArgs),output.ref+=title,(0,function_js_1.isFunction)(args.filterAfterLinkText)&&args.filterAfterLinkText(filterArgs),output.ref+=`</${linkTag}>`,(0,function_js_1.isFunction)(args.filterAfterLink)&&args.filterAfterLink(filterArgs),(0,array_js_1.isArrayStrict)(children)&&this.#recurseOutput(children,output,args,depth+1,maxDepth),output.ref+=`</${itemTag}>`,(0,function_js_1.isFunction)(args.filterAfterItem)&&args.filterAfterItem(filterArgs)}),output.ref+=`</${listTag}>`,(0,function_js_1.isFunction)(args.filterAfterList)&&args.filterAfterList(listFilterArgs)};getOutput(location,args,maxDepth){const nav=this.#navigationsByLocation.get(location);if(!nav)return"";args=Object.assign({depthAttr:!1},args||{});const items=nav.items,{currentLink:currentLink,currentType:currentType}=args,currLink=(0,string_js_1.isStringStrict)(currentLink)?currentLink:"",currType=((0,array_js_1.isArrayStrict)(currentType)?currentType:[currentType]).map(type=>(0,contentType_js_1.normalizeContentType)(type)),normalizedItems=this.#getItems(items,currLink,currType);if(!normalizedItems.length)return"";const output={ref:""};return this.#recurseOutput(normalizedItems,output,args,0,maxDepth),output.ref}getBreadcrumbs(items,args){if(!(0,array_js_1.isArrayStrict)(items))return"";const current=(args=Object.assign({a11yClass:"a-hide-vis"},args||{})).current,dataAttr=(0,string_js_1.isStringStrict)(args.dataAttr)?args.dataAttr:"data-nav",listClasses=(0,string_js_1.isStringStrict)(args.listClass)?` class="${args.listClass}"`:"",listAttrs=(0,string_js_1.isStringStrict)(args.listAttr)?` ${args.listAttr}`:"",filteredItems=items.filter(item=>!!(0,string_js_1.isStringStrict)(item.title)&&(!!(0,string_js_1.isString)(item.slug)&&(item.slug=(0,link_js_1.getSlug)({id:item.id,slug:item.slug,contentType:item.contentType,itemData:item.internalLink}),!0))),itemClasses=(0,string_js_1.isStringStrict)(args.itemClass)?` class="${args.itemClass}"`:"",itemAttrs=(0,string_js_1.isStringStrict)(args.itemAttr)?` ${args.itemAttr}`:"",lastItemIndex=filteredItems.length-1,itemsArr=filteredItems.map((item,index)=>{const{title:title,slug:slug}=item,link=(0,link_js_1.getPermalink)(slug),output={ref:""},lastLevel=lastItemIndex===index,filterArgs={output:output,lastLevel:lastLevel};output.ref+=`<li${itemClasses}${itemAttrs}${lastLevel?` ${dataAttr}-last`:""}>`,(0,function_js_1.isFunction)(args.filterBeforeLink)&&args.filterBeforeLink(filterArgs);const linkClassesArr=[];(0,string_js_1.isStringStrict)(args.linkClass)&&linkClassesArr.push(args.linkClass),(0,string_js_1.isStringStrict)(args.internalLinkClass)&&linkClassesArr.push(args.internalLinkClass);const linkClasses=linkClassesArr.length?` class="${linkClassesArr.join(" ")}"`:"",linkAttrs=(0,string_js_1.isStringStrict)(args.linkAttr)?` ${args.linkAttr}`:"";return output.ref+=`<a${linkClasses} href="${link}"${linkAttrs}>${title}</a>`,(0,function_js_1.isFunction)(args.filterAfterLink)&&args.filterAfterLink(filterArgs),output.ref+="</li>",output.ref}),currentLabel=(0,string_js_1.isStringStrict)(args.currentLabel)?args.currentLabel:"(current page)",currentClasses=(0,string_js_1.isStringStrict)(args.currentClass)?` class="${args.currentClass}"`:"",a11yClasses=(0,string_js_1.isStringStrict)(args.a11yClass)?` class="${args.a11yClass}"`:"",currentItem=(0,string_js_1.isStringStrict)(current)?`\n <li${itemClasses}${itemAttrs} ${dataAttr}-current>\n <span${currentClasses}>${current}<span${a11yClasses}> ${currentLabel}</span></span>\n </li>\n `:"";return`\n <ol${listClasses}${listAttrs}>\n ${itemsArr.join("")}\n ${currentItem}\n </ol>\n `}getItemsById(){return this.#itemsById}getNavigationsByLocation(){return this.#navigationsByLocation}getNavigationByLocation(location){return this.#navigationsByLocation.get(location)}}exports.Navigation=Navigation;
@@ -0,0 +1,88 @@
1
+ import type { InternalLink, Generic, RefString } from '../../global/globalTypes.js';
2
+ export interface NavigationProps {
3
+ navigations: NavigationList[];
4
+ items: NavigationItem[];
5
+ currentLink?: string;
6
+ currentType?: string | string[];
7
+ }
8
+ export interface NavigationList extends Generic {
9
+ title: string;
10
+ location: string | string[];
11
+ items: NavigationItem[];
12
+ }
13
+ export interface NavigationByLocationItem {
14
+ title: string;
15
+ items: NavigationItem[];
16
+ }
17
+ export type NavigationByLocation<L extends string = string> = Map<L, NavigationByLocationItem>;
18
+ export interface NavigationItem extends Generic {
19
+ id: string;
20
+ title: string;
21
+ link?: string;
22
+ internalLink?: InternalLink;
23
+ externalLink?: string;
24
+ children?: NavigationItem[];
25
+ current?: boolean;
26
+ external?: boolean;
27
+ descendentCurrent?: boolean;
28
+ archiveCurrent?: boolean;
29
+ }
30
+ export type NavigationItemsById = Map<string, NavigationItem>;
31
+ export interface NavigationBreadcrumbItem extends NavigationItem {
32
+ slug: string;
33
+ contentType: string;
34
+ }
35
+ export interface NavigationOutputBaseArgs {
36
+ listClass?: string;
37
+ listAttr?: string;
38
+ itemClass?: string;
39
+ itemAttr?: string;
40
+ linkClass?: string;
41
+ internalLinkClass?: string;
42
+ linkAttr?: string;
43
+ depthAttr?: boolean;
44
+ dataAttr?: string;
45
+ }
46
+ export interface NavigationOutputListFilterArgs {
47
+ args: NavigationOutputArgs;
48
+ output: RefString;
49
+ items: NavigationItem[];
50
+ depth: number;
51
+ }
52
+ export interface NavigationOutputFilterArgs {
53
+ args: NavigationOutputArgs;
54
+ item: NavigationItem;
55
+ output: RefString;
56
+ index: number;
57
+ items: NavigationItem[];
58
+ depth: number;
59
+ }
60
+ export type NavigationOutputListFilter = (args: NavigationOutputListFilterArgs) => void;
61
+ export type NavigationFilter = (args: NavigationOutputFilterArgs) => void;
62
+ export interface NavigationOutputArgs extends NavigationOutputBaseArgs {
63
+ currentLink?: string;
64
+ currentType?: string | string[];
65
+ listTag?: string;
66
+ itemTag?: string;
67
+ filterBeforeList?: NavigationOutputListFilter;
68
+ filterAfterList?: NavigationOutputListFilter;
69
+ filterBeforeItem?: NavigationFilter;
70
+ filterAfterItem?: NavigationFilter;
71
+ filterBeforeLink?: NavigationFilter;
72
+ filterAfterLink?: NavigationFilter;
73
+ filterBeforeLinkText?: NavigationFilter;
74
+ filterAfterLinkText?: NavigationFilter;
75
+ }
76
+ export interface NavigationBreadcrumbOutputFilterArgs {
77
+ output: RefString;
78
+ lastLevel: boolean;
79
+ }
80
+ export type NavigationBreadcrumbOutputFilter = (args: NavigationBreadcrumbOutputFilterArgs) => void;
81
+ export interface NavigationBreadcrumbOutputArgs extends NavigationOutputBaseArgs {
82
+ current?: string;
83
+ currentClass?: string;
84
+ currentLabel?: string;
85
+ a11yClass?: string;
86
+ filterBeforeLink?: NavigationBreadcrumbOutputFilter;
87
+ filterAfterLink?: NavigationBreadcrumbOutputFilter;
88
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,3 @@
1
+ import type { PaginationProps, PaginationReturn } from './PaginationTypes.js';
2
+ declare const Pagination: (props: PaginationProps) => PaginationReturn;
3
+ export { Pagination };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Pagination=void 0;const object_js_1=require("../../utils/object/object.js"),string_js_1=require("../../utils/string/string.js"),Pagination=props=>{const fallback={output:"",data:{}};if(!(0,object_js_1.isObjectStrict)(props))return fallback;const{total:total=1,display:display=5,current:current=1,filters:filters,url:url,ellipsis:ellipsis,first:first,last:last,prev:prev="",next:next="",firstLabel:firstLabel="First page",lastLabel:lastLabel="Last page",prevLabel:prevLabel="Previous page",nextLabel:nextLabel="Next page",currentLabel:currentLabel="Current page",pageLabel:pageLabel="Page",titleTemplate:titleTemplate="Page %current of %total",args:args}=props,{listClass:listClass,listAttr:listAttr,itemClass:itemClass,itemAttr:itemAttr,linkClass:linkClass,linkAttr:linkAttr,currentClass:currentClass,a11yClass:a11yClass="a-hide-vis",firstClass:firstClass,lastClass:lastClass,prevSpanClass:prevSpanClass,prevLinkClass:prevLinkClass,nextSpanClass:nextSpanClass,nextLinkClass:nextLinkClass}=(0,object_js_1.isObjectStrict)(args)?args:{};if(total<=1||!(0,string_js_1.isStringStrict)(url))return fallback;let output="";const hasFilters=(0,object_js_1.isObjectStrict)(filters);let firstParams={},lastParams={page:total.toString()},prevParams={},nextParams={},currentParams={};const prevPage=current-1,nextPage=current+1<=total?current+1:0;current>1&&(currentParams.page=current.toString()),prevPage>1&&(prevParams.page=prevPage.toString()),nextPage&&(nextParams.page=nextPage.toString()),hasFilters&&(firstParams={...firstParams,...filters},lastParams={...lastParams,...filters},currentParams={...currentParams,...filters},prevParams={...prevParams,...filters},current<total&&(nextParams={...nextParams,...filters}));const lastParamsStr=`?${new URLSearchParams(lastParams).toString()}`;let firstParamsStr=new URLSearchParams(firstParams).toString(),prevParamsStr=new URLSearchParams(prevParams).toString(),nextParamsStr=new URLSearchParams(nextParams).toString(),currentParamsStr=new URLSearchParams(currentParams).toString();firstParamsStr&&(firstParamsStr=`?${firstParamsStr}`),prevParamsStr&&(prevParamsStr=`?${prevParamsStr}`),nextParamsStr&&(nextParamsStr=`?${nextParamsStr}`),currentParamsStr&&(currentParamsStr=`?${currentParamsStr}`);const data={current:current,total:total};nextPage&&(data.next=nextPage),prevPage&&(data.prev=prevPage),currentParamsStr&&(data.currentParams=currentParams),nextParamsStr&&(data.nextParams=nextParams),prevParamsStr&&(data.prevParams=prevParams),firstParamsStr&&(data.firstParams=firstParams),data.lastParams=lastParams,current>1&&(data.title=titleTemplate.replace("%current",current.toString()).replace("%total",total.toString()));const max=display-1,half=Math.ceil(display/2),maxHalf=max/2,center=total>max,limit=center?max:total-1;let start=1;center&&(start=current<max?1:current-maxHalf),start>total-limit&&(start=total-limit);const totalPagesItems=start+limit,listAttrs=[];(0,string_js_1.isStringStrict)(listClass)&&listAttrs.push(`class="${listClass}"`),(0,string_js_1.isStringStrict)(listAttr)&&listAttrs.push(listAttr);const hasEllipsis=(0,string_js_1.isStringStrict)(ellipsis),itemAttrs=`${(0,string_js_1.isStringStrict)(itemClass)?` class="${itemClass}"`:""}${(0,string_js_1.isStringStrict)(itemAttr)?` ${itemAttr}`:""}`;(0,string_js_1.isStringStrict)(first)&&(output+=`\n <li${itemAttrs} data-pag-first>\n <a\n href="${url}${firstParamsStr}"\n aria-label="${firstLabel}"${(0,string_js_1.isStringStrict)(firstClass)?` class="${firstClass}"`:""}\n >\n ${first}\n </a>\n </li>\n `);let prevItem=`<span${(0,string_js_1.isStringStrict)(prevSpanClass)?` class="${prevSpanClass}"`:""}>${prev}</span>`,isPrevLink=!1;current>1&&(isPrevLink=!0,prevItem=`\n <a\n href="${url}${prevParamsStr}"\n aria-label="${prevLabel}"${(0,string_js_1.isStringStrict)(prevLinkClass)?` class="${prevLinkClass}"`:""}\n >\n ${prev}\n </a>\n `),output+=`<li${itemAttrs} data-pag-prev="${isPrevLink?"link":"text"}">${prevItem}</li>`;let ellipsisOutput="";hasEllipsis&&(ellipsisOutput=`<li${itemAttrs} aria-hidden="true" data-pag-ellipsis>${ellipsis}</li>`),center&&current>=limit&&current>half&&(output+=ellipsisOutput);for(let i=start;i<=totalPagesItems;i+=1){const isCurrent=i===current;let content="";if(isCurrent)content=`\n <span${(0,string_js_1.isStringStrict)(currentClass)?` class="${currentClass}"`:""}>\n <span class="${a11yClass}">${currentLabel} </span>\n ${i}\n </span>\n `;else{let params={};i>1&&(params.page=i.toString()),hasFilters&&(params={...params,...filters});let paramsStr=new URLSearchParams(params).toString();paramsStr&&(paramsStr=`?${paramsStr}`),content=`\n <a href="${url}${paramsStr}"${(0,string_js_1.isStringStrict)(linkClass)?` class="${linkClass}"`:""}${(0,string_js_1.isStringStrict)(linkAttr)?` ${linkAttr}`:""}>\n <span class="${a11yClass}">${pageLabel} </span>\n ${i}\n </a>\n `}output+=`<li${itemAttrs}${isCurrent?" data-pag-current":""}>${content}</li>`}center&&current<total-maxHalf&&(output+=ellipsisOutput);let nextItem=`<span${(0,string_js_1.isStringStrict)(nextSpanClass)?` class="${nextSpanClass}"`:""}>${next}</span>`,nextLink=!1;return current<total&&(nextLink=!0,nextItem=`\n <a\n href="${url}${nextParamsStr}"\n aria-label="${nextLabel}"${(0,string_js_1.isStringStrict)(nextLinkClass)?` class="${nextLinkClass}"`:""}\n >\n ${next}\n </a>\n `),output+=`<li${itemAttrs} data-pag-next="${nextLink?"link":"text"}">${nextItem}</li>`,(0,string_js_1.isStringStrict)(last)&&(output+=`\n <li${itemAttrs} data-pag-last>\n <a\n href="${url}${lastParamsStr}"\n aria-label="${lastLabel}"${(0,string_js_1.isStringStrict)(lastClass)?` class="${lastClass}"`:""}\n >\n ${last}\n </a>\n </li>\n `),{output:`\n <ol${listAttrs.length?` ${listAttrs.join(" ")}`:""}>\n ${output}\n </ol>\n `,data:data}};exports.Pagination=Pagination;
@@ -0,0 +1,54 @@
1
+ export interface PaginationProps {
2
+ total?: number;
3
+ display?: number;
4
+ current?: number;
5
+ filters?: Record<string, string>;
6
+ url?: string;
7
+ ellipsis?: string;
8
+ first?: string;
9
+ last?: string;
10
+ prev?: string;
11
+ next?: string;
12
+ firstLabel?: string;
13
+ lastLabel?: string;
14
+ prevLabel?: string;
15
+ nextLabel?: string;
16
+ currentLabel?: string;
17
+ pageLabel?: string;
18
+ titleTemplate?: string;
19
+ args?: PaginationArgs;
20
+ }
21
+ export interface PaginationArgs {
22
+ listClass?: string;
23
+ listAttr?: string;
24
+ itemClass?: string;
25
+ itemAttr?: string;
26
+ linkClass?: string;
27
+ linkAttr?: string;
28
+ currentClass?: string;
29
+ a11yClass?: string;
30
+ firstClass?: string;
31
+ lastClass?: string;
32
+ prevSpanClass?: string;
33
+ prevLinkClass?: string;
34
+ nextSpanClass?: string;
35
+ nextLinkClass?: string;
36
+ }
37
+ export interface PaginationData {
38
+ current?: number;
39
+ total?: number;
40
+ title?: string;
41
+ first?: number;
42
+ last?: number;
43
+ next?: number;
44
+ prev?: number;
45
+ firstParams?: Record<string, string>;
46
+ lastParams?: Record<string, string>;
47
+ nextParams?: Record<string, string>;
48
+ prevParams?: Record<string, string>;
49
+ currentParams?: Record<string, string>;
50
+ }
51
+ export interface PaginationReturn {
52
+ output: string;
53
+ data: PaginationData;
54
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,5 @@
1
+ import type { Config, ConfigSet, ConfigSetFilter } from './configTypes.js';
2
+ declare let config: Config;
3
+ declare const setConfig: ConfigSet;
4
+ declare const setConfigFilter: ConfigSetFilter;
5
+ export { config, setConfig, setConfigFilter };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setConfigFilter=exports.setConfig=exports.config=void 0;let config={namespace:"frm",source:"cms",title:"",meta:{description:"",image:""},partialTypes:[],wholeTypes:[],hierarchicalTypes:[],localeInSlug:{},typeInSlug:{},taxonomyInSlug:{},normalTypes:{},renderTypes:{},env:{dev:!0,prod:!1,build:!1,cache:!1,dir:"",devUrl:"",prodUrl:""},cms:{name:"",space:"",prodUser:"",prodCredential:"",prodHost:"",devUser:"",devCredential:"",devHost:""},local:{dir:"json"},scripts:{inputDir:"lib",outputDir:"js"},styles:{inputDir:"src",outputDir:"css"},image:{inputDir:"src/assets/img",outputDir:"site/assets/img",localUrl:"/assets/img",remoteUrl:"",quality:75,sizes:[200,400,600,800,1e3,1200,1600,2e3]},filter:config=>config};exports.config=config;const setConfig=args=>(exports.config=config={...config,...args},config);exports.setConfig=setConfig;const setConfigFilter=env=>(exports.config=config=config.filter(config,env),config);exports.setConfigFilter=setConfigFilter;
@@ -0,0 +1,66 @@
1
+ import type { Source, GenericStrings, Generic } from '../global/globalTypes.js';
2
+ export interface ConfigMeta {
3
+ description: string;
4
+ image: string;
5
+ }
6
+ export interface ConfigEnv {
7
+ dev: boolean;
8
+ prod: boolean;
9
+ build: boolean;
10
+ cache: boolean;
11
+ dir: string;
12
+ devUrl: string;
13
+ prodUrl: string;
14
+ }
15
+ export interface ConfigCms {
16
+ name: string;
17
+ space: string;
18
+ prodUser: string;
19
+ prodCredential: string;
20
+ prodHost: string;
21
+ devUser: string;
22
+ devCredential: string;
23
+ devHost: string;
24
+ ssl?: boolean;
25
+ env?: string;
26
+ locales?: string[];
27
+ }
28
+ export interface ConfigLocal {
29
+ dir: string;
30
+ }
31
+ export interface ConfigAsset {
32
+ inputDir: string;
33
+ outputDir: string;
34
+ }
35
+ export interface ConfigImage {
36
+ inputDir: string;
37
+ outputDir: string;
38
+ localUrl: string;
39
+ remoteUrl: string;
40
+ sizes: number[];
41
+ quality: number;
42
+ }
43
+ export type ConfigFilter = (config: Config, env: Generic) => Config;
44
+ export interface Config {
45
+ namespace: string;
46
+ source: Source;
47
+ title: string;
48
+ meta: ConfigMeta;
49
+ partialTypes: string[];
50
+ wholeTypes: string[];
51
+ renderTypes: GenericStrings;
52
+ normalTypes: GenericStrings;
53
+ hierarchicalTypes: string[];
54
+ localeInSlug: Record<string, string>;
55
+ typeInSlug: Record<string, string | Record<string, string>>;
56
+ taxonomyInSlug: Record<string, string | Record<string, string>>;
57
+ env: ConfigEnv;
58
+ cms: ConfigCms;
59
+ local: ConfigLocal;
60
+ scripts: ConfigAsset;
61
+ styles: ConfigAsset;
62
+ image: ConfigImage;
63
+ filter: ConfigFilter;
64
+ }
65
+ export type ConfigSet = (args: Partial<Config>) => Config;
66
+ export type ConfigSetFilter = (env: Generic) => Config;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,5 @@
1
+ import type { ContentfulDataParams, AllContentfulDataArgs } from './contentfulDataTypes.js';
2
+ import type { RenderAllData, RenderData } from '../render/renderTypes.js';
3
+ declare const getContentfulData: (key: string, params?: ContentfulDataParams) => Promise<RenderData>;
4
+ declare const getAllContentfulData: (args?: AllContentfulDataArgs) => Promise<RenderAllData | undefined>;
5
+ export { getContentfulData, getAllContentfulData };
@@ -0,0 +1 @@
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getAllContentfulData=exports.getContentfulData=void 0;const contentful_resolve_response_1=__importDefault(require("contentful-resolve-response")),filters_js_1=require("../filters/filters.js"),object_js_1=require("../utils/object/object.js"),string_js_1=require("../utils/string/string.js"),config_js_1=require("../config/config.js"),store_js_1=require("../store/store.js"),contentfulDataNormal_js_1=require("./contentfulDataNormal.js"),getContentfulData=async(key,params)=>{if(!(0,string_js_1.isStringStrict)(key))throw new Error("No key");if(config_js_1.config.env.cache){const cacheDataFilterArgs={key:key,type:"get"},cacheData=await(0,filters_js_1.applyFilters)("cacheData",void 0,cacheDataFilterArgs,!0);if((0,object_js_1.isObject)(cacheData))return structuredClone(cacheData)}const{space:space,devCredential:devCredential,prodCredential:prodCredential,devHost:devHost,prodHost:prodHost,env:env="master"}=config_js_1.config.cms;let accessToken=devCredential,host=devHost;if(config_js_1.config.env.prod&&(accessToken=prodCredential,host=prodHost),!(0,string_js_1.isStringStrict)(space)||!(0,string_js_1.isStringStrict)(accessToken)||!(0,string_js_1.isStringStrict)(host))throw new Error("No credentials");let url=`https://${host}/spaces/${space}/environments/${env}/entries?access_token=${accessToken}`;if((0,object_js_1.isObjectStrict)(params))for(const[key,value]of Object.entries(params))url+=`&${key}=${value.toString()}`;const resp=await fetch(url),data=await resp.json();if(!resp.ok){const message=(0,string_js_1.isStringStrict)(data.message)?data.message:"Bad fetch response";throw new Error(message,{cause:data})}const resolvedData=(0,contentful_resolve_response_1.default)(data),newItems=(0,contentfulDataNormal_js_1.normalizeContentfulData)(resolvedData),{total:total,limit:limit,skip:skip}=data,newData={items:newItems,total:total,limit:limit,skip:skip};if(config_js_1.config.env.cache){const cacheDataFilterArgs={key:key,type:"set",data:data};await(0,filters_js_1.applyFilters)("cacheData",newData,cacheDataFilterArgs,!0)}return newData};exports.getContentfulData=getContentfulData;const getAllContentfulData=async args=>{const{serverlessData:serverlessData,previewData:previewData}=(0,object_js_1.isObjectStrict)(args)?args:{};let allData={navigationItem:[],navigation:[],content:{page:[]}};const isServerless=null!=serverlessData,isPreview=null!=previewData,contentfulDataFilterArgs={serverlessData:serverlessData,previewData:previewData},cmsLocales=config_js_1.config.cms.locales||[],defaultLocale=cmsLocales[0],paramLocales=isPreview?[]:[...cmsLocales];if(0===paramLocales.length&&paramLocales.push(""),isServerless||isPreview){let locale,contentType="",id="";if(isServerless){const item=(0,store_js_1.getStoreItem)("slugs")[serverlessData.path];if(item){const[itemId,itemContentType,itemLocale]=item;id=itemId||"",contentType=itemContentType||"",locale=itemLocale||""}}if(isPreview&&(id=previewData.id,contentType=previewData.contentType,locale=previewData.locale),id){const key=`serverless_${id}_${contentType}`,params={content_type:contentType,"sys.id":id,include:10};locale&&locale!==defaultLocale&&(params.locale=locale,paramLocales[0]=locale);const data=await getContentfulData(key,params);let{items:items}=data;items=(0,filters_js_1.applyFilters)("contentfulData",items,{...contentfulDataFilterArgs,contentType:contentType}),allData.content[contentType]=items}}if(!isServerless){const partial=config_js_1.config.partialTypes;for(const contentType of partial){const key=`all_${contentType}`;let newItems=[];for(const locale of paramLocales){const params={content_type:contentType};locale&&locale!==defaultLocale&&(params.locale=locale);const newData=await getContentfulData(key,params);let{items:items}=newData;items=(0,filters_js_1.applyFilters)("contentfulData",items,{...contentfulDataFilterArgs,contentType:contentType}),newItems=[...newItems,...items]}allData[contentType]=newItems}}if(!isServerless&&!isPreview){const whole=config_js_1.config.wholeTypes;for(const contentType of whole){const key=`all_${contentType}`;let newItems=[];for(const locale of paramLocales){const params={content_type:contentType,include:10};locale&&locale!==defaultLocale&&(params.locale=locale);const newData=await getContentfulData(key,params);let{items:items}=newData;items=(0,filters_js_1.applyFilters)("contentfulData",items,{...contentfulDataFilterArgs,contentType:contentType}),newItems=[...newItems,...items]}allData.content[contentType]=newItems}}return allData=(0,filters_js_1.applyFilters)("allData",allData,{type:"contentful",serverlessData:serverlessData,previewData:previewData}),allData};exports.getAllContentfulData=getAllContentfulData;
@@ -0,0 +1,4 @@
1
+ import type { ContentfulDataItem } from './contentfulDataTypes.js';
2
+ import type { RenderItem } from '../render/renderTypes.js';
3
+ declare const normalizeContentfulData: (data: ContentfulDataItem[], _newData?: RenderItem[]) => RenderItem[];
4
+ export { normalizeContentfulData };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeContentfulData=void 0;const contentType_js_1=require("../utils/contentType/contentType.js"),array_js_1=require("../utils/array/array.js"),object_js_1=require("../utils/object/object.js"),string_js_1=require("../utils/string/string.js"),objectUtils_js_1=require("../utils/object/objectUtils.js"),number_js_1=require("../utils/number/number.js"),config_js_1=require("../config/config.js"),getTag=(type="text")=>({br:"br",hr:"hr",paragraph:"p",blockquote:"blockquote",bold:"b",italic:"i",underline:"u",superscript:"sup",subscript:"sub",code:"code",hyperlink:"a","entry-hyperlink":"a","asset-hyperlink":"a","heading-1":"h1","heading-2":"h2","heading-3":"h3","heading-4":"h4","heading-5":"h5","heading-6":"h6","list-item":"li","unordered-list":"ul","ordered-list":"ol",table:"table","table-row":"tr","table-cell":"td","table-header-cell":"th"}[type]||""),normalizeRichText=items=>{const newItems=[];return items.forEach(item=>{if(!(0,object_js_1.isObjectStrict)(item))return;const{nodeType:nodeType,data:data,value:value,marks:marks,content:content}=item,tag=getTag(nodeType);let contentValue,link,internalLink;if((0,string_js_1.isStringStrict)(value)&&(contentValue=value,contentValue=contentValue.replace(/\n/g,"<br>"),(0,array_js_1.isArrayStrict)(marks))){const markTags=marks.map(m=>getTag(m.type));contentValue=`${markTags.map(m=>`<${m}>`).join("")}${value}${markTags.map(m=>`</${m}>`).join("")}`}if((0,string_js_1.isStringStrict)(content)&&(contentValue=content),(0,array_js_1.isArrayStrict)(content)&&(contentValue=normalizeRichText(content)),(0,object_js_1.isObjectStrict)(data)&&(link=(0,string_js_1.isString)(data.uri)?data.uri:"",(0,object_js_1.isObjectStrict)(data.target))){const target=data.target;"entry-hyperlink"!==nodeType&&"embedded-entry-inline"!==nodeType||(internalLink=target);const url=target.fields?.file?.url;"asset-hyperlink"===nodeType&&(0,string_js_1.isString)(url)&&(link=`https:${url}`)}if(!contentValue)return;const newItem={content:contentValue};return(0,string_js_1.isStringStrict)(tag)&&(newItem.tag=tag),(0,string_js_1.isStringStrict)(link)&&(newItem.link=link),(0,object_js_1.isObjectStrict)(internalLink)&&(newItem.internalLink=normalizeItem(internalLink,[],!0)),newItems.push(newItem)}),newItems},normalizeFile=(file,fields)=>{const type=(0,string_js_1.isString)(file.contentType)?file.contentType:"",format=type?type.split("/")[1]:"";return{url:(0,string_js_1.isString)(file.url)?`https:${file.url}`:"",name:(0,string_js_1.isString)(file.fileName)?file.fileName:"",alt:(0,string_js_1.isString)(fields.description)?fields.description:"",width:(0,number_js_1.isNumber)(file.details?.image?.width)?file.details.image.width:0,height:(0,number_js_1.isNumber)(file.details?.image?.height)?file.details.image.height:0,size:(0,number_js_1.isNumber)(file.details?.size)?file.details.size:0,format:"jpeg"===format?"jpg":format,type:type}},normalizeItem=(item,data,isInternalLink=!1)=>{let newItem={};const itemCopy={...item};(0,string_js_1.isString)(itemCopy.sys?.id)&&(newItem.id=itemCopy.sys.id),(0,string_js_1.isStringStrict)(itemCopy.sys?.locale)&&(newItem.locale=itemCopy.sys.locale);let type="";if((0,string_js_1.isString)(itemCopy.sys?.type)&&(type=itemCopy.sys.type),(0,string_js_1.isString)(itemCopy.sys?.contentType?.sys?.id)&&(type=itemCopy.sys.contentType.sys.id),type&&"Link"!==type&&(newItem.contentType=(0,contentType_js_1.normalizeContentType)(type),(0,string_js_1.isString)(config_js_1.config.renderTypes[type])&&(newItem.renderType=config_js_1.config.renderTypes[type])),(0,array_js_1.isArrayStrict)(itemCopy.metadata?.tags)&&(newItem.metadata={tags:itemCopy.metadata.tags.map(t=>({id:(0,string_js_1.isString)(t.sys?.id)?t.sys.id:""}))}),(0,object_js_1.isObjectStrict)(itemCopy.fields)){const fields=itemCopy.fields,file=fields.file;if((0,object_js_1.isObjectStrict)(file))return Object.assign(normalizeFile(file,fields),newItem);(0,objectUtils_js_1.getObjectKeys)(fields).forEach(prop=>{const field=fields[prop];if("content"!==prop||!isInternalLink)if((0,object_js_1.isObjectStrict)(field))if("document"===field.nodeType){const{content:content}=field;(0,array_js_1.isArrayStrict)(content)&&(newItem[prop]=content.map(c=>(0,object_js_1.isObjectStrict)(c)?normalizeItem(c,data,isInternalLink):c))}else newItem[prop]=normalizeItem(field,data,"internalLink"===prop);else(0,array_js_1.isArrayStrict)(field)?newItem[prop]=field.map(f=>(0,object_js_1.isObjectStrict)(f)?normalizeItem(f,data,isInternalLink):f):newItem[prop]=field})}if((0,string_js_1.isString)(itemCopy.nodeType)){const nodeType=itemCopy.nodeType;if("embedded-entry-block"===nodeType||"embedded-asset-block"===nodeType){const content=(0,object_js_1.isObjectStrict)(itemCopy.data?.target)?itemCopy.data.target:{};newItem=normalizeItem(content,data,isInternalLink)}else newItem.renderType="richText",newItem.tag=getTag(itemCopy.nodeType),(0,string_js_1.isString)(itemCopy.content)&&(newItem.content=itemCopy.content),(0,array_js_1.isArrayStrict)(itemCopy.content)&&(newItem.content=normalizeRichText(itemCopy.content))}return newItem},normalizeContentfulData=(data,_newData=[])=>(0,array_js_1.isArrayStrict)(data)?(data.forEach(item=>{(0,object_js_1.isObjectStrict)(item)&&_newData.push(normalizeItem(item,_newData))}),_newData):[];exports.normalizeContentfulData=normalizeContentfulData;
@@ -0,0 +1,78 @@
1
+ import type { Generic } from '../global/globalTypes.js';
2
+ import type { RenderServerlessData, RenderPreviewData } from '../render/renderTypes.js';
3
+ export type ContentfulDataParams = Record<string, string | number | boolean>;
4
+ interface ContentfulDataErrorSys {
5
+ type: string;
6
+ id: string;
7
+ }
8
+ export interface ContentfulDataError {
9
+ message: string;
10
+ sys: ContentfulDataErrorSys;
11
+ }
12
+ export interface ContentfulData {
13
+ items: ContentfulDataItem[];
14
+ total: number;
15
+ limit: number;
16
+ skip: number;
17
+ }
18
+ interface ContentfulDataId {
19
+ id?: string;
20
+ }
21
+ export interface ContentfulDataTag {
22
+ sys?: ContentfulDataId;
23
+ }
24
+ interface ContentfulDataMeta {
25
+ tags?: ContentfulDataTag[];
26
+ }
27
+ export interface ContentfulDataMark {
28
+ type: string;
29
+ }
30
+ interface ContentfulDataFileImage {
31
+ width?: number;
32
+ height?: number;
33
+ }
34
+ interface ContentfulDataFileDetails {
35
+ size?: number;
36
+ image?: ContentfulDataFileImage;
37
+ }
38
+ export interface ContentfulDataFile {
39
+ url?: string;
40
+ contentType?: string;
41
+ fileName?: string;
42
+ details?: ContentfulDataFileDetails;
43
+ }
44
+ export interface ContentfulDataFields extends Generic {
45
+ content?: ContentfulDataItem[] | ContentfulDataItem;
46
+ internalLink?: ContentfulDataItem;
47
+ file?: ContentfulDataFile;
48
+ description?: string;
49
+ title?: string;
50
+ }
51
+ interface ContentfulDataSysType {
52
+ sys?: ContentfulDataId;
53
+ }
54
+ export interface ContentfulDataSys {
55
+ id?: string;
56
+ type?: string;
57
+ locale?: string;
58
+ contentType?: ContentfulDataSysType;
59
+ }
60
+ interface ContentfulDataDatum {
61
+ uri?: string;
62
+ target?: ContentfulDataItem;
63
+ }
64
+ export interface ContentfulDataItem {
65
+ value?: string;
66
+ nodeType?: string;
67
+ marks?: ContentfulDataMark[];
68
+ data?: ContentfulDataDatum;
69
+ content?: ContentfulDataItem[] | string;
70
+ metadata?: ContentfulDataMeta;
71
+ sys?: ContentfulDataSys;
72
+ fields?: ContentfulDataFields;
73
+ }
74
+ export interface AllContentfulDataArgs {
75
+ serverlessData?: RenderServerlessData;
76
+ previewData?: RenderPreviewData;
77
+ }
78
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,8 @@
1
+ import type { Filters, FilterMap, FilterReturnType } from './filtersTypes.js';
2
+ declare let filters: FilterMap;
3
+ declare const addFilter: <T extends keyof Filters>(name: T, filter: Filters[T]) => boolean;
4
+ declare const removeFilter: <T extends keyof Filters>(name: T, filter: Filters[T]) => boolean;
5
+ declare const applyFilters: <T, V extends boolean = false>(name: string, value: T, args?: unknown, isAsync?: V) => FilterReturnType<T, V>;
6
+ declare const resetFilters: () => void;
7
+ declare const setFilters: (args: Partial<Filters>) => boolean;
8
+ export { filters, addFilter, removeFilter, applyFilters, resetFilters, setFilters };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setFilters=exports.resetFilters=exports.applyFilters=exports.removeFilter=exports.addFilter=exports.filters=void 0;const set_js_1=require("../utils/set/set.js"),string_js_1=require("../utils/string/string.js"),object_js_1=require("../utils/object/object.js"),function_js_1=require("../utils/function/function.js");let filters=new Map([["columnProps",new Set],["containerProps",new Set],["formOptionProps",new Set],["formFieldProps",new Set],["formProps",new Set],["richTextProps",new Set],["richTextOutput",new Set],["richTextContentItem",new Set],["richTextContent",new Set],["richTextContentOutput",new Set],["renderItem",new Set],["renderItemData",new Set],["renderContent",new Set],["serverlessResult",new Set],["contactResult",new Set],["cacheData",new Set],["storeData",new Set],["contentfulData",new Set],["wordpressData",new Set],["localData",new Set],["allData",new Set],["slugParts",new Set],["slug",new Set]]);exports.filters=filters;const addFilter=(name,filter)=>!(!(0,string_js_1.isStringStrict)(name)||!(0,function_js_1.isFunction)(filter))&&((0,set_js_1.isSet)(filters.get(name))||filters.set(name,new Set),filters.get(name)?.add(filter),!0);exports.addFilter=addFilter;const removeFilter=(name,filter)=>{if(!(0,string_js_1.isStringStrict)(name)||!(0,function_js_1.isFunction)(filter))return!1;const filterSet=filters.get(name);return!!(0,set_js_1.isSet)(filterSet)&&filterSet.delete(filter)};exports.removeFilter=removeFilter;const applySequentially=async(callbacks,value,args)=>{for(const callback of callbacks)value=await callback(value,args);return value},applyFilters=(name,value,args,isAsync=!1)=>{const filterSet=filters.get(name);if(!(0,set_js_1.isSetStrict)(filterSet))return value;const callbacks=[];for(const callback of filterSet.values())isAsync?callbacks.push(callback):value=callback(value,args);return isAsync?applySequentially(callbacks,value,args).then(newValue=>newValue).catch(()=>value):value};exports.applyFilters=applyFilters;const resetFilters=()=>{exports.filters=filters=new Map([["columnProps",new Set],["containerProps",new Set],["formOptionProps",new Set],["formFieldProps",new Set],["formProps",new Set],["richTextProps",new Set],["richTextOutput",new Set],["richTextContentItem",new Set],["richTextContent",new Set],["richTextContentOutput",new Set],["renderItem",new Set],["renderItemData",new Set],["renderContent",new Set],["serverlessResult",new Set],["contactResult",new Set],["cacheData",new Set],["storeData",new Set],["contentfulData",new Set],["wordpressData",new Set],["localData",new Set],["allData",new Set],["slugParts",new Set],["slug",new Set]])};exports.resetFilters=resetFilters;const setFilters=args=>{if(!(0,object_js_1.isObjectStrict)(args))return!1;const newFilters=Object.entries(args);return!!newFilters.length&&(resetFilters(),newFilters.forEach(([name,filter])=>{filter&&addFilter(name,filter)}),!0)};exports.setFilters=setFilters;