@alanizcreative/formation-static 1.3.0-beta.29

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 (349) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/cjs/components/Navigation/Navigation.d.ts +16 -0
  4. package/cjs/components/Navigation/Navigation.js +1 -0
  5. package/cjs/components/Navigation/NavigationTypes.d.ts +85 -0
  6. package/cjs/components/Navigation/NavigationTypes.js +1 -0
  7. package/cjs/components/Pagination/Pagination.d.ts +3 -0
  8. package/cjs/components/Pagination/Pagination.js +1 -0
  9. package/cjs/components/Pagination/PaginationTypes.d.ts +44 -0
  10. package/cjs/components/Pagination/PaginationTypes.js +1 -0
  11. package/cjs/config/config.d.ts +5 -0
  12. package/cjs/config/config.js +1 -0
  13. package/cjs/config/configTypes.d.ts +64 -0
  14. package/cjs/config/configTypes.js +1 -0
  15. package/cjs/contentful/contentfulData.d.ts +5 -0
  16. package/cjs/contentful/contentfulData.js +1 -0
  17. package/cjs/contentful/contentfulDataNormal.d.ts +4 -0
  18. package/cjs/contentful/contentfulDataNormal.js +1 -0
  19. package/cjs/contentful/contentfulDataTypes.d.ts +67 -0
  20. package/cjs/contentful/contentfulDataTypes.js +1 -0
  21. package/cjs/global/globalTypes.d.ts +32 -0
  22. package/cjs/global/globalTypes.js +1 -0
  23. package/cjs/layouts/Column/Column.d.ts +3 -0
  24. package/cjs/layouts/Column/Column.js +1 -0
  25. package/cjs/layouts/Column/ColumnTypes.d.ts +16 -0
  26. package/cjs/layouts/Column/ColumnTypes.js +1 -0
  27. package/cjs/layouts/Container/Container.d.ts +3 -0
  28. package/cjs/layouts/Container/Container.js +1 -0
  29. package/cjs/layouts/Container/ContainerTypes.d.ts +15 -0
  30. package/cjs/layouts/Container/ContainerTypes.js +1 -0
  31. package/cjs/local/localData.d.ts +5 -0
  32. package/cjs/local/localData.js +1 -0
  33. package/cjs/local/localDataNormal.d.ts +3 -0
  34. package/cjs/local/localDataNormal.js +1 -0
  35. package/cjs/local/localDataTypes.d.ts +14 -0
  36. package/cjs/local/localDataTypes.js +1 -0
  37. package/cjs/objects/Form/Form.d.ts +3 -0
  38. package/cjs/objects/Form/Form.js +1 -0
  39. package/cjs/objects/Form/FormField.d.ts +3 -0
  40. package/cjs/objects/Form/FormField.js +1 -0
  41. package/cjs/objects/Form/FormOption.d.ts +3 -0
  42. package/cjs/objects/Form/FormOption.js +1 -0
  43. package/cjs/objects/Form/FormTypes.d.ts +74 -0
  44. package/cjs/objects/Form/FormTypes.js +1 -0
  45. package/cjs/package.json +1 -0
  46. package/cjs/redirects/redirects.d.ts +4 -0
  47. package/cjs/redirects/redirects.js +1 -0
  48. package/cjs/redirects/redirectsFile.d.ts +2 -0
  49. package/cjs/redirects/redirectsFile.js +1 -0
  50. package/cjs/render/render.d.ts +11 -0
  51. package/cjs/render/render.js +1 -0
  52. package/cjs/render/renderInline.d.ts +4 -0
  53. package/cjs/render/renderInline.js +1 -0
  54. package/cjs/render/renderTypes.d.ts +198 -0
  55. package/cjs/render/renderTypes.js +1 -0
  56. package/cjs/serverless/Ajax/Ajax.d.ts +3 -0
  57. package/cjs/serverless/Ajax/Ajax.js +1 -0
  58. package/cjs/serverless/Ajax/AjaxTypes.d.ts +11 -0
  59. package/cjs/serverless/Ajax/AjaxTypes.js +1 -0
  60. package/cjs/serverless/Contact/Contact.d.ts +3 -0
  61. package/cjs/serverless/Contact/Contact.js +1 -0
  62. package/cjs/serverless/Contact/ContactTypes.d.ts +13 -0
  63. package/cjs/serverless/Contact/ContactTypes.js +1 -0
  64. package/cjs/serverless/Preview/Preview.d.ts +5 -0
  65. package/cjs/serverless/Preview/Preview.js +1 -0
  66. package/cjs/serverless/Reload/Reload.d.ts +5 -0
  67. package/cjs/serverless/Reload/Reload.js +1 -0
  68. package/cjs/serverless/Reload/ReloadTypes.d.ts +5 -0
  69. package/cjs/serverless/Reload/ReloadTypes.js +1 -0
  70. package/cjs/serverless/serverless.d.ts +6 -0
  71. package/cjs/serverless/serverless.js +1 -0
  72. package/cjs/serverless/serverlessFiles.d.ts +3 -0
  73. package/cjs/serverless/serverlessFiles.js +1 -0
  74. package/cjs/serverless/serverlessTypes.d.ts +50 -0
  75. package/cjs/serverless/serverlessTypes.js +1 -0
  76. package/cjs/store/store.d.ts +9 -0
  77. package/cjs/store/store.js +1 -0
  78. package/cjs/store/storeFiles.d.ts +2 -0
  79. package/cjs/store/storeFiles.js +1 -0
  80. package/cjs/store/storeTypes.d.ts +35 -0
  81. package/cjs/store/storeTypes.js +1 -0
  82. package/cjs/text/RichText/RichText.d.ts +4 -0
  83. package/cjs/text/RichText/RichText.js +1 -0
  84. package/cjs/text/RichText/RichTextTypes.d.ts +54 -0
  85. package/cjs/text/RichText/RichTextTypes.js +1 -0
  86. package/cjs/utils/ResponseError/ResponseError.d.ts +5 -0
  87. package/cjs/utils/ResponseError/ResponseError.js +1 -0
  88. package/cjs/utils/action/action.d.ts +8 -0
  89. package/cjs/utils/action/action.js +1 -0
  90. package/cjs/utils/action/actionTypes.d.ts +10 -0
  91. package/cjs/utils/action/actionTypes.js +1 -0
  92. package/cjs/utils/archive/archive.d.ts +7 -0
  93. package/cjs/utils/archive/archive.js +1 -0
  94. package/cjs/utils/archive/archiveTypes.d.ts +18 -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/filePath.d.ts +2 -0
  113. package/cjs/utils/file/filePath.js +1 -0
  114. package/cjs/utils/filter/filter.d.ts +8 -0
  115. package/cjs/utils/filter/filter.js +1 -0
  116. package/cjs/utils/filter/filterTypes.d.ts +62 -0
  117. package/cjs/utils/filter/filterTypes.js +1 -0
  118. package/cjs/utils/function/function.d.ts +3 -0
  119. package/cjs/utils/function/function.js +1 -0
  120. package/cjs/utils/heading/heading.d.ts +2 -0
  121. package/cjs/utils/heading/heading.js +1 -0
  122. package/cjs/utils/image/image.d.ts +5 -0
  123. package/cjs/utils/image/image.js +1 -0
  124. package/cjs/utils/image/imageLocal.d.ts +3 -0
  125. package/cjs/utils/image/imageLocal.js +1 -0
  126. package/cjs/utils/image/imageRemote.d.ts +3 -0
  127. package/cjs/utils/image/imageRemote.js +1 -0
  128. package/cjs/utils/image/imageTypes.d.ts +60 -0
  129. package/cjs/utils/image/imageTypes.js +1 -0
  130. package/cjs/utils/json/json.d.ts +3 -0
  131. package/cjs/utils/json/json.js +1 -0
  132. package/cjs/utils/link/link.d.ts +6 -0
  133. package/cjs/utils/link/link.js +1 -0
  134. package/cjs/utils/link/linkShare.d.ts +3 -0
  135. package/cjs/utils/link/linkShare.js +1 -0
  136. package/cjs/utils/link/linkTypes.d.ts +31 -0
  137. package/cjs/utils/link/linkTypes.js +1 -0
  138. package/cjs/utils/map/map.d.ts +2 -0
  139. package/cjs/utils/map/map.js +1 -0
  140. package/cjs/utils/minify/minify.d.ts +2 -0
  141. package/cjs/utils/minify/minify.js +1 -0
  142. package/cjs/utils/number/number.d.ts +2 -0
  143. package/cjs/utils/number/number.js +1 -0
  144. package/cjs/utils/object/object.d.ts +4 -0
  145. package/cjs/utils/object/object.js +1 -0
  146. package/cjs/utils/object/objectUtils.d.ts +2 -0
  147. package/cjs/utils/object/objectUtils.js +1 -0
  148. package/cjs/utils/path/path.d.ts +3 -0
  149. package/cjs/utils/path/path.js +1 -0
  150. package/cjs/utils/print/print.d.ts +2 -0
  151. package/cjs/utils/print/print.js +1 -0
  152. package/cjs/utils/scriptStyle/scriptStyle.d.ts +8 -0
  153. package/cjs/utils/scriptStyle/scriptStyle.js +1 -0
  154. package/cjs/utils/scriptStyle/scriptStyleTypes.d.ts +12 -0
  155. package/cjs/utils/scriptStyle/scriptStyleTypes.js +1 -0
  156. package/cjs/utils/set/set.d.ts +3 -0
  157. package/cjs/utils/set/set.js +1 -0
  158. package/cjs/utils/shortcode/shortcode.d.ts +10 -0
  159. package/cjs/utils/shortcode/shortcode.js +1 -0
  160. package/cjs/utils/shortcode/shortcodeTypes.d.ts +20 -0
  161. package/cjs/utils/shortcode/shortcodeTypes.js +1 -0
  162. package/cjs/utils/string/string.d.ts +3 -0
  163. package/cjs/utils/string/string.js +1 -0
  164. package/cjs/utils/tag/tag.d.ts +4 -0
  165. package/cjs/utils/tag/tag.js +1 -0
  166. package/cjs/utils/tag/tagTypes.d.ts +7 -0
  167. package/cjs/utils/tag/tagTypes.js +1 -0
  168. package/cjs/utils/year/year.d.ts +2 -0
  169. package/cjs/utils/year/year.js +1 -0
  170. package/cjs/wordpress/wordpressData.d.ts +6 -0
  171. package/cjs/wordpress/wordpressData.js +1 -0
  172. package/cjs/wordpress/wordpressDataNormal.d.ts +9 -0
  173. package/cjs/wordpress/wordpressDataNormal.js +1 -0
  174. package/cjs/wordpress/wordpressDataTypes.d.ts +206 -0
  175. package/cjs/wordpress/wordpressDataTypes.js +1 -0
  176. package/lib/components/Navigation/Navigation.d.ts +16 -0
  177. package/lib/components/Navigation/Navigation.js +1 -0
  178. package/lib/components/Navigation/NavigationTypes.d.ts +85 -0
  179. package/lib/components/Navigation/NavigationTypes.js +1 -0
  180. package/lib/components/Pagination/Pagination.d.ts +3 -0
  181. package/lib/components/Pagination/Pagination.js +1 -0
  182. package/lib/components/Pagination/PaginationTypes.d.ts +44 -0
  183. package/lib/components/Pagination/PaginationTypes.js +1 -0
  184. package/lib/config/config.d.ts +5 -0
  185. package/lib/config/config.js +1 -0
  186. package/lib/config/configTypes.d.ts +64 -0
  187. package/lib/config/configTypes.js +1 -0
  188. package/lib/contentful/contentfulData.d.ts +5 -0
  189. package/lib/contentful/contentfulData.js +1 -0
  190. package/lib/contentful/contentfulDataNormal.d.ts +4 -0
  191. package/lib/contentful/contentfulDataNormal.js +1 -0
  192. package/lib/contentful/contentfulDataTypes.d.ts +67 -0
  193. package/lib/contentful/contentfulDataTypes.js +1 -0
  194. package/lib/global/globalTypes.d.ts +32 -0
  195. package/lib/global/globalTypes.js +1 -0
  196. package/lib/layouts/Column/Column.d.ts +3 -0
  197. package/lib/layouts/Column/Column.js +1 -0
  198. package/lib/layouts/Column/ColumnTypes.d.ts +16 -0
  199. package/lib/layouts/Column/ColumnTypes.js +1 -0
  200. package/lib/layouts/Container/Container.d.ts +3 -0
  201. package/lib/layouts/Container/Container.js +1 -0
  202. package/lib/layouts/Container/ContainerTypes.d.ts +15 -0
  203. package/lib/layouts/Container/ContainerTypes.js +1 -0
  204. package/lib/local/localData.d.ts +5 -0
  205. package/lib/local/localData.js +1 -0
  206. package/lib/local/localDataNormal.d.ts +3 -0
  207. package/lib/local/localDataNormal.js +1 -0
  208. package/lib/local/localDataTypes.d.ts +14 -0
  209. package/lib/local/localDataTypes.js +1 -0
  210. package/lib/objects/Form/Form.d.ts +3 -0
  211. package/lib/objects/Form/Form.js +1 -0
  212. package/lib/objects/Form/FormField.d.ts +3 -0
  213. package/lib/objects/Form/FormField.js +1 -0
  214. package/lib/objects/Form/FormOption.d.ts +3 -0
  215. package/lib/objects/Form/FormOption.js +1 -0
  216. package/lib/objects/Form/FormTypes.d.ts +74 -0
  217. package/lib/objects/Form/FormTypes.js +1 -0
  218. package/lib/package.json +1 -0
  219. package/lib/redirects/redirects.d.ts +4 -0
  220. package/lib/redirects/redirects.js +1 -0
  221. package/lib/redirects/redirectsFile.d.ts +2 -0
  222. package/lib/redirects/redirectsFile.js +1 -0
  223. package/lib/render/render.d.ts +11 -0
  224. package/lib/render/render.js +1 -0
  225. package/lib/render/renderInline.d.ts +4 -0
  226. package/lib/render/renderInline.js +1 -0
  227. package/lib/render/renderTypes.d.ts +198 -0
  228. package/lib/render/renderTypes.js +1 -0
  229. package/lib/serverless/Ajax/Ajax.d.ts +3 -0
  230. package/lib/serverless/Ajax/Ajax.js +1 -0
  231. package/lib/serverless/Ajax/AjaxTypes.d.ts +11 -0
  232. package/lib/serverless/Ajax/AjaxTypes.js +1 -0
  233. package/lib/serverless/Contact/Contact.d.ts +3 -0
  234. package/lib/serverless/Contact/Contact.js +1 -0
  235. package/lib/serverless/Contact/ContactTypes.d.ts +13 -0
  236. package/lib/serverless/Contact/ContactTypes.js +1 -0
  237. package/lib/serverless/Preview/Preview.d.ts +5 -0
  238. package/lib/serverless/Preview/Preview.js +1 -0
  239. package/lib/serverless/Reload/Reload.d.ts +5 -0
  240. package/lib/serverless/Reload/Reload.js +1 -0
  241. package/lib/serverless/Reload/ReloadTypes.d.ts +5 -0
  242. package/lib/serverless/Reload/ReloadTypes.js +1 -0
  243. package/lib/serverless/serverless.d.ts +6 -0
  244. package/lib/serverless/serverless.js +1 -0
  245. package/lib/serverless/serverlessFiles.d.ts +3 -0
  246. package/lib/serverless/serverlessFiles.js +1 -0
  247. package/lib/serverless/serverlessTypes.d.ts +50 -0
  248. package/lib/serverless/serverlessTypes.js +1 -0
  249. package/lib/store/store.d.ts +9 -0
  250. package/lib/store/store.js +1 -0
  251. package/lib/store/storeFiles.d.ts +2 -0
  252. package/lib/store/storeFiles.js +1 -0
  253. package/lib/store/storeTypes.d.ts +35 -0
  254. package/lib/store/storeTypes.js +1 -0
  255. package/lib/text/RichText/RichText.d.ts +4 -0
  256. package/lib/text/RichText/RichText.js +1 -0
  257. package/lib/text/RichText/RichTextTypes.d.ts +54 -0
  258. package/lib/text/RichText/RichTextTypes.js +1 -0
  259. package/lib/utils/ResponseError/ResponseError.d.ts +5 -0
  260. package/lib/utils/ResponseError/ResponseError.js +1 -0
  261. package/lib/utils/action/action.d.ts +8 -0
  262. package/lib/utils/action/action.js +1 -0
  263. package/lib/utils/action/actionTypes.d.ts +10 -0
  264. package/lib/utils/action/actionTypes.js +1 -0
  265. package/lib/utils/archive/archive.d.ts +7 -0
  266. package/lib/utils/archive/archive.js +1 -0
  267. package/lib/utils/archive/archiveTypes.d.ts +18 -0
  268. package/lib/utils/archive/archiveTypes.js +1 -0
  269. package/lib/utils/array/array.d.ts +3 -0
  270. package/lib/utils/array/array.js +1 -0
  271. package/lib/utils/boolean/boolean.d.ts +2 -0
  272. package/lib/utils/boolean/boolean.js +1 -0
  273. package/lib/utils/contentType/contentType.d.ts +2 -0
  274. package/lib/utils/contentType/contentType.js +1 -0
  275. package/lib/utils/dataSource/dataSource.d.ts +3 -0
  276. package/lib/utils/dataSource/dataSource.js +1 -0
  277. package/lib/utils/dataSource/dataSourceTypes.d.ts +9 -0
  278. package/lib/utils/dataSource/dataSourceTypes.js +1 -0
  279. package/lib/utils/escape/escape.d.ts +2 -0
  280. package/lib/utils/escape/escape.js +1 -0
  281. package/lib/utils/excerpt/excerpt.d.ts +3 -0
  282. package/lib/utils/excerpt/excerpt.js +1 -0
  283. package/lib/utils/excerpt/excerptTypes.d.ts +14 -0
  284. package/lib/utils/excerpt/excerptTypes.js +1 -0
  285. package/lib/utils/file/filePath.d.ts +2 -0
  286. package/lib/utils/file/filePath.js +1 -0
  287. package/lib/utils/filter/filter.d.ts +8 -0
  288. package/lib/utils/filter/filter.js +1 -0
  289. package/lib/utils/filter/filterTypes.d.ts +62 -0
  290. package/lib/utils/filter/filterTypes.js +1 -0
  291. package/lib/utils/function/function.d.ts +3 -0
  292. package/lib/utils/function/function.js +1 -0
  293. package/lib/utils/heading/heading.d.ts +2 -0
  294. package/lib/utils/heading/heading.js +1 -0
  295. package/lib/utils/image/image.d.ts +5 -0
  296. package/lib/utils/image/image.js +1 -0
  297. package/lib/utils/image/imageLocal.d.ts +3 -0
  298. package/lib/utils/image/imageLocal.js +1 -0
  299. package/lib/utils/image/imageRemote.d.ts +3 -0
  300. package/lib/utils/image/imageRemote.js +1 -0
  301. package/lib/utils/image/imageTypes.d.ts +60 -0
  302. package/lib/utils/image/imageTypes.js +1 -0
  303. package/lib/utils/json/json.d.ts +3 -0
  304. package/lib/utils/json/json.js +1 -0
  305. package/lib/utils/link/link.d.ts +6 -0
  306. package/lib/utils/link/link.js +1 -0
  307. package/lib/utils/link/linkShare.d.ts +3 -0
  308. package/lib/utils/link/linkShare.js +1 -0
  309. package/lib/utils/link/linkTypes.d.ts +31 -0
  310. package/lib/utils/link/linkTypes.js +1 -0
  311. package/lib/utils/map/map.d.ts +2 -0
  312. package/lib/utils/map/map.js +1 -0
  313. package/lib/utils/minify/minify.d.ts +2 -0
  314. package/lib/utils/minify/minify.js +1 -0
  315. package/lib/utils/number/number.d.ts +2 -0
  316. package/lib/utils/number/number.js +1 -0
  317. package/lib/utils/object/object.d.ts +4 -0
  318. package/lib/utils/object/object.js +1 -0
  319. package/lib/utils/object/objectUtils.d.ts +2 -0
  320. package/lib/utils/object/objectUtils.js +1 -0
  321. package/lib/utils/path/path.d.ts +3 -0
  322. package/lib/utils/path/path.js +1 -0
  323. package/lib/utils/print/print.d.ts +2 -0
  324. package/lib/utils/print/print.js +1 -0
  325. package/lib/utils/scriptStyle/scriptStyle.d.ts +8 -0
  326. package/lib/utils/scriptStyle/scriptStyle.js +1 -0
  327. package/lib/utils/scriptStyle/scriptStyleTypes.d.ts +12 -0
  328. package/lib/utils/scriptStyle/scriptStyleTypes.js +1 -0
  329. package/lib/utils/set/set.d.ts +3 -0
  330. package/lib/utils/set/set.js +1 -0
  331. package/lib/utils/shortcode/shortcode.d.ts +10 -0
  332. package/lib/utils/shortcode/shortcode.js +1 -0
  333. package/lib/utils/shortcode/shortcodeTypes.d.ts +20 -0
  334. package/lib/utils/shortcode/shortcodeTypes.js +1 -0
  335. package/lib/utils/string/string.d.ts +3 -0
  336. package/lib/utils/string/string.js +1 -0
  337. package/lib/utils/tag/tag.d.ts +4 -0
  338. package/lib/utils/tag/tag.js +1 -0
  339. package/lib/utils/tag/tagTypes.d.ts +7 -0
  340. package/lib/utils/tag/tagTypes.js +1 -0
  341. package/lib/utils/year/year.d.ts +2 -0
  342. package/lib/utils/year/year.js +1 -0
  343. package/lib/wordpress/wordpressData.d.ts +6 -0
  344. package/lib/wordpress/wordpressData.js +1 -0
  345. package/lib/wordpress/wordpressDataNormal.d.ts +9 -0
  346. package/lib/wordpress/wordpressDataNormal.js +1 -0
  347. package/lib/wordpress/wordpressDataTypes.d.ts +206 -0
  348. package/lib/wordpress/wordpressDataTypes.js +1 -0
  349. package/package.json +87 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPathDepth=exports.getPath=void 0;const string_js_1=require("../string/string.js"),config_js_1=require("../../config/config.js"),store_js_1=require("../../store/store.js"),serverless_js_1=require("../../serverless/serverless.js"),getPath=(file,type)=>{const root=config_js_1.config.env.dir;if(!(0,string_js_1.isStringStrict)(root)||!(0,string_js_1.isStringStrict)(file))return"";let append=file;if("store"===type){const dir=store_js_1.storeDir;(0,string_js_1.isStringStrict)(dir)&&(append=`${dir}/${file}.json`)}if("serverless"===type){const dir=serverless_js_1.serverlessDir;(0,string_js_1.isStringStrict)(dir)&&(append=`${dir}/${file}.js`)}return`${root}${root.endsWith("/")?"":"/"}${append}`};exports.getPath=getPath;const getPathDepth=(path="")=>{if(!(0,string_js_1.isStringStrict)(path))return"";let pathDepth=path.split("/");return pathDepth.pop(),pathDepth=pathDepth.map((()=>"../")),pathDepth.join("")};exports.getPathDepth=getPathDepth;
@@ -0,0 +1,2 @@
1
+ declare const print: (pre: string | undefined, message: unknown, type?: "error" | "warning" | "success" | "info") => void;
2
+ export { print };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.print=void 0;const array_js_1=require("../array/array.js"),print=(pre="Log",message,type="error")=>{const output=`${pre}: \n${((0,array_js_1.isArray)(message)?message:[message]).join("\n").trim()}`;"error"===type&&console.error(`${output}`),"warning"===type&&console.warn(`${output}`),"success"===type&&console.info(`${output}`),"info"===type&&console.info(`${output}`)};exports.print=print;
@@ -0,0 +1,8 @@
1
+ import type { Scripts, Styles } from './scriptStyleTypes.js';
2
+ declare const scripts: Scripts;
3
+ declare const styles: Styles;
4
+ declare const addScript: (path: string, deps?: string[]) => boolean;
5
+ declare const addStyle: (path: string, deps?: string[]) => boolean;
6
+ declare const outputScripts: (link: string) => string;
7
+ declare const outputStyles: (link: string) => string;
8
+ export { scripts, styles, addScript, addStyle, outputScripts, outputStyles };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.outputStyles=exports.outputScripts=exports.addStyle=exports.addScript=exports.styles=exports.scripts=void 0;const array_js_1=require("../array/array.js"),string_js_1=require("../string/string.js"),config_js_1=require("../../config/config.js"),scripts={deps:new Map,item:new Map,build:new Map,meta:{}};exports.scripts=scripts;const styles={deps:new Map,item:new Map,build:new Map};exports.styles=styles;const addScriptStyle=(type,path,deps=[])=>{if(!(0,string_js_1.isStringStrict)(path))return!1;const isScripts="scripts"===type,assets=isScripts?scripts:styles,ext=isScripts?"js":"scss",{inputDir:inputDir,outputDir:outputDir}=config_js_1.config[type],input=`${inputDir}/${path}.${ext}`,output=`${outputDir}/${path}`;return assets.item.set(output,input),assets.build.set(output,input),(0,array_js_1.isArrayStrict)(deps)&&deps.forEach((dep=>{const depInput=`${inputDir}/${dep}.${ext}`,depOutput=`${outputDir}/${dep}`;assets.deps.has(output)||assets.deps.set(output,new Set),assets.deps.get(output)?.add(depOutput),assets.item.set(depOutput,depInput),assets.build.set(depOutput,depInput)})),!0},addScript=(path,deps=[])=>addScriptStyle("scripts",path,deps);exports.addScript=addScript;const addStyle=(path,deps=[])=>addScriptStyle("styles",path,deps);exports.addStyle=addStyle;const outputScriptsStyles=(type,link)=>{if(!(0,string_js_1.isStringStrict)(link))return"";const{item:item,deps:deps}="scripts"===type?scripts:styles;if(!item.size)return"";const itemOut=Array.from(item.keys());itemOut.sort(((a,b)=>{const aIsDep=deps.get(b)?.has(a),bIsDep=deps.get(a)?.has(b);return!0===aIsDep?-1:!0===bIsDep?1:0}));let output="";return itemOut.forEach((out=>{"scripts"===type&&(output+=`<script type="module" src="${link}${out}.js"><\/script>`),"styles"===type&&(output+=`<link rel="stylesheet" href="${link}${out}.css" media="all">`)})),output},outputScripts=link=>outputScriptsStyles("scripts",link);exports.outputScripts=outputScripts;const outputStyles=link=>outputScriptsStyles("styles",link);exports.outputStyles=outputStyles;
@@ -0,0 +1,12 @@
1
+ import type { Generic } from '../../global/globalTypes.js';
2
+ export interface Scripts {
3
+ deps: Map<string, Set<string>>;
4
+ item: Map<string, string>;
5
+ build: Map<string, string>;
6
+ meta: Generic;
7
+ }
8
+ export interface Styles {
9
+ deps: Map<string, Set<string>>;
10
+ item: Map<string, string>;
11
+ build: Map<string, string>;
12
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,3 @@
1
+ declare const isSet: <T>(value: unknown) => value is Set<T>;
2
+ declare const isSetStrict: <T>(value: unknown) => value is Set<T>;
3
+ export { isSet, isSetStrict };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isSetStrict=exports.isSet=void 0;const isSet=value=>value instanceof Set;exports.isSet=isSet;const isSetStrict=value=>isSet(value)&&value.size>0;exports.isSetStrict=isSetStrict;
@@ -0,0 +1,10 @@
1
+ import type { Shortcode, Shortcodes, ShortcodesSet } from './shortcodeTypes.js';
2
+ import type { RenderItem } from '../../render/renderTypes.js';
3
+ declare const shortcodes: Shortcodes;
4
+ declare const addShortcode: <T extends Shortcode>(name: string, shortcode: T) => boolean;
5
+ declare const removeShortcode: (name: string) => boolean;
6
+ declare const doShortcodes: (content: string, pageData?: RenderItem) => Promise<string>;
7
+ declare const resetShortcodes: () => void;
8
+ declare const setShortcodes: <T extends ShortcodesSet>(args: T) => boolean;
9
+ declare const stripShortcodes: (content: string) => string;
10
+ export { shortcodes, addShortcode, removeShortcode, doShortcodes, resetShortcodes, setShortcodes, stripShortcodes };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.stripShortcodes=exports.setShortcodes=exports.resetShortcodes=exports.doShortcodes=exports.removeShortcode=exports.addShortcode=exports.shortcodes=void 0;const object_js_1=require("../object/object.js"),array_js_1=require("../array/array.js"),string_js_1=require("../string/string.js"),function_js_1=require("../function/function.js"),number_js_1=require("../number/number.js"),escape_js_1=require("../escape/escape.js"),shortcodes=new Map;exports.shortcodes=shortcodes;const attrReg=/[\w-]+=".*?"/g,getShortcodeData=(content,tagNames,props,pageData)=>{if(!(0,string_js_1.isStringStrict)(content)||!(0,string_js_1.isStringStrict)(tagNames))return[];const reg=new RegExp(String.raw`\[(?:\/)?(?<name>${tagNames})(?:\s[^\]]*?)?\]`,"g"),matches=[...content.matchAll(reg)];if(!matches.length)return[];const data=[];return matches.forEach(((opening,i)=>{const name=opening.groups?.name,tag=opening[0];if(!(0,string_js_1.isStringStrict)(name)||tag.startsWith("[/"))return;const info=props||shortcodes.get(name);if(!(0,object_js_1.isObjectStrict)(info))return;const child=info.child,hasChild=(0,string_js_1.isStringStrict)(child),startIndex=opening.index,startLen=tag.length;let endIndex=startIndex+tag.length,endLen=0;const closingTag=`[/${name}]`,closingMatch=hasChild?matches.find((m=>m[0]===closingTag)):matches[i+1];closingMatch?.[0]===closingTag&&(endIndex=closingMatch.index,endLen=closingTag.length);const attributes={},attributeTypes=(0,object_js_1.isObjectStrict)(info.attributeTypes)?info.attributeTypes:{},attr=tag.match(attrReg);(0,array_js_1.isArrayStrict)(attr)&&attr.forEach((a=>{const[key,value]=a.split("=");if(!(0,string_js_1.isStringStrict)(key)||!(0,string_js_1.isStringStrict)(value))return;let val=(0,escape_js_1.escape)(value.replace(/"/g,""));if((0,string_js_1.isStringStrict)(attributeTypes[key])){const type=attributeTypes[key];if("number"===type){const num=parseInt(val,10);val=isNaN(num)?0:num}"boolean"===type&&(val="true"===val)}attributes[key]=val}));let replaceContent="",innerContent="";(0,number_js_1.isNumber)(startIndex)&&(0,number_js_1.isNumber)(endIndex)&&(replaceContent=content.slice(startIndex,endIndex+endLen),innerContent=content.slice(startIndex+startLen,endIndex));let children=[];hasChild&&(children=getShortcodeData(innerContent,child,props,pageData)),data.push({name:name,replaceContent:replaceContent,content:innerContent,attributes:attributes,children:children,pageData:pageData})})),data},addShortcode=(name,shortcode)=>!(!(0,string_js_1.isStringStrict)(name)||!(0,object_js_1.isObjectStrict)(shortcode))&&(shortcodes.set(name,shortcode),!0);exports.addShortcode=addShortcode;const removeShortcode=name=>!!(0,string_js_1.isStringStrict)(name)&&shortcodes.delete(name);exports.removeShortcode=removeShortcode;const doShortcodes=async(content,pageData)=>{if(!shortcodes.size)return content;const names=[...shortcodes.keys()].join("|"),data=getShortcodeData(content,names,void 0,pageData);if(!data.length)return content;let newContent=content;for(const datum of data){const{name:name,replaceContent:replaceContent}=datum,callback=shortcodes.get(name)?.callback;if((0,function_js_1.isFunction)(callback)){const res=await callback({...datum,pageData:pageData});(0,string_js_1.isStringStrict)(res)&&(newContent=newContent.replace(replaceContent,res))}}return newContent};exports.doShortcodes=doShortcodes;const resetShortcodes=()=>{shortcodes.clear()};exports.resetShortcodes=resetShortcodes;const setShortcodes=args=>{if(!(0,object_js_1.isObjectStrict)(args))return!1;const names=Object.entries(args);return!!names.length&&(resetShortcodes(),names.forEach((([name,shortcode])=>{addShortcode(name,shortcode)})),!0)};exports.setShortcodes=setShortcodes;const stripShortcodes=content=>{if(!shortcodes.size)return content;const names=[...shortcodes.keys()].join("|"),reg=new RegExp(String.raw`\[(?:\/)?(?<name>${names})(?:\s[^\]]*?)?\]`,"g");return content.replace(reg,(()=>""))};exports.stripShortcodes=stripShortcodes;
@@ -0,0 +1,20 @@
1
+ import type { GenericStrings } from '../../global/globalTypes.js';
2
+ import type { RenderItem } from '../../render/renderTypes.js';
3
+ export type ShortcodeAttrValue = string | number | boolean | undefined;
4
+ export type ShortcodeAttrs = Record<string, ShortcodeAttrValue>;
5
+ export interface ShortcodeData {
6
+ name: string;
7
+ replaceContent: string;
8
+ content: string;
9
+ attributes: ShortcodeAttrs;
10
+ children: ShortcodeData[];
11
+ pageData?: RenderItem;
12
+ }
13
+ export type ShortcodeCallback = (args: ShortcodeData) => string | Promise<string>;
14
+ export interface Shortcode {
15
+ callback: ShortcodeCallback;
16
+ attributeTypes?: GenericStrings;
17
+ child?: string;
18
+ }
19
+ export type Shortcodes = Map<string, Shortcode>;
20
+ export type ShortcodesSet = Record<string, Shortcode>;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,3 @@
1
+ declare const isString: (value: unknown) => value is string;
2
+ declare const isStringStrict: (value: unknown) => value is string;
3
+ export { isString, isStringStrict };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isStringStrict=exports.isString=void 0;const isString=value=>"string"==typeof value;exports.isString=isString;const isStringStrict=value=>isString(value)&&""!==value;exports.isStringStrict=isStringStrict;
@@ -0,0 +1,4 @@
1
+ import type { TagGet, TagExists } from './tagTypes.js';
2
+ declare const getTag: TagGet;
3
+ declare const tagExists: TagExists;
4
+ export { getTag, tagExists };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.tagExists=exports.getTag=void 0;const object_js_1=require("../object/object.js"),string_js_1=require("../string/string.js"),array_js_1=require("../array/array.js"),getTag=(item,id)=>{if(!(0,object_js_1.isObjectStrict)(item)||!(0,string_js_1.isStringStrict)(id))return;const tags=item.metadata?.tags;if(!(0,array_js_1.isArrayStrict)(tags))return;let tagInfo;return tags.find((tag=>{if(!(0,object_js_1.isObjectStrict)(tag))return!1;const tagId=tag.id;return tagId===id&&(tagInfo={id:tagId,name:(0,string_js_1.isStringStrict)(tag.name)?tag.name:""},!0)})),tagInfo};exports.getTag=getTag;const tagExists=(item,id)=>null!=getTag(item,id);exports.tagExists=tagExists;
@@ -0,0 +1,7 @@
1
+ import type { RenderItem } from '../../render/renderTypes.js';
2
+ export type TagGet = (item: RenderItem, id: string) => TagGetReturn | undefined;
3
+ export type TagExists = (item: RenderItem, id: string) => boolean;
4
+ export interface TagGetReturn {
5
+ id: string;
6
+ name: string;
7
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,2 @@
1
+ declare const getYear: () => number;
2
+ export { getYear };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getYear=void 0;const getYear=()=>(new Date).getFullYear();exports.getYear=getYear;
@@ -0,0 +1,6 @@
1
+ import type { AllWordPressDataArgs, WordPressDataArgs } from './wordpressDataTypes.js';
2
+ import type { RenderAllData, RenderItem } from '../render/renderTypes.js';
3
+ declare const getRoute: (type: string) => string;
4
+ declare const getWordPressData: (args: WordPressDataArgs, _page?: number) => Promise<RenderItem[]>;
5
+ declare const getAllWordPressData: (args?: AllWordPressDataArgs) => Promise<RenderAllData | undefined>;
6
+ export { getRoute, getWordPressData, getAllWordPressData };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getAllWordPressData=exports.getWordPressData=exports.getRoute=void 0;const wordpressDataNormal_js_1=require("./wordpressDataNormal.js"),filter_js_1=require("../utils/filter/filter.js"),object_js_1=require("../utils/object/object.js"),string_js_1=require("../utils/string/string.js"),array_js_1=require("../utils/array/array.js"),store_js_1=require("../store/store.js"),config_js_1=require("../config/config.js"),getRoute=type=>{const route=wordpressDataNormal_js_1.normalRoutes.get(type);return(0,string_js_1.isString)(route)?route:type};exports.getRoute=getRoute;const getWordPressData=async(args,_page=1)=>{if(!(0,object_js_1.isObjectStrict)(args))throw new Error("No args");const{key:key,route:route,params:params,meta:meta,fetcher:fetcher=fetch,options:options}=args;if(!(0,string_js_1.isStringStrict)(key))throw new Error("No key");const hasMeta=(0,object_js_1.isObjectStrict)(meta);if(config_js_1.config.env.cache){const cacheDataFilterArgs={key:key,type:"get"},cacheData=await(0,filter_js_1.applyFilters)("cacheData",void 0,cacheDataFilterArgs,!0),cacheItems=cacheData?.items,cacheMeta=cacheData?.meta;if((0,object_js_1.isObjectStrict)(cacheMeta)&&hasMeta){const{total:total,totalPages:totalPages}=cacheMeta;meta.total=total,meta.totalPages=totalPages}if((0,array_js_1.isArray)(cacheItems))return structuredClone(cacheItems)}if(!(0,string_js_1.isStringStrict)(route))throw new Error("No route");const{devUser:devUser,prodUser:prodUser,devCredential:devCredential,prodCredential:prodCredential,devHost:devHost,prodHost:prodHost,ssl:ssl=!0}=config_js_1.config.cms;let user=devUser,pass=devCredential,host=devHost,status="any";if(config_js_1.config.env.prod&&(user=prodUser,pass=prodCredential,host=prodHost,status="publish"),!(0,string_js_1.isStringStrict)(user)||!(0,string_js_1.isStringStrict)(pass)||!(0,string_js_1.isStringStrict)(host))throw new Error("No credentials");let url=`${ssl?"https":"http"}://${host}/wp-json/wp/v2/${route}?status=${status}`,loop=!1,embed=!1;if((0,object_js_1.isObjectStrict)(params))for(const[key,value]of Object.entries(params)){let val=value;"_embed"===key&&(embed=!0),"per_page"===key&&-1===value&&(val=100,loop=!0),url+=`&${key}=${val.toString()}`}loop&&(url+=`&page=${_page}`),embed||(url+="&_embed");const headers=new Headers;headers.set("Authorization",`Basic ${btoa(`${user}:${pass}`)}`);const resp=await fetcher(url,{headers:headers,...options}),data=await resp.json(),isErr=(0,object_js_1.isObjectStrict)(data)&&(0,string_js_1.isStringStrict)(data.message),message=isErr?data.message:"Bad fetch response";if(!resp.ok||isErr)throw new Error(message,{cause:data});const total=resp.headers.get("X-WP-Total"),totalPages=resp.headers.get("X-WP-TotalPages"),totalNum=(0,string_js_1.isStringStrict)(total)?parseInt(total,10):1,totalPagesNum=(0,string_js_1.isStringStrict)(totalPages)?parseInt(totalPages,10):1;hasMeta&&(meta.total=totalNum,meta.totalPages=totalPagesNum);const dataItems=(0,array_js_1.isArray)(data)?data:[data];let newData=(0,wordpressDataNormal_js_1.normalizeWordPressData)(dataItems,route);if(loop&&_page<totalPagesNum){const pagData=await getWordPressData({key:key,route:route,meta:meta,params:{per_page:-1}},_page+1);(0,array_js_1.isArray)(pagData)&&(newData=[...newData,...pagData])}if(config_js_1.config.env.cache){const cacheDataFilterArgs={key:key,type:"set",data:data};await(0,filter_js_1.applyFilters)("cacheData",{items:newData,meta:meta},cacheDataFilterArgs,!0)}return newData};exports.getWordPressData=getWordPressData;const getAllWordPressData=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,wordpressDataFilterArgs={serverlessData:serverlessData,previewData:previewData};if(isServerless||isPreview){let contentType="",id="";if(isServerless){const item=(0,store_js_1.getStoreItem)("slugs")[serverlessData.path];(0,object_js_1.isObjectStrict)(item)&&(id=(0,string_js_1.isStringStrict)(item.id)?item.id:"",contentType=(0,string_js_1.isStringStrict)(item.contentType)?item.contentType:"")}if(isPreview&&(id=previewData.id,contentType=previewData.contentType),id){const key=`serverless_${id}_${contentType}`,data=await getWordPressData({key:key,route:`${getRoute(contentType)}/${id}`});(0,array_js_1.isArray)(data)&&(allData.content[contentType]=data)}}if(!isServerless){const partial=config_js_1.config.partialTypes;for(const contentType of partial){const isMenu="nav_menu"===contentType,isMenuItem="nav_menu_item"===contentType,partialType=isMenu?"navigation":isMenuItem?"navigationItem":contentType;allData[partialType]=[];const key=`all_${contentType}`;let data=await getWordPressData({key:key,route:getRoute(contentType),params:{per_page:-1}});isMenuItem&&(data=(0,wordpressDataNormal_js_1.normalizeWordPressMenuItems)(data)),isMenu&&(data=(0,wordpressDataNormal_js_1.normalizeWordPressMenus)(data)),data=(0,filter_js_1.applyFilters)("wordpressData",data,{...wordpressDataFilterArgs,contentType:contentType}),(0,array_js_1.isArray)(data)&&(allData[partialType]=data)}}if(!isServerless&&!isPreview){const whole=config_js_1.config.wholeTypes;for(const contentType of whole){allData.content[contentType]=[];const key=`all_${contentType}`;let data=await getWordPressData({key:key,route:getRoute(contentType),params:{per_page:-1}});data=(0,filter_js_1.applyFilters)("wordpressData",data,{...wordpressDataFilterArgs,contentType:contentType}),(0,array_js_1.isArray)(data)&&(allData.content[contentType]=data)}}return allData=(0,filter_js_1.applyFilters)("allData",allData,{type:"wordpress",serverlessData:serverlessData,previewData:previewData}),allData};exports.getAllWordPressData=getAllWordPressData;
@@ -0,0 +1,9 @@
1
+ import type { WordPressDataItem, WordPressDataMenuItem, WordPressDataMenu } from './wordpressDataTypes.js';
2
+ import type { RenderItem } from '../render/renderTypes.js';
3
+ import type { NavigationList, NavigationItem } from '../components/Navigation/NavigationTypes.js';
4
+ declare const normalRoutes: Map<string, string>;
5
+ declare const normalMetaKeys: Map<string, string>;
6
+ declare const normalizeWordPressMenuItems: (items: WordPressDataMenuItem[]) => NavigationItem[];
7
+ declare const normalizeWordPressMenus: (menus: WordPressDataMenu[]) => NavigationList[];
8
+ declare const normalizeWordPressData: (data: WordPressDataItem[], route?: string, _newData?: RenderItem[]) => RenderItem[];
9
+ export { normalizeWordPressData, normalizeWordPressMenuItems, normalizeWordPressMenus, normalRoutes, normalMetaKeys };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalMetaKeys=exports.normalRoutes=exports.normalizeWordPressMenus=exports.normalizeWordPressMenuItems=exports.normalizeWordPressData=void 0;const block_serialization_spec_parser_1=require("@wordpress/block-serialization-spec-parser"),contentType_js_1=require("../utils/contentType/contentType.js"),objectUtils_js_1=require("../utils/object/objectUtils.js"),store_js_1=require("../store/store.js"),string_js_1=require("../utils/string/string.js"),array_js_1=require("../utils/array/array.js"),object_js_1=require("../utils/object/object.js"),number_js_1=require("../utils/number/number.js"),config_js_1=require("../config/config.js"),normalRoutes=new Map([["page","pages"],["post","posts"],["taxonomy","taxonomies"],["category","categories"],["tag","tags"],["attachment","media"],["nav_menu","menus"],["nav_menu_item","menu-items"]]);exports.normalRoutes=normalRoutes;const normalMetaKeys=new Map;exports.normalMetaKeys=normalMetaKeys;const menusById=new Map,excludeProps=["_links","auto_add"],getTaxonomy=id=>{const taxonomy=(0,store_js_1.getStoreItem)("taxonomies")[id],{title:title="",slug:slug="",contentTypes:contentTypes=[]}=(0,object_js_1.isObjectStrict)(taxonomy)?taxonomy:{};return{id:id,title:title,slug:slug,contentTypes:contentTypes}},normalizeFile=file=>{const{url:url,filename:filename,alt:alt,width:width,height:height,filesizeInBytes:filesizeInBytes,subtype:subtype,mime:mime,sizes:sizes}=file;let s;if((0,object_js_1.isObjectStrict)(sizes)){s={};for(const[,value]of Object.entries(sizes)){const{width:width,source_url:src}=value;let{url:url}=value;(0,string_js_1.isStringStrict)(src)&&(url=src),(0,number_js_1.isNumber)(width)&&(0,string_js_1.isStringStrict)(url)&&(s[width]=url)}}return{url:(0,string_js_1.isString)(url)?url:"",name:(0,string_js_1.isString)(filename)?filename:"",alt:(0,string_js_1.isString)(alt)?alt:"",width:(0,number_js_1.isNumber)(width)?width:0,height:(0,number_js_1.isNumber)(height)?height:0,size:(0,number_js_1.isNumber)(filesizeInBytes)?filesizeInBytes:0,format:"jpeg"===subtype?"jpg":subtype,type:mime,sizes:s}},normalizeEmbedded=(value,item,newItem)=>{(0,objectUtils_js_1.getObjectKeys)(value).forEach((k=>{const embeds=value[k];(0,array_js_1.isArrayStrict)(embeds)&&("author"===k&&embeds.forEach((embed=>{if(!(0,object_js_1.isObjectStrict)(embed))return;const{id:id,name:name,url:url,description:description,link:link,slug:slug}=embed;item.author===id&&(newItem.author={id:id.toString(),name:name,url:url,description:description,link:link,slug:slug})})),"up"===k&&embeds.forEach((embed=>{if(!(0,object_js_1.isObjectStrict)(embed))return;const{id:id,title:parentTitle,name:name,type:type,taxonomy:taxonomy,slug:slug}=embed;if(item.parent!==id)return;let title="";(0,string_js_1.isString)(parentTitle?.rendered)&&(title=parentTitle.rendered),(0,string_js_1.isString)(name)&&(title=name),newItem.parent={id:id.toString(),contentType:(0,string_js_1.isString)(taxonomy)?"term":type,title:title,slug:slug}})),"wp:featuredmedia"===k&&embeds.forEach((embed=>{if(!(0,object_js_1.isObjectStrict)(embed))return;const{id:id,source_url:url,media_details:details,mime_type:mimeType,alt_text:alt}=embed;if(!(0,object_js_1.isObjectStrict)(details))return;const{file:file,filesize:filesize,width:width,height:height,sizes:sizes}=details;item.featured_media===id&&(newItem.featured_media=normalizeFile({url:url,filename:file?.split("/").pop(),alt:alt,width:width,height:height,filesizeInBytes:filesize,subtype:mimeType?.split("/").pop(),mime:mimeType,sizes:sizes}))})),"wp:term"===k&&embeds.forEach((embed=>{(0,array_js_1.isArrayStrict)(embed)&&embed.forEach((e=>{if(!(0,object_js_1.isObjectStrict)(e))return;const{id:id,link:link,name:name,slug:slug,taxonomy:taxonomy=""}=e;let taxonomyLookup=taxonomy;"category"===taxonomy&&(taxonomyLookup="categories"),"post_tag"===taxonomy&&(taxonomyLookup="tags");const itemTaxonomy=newItem[taxonomyLookup]??item[taxonomyLookup];(0,array_js_1.isArrayStrict)(itemTaxonomy)&&(newItem[taxonomyLookup]=itemTaxonomy.map((taxonomyId=>taxonomyId!==id?taxonomyId:{id:id.toString(),link:link,title:name,slug:slug,contentType:"term",taxonomy:getTaxonomy(taxonomy)})))}))})))}))},normalizeBlocks=blocks=>{const newItems=[];return blocks.forEach((block=>{const{blockName:blockName,attrs:attrs,innerBlocks:innerBlocks}=block,contentType=blockName;if(!(0,string_js_1.isStringStrict)(contentType))return;const{attributeIsItem:attributeIsItem}=attrs,attrItemArr=((0,string_js_1.isStringStrict)(attributeIsItem)?attributeIsItem:"").split(","),attrItemExists=attrItemArr.length>0;for(const[key,value]of Object.entries(attrs))if((0,object_js_1.isObjectStrict)(value)){if(attrItemExists&&attrItemArr.includes(key)){const itemValue=normalizeItem(value);itemValue.content=void 0,attrs[key]=itemValue}(0,string_js_1.isStringStrict)(value.mime)&&(attrs[key]=normalizeFile(value))}const newItem={contentType:contentType,...attrs},renderType=config_js_1.config.renderTypes[contentType];return(0,string_js_1.isString)(renderType)&&(newItem.renderType=renderType),(0,array_js_1.isArrayStrict)(innerBlocks)&&(newItem.content=normalizeBlocks(innerBlocks)),newItems.push(newItem)})),newItems},normalizeItem=item=>{const newItem={};for(const[key,value]of Object.entries(item)){if(excludeProps.includes(key))continue;let val=value,k=key;const isObj=(0,object_js_1.isObjectStrict)(value),isStr=(0,string_js_1.isStringStrict)(value);if("id"!==key&&"object_id"!==k||(val=value?.toString()),"type"===key&&isStr)newItem.contentType=(0,contentType_js_1.normalizeContentType)(value),(0,string_js_1.isString)(config_js_1.config.renderTypes[value])&&(newItem.renderType=config_js_1.config.renderTypes[value]);else{if("types"===key&&(k="contentTypes"),isObj){const{rendered:rendered}=value;(0,string_js_1.isString)(rendered)&&(val=rendered)}if("name"===key&&(k="title"),"_embedded"===key&&isObj)normalizeEmbedded(value,item,newItem);else{if((0,string_js_1.isStringStrict)(val)){if("excerpt"===key&&(val=val.replace(/<[^>]*>|\[.*?\]/g,"").trim()),"content"===key){const normalVal=normalizeBlocks((0,block_serialization_spec_parser_1.parse)(val));val=normalVal.length>0?normalVal:val}"taxonomy"===key&&(newItem.contentType="term",val=getTaxonomy(val))}if("meta"===key&&isObj)for(const[metaKey,metaValue]of Object.entries(val)){newItem[normalMetaKeys.get(metaKey)??metaKey]=metaValue}else{if("media_details"===k&&isObj){const valObj=val,valFull=valObj.sizes?.full,sourceUrl=item.source_url,mimeType=item.mime_type;val=normalizeFile({url:sourceUrl,filename:sourceUrl?.split("/").pop(),alt:item.alt_text,width:valFull?.width,height:valFull?.height,filesizeInBytes:valObj.filesize,subtype:mimeType?.split("/")[1],mime:mimeType,sizes:valObj.sizes})}newItem[k]=val}}}}return newItem},normalizeWordPressMenuItems=items=>{const itemsObj=Object.fromEntries(items.map((item=>[item.id,item])));menusById.clear(),items.forEach((item=>{const{id:id="",title:title="",menu_order:menu_order=0,menus:menus=0,parent:parent}=item,hasMenuOrder=(0,number_js_1.isNumber)(menu_order);if(hasMenuOrder&&(0,object_js_1.isObjectStrict)(itemsObj[parent])&&(null==itemsObj[parent].children&&(itemsObj[parent].children=[]),itemsObj[parent].children.push({id:id,menu_order:menu_order,title:title})),hasMenuOrder&&(0,number_js_1.isNumber)(menus)&&0===parent){const menuId=menus.toString();null==menusById.get(menuId)&&menusById.set(menuId,[]),menusById.get(menuId)?.push({id:id,menu_order:menu_order,title:title})}}));const newItems=[];for(const[id,obj]of Object.entries(itemsObj)){const{url:url="",title:title="",attr_title:attr_title="",description:description="",contentType:contentType="",children:children=[],object:object="",object_id:object_id="",target:target="",classes:classes=[],xfn:xfn=[],meta:meta=[]}=obj;if(!(0,string_js_1.isString)(url)||!(0,string_js_1.isStringStrict)(title))continue;const isCustom="custom"===contentType,newItem={id:id,title:title,attr_title:attr_title,description:description,target:target,classes:classes,xfn:xfn,meta:meta};if(!isCustom&&(0,string_js_1.isStringStrict)(object)&&(0,string_js_1.isStringStrict)(object_id)){const isTerm="taxonomy"===contentType,internalLink={contentType:isTerm?"term":object,id:object_id,slug:url.split("/").filter(Boolean).pop()};isTerm&&(internalLink.taxonomy=getTaxonomy(object)),newItem.link=url,newItem.internalLink=internalLink}if(isCustom){url.startsWith("http")&&!url.startsWith(config_js_1.config.env.prodUrl)?newItem.externalLink=url:newItem.link=url}(0,array_js_1.isArrayStrict)(children)&&(newItem.children=children.sort(((a,b)=>a.menu_order-b.menu_order))),newItems.push(newItem)}return newItems};exports.normalizeWordPressMenuItems=normalizeWordPressMenuItems;const normalizeWordPressMenus=menus=>{const newMenus=[];return menus.forEach((menu=>{const{id:id="",title:title="",description:description="",locations:locations=[],meta:meta=[]}=menu,newMenu={id:id,title:title,description:description,meta:meta,location:locations,items:menusById.get(id)?.sort(((a,b)=>a.menu_order-b.menu_order))??[]};newMenus.push(newMenu)})),newMenus};exports.normalizeWordPressMenus=normalizeWordPressMenus;const normalizeWordPressData=(data,route,_newData=[])=>(0,array_js_1.isArrayStrict)(data)?("taxonomies"===route&&(data=Object.entries(data[0]).map((([key,value])=>({id:key,type:"taxonomy",...value})))),data.forEach((item=>{(0,object_js_1.isObjectStrict)(item)&&_newData.push(normalizeItem(item))})),"taxonomies"===route&&_newData.forEach((item=>{(0,store_js_1.setStoreItem)("taxonomies",item,item.id)})),_newData):[];exports.normalizeWordPressData=normalizeWordPressData;
@@ -0,0 +1,206 @@
1
+ import type { Generic, GenericStrings } from '../global/globalTypes.js';
2
+ import type { NavigationItem } from '../components/Navigation/NavigationTypes.js';
3
+ import type { RenderServerlessData, RenderPreviewData, RenderItem, RenderDataMeta } from '../render/renderTypes.js';
4
+ export type WordPressDataParams = Record<string, string | number | boolean>;
5
+ export interface WordPressDataError {
6
+ code?: string;
7
+ message?: string;
8
+ data?: {
9
+ status?: number;
10
+ params?: GenericStrings;
11
+ details?: Generic;
12
+ };
13
+ }
14
+ export type WordPressDataStatus = 'publish' | 'draft' | 'future' | 'pending' | 'private' | 'trash' | 'auto-draft' | 'inherit';
15
+ export interface WordPressDataRendered {
16
+ rendered?: string;
17
+ }
18
+ export interface WordPressDataRenderedProtected {
19
+ rendered?: string;
20
+ protected?: boolean;
21
+ }
22
+ export interface WordPressDataMenuChild extends NavigationItem {
23
+ menu_order: number;
24
+ }
25
+ export interface WordPressDataMenuItem extends RenderItem {
26
+ children?: WordPressDataMenuChild[];
27
+ }
28
+ export interface WordPressDataMenu extends RenderItem {
29
+ name?: string;
30
+ locations?: string[];
31
+ }
32
+ export interface WordPressDataAuthor {
33
+ id: number;
34
+ name?: string;
35
+ url?: string;
36
+ description?: string;
37
+ link?: string;
38
+ slug?: string;
39
+ }
40
+ export interface WordPressDataMediaDetails {
41
+ width?: number;
42
+ height?: number;
43
+ filesize?: number;
44
+ file?: string;
45
+ sizes?: Record<string, WordPressDataMediaSize>;
46
+ }
47
+ export interface WordPressDataMediaSize {
48
+ source_url?: string;
49
+ mime_type?: string;
50
+ file?: string;
51
+ filesize?: number;
52
+ width?: number;
53
+ height?: number;
54
+ }
55
+ export interface WordPressDataFeaturedMedia {
56
+ id: number;
57
+ source_url?: string;
58
+ alt_text?: string;
59
+ caption?: WordPressDataRendered;
60
+ media_type?: string;
61
+ mime_type?: string;
62
+ media_details?: WordPressDataMediaDetails;
63
+ }
64
+ export interface WordPressDataTerm {
65
+ id: number;
66
+ link?: string;
67
+ name?: string;
68
+ slug?: string;
69
+ taxonomy?: string;
70
+ }
71
+ export interface WordPressDataAttachment {
72
+ id: number;
73
+ source_url?: string;
74
+ title?: WordPressDataRendered;
75
+ media_type?: string;
76
+ mime_type?: string;
77
+ }
78
+ export interface WordPressDataParent {
79
+ id: number;
80
+ title?: WordPressDataRendered;
81
+ excerpt?: WordPressDataRendered;
82
+ slug?: string;
83
+ type?: string;
84
+ link?: string;
85
+ author?: number;
86
+ featured_media?: number;
87
+ name?: string;
88
+ taxonomy?: string;
89
+ }
90
+ export interface WordPressDataEmbedded {
91
+ author?: WordPressDataAuthor[];
92
+ up?: WordPressDataParent[];
93
+ 'wp:featuredmedia'?: WordPressDataFeaturedMedia[];
94
+ 'wp:attachment'?: WordPressDataAttachment[];
95
+ 'wp:term'?: WordPressDataTerm[][];
96
+ }
97
+ export interface WordPressDataLink {
98
+ href: string;
99
+ name?: string;
100
+ templated?: boolean;
101
+ count?: number;
102
+ taxonomy?: string;
103
+ embeddable?: boolean;
104
+ }
105
+ export interface WordPressDataLinks {
106
+ self: WordPressDataLink[];
107
+ collection: WordPressDataLink[];
108
+ about: WordPressDataLink[];
109
+ 'version-history': WordPressDataLink[];
110
+ 'wp:attachment': WordPressDataLink[];
111
+ 'wp:term': WordPressDataLink[];
112
+ curies: WordPressDataLink[];
113
+ }
114
+ export interface WordPressDataFileSize {
115
+ height?: number;
116
+ width?: number;
117
+ url?: string;
118
+ source_url?: string;
119
+ orientation?: string;
120
+ }
121
+ export interface WordPressDataFile {
122
+ contentType?: string;
123
+ id?: number;
124
+ title?: string;
125
+ filename?: string;
126
+ url?: string;
127
+ link?: string;
128
+ alt?: string;
129
+ author?: string;
130
+ description?: string;
131
+ caption?: string;
132
+ name?: string;
133
+ status?: string;
134
+ uploadedTo?: number;
135
+ date?: string;
136
+ modified?: string;
137
+ menuOrder?: number;
138
+ mime?: string;
139
+ type?: string;
140
+ subtype?: string;
141
+ icon?: string;
142
+ dateFormatted?: string;
143
+ nonces?: {
144
+ update: string;
145
+ delete: string;
146
+ edit: string;
147
+ };
148
+ editLink?: string;
149
+ meta?: boolean;
150
+ authorName?: string;
151
+ authorLink?: string;
152
+ filesizeInBytes?: number;
153
+ filesizeHumanReadable?: string;
154
+ context?: string;
155
+ height?: number;
156
+ width?: number;
157
+ orientation?: string;
158
+ sizes?: Record<string, WordPressDataFileSize>;
159
+ }
160
+ export interface WordPressDataMeta extends Generic {
161
+ footnotes?: string;
162
+ }
163
+ export interface WordPressDataItem extends Partial<WordPressDataFeaturedMedia>, Generic {
164
+ id?: number;
165
+ date?: string;
166
+ date_gmt?: string;
167
+ guid?: WordPressDataRendered;
168
+ modified?: string;
169
+ modified_gmt?: string;
170
+ slug?: string;
171
+ status?: WordPressDataStatus;
172
+ type?: string;
173
+ link?: string;
174
+ title?: WordPressDataRendered;
175
+ content?: WordPressDataRenderedProtected;
176
+ excerpt?: WordPressDataRenderedProtected;
177
+ author?: number;
178
+ featured_media?: number;
179
+ parent?: number;
180
+ menu_order?: number;
181
+ comment_status?: string;
182
+ ping_status?: string;
183
+ sticky?: boolean;
184
+ template?: string;
185
+ format?: string;
186
+ meta?: WordPressDataMeta;
187
+ categories?: number[];
188
+ tags?: number[];
189
+ class_list?: string[];
190
+ taxonomy?: string;
191
+ name?: string;
192
+ _links?: WordPressDataLinks;
193
+ _embedded?: WordPressDataEmbedded;
194
+ }
195
+ export interface WordPressDataArgs {
196
+ key: string;
197
+ route: string;
198
+ params?: WordPressDataParams;
199
+ meta?: RenderDataMeta;
200
+ fetcher?: typeof fetch;
201
+ options?: RequestInit;
202
+ }
203
+ export interface AllWordPressDataArgs {
204
+ serverlessData?: RenderServerlessData;
205
+ previewData?: RenderPreviewData;
206
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -0,0 +1,16 @@
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
+ currentLink: string;
7
+ currentType: string[];
8
+ init: boolean;
9
+ constructor(props: NavigationProps);
10
+ getOutput(location: L, args?: NavigationOutputArgs, maxDepth?: number): string;
11
+ getBreadcrumbs(items: NavigationBreadcrumbItem[], current?: string, args?: NavigationBreadcrumbOutputArgs): string;
12
+ getItemsById(): NavigationItemsById;
13
+ getNavigationsByLocation(): NavigationByLocation<L>;
14
+ getNavigationByLocation(location: L): NavigationByLocationItem | undefined;
15
+ }
16
+ export { Navigation };
@@ -0,0 +1 @@
1
+ import{getSlug,getPermalink,getLink}from"../../utils/link/link.js";import{isArrayStrict}from"../../utils/array/array.js";import{isObjectStrict}from"../../utils/object/object.js";import{isStringStrict,isString}from"../../utils/string/string.js";import{isFunction}from"../../utils/function/function.js";import{isNumber}from"../../utils/number/number.js";import{normalizeContentType}from"../../utils/contentType/contentType.js";import{getStoreItem}from"../../store/store.js";class Navigation{navigations=[];items=[];currentLink="";currentType=[];init=!1;#itemsById=new Map;#navigationsByLocation=new Map;constructor(props){this.init=this.#initialize(props)}#initialize(props){if(!isObjectStrict(props))return!1;const{navigations:navigations,items:items,currentLink:currentLink,currentType:currentType}=props;if(!isArrayStrict(navigations)||!isArrayStrict(items))return!1;this.navigations=navigations,this.items=items,this.currentLink=isStringStrict(currentLink)?currentLink:"";const typesArr=isArrayStrict(currentType)?currentType:[currentType];return this.currentType=typesArr.map((type=>normalizeContentType(type))),this.items.forEach((item=>{item&&this.#itemsById.set(item.id,item)})),this.items.forEach((item=>{const info=this.#getItemInfo(item);info&&this.#itemsById.set(info.id,info)})),this.navigations.forEach((nav=>{if(!isObjectStrict(nav))return;const{title:title,location:location,items:items=[]}=nav,locations=isArrayStrict(location)?location:[location];isStringStrict(title)&&isArrayStrict(items)&&locations.forEach((loc=>{this.#navigationsByLocation.set(loc,{title:title,items:items})}))})),!0}#getItemInfo(item){if(!isObjectStrict(item))return;const{id:id,title:title,link:link,internalLink:internalLink,externalLink:externalLink,children:children}=item;let external=!1;isStringStrict(externalLink)&&(external=!0);const props={id:id,title:title,link:isStringStrict(link)?link:getLink(internalLink,externalLink),external:external};isStringStrict(props.link)&&!external&&(props.current=props.link===this.currentLink);const internalId=internalLink?.id;if(isStringStrict(internalId)){let isArchiveCurrent=!1;for(const type of this.currentType){if(internalId===getStoreItem("archiveMeta")[type]?.id){isArchiveCurrent=!0;break}}props.archiveCurrent=isArchiveCurrent}let descendentCurrent=!1;if(isArrayStrict(children)){const storeChildren=[];descendentCurrent=this.#recurseItemChildren(children,storeChildren),props.children=storeChildren}return descendentCurrent&&(props.descendentCurrent=descendentCurrent),{...item,...props}}#recurseItemChildren(children,output){let childCurrent=!1;return children.forEach((child=>{const info=this.#getItemInfo(this.#itemsById.get(child?.id));if(!info)return;const{current:current=!1,archiveCurrent:archiveCurrent=!1}=info;(current||archiveCurrent)&&(childCurrent=!0),output.push(info)})),childCurrent}#getItems(items=[]){const resItems=[];return items.forEach((item=>{if(!isObjectStrict(item))return;const{id:id}=item,storedItem=this.#itemsById.get(id);storedItem&&resItems.push(storedItem)})),resItems}#recurseOutput=(items,output,args,depth=0,maxDepth)=>{if(isNumber(maxDepth)&&depth>maxDepth)return;const dataAttr=isStringStrict(args.dataAttr)?args.dataAttr:"data-nav",depthAttr=args.depthAttr?` ${dataAttr}-depth="${depth}"`:"",listFilterArgs={args:args,output:output,items:items,depth:depth};isFunction(args.filterBeforeList)&&args.filterBeforeList(listFilterArgs);const listClasses=isStringStrict(args.listClass)?` class="${args.listClass}"`:"",listAttrs=isStringStrict(args.listAttr)?` ${args.listAttr}`:"",listTag=isStringStrict(args.listTag)?args.listTag:"ul";output.html+=`<${listTag}${depthAttr}${listClasses}${listAttrs}>`,items.forEach(((item,index)=>{const{title:title,link:link,external:external=!1,children:children,current:current=!1,descendentCurrent:descendentCurrent=!1,archiveCurrent:archiveCurrent=!1}=item,filterArgs={args:args,item:item,output:output,index:index,items:items,depth:depth};isFunction(args.filterBeforeItem)&&args.filterBeforeItem(filterArgs);const itemClasses=isStringStrict(args.itemClass)?` class="${args.itemClass}"`:"",itemTag=isStringStrict(args.itemTag)?args.itemTag:"li";let itemAttrs=isStringStrict(args.itemAttr)?` ${args.itemAttr}`:"";current&&(itemAttrs+=` ${dataAttr}-current`),descendentCurrent&&(itemAttrs+=` ${dataAttr}-descendent-current`),archiveCurrent&&(itemAttrs+=` ${dataAttr}-archive-current`),output.html+=`<${itemTag}${depthAttr}${itemClasses}${itemAttrs}>`,isFunction(args.filterBeforeLink)&&args.filterBeforeLink(filterArgs);const linkClassesArr=[];isStringStrict(args.linkClass)&&linkClassesArr.push(args.linkClass),!external&&isStringStrict(args.internalLinkClass)&&linkClassesArr.push(args.internalLinkClass);const hasLink=isStringStrict(link),linkClasses=linkClassesArr.length>0?` class="${linkClassesArr.join(" ")}"`:"",linkAttrsArr=[hasLink?`href="${link}"`:'type="button"'];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.html+=`<${linkTag}${depthAttr}${linkClasses}${linkAttrs}>`,isFunction(args.filterBeforeLinkText)&&args.filterBeforeLinkText(filterArgs),output.html+=title,isFunction(args.filterAfterLinkText)&&args.filterAfterLinkText(filterArgs),output.html+=`</${linkTag}>`,isFunction(args.filterAfterLink)&&args.filterAfterLink(filterArgs),isArrayStrict(children)&&this.#recurseOutput(children,output,args,depth+1,maxDepth),output.html+=`</${itemTag}>`,isFunction(args.filterAfterItem)&&args.filterAfterItem(filterArgs)})),output.html+=`</${listTag}>`,isFunction(args.filterAfterList)&&args.filterAfterList(listFilterArgs)};getOutput(location,args,maxDepth){const nav=this.#navigationsByLocation.get(location);if(!nav)return"";const items=nav.items,normalizedItems=this.#getItems(items);if(!normalizedItems.length)return"";args=Object.assign({listTag:"",listClass:"",listAttr:"",itemTag:"",itemClass:"",itemAttr:"",linkClass:"",internalLinkClass:"",linkAttr:"",dataAttr:"",depthAttr:!1,filterBeforeList:()=>{},filterAfterList:()=>{},filterBeforeItem:()=>{},filterAfterItem:()=>{},filterBeforeLink:()=>{},filterAfterLink:()=>{},filterBeforeLinkText:()=>{},filterAfterLinkText:()=>{}},isObjectStrict(args)?args:{});const output={html:""};return this.#recurseOutput(normalizedItems,output,args,0,maxDepth),output.html}getBreadcrumbs(items,current,args){if(!isArrayStrict(items))return"";args=Object.assign({listClass:"",listAttr:"",itemClass:"",itemAttr:"",linkClass:"",internalLinkClass:"",linkAttr:"",currentClass:"",currentLabel:"",a11yClass:"a-hide-vis",dataAttr:"",filterBeforeLink:()=>{},filterAfterLink:()=>{}},isObjectStrict(args)?args:{});const dataAttr=isStringStrict(args.dataAttr)?args.dataAttr:"data-nav",listClasses=isStringStrict(args.listClass)?` class="${args.listClass}"`:"",listAttrs=isStringStrict(args.listAttr)?` ${args.listAttr}`:"",filteredItems=items.filter((item=>!!isStringStrict(item.title)&&(!!isString(item.slug)&&(item.slug=getSlug({id:item.id,slug:item.slug,contentType:item.contentType,pageData:item.internalLink}),!0)))),itemClasses=isStringStrict(args.itemClass)?` class="${args.itemClass}"`:"",itemAttrs=isStringStrict(args.itemAttr)?` ${args.itemAttr}`:"",lastItemIndex=filteredItems.length-1,itemsArr=filteredItems.map(((item,index)=>{const{title:title,slug:slug}=item,link=getPermalink(slug),output={html:""},lastLevel=lastItemIndex===index,filterArgs={output:output,lastLevel:lastLevel};output.html+=`<li${itemClasses}${itemAttrs}${lastLevel?` ${dataAttr}-last`:""}>`,isFunction(args.filterBeforeLink)&&args.filterBeforeLink(filterArgs);const linkClassesArr=[];isStringStrict(args.linkClass)&&linkClassesArr.push(args.linkClass),isStringStrict(args.internalLinkClass)&&linkClassesArr.push(args.internalLinkClass);const linkClasses=linkClassesArr.length>0?` class="${linkClassesArr.join(" ")}"`:"",linkAttrs=isStringStrict(args.linkAttr)?` ${args.linkAttr}`:"";return output.html+=`<a${linkClasses} href="${link}"${linkAttrs}>${title}</a>`,isFunction(args.filterAfterLink)&&args.filterAfterLink(filterArgs),output.html+="</li>",output.html})),currentLabel=isStringStrict(args.currentLabel)?args.currentLabel:"(current page)",currentClasses=isStringStrict(args.currentClass)?` class="${args.currentClass}"`:"",a11yClasses=isStringStrict(args.a11yClass)?` class="${args.a11yClass}"`:"",currentItem=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)}}export{Navigation};
@@ -0,0 +1,85 @@
1
+ import type { InternalLink, Generic, HtmlString } 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: HtmlString;
49
+ items: NavigationItem[];
50
+ depth: number;
51
+ }
52
+ export interface NavigationOutputFilterArgs {
53
+ args: NavigationOutputArgs;
54
+ item: NavigationItem;
55
+ output: HtmlString;
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
+ listTag?: string;
64
+ itemTag?: string;
65
+ filterBeforeList?: NavigationOutputListFilter;
66
+ filterAfterList?: NavigationOutputListFilter;
67
+ filterBeforeItem?: NavigationFilter;
68
+ filterAfterItem?: NavigationFilter;
69
+ filterBeforeLink?: NavigationFilter;
70
+ filterAfterLink?: NavigationFilter;
71
+ filterBeforeLinkText?: NavigationFilter;
72
+ filterAfterLinkText?: NavigationFilter;
73
+ }
74
+ export interface NavigationBreadcrumbOutputFilterArgs {
75
+ output: HtmlString;
76
+ lastLevel: boolean;
77
+ }
78
+ export type NavigationBreadcrumbOutputFilter = (args: NavigationBreadcrumbOutputFilterArgs) => void;
79
+ export interface NavigationBreadcrumbOutputArgs extends NavigationOutputBaseArgs {
80
+ currentClass?: string;
81
+ currentLabel?: string;
82
+ a11yClass?: string;
83
+ filterBeforeLink?: NavigationBreadcrumbOutputFilter;
84
+ filterAfterLink?: NavigationBreadcrumbOutputFilter;
85
+ }
@@ -0,0 +1 @@
1
+ export{};
@@ -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
+ import{isObjectStrict}from"../../utils/object/object.js";import{isStringStrict}from"../../utils/string/string.js";const Pagination=props=>{const fallback={output:"",data:{}};if(!isObjectStrict(props))return fallback;const{total:total=1,display:display=5,current:current=1,filters:filters,url:url,ellipsis:ellipsis,prev:prev="",next:next="",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",prevSpanClass:prevSpanClass,prevLinkClass:prevLinkClass,nextSpanClass:nextSpanClass,nextLinkClass:nextLinkClass}=isObjectStrict(args)?args:{};if(total<=1||!isStringStrict(url))return fallback;let output="";const hasFilters=isStringStrict(filters);let prevFilters="",nextFilters="",currentFilters="";hasFilters&&(prevFilters=current>2?`&${filters}`:`?${filters}`,currentFilters=1===current?`?${filters}`:`&${filters}`,current<total&&(nextFilters=`&${filters}`));const data={current:current,total:total,nextFilters:nextFilters,currentFilters:currentFilters};1===current?data.next=current+1:(data.title=titleTemplate.replace("%current",current.toString()).replace("%total",total.toString()),data.next=current+1<=total?current+1:0,data.prev=current-1,data.prevFilters=prevFilters);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=[];isStringStrict(listClass)&&listAttrs.push(`class="${listClass}"`),isStringStrict(listAttr)&&listAttrs.push(listAttr);const hasEllipsis=isStringStrict(ellipsis),itemAttrs=`${isStringStrict(itemClass)?` class="${itemClass}"`:""}${isStringStrict(itemAttr)?` ${itemAttr}`:""}`;let prevItem=`<span${isStringStrict(prevSpanClass)?` class="${prevSpanClass}"`:""}>${prev}</span>`,isPrevLink=!1;current>1&&(isPrevLink=!0,prevItem=`\n <a\n href="${url}${current>2?"?page="+(current-1):""}${prevFilters}"\n aria-label="${prevLabel}"${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${isStringStrict(currentClass)?` class="${currentClass}"`:""}>\n <span class="${a11yClass}">${currentLabel} </span>\n ${i}\n </span>\n `;else{content=`\n <a href="${1===i?url:`${url}?page=${i}`}${hasFilters?1===i?`?${filters}`:`&${filters}`:""}"${isStringStrict(linkClass)?` class="${linkClass}"`:""}${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${isStringStrict(nextSpanClass)?` class="${nextSpanClass}"`:""}>${next}</span>`,nextLink=!1;return current<total&&(nextLink=!0,nextItem=`\n <a\n href="${url}?page=${current+1}${nextFilters}"\n aria-label="${nextLabel}"${isStringStrict(nextLinkClass)?` class="${nextLinkClass}"`:""}\n >\n ${next}\n </a>\n `),output+=`<li${itemAttrs} data-pag-next="${nextLink?"link":"text"}">${nextItem}</li>`,{output:`\n <ol${listAttrs.length>0?` ${listAttrs.join(" ")}`:""}>\n ${output}\n </ol>\n `,data:data}};export{Pagination};
@@ -0,0 +1,44 @@
1
+ export interface PaginationProps {
2
+ total?: number;
3
+ display?: number;
4
+ current?: number;
5
+ filters?: string;
6
+ url?: string;
7
+ ellipsis?: string;
8
+ prev?: string;
9
+ next?: string;
10
+ prevLabel?: string;
11
+ nextLabel?: string;
12
+ currentLabel?: string;
13
+ pageLabel?: string;
14
+ titleTemplate?: string;
15
+ args?: PaginationArgs;
16
+ }
17
+ export interface PaginationArgs {
18
+ listClass?: string;
19
+ listAttr?: string;
20
+ itemClass?: string;
21
+ itemAttr?: string;
22
+ linkClass?: string;
23
+ linkAttr?: string;
24
+ currentClass?: string;
25
+ a11yClass?: string;
26
+ prevSpanClass?: string;
27
+ prevLinkClass?: string;
28
+ nextSpanClass?: string;
29
+ nextLinkClass?: string;
30
+ }
31
+ export interface PaginationData {
32
+ current?: number;
33
+ total?: number;
34
+ title?: string;
35
+ next?: number;
36
+ prev?: number;
37
+ nextFilters?: string;
38
+ prevFilters?: string;
39
+ currentFilters?: string;
40
+ }
41
+ export interface PaginationReturn {
42
+ output: string;
43
+ data: PaginationData;
44
+ }
@@ -0,0 +1 @@
1
+ export{};
@@ -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
+ 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};const setConfig=args=>(config={...config,...args},config),setConfigFilter=env=>(config=config.filter(config,env),config);export{config,setConfig,setConfigFilter};