@cloudfrogger/goodui 0.0.59 → 0.0.62

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 (397) hide show
  1. package/README.md +10 -0
  2. package/ai/README.md +47 -0
  3. package/ai/case-studies/index.md +10 -0
  4. package/ai/case-studies/vpshoster.md +18 -0
  5. package/ai/case-studies/webmailer.md +21 -0
  6. package/ai/catalog/README.md +7 -0
  7. package/ai/catalog/component.schema.json +289 -0
  8. package/ai/catalog/components/div-goodDetailRow.json +33 -0
  9. package/ai/catalog/components/form-goodForm.json +84 -0
  10. package/ai/catalog/components/good-action-bar.json +83 -0
  11. package/ai/catalog/components/good-action-group.json +143 -0
  12. package/ai/catalog/components/good-action-menu.json +121 -0
  13. package/ai/catalog/components/good-alert.json +184 -0
  14. package/ai/catalog/components/good-app-layout.json +245 -0
  15. package/ai/catalog/components/good-assistant-body.json +43 -0
  16. package/ai/catalog/components/good-assistant-footer.json +43 -0
  17. package/ai/catalog/components/good-assistant-header.json +43 -0
  18. package/ai/catalog/components/good-assistant-main.json +61 -0
  19. package/ai/catalog/components/good-assistant-mobile.json +43 -0
  20. package/ai/catalog/components/good-assistant-panel.json +131 -0
  21. package/ai/catalog/components/good-avatar-menu-item.json +82 -0
  22. package/ai/catalog/components/good-avatar-menu.json +83 -0
  23. package/ai/catalog/components/good-badge.json +180 -0
  24. package/ai/catalog/components/good-bar-chart.json +118 -0
  25. package/ai/catalog/components/good-brand-icon.json +71 -0
  26. package/ai/catalog/components/good-breadcrumbs.json +102 -0
  27. package/ai/catalog/components/good-button.json +192 -0
  28. package/ai/catalog/components/good-calendar.json +430 -0
  29. package/ai/catalog/components/good-card-footer.json +63 -0
  30. package/ai/catalog/components/good-card-header.json +100 -0
  31. package/ai/catalog/components/good-card.json +57 -0
  32. package/ai/catalog/components/good-chart-axis.json +168 -0
  33. package/ai/catalog/components/good-chart-bar.json +89 -0
  34. package/ai/catalog/components/good-chart-histogram.json +78 -0
  35. package/ai/catalog/components/good-chart-line.json +89 -0
  36. package/ai/catalog/components/good-chart-scatter.json +87 -0
  37. package/ai/catalog/components/good-checkbox.json +171 -0
  38. package/ai/catalog/components/good-citation.json +62 -0
  39. package/ai/catalog/components/good-code-block.json +116 -0
  40. package/ai/catalog/components/good-color-controls.json +58 -0
  41. package/ai/catalog/components/good-color-picker.json +141 -0
  42. package/ai/catalog/components/good-column.json +53 -0
  43. package/ai/catalog/components/good-columns.json +77 -0
  44. package/ai/catalog/components/good-date-input.json +386 -0
  45. package/ai/catalog/components/good-detail-list.json +43 -0
  46. package/ai/catalog/components/good-dropdown.json +259 -0
  47. package/ai/catalog/components/good-error-page.json +133 -0
  48. package/ai/catalog/components/good-error-text.json +43 -0
  49. package/ai/catalog/components/good-expandable.json +159 -0
  50. package/ai/catalog/components/good-eyebrow.json +61 -0
  51. package/ai/catalog/components/good-field-label.json +62 -0
  52. package/ai/catalog/components/good-form-field.json +67 -0
  53. package/ai/catalog/components/good-form-row.json +70 -0
  54. package/ai/catalog/components/good-group.json +150 -0
  55. package/ai/catalog/components/good-heading-group.json +45 -0
  56. package/ai/catalog/components/good-heading.json +69 -0
  57. package/ai/catalog/components/good-hint.json +43 -0
  58. package/ai/catalog/components/good-histogram.json +103 -0
  59. package/ai/catalog/components/good-icon.json +97 -0
  60. package/ai/catalog/components/good-image-input.json +190 -0
  61. package/ai/catalog/components/good-image-preview.json +97 -0
  62. package/ai/catalog/components/good-inline-image.json +131 -0
  63. package/ai/catalog/components/good-input-phone.json +226 -0
  64. package/ai/catalog/components/good-input.json +350 -0
  65. package/ai/catalog/components/good-line-chart.json +94 -0
  66. package/ai/catalog/components/good-link.json +147 -0
  67. package/ai/catalog/components/good-listbox.json +248 -0
  68. package/ai/catalog/components/good-main-menu.json +138 -0
  69. package/ai/catalog/components/good-main-view.json +179 -0
  70. package/ai/catalog/components/good-map-color-scale.json +163 -0
  71. package/ai/catalog/components/good-map-overlay.json +136 -0
  72. package/ai/catalog/components/good-modal-footer.json +63 -0
  73. package/ai/catalog/components/good-modal-header.json +73 -0
  74. package/ai/catalog/components/good-modal.json +131 -0
  75. package/ai/catalog/components/good-month-calendar.json +170 -0
  76. package/ai/catalog/components/good-notification-host.json +46 -0
  77. package/ai/catalog/components/good-notifications.json +72 -0
  78. package/ai/catalog/components/good-number-input.json +180 -0
  79. package/ai/catalog/components/good-paragraph.json +47 -0
  80. package/ai/catalog/components/good-pdf-preview.json +153 -0
  81. package/ai/catalog/components/good-pin-input.json +211 -0
  82. package/ai/catalog/components/good-progress.json +158 -0
  83. package/ai/catalog/components/good-prose.json +43 -0
  84. package/ai/catalog/components/good-radio-group.json +181 -0
  85. package/ai/catalog/components/good-range-slider.json +285 -0
  86. package/ai/catalog/components/good-rating.json +160 -0
  87. package/ai/catalog/components/good-resizable-pane.json +61 -0
  88. package/ai/catalog/components/good-resizable.json +185 -0
  89. package/ai/catalog/components/good-rich-text-editor.json +164 -0
  90. package/ai/catalog/components/good-scatter-chart.json +94 -0
  91. package/ai/catalog/components/good-search.json +60 -0
  92. package/ai/catalog/components/good-section.json +43 -0
  93. package/ai/catalog/components/good-select-country.json +205 -0
  94. package/ai/catalog/components/good-select-font.json +111 -0
  95. package/ai/catalog/components/good-select.json +217 -0
  96. package/ai/catalog/components/good-separator.json +59 -0
  97. package/ai/catalog/components/good-settings.json +60 -0
  98. package/ai/catalog/components/good-sidebar-container.json +112 -0
  99. package/ai/catalog/components/good-sidebar-item.json +210 -0
  100. package/ai/catalog/components/good-sidebar-menu-container.json +80 -0
  101. package/ai/catalog/components/good-sidebar-submenu-group.json +98 -0
  102. package/ai/catalog/components/good-sidebar-submenu-item.json +113 -0
  103. package/ai/catalog/components/good-signature-pad.json +115 -0
  104. package/ai/catalog/components/good-sparkline.json +188 -0
  105. package/ai/catalog/components/good-status-icon.json +425 -0
  106. package/ai/catalog/components/good-subheading.json +67 -0
  107. package/ai/catalog/components/good-subnav.json +132 -0
  108. package/ai/catalog/components/good-summary.json +43 -0
  109. package/ai/catalog/components/good-switch.json +167 -0
  110. package/ai/catalog/components/good-tab.json +129 -0
  111. package/ai/catalog/components/good-table.json +294 -0
  112. package/ai/catalog/components/good-tabs.json +90 -0
  113. package/ai/catalog/components/good-textarea.json +194 -0
  114. package/ai/catalog/components/good-theme-toggle.json +57 -0
  115. package/ai/catalog/components/good-timeline-section.json +105 -0
  116. package/ai/catalog/components/good-timeline-step.json +248 -0
  117. package/ai/catalog/components/good-timeline.json +302 -0
  118. package/ai/catalog/components/good-topbar-dropdown-item.json +115 -0
  119. package/ai/catalog/components/good-topbar-dropdown-menu.json +85 -0
  120. package/ai/catalog/components/good-topbar-menu-container.json +96 -0
  121. package/ai/catalog/components/good-topbar-menu-item.json +99 -0
  122. package/ai/catalog/components/good-topbar-submenu.json +77 -0
  123. package/ai/catalog/components/good-topbar.json +259 -0
  124. package/ai/catalog/components/good-world-map.json +145 -0
  125. package/ai/catalog/components/goodCardActions.json +33 -0
  126. package/ai/catalog/components/goodDropdownFooter.json +33 -0
  127. package/ai/catalog/components/goodDropdownHeader.json +33 -0
  128. package/ai/catalog/components/goodExpandableHeader.json +33 -0
  129. package/ai/catalog/components/ng-template-goodListboxItem.json +33 -0
  130. package/ai/catalog/components/ng-template-goodTableCell.json +43 -0
  131. package/ai/catalog/index.json +1484 -0
  132. package/ai/catalog/index.schema.json +13 -0
  133. package/ai/examples/angular.json +26 -0
  134. package/ai/examples/edit-form.html +13 -0
  135. package/ai/examples/edit-form.ts +18 -0
  136. package/ai/examples/index.html +1 -0
  137. package/ai/examples/login.html +11 -0
  138. package/ai/examples/login.ts +14 -0
  139. package/ai/examples/main.ts +25 -0
  140. package/ai/examples/settings.html +10 -0
  141. package/ai/examples/settings.ts +13 -0
  142. package/ai/examples/table-view.html +3 -0
  143. package/ai/examples/table-view.ts +21 -0
  144. package/ai/examples/tsconfig.json +27 -0
  145. package/ai/guides/common-mistakes.md +9 -0
  146. package/ai/guides/component-discovery.md +17 -0
  147. package/ai/guides/design-tokens.md +10 -0
  148. package/ai/guides/layout.md +17 -0
  149. package/ai/guides/page-patterns.md +39 -0
  150. package/ai/install.mjs +25 -0
  151. package/ai/manifest.json +6 -0
  152. package/ai/skill/goodui/SKILL.md +27 -0
  153. package/angular/projects/goodui/package.json +28 -0
  154. package/angular/projects/goodui/src/action-bar.css +20 -0
  155. package/angular/projects/goodui/src/assistant-panel.css +38 -0
  156. package/angular/projects/goodui/src/calendar.css +161 -0
  157. package/angular/projects/goodui/src/chart.css +35 -0
  158. package/angular/projects/goodui/src/color-picker.css +40 -0
  159. package/angular/projects/goodui/src/error-page.css +24 -0
  160. package/angular/projects/goodui/src/lib/action-bar.ts +161 -0
  161. package/angular/projects/goodui/src/lib/action-group.ts +31 -0
  162. package/angular/projects/goodui/src/lib/action-menu.ts +81 -0
  163. package/angular/projects/goodui/src/lib/actions.ts +318 -0
  164. package/angular/projects/goodui/src/lib/alert.ts +60 -0
  165. package/angular/projects/goodui/src/lib/app-layout.ts +79 -0
  166. package/angular/projects/goodui/src/lib/assistant-panel.ts +133 -0
  167. package/angular/projects/goodui/src/lib/badge.ts +47 -0
  168. package/angular/projects/goodui/src/lib/bar-chart.html +80 -0
  169. package/angular/projects/goodui/src/lib/bar-chart.ts +233 -0
  170. package/angular/projects/goodui/src/lib/breadcrumbs.ts +81 -0
  171. package/angular/projects/goodui/src/lib/button.ts +38 -0
  172. package/angular/projects/goodui/src/lib/calendar-layout.ts +68 -0
  173. package/angular/projects/goodui/src/lib/calendar-service.ts +144 -0
  174. package/angular/projects/goodui/src/lib/calendar-working-hours.ts +65 -0
  175. package/angular/projects/goodui/src/lib/calendar.html +200 -0
  176. package/angular/projects/goodui/src/lib/calendar.ts +471 -0
  177. package/angular/projects/goodui/src/lib/card.ts +64 -0
  178. package/angular/projects/goodui/src/lib/chart-colors.ts +22 -0
  179. package/angular/projects/goodui/src/lib/chart-data.ts +269 -0
  180. package/angular/projects/goodui/src/lib/checkbox.ts +87 -0
  181. package/angular/projects/goodui/src/lib/code-block.ts +147 -0
  182. package/angular/projects/goodui/src/lib/color-controls.ts +107 -0
  183. package/angular/projects/goodui/src/lib/color-picker.ts +142 -0
  184. package/angular/projects/goodui/src/lib/color-utils.ts +69 -0
  185. package/angular/projects/goodui/src/lib/country-data.ts +16 -0
  186. package/angular/projects/goodui/src/lib/date-input.ts +542 -0
  187. package/angular/projects/goodui/src/lib/dropdown.ts +309 -0
  188. package/angular/projects/goodui/src/lib/error-page.ts +46 -0
  189. package/angular/projects/goodui/src/lib/expandable.ts +64 -0
  190. package/angular/projects/goodui/src/lib/form.ts +12 -0
  191. package/angular/projects/goodui/src/lib/goodui-config.ts +16 -0
  192. package/angular/projects/goodui/src/lib/group.ts +45 -0
  193. package/angular/projects/goodui/src/lib/histogram.html +52 -0
  194. package/angular/projects/goodui/src/lib/histogram.ts +146 -0
  195. package/angular/projects/goodui/src/lib/icon.ts +44 -0
  196. package/angular/projects/goodui/src/lib/image-input.ts +154 -0
  197. package/angular/projects/goodui/src/lib/image-preview.ts +26 -0
  198. package/angular/projects/goodui/src/lib/input-phone.ts +305 -0
  199. package/angular/projects/goodui/src/lib/input.ts +143 -0
  200. package/angular/projects/goodui/src/lib/line-chart.html +53 -0
  201. package/angular/projects/goodui/src/lib/line-chart.ts +193 -0
  202. package/angular/projects/goodui/src/lib/link.ts +46 -0
  203. package/angular/projects/goodui/src/lib/listbox.ts +254 -0
  204. package/angular/projects/goodui/src/lib/main-view.ts +39 -0
  205. package/angular/projects/goodui/src/lib/marker-colors.ts +7 -0
  206. package/angular/projects/goodui/src/lib/modal.ts +199 -0
  207. package/angular/projects/goodui/src/lib/models.ts +115 -0
  208. package/angular/projects/goodui/src/lib/month-calendar.ts +289 -0
  209. package/angular/projects/goodui/src/lib/notification-center.ts +170 -0
  210. package/angular/projects/goodui/src/lib/notification-host.ts +86 -0
  211. package/angular/projects/goodui/src/lib/number-input.ts +180 -0
  212. package/angular/projects/goodui/src/lib/pdf-preview.ts +242 -0
  213. package/angular/projects/goodui/src/lib/pdf-worker.generated.ts +2 -0
  214. package/angular/projects/goodui/src/lib/pin-input.ts +193 -0
  215. package/angular/projects/goodui/src/lib/progress.ts +93 -0
  216. package/angular/projects/goodui/src/lib/provide-goodui.ts +15 -0
  217. package/angular/projects/goodui/src/lib/radio-group.ts +94 -0
  218. package/angular/projects/goodui/src/lib/range-slider.ts +313 -0
  219. package/angular/projects/goodui/src/lib/rating.ts +90 -0
  220. package/angular/projects/goodui/src/lib/required-control.ts +4 -0
  221. package/angular/projects/goodui/src/lib/resizable.ts +168 -0
  222. package/angular/projects/goodui/src/lib/rich-text-command.ts +111 -0
  223. package/angular/projects/goodui/src/lib/rich-text-editor.html +193 -0
  224. package/angular/projects/goodui/src/lib/rich-text-editor.ts +864 -0
  225. package/angular/projects/goodui/src/lib/rich-text-sanitize.ts +99 -0
  226. package/angular/projects/goodui/src/lib/scatter-chart.html +48 -0
  227. package/angular/projects/goodui/src/lib/scatter-chart.ts +150 -0
  228. package/angular/projects/goodui/src/lib/select-country.ts +104 -0
  229. package/angular/projects/goodui/src/lib/select-font.ts +189 -0
  230. package/angular/projects/goodui/src/lib/select.ts +336 -0
  231. package/angular/projects/goodui/src/lib/sidebar.ts +232 -0
  232. package/angular/projects/goodui/src/lib/signature-pad.ts +238 -0
  233. package/angular/projects/goodui/src/lib/sparkline.html +15 -0
  234. package/angular/projects/goodui/src/lib/sparkline.ts +106 -0
  235. package/angular/projects/goodui/src/lib/status-icon.ts +79 -0
  236. package/angular/projects/goodui/src/lib/subnav.ts +156 -0
  237. package/angular/projects/goodui/src/lib/switch.ts +54 -0
  238. package/angular/projects/goodui/src/lib/table.ts +538 -0
  239. package/angular/projects/goodui/src/lib/tabs.ts +251 -0
  240. package/angular/projects/goodui/src/lib/textarea.ts +83 -0
  241. package/angular/projects/goodui/src/lib/theme.ts +49 -0
  242. package/angular/projects/goodui/src/lib/timeline.ts +252 -0
  243. package/angular/projects/goodui/src/lib/topbar.ts +402 -0
  244. package/angular/projects/goodui/src/lib/typography.ts +250 -0
  245. package/angular/projects/goodui/src/lib/world-map-data.ts +3 -0
  246. package/angular/projects/goodui/src/lib/world-map.html +73 -0
  247. package/angular/projects/goodui/src/lib/world-map.ts +391 -0
  248. package/angular/projects/goodui/src/month-calendar.css +47 -0
  249. package/angular/projects/goodui/src/pdf-preview.css +25 -0
  250. package/angular/projects/goodui/src/progress.css +38 -0
  251. package/angular/projects/goodui/src/public-api.ts +74 -0
  252. package/angular/projects/goodui/src/range-slider.css +54 -0
  253. package/angular/projects/goodui/src/resizable.css +32 -0
  254. package/angular/projects/goodui/src/rich-text-editor.css +33 -0
  255. package/angular/projects/goodui/src/select-font.css +16 -0
  256. package/angular/projects/goodui/src/signature-pad.css +14 -0
  257. package/angular/projects/goodui/src/styles.css +1105 -0
  258. package/angular/projects/goodui/src/timeline.css +138 -0
  259. package/angular/projects/goodui/src/tokens.generated.css +754 -0
  260. package/design/component-map.json +2233 -0
  261. package/design-tokens/penpot.tokens.json +3339 -0
  262. package/design.md +452 -0
  263. package/guides/README.md +17 -0
  264. package/guides/components/action-bar.md +43 -0
  265. package/guides/components/action-group.md +43 -0
  266. package/guides/components/action-menu.md +22 -0
  267. package/guides/components/alert.md +28 -0
  268. package/guides/components/assistant-panel.md +50 -0
  269. package/guides/components/avatar-menu.md +34 -0
  270. package/guides/components/badge.md +39 -0
  271. package/guides/components/bar-chart.md +40 -0
  272. package/guides/components/breadcrumbs.md +37 -0
  273. package/guides/components/button.md +40 -0
  274. package/guides/components/calendar.md +166 -0
  275. package/guides/components/card.md +62 -0
  276. package/guides/components/chart-axis.md +5 -0
  277. package/guides/components/chart-bar.md +5 -0
  278. package/guides/components/chart-data.md +58 -0
  279. package/guides/components/chart-histogram.md +16 -0
  280. package/guides/components/chart-line.md +5 -0
  281. package/guides/components/chart-scatter.md +14 -0
  282. package/guides/components/checkbox.md +36 -0
  283. package/guides/components/code-block.md +35 -0
  284. package/guides/components/color-controls.md +22 -0
  285. package/guides/components/column.md +5 -0
  286. package/guides/components/columns.md +13 -0
  287. package/guides/components/date-input.md +62 -0
  288. package/guides/components/detail-list.md +25 -0
  289. package/guides/components/dropdown.md +48 -0
  290. package/guides/components/error-page.md +31 -0
  291. package/guides/components/expandable.md +36 -0
  292. package/guides/components/form.md +49 -0
  293. package/guides/components/group.md +41 -0
  294. package/guides/components/histogram.md +45 -0
  295. package/guides/components/icon.md +13 -0
  296. package/guides/components/image-input.md +34 -0
  297. package/guides/components/input-phone.md +45 -0
  298. package/guides/components/input.md +59 -0
  299. package/guides/components/line-chart.md +37 -0
  300. package/guides/components/link.md +31 -0
  301. package/guides/components/listbox.md +109 -0
  302. package/guides/components/main-menu.md +11 -0
  303. package/guides/components/main-view.md +21 -0
  304. package/guides/components/modal.md +58 -0
  305. package/guides/components/month-calendar.md +88 -0
  306. package/guides/components/notifications.md +76 -0
  307. package/guides/components/number-input.md +21 -0
  308. package/guides/components/pdf-preview.md +38 -0
  309. package/guides/components/pin-input.md +37 -0
  310. package/guides/components/progress.md +41 -0
  311. package/guides/components/radio-group.md +41 -0
  312. package/guides/components/range-slider.md +42 -0
  313. package/guides/components/rating.md +39 -0
  314. package/guides/components/resizable-pane.md +3 -0
  315. package/guides/components/resizable.md +75 -0
  316. package/guides/components/rich-text-editor.md +113 -0
  317. package/guides/components/scatter-chart.md +43 -0
  318. package/guides/components/search.md +9 -0
  319. package/guides/components/select-font.md +16 -0
  320. package/guides/components/select.md +65 -0
  321. package/guides/components/settings.md +11 -0
  322. package/guides/components/sidebar.md +47 -0
  323. package/guides/components/signature-pad.md +45 -0
  324. package/guides/components/sparkline.md +31 -0
  325. package/guides/components/status-icon.md +32 -0
  326. package/guides/components/submenus.md +30 -0
  327. package/guides/components/subnav.md +54 -0
  328. package/guides/components/switch.md +48 -0
  329. package/guides/components/table.md +256 -0
  330. package/guides/components/tabs.md +46 -0
  331. package/guides/components/textarea.md +44 -0
  332. package/guides/components/theme-toggle.md +33 -0
  333. package/guides/components/timeline-section.md +7 -0
  334. package/guides/components/timeline-step.md +12 -0
  335. package/guides/components/timeline.md +179 -0
  336. package/guides/components/topbar.md +83 -0
  337. package/guides/components/typography.md +155 -0
  338. package/guides/components/world-map.md +72 -0
  339. package/guides/contributing/design-to-code.md +261 -0
  340. package/guides/deployment/drone.md +77 -0
  341. package/guides/examples/user-registration.md +11 -0
  342. package/guides/foundations/naming.md +7 -0
  343. package/guides/foundations/tokens.md +203 -0
  344. package/guides/intro.md +80 -0
  345. package/guides/layout/app-layout.md +64 -0
  346. package/guides/layout/layout-rules.md +16 -0
  347. package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.html +22 -0
  348. package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.ts +111 -0
  349. package/homepage/src/app/examples/calendar-workspace/source-code.generated.ts +3 -0
  350. package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.html +166 -0
  351. package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.ts +134 -0
  352. package/homepage/src/app/examples/case-studies/cloudhoster/cloudhoster-store.ts +92 -0
  353. package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.html +93 -0
  354. package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.ts +115 -0
  355. package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.html +202 -0
  356. package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.ts +143 -0
  357. package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.html +70 -0
  358. package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.ts +44 -0
  359. package/homepage/src/app/examples/case-studies/cloudhoster/home-page.html +70 -0
  360. package/homepage/src/app/examples/case-studies/cloudhoster/home-page.ts +32 -0
  361. package/homepage/src/app/examples/case-studies/cloudhoster/source-code.generated.ts +12 -0
  362. package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.html +208 -0
  363. package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.ts +214 -0
  364. package/homepage/src/app/examples/case-studies/vpshoster/overview-page.html +35 -0
  365. package/homepage/src/app/examples/case-studies/vpshoster/overview-page.ts +17 -0
  366. package/homepage/src/app/examples/case-studies/vpshoster/servers-page.html +111 -0
  367. package/homepage/src/app/examples/case-studies/vpshoster/servers-page.ts +206 -0
  368. package/homepage/src/app/examples/case-studies/vpshoster/source-code.generated.ts +6 -0
  369. package/homepage/src/app/examples/case-studies/vpshoster/vps-store.ts +92 -0
  370. package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.html +35 -0
  371. package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.ts +17 -0
  372. package/homepage/src/app/examples/error-pages/error-pages-example-page.html +27 -0
  373. package/homepage/src/app/examples/error-pages/error-pages-example-page.ts +34 -0
  374. package/homepage/src/app/examples/error-pages/not-found-page.html +8 -0
  375. package/homepage/src/app/examples/error-pages/not-found-page.ts +19 -0
  376. package/homepage/src/app/examples/error-pages/server-error-page.html +8 -0
  377. package/homepage/src/app/examples/error-pages/server-error-page.ts +20 -0
  378. package/homepage/src/app/examples/error-pages/source-code.generated.ts +7 -0
  379. package/homepage/src/app/examples/mail-compose/mail-compose-page.html +25 -0
  380. package/homepage/src/app/examples/mail-compose/mail-compose-page.ts +28 -0
  381. package/homepage/src/app/examples/mail-workspace/mail-workspace-page.html +59 -0
  382. package/homepage/src/app/examples/mail-workspace/mail-workspace-page.ts +128 -0
  383. package/homepage/src/app/examples/mail-workspace/source-code.generated.ts +3 -0
  384. package/homepage/src/app/examples/notifications/notifications-page.html +51 -0
  385. package/homepage/src/app/examples/notifications/notifications-page.ts +133 -0
  386. package/homepage/src/app/examples/notifications/source-code.generated.ts +3 -0
  387. package/homepage/src/app/examples/pdf-reader/pdf-reader-page.html +27 -0
  388. package/homepage/src/app/examples/pdf-reader/pdf-reader-page.ts +39 -0
  389. package/homepage/src/app/examples/pdf-reader/source-code.generated.ts +3 -0
  390. package/homepage/src/app/examples/user-registration/source-code.generated.ts +5 -0
  391. package/homepage/src/app/examples/user-registration/user-registration-example-page.html +11 -0
  392. package/homepage/src/app/examples/user-registration/user-registration-example-page.ts +21 -0
  393. package/homepage/src/app/examples/user-registration/user-registration-form.html +116 -0
  394. package/homepage/src/app/examples/user-registration/user-registration-form.ts +93 -0
  395. package/homepage/src/app/examples/user-registration/user-registration-page.html +11 -0
  396. package/homepage/src/app/examples/user-registration/user-registration-page.ts +23 -0
  397. package/package.json +2 -2
@@ -0,0 +1,238 @@
1
+ import { ChangeDetectionStrategy, Component, ElementRef, computed, forwardRef, input, model, output, signal, viewChild } from '@angular/core';
2
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import { GoodButtonComponent } from './button';
4
+
5
+ /** One sampled point. X and Y are CSS pixels in the recorded surface; t is milliseconds since the first contact. */
6
+ export interface GoodSignaturePoint {
7
+ x: number;
8
+ y: number;
9
+ t: number;
10
+ pressure: number;
11
+ }
12
+
13
+ /** A continuous pointer-down to pointer-up trace. */
14
+ export interface GoodSignatureStroke {
15
+ pointerType: 'pen' | 'touch' | 'mouse';
16
+ points: readonly GoodSignaturePoint[];
17
+ }
18
+
19
+ /** InkML-inspired X/Y/T/F samples with an explicit canvas and UTC start time. This object is not InkML XML. */
20
+ export interface GoodSignatureData {
21
+ version: 1;
22
+ capturedAt: string;
23
+ width: number;
24
+ height: number;
25
+ strokes: readonly GoodSignatureStroke[];
26
+ }
27
+
28
+ function dimension(value: number): number | null {
29
+ return Number.isFinite(value) && value > 0 && value <= 8192 ? Math.round(value * 100) / 100 : null;
30
+ }
31
+
32
+ function number(value: number, max: number): string {
33
+ return String(Math.round(Math.max(0, Math.min(max, value)) * 100) / 100);
34
+ }
35
+
36
+ function safePoints(stroke: GoodSignatureStroke, width: number, height: number): GoodSignaturePoint[] {
37
+ if (!Array.isArray(stroke?.points)) return [];
38
+ return stroke.points.filter(point => point && Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.t))
39
+ .map(point => ({ ...point, x: Math.max(0, Math.min(width, point.x)), y: Math.max(0, Math.min(height, point.y)) }));
40
+ }
41
+
42
+ export function goodSignaturePath(stroke: GoodSignatureStroke, width: number, height: number): string {
43
+ const points = safePoints(stroke, width, height);
44
+ return points.map((point, index) => `${index ? 'L' : 'M'}${number(point.x, width)} ${number(point.y, height)}`).join(' ');
45
+ }
46
+
47
+ /** Standalone, fixed-ink SVG suitable for saving; returns an empty string for an empty signature. */
48
+ export function goodSignatureSvg(data: GoodSignatureData | null): string {
49
+ const width = dimension(data?.width ?? NaN), height = dimension(data?.height ?? NaN);
50
+ if (!data || !width || !height || !Array.isArray(data.strokes) || !data.strokes.some(stroke => safePoints(stroke, width, height).length)) return '';
51
+ const strokes = data.strokes.map(stroke => {
52
+ const points = safePoints(stroke, width, height);
53
+ if (!points.length) return '';
54
+ if (points.length === 1) return `<circle cx="${number(points[0].x, width)}" cy="${number(points[0].y, height)}" r="1.35" fill="#111827" stroke="none"/>`;
55
+ return `<path d="${goodSignaturePath(stroke, width, height)}"/>`;
56
+ }).join('');
57
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" fill="none" stroke="#111827" stroke-width="2.7" stroke-linecap="round" stroke-linejoin="round">${strokes}</svg>`;
58
+ }
59
+
60
+ /** Standards-based interchange when a consumer needs InkML rather than the GoodUI JSON object. */
61
+ export function goodSignatureInkml(data: GoodSignatureData | null): string {
62
+ const width = dimension(data?.width ?? NaN), height = dimension(data?.height ?? NaN);
63
+ if (!data || !width || !height || !Array.isArray(data.strokes)) return '';
64
+ const timestamp = Date.parse(data.capturedAt);
65
+ if (!Number.isFinite(timestamp)) return '';
66
+ const traces = data.strokes.map(stroke => {
67
+ const points = safePoints(stroke, width, height);
68
+ return points.length ? `<trace>${points.map(point => `${number(point.x, width)} ${number(point.y, height)} ${number(point.t, Number.MAX_SAFE_INTEGER)} ${number(Number.isFinite(point.pressure) ? point.pressure : .5, 1)}`).join(', ')}</trace>` : '';
69
+ }).join('');
70
+ if (!traces) return '';
71
+ return `<ink xmlns="http://www.w3.org/2003/InkML"><timestamp xml:id="start" timeString="${new Date(timestamp).toISOString()}"/><traceFormat><channel name="X" type="decimal" units="dev"/><channel name="Y" type="decimal" units="dev"/><channel name="T" type="decimal" units="ms" respectTo="#start"/><channel name="F" type="decimal" units="%"/></traceFormat>${traces}</ink>`;
72
+ }
73
+
74
+ @Component({
75
+ selector: 'good-signature-pad',
76
+ standalone: true,
77
+ imports: [GoodButtonComponent],
78
+ changeDetection: ChangeDetectionStrategy.OnPush,
79
+ host: { class: 'good-signature-pad', '[attr.data-disabled]': 'isDisabled()', '[attr.data-readonly]': 'readonly()', '[attr.data-empty]': '!hasInk()' },
80
+ providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GoodSignaturePadComponent), multi: true }],
81
+ template: `
82
+ <div class="good-signature-pad-header">
83
+ <span class="good-signature-pad-label">{{ label() }}</span>
84
+ @if (showClear()) {
85
+ <good-button variant="outline" size="small" ariaLabel="Clear signature" [disabled]="isDisabled() || readonly() || !hasInk()" (click)="clear()">Clear</good-button>
86
+ }
87
+ </div>
88
+ <div #surface class="good-signature-pad-surface" [style.height.px]="height()" role="img"
89
+ [attr.aria-label]="label() + ' drawing area'" [attr.aria-disabled]="isDisabled() || null"
90
+ (pointerdown)="onPointerDown($event)" (pointermove)="onPointerMove($event)"
91
+ (pointerup)="onPointerUp($event)" (pointercancel)="onPointerCancel($event)"
92
+ (lostpointercapture)="onLostCapture($event)">
93
+ @if (!hasInk()) { <span class="good-signature-pad-placeholder">Sign here</span> }
94
+ <svg class="good-signature-pad-ink" [attr.viewBox]="viewBox()" preserveAspectRatio="xMidYMid meet" aria-hidden="true">
95
+ @for (stroke of displayStrokes(); track $index) {
96
+ @if (stroke.points.length === 1) {
97
+ <circle [attr.cx]="stroke.points[0].x" [attr.cy]="stroke.points[0].y" r="1.35" />
98
+ } @else if (stroke.points.length > 1) {
99
+ <path [attr.d]="path(stroke)" />
100
+ }
101
+ }
102
+ </svg>
103
+ <span class="good-signature-pad-baseline" aria-hidden="true"></span>
104
+ <span class="good-signature-pad-hint">Use a finger, pen, or mouse</span>
105
+ </div>
106
+ `,
107
+ })
108
+ export class GoodSignaturePadComponent implements ControlValueAccessor {
109
+ private readonly surface = viewChild<ElementRef<HTMLElement>>('surface');
110
+ private pointerId: number | null = null;
111
+ private timeOrigin = 0;
112
+ private capturedAt = '';
113
+ private onChange: (value: GoodSignatureData | null) => void = () => {};
114
+ private onTouched: () => void = () => {};
115
+ private readonly formDisabled = signal(false);
116
+
117
+ readonly label = input('Signature');
118
+ readonly height = input(180);
119
+ readonly disabled = input(false);
120
+ readonly readonly = input(false);
121
+ readonly showClear = input(true);
122
+ readonly value = model<GoodSignatureData | null>(null);
123
+ readonly svgChange = output<string>();
124
+ readonly strokeCompleted = output<GoodSignatureStroke>();
125
+ readonly draft = signal<GoodSignatureStroke | null>(null);
126
+ private readonly captureSize = signal({ width: 600, height: 180 });
127
+ readonly isDisabled = computed(() => this.disabled() || this.formDisabled());
128
+ readonly hasInk = computed(() => !!this.value()?.strokes.some(stroke => stroke.points.length) || !!this.draft()?.points.length);
129
+ readonly svg = computed(() => goodSignatureSvg(this.value()));
130
+ readonly inkml = computed(() => goodSignatureInkml(this.value()));
131
+ readonly viewBox = computed(() => {
132
+ const size = this.value() ?? this.captureSize();
133
+ return `0 0 ${dimension(size.width) ?? 600} ${dimension(size.height) ?? 180}`;
134
+ });
135
+ readonly displayStrokes = computed(() => [...(this.value()?.strokes ?? []), ...(this.draft() ? [this.draft()!] : [])]);
136
+
137
+ path(stroke: GoodSignatureStroke): string {
138
+ const size = this.value() ?? this.captureSize();
139
+ return goodSignaturePath(stroke, dimension(size.width) ?? 600, dimension(size.height) ?? 180);
140
+ }
141
+
142
+ onPointerDown(event: PointerEvent): void {
143
+ if (this.isDisabled() || this.readonly() || this.pointerId !== null || !event.isPrimary || (event.pointerType === 'mouse' && event.button !== 0)) return;
144
+ const surface = this.surface()?.nativeElement;
145
+ if (!surface) return;
146
+ event.preventDefault();
147
+ const bounds = surface.getBoundingClientRect();
148
+ if (!this.value()) this.captureSize.set({ width: Math.max(1, bounds.width), height: Math.max(1, bounds.height) });
149
+ if (!this.value()) {
150
+ this.timeOrigin = event.timeStamp;
151
+ this.capturedAt = new Date().toISOString();
152
+ } else if (!this.timeOrigin) {
153
+ const lastTime = this.value()!.strokes.at(-1)?.points.at(-1)?.t ?? -1;
154
+ this.timeOrigin = event.timeStamp - Math.max(0, lastTime + 1);
155
+ }
156
+ this.pointerId = event.pointerId;
157
+ const pointerType = event.pointerType === 'pen' || event.pointerType === 'touch' ? event.pointerType : 'mouse';
158
+ this.draft.set({ pointerType, points: [this.point(event)] });
159
+ surface.setPointerCapture(event.pointerId);
160
+ }
161
+
162
+ onPointerMove(event: PointerEvent): void {
163
+ if (event.pointerId !== this.pointerId) return;
164
+ event.preventDefault();
165
+ const samples = typeof event.getCoalescedEvents === 'function' ? event.getCoalescedEvents() : [];
166
+ for (const sample of samples.length ? samples : [event]) this.appendPoint(sample);
167
+ if (samples.length) this.appendPoint(event);
168
+ }
169
+
170
+ onPointerUp(event: PointerEvent): void {
171
+ if (event.pointerId !== this.pointerId) return;
172
+ this.appendPoint(event);
173
+ this.finishStroke();
174
+ }
175
+
176
+ onPointerCancel(event: PointerEvent): void { if (event.pointerId === this.pointerId) this.finishStroke(); }
177
+ onLostCapture(event: PointerEvent): void { if (event.pointerId === this.pointerId) this.finishStroke(); }
178
+
179
+ private point(event: PointerEvent): GoodSignaturePoint {
180
+ const bounds = this.surface()!.nativeElement.getBoundingClientRect();
181
+ const size = this.value() ?? this.captureSize();
182
+ const width = dimension(size.width) ?? 600, height = dimension(size.height) ?? 180;
183
+ const scale = Math.min(bounds.width / width, bounds.height / height) || 1;
184
+ const offsetX = (bounds.width - width * scale) / 2, offsetY = (bounds.height - height * scale) / 2;
185
+ return {
186
+ x: Math.round(Math.max(0, Math.min(width, (event.clientX - bounds.left - offsetX) / scale)) * 100) / 100,
187
+ y: Math.round(Math.max(0, Math.min(height, (event.clientY - bounds.top - offsetY) / scale)) * 100) / 100,
188
+ t: Math.round(Math.max(0, event.timeStamp - this.timeOrigin) * 100) / 100,
189
+ pressure: Math.round(Math.max(0, Math.min(1, event.pressure)) * 1000) / 1000,
190
+ };
191
+ }
192
+
193
+ private appendPoint(event: PointerEvent): void {
194
+ const current = this.draft();
195
+ if (!current) return;
196
+ const next = this.point(event), previous = current.points.at(-1);
197
+ if (previous && previous.x === next.x && previous.y === next.y && previous.t === next.t) return;
198
+ this.draft.set({ ...current, points: [...current.points, next] });
199
+ }
200
+
201
+ private finishStroke(): void {
202
+ const stroke = this.draft(), surface = this.surface()?.nativeElement, pointerId = this.pointerId;
203
+ this.pointerId = null;
204
+ this.draft.set(null);
205
+ if (surface && pointerId !== null && surface.hasPointerCapture(pointerId)) surface.releasePointerCapture(pointerId);
206
+ if (!stroke?.points.length) return;
207
+ const existing = this.value(), size = existing ?? this.captureSize();
208
+ const value: GoodSignatureData = {
209
+ version: 1, capturedAt: existing?.capturedAt ?? this.capturedAt,
210
+ width: size.width, height: size.height, strokes: [...(existing?.strokes ?? []), stroke],
211
+ };
212
+ this.value.set(value);
213
+ this.onChange(value);
214
+ this.onTouched();
215
+ this.strokeCompleted.emit(stroke);
216
+ this.svgChange.emit(goodSignatureSvg(value));
217
+ }
218
+
219
+ clear(): void {
220
+ if (this.isDisabled() || this.readonly()) return;
221
+ const surface = this.surface()?.nativeElement;
222
+ const pointerId = this.pointerId;
223
+ this.pointerId = null;
224
+ if (surface && pointerId !== null && surface.hasPointerCapture(pointerId)) surface.releasePointerCapture(pointerId);
225
+ this.timeOrigin = 0;
226
+ this.capturedAt = '';
227
+ this.draft.set(null);
228
+ this.value.set(null);
229
+ this.onChange(null);
230
+ this.onTouched();
231
+ this.svgChange.emit('');
232
+ }
233
+
234
+ writeValue(value: GoodSignatureData | null): void { this.timeOrigin = 0; this.capturedAt = ''; this.value.set(value ?? null); }
235
+ registerOnChange(fn: (value: GoodSignatureData | null) => void): void { this.onChange = fn; }
236
+ registerOnTouched(fn: () => void): void { this.onTouched = fn; }
237
+ setDisabledState(disabled: boolean): void { this.formDisabled.set(disabled); }
238
+ }
@@ -0,0 +1,15 @@
1
+ @if (errors().length) {
2
+ <span class="good-sparkline-message" role="alert" [attr.title]="errors().join(' ')">Invalid data</span>
3
+ } @else if (!points().length) {
4
+ <span class="good-sparkline-message" role="status">No data</span>
5
+ } @else {
6
+ <svg [attr.viewBox]="'0 0 ' + chartWidth() + ' ' + chartHeight()" role="img"
7
+ [attr.aria-label]="description()" preserveAspectRatio="xMidYMid meet">
8
+ <path class="good-sparkline-path" [attr.d]="path()" [attr.stroke]="colorValue()"
9
+ [attr.stroke-width]="strokeWidth()" />
10
+ @if (showEndpoint() && endpoint(); as end) {
11
+ <circle class="good-sparkline-endpoint" [attr.cx]="end.x" [attr.cy]="end.y"
12
+ [attr.r]="dotRadius()" [attr.stroke]="colorValue()" />
13
+ }
14
+ </svg>
15
+ }
@@ -0,0 +1,106 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
2
+ import { resolveChartColor } from './chart-colors';
3
+ import { GoodChartAggregation, GoodChartAxisType, GoodChartDataSource, GoodChartTimeGroup, resolveChartSeries } from './chart-data';
4
+
5
+ export type GoodSparklineSize = 'small' | 'default' | 'large';
6
+
7
+ const dimensions: Record<GoodSparklineSize, { width: number; height: number; padding: number; stroke: number; dot: number }> = {
8
+ small: { width: 88, height: 24, padding: 3, stroke: 1.75, dot: 2 },
9
+ default: { width: 128, height: 32, padding: 4, stroke: 2, dot: 2.5 },
10
+ large: { width: 180, height: 48, padding: 5, stroke: 2.5, dot: 3 },
11
+ };
12
+
13
+ /** A compact single-series trend built from the shared typed chart source. */
14
+ @Component({
15
+ selector: 'good-sparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
16
+ host: { class: 'good-sparkline', '[attr.data-size]': 'size()', '[style.width.px]': 'chartWidth()', '[style.height.px]': 'chartHeight()' },
17
+ templateUrl: './sparkline.html',
18
+ })
19
+ export class GoodSparklineComponent {
20
+ readonly source = input.required<GoodChartDataSource>();
21
+ readonly yKey = input.required<string>();
22
+ readonly xKey = input('');
23
+ readonly size = input<GoodSparklineSize>('default');
24
+ /** Set a custom pixel width; otherwise the selected size supplies a compact width. */
25
+ readonly width = input<number | null>(null);
26
+ readonly color = input('');
27
+ readonly min = input<number | null>(null);
28
+ readonly max = input<number | null>(null);
29
+ readonly groupBy = input<GoodChartTimeGroup | null>(null);
30
+ readonly aggregate = input<GoodChartAggregation>('none');
31
+ readonly showEndpoint = input(true);
32
+ readonly ariaLabel = input('');
33
+
34
+ readonly chartWidth = computed(() => {
35
+ const requested = this.width();
36
+ return requested !== null && Number.isFinite(requested) ? Math.max(48, Math.min(600, requested)) : dimensions[this.size()].width;
37
+ });
38
+ readonly chartHeight = computed(() => dimensions[this.size()].height);
39
+ readonly padding = computed(() => dimensions[this.size()].padding);
40
+ readonly strokeWidth = computed(() => dimensions[this.size()].stroke);
41
+ readonly dotRadius = computed(() => dimensions[this.size()].dot);
42
+ readonly colorValue = computed(() => resolveChartColor(this.color(), [], 0));
43
+
44
+ readonly xAxisType = computed<GoodChartAxisType>(() => {
45
+ const key = this.source().keys.find(item => item.key === this.xKey());
46
+ if (!key) return 'number';
47
+ if (key.type === 'category') return 'category';
48
+ if (key.type === 'date' || key.type === 'datetime') return 'time';
49
+ return 'number';
50
+ });
51
+ readonly resolved = computed(() => resolveChartSeries(
52
+ [this.source()], [{ source: this.source().id, xKey: this.xKey() || undefined, yKey: this.yKey() }],
53
+ { type: this.xAxisType(), groupBy: this.groupBy(), aggregate: this.aggregate() }, 'Sparkline',
54
+ ));
55
+ readonly points = computed(() => this.resolved().lines[0]?.points ?? []);
56
+ readonly errors = computed(() => {
57
+ const bounds = this.min() !== null && this.max() !== null && this.min()! >= this.max()!
58
+ ? ['Sparkline: min must be smaller than max.'] : [];
59
+ return [...this.resolved().errors, ...bounds];
60
+ });
61
+ readonly yDomain = computed<[number, number]>(() => {
62
+ const values = this.points().map(point => point.y);
63
+ const low = values.length ? Math.min(...values) : 0;
64
+ const high = values.length ? Math.max(...values) : 1;
65
+ const padding = Math.max(.5, (high - low) * .08);
66
+ const min = this.min() ?? low - padding;
67
+ const max = this.max() ?? high + padding;
68
+ return min < max ? [min, max] : [min - 1, min + 1];
69
+ });
70
+ readonly xValues = computed(() => this.points().map(point => point.x));
71
+ readonly path = computed(() => this.points().map((point, index) =>
72
+ `${index ? 'L' : 'M'}${this.xPosition(point.x).toFixed(2)},${this.yPosition(point.y).toFixed(2)}`).join(' '));
73
+ readonly endpoint = computed(() => {
74
+ const last = this.points().at(-1);
75
+ return last ? { x: this.xPosition(last.x), y: this.yPosition(last.y) } : null;
76
+ });
77
+ readonly description = computed(() => {
78
+ if (this.ariaLabel().trim()) return this.ariaLabel().trim();
79
+ const key = this.source().keys.find(item => item.key === this.yKey());
80
+ const name = key?.label || this.yKey();
81
+ const points = this.points();
82
+ if (!points.length) return `${name}: no data`;
83
+ const first = points[0].y;
84
+ const last = points[points.length - 1].y;
85
+ const unit = key?.unit ? ` ${key.unit}` : '';
86
+ return `${name} trend: ${points.length} values, from ${first}${unit} to ${last}${unit}`;
87
+ });
88
+
89
+ xPosition(value: string | number): number {
90
+ const points = this.points();
91
+ const inner = this.chartWidth() - this.padding() * 2;
92
+ if (this.xAxisType() === 'category') {
93
+ const index = this.xValues().indexOf(value);
94
+ return points.length < 2 ? this.chartWidth() / 2 : this.padding() + index * inner / (points.length - 1);
95
+ }
96
+ const values = this.xValues().map(Number);
97
+ const min = Math.min(...values);
98
+ const max = Math.max(...values);
99
+ return min === max ? this.chartWidth() / 2 : this.padding() + (Number(value) - min) * inner / (max - min);
100
+ }
101
+ yPosition(value: number): number {
102
+ const [min, max] = this.yDomain();
103
+ const clamped = Math.max(min, Math.min(max, value));
104
+ return this.padding() + (max - clamped) * (this.chartHeight() - this.padding() * 2) / (max - min);
105
+ }
106
+ }
@@ -0,0 +1,79 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
2
+
3
+ export type GoodStatusIconStatus = 'completed' | 'pending' | 'progressing' | 'revising' | 'dismissed' | 'error';
4
+ export type GoodStatusIconAppearance = 'plain' | 'led' | 'clock' | 'clock-mono' | 'circle' | 'circle-mono' | 'symbol';
5
+ export type GoodStatusIconSize = 'small' | 'default' | 'large';
6
+
7
+ @Component({
8
+ selector: 'good-status-icon',
9
+ standalone: true,
10
+ changeDetection: ChangeDetectionStrategy.OnPush,
11
+ host: {
12
+ class: 'good-status-icon',
13
+ '[attr.data-status]': 'status()',
14
+ '[attr.data-appearance]': 'appearance()',
15
+ '[attr.data-size]': 'size()',
16
+ '[attr.data-disabled]': 'disabled()',
17
+ '[attr.role]': "decorative() ? null : 'img'",
18
+ '[attr.aria-hidden]': "decorative() ? 'true' : null",
19
+ '[attr.aria-label]': 'decorative() ? null : accessibleLabel()',
20
+ },
21
+ template: `
22
+ @switch (appearance()) {
23
+ @case ('plain') { <span class="good-status-icon-dot" aria-hidden="true"></span> }
24
+ @case ('led') { <span class="good-status-icon-led" aria-hidden="true"></span> }
25
+ @case ('clock') {
26
+ <svg class="good-status-icon-svg good-status-icon-clock" viewBox="0 0 24 24" aria-hidden="true">
27
+ <circle cx="12" cy="12" r="10" />
28
+ <path d="M12 6.5v5.5l3.5 2" />
29
+ </svg>
30
+ }
31
+ @case ('clock-mono') {
32
+ <svg class="good-status-icon-svg good-status-icon-clock-mono" viewBox="0 0 24 24" aria-hidden="true">
33
+ <circle cx="12" cy="12" r="9" />
34
+ <path d="M12 6.5v5.5l3.5 2" />
35
+ </svg>
36
+ }
37
+ @case ('circle') {
38
+ <svg class="good-status-icon-svg good-status-icon-circle" viewBox="0 0 24 24" aria-hidden="true">
39
+ <circle cx="12" cy="12" r="9" />
40
+ </svg>
41
+ }
42
+ @case ('circle-mono') {
43
+ <svg class="good-status-icon-svg good-status-icon-circle-mono" viewBox="0 0 24 24" aria-hidden="true">
44
+ <circle cx="12" cy="12" r="9" />
45
+ </svg>
46
+ }
47
+ @case ('symbol') {
48
+ <span class="good-status-icon-symbol" aria-hidden="true">
49
+ <svg class="good-status-icon-svg" viewBox="0 0 24 24">
50
+ @switch (status()) {
51
+ @case ('completed') { <path d="m5 12 4.2 4.2L19 6.5" /> }
52
+ @case ('pending') { <circle cx="5.5" cy="12" r=".8" /><circle cx="12" cy="12" r=".8" /><circle cx="18.5" cy="12" r=".8" /> }
53
+ @case ('progressing') { <path d="M19 8a8 8 0 1 0 1 6" /><path d="M19 4v4h-4" /> }
54
+ @case ('revising') { <path d="M20 8a8 8 0 1 0 1 7" /><path d="M20 4v4h-4" /><path d="m9 12 2 2 4-4" /> }
55
+ @case ('dismissed') { <path d="M5 12h14" /> }
56
+ @case ('error') { <path d="M6 6l12 12M18 6 6 18" /> }
57
+ }
58
+ </svg>
59
+ </span>
60
+ }
61
+ }
62
+ `,
63
+ })
64
+ export class GoodStatusIconComponent {
65
+ readonly status = input.required<GoodStatusIconStatus>();
66
+ readonly appearance = input<GoodStatusIconAppearance>('plain');
67
+ readonly size = input<GoodStatusIconSize>('default');
68
+ readonly disabled = input(false);
69
+ readonly decorative = input(false);
70
+ readonly ariaLabel = input('');
71
+
72
+ readonly accessibleLabel = computed(() => {
73
+ const names: Record<GoodStatusIconStatus, string> = {
74
+ completed: 'Completed', pending: 'Pending', progressing: 'Progressing',
75
+ revising: 'Revising', dismissed: 'Dismissed', error: 'Error',
76
+ };
77
+ return this.ariaLabel() || `${names[this.status()]}${this.disabled() ? ' (disabled)' : ''}`;
78
+ });
79
+ }
@@ -0,0 +1,156 @@
1
+ import { ChangeDetectionStrategy, Component, ElementRef, HostListener, computed, effect, inject, input, signal, viewChild } from '@angular/core';
2
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
+ import { NavigationEnd, Router, RouterLink } from '@angular/router';
4
+ import { filter } from 'rxjs';
5
+ import { LucideEllipsis } from '@lucide/angular';
6
+ import { GoodSubnavAction, GoodSubnavItem, goodSubnavItemContainsRoute } from './models';
7
+ import { GoodButtonComponent } from './button';
8
+ import { GoodActionMenuComponent } from './action-menu';
9
+
10
+ let nextSubnavId = 0;
11
+
12
+ @Component({
13
+ selector: 'good-subnav',
14
+ standalone: true,
15
+ imports: [RouterLink, GoodButtonComponent, GoodActionMenuComponent],
16
+ changeDetection: ChangeDetectionStrategy.OnPush,
17
+ template: `
18
+ <nav [attr.aria-label]="ariaLabel()" (keydown)="onKeydown($event)">
19
+ <div class="good-subnav-row">
20
+ <div #scrollViewport class="good-subnav-scroll" (scroll)="close()">
21
+ <div class="good-subnav-track">
22
+ @for (item of items(); track item.id) {
23
+ <div class="good-subnav-item" [class.good-is-active]="isActive(item)">
24
+ @if (item.route && !item.disabled) {
25
+ <a class="good-subnav-link" [routerLink]="item.route" [attr.aria-current]="isCurrent(item) ? 'page' : null" (click)="close()">{{ item.label }}</a>
26
+ } @else if (item.children?.length && !item.disabled) {
27
+ <button type="button" class="good-subnav-link" [attr.aria-expanded]="openId() === item.id"
28
+ [attr.aria-controls]="panelId" (click)="toggle(item, $event)">{{ item.label }}
29
+ <svg class="good-subnav-inline-chevron" aria-hidden="true" viewBox="0 0 16 16" fill="none"><path d="m4 6 4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
30
+ </button>
31
+ } @else {
32
+ <span class="good-subnav-link" [class.good-is-disabled]="item.disabled">{{ item.label }}</span>
33
+ }
34
+ @if (item.route && item.children?.length && !item.disabled) {
35
+ <button type="button" class="good-subnav-chevron" [attr.aria-label]="item.label + ' options'"
36
+ [attr.aria-expanded]="openId() === item.id" [attr.aria-controls]="panelId" (click)="toggle(item, $event)">
37
+ <svg aria-hidden="true" viewBox="0 0 16 16" fill="none"><path d="m4 6 4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
38
+ </button>
39
+ }
40
+ </div>
41
+ }
42
+ </div>
43
+ </div>
44
+ <div class="good-subnav-actions">
45
+ @for (action of actions(); track action.id) {
46
+ @if (action.menuItems?.length) {
47
+ <good-action-menu [icon]="action.icon || ellipsisIcon" [variant]="action.variant || 'outline'" [size]="action.size || 'small'" [label]="action.label" [items]="action.menuItems!" />
48
+ } @else {
49
+ <good-button [icon]="action.icon" [iconOnly]="!!action.iconOnly" [variant]="action.variant || 'outline'" [size]="action.size || 'small'" [ariaLabel]="action.iconOnly ? action.label : ''"
50
+ (click)="activateAction(action)">{{ action.label }}</good-button>
51
+ }
52
+ }
53
+ <ng-content select="[good-subnav-actions]" />
54
+ </div>
55
+ </div>
56
+ @if (openItem(); as parent) {
57
+ <div class="good-subnav-dropdown" [id]="panelId" [style.left.px]="panelLeft()" [style.top.px]="panelTop()" [attr.aria-label]="parent.label + ' pages'">
58
+ @for (child of parent.children; track child.id) {
59
+ @if (child.route && !child.disabled) {
60
+ <a class="good-subnav-dropdown-link" [routerLink]="child.route" [class.good-is-active]="child.route === currentRoute()"
61
+ [attr.aria-current]="child.route === currentRoute() ? 'page' : null" (click)="close()">{{ child.label }}</a>
62
+ } @else {
63
+ <span class="good-subnav-dropdown-link good-is-disabled">{{ child.label }}</span>
64
+ }
65
+ }
66
+ </div>
67
+ }
68
+ </nav>
69
+ `,
70
+ host: { class: 'good-subnav' },
71
+ })
72
+ export class GoodSubnavComponent {
73
+ readonly ellipsisIcon = LucideEllipsis;
74
+ private readonly router = inject(Router);
75
+ private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);
76
+ private readonly scrollViewport = viewChild<ElementRef<HTMLElement>>('scrollViewport');
77
+ private readonly routerRoute = signal('/');
78
+ private returnFocus: HTMLElement | null = null;
79
+ readonly items = input<readonly GoodSubnavItem[]>([]);
80
+ readonly actions = input<readonly GoodSubnavAction[]>([]);
81
+ readonly ariaLabel = input('Subnav');
82
+ readonly activeRoute = input('');
83
+ readonly currentRoute = computed(() => this.activeRoute() || this.routerRoute());
84
+ readonly openId = signal<string | null>(null);
85
+ readonly openItem = computed(() => this.items().find(item => item.id === this.openId()) ?? null);
86
+ readonly panelLeft = signal(0);
87
+ readonly panelTop = signal(0);
88
+ readonly panelId = `good-subnav-panel-${++nextSubnavId}`;
89
+
90
+ activateAction(action: GoodSubnavAction): void {
91
+ if (action.route) void this.router.navigateByUrl(action.route);
92
+ else action.action?.();
93
+ }
94
+
95
+ constructor() {
96
+ this.routerRoute.set(this.router.url.split(/[?#]/)[0] || '/');
97
+ this.router.events.pipe(filter((event): event is NavigationEnd => event instanceof NavigationEnd), takeUntilDestroyed())
98
+ .subscribe(event => {
99
+ this.routerRoute.set(event.urlAfterRedirects.split(/[?#]/)[0] || '/');
100
+ this.close();
101
+ });
102
+ effect(() => {
103
+ const route = this.currentRoute();
104
+ const items = this.items();
105
+ requestAnimationFrame(() => {
106
+ const index = items.findIndex(item => goodSubnavItemContainsRoute(item, route));
107
+ const element = this.scrollViewport()?.nativeElement.children[0]?.children[index] as HTMLElement | undefined;
108
+ element?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
109
+ });
110
+ });
111
+ }
112
+
113
+ isActive(item: GoodSubnavItem): boolean { return goodSubnavItemContainsRoute(item, this.currentRoute()); }
114
+ isCurrent(item: GoodSubnavItem): boolean {
115
+ return !!item.route && item.route === this.currentRoute();
116
+ }
117
+
118
+ toggle(item: GoodSubnavItem, event: Event): void {
119
+ if (this.openId() === item.id) { this.close(); return; }
120
+ const trigger = event.currentTarget as HTMLElement;
121
+ const rect = trigger.closest('.good-subnav-item')!.getBoundingClientRect();
122
+ this.returnFocus = trigger;
123
+ this.panelLeft.set(Math.max(8, Math.min(rect.left, window.innerWidth - 228)));
124
+ const panelHeight = Math.min(360, (item.children?.length ?? 0) * 42 + 16, window.innerHeight * .6);
125
+ this.panelTop.set(rect.bottom + 4 + panelHeight > window.innerHeight - 8 ? Math.max(8, rect.top - panelHeight - 4) : rect.bottom + 4);
126
+ this.openId.set(item.id);
127
+ requestAnimationFrame(() => this.host.nativeElement.querySelector<HTMLElement>('.good-subnav-dropdown a')?.focus());
128
+ }
129
+
130
+ close(restoreFocus = false): void {
131
+ if (this.openId() === null) return;
132
+ this.openId.set(null);
133
+ if (restoreFocus) this.returnFocus?.focus();
134
+ }
135
+
136
+ onKeydown(event: KeyboardEvent): void {
137
+ if (event.key === 'Escape' && this.openId()) { event.preventDefault(); this.close(true); return; }
138
+ if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key) || this.openId()) return;
139
+ const controls = Array.from(this.host.nativeElement.querySelectorAll<HTMLElement>('.good-subnav-item > .good-subnav-link:not(span)'));
140
+ const current = controls.findIndex(control => control === document.activeElement || control.parentElement?.contains(document.activeElement));
141
+ if (current < 0 || !controls.length) return;
142
+ event.preventDefault();
143
+ const next = event.key === 'Home' ? 0 : event.key === 'End' ? controls.length - 1 :
144
+ (current + (event.key === 'ArrowRight' ? 1 : -1) + controls.length) % controls.length;
145
+ controls[next].focus();
146
+ controls[next].scrollIntoView({ block: 'nearest', inline: 'nearest' });
147
+ }
148
+
149
+ @HostListener('document:pointerdown', ['$event'])
150
+ onPointerDown(event: PointerEvent): void {
151
+ if (this.openId() && !this.host.nativeElement.contains(event.target as Node)) this.close();
152
+ }
153
+
154
+ @HostListener('window:resize')
155
+ onResize(): void { this.close(); }
156
+ }
@@ -0,0 +1,54 @@
1
+ import { ChangeDetectionStrategy, Component, computed, forwardRef, input, model, signal } from '@angular/core';
2
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
+
4
+ export type GoodSwitchSize = 'small' | 'default' | 'large';
5
+ export type GoodSwitchAppearance = 'brand' | 'mono';
6
+
7
+ @Component({
8
+ selector: 'good-switch',
9
+ standalone: true,
10
+ changeDetection: ChangeDetectionStrategy.OnPush,
11
+ providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GoodSwitchComponent), multi: true }],
12
+ template: `
13
+ <label class="good-switch-control" [attr.data-size]="size()" [attr.data-appearance]="appearance()" [attr.data-state]="checked() ? 'on' : 'off'"
14
+ [attr.data-status]="status()">
15
+ <input class="good-switch-input" type="checkbox" role="switch" [checked]="checked()"
16
+ [disabled]="isDisabled()" [required]="required()" [name]="name()" [id]="inputId() || null"
17
+ [attr.aria-label]="showLabel() ? null : label()" [attr.aria-invalid]="error() ? 'true' : null"
18
+ [attr.aria-describedby]="describedBy() || null" (change)="onInputChange($event)" (blur)="onBlur()" />
19
+ <span class="good-switch-track" aria-hidden="true"><span class="good-switch-thumb"></span></span>
20
+ @if (showLabel()) { <span class="good-switch-label">{{ label() }}</span> }
21
+ </label>
22
+ `,
23
+ host: { class: 'good-switch' },
24
+ })
25
+ export class GoodSwitchComponent implements ControlValueAccessor {
26
+ readonly label = input.required<string>();
27
+ readonly showLabel = input(false);
28
+ readonly checked = model(false);
29
+ readonly size = input<GoodSwitchSize>('default');
30
+ readonly appearance = input<GoodSwitchAppearance>('brand');
31
+ readonly disabled = input(false);
32
+ readonly error = input(false);
33
+ readonly required = input(false);
34
+ readonly name = input('');
35
+ readonly inputId = input('');
36
+ readonly describedBy = input('');
37
+ private readonly formDisabled = signal(false);
38
+ readonly isDisabled = computed(() => this.disabled() || this.formDisabled());
39
+ readonly status = computed(() => this.isDisabled() ? 'disabled' : this.error() ? 'error' : 'default');
40
+ private onChange: (value: boolean) => void = () => {};
41
+ private onTouched: () => void = () => {};
42
+
43
+ onInputChange(event: Event): void {
44
+ const next = (event.target as HTMLInputElement).checked;
45
+ this.checked.set(next);
46
+ this.onChange(next);
47
+ }
48
+
49
+ onBlur(): void { this.onTouched(); }
50
+ writeValue(value: unknown): void { this.checked.set(value === true); }
51
+ registerOnChange(fn: (value: boolean) => void): void { this.onChange = fn; }
52
+ registerOnTouched(fn: () => void): void { this.onTouched = fn; }
53
+ setDisabledState(disabled: boolean): void { this.formDisabled.set(disabled); }
54
+ }