@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
+ import{parse}from"@wordpress/block-serialization-spec-parser";import{normalizeContentType}from"../utils/contentType/contentType.js";import{getObjectKeys}from"../utils/object/objectUtils.js";import{getStoreItem,setStoreItem}from"../store/store.js";import{isString,isStringStrict}from"../utils/string/string.js";import{isArrayStrict}from"../utils/array/array.js";import{isObjectStrict}from"../utils/object/object.js";import{isNumber}from"../utils/number/number.js";import{config}from"../config/config.js";const normalRoutes=new Map([["page","pages"],["post","posts"],["taxonomy","taxonomies"],["category","categories"],["tag","tags"],["attachment","media"],["nav_menu","menus"],["nav_menu_item","menu-items"]]),normalMetaKeys=new Map,menusById=new Map,excludeProps=["_links","auto_add"],getTaxonomy=id=>{const taxonomy=getStoreItem("taxonomies")[id],{title:title="",slug:slug="",contentTypes:contentTypes=[]}=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(isObjectStrict(sizes)){s={};for(const[,value]of Object.entries(sizes)){const{width:width,source_url:src}=value;let{url:url}=value;isStringStrict(src)&&(url=src),isNumber(width)&&isStringStrict(url)&&(s[width]=url)}}return{url:isString(url)?url:"",name:isString(filename)?filename:"",alt:isString(alt)?alt:"",width:isNumber(width)?width:0,height:isNumber(height)?height:0,size:isNumber(filesizeInBytes)?filesizeInBytes:0,format:"jpeg"===subtype?"jpg":subtype,type:mime,sizes:s}},normalizeEmbedded=(value,item,newItem)=>{getObjectKeys(value).forEach((k=>{const embeds=value[k];isArrayStrict(embeds)&&("author"===k&&embeds.forEach((embed=>{if(!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(!isObjectStrict(embed))return;const{id:id,title:parentTitle,name:name,type:type,taxonomy:taxonomy,slug:slug}=embed;if(item.parent!==id)return;let title="";isString(parentTitle?.rendered)&&(title=parentTitle.rendered),isString(name)&&(title=name),newItem.parent={id:id.toString(),contentType:isString(taxonomy)?"term":type,title:title,slug:slug}})),"wp:featuredmedia"===k&&embeds.forEach((embed=>{if(!isObjectStrict(embed))return;const{id:id,source_url:url,media_details:details,mime_type:mimeType,alt_text:alt}=embed;if(!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=>{isArrayStrict(embed)&&embed.forEach((e=>{if(!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];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(!isStringStrict(contentType))return;const{attributeIsItem:attributeIsItem}=attrs,attrItemArr=(isStringStrict(attributeIsItem)?attributeIsItem:"").split(","),attrItemExists=attrItemArr.length>0;for(const[key,value]of Object.entries(attrs))if(isObjectStrict(value)){if(attrItemExists&&attrItemArr.includes(key)){const itemValue=normalizeItem(value);itemValue.content=void 0,attrs[key]=itemValue}isStringStrict(value.mime)&&(attrs[key]=normalizeFile(value))}const newItem={contentType:contentType,...attrs},renderType=config.renderTypes[contentType];return isString(renderType)&&(newItem.renderType=renderType),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=isObjectStrict(value),isStr=isStringStrict(value);if("id"!==key&&"object_id"!==k||(val=value?.toString()),"type"===key&&isStr)newItem.contentType=normalizeContentType(value),isString(config.renderTypes[value])&&(newItem.renderType=config.renderTypes[value]);else{if("types"===key&&(k="contentTypes"),isObj){const{rendered:rendered}=value;isString(rendered)&&(val=rendered)}if("name"===key&&(k="title"),"_embedded"===key&&isObj)normalizeEmbedded(value,item,newItem);else{if(isStringStrict(val)){if("excerpt"===key&&(val=val.replace(/<[^>]*>|\[.*?\]/g,"").trim()),"content"===key){const normalVal=normalizeBlocks(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=isNumber(menu_order);if(hasMenuOrder&&isObjectStrict(itemsObj[parent])&&(null==itemsObj[parent].children&&(itemsObj[parent].children=[]),itemsObj[parent].children.push({id:id,menu_order:menu_order,title:title})),hasMenuOrder&&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(!isString(url)||!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&&isStringStrict(object)&&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.env.prodUrl)?newItem.externalLink=url:newItem.link=url}isArrayStrict(children)&&(newItem.children=children.sort(((a,b)=>a.menu_order-b.menu_order))),newItems.push(newItem)}return newItems},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},normalizeWordPressData=(data,route,_newData=[])=>isArrayStrict(data)?("taxonomies"===route&&(data=Object.entries(data[0]).map((([key,value])=>({id:key,type:"taxonomy",...value})))),data.forEach((item=>{isObjectStrict(item)&&_newData.push(normalizeItem(item))})),"taxonomies"===route&&_newData.forEach((item=>{setStoreItem("taxonomies",item,item.id)})),_newData):[];export{normalizeWordPressData,normalizeWordPressMenuItems,normalizeWordPressMenus,normalRoutes,normalMetaKeys};
@@ -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
+ export{};
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@alanizcreative/formation-static",
3
+ "version": "1.3.0-beta.29",
4
+ "description": "Foundation and utilities to build static sites using local JSON files, Contentful, or WordPress",
5
+ "main": "./lib/config/config.js",
6
+ "packageManager": "pnpm@10.6.2",
7
+ "type": "module",
8
+ "files": [
9
+ "./lib",
10
+ "./cjs"
11
+ ],
12
+ "exports": {
13
+ "./*": {
14
+ "import": "./lib/*",
15
+ "require": "./cjs/*"
16
+ }
17
+ },
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "scripts": {
22
+ "build:lib": "npx tsc --project tsconfig.build.json",
23
+ "build:cjs": "npx tsc --project tsconfig.build.json --moduleResolution node --module commonjs --esModuleInterop --outDir cjs/",
24
+ "build": "pnpm build:lib && pnpm build:cjs && node scripts/packageFile.js && pnpm minify",
25
+ "minify": "find lib cjs -name \"*.js\" -exec terser {} -o {} --compress \\;",
26
+ "test": "vitest --run --reporter verbose --coverage",
27
+ "lint": "npx eslint .",
28
+ "release": "release-it",
29
+ "release:beta": "release-it --preRelease=beta"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/galaniz/formation-static.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/galaniz/formation-static/issues"
37
+ },
38
+ "homepage": "https://github.com/galaniz/formation-static#readme",
39
+ "author": "Graciela Alaniz (https://alanizcreative.com/)",
40
+ "license": "MIT",
41
+ "devDependencies": {
42
+ "@cloudflare/workers-types": "4.20250310.0",
43
+ "@types/contentful-resolve-response": "^0.1.33",
44
+ "@types/node": "^22.13.10",
45
+ "@types/uuid": "^10.0.0",
46
+ "@types/wordpress__block-serialization-spec-parser": "^3.1.3",
47
+ "@vitest/coverage-v8": "^3.0.8",
48
+ "eslint": "9.22.0",
49
+ "memfs": "4.17.0",
50
+ "release-it": "^18.1.2",
51
+ "terser": "5.37.0",
52
+ "typescript": "^5.8.2",
53
+ "typescript-eslint": "8.26.1",
54
+ "vitest": "^3.0.8"
55
+ },
56
+ "dependencies": {
57
+ "uuid": "^11.1.0"
58
+ },
59
+ "peerDependencies": {
60
+ "@wordpress/block-serialization-spec-parser": "^5.11.0",
61
+ "contentful-resolve-response": "^1.9.0",
62
+ "sharp": "0.33.5"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "@wordpress/block-serialization-spec-parser": {
66
+ "optional": true
67
+ },
68
+ "contentful-resolve-response": {
69
+ "optional": true
70
+ },
71
+ "sharp": {
72
+ "optional": true
73
+ }
74
+ },
75
+ "release-it": {
76
+ "git": {
77
+ "requireCommits": true,
78
+ "commitMessage": "chore: release ${version} [ci skip]"
79
+ },
80
+ "github": {
81
+ "release": true
82
+ }
83
+ },
84
+ "publishConfig": {
85
+ "access": "public"
86
+ }
87
+ }