shared-lib-web 0.0.0-stage → 0.0.3

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 (692) hide show
  1. package/CODING_RULES.md +118 -0
  2. package/LICENSE +21 -0
  3. package/README.md +884 -2
  4. package/dist/components/app-brand.d.ts +9 -0
  5. package/dist/components/app-brand.d.ts.map +1 -0
  6. package/dist/components/app-brand.js +27 -0
  7. package/dist/components/app-brand.js.map +1 -0
  8. package/dist/components/branch-switcher.d.ts +7 -0
  9. package/dist/components/branch-switcher.d.ts.map +1 -0
  10. package/dist/components/branch-switcher.js +37 -0
  11. package/dist/components/branch-switcher.js.map +1 -0
  12. package/dist/components/coming-soon.d.ts +6 -0
  13. package/dist/components/coming-soon.d.ts.map +1 -0
  14. package/dist/components/coming-soon.js +20 -0
  15. package/dist/components/coming-soon.js.map +1 -0
  16. package/dist/components/empty-state.d.ts +15 -0
  17. package/dist/components/empty-state.d.ts.map +1 -0
  18. package/dist/components/empty-state.js +14 -0
  19. package/dist/components/empty-state.js.map +1 -0
  20. package/dist/components/language-switcher.d.ts +12 -0
  21. package/dist/components/language-switcher.d.ts.map +1 -0
  22. package/dist/components/language-switcher.js +61 -0
  23. package/dist/components/language-switcher.js.map +1 -0
  24. package/dist/components/page-loader.d.ts +2 -0
  25. package/dist/components/page-loader.d.ts.map +1 -0
  26. package/dist/components/page-loader.js +8 -0
  27. package/dist/components/page-loader.js.map +1 -0
  28. package/dist/components/page-not-found.d.ts +2 -0
  29. package/dist/components/page-not-found.d.ts.map +1 -0
  30. package/dist/components/page-not-found.js +18 -0
  31. package/dist/components/page-not-found.js.map +1 -0
  32. package/dist/components/permission-denied.d.ts +2 -0
  33. package/dist/components/permission-denied.d.ts.map +1 -0
  34. package/dist/components/permission-denied.js +12 -0
  35. package/dist/components/permission-denied.js.map +1 -0
  36. package/dist/components/require-access.d.ts +11 -0
  37. package/dist/components/require-access.d.ts.map +1 -0
  38. package/dist/components/require-access.js +15 -0
  39. package/dist/components/require-access.js.map +1 -0
  40. package/dist/components/scroll-to-top.d.ts +12 -0
  41. package/dist/components/scroll-to-top.d.ts.map +1 -0
  42. package/dist/components/scroll-to-top.js +42 -0
  43. package/dist/components/scroll-to-top.js.map +1 -0
  44. package/dist/components/settings-menu.d.ts +21 -0
  45. package/dist/components/settings-menu.d.ts.map +1 -0
  46. package/dist/components/settings-menu.js +115 -0
  47. package/dist/components/settings-menu.js.map +1 -0
  48. package/dist/components/theme-switcher.d.ts +5 -0
  49. package/dist/components/theme-switcher.d.ts.map +1 -0
  50. package/dist/components/theme-switcher.js +33 -0
  51. package/dist/components/theme-switcher.js.map +1 -0
  52. package/dist/components/toast-container.d.ts +5 -0
  53. package/dist/components/toast-container.d.ts.map +1 -0
  54. package/dist/components/toast-container.js +51 -0
  55. package/dist/components/toast-container.js.map +1 -0
  56. package/dist/components/top-progress.d.ts +2 -0
  57. package/dist/components/top-progress.d.ts.map +1 -0
  58. package/dist/components/top-progress.js +14 -0
  59. package/dist/components/top-progress.js.map +1 -0
  60. package/dist/components/user-menu.d.ts +26 -0
  61. package/dist/components/user-menu.d.ts.map +1 -0
  62. package/dist/components/user-menu.js +85 -0
  63. package/dist/components/user-menu.js.map +1 -0
  64. package/dist/context/ui-context.d.ts +5 -0
  65. package/dist/context/ui-context.d.ts.map +1 -0
  66. package/dist/context/ui-context.js +16 -0
  67. package/dist/context/ui-context.js.map +1 -0
  68. package/dist/context/use-ui.d.ts +3 -0
  69. package/dist/context/use-ui.d.ts.map +1 -0
  70. package/dist/context/use-ui.js +40 -0
  71. package/dist/context/use-ui.js.map +1 -0
  72. package/dist/i18n/browser-language.d.ts +9 -0
  73. package/dist/i18n/browser-language.d.ts.map +1 -0
  74. package/dist/i18n/browser-language.js +89 -0
  75. package/dist/i18n/browser-language.js.map +1 -0
  76. package/dist/i18n/default-messages.d.ts +5 -0
  77. package/dist/i18n/default-messages.d.ts.map +1 -0
  78. package/dist/i18n/default-messages.js +67 -0
  79. package/dist/i18n/default-messages.js.map +1 -0
  80. package/dist/i18n/direction.d.ts +10 -0
  81. package/dist/i18n/direction.d.ts.map +1 -0
  82. package/dist/i18n/direction.js +35 -0
  83. package/dist/i18n/direction.js.map +1 -0
  84. package/dist/i18n/locale-groups.d.ts +18 -0
  85. package/dist/i18n/locale-groups.d.ts.map +1 -0
  86. package/dist/i18n/locale-groups.js +74 -0
  87. package/dist/i18n/locale-groups.js.map +1 -0
  88. package/dist/i18n/locale-service.d.ts +54 -0
  89. package/dist/i18n/locale-service.d.ts.map +1 -0
  90. package/dist/i18n/locale-service.js +231 -0
  91. package/dist/i18n/locale-service.js.map +1 -0
  92. package/dist/i18n/locale-signal.d.ts +18 -0
  93. package/dist/i18n/locale-signal.d.ts.map +1 -0
  94. package/dist/i18n/locale-signal.js +142 -0
  95. package/dist/i18n/locale-signal.js.map +1 -0
  96. package/dist/i18n/translator.d.ts +21 -0
  97. package/dist/i18n/translator.d.ts.map +1 -0
  98. package/dist/i18n/translator.js +105 -0
  99. package/dist/i18n/translator.js.map +1 -0
  100. package/dist/index.d.ts +117 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +130 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/interfaces/app-types.d.ts +143 -0
  105. package/dist/interfaces/app-types.d.ts.map +1 -0
  106. package/dist/interfaces/app-types.js +5 -0
  107. package/dist/interfaces/app-types.js.map +1 -0
  108. package/dist/interfaces/toast.d.ts +9 -0
  109. package/dist/interfaces/toast.d.ts.map +1 -0
  110. package/dist/interfaces/toast.js +4 -0
  111. package/dist/interfaces/toast.js.map +1 -0
  112. package/dist/interfaces/ui-config.d.ts +319 -0
  113. package/dist/interfaces/ui-config.d.ts.map +1 -0
  114. package/dist/interfaces/ui-config.js +6 -0
  115. package/dist/interfaces/ui-config.js.map +1 -0
  116. package/dist/interfaces/ui-context.d.ts +37 -0
  117. package/dist/interfaces/ui-context.d.ts.map +1 -0
  118. package/dist/interfaces/ui-context.js +4 -0
  119. package/dist/interfaces/ui-context.js.map +1 -0
  120. package/dist/layout.d.ts +10 -0
  121. package/dist/layout.d.ts.map +1 -0
  122. package/dist/layout.js +22 -0
  123. package/dist/layout.js.map +1 -0
  124. package/dist/layouts/app-layout.d.ts +23 -0
  125. package/dist/layouts/app-layout.d.ts.map +1 -0
  126. package/dist/layouts/app-layout.js +52 -0
  127. package/dist/layouts/app-layout.js.map +1 -0
  128. package/dist/layouts/article-layout.d.ts +7 -0
  129. package/dist/layouts/article-layout.d.ts.map +1 -0
  130. package/dist/layouts/article-layout.js +8 -0
  131. package/dist/layouts/article-layout.js.map +1 -0
  132. package/dist/layouts/aside-layout.d.ts +27 -0
  133. package/dist/layouts/aside-layout.d.ts.map +1 -0
  134. package/dist/layouts/aside-layout.js +70 -0
  135. package/dist/layouts/aside-layout.js.map +1 -0
  136. package/dist/layouts/auth-layout.d.ts +7 -0
  137. package/dist/layouts/auth-layout.d.ts.map +1 -0
  138. package/dist/layouts/auth-layout.js +20 -0
  139. package/dist/layouts/auth-layout.js.map +1 -0
  140. package/dist/layouts/content-layout.d.ts +3 -0
  141. package/dist/layouts/content-layout.d.ts.map +1 -0
  142. package/dist/layouts/content-layout.js +10 -0
  143. package/dist/layouts/content-layout.js.map +1 -0
  144. package/dist/layouts/float-layout.d.ts +3 -0
  145. package/dist/layouts/float-layout.d.ts.map +1 -0
  146. package/dist/layouts/float-layout.js +10 -0
  147. package/dist/layouts/float-layout.js.map +1 -0
  148. package/dist/layouts/grid-layout.d.ts +3 -0
  149. package/dist/layouts/grid-layout.d.ts.map +1 -0
  150. package/dist/layouts/grid-layout.js +10 -0
  151. package/dist/layouts/grid-layout.js.map +1 -0
  152. package/dist/layouts/head-layout.d.ts +16 -0
  153. package/dist/layouts/head-layout.d.ts.map +1 -0
  154. package/dist/layouts/head-layout.js +36 -0
  155. package/dist/layouts/head-layout.js.map +1 -0
  156. package/dist/layouts/header.d.ts +18 -0
  157. package/dist/layouts/header.d.ts.map +1 -0
  158. package/dist/layouts/header.js +26 -0
  159. package/dist/layouts/header.js.map +1 -0
  160. package/dist/layouts/layout-constants.d.ts +3 -0
  161. package/dist/layouts/layout-constants.d.ts.map +1 -0
  162. package/dist/layouts/layout-constants.js +5 -0
  163. package/dist/layouts/layout-constants.js.map +1 -0
  164. package/dist/layouts/mega-menu.d.ts +3 -0
  165. package/dist/layouts/mega-menu.d.ts.map +1 -0
  166. package/dist/layouts/mega-menu.js +104 -0
  167. package/dist/layouts/mega-menu.js.map +1 -0
  168. package/dist/layouts/navigation.d.ts +11 -0
  169. package/dist/layouts/navigation.d.ts.map +1 -0
  170. package/dist/layouts/navigation.js +41 -0
  171. package/dist/layouts/navigation.js.map +1 -0
  172. package/dist/layouts/rail-flyout.d.ts +5 -0
  173. package/dist/layouts/rail-flyout.d.ts.map +1 -0
  174. package/dist/layouts/rail-flyout.js +49 -0
  175. package/dist/layouts/rail-flyout.js.map +1 -0
  176. package/dist/layouts/rail-tooltip.d.ts +8 -0
  177. package/dist/layouts/rail-tooltip.d.ts.map +1 -0
  178. package/dist/layouts/rail-tooltip.js +60 -0
  179. package/dist/layouts/rail-tooltip.js.map +1 -0
  180. package/dist/layouts/sidebar.d.ts +38 -0
  181. package/dist/layouts/sidebar.d.ts.map +1 -0
  182. package/dist/layouts/sidebar.js +137 -0
  183. package/dist/layouts/sidebar.js.map +1 -0
  184. package/dist/markdown.d.ts +4 -0
  185. package/dist/markdown.d.ts.map +1 -0
  186. package/dist/markdown.js +12 -0
  187. package/dist/markdown.js.map +1 -0
  188. package/dist/providers/provider-effects.d.ts +9 -0
  189. package/dist/providers/provider-effects.d.ts.map +1 -0
  190. package/dist/providers/provider-effects.js +29 -0
  191. package/dist/providers/provider-effects.js.map +1 -0
  192. package/dist/providers/register-config.d.ts +4 -0
  193. package/dist/providers/register-config.d.ts.map +1 -0
  194. package/dist/providers/register-config.js +30 -0
  195. package/dist/providers/register-config.js.map +1 -0
  196. package/dist/providers/shared-web-ui-provider.d.ts +19 -0
  197. package/dist/providers/shared-web-ui-provider.d.ts.map +1 -0
  198. package/dist/providers/shared-web-ui-provider.js +53 -0
  199. package/dist/providers/shared-web-ui-provider.js.map +1 -0
  200. package/dist/providers/theme-provider.d.ts +6 -0
  201. package/dist/providers/theme-provider.d.ts.map +1 -0
  202. package/dist/providers/theme-provider.js +11 -0
  203. package/dist/providers/theme-provider.js.map +1 -0
  204. package/dist/providers/translation-provider.d.ts +8 -0
  205. package/dist/providers/translation-provider.d.ts.map +1 -0
  206. package/dist/providers/translation-provider.js +21 -0
  207. package/dist/providers/translation-provider.js.map +1 -0
  208. package/dist/query/page-link.d.ts +20 -0
  209. package/dist/query/page-link.d.ts.map +1 -0
  210. package/dist/query/page-link.js +53 -0
  211. package/dist/query/page-link.js.map +1 -0
  212. package/dist/query/page-path.d.ts +5 -0
  213. package/dist/query/page-path.d.ts.map +1 -0
  214. package/dist/query/page-path.js +24 -0
  215. package/dist/query/page-path.js.map +1 -0
  216. package/dist/query/query-param.d.ts +66 -0
  217. package/dist/query/query-param.d.ts.map +1 -0
  218. package/dist/query/query-param.js +218 -0
  219. package/dist/query/query-param.js.map +1 -0
  220. package/dist/query/use-query-param.d.ts +5 -0
  221. package/dist/query/use-query-param.d.ts.map +1 -0
  222. package/dist/query/use-query-param.js +21 -0
  223. package/dist/query/use-query-param.js.map +1 -0
  224. package/dist/skeleton/skeleton-article.d.ts +2 -0
  225. package/dist/skeleton/skeleton-article.d.ts.map +1 -0
  226. package/dist/skeleton/skeleton-article.js +7 -0
  227. package/dist/skeleton/skeleton-article.js.map +1 -0
  228. package/dist/skeleton/skeleton-auth-form.d.ts +6 -0
  229. package/dist/skeleton/skeleton-auth-form.d.ts.map +1 -0
  230. package/dist/skeleton/skeleton-auth-form.js +9 -0
  231. package/dist/skeleton/skeleton-auth-form.js.map +1 -0
  232. package/dist/skeleton/skeleton-cards.d.ts +6 -0
  233. package/dist/skeleton/skeleton-cards.d.ts.map +1 -0
  234. package/dist/skeleton/skeleton-cards.js +16 -0
  235. package/dist/skeleton/skeleton-cards.js.map +1 -0
  236. package/dist/skeleton/skeleton-chat.d.ts +2 -0
  237. package/dist/skeleton/skeleton-chat.d.ts.map +1 -0
  238. package/dist/skeleton/skeleton-chat.js +17 -0
  239. package/dist/skeleton/skeleton-chat.js.map +1 -0
  240. package/dist/skeleton/skeleton-dashboard.d.ts +2 -0
  241. package/dist/skeleton/skeleton-dashboard.d.ts.map +1 -0
  242. package/dist/skeleton/skeleton-dashboard.js +16 -0
  243. package/dist/skeleton/skeleton-dashboard.js.map +1 -0
  244. package/dist/skeleton/skeleton-float.d.ts +2 -0
  245. package/dist/skeleton/skeleton-float.d.ts.map +1 -0
  246. package/dist/skeleton/skeleton-float.js +7 -0
  247. package/dist/skeleton/skeleton-float.js.map +1 -0
  248. package/dist/skeleton/skeleton-form.d.ts +10 -0
  249. package/dist/skeleton/skeleton-form.d.ts.map +1 -0
  250. package/dist/skeleton/skeleton-form.js +16 -0
  251. package/dist/skeleton/skeleton-form.js.map +1 -0
  252. package/dist/skeleton/skeleton-menu.d.ts +2 -0
  253. package/dist/skeleton/skeleton-menu.d.ts.map +1 -0
  254. package/dist/skeleton/skeleton-menu.js +16 -0
  255. package/dist/skeleton/skeleton-menu.js.map +1 -0
  256. package/dist/skeleton/skeleton-page.d.ts +2 -0
  257. package/dist/skeleton/skeleton-page.d.ts.map +1 -0
  258. package/dist/skeleton/skeleton-page.js +9 -0
  259. package/dist/skeleton/skeleton-page.js.map +1 -0
  260. package/dist/skeleton/skeleton-table.d.ts +2 -0
  261. package/dist/skeleton/skeleton-table.d.ts.map +1 -0
  262. package/dist/skeleton/skeleton-table.js +16 -0
  263. package/dist/skeleton/skeleton-table.js.map +1 -0
  264. package/dist/state/api-loader.d.ts +19 -0
  265. package/dist/state/api-loader.d.ts.map +1 -0
  266. package/dist/state/api-loader.js +187 -0
  267. package/dist/state/api-loader.js.map +1 -0
  268. package/dist/state/auth-service.d.ts +32 -0
  269. package/dist/state/auth-service.d.ts.map +1 -0
  270. package/dist/state/auth-service.js +136 -0
  271. package/dist/state/auth-service.js.map +1 -0
  272. package/dist/state/branch-service.d.ts +42 -0
  273. package/dist/state/branch-service.d.ts.map +1 -0
  274. package/dist/state/branch-service.js +193 -0
  275. package/dist/state/branch-service.js.map +1 -0
  276. package/dist/state/company-service.d.ts +16 -0
  277. package/dist/state/company-service.d.ts.map +1 -0
  278. package/dist/state/company-service.js +97 -0
  279. package/dist/state/company-service.js.map +1 -0
  280. package/dist/state/document-sync.d.ts +7 -0
  281. package/dist/state/document-sync.d.ts.map +1 -0
  282. package/dist/state/document-sync.js +39 -0
  283. package/dist/state/document-sync.js.map +1 -0
  284. package/dist/state/language-service.d.ts +19 -0
  285. package/dist/state/language-service.d.ts.map +1 -0
  286. package/dist/state/language-service.js +78 -0
  287. package/dist/state/language-service.js.map +1 -0
  288. package/dist/state/layout-choice-service.d.ts +10 -0
  289. package/dist/state/layout-choice-service.d.ts.map +1 -0
  290. package/dist/state/layout-choice-service.js +34 -0
  291. package/dist/state/layout-choice-service.js.map +1 -0
  292. package/dist/state/menu-service.d.ts +20 -0
  293. package/dist/state/menu-service.d.ts.map +1 -0
  294. package/dist/state/menu-service.js +59 -0
  295. package/dist/state/menu-service.js.map +1 -0
  296. package/dist/state/navigation-service.d.ts +37 -0
  297. package/dist/state/navigation-service.d.ts.map +1 -0
  298. package/dist/state/navigation-service.js +131 -0
  299. package/dist/state/navigation-service.js.map +1 -0
  300. package/dist/state/preference-sync.d.ts +15 -0
  301. package/dist/state/preference-sync.d.ts.map +1 -0
  302. package/dist/state/preference-sync.js +93 -0
  303. package/dist/state/preference-sync.js.map +1 -0
  304. package/dist/state/progress-service.d.ts +3 -0
  305. package/dist/state/progress-service.d.ts.map +1 -0
  306. package/dist/state/progress-service.js +17 -0
  307. package/dist/state/progress-service.js.map +1 -0
  308. package/dist/state/screen-access.d.ts +15 -0
  309. package/dist/state/screen-access.d.ts.map +1 -0
  310. package/dist/state/screen-access.js +60 -0
  311. package/dist/state/screen-access.js.map +1 -0
  312. package/dist/state/sidebar-service.d.ts +8 -0
  313. package/dist/state/sidebar-service.d.ts.map +1 -0
  314. package/dist/state/sidebar-service.js +18 -0
  315. package/dist/state/sidebar-service.js.map +1 -0
  316. package/dist/state/signals.d.ts +92 -0
  317. package/dist/state/signals.d.ts.map +1 -0
  318. package/dist/state/signals.js +161 -0
  319. package/dist/state/signals.js.map +1 -0
  320. package/dist/state/toast-service.d.ts +9 -0
  321. package/dist/state/toast-service.d.ts.map +1 -0
  322. package/dist/state/toast-service.js +36 -0
  323. package/dist/state/toast-service.js.map +1 -0
  324. package/dist/styles.css +15 -0
  325. package/dist/theme/custom-themes.d.ts +28 -0
  326. package/dist/theme/custom-themes.d.ts.map +1 -0
  327. package/dist/theme/custom-themes.js +218 -0
  328. package/dist/theme/custom-themes.js.map +1 -0
  329. package/dist/theme/dark-themes.d.ts +10 -0
  330. package/dist/theme/dark-themes.d.ts.map +1 -0
  331. package/dist/theme/dark-themes.js +92 -0
  332. package/dist/theme/dark-themes.js.map +1 -0
  333. package/dist/theme/logo.d.ts +7 -0
  334. package/dist/theme/logo.d.ts.map +1 -0
  335. package/dist/theme/logo.js +24 -0
  336. package/dist/theme/logo.js.map +1 -0
  337. package/dist/theme/theme-service.d.ts +32 -0
  338. package/dist/theme/theme-service.d.ts.map +1 -0
  339. package/dist/theme/theme-service.js +123 -0
  340. package/dist/theme/theme-service.js.map +1 -0
  341. package/dist/types/class-names.d.ts +9 -0
  342. package/dist/types/class-names.d.ts.map +1 -0
  343. package/dist/types/class-names.js +45 -0
  344. package/dist/types/class-names.js.map +1 -0
  345. package/dist/types/field-error.d.ts +5 -0
  346. package/dist/types/field-error.d.ts.map +1 -0
  347. package/dist/types/field-error.js +16 -0
  348. package/dist/types/field-error.js.map +1 -0
  349. package/dist/types/field-props.d.ts +20 -0
  350. package/dist/types/field-props.d.ts.map +1 -0
  351. package/dist/types/field-props.js +4 -0
  352. package/dist/types/field-props.js.map +1 -0
  353. package/dist/types/field-registry.d.ts +11 -0
  354. package/dist/types/field-registry.d.ts.map +1 -0
  355. package/dist/types/field-registry.js +18 -0
  356. package/dist/types/field-registry.js.map +1 -0
  357. package/dist/types/field-wrapper.d.ts +13 -0
  358. package/dist/types/field-wrapper.d.ts.map +1 -0
  359. package/dist/types/field-wrapper.js +16 -0
  360. package/dist/types/field-wrapper.js.map +1 -0
  361. package/dist/types/lang-field.d.ts +15 -0
  362. package/dist/types/lang-field.d.ts.map +1 -0
  363. package/dist/types/lang-field.js +68 -0
  364. package/dist/types/lang-field.js.map +1 -0
  365. package/dist/types/markdown-color-mode.d.ts +7 -0
  366. package/dist/types/markdown-color-mode.d.ts.map +1 -0
  367. package/dist/types/markdown-color-mode.js +11 -0
  368. package/dist/types/markdown-color-mode.js.map +1 -0
  369. package/dist/types/media-service.d.ts +24 -0
  370. package/dist/types/media-service.d.ts.map +1 -0
  371. package/dist/types/media-service.js +41 -0
  372. package/dist/types/media-service.js.map +1 -0
  373. package/dist/types/media-viewer.d.ts +2 -0
  374. package/dist/types/media-viewer.d.ts.map +1 -0
  375. package/dist/types/media-viewer.js +23 -0
  376. package/dist/types/media-viewer.js.map +1 -0
  377. package/dist/types/type.button.d.ts +36 -0
  378. package/dist/types/type.button.d.ts.map +1 -0
  379. package/dist/types/type.button.js +27 -0
  380. package/dist/types/type.button.js.map +1 -0
  381. package/dist/types/type.checkbox.d.ts +5 -0
  382. package/dist/types/type.checkbox.d.ts.map +1 -0
  383. package/dist/types/type.checkbox.js +26 -0
  384. package/dist/types/type.checkbox.js.map +1 -0
  385. package/dist/types/type.confirm.d.ts +19 -0
  386. package/dist/types/type.confirm.d.ts.map +1 -0
  387. package/dist/types/type.confirm.js +15 -0
  388. package/dist/types/type.confirm.js.map +1 -0
  389. package/dist/types/type.date.d.ts +16 -0
  390. package/dist/types/type.date.d.ts.map +1 -0
  391. package/dist/types/type.date.js +65 -0
  392. package/dist/types/type.date.js.map +1 -0
  393. package/dist/types/type.drawer.d.ts +20 -0
  394. package/dist/types/type.drawer.d.ts.map +1 -0
  395. package/dist/types/type.drawer.js +31 -0
  396. package/dist/types/type.drawer.js.map +1 -0
  397. package/dist/types/type.dropdown.d.ts +23 -0
  398. package/dist/types/type.dropdown.d.ts.map +1 -0
  399. package/dist/types/type.dropdown.js +34 -0
  400. package/dist/types/type.dropdown.js.map +1 -0
  401. package/dist/types/type.filter.d.ts +17 -0
  402. package/dist/types/type.filter.d.ts.map +1 -0
  403. package/dist/types/type.filter.js +28 -0
  404. package/dist/types/type.filter.js.map +1 -0
  405. package/dist/types/type.icon.d.ts +21 -0
  406. package/dist/types/type.icon.d.ts.map +1 -0
  407. package/dist/types/type.icon.js +24 -0
  408. package/dist/types/type.icon.js.map +1 -0
  409. package/dist/types/type.image.d.ts +34 -0
  410. package/dist/types/type.image.d.ts.map +1 -0
  411. package/dist/types/type.image.js +46 -0
  412. package/dist/types/type.image.js.map +1 -0
  413. package/dist/types/type.input.d.ts +13 -0
  414. package/dist/types/type.input.d.ts.map +1 -0
  415. package/dist/types/type.input.js +29 -0
  416. package/dist/types/type.input.js.map +1 -0
  417. package/dist/types/type.lang-md.d.ts +10 -0
  418. package/dist/types/type.lang-md.d.ts.map +1 -0
  419. package/dist/types/type.lang-md.js +56 -0
  420. package/dist/types/type.lang-md.js.map +1 -0
  421. package/dist/types/type.lang.d.ts +11 -0
  422. package/dist/types/type.lang.d.ts.map +1 -0
  423. package/dist/types/type.lang.js +56 -0
  424. package/dist/types/type.lang.js.map +1 -0
  425. package/dist/types/type.list.d.ts +13 -0
  426. package/dist/types/type.list.d.ts.map +1 -0
  427. package/dist/types/type.list.js +42 -0
  428. package/dist/types/type.list.js.map +1 -0
  429. package/dist/types/type.mdv.d.ts +10 -0
  430. package/dist/types/type.mdv.d.ts.map +1 -0
  431. package/dist/types/type.mdv.js +22 -0
  432. package/dist/types/type.mdv.js.map +1 -0
  433. package/dist/types/type.mdx.d.ts +10 -0
  434. package/dist/types/type.mdx.d.ts.map +1 -0
  435. package/dist/types/type.mdx.js +30 -0
  436. package/dist/types/type.mdx.js.map +1 -0
  437. package/dist/types/type.modal.d.ts +18 -0
  438. package/dist/types/type.modal.d.ts.map +1 -0
  439. package/dist/types/type.modal.js +30 -0
  440. package/dist/types/type.modal.js.map +1 -0
  441. package/dist/types/type.otp.d.ts +8 -0
  442. package/dist/types/type.otp.d.ts.map +1 -0
  443. package/dist/types/type.otp.js +48 -0
  444. package/dist/types/type.otp.js.map +1 -0
  445. package/dist/types/type.search.d.ts +16 -0
  446. package/dist/types/type.search.d.ts.map +1 -0
  447. package/dist/types/type.search.js +48 -0
  448. package/dist/types/type.search.js.map +1 -0
  449. package/dist/types/type.select.d.ts +14 -0
  450. package/dist/types/type.select.d.ts.map +1 -0
  451. package/dist/types/type.select.js +53 -0
  452. package/dist/types/type.select.js.map +1 -0
  453. package/dist/types/type.switch.d.ts +8 -0
  454. package/dist/types/type.switch.d.ts.map +1 -0
  455. package/dist/types/type.switch.js +26 -0
  456. package/dist/types/type.switch.js.map +1 -0
  457. package/dist/types/type.table.d.ts +28 -0
  458. package/dist/types/type.table.d.ts.map +1 -0
  459. package/dist/types/type.table.js +72 -0
  460. package/dist/types/type.table.js.map +1 -0
  461. package/dist/types/type.text-area.d.ts +9 -0
  462. package/dist/types/type.text-area.d.ts.map +1 -0
  463. package/dist/types/type.text-area.js +26 -0
  464. package/dist/types/type.text-area.js.map +1 -0
  465. package/dist/types/type.time.d.ts +9 -0
  466. package/dist/types/type.time.d.ts.map +1 -0
  467. package/dist/types/type.time.js +34 -0
  468. package/dist/types/type.time.js.map +1 -0
  469. package/dist/types/type.upload.d.ts +45 -0
  470. package/dist/types/type.upload.d.ts.map +1 -0
  471. package/dist/types/type.upload.js +90 -0
  472. package/dist/types/type.upload.js.map +1 -0
  473. package/dist/types/type.video.d.ts +19 -0
  474. package/dist/types/type.video.d.ts.map +1 -0
  475. package/dist/types/type.video.js +33 -0
  476. package/dist/types/type.video.js.map +1 -0
  477. package/dist/types/upload-service.d.ts +47 -0
  478. package/dist/types/upload-service.d.ts.map +1 -0
  479. package/dist/types/upload-service.js +191 -0
  480. package/dist/types/upload-service.js.map +1 -0
  481. package/dist/utils/app-config.d.ts +6 -0
  482. package/dist/utils/app-config.d.ts.map +1 -0
  483. package/dist/utils/app-config.js +17 -0
  484. package/dist/utils/app-config.js.map +1 -0
  485. package/dist/utils/app-http.d.ts +77 -0
  486. package/dist/utils/app-http.d.ts.map +1 -0
  487. package/dist/utils/app-http.js +331 -0
  488. package/dist/utils/app-http.js.map +1 -0
  489. package/dist/utils/app-storage.d.ts +56 -0
  490. package/dist/utils/app-storage.d.ts.map +1 -0
  491. package/dist/utils/app-storage.js +236 -0
  492. package/dist/utils/app-storage.js.map +1 -0
  493. package/dist/utils/content-util.d.ts +6 -0
  494. package/dist/utils/content-util.d.ts.map +1 -0
  495. package/dist/utils/content-util.js +45 -0
  496. package/dist/utils/content-util.js.map +1 -0
  497. package/dist/utils/crypto-util.d.ts +15 -0
  498. package/dist/utils/crypto-util.d.ts.map +1 -0
  499. package/dist/utils/crypto-util.js +76 -0
  500. package/dist/utils/crypto-util.js.map +1 -0
  501. package/dist/utils/error-util.d.ts +3 -0
  502. package/dist/utils/error-util.d.ts.map +1 -0
  503. package/dist/utils/error-util.js +58 -0
  504. package/dist/utils/error-util.js.map +1 -0
  505. package/dist/utils/event-util.d.ts +16 -0
  506. package/dist/utils/event-util.d.ts.map +1 -0
  507. package/dist/utils/event-util.js +51 -0
  508. package/dist/utils/event-util.js.map +1 -0
  509. package/dist/utils/file-util.d.ts +30 -0
  510. package/dist/utils/file-util.d.ts.map +1 -0
  511. package/dist/utils/file-util.js +165 -0
  512. package/dist/utils/file-util.js.map +1 -0
  513. package/dist/utils/lang-util.d.ts +12 -0
  514. package/dist/utils/lang-util.d.ts.map +1 -0
  515. package/dist/utils/lang-util.js +53 -0
  516. package/dist/utils/lang-util.js.map +1 -0
  517. package/dist/utils/language-util.d.ts +21 -0
  518. package/dist/utils/language-util.d.ts.map +1 -0
  519. package/dist/utils/language-util.js +96 -0
  520. package/dist/utils/language-util.js.map +1 -0
  521. package/dist/utils/leave-guard.d.ts +5 -0
  522. package/dist/utils/leave-guard.d.ts.map +1 -0
  523. package/dist/utils/leave-guard.js +24 -0
  524. package/dist/utils/leave-guard.js.map +1 -0
  525. package/dist/utils/lucide-icon.d.ts +10 -0
  526. package/dist/utils/lucide-icon.d.ts.map +1 -0
  527. package/dist/utils/lucide-icon.js +48 -0
  528. package/dist/utils/lucide-icon.js.map +1 -0
  529. package/dist/utils/menu-util.d.ts +33 -0
  530. package/dist/utils/menu-util.d.ts.map +1 -0
  531. package/dist/utils/menu-util.js +151 -0
  532. package/dist/utils/menu-util.js.map +1 -0
  533. package/dist/utils/option-util.d.ts +21 -0
  534. package/dist/utils/option-util.d.ts.map +1 -0
  535. package/dist/utils/option-util.js +101 -0
  536. package/dist/utils/option-util.js.map +1 -0
  537. package/dist/utils/session-id.d.ts +5 -0
  538. package/dist/utils/session-id.d.ts.map +1 -0
  539. package/dist/utils/session-id.js +44 -0
  540. package/dist/utils/session-id.js.map +1 -0
  541. package/dist/utils/shared-regexp.d.ts +31 -0
  542. package/dist/utils/shared-regexp.d.ts.map +1 -0
  543. package/dist/utils/shared-regexp.js +17 -0
  544. package/dist/utils/shared-regexp.js.map +1 -0
  545. package/dist/utils/signal-source.d.ts +4 -0
  546. package/dist/utils/signal-source.d.ts.map +1 -0
  547. package/dist/utils/signal-source.js +13 -0
  548. package/dist/utils/signal-source.js.map +1 -0
  549. package/dist/utils/storage-keys.d.ts +73 -0
  550. package/dist/utils/storage-keys.d.ts.map +1 -0
  551. package/dist/utils/storage-keys.js +80 -0
  552. package/dist/utils/storage-keys.js.map +1 -0
  553. package/package.json +101 -4
  554. package/src/components/app-brand.tsx +41 -0
  555. package/src/components/branch-switcher.tsx +74 -0
  556. package/src/components/coming-soon.tsx +36 -0
  557. package/src/components/empty-state.tsx +42 -0
  558. package/src/components/language-switcher.tsx +96 -0
  559. package/src/components/page-loader.tsx +11 -0
  560. package/src/components/page-not-found.tsx +42 -0
  561. package/src/components/permission-denied.tsx +21 -0
  562. package/src/components/require-access.tsx +30 -0
  563. package/src/components/scroll-to-top.tsx +62 -0
  564. package/src/components/settings-menu.tsx +250 -0
  565. package/src/components/theme-switcher.tsx +72 -0
  566. package/src/components/toast-container.tsx +73 -0
  567. package/src/components/top-progress.tsx +14 -0
  568. package/src/components/user-menu.tsx +179 -0
  569. package/src/context/ui-context.ts +20 -0
  570. package/src/context/use-ui.ts +43 -0
  571. package/src/i18n/browser-language.ts +98 -0
  572. package/src/i18n/default-messages.ts +70 -0
  573. package/src/i18n/direction.ts +43 -0
  574. package/src/i18n/locale-groups.ts +87 -0
  575. package/src/i18n/locale-service.ts +259 -0
  576. package/src/i18n/locale-signal.ts +173 -0
  577. package/src/i18n/translator.ts +114 -0
  578. package/src/index.ts +409 -0
  579. package/src/interfaces/app-types.ts +160 -0
  580. package/src/interfaces/toast.ts +12 -0
  581. package/src/interfaces/ui-config.ts +342 -0
  582. package/src/interfaces/ui-context.ts +43 -0
  583. package/src/layout.ts +29 -0
  584. package/src/layouts/app-layout.tsx +103 -0
  585. package/src/layouts/article-layout.tsx +16 -0
  586. package/src/layouts/aside-layout.tsx +118 -0
  587. package/src/layouts/auth-layout.tsx +41 -0
  588. package/src/layouts/content-layout.tsx +11 -0
  589. package/src/layouts/float-layout.tsx +11 -0
  590. package/src/layouts/grid-layout.tsx +11 -0
  591. package/src/layouts/head-layout.tsx +61 -0
  592. package/src/layouts/header.tsx +74 -0
  593. package/src/layouts/layout-constants.ts +5 -0
  594. package/src/layouts/mega-menu.tsx +203 -0
  595. package/src/layouts/navigation.ts +45 -0
  596. package/src/layouts/rail-flyout.tsx +77 -0
  597. package/src/layouts/rail-tooltip.tsx +77 -0
  598. package/src/layouts/sidebar.tsx +296 -0
  599. package/src/markdown.ts +12 -0
  600. package/src/providers/provider-effects.ts +33 -0
  601. package/src/providers/register-config.ts +32 -0
  602. package/src/providers/shared-web-ui-provider.tsx +81 -0
  603. package/src/providers/theme-provider.tsx +15 -0
  604. package/src/providers/translation-provider.tsx +28 -0
  605. package/src/query/page-link.tsx +84 -0
  606. package/src/query/page-path.ts +26 -0
  607. package/src/query/query-param.ts +267 -0
  608. package/src/query/use-query-param.ts +23 -0
  609. package/src/skeleton/skeleton-article.tsx +11 -0
  610. package/src/skeleton/skeleton-auth-form.tsx +20 -0
  611. package/src/skeleton/skeleton-cards.tsx +35 -0
  612. package/src/skeleton/skeleton-chat.tsx +34 -0
  613. package/src/skeleton/skeleton-dashboard.tsx +34 -0
  614. package/src/skeleton/skeleton-float.tsx +10 -0
  615. package/src/skeleton/skeleton-form.tsx +45 -0
  616. package/src/skeleton/skeleton-menu.tsx +30 -0
  617. package/src/skeleton/skeleton-page.tsx +18 -0
  618. package/src/skeleton/skeleton-table.tsx +25 -0
  619. package/src/state/api-loader.ts +205 -0
  620. package/src/state/auth-service.ts +159 -0
  621. package/src/state/branch-service.ts +217 -0
  622. package/src/state/company-service.ts +107 -0
  623. package/src/state/document-sync.ts +43 -0
  624. package/src/state/language-service.ts +85 -0
  625. package/src/state/layout-choice-service.ts +40 -0
  626. package/src/state/menu-service.ts +67 -0
  627. package/src/state/navigation-service.ts +160 -0
  628. package/src/state/preference-sync.ts +101 -0
  629. package/src/state/progress-service.ts +18 -0
  630. package/src/state/screen-access.ts +70 -0
  631. package/src/state/sidebar-service.ts +22 -0
  632. package/src/state/signals.ts +215 -0
  633. package/src/state/toast-service.ts +45 -0
  634. package/src/styles.css +15 -0
  635. package/src/theme/custom-themes.ts +236 -0
  636. package/src/theme/dark-themes.ts +97 -0
  637. package/src/theme/logo.ts +27 -0
  638. package/src/theme/org-themes.json +70 -0
  639. package/src/theme/theme-service.ts +142 -0
  640. package/src/types/class-names.ts +53 -0
  641. package/src/types/field-error.ts +19 -0
  642. package/src/types/field-props.ts +23 -0
  643. package/src/types/field-registry.ts +27 -0
  644. package/src/types/field-wrapper.tsx +42 -0
  645. package/src/types/lang-field.ts +71 -0
  646. package/src/types/markdown-color-mode.ts +13 -0
  647. package/src/types/media-service.ts +61 -0
  648. package/src/types/media-viewer.tsx +57 -0
  649. package/src/types/type.button.tsx +108 -0
  650. package/src/types/type.checkbox.tsx +49 -0
  651. package/src/types/type.confirm.tsx +50 -0
  652. package/src/types/type.date.tsx +97 -0
  653. package/src/types/type.drawer.tsx +86 -0
  654. package/src/types/type.dropdown.tsx +81 -0
  655. package/src/types/type.filter.tsx +64 -0
  656. package/src/types/type.icon.ts +53 -0
  657. package/src/types/type.image.tsx +115 -0
  658. package/src/types/type.input.tsx +57 -0
  659. package/src/types/type.lang-md.tsx +129 -0
  660. package/src/types/type.lang.tsx +156 -0
  661. package/src/types/type.list.tsx +97 -0
  662. package/src/types/type.mdv.tsx +35 -0
  663. package/src/types/type.mdx.tsx +54 -0
  664. package/src/types/type.modal.tsx +77 -0
  665. package/src/types/type.otp.tsx +82 -0
  666. package/src/types/type.search.tsx +87 -0
  667. package/src/types/type.select.tsx +87 -0
  668. package/src/types/type.switch.tsx +52 -0
  669. package/src/types/type.table.tsx +152 -0
  670. package/src/types/type.text-area.tsx +51 -0
  671. package/src/types/type.time.tsx +61 -0
  672. package/src/types/type.upload.tsx +294 -0
  673. package/src/types/type.video.tsx +119 -0
  674. package/src/types/upload-service.ts +229 -0
  675. package/src/utils/app-config.ts +21 -0
  676. package/src/utils/app-http.ts +369 -0
  677. package/src/utils/app-storage.ts +259 -0
  678. package/src/utils/content-util.ts +49 -0
  679. package/src/utils/crypto-util.ts +88 -0
  680. package/src/utils/error-util.ts +64 -0
  681. package/src/utils/event-util.ts +58 -0
  682. package/src/utils/file-util.ts +186 -0
  683. package/src/utils/lang-util.ts +60 -0
  684. package/src/utils/language-util.ts +107 -0
  685. package/src/utils/leave-guard.ts +26 -0
  686. package/src/utils/lucide-icon.ts +55 -0
  687. package/src/utils/menu-util.ts +165 -0
  688. package/src/utils/option-util.ts +108 -0
  689. package/src/utils/session-id.ts +48 -0
  690. package/src/utils/shared-regexp.ts +18 -0
  691. package/src/utils/signal-source.ts +15 -0
  692. package/src/utils/storage-keys.ts +86 -0
@@ -0,0 +1,70 @@
1
+ // screen-access.ts
2
+ // What the user may do on the current screen, from NavItem.permissions in the navigation.
3
+ //
4
+ // const access = screenAccessSignal.value; // { read, create, update, delete }
5
+ // if (canAccess("update")) { ... }
6
+ // <RequireAccess><UserPage /></RequireAccess> // shows PermissionDenied when read is false
7
+
8
+ import { computed } from "@preact/signals-react";
9
+ import type { NavItem, ScreenPermissions } from "../interfaces/ui-config.ts";
10
+ import { isPathMatch } from "../layouts/navigation.ts";
11
+ import { navigationSignal, currentPageSignal } from "./signals.ts";
12
+
13
+ export type ScreenAction = keyof ScreenPermissions;
14
+
15
+ /** Full access, used for screens that are not in the navigation. */
16
+ export const FULL_ACCESS: Required<ScreenPermissions> = { read: true, create: true, update: true, delete: true };
17
+
18
+ /** Finds the deepest nav item whose path matches the URL path. */
19
+ export function findNavItemByPath(items: NavItem[], currentPage: string): NavItem | undefined {
20
+ for (const item of items) {
21
+ const childItems = item.children ?? [];
22
+ const childMatch = findNavItemByPath(childItems, currentPage);
23
+ if (childMatch) {
24
+ return childMatch;
25
+ }
26
+ const isMatch = isPathMatch(item.path, currentPage);
27
+ if (isMatch) {
28
+ return item;
29
+ }
30
+ }
31
+ return undefined;
32
+ }
33
+
34
+ /** Turns optional permissions into a full object (missing values are true). */
35
+ export function completePermissions(permissions: ScreenPermissions | undefined): Required<ScreenPermissions> {
36
+ if (!permissions) {
37
+ return FULL_ACCESS;
38
+ }
39
+ return {
40
+ read: permissions.read ?? true,
41
+ create: permissions.create ?? true,
42
+ update: permissions.update ?? true,
43
+ delete: permissions.delete ?? true,
44
+ };
45
+ }
46
+
47
+ function readScreenAccess(): Required<ScreenPermissions> {
48
+ const items = navigationSignal.value;
49
+ const currentPage = currentPageSignal.value;
50
+ const navItem = findNavItemByPath(items, currentPage);
51
+ const permissions = completePermissions(navItem?.permissions);
52
+ return permissions;
53
+ }
54
+
55
+ /** Permissions of the current screen. */
56
+ export const screenAccessSignal = computed(readScreenAccess);
57
+
58
+ /** true when the user may do the action on the current screen. */
59
+ export function canAccess(action: ScreenAction): boolean {
60
+ const access = screenAccessSignal.value;
61
+ return access[action];
62
+ }
63
+
64
+ /** true when the user may do the action on any path (not only the current screen). */
65
+ export function canAccessPath(action: ScreenAction, currentPage: string): boolean {
66
+ const items = navigationSignal.value;
67
+ const navItem = findNavItemByPath(items, currentPage);
68
+ const permissions = completePermissions(navItem?.permissions);
69
+ return permissions[action];
70
+ }
@@ -0,0 +1,22 @@
1
+ // sidebar-service.ts
2
+ // Opens and closes the sidebar drawer on small screens.
3
+
4
+ import type { ChangeEvent } from "react";
5
+ import { isSidebarOpenSignal } from "./signals.ts";
6
+
7
+ /** Closes the drawer (called after a menu link is clicked). */
8
+ export function closeSidebar(): void {
9
+ isSidebarOpenSignal.value = false;
10
+ }
11
+
12
+ /** Opens or closes the drawer. */
13
+ export function toggleSidebar(): void {
14
+ const isOpen = isSidebarOpenSignal.value;
15
+ isSidebarOpenSignal.value = !isOpen;
16
+ }
17
+
18
+ /** Change handler for the DaisyUI drawer checkbox. */
19
+ export function handleDrawerToggleChange(event: ChangeEvent<HTMLInputElement>): void {
20
+ const checkbox = event.currentTarget;
21
+ isSidebarOpenSignal.value = checkbox.checked;
22
+ }
@@ -0,0 +1,215 @@
1
+ // signals.ts
2
+ // All global UI state of the shell, kept in @preact/signals-react signals.
3
+ //
4
+ // localeSignal current language code ("en")
5
+ // themeSignal current DaisyUI theme ("light")
6
+ // directionSignal "ltr" or "rtl" (computed from localeSignal and the config)
7
+ // translationSignal loaded messages of the current language
8
+ //
9
+ // Read a value with signalName.value.
10
+ // Change values only through changeLanguage() and changeTheme(),
11
+ // so that <html>, localStorage and translations stay in sync.
12
+
13
+ import { computed, signal } from "@preact/signals-react";
14
+ import { ConstValue } from "dff-util";
15
+ import { toPagePath } from "../query/page-path.ts";
16
+ import { resolveDirection } from "../i18n/direction.ts";
17
+ import type {
18
+ AppType,
19
+ CompanyDetails,
20
+ CustomTheme,
21
+ Direction,
22
+ LanguageOption,
23
+ LocaleMessages,
24
+ NavItem,
25
+ NavigationMode,
26
+ Theme,
27
+ UiConfig,
28
+ } from "../interfaces/ui-config.ts";
29
+ import type { ToastItem } from "../interfaces/toast.ts";
30
+ import { buildDarkThemeNames } from "../theme/dark-themes.ts";
31
+
32
+ /** The config given to <SharedWebUiProvider>. null until the provider renders. */
33
+ export const uiConfigSignal = signal<UiConfig | null>(null);
34
+
35
+ /** What the app is: <SharedWebUiProvider type="spa" | "shell" | "mfe"> (default "spa"). */
36
+ export const appTypeSignal = signal<AppType>("spa");
37
+
38
+ /** Current language code. */
39
+ export const localeSignal = signal<string>(ConstValue.EMPTY);
40
+
41
+ /** Current DaisyUI theme. */
42
+ export const themeSignal = signal<Theme>(ConstValue.LIGHT);
43
+
44
+ /** The custom themes (config.customThemes or setCustomThemes), listed first in the theme switcher. */
45
+ export const customThemesSignal = signal<CustomTheme[]>([]);
46
+
47
+ /** The company details (config.loadCompanyDetails or setCompanyDetails); null = not here yet (config values are used). */
48
+ export const companyDetailsSignal = signal<CompanyDetails | null>(null);
49
+
50
+ /** Messages of the current language. */
51
+ export const translationSignal = signal<LocaleMessages>({});
52
+
53
+ /** Messages of the fallback language, used when a key is missing. */
54
+ export const fallbackTranslationSignal = signal<LocaleMessages>({});
55
+
56
+ /** true once the first locale file has been loaded. */
57
+ export const isTranslationReadySignal = signal<boolean>(false);
58
+
59
+ /** true when the sidebar drawer is open on small screens. */
60
+ export const isSidebarOpenSignal = signal<boolean>(false);
61
+
62
+ /** true when the desktop sidebar is collapsed to an icon rail. */
63
+ export const isSidebarCollapsedSignal = signal<boolean>(false);
64
+
65
+ /** true when the menu (sidebar / mega menu bar) is shown. Change it any time with setMenuVisible(). */
66
+ export const isMenuVisibleSignal = signal<boolean>(true);
67
+
68
+ /** Current navigation items (from the config, or from setNavigation()). */
69
+ export const navigationSignal = signal<NavItem[]>([]);
70
+
71
+ /** true while the app loads its menus (the sidebar shows a skeleton). */
72
+ export const navigationLoadingSignal = signal<boolean>(false);
73
+
74
+ /** "sidebar" or "megamenu". */
75
+ export const navigationModeSignal = signal<NavigationMode>("sidebar");
76
+
77
+ /** The query parameters of the address bar ({ page: "/profiles", id: "42" }). Kept in sync by query-param.ts. */
78
+ export const queryParamsSignal = signal<Record<string, string>>({});
79
+
80
+ /** The path of the address bar ("/profiles"). Kept in sync by query-param.ts (used by layout.pageMode "path"). */
81
+ export const pathnameSignal = signal<string>("/");
82
+
83
+ /** Default name of the query parameter that holds the current page. */
84
+ export const DEFAULT_PAGE_PARAM = "page";
85
+
86
+ /** Default home page (used when ?page is missing). */
87
+ export const DEFAULT_HOME_PAGE = "/";
88
+
89
+ /** "/profiles/" -> "/profiles"; "/" or "" -> "" (= the home page). */
90
+ export function toPageFromPath(pathname: string): string {
91
+ let end = pathname.length;
92
+ while (end > 0 && pathname.charAt(end - 1) === ConstValue.SLASH) {
93
+ end = end - 1;
94
+ }
95
+ return pathname.slice(0, end);
96
+ }
97
+
98
+ /** true when pages live in the path: layout.pageMode "path", or no pageMode and the app type "shell". */
99
+ export function readIsPathPageMode(config: UiConfig | null): boolean {
100
+ const pageMode = config?.layout?.pageMode;
101
+ if (pageMode) {
102
+ return pageMode === "path";
103
+ }
104
+ return appTypeSignal.value === "shell";
105
+ }
106
+
107
+ /** config.homePath (not used by an "mfe": the shell owns the home page), else "/". */
108
+ function readHomePage(config: UiConfig | null): string {
109
+ const isMfe = appTypeSignal.value === "mfe";
110
+ if (isMfe) {
111
+ return DEFAULT_HOME_PAGE;
112
+ }
113
+ return config?.homePath ?? DEFAULT_HOME_PAGE;
114
+ }
115
+
116
+ function readCurrentPage(): string {
117
+ const config = uiConfigSignal.value;
118
+ const homePage = readHomePage(config);
119
+ const isPathMode = readIsPathPageMode(config);
120
+ if (isPathMode) {
121
+ const pathname = pathnameSignal.value;
122
+ const pathPage = toPageFromPath(pathname);
123
+ return pathPage || homePage;
124
+ }
125
+ const pageParam = config?.layout?.pageParam ?? DEFAULT_PAGE_PARAM;
126
+ const queryParams = queryParamsSignal.value;
127
+ const pageValue = queryParams[pageParam] ?? ConstValue.EMPTY;
128
+ const page = toPagePath(pageValue);
129
+ return page || homePage;
130
+ }
131
+
132
+ /**
133
+ * The current page as a menu href, from ?page=profiles (layout.pageMode "query", default) or /profiles ("path").
134
+ * No page in the address -> config.homePath.
135
+ */
136
+ export const currentPageSignal = computed(readCurrentPage);
137
+
138
+ /** id of the open mega menu group, or "" when closed. */
139
+ export const openMegaMenuIdSignal = signal<string>(ConstValue.EMPTY);
140
+
141
+ /** Open group flyout of the collapsed sidebar rail: group id and top position in px. */
142
+ /** Tooltip next to the collapsed rail (rail-tooltip.tsx): label text and the middle of the hovered icon. */
143
+ export const railTooltipSignal = signal<{ text: string; top: number }>({ text: ConstValue.EMPTY, top: 0 });
144
+ export const railFlyoutSignal = signal<{ groupId: string; top: number }>({ groupId: ConstValue.EMPTY, top: 0 });
145
+
146
+ /** true while a request runs (thin progress bar at the top). */
147
+ export const progressSignal = signal<boolean>(false);
148
+
149
+ /** true when the page is scrolled down (shows the scroll-to-top button). */
150
+ export const isScrolledSignal = signal<boolean>(false);
151
+
152
+ /** true when the settings dialog (header settings "menu" mode) is open. */
153
+ export const isSettingsOpenSignal = signal<boolean>(false);
154
+
155
+ /** Visible toast messages. */
156
+ export const toastsSignal = signal<ToastItem[]>([]);
157
+
158
+ /** Languages offered by the switchers: config.languages, or the backend list (lang prop / setLanguages). */
159
+ export const languagesSignal = signal<LanguageOption[]>([]);
160
+
161
+ function readDirection(): Direction {
162
+ const languageCode = localeSignal.value;
163
+ const languages = languagesSignal.value;
164
+ const direction = resolveDirection(languageCode, languages);
165
+ return direction;
166
+ }
167
+
168
+ /** true while an AsideLayout is on screen (no header, the sidebar is always there, no mega menu). */
169
+ export const isAsideLayoutSignal = signal<boolean>(false);
170
+
171
+ /** true on small screens (below the lg breakpoint, 1024px). Kept up to date by watchSmallScreen(). */
172
+ export const isSmallScreenSignal = signal<boolean>(false);
173
+
174
+ function readIsDesktopSidebar(): boolean {
175
+ const isMenuVisible = isMenuVisibleSignal.value;
176
+ const isSidebarMode = navigationModeSignal.value === "sidebar";
177
+ const isAsideLayout = isAsideLayoutSignal.value;
178
+ return isMenuVisible && (isSidebarMode || isAsideLayout);
179
+ }
180
+
181
+ /**
182
+ * true when a sidebar belongs on desktop screens: the menu is on and the navigation mode is "sidebar"
183
+ * (or an AsideLayout is used, which has no mega menu).
184
+ * In "megamenu" mode the header shows the menu instead; small screens always use the drawer.
185
+ * Own layouts use it to show or hide their menu column.
186
+ */
187
+ export const isDesktopSidebarSignal = computed(readIsDesktopSidebar);
188
+
189
+ function readIsRailEverywhere(): boolean {
190
+ const isAsideLayout = isAsideLayoutSignal.value;
191
+ const isSmallScreen = isSmallScreenSignal.value;
192
+ const isCollapsed = isSidebarCollapsedSignal.value;
193
+ return isAsideLayout && (isSmallScreen || isCollapsed);
194
+ }
195
+
196
+ /**
197
+ * true when the sidebar is an icon rail on EVERY screen size: AsideLayout on a small screen (always collapsed)
198
+ * or AsideLayout collapsed on desktop. The rail classes then have no "lg:" prefix.
199
+ */
200
+ export const isRailEverywhereSignal = computed(readIsRailEverywhere);
201
+
202
+ /** Current text direction, worked out from the language. */
203
+ export const directionSignal = computed(readDirection);
204
+
205
+ function readIsDarkTheme(): boolean {
206
+ const config = uiConfigSignal.value;
207
+ const theme = themeSignal.value;
208
+ const customThemes = customThemesSignal.value;
209
+ const darkThemes = buildDarkThemeNames(config?.darkThemes, customThemes);
210
+ const isDark = darkThemes.includes(theme);
211
+ return isDark;
212
+ }
213
+
214
+ /** true when the current theme is a dark theme. */
215
+ export const isDarkThemeSignal = computed(readIsDarkTheme);
@@ -0,0 +1,45 @@
1
+ // toast-service.ts
2
+ // Shows short messages in the corner of the screen.
3
+ //
4
+ // ShowToast("Saved", "success");
5
+ // ShowToast(t(ConstKeys.WENT_WRONG), "warning", 5000);
6
+ //
7
+ // <SharedWebUiProvider> already renders the ToastContainer.
8
+
9
+ import { AppUUID4 } from "dff-util";
10
+ import type { ToastItem, ToastType } from "../interfaces/toast.ts";
11
+ import { toastsSignal } from "./signals.ts";
12
+
13
+ export const DEFAULT_TOAST_DURATION_MS = 3000;
14
+
15
+ /** Removes one toast by id. */
16
+ export function removeToast(toastId: string): void {
17
+ const remainingToasts: ToastItem[] = [];
18
+ for (const toast of toastsSignal.value) {
19
+ if (toast.id !== toastId) {
20
+ remainingToasts.push(toast);
21
+ }
22
+ }
23
+ toastsSignal.value = remainingToasts;
24
+ }
25
+
26
+ /** Shows a toast. durationMs = 0 keeps it until closed. Returns the toast id. */
27
+ export function ShowToast(
28
+ message: string,
29
+ type: ToastType = "info",
30
+ durationMs: number = DEFAULT_TOAST_DURATION_MS,
31
+ ): string {
32
+ const toastId = AppUUID4();
33
+ const newToast: ToastItem = { id: toastId, message: message, type: type };
34
+ const currentToasts = toastsSignal.value;
35
+ toastsSignal.value = [...currentToasts, newToast];
36
+ if (durationMs > 0) {
37
+ setTimeout(removeToast, durationMs, toastId);
38
+ }
39
+ return toastId;
40
+ }
41
+
42
+ /** Removes every toast. */
43
+ export function clearToasts(): void {
44
+ toastsSignal.value = [];
45
+ }
package/src/styles.css ADDED
@@ -0,0 +1,15 @@
1
+ /*
2
+ shared-lib-web/styles.css
3
+ Import this file in your app CSS AFTER "tailwindcss" so Tailwind scans
4
+ the class names used inside the package:
5
+
6
+ @import "tailwindcss";
7
+ @import "shared-lib-web/styles.css";
8
+ @plugin "daisyui" { themes: all; }
9
+ */
10
+ @source "./";
11
+
12
+ /* HeadLayout: fields that scroll into view (for example the first error after Submit) stay below the sticky bars. */
13
+ html:has([data-head-layout]) {
14
+ scroll-padding-top: 9rem;
15
+ }
@@ -0,0 +1,236 @@
1
+ // custom-themes.ts
2
+ // Custom DaisyUI themes from plain data (a JSON file or an API reply) — no CSS file, no rebuild.
3
+ // The themes are an object keyed by theme name ("name" inside is optional, the key is the name):
4
+ //
5
+ // { "org-light": { "isDark": false, "name": "org-light", "variables": { "color-primary": "oklch(55.8% 0.154 249.1)", ... } },
6
+ // "org-dark": { "isDark": true, "name": "org-dark", "variables": { ... } } }
7
+ //
8
+ // A plain list [{ "name": "org-light", ... }] is accepted too.
9
+ //
10
+ // setCustomThemes(list) writes ONE <style> element:
11
+ // [data-theme="org-light"] { color-scheme: light; --color-primary: oklch(55.8% 0.154 249.1); ... }
12
+ // DaisyUI components read these CSS variables, so a custom theme works like a built-in one, and the theme switcher
13
+ // lists it first. Pass them in config.customThemes, load them lazily with config.loadThemes (like loadLocale),
14
+ // or set them any time later with setCustomThemes(json).
15
+ // The built-in DaisyUI themes still come from your CSS: @plugin "daisyui" { themes: all; }.
16
+
17
+ import type { CustomTheme, CustomThemeMap, CustomThemes, CustomThemesModule, UiConfig } from "../interfaces/ui-config.ts";
18
+ import { customThemesSignal, uiConfigSignal } from "../state/signals.ts";
19
+ import { isSignalSource } from "../utils/signal-source.ts";
20
+ import { applySavedThemeWhenKnown, leaveUnknownTheme } from "./theme-service.ts";
21
+
22
+ const STYLE_ELEMENT_ID = "shared-lib-web-custom-themes";
23
+ /** Theme names: lowercase letters, digits and "-" (they go into a CSS selector). */
24
+ const SAFE_NAME = /^[a-z0-9][a-z0-9-]*$/;
25
+ /** Variable names, with or without the leading "--". */
26
+ const SAFE_VARIABLE = /^(--)?[a-z0-9][a-z0-9-]*$/i;
27
+ /** Characters that could end the CSS rule (values come from JSON, maybe from a server). */
28
+ const UNSAFE_VALUE = /[;{}<>"\\]/;
29
+ const VARIABLE_PREFIX = "--";
30
+
31
+ /** "color-primary" -> "--color-primary" ("--color-primary" stays). */
32
+ function toVariableName(key: string): string {
33
+ const hasPrefix = key.startsWith(VARIABLE_PREFIX);
34
+ return hasPrefix ? key : `${VARIABLE_PREFIX}${key}`;
35
+ }
36
+
37
+ /** The CSS lines of the variables; unsafe names or values are skipped. */
38
+ function buildVariableLines(variables: Record<string, string>): string[] {
39
+ const lines: string[] = [];
40
+ const entries = Object.entries(variables);
41
+ for (const [key, value] of entries) {
42
+ const valueText = String(value);
43
+ const isSafeKey = SAFE_VARIABLE.test(key);
44
+ const isUnsafeValue = UNSAFE_VALUE.test(valueText);
45
+ if (!isSafeKey || isUnsafeValue) {
46
+ continue;
47
+ }
48
+ const variableName = toVariableName(key);
49
+ lines.push(` ${variableName}: ${valueText};`);
50
+ }
51
+ return lines;
52
+ }
53
+
54
+ /** true when the theme has a usable name. */
55
+ export function isValidCustomTheme(theme: CustomTheme): boolean {
56
+ const hasName = typeof theme?.name === "string";
57
+ return hasName && SAFE_NAME.test(theme.name);
58
+ }
59
+
60
+ /** The CSS rule of one custom theme: [data-theme="name"] { color-scheme: ...; --color-primary: ...; } */
61
+ export function buildCustomThemeCss(theme: CustomTheme): string {
62
+ const isValid = isValidCustomTheme(theme);
63
+ if (!isValid) {
64
+ return "";
65
+ }
66
+ const colorScheme = theme.isDark ? "dark" : "light";
67
+ const variableLines = buildVariableLines(theme.variables ?? {});
68
+ const bodyLines = [` color-scheme: ${colorScheme};`, ...variableLines];
69
+ const bodyText = bodyLines.join("\n");
70
+ return `[data-theme="${theme.name}"] {\n${bodyText}\n}`;
71
+ }
72
+
73
+ /** Writes the CSS into the one <style> element of the custom themes (created on first use). */
74
+ function writeThemeStyle(cssText: string): void {
75
+ if (typeof document === "undefined") {
76
+ return;
77
+ }
78
+ let styleElement = document.getElementById(STYLE_ELEMENT_ID);
79
+ if (!styleElement) {
80
+ styleElement = document.createElement("style");
81
+ styleElement.id = STYLE_ELEMENT_ID;
82
+ document.head.append(styleElement);
83
+ }
84
+ styleElement.textContent = cssText;
85
+ }
86
+
87
+ /** true for a plain object (not null, not a list). */
88
+ function isPlainObject(value: unknown): value is Record<string, unknown> {
89
+ const isObject = typeof value === "object" && value !== null;
90
+ return isObject && !Array.isArray(value);
91
+ }
92
+
93
+ /** The themes of an object keyed by theme name; an entry without "name" gets its key as name. */
94
+ function readThemeMapEntries(themeMap: CustomThemeMap): CustomTheme[] {
95
+ const themeList: CustomTheme[] = [];
96
+ const entries = Object.entries(themeMap);
97
+ for (const [key, entry] of entries) {
98
+ if (!isPlainObject(entry)) {
99
+ continue;
100
+ }
101
+ const hasName = typeof entry.name === "string";
102
+ const name = hasName ? entry.name : key;
103
+ themeList.push({ ...entry, name } as CustomTheme);
104
+ }
105
+ return themeList;
106
+ }
107
+
108
+ /**
109
+ * The custom themes as a list: an object keyed by theme name ({ "org-light": {...}, "org-dark": {...} }) is turned
110
+ * into a list (in key order); a list stays as it is; anything else is an empty list.
111
+ */
112
+ export function toCustomThemeList(themes?: CustomThemes | null): CustomTheme[] {
113
+ if (Array.isArray(themes)) {
114
+ return themes;
115
+ }
116
+ if (isPlainObject(themes)) {
117
+ return readThemeMapEntries(themes as CustomThemeMap);
118
+ }
119
+ return [];
120
+ }
121
+
122
+ /**
123
+ * Sets the custom themes (replaces the earlier ones): writes their CSS, adds them to the theme switcher and,
124
+ * when the saved theme is one of them, switches to it. Accepts the parsed JSON as it is — the object keyed by theme
125
+ * name, or a list; invalid entries are skipped.
126
+ */
127
+ export function setCustomThemes(themes?: CustomThemes | null): void {
128
+ const validThemes: CustomTheme[] = [];
129
+ const givenThemes = toCustomThemeList(themes);
130
+ for (const theme of givenThemes) {
131
+ const isValid = isValidCustomTheme(theme);
132
+ if (isValid) {
133
+ validThemes.push(theme);
134
+ }
135
+ }
136
+ const cssParts = validThemes.map(buildCustomThemeCss);
137
+ const cssText = cssParts.join("\n\n");
138
+ writeThemeStyle(cssText);
139
+ customThemesSignal.value = validThemes;
140
+ applySavedThemeWhenKnown();
141
+ }
142
+
143
+ /** true when the value is a JSON module ({ default: themes }), not a theme map with a theme called "default". */
144
+ function isThemesJsonModule(themesModule: CustomThemesModule): themesModule is { default: CustomThemes } {
145
+ if (!isPlainObject(themesModule)) {
146
+ return false;
147
+ }
148
+ const defaultValue = themesModule.default;
149
+ if (Array.isArray(defaultValue)) {
150
+ return true;
151
+ }
152
+ return isPlainObject(defaultValue) && !("variables" in defaultValue);
153
+ }
154
+
155
+ /** The themes inside a themes module as a list: the object keyed by name or the list, or the default export of a JSON module. */
156
+ export function unwrapThemesModule(themesModule: CustomThemesModule): CustomTheme[] {
157
+ const isJsonModule = isThemesJsonModule(themesModule);
158
+ if (isJsonModule) {
159
+ return toCustomThemeList(themesModule.default);
160
+ }
161
+ return toCustomThemeList(themesModule as CustomThemes);
162
+ }
163
+
164
+ /** baseThemes + extraThemes; a theme with the same name in extraThemes replaces the one in baseThemes. */
165
+ export function mergeCustomThemes(baseThemes: CustomTheme[], extraThemes: CustomTheme[]): CustomTheme[] {
166
+ const mergedThemes: CustomTheme[] = [];
167
+ const extraNames: string[] = [];
168
+ for (const extraTheme of extraThemes) {
169
+ extraNames.push(extraTheme?.name);
170
+ }
171
+ for (const baseTheme of baseThemes) {
172
+ const isReplaced = extraNames.includes(baseTheme.name);
173
+ if (!isReplaced) {
174
+ mergedThemes.push(baseTheme);
175
+ }
176
+ }
177
+ mergedThemes.push(...extraThemes);
178
+ return mergedThemes;
179
+ }
180
+
181
+ /** Configs whose loadThemes already ran (StrictMode mounts twice). */
182
+ const loadedConfigs = new WeakSet<UiConfig>();
183
+
184
+ /**
185
+ * Runs config.loadThemes once per config and adds the result to config.customThemes.
186
+ * When it fails, or the saved theme is not in the result, the default theme is used.
187
+ */
188
+ export async function loadConfigThemes(config: UiConfig): Promise<void> {
189
+ const loadThemes = config.loadThemes;
190
+ const isLoaded = loadedConfigs.has(config);
191
+ if (typeof loadThemes !== "function" || isLoaded) {
192
+ return;
193
+ }
194
+ loadedConfigs.add(config);
195
+ try {
196
+ const themesModule = await loadThemes();
197
+ const loadedThemes = unwrapThemesModule(themesModule);
198
+ const isConfigStillActive = uiConfigSignal.peek() === config;
199
+ if (isConfigStillActive) {
200
+ const baseThemes = toCustomThemeList(config.customThemes);
201
+ const mergedThemes = mergeCustomThemes(baseThemes, loadedThemes);
202
+ setCustomThemes(mergedThemes);
203
+ }
204
+ } catch (error) {
205
+ console.error("shared-lib-web: could not load the custom themes (config.loadThemes).", error);
206
+ }
207
+ leaveUnknownTheme();
208
+ }
209
+
210
+ /** One value of a loadThemes signal: null = not here yet; a list (or JSON module) replaces the loaded themes. */
211
+ function applyThemesFromSignal(config: UiConfig, themesModule: CustomThemesModule | null): void {
212
+ const isConfigActive = uiConfigSignal.peek() === config;
213
+ if (!themesModule || !isConfigActive) {
214
+ return;
215
+ }
216
+ const loadedThemes = unwrapThemesModule(themesModule);
217
+ const baseThemes = toCustomThemeList(config.customThemes);
218
+ const mergedThemes = mergeCustomThemes(baseThemes, loadedThemes);
219
+ setCustomThemes(mergedThemes);
220
+ leaveUnknownTheme();
221
+ }
222
+
223
+ /** Follows config.loadThemes when it is a signal. Returns the stop function (nothing to stop otherwise). */
224
+ export function followConfigThemes(config: UiConfig): () => void {
225
+ const themesSource = config.loadThemes;
226
+ if (!isSignalSource(themesSource)) {
227
+ return stopNothing;
228
+ }
229
+ const applyThemes = applyThemesFromSignal.bind(null, config);
230
+ return themesSource.subscribe(applyThemes as (value: unknown) => void);
231
+ }
232
+
233
+ /** Nothing to clean up. */
234
+ function stopNothing(): void {
235
+ return;
236
+ }