@aglyn/shared-ui-jsx 1.0.0-beta.143

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 (261) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +63 -0
  4. package/src/index.d.ts +48 -0
  5. package/src/index.js +179 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/components/aglyn-text.d.ts +86 -0
  8. package/src/lib/components/aglyn-text.js +44 -0
  9. package/src/lib/components/aglyn-text.js.map +1 -0
  10. package/src/lib/components/app-link.d.ts +74 -0
  11. package/src/lib/components/app-link.js +139 -0
  12. package/src/lib/components/app-link.js.map +1 -0
  13. package/src/lib/components/aspect-ratio.d.ts +59 -0
  14. package/src/lib/components/aspect-ratio.js +153 -0
  15. package/src/lib/components/aspect-ratio.js.map +1 -0
  16. package/src/lib/components/background-image.component.d.ts +30 -0
  17. package/src/lib/components/background-image.component.js +42 -0
  18. package/src/lib/components/background-image.component.js.map +1 -0
  19. package/src/lib/components/card-columns.d.ts +86 -0
  20. package/src/lib/components/card-columns.js +148 -0
  21. package/src/lib/components/card-columns.js.map +1 -0
  22. package/src/lib/components/card-display.d.ts +36 -0
  23. package/src/lib/components/card-display.js +158 -0
  24. package/src/lib/components/card-display.js.map +1 -0
  25. package/src/lib/components/card-list-item.d.ts +35 -0
  26. package/src/lib/components/card-list-item.js +137 -0
  27. package/src/lib/components/card-list-item.js.map +1 -0
  28. package/src/lib/components/children-function-prop.d.ts +25 -0
  29. package/src/lib/components/children-function-prop.js +29 -0
  30. package/src/lib/components/children-function-prop.js.map +1 -0
  31. package/src/lib/components/confirmation-provider.component.d.ts +19 -0
  32. package/src/lib/components/confirmation-provider.component.js +83 -0
  33. package/src/lib/components/confirmation-provider.component.js.map +1 -0
  34. package/src/lib/components/container.d.ts +25 -0
  35. package/src/lib/components/container.js +62 -0
  36. package/src/lib/components/container.js.map +1 -0
  37. package/src/lib/components/data-table.component.d.ts +54 -0
  38. package/src/lib/components/data-table.component.js +211 -0
  39. package/src/lib/components/data-table.component.js.map +1 -0
  40. package/src/lib/components/dialog-confirm.d.ts +36 -0
  41. package/src/lib/components/dialog-confirm.js +74 -0
  42. package/src/lib/components/dialog-confirm.js.map +1 -0
  43. package/src/lib/components/ellipsis-pulse.component.d.ts +22 -0
  44. package/src/lib/components/ellipsis-pulse.component.js +51 -0
  45. package/src/lib/components/ellipsis-pulse.component.js.map +1 -0
  46. package/src/lib/components/emotion-cache-provider.d.ts +31 -0
  47. package/src/lib/components/emotion-cache-provider.js +40 -0
  48. package/src/lib/components/emotion-cache-provider.js.map +1 -0
  49. package/src/lib/components/empty-state.component.d.ts +63 -0
  50. package/src/lib/components/empty-state.component.js +214 -0
  51. package/src/lib/components/empty-state.component.js.map +1 -0
  52. package/src/lib/components/error-boundary.component.d.ts +28 -0
  53. package/src/lib/components/error-boundary.component.js +86 -0
  54. package/src/lib/components/error-boundary.component.js.map +1 -0
  55. package/src/lib/components/grid-buttons.d.ts +26 -0
  56. package/src/lib/components/grid-buttons.js +45 -0
  57. package/src/lib/components/grid-buttons.js.map +1 -0
  58. package/src/lib/components/grid-items.d.ts +103 -0
  59. package/src/lib/components/grid-items.js +336 -0
  60. package/src/lib/components/grid-items.js.map +1 -0
  61. package/src/lib/components/grid-list.d.ts +37 -0
  62. package/src/lib/components/grid-list.js +156 -0
  63. package/src/lib/components/grid-list.js.map +1 -0
  64. package/src/lib/components/help-tip.component.d.ts +30 -0
  65. package/src/lib/components/help-tip.component.js +139 -0
  66. package/src/lib/components/help-tip.component.js.map +1 -0
  67. package/src/lib/components/link-navigation-reporter.d.ts +24 -0
  68. package/src/lib/components/link-navigation-reporter.js +64 -0
  69. package/src/lib/components/link-navigation-reporter.js.map +1 -0
  70. package/src/lib/components/list-pagination.component.d.ts +57 -0
  71. package/src/lib/components/list-pagination.component.js +90 -0
  72. package/src/lib/components/list-pagination.component.js.map +1 -0
  73. package/src/lib/components/list-table.component.d.ts +155 -0
  74. package/src/lib/components/list-table.component.js +369 -0
  75. package/src/lib/components/list-table.component.js.map +1 -0
  76. package/src/lib/components/loading-layout-app.component.d.ts +35 -0
  77. package/src/lib/components/loading-layout-app.component.js +42 -0
  78. package/src/lib/components/loading-layout-app.component.js.map +1 -0
  79. package/src/lib/components/loading-modal-overlay.d.ts +30 -0
  80. package/src/lib/components/loading-modal-overlay.js +156 -0
  81. package/src/lib/components/loading-modal-overlay.js.map +1 -0
  82. package/src/lib/components/loading-modal.d.ts +19 -0
  83. package/src/lib/components/loading-modal.js +113 -0
  84. package/src/lib/components/loading-modal.js.map +1 -0
  85. package/src/lib/components/loading-text.component.d.ts +21 -0
  86. package/src/lib/components/loading-text.component.js +40 -0
  87. package/src/lib/components/loading-text.component.js.map +1 -0
  88. package/src/lib/components/mdi-icon/index.d.ts +2 -0
  89. package/src/lib/components/mdi-icon/index.js +4 -0
  90. package/src/lib/components/mdi-icon/index.js.map +1 -0
  91. package/src/lib/components/mdi-icon/md-icon-stack.d.ts +31 -0
  92. package/src/lib/components/mdi-icon/md-icon-stack.js +101 -0
  93. package/src/lib/components/mdi-icon/md-icon-stack.js.map +1 -0
  94. package/src/lib/components/mdi-icon/md-icon.d.ts +32 -0
  95. package/src/lib/components/mdi-icon/md-icon.js +147 -0
  96. package/src/lib/components/mdi-icon/md-icon.js.map +1 -0
  97. package/src/lib/components/mdi-icon/mdi-icon-from-id.d.ts +23 -0
  98. package/src/lib/components/mdi-icon/mdi-icon-from-id.js +35 -0
  99. package/src/lib/components/mdi-icon/mdi-icon-from-id.js.map +1 -0
  100. package/src/lib/components/mdi-icon/mdi-icon.d.ts +24 -0
  101. package/src/lib/components/mdi-icon/mdi-icon.js +46 -0
  102. package/src/lib/components/mdi-icon/mdi-icon.js.map +1 -0
  103. package/src/lib/components/measured-figures.component.d.ts +64 -0
  104. package/src/lib/components/measured-figures.component.js +161 -0
  105. package/src/lib/components/measured-figures.component.js.map +1 -0
  106. package/src/lib/components/menu.d.ts +45 -0
  107. package/src/lib/components/menu.js +229 -0
  108. package/src/lib/components/menu.js.map +1 -0
  109. package/src/lib/components/mui-shadow-dom.d.ts +38 -0
  110. package/src/lib/components/mui-shadow-dom.js +161 -0
  111. package/src/lib/components/mui-shadow-dom.js.map +1 -0
  112. package/src/lib/components/navigation-drawer.component.d.ts +31 -0
  113. package/src/lib/components/navigation-drawer.component.js +76 -0
  114. package/src/lib/components/navigation-drawer.component.js.map +1 -0
  115. package/src/lib/components/navigation-intent.d.ts +18 -0
  116. package/src/lib/components/navigation-intent.js +56 -0
  117. package/src/lib/components/navigation-intent.js.map +1 -0
  118. package/src/lib/components/navigation-view/index.d.ts +18 -0
  119. package/src/lib/components/navigation-view/index.js +19 -0
  120. package/src/lib/components/navigation-view/index.js.map +1 -0
  121. package/src/lib/components/navigation-view/navigation-view.d.ts +35 -0
  122. package/src/lib/components/navigation-view/navigation-view.js +175 -0
  123. package/src/lib/components/navigation-view/navigation-view.js.map +1 -0
  124. package/src/lib/components/next-link.d.ts +27 -0
  125. package/src/lib/components/next-link.js +88 -0
  126. package/src/lib/components/next-link.js.map +1 -0
  127. package/src/lib/components/popper-styled.component.d.ts +25 -0
  128. package/src/lib/components/popper-styled.component.js +129 -0
  129. package/src/lib/components/popper-styled.component.js.map +1 -0
  130. package/src/lib/components/quota-readout.component.d.ts +69 -0
  131. package/src/lib/components/quota-readout.component.js +52 -0
  132. package/src/lib/components/quota-readout.component.js.map +1 -0
  133. package/src/lib/components/resizeable-stack.d.ts +4 -0
  134. package/src/lib/components/resizeable-stack.js +23 -0
  135. package/src/lib/components/resizeable-stack.js.map +1 -0
  136. package/src/lib/components/row-actions-menu.component.d.ts +53 -0
  137. package/src/lib/components/row-actions-menu.component.js +132 -0
  138. package/src/lib/components/row-actions-menu.component.js.map +1 -0
  139. package/src/lib/components/ruler-guides.component.d.ts +35 -0
  140. package/src/lib/components/ruler-guides.component.js +166 -0
  141. package/src/lib/components/ruler-guides.component.js.map +1 -0
  142. package/src/lib/components/sandbox-frame.d.ts +42 -0
  143. package/src/lib/components/sandbox-frame.js +122 -0
  144. package/src/lib/components/sandbox-frame.js.map +1 -0
  145. package/src/lib/components/scroll-reaction.d.ts +59 -0
  146. package/src/lib/components/scroll-reaction.js +43 -0
  147. package/src/lib/components/scroll-reaction.js.map +1 -0
  148. package/src/lib/components/scroll-table.component.d.ts +124 -0
  149. package/src/lib/components/scroll-table.component.js +103 -0
  150. package/src/lib/components/scroll-table.component.js.map +1 -0
  151. package/src/lib/components/shadow-dom/index.d.ts +18 -0
  152. package/src/lib/components/shadow-dom/index.js +19 -0
  153. package/src/lib/components/shadow-dom/index.js.map +1 -0
  154. package/src/lib/components/shadow-dom/shadow-dom.d.ts +42 -0
  155. package/src/lib/components/shadow-dom/shadow-dom.js +123 -0
  156. package/src/lib/components/shadow-dom/shadow-dom.js.map +1 -0
  157. package/src/lib/components/splash-screen.d.ts +33 -0
  158. package/src/lib/components/splash-screen.js +105 -0
  159. package/src/lib/components/splash-screen.js.map +1 -0
  160. package/src/lib/components/sr-only.d.ts +20 -0
  161. package/src/lib/components/sr-only.js +25 -0
  162. package/src/lib/components/sr-only.js.map +1 -0
  163. package/src/lib/components/status-screen-plain.component.d.ts +27 -0
  164. package/src/lib/components/status-screen-plain.component.js +178 -0
  165. package/src/lib/components/status-screen-plain.component.js.map +1 -0
  166. package/src/lib/components/usage-meter.component.d.ts +30 -0
  167. package/src/lib/components/usage-meter.component.js +92 -0
  168. package/src/lib/components/usage-meter.component.js.map +1 -0
  169. package/src/lib/components/variable-text-field.component.d.ts +50 -0
  170. package/src/lib/components/variable-text-field.component.js +188 -0
  171. package/src/lib/components/variable-text-field.component.js.map +1 -0
  172. package/src/lib/components/zoomable-panning-component/index.d.ts +1 -0
  173. package/src/lib/components/zoomable-panning-component/index.js +3 -0
  174. package/src/lib/components/zoomable-panning-component/index.js.map +1 -0
  175. package/src/lib/components/zoomable-panning-component/util.d.ts +58 -0
  176. package/src/lib/components/zoomable-panning-component/util.js +114 -0
  177. package/src/lib/components/zoomable-panning-component/util.js.map +1 -0
  178. package/src/lib/components/zoomable-panning-component/zoomable-panning-component.d.ts +132 -0
  179. package/src/lib/components/zoomable-panning-component/zoomable-panning-component.js +728 -0
  180. package/src/lib/components/zoomable-panning-component/zoomable-panning-component.js.map +1 -0
  181. package/src/lib/const/aglyn-besigner-logo-full.d.ts +39 -0
  182. package/src/lib/const/aglyn-besigner-logo-full.js +146 -0
  183. package/src/lib/const/aglyn-besigner-logo-full.js.map +1 -0
  184. package/src/lib/const/aglyn-console-logo-full.d.ts +34 -0
  185. package/src/lib/const/aglyn-console-logo-full.js +142 -0
  186. package/src/lib/const/aglyn-console-logo-full.js.map +1 -0
  187. package/src/lib/const/aglyn-logo-class-keys.d.ts +30 -0
  188. package/src/lib/const/aglyn-logo-class-keys.js +32 -0
  189. package/src/lib/const/aglyn-logo-class-keys.js.map +1 -0
  190. package/src/lib/const/aglyn-logo-full.d.ts +29 -0
  191. package/src/lib/const/aglyn-logo-full.js +111 -0
  192. package/src/lib/const/aglyn-logo-full.js.map +1 -0
  193. package/src/lib/const/list-filter.d.ts +260 -0
  194. package/src/lib/const/list-filter.js +409 -0
  195. package/src/lib/const/list-filter.js.map +1 -0
  196. package/src/lib/const/prebuilt-components.d.ts +17 -0
  197. package/src/lib/const/prebuilt-components.js +22 -0
  198. package/src/lib/const/prebuilt-components.js.map +1 -0
  199. package/src/lib/const/svg-icons.d.ts +75 -0
  200. package/src/lib/const/svg-icons.js +313 -0
  201. package/src/lib/const/svg-icons.js.map +1 -0
  202. package/src/lib/const/table-pagination.d.ts +106 -0
  203. package/src/lib/const/table-pagination.js +106 -0
  204. package/src/lib/const/table-pagination.js.map +1 -0
  205. package/src/lib/contexts/confirmation.context.d.ts +996 -0
  206. package/src/lib/contexts/confirmation.context.js +49 -0
  207. package/src/lib/contexts/confirmation.context.js.map +1 -0
  208. package/src/lib/contexts/loading.context.d.ts +93 -0
  209. package/src/lib/contexts/loading.context.js +126 -0
  210. package/src/lib/contexts/loading.context.js.map +1 -0
  211. package/src/lib/hocs/create-hoc-with-context-consumer.d.ts +36 -0
  212. package/src/lib/hocs/create-hoc-with-context-consumer.js +44 -0
  213. package/src/lib/hocs/create-hoc-with-context-consumer.js.map +1 -0
  214. package/src/lib/hocs/with-hoc.d.ts +32 -0
  215. package/src/lib/hocs/with-hoc.js +37 -0
  216. package/src/lib/hocs/with-hoc.js.map +1 -0
  217. package/src/lib/hooks/mdi-icon/use-mdi-icon.d.ts +20 -0
  218. package/src/lib/hooks/mdi-icon/use-mdi-icon.js +48 -0
  219. package/src/lib/hooks/mdi-icon/use-mdi-icon.js.map +1 -0
  220. package/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.d.ts +26 -0
  221. package/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.js +73 -0
  222. package/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.js.map +1 -0
  223. package/src/lib/hooks/mdi-icon/use-mdi-icons.d.ts +19 -0
  224. package/src/lib/hooks/mdi-icon/use-mdi-icons.js +49 -0
  225. package/src/lib/hooks/mdi-icon/use-mdi-icons.js.map +1 -0
  226. package/src/lib/hooks/router-events.d.ts +56 -0
  227. package/src/lib/hooks/router-events.js +88 -0
  228. package/src/lib/hooks/router-events.js.map +1 -0
  229. package/src/lib/hooks/use-async-effect.d.ts +24 -0
  230. package/src/lib/hooks/use-async-effect.js +44 -0
  231. package/src/lib/hooks/use-async-effect.js.map +1 -0
  232. package/src/lib/hooks/use-callback-param-ref.d.ts +19 -0
  233. package/src/lib/hooks/use-callback-param-ref.js +29 -0
  234. package/src/lib/hooks/use-callback-param-ref.js.map +1 -0
  235. package/src/lib/hooks/use-id.d.ts +21 -0
  236. package/src/lib/hooks/use-id.js +28 -0
  237. package/src/lib/hooks/use-id.js.map +1 -0
  238. package/src/lib/hooks/use-isomorphic-layout-effect.d.ts +19 -0
  239. package/src/lib/hooks/use-isomorphic-layout-effect.js +20 -0
  240. package/src/lib/hooks/use-isomorphic-layout-effect.js.map +1 -0
  241. package/src/lib/hooks/use-merge-refs.d.ts +38 -0
  242. package/src/lib/hooks/use-merge-refs.js +52 -0
  243. package/src/lib/hooks/use-merge-refs.js.map +1 -0
  244. package/src/lib/hooks/use-subscribable.d.ts +29 -0
  245. package/src/lib/hooks/use-subscribable.js +50 -0
  246. package/src/lib/hooks/use-subscribable.js.map +1 -0
  247. package/src/lib/types.d.ts +18 -0
  248. package/src/lib/types.js +18 -0
  249. package/src/lib/types.js.map +1 -0
  250. package/src/lib/utils/make-link-elements.d.ts +24 -0
  251. package/src/lib/utils/make-link-elements.js +32 -0
  252. package/src/lib/utils/make-link-elements.js.map +1 -0
  253. package/src/lib/utils/make-meta-elements.d.ts +24 -0
  254. package/src/lib/utils/make-meta-elements.js +32 -0
  255. package/src/lib/utils/make-meta-elements.js.map +1 -0
  256. package/src/lib/utils/scroll-overflow.d.ts +120 -0
  257. package/src/lib/utils/scroll-overflow.js +115 -0
  258. package/src/lib/utils/scroll-overflow.js.map +1 -0
  259. package/src/lib/utils/vendor.d.ts +17 -0
  260. package/src/lib/utils/vendor.js +18 -0
  261. package/src/lib/utils/vendor.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Icon, IconId } from '@aglyn/shared-data-mdi'\nimport { Fuse } from '@aglyn/shared-util-vendor/fuse'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport type { ApplyFilterFn, ClearFilterFn } from '../../types'\nimport { useMdiIcons } from './use-mdi-icons'\n\ntype UseMdiIconsReturn = [\n filteredIcons: Icon[],\n allIcons: Icon[],\n applyFilter: ApplyFilterFn,\n clearFilter: ClearFilterFn,\n]\nexport function useMdiIconsFuzzy(iconId?: IconId[]): UseMdiIconsReturn {\n const allIcons = useMdiIcons(iconId)\n const [filteredIcons, setFilteredIcons] = useState(allIcons)\n\n // The catalog arrives async (AGL-189): when the icon set materializes\n // after mount, refresh the unfiltered view or the grid stays empty.\n useEffect(() => {\n setFilteredIcons(allIcons)\n }, [allIcons])\n\n const fuzzy = useMemo(() => {\n return new Fuse(allIcons, {\n keys: [\n { name: 'name', weight: 0.5 },\n { name: 'as', weight: 0.25 },\n { name: 'tags', weight: 0.25 },\n ],\n includeScore: true,\n shouldSort: true,\n // threshold: 0.25,\n // minMatchCharLength: 3\n })\n }, [allIcons])\n\n const clearFilter: ClearFilterFn = useCallback(() => {\n setFilteredIcons(allIcons)\n }, [allIcons, setFilteredIcons])\n\n const applyFilter: ApplyFilterFn = useCallback(\n async (query: string) => {\n const results = fuzzy.search(query)\n setFilteredIcons(results.map((i) => i.item))\n },\n [fuzzy, setFilteredIcons],\n )\n\n return [filteredIcons, allIcons, applyFilter, clearFilter]\n}\nexport default useMdiIconsFuzzy\n"],"names":["Fuse","useCallback","useEffect","useMemo","useState","useMdiIcons","useMdiIconsFuzzy","iconId","allIcons","filteredIcons","setFilteredIcons","fuzzy","keys","name","weight","includeScore","shouldSort","clearFilter","applyFilter","query","results","search","map","i","item"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,IAAI,QAAQ,iCAAgC;AACrD,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAEjE,SAASC,WAAW,QAAQ,qBAAiB;AAQ7C,OAAO,SAASC,iBAAiBC,MAAiB;IAChD,MAAMC,WAAWH,YAAYE;IAC7B,MAAM,CAACE,eAAeC,iBAAiB,GAAGN,SAASI;IAEnD,sEAAsE;IACtE,oEAAoE;IACpEN,UAAU;QACRQ,iBAAiBF;IACnB,GAAG;QAACA;KAAS;IAEb,MAAMG,QAAQR,QAAQ;QACpB,OAAO,IAAIH,KAAKQ,UAAU;YACxBI,MAAM;gBACJ;oBAAEC,MAAM;oBAAQC,QAAQ;gBAAI;gBAC5B;oBAAED,MAAM;oBAAMC,QAAQ;gBAAK;gBAC3B;oBAAED,MAAM;oBAAQC,QAAQ;gBAAK;aAC9B;YACDC,cAAc;YACdC,YAAY;QAGd;IACF,GAAG;QAACR;KAAS;IAEb,MAAMS,cAA6BhB,YAAY;QAC7CS,iBAAiBF;IACnB,GAAG;QAACA;QAAUE;KAAiB;IAE/B,MAAMQ,cAA6BjB,YACjC,OAAOkB;QACL,MAAMC,UAAUT,MAAMU,MAAM,CAACF;QAC7BT,iBAAiBU,QAAQE,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;IAC5C,GACA;QAACb;QAAOD;KAAiB;IAG3B,OAAO;QAACD;QAAeD;QAAUU;QAAaD;KAAY;AAC5D;AACA,eAAeX,iBAAgB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type Icon, type IconId } from '@aglyn/shared-data-mdi';
18
+ export declare function useMdiIcons(iconId?: IconId[]): Icon[];
19
+ export default useMdiIcons;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { getMdiAllIcons, getMdiIconFromId, loadMdiIcons } from "@aglyn/shared-data-mdi";
17
+ import { useEffect, useMemo, useState } from "react";
18
+ export function useMdiIcons(iconId) {
19
+ // The catalog loads lazily on first use (AGL-189); `ready` flips once the
20
+ // MdiIcons map is populated so the memo recomputes with the full set.
21
+ const [ready, setReady] = useState(()=>getMdiAllIcons().size > 0);
22
+ useEffect(()=>{
23
+ if (ready) return undefined;
24
+ let active = true;
25
+ void loadMdiIcons().then((icons)=>{
26
+ if (active && icons.size > 0) setReady(true);
27
+ });
28
+ return ()=>{
29
+ active = false;
30
+ };
31
+ }, [
32
+ ready
33
+ ]);
34
+ return useMemo(()=>{
35
+ const MdiIcons = getMdiAllIcons();
36
+ return Array.isArray(iconId) ? [
37
+ ...iconId
38
+ ].map(getMdiIconFromId) : [
39
+ ...MdiIcons.values()
40
+ ];
41
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
+ }, [
43
+ iconId,
44
+ ready
45
+ ]);
46
+ }
47
+ export default useMdiIcons;
48
+
49
+ //# sourceMappingURL=use-mdi-icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/mdi-icon/use-mdi-icons.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n getMdiAllIcons,\n getMdiIconFromId,\n type Icon,\n type IconId,\n loadMdiIcons,\n} from '@aglyn/shared-data-mdi'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport function useMdiIcons(iconId?: IconId[]): Icon[] {\n // The catalog loads lazily on first use (AGL-189); `ready` flips once the\n // MdiIcons map is populated so the memo recomputes with the full set.\n const [ready, setReady] = useState(() => getMdiAllIcons().size > 0)\n useEffect(() => {\n if (ready) return undefined\n let active = true\n void loadMdiIcons().then((icons) => {\n if (active && icons.size > 0) setReady(true)\n })\n return () => {\n active = false\n }\n }, [ready])\n\n return useMemo(() => {\n const MdiIcons = getMdiAllIcons()\n return Array.isArray(iconId)\n ? [...iconId].map(getMdiIconFromId)\n : [...MdiIcons.values()]\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [iconId, ready])\n}\nexport default useMdiIcons\n"],"names":["getMdiAllIcons","getMdiIconFromId","loadMdiIcons","useEffect","useMemo","useState","useMdiIcons","iconId","ready","setReady","size","undefined","active","then","icons","MdiIcons","Array","isArray","map","values"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,cAAc,EACdC,gBAAgB,EAGhBC,YAAY,QACP,yBAAwB;AAC/B,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAEpD,OAAO,SAASC,YAAYC,MAAiB;IAC3C,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,CAACC,OAAOC,SAAS,GAAGJ,SAAS,IAAML,iBAAiBU,IAAI,GAAG;IACjEP,UAAU;QACR,IAAIK,OAAO,OAAOG;QAClB,IAAIC,SAAS;QACb,KAAKV,eAAeW,IAAI,CAAC,CAACC;YACxB,IAAIF,UAAUE,MAAMJ,IAAI,GAAG,GAAGD,SAAS;QACzC;QACA,OAAO;YACLG,SAAS;QACX;IACF,GAAG;QAACJ;KAAM;IAEV,OAAOJ,QAAQ;QACb,MAAMW,WAAWf;QACjB,OAAOgB,MAAMC,OAAO,CAACV,UACjB;eAAIA;SAAO,CAACW,GAAG,CAACjB,oBAChB;eAAIc,SAASI,MAAM;SAAG;IAC1B,uDAAuD;IACzD,GAAG;QAACZ;QAAQC;KAAM;AACpB;AACA,eAAeF,YAAW"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export type RouteProperties = {
18
+ shallow: boolean;
19
+ };
20
+ export type ChangeError = {
21
+ cancelled: boolean;
22
+ [any: string]: any;
23
+ };
24
+ export type AnyCallback = (...args: any[]) => void;
25
+ export type BeforeHistoryChangeCallback = (asPath: string, routeProps: RouteProperties) => void;
26
+ export type HashChangeStartCallback = (asPath: string, routeProps: RouteProperties) => void;
27
+ export type HashChangeCompleteCallback = (asPath: string, routeProps: RouteProperties) => void;
28
+ export type RouterChangeStartCallback = (asPath: string, routeProps: RouteProperties) => void;
29
+ export type RouterChangeCompleteCallback = (asPath: string, routeProps: RouteProperties) => void;
30
+ export type RouterChangeErrorCallback = (error: ChangeError, asPath: string, routeProps: RouteProperties) => void;
31
+ export declare enum NextRouterEvent {
32
+ HASH_CHANGE_START = "hashChangeStart",
33
+ HASH_CHANGE_COMPLETE = "hashChangeComplete",
34
+ ROUTE_CHANGE_START = "routeChangeStart",
35
+ ROUTE_CHANGE_COMPLETE = "routeChangeComplete",
36
+ ROUTE_CHANGE_ERROR = "routeChangeError",
37
+ BEFORE_HISTORY_CHANGE = "beforeHistoryChange"
38
+ }
39
+ export interface EventCallbacks {
40
+ [NextRouterEvent.BEFORE_HISTORY_CHANGE]: BeforeHistoryChangeCallback;
41
+ [NextRouterEvent.HASH_CHANGE_START]: HashChangeStartCallback;
42
+ [NextRouterEvent.HASH_CHANGE_COMPLETE]: HashChangeCompleteCallback;
43
+ [NextRouterEvent.ROUTE_CHANGE_START]: RouterChangeStartCallback;
44
+ [NextRouterEvent.ROUTE_CHANGE_COMPLETE]: RouterChangeCompleteCallback;
45
+ [NextRouterEvent.ROUTE_CHANGE_ERROR]: RouterChangeErrorCallback;
46
+ [eventId: string]: AnyCallback;
47
+ }
48
+ type EventParamType = [id: keyof EventCallbacks, callback: EventCallbacks[keyof EventCallbacks]];
49
+ export declare const useRouterEvent: (events: EventParamType[]) => void;
50
+ export declare const useOnBeforeHistoryChange: (callback: EventCallbacks[NextRouterEvent.BEFORE_HISTORY_CHANGE]) => void;
51
+ export declare const useOnHashChangeStart: (callback: EventCallbacks[NextRouterEvent.HASH_CHANGE_START]) => void;
52
+ export declare const useOnHashChangeComplete: (callback: EventCallbacks[NextRouterEvent.HASH_CHANGE_COMPLETE]) => void;
53
+ export declare const useOnRouteChangeStart: (callback: EventCallbacks[NextRouterEvent.ROUTE_CHANGE_START]) => void;
54
+ export declare const useOnRouteChangeComplete: (callback: EventCallbacks[NextRouterEvent.ROUTE_CHANGE_COMPLETE]) => void;
55
+ export declare const useOnRouteChangeError: (callback: EventCallbacks[NextRouterEvent.ROUTE_CHANGE_ERROR]) => void;
56
+ export {};
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { useRouter } from "next/router";
17
+ import { useEffect } from "react";
18
+ export var NextRouterEvent = /*#__PURE__*/ function(NextRouterEvent) {
19
+ NextRouterEvent["HASH_CHANGE_START"] = "hashChangeStart";
20
+ NextRouterEvent["HASH_CHANGE_COMPLETE"] = "hashChangeComplete";
21
+ NextRouterEvent["ROUTE_CHANGE_START"] = "routeChangeStart";
22
+ NextRouterEvent["ROUTE_CHANGE_COMPLETE"] = "routeChangeComplete";
23
+ NextRouterEvent["ROUTE_CHANGE_ERROR"] = "routeChangeError";
24
+ NextRouterEvent["BEFORE_HISTORY_CHANGE"] = "beforeHistoryChange";
25
+ return NextRouterEvent;
26
+ }({});
27
+ export const useRouterEvent = (events)=>{
28
+ const router = useRouter();
29
+ useEffect(()=>{
30
+ events.map(([id, callback])=>router.events.on(id, callback));
31
+ return ()=>{
32
+ events.map(([id, callback])=>router.events.off(id, callback));
33
+ };
34
+ }, [
35
+ events,
36
+ router.events
37
+ ]);
38
+ };
39
+ export const useOnBeforeHistoryChange = (callback)=>{
40
+ useRouterEvent([
41
+ [
42
+ "beforeHistoryChange",
43
+ callback
44
+ ]
45
+ ]);
46
+ };
47
+ export const useOnHashChangeStart = (callback)=>{
48
+ useRouterEvent([
49
+ [
50
+ "hashChangeStart",
51
+ callback
52
+ ]
53
+ ]);
54
+ };
55
+ export const useOnHashChangeComplete = (callback)=>{
56
+ useRouterEvent([
57
+ [
58
+ "hashChangeComplete",
59
+ callback
60
+ ]
61
+ ]);
62
+ };
63
+ export const useOnRouteChangeStart = (callback)=>{
64
+ useRouterEvent([
65
+ [
66
+ "routeChangeStart",
67
+ callback
68
+ ]
69
+ ]);
70
+ };
71
+ export const useOnRouteChangeComplete = (callback)=>{
72
+ useRouterEvent([
73
+ [
74
+ "routeChangeComplete",
75
+ callback
76
+ ]
77
+ ]);
78
+ };
79
+ export const useOnRouteChangeError = (callback)=>{
80
+ useRouterEvent([
81
+ [
82
+ "routeChangeError",
83
+ callback
84
+ ]
85
+ ]);
86
+ };
87
+
88
+ //# sourceMappingURL=router-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/router-events.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {useRouter} from 'next/router'\nimport {useEffect} from 'react'\n\n\nexport type RouteProperties = {\n shallow: boolean\n}\nexport type ChangeError = {\n cancelled: boolean,\n [any: string]: any,\n}\nexport type AnyCallback = (...args: any[]) => void\nexport type BeforeHistoryChangeCallback = (asPath: string, routeProps: RouteProperties) => void\nexport type HashChangeStartCallback = (asPath: string, routeProps: RouteProperties) => void\nexport type HashChangeCompleteCallback = (asPath: string, routeProps: RouteProperties) => void\nexport type RouterChangeStartCallback = (asPath: string, routeProps: RouteProperties) => void\nexport type RouterChangeCompleteCallback = (asPath: string, routeProps: RouteProperties) => void\nexport type RouterChangeErrorCallback = (\n error: ChangeError,\n asPath: string,\n routeProps: RouteProperties,\n) => void\n\nexport enum NextRouterEvent {\n HASH_CHANGE_START = 'hashChangeStart',\n HASH_CHANGE_COMPLETE = 'hashChangeComplete',\n ROUTE_CHANGE_START = 'routeChangeStart',\n ROUTE_CHANGE_COMPLETE = 'routeChangeComplete',\n ROUTE_CHANGE_ERROR = 'routeChangeError',\n BEFORE_HISTORY_CHANGE = 'beforeHistoryChange',\n}\n\nexport interface EventCallbacks {\n [NextRouterEvent.BEFORE_HISTORY_CHANGE]: BeforeHistoryChangeCallback,\n [NextRouterEvent.HASH_CHANGE_START]: HashChangeStartCallback,\n [NextRouterEvent.HASH_CHANGE_COMPLETE]: HashChangeCompleteCallback,\n [NextRouterEvent.ROUTE_CHANGE_START]: RouterChangeStartCallback,\n [NextRouterEvent.ROUTE_CHANGE_COMPLETE]: RouterChangeCompleteCallback,\n [NextRouterEvent.ROUTE_CHANGE_ERROR]: RouterChangeErrorCallback,\n [eventId: string]: AnyCallback\n}\n\ntype EventParamType = [id: keyof EventCallbacks, callback: EventCallbacks[keyof EventCallbacks]]\nexport const useRouterEvent = (events: EventParamType[]) => {\n const router = useRouter()\n useEffect(() => {\n events.map(([id, callback]) => router.events.on(id as any, callback))\n return () => {\n events.map(([id, callback]) => router.events.off(id as any, callback))\n }\n }, [events, router.events])\n}\nexport const useOnBeforeHistoryChange = (callback: EventCallbacks[NextRouterEvent.BEFORE_HISTORY_CHANGE]) => {\n useRouterEvent([[NextRouterEvent.BEFORE_HISTORY_CHANGE, callback]])\n}\nexport const useOnHashChangeStart = (callback: EventCallbacks[NextRouterEvent.HASH_CHANGE_START]) => {\n useRouterEvent([[NextRouterEvent.HASH_CHANGE_START, callback]])\n}\nexport const useOnHashChangeComplete = (callback: EventCallbacks[NextRouterEvent.HASH_CHANGE_COMPLETE]) => {\n useRouterEvent([[NextRouterEvent.HASH_CHANGE_COMPLETE, callback]])\n}\nexport const useOnRouteChangeStart = (callback: EventCallbacks[NextRouterEvent.ROUTE_CHANGE_START]) => {\n useRouterEvent([[NextRouterEvent.ROUTE_CHANGE_START, callback]])\n}\nexport const useOnRouteChangeComplete = (callback: EventCallbacks[NextRouterEvent.ROUTE_CHANGE_COMPLETE]) => {\n useRouterEvent([[NextRouterEvent.ROUTE_CHANGE_COMPLETE, callback]])\n}\nexport const useOnRouteChangeError = (callback: EventCallbacks[NextRouterEvent.ROUTE_CHANGE_ERROR]) => {\n useRouterEvent([[NextRouterEvent.ROUTE_CHANGE_ERROR, callback]])\n}\n"],"names":["useRouter","useEffect","NextRouterEvent","useRouterEvent","events","router","map","id","callback","on","off","useOnBeforeHistoryChange","useOnHashChangeStart","useOnHashChangeComplete","useOnRouteChangeStart","useOnRouteChangeComplete","useOnRouteChangeError"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,SAAS,QAAO,cAAa;AACrC,SAAQC,SAAS,QAAO,QAAO;AAsB/B,OAAO,IAAA,AAAKC,yCAAAA;;;;;;;WAAAA;MAOX;AAaD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAMC,SAASL;IACfC,UAAU;QACRG,OAAOE,GAAG,CAAC,CAAC,CAACC,IAAIC,SAAS,GAAKH,OAAOD,MAAM,CAACK,EAAE,CAACF,IAAWC;QAC3D,OAAO;YACLJ,OAAOE,GAAG,CAAC,CAAC,CAACC,IAAIC,SAAS,GAAKH,OAAOD,MAAM,CAACM,GAAG,CAACH,IAAWC;QAC9D;IACF,GAAG;QAACJ;QAAQC,OAAOD,MAAM;KAAC;AAC5B,EAAC;AACD,OAAO,MAAMO,2BAA2B,CAACH;IACvCL,eAAe;QAAC;;YAAwCK;SAAS;KAAC;AACpE,EAAC;AACD,OAAO,MAAMI,uBAAuB,CAACJ;IACnCL,eAAe;QAAC;;YAAoCK;SAAS;KAAC;AAChE,EAAC;AACD,OAAO,MAAMK,0BAA0B,CAACL;IACtCL,eAAe;QAAC;;YAAuCK;SAAS;KAAC;AACnE,EAAC;AACD,OAAO,MAAMM,wBAAwB,CAACN;IACpCL,eAAe;QAAC;;YAAqCK;SAAS;KAAC;AACjE,EAAC;AACD,OAAO,MAAMO,2BAA2B,CAACP;IACvCL,eAAe;QAAC;;YAAwCK;SAAS;KAAC;AACpE,EAAC;AACD,OAAO,MAAMQ,wBAAwB,CAACR;IACpCL,eAAe;QAAC;;YAAqCK;SAAS;KAAC;AACjE,EAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { DependencyList } from 'react';
18
+ export type EffectCallback<T = unknown> = (isMounted: () => boolean) => T | Promise<T>;
19
+ export type EffectParam<T = unknown> = EffectCallback<T> | {
20
+ onMount?: EffectCallback<T>;
21
+ onUnmount?: (result?: T) => void;
22
+ };
23
+ export declare function useAsyncEffect<T = unknown>(effect: EffectParam<T>, deps?: DependencyList): void;
24
+ export default useAsyncEffect;
@@ -0,0 +1,44 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import useCallbackParamRef from "./use-callback-param-ref.js";
18
+ import { useEffect } from "react";
19
+ export function useAsyncEffect(effect, deps) {
20
+ const isFunc = typeof effect === 'function';
21
+ const { onMount, onUnmount } = isFunc ? {
22
+ onMount: effect,
23
+ onUnmount: undefined
24
+ } : _extends({}, effect);
25
+ const handleMount = useCallbackParamRef(onMount);
26
+ const handleUnmount = useCallbackParamRef(onUnmount);
27
+ useEffect(function() {
28
+ const doMount = handleMount.current;
29
+ const doUnmount = handleUnmount.current;
30
+ let result;
31
+ let mounted = true;
32
+ if (typeof doMount === 'function') {
33
+ Promise.resolve(doMount(()=>mounted)).then((value)=>result = value);
34
+ }
35
+ return ()=>{
36
+ mounted = false;
37
+ if (typeof doUnmount === 'function') doUnmount(result);
38
+ };
39
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ deps);
41
+ }
42
+ export default useAsyncEffect;
43
+
44
+ //# sourceMappingURL=use-async-effect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/use-async-effect.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport useCallbackParamRef from './use-callback-param-ref'\nimport { DependencyList, useEffect } from 'react'\n\nexport type EffectCallback<T = unknown> = (\n isMounted: () => boolean,\n) => T | Promise<T>\n\nexport type EffectParam<T = unknown> =\n | EffectCallback<T>\n | { onMount?: EffectCallback<T>; onUnmount?: (result?: T) => void }\n\nexport function useAsyncEffect<T = unknown>(\n effect: EffectParam<T>,\n deps?: DependencyList,\n) {\n const isFunc = typeof effect === 'function'\n const { onMount, onUnmount } = isFunc\n ? { onMount: effect, onUnmount: undefined }\n : { ...effect }\n const handleMount = useCallbackParamRef(onMount)\n const handleUnmount = useCallbackParamRef(onUnmount)\n\n useEffect(\n function () {\n const doMount = handleMount.current\n const doUnmount = handleUnmount.current\n let result: T\n let mounted = true\n\n if (typeof doMount === 'function') {\n Promise.resolve(doMount(() => mounted)).then(\n (value) => (result = value),\n )\n }\n\n return () => {\n mounted = false\n\n if (typeof doUnmount === 'function') doUnmount(result)\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n deps,\n )\n}\n\nexport default useAsyncEffect\n"],"names":["useCallbackParamRef","useEffect","useAsyncEffect","effect","deps","isFunc","onMount","onUnmount","undefined","handleMount","handleUnmount","doMount","current","doUnmount","result","mounted","Promise","resolve","then","value"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,yBAAyB,8BAA0B;AAC1D,SAAyBC,SAAS,QAAQ,QAAO;AAUjD,OAAO,SAASC,eACdC,MAAsB,EACtBC,IAAqB;IAErB,MAAMC,SAAS,OAAOF,WAAW;IACjC,MAAM,EAAEG,OAAO,EAAEC,SAAS,EAAE,GAAGF,SAC3B;QAAEC,SAASH;QAAQI,WAAWC;IAAU,IACxC,aAAKL;IACT,MAAMM,cAAcT,oBAAoBM;IACxC,MAAMI,gBAAgBV,oBAAoBO;IAE1CN,UACE;QACE,MAAMU,UAAUF,YAAYG,OAAO;QACnC,MAAMC,YAAYH,cAAcE,OAAO;QACvC,IAAIE;QACJ,IAAIC,UAAU;QAEd,IAAI,OAAOJ,YAAY,YAAY;YACjCK,QAAQC,OAAO,CAACN,QAAQ,IAAMI,UAAUG,IAAI,CAC1C,CAACC,QAAWL,SAASK;QAEzB;QAEA,OAAO;YACLJ,UAAU;YAEV,IAAI,OAAOF,cAAc,YAAYA,UAAUC;QACjD;IACF,GACA,uDAAuD;IACvDV;AAEJ;AAEA,eAAeF,eAAc"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { RefObject } from 'react';
18
+ export declare function useCallbackParamRef<T extends (...args: any[]) => any>(param: T): RefObject<T>;
19
+ export default useCallbackParamRef;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { useEffect, useRef } from "react";
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ export function useCallbackParamRef(param) {
19
+ const callback = useRef(param);
20
+ useEffect(()=>{
21
+ callback.current = param;
22
+ }, [
23
+ param
24
+ ]);
25
+ return callback;
26
+ }
27
+ export default useCallbackParamRef;
28
+
29
+ //# sourceMappingURL=use-callback-param-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/use-callback-param-ref.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { RefObject, useEffect, useRef } from 'react'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCallbackParamRef<T extends (...args: any[]) => any>(\n param: T,\n): RefObject<T> {\n const callback = useRef<T>(param)\n useEffect(() => {\n callback.current = param\n }, [param])\n return callback\n}\n\nexport default useCallbackParamRef\n"],"names":["useEffect","useRef","useCallbackParamRef","param","callback","current"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,SAAoBA,SAAS,EAAEC,MAAM,QAAQ,QAAO;AAEpD,8DAA8D;AAC9D,OAAO,SAASC,oBACdC,KAAQ;IAER,MAAMC,WAAWH,OAAUE;IAC3BH,UAAU;QACRI,SAASC,OAAO,GAAGF;IACrB,GAAG;QAACA;KAAM;IACV,OAAOC;AACT;AAEA,eAAeF,oBAAmB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Use the provided
19
+ */
20
+ export declare function useId(id?: JSX.Key): JSX.Key;
21
+ export default useId;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { useId as useReactId, useMemo } from "react";
17
+ /**
18
+ * Use the provided
19
+ */ export function useId(id) {
20
+ const serverId = useReactId();
21
+ return useMemo(()=>id != null ? id : serverId, [
22
+ id,
23
+ serverId
24
+ ]);
25
+ }
26
+ export default useId;
27
+
28
+ //# sourceMappingURL=use-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/use-id.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useId as useReactId, useMemo } from 'react'\n\n/**\n * Use the provided\n */\nexport function useId(id?: JSX.Key): JSX.Key {\n const serverId = useReactId()\n return useMemo(() => id ?? serverId, [id, serverId])\n}\n\nexport default useId\n"],"names":["useId","useReactId","useMemo","id","serverId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,SAASC,UAAU,EAAEC,OAAO,QAAQ,QAAO;AAEpD;;CAEC,GACD,OAAO,SAASF,MAAMG,EAAY;IAChC,MAAMC,WAAWH;IACjB,OAAOC,QAAQ,IAAMC,aAAAA,KAAMC,UAAU;QAACD;QAAIC;KAAS;AACrD;AAEA,eAAeJ,MAAK"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { useEffect } from 'react';
18
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
19
+ export default useIsomorphicLayoutEffect;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { useEffect, useLayoutEffect } from "react";
17
+ export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
18
+ export default useIsomorphicLayoutEffect;
19
+
20
+ //# sourceMappingURL=use-isomorphic-layout-effect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/use-isomorphic-layout-effect.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {useEffect, useLayoutEffect} from 'react'\n\n\nexport const useIsomorphicLayoutEffect = typeof window !== 'undefined'\n ? useLayoutEffect\n : useEffect\n\nexport default useIsomorphicLayoutEffect\n"],"names":["useEffect","useLayoutEffect","useIsomorphicLayoutEffect","window"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,SAAS,EAAEC,eAAe,QAAO,QAAO;AAGhD,OAAO,MAAMC,4BAA4B,OAAOC,WAAW,cACvDF,kBACAD,UAAS;AAEb,eAAeE,0BAAyB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type ForwardedRef, type MutableRefObject, type RefCallback } from 'react';
18
+ /**
19
+ * Check if value is of type function similar to a ref callback
20
+ */
21
+ export declare function isRefCallback<T>(val: ForwardedRef<T>): val is RefCallback<T>;
22
+ /**
23
+ * Check if value is of mutable ref object
24
+ */
25
+ export declare function isRefObject<T>(val: ForwardedRef<T>): val is MutableRefObject<T>;
26
+ /**
27
+ * Assign a React ref object, could be a RefCallback or RefObject
28
+ */
29
+ export declare function assignRef<T>(ref: ForwardedRef<T>, value: T): T;
30
+ /**
31
+ * Merges multiple refs into one. Works with either callback or object refs.
32
+ */
33
+ export declare function mergeRefs<T>(...refs: ForwardedRef<T>[]): RefCallback<T>;
34
+ /**
35
+ * Merges multiple refs into one, by returning a new memoized ref callback
36
+ */
37
+ export declare function useMergeRefs<T>(...refs: ForwardedRef<T>[]): RefCallback<T>;
38
+ export default useMergeRefs;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { useMemo } from "react";
17
+ /**
18
+ * Check if value is of type function similar to a ref callback
19
+ */ export function isRefCallback(val) {
20
+ return typeof val === 'function';
21
+ }
22
+ /**
23
+ * Check if value is of mutable ref object
24
+ */ export function isRefObject(val) {
25
+ return Boolean(val && 'current' in val);
26
+ }
27
+ /**
28
+ * Assign a React ref object, could be a RefCallback or RefObject
29
+ */ export function assignRef(ref, value) {
30
+ if (isRefCallback(ref)) ref(value);
31
+ else if (isRefObject(ref)) ref.current = value;
32
+ return value;
33
+ }
34
+ /**
35
+ * Merges multiple refs into one. Works with either callback or object refs.
36
+ */ export function mergeRefs(...refs) {
37
+ if (refs.every((ref)=>ref === null)) return null;
38
+ return (value)=>{
39
+ for (const ref of refs){
40
+ assignRef(ref, value);
41
+ }
42
+ };
43
+ }
44
+ /**
45
+ * Merges multiple refs into one, by returning a new memoized ref callback
46
+ */ export function useMergeRefs(...refs) {
47
+ // eslint-disable-next-line react-hooks/exhaustive-deps
48
+ return useMemo(()=>mergeRefs(...refs), refs);
49
+ }
50
+ export default useMergeRefs;
51
+
52
+ //# sourceMappingURL=use-merge-refs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/hooks/use-merge-refs.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n type ForwardedRef,\n type MutableRefObject,\n type RefCallback,\n useMemo,\n} from 'react'\n\n/**\n * Check if value is of type function similar to a ref callback\n */\nexport function isRefCallback<T>(val: ForwardedRef<T>): val is RefCallback<T> {\n return typeof val === 'function'\n}\n\n/**\n * Check if value is of mutable ref object\n */\nexport function isRefObject<T>(\n val: ForwardedRef<T>,\n): val is MutableRefObject<T> {\n return Boolean(val && 'current' in val)\n}\n\n/**\n * Assign a React ref object, could be a RefCallback or RefObject\n */\nexport function assignRef<T>(ref: ForwardedRef<T>, value: T): T {\n if (isRefCallback(ref)) ref(value)\n else if (isRefObject(ref)) ref.current = value\n return value\n}\n\n/**\n * Merges multiple refs into one. Works with either callback or object refs.\n */\nexport function mergeRefs<T>(...refs: ForwardedRef<T>[]): RefCallback<T> {\n if (refs.every((ref) => ref === null)) return null\n return (value: T) => {\n for (const ref of refs) {\n assignRef(ref, value)\n }\n }\n}\n\n/**\n * Merges multiple refs into one, by returning a new memoized ref callback\n */\nexport function useMergeRefs<T>(...refs: ForwardedRef<T>[]): RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => mergeRefs(...refs), refs)\n}\n\nexport default useMergeRefs\n"],"names":["useMemo","isRefCallback","val","isRefObject","Boolean","assignRef","ref","value","current","mergeRefs","refs","every","useMergeRefs"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAIEA,OAAO,QACF,QAAO;AAEd;;CAEC,GACD,OAAO,SAASC,cAAiBC,GAAoB;IACnD,OAAO,OAAOA,QAAQ;AACxB;AAEA;;CAEC,GACD,OAAO,SAASC,YACdD,GAAoB;IAEpB,OAAOE,QAAQF,OAAO,aAAaA;AACrC;AAEA;;CAEC,GACD,OAAO,SAASG,UAAaC,GAAoB,EAAEC,KAAQ;IACzD,IAAIN,cAAcK,MAAMA,IAAIC;SACvB,IAAIJ,YAAYG,MAAMA,IAAIE,OAAO,GAAGD;IACzC,OAAOA;AACT;AAEA;;CAEC,GACD,OAAO,SAASE,UAAa,GAAGC,IAAuB;IACrD,IAAIA,KAAKC,KAAK,CAAC,CAACL,MAAQA,QAAQ,OAAO,OAAO;IAC9C,OAAO,CAACC;QACN,KAAK,MAAMD,OAAOI,KAAM;YACtBL,UAAUC,KAAKC;QACjB;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASK,aAAgB,GAAGF,IAAuB;IACxD,uDAAuD;IACvD,OAAOV,QAAQ,IAAMS,aAAaC,OAAOA;AAC3C;AAEA,eAAeE,aAAY"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type DependencyList } from 'react';
18
+ import type { Observable as RxJsObservable } from 'rxjs';
19
+ export type SubscribableLike<T> = RxJsObservable<T> | Observable<T>;
20
+ export type MapObservable<V, R> = (newValue: V, prevValue: R) => R;
21
+ export interface Observable<T> {
22
+ subscribe: (listener: (value: T) => void) => {
23
+ unsubscribe: () => void;
24
+ };
25
+ pipe?(...args: any[]): any;
26
+ }
27
+ export declare function useSubscribable<T>($subscribable: SubscribableLike<T>): T | undefined;
28
+ export declare function useSubscribable<T, U = any, M extends MapObservable<U, U | T | undefined> = MapObservable<U, U | T | undefined>>($subscribable: SubscribableLike<U>, initialValue: U | T, mapValue?: M, dependencies?: DependencyList): U | T;
29
+ export default useSubscribable;