@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.
- package/README.md +10 -0
- package/ai/README.md +47 -0
- package/ai/case-studies/index.md +10 -0
- package/ai/case-studies/vpshoster.md +18 -0
- package/ai/case-studies/webmailer.md +21 -0
- package/ai/catalog/README.md +7 -0
- package/ai/catalog/component.schema.json +289 -0
- package/ai/catalog/components/div-goodDetailRow.json +33 -0
- package/ai/catalog/components/form-goodForm.json +84 -0
- package/ai/catalog/components/good-action-bar.json +83 -0
- package/ai/catalog/components/good-action-group.json +143 -0
- package/ai/catalog/components/good-action-menu.json +121 -0
- package/ai/catalog/components/good-alert.json +184 -0
- package/ai/catalog/components/good-app-layout.json +245 -0
- package/ai/catalog/components/good-assistant-body.json +43 -0
- package/ai/catalog/components/good-assistant-footer.json +43 -0
- package/ai/catalog/components/good-assistant-header.json +43 -0
- package/ai/catalog/components/good-assistant-main.json +61 -0
- package/ai/catalog/components/good-assistant-mobile.json +43 -0
- package/ai/catalog/components/good-assistant-panel.json +131 -0
- package/ai/catalog/components/good-avatar-menu-item.json +82 -0
- package/ai/catalog/components/good-avatar-menu.json +83 -0
- package/ai/catalog/components/good-badge.json +180 -0
- package/ai/catalog/components/good-bar-chart.json +118 -0
- package/ai/catalog/components/good-brand-icon.json +71 -0
- package/ai/catalog/components/good-breadcrumbs.json +102 -0
- package/ai/catalog/components/good-button.json +192 -0
- package/ai/catalog/components/good-calendar.json +430 -0
- package/ai/catalog/components/good-card-footer.json +63 -0
- package/ai/catalog/components/good-card-header.json +100 -0
- package/ai/catalog/components/good-card.json +57 -0
- package/ai/catalog/components/good-chart-axis.json +168 -0
- package/ai/catalog/components/good-chart-bar.json +89 -0
- package/ai/catalog/components/good-chart-histogram.json +78 -0
- package/ai/catalog/components/good-chart-line.json +89 -0
- package/ai/catalog/components/good-chart-scatter.json +87 -0
- package/ai/catalog/components/good-checkbox.json +171 -0
- package/ai/catalog/components/good-citation.json +62 -0
- package/ai/catalog/components/good-code-block.json +116 -0
- package/ai/catalog/components/good-color-controls.json +58 -0
- package/ai/catalog/components/good-color-picker.json +141 -0
- package/ai/catalog/components/good-column.json +53 -0
- package/ai/catalog/components/good-columns.json +77 -0
- package/ai/catalog/components/good-date-input.json +386 -0
- package/ai/catalog/components/good-detail-list.json +43 -0
- package/ai/catalog/components/good-dropdown.json +259 -0
- package/ai/catalog/components/good-error-page.json +133 -0
- package/ai/catalog/components/good-error-text.json +43 -0
- package/ai/catalog/components/good-expandable.json +159 -0
- package/ai/catalog/components/good-eyebrow.json +61 -0
- package/ai/catalog/components/good-field-label.json +62 -0
- package/ai/catalog/components/good-form-field.json +67 -0
- package/ai/catalog/components/good-form-row.json +70 -0
- package/ai/catalog/components/good-group.json +150 -0
- package/ai/catalog/components/good-heading-group.json +45 -0
- package/ai/catalog/components/good-heading.json +69 -0
- package/ai/catalog/components/good-hint.json +43 -0
- package/ai/catalog/components/good-histogram.json +103 -0
- package/ai/catalog/components/good-icon.json +97 -0
- package/ai/catalog/components/good-image-input.json +190 -0
- package/ai/catalog/components/good-image-preview.json +97 -0
- package/ai/catalog/components/good-inline-image.json +131 -0
- package/ai/catalog/components/good-input-phone.json +226 -0
- package/ai/catalog/components/good-input.json +350 -0
- package/ai/catalog/components/good-line-chart.json +94 -0
- package/ai/catalog/components/good-link.json +147 -0
- package/ai/catalog/components/good-listbox.json +248 -0
- package/ai/catalog/components/good-main-menu.json +138 -0
- package/ai/catalog/components/good-main-view.json +179 -0
- package/ai/catalog/components/good-map-color-scale.json +163 -0
- package/ai/catalog/components/good-map-overlay.json +136 -0
- package/ai/catalog/components/good-modal-footer.json +63 -0
- package/ai/catalog/components/good-modal-header.json +73 -0
- package/ai/catalog/components/good-modal.json +131 -0
- package/ai/catalog/components/good-month-calendar.json +170 -0
- package/ai/catalog/components/good-notification-host.json +46 -0
- package/ai/catalog/components/good-notifications.json +72 -0
- package/ai/catalog/components/good-number-input.json +180 -0
- package/ai/catalog/components/good-paragraph.json +47 -0
- package/ai/catalog/components/good-pdf-preview.json +153 -0
- package/ai/catalog/components/good-pin-input.json +211 -0
- package/ai/catalog/components/good-progress.json +158 -0
- package/ai/catalog/components/good-prose.json +43 -0
- package/ai/catalog/components/good-radio-group.json +181 -0
- package/ai/catalog/components/good-range-slider.json +285 -0
- package/ai/catalog/components/good-rating.json +160 -0
- package/ai/catalog/components/good-resizable-pane.json +61 -0
- package/ai/catalog/components/good-resizable.json +185 -0
- package/ai/catalog/components/good-rich-text-editor.json +164 -0
- package/ai/catalog/components/good-scatter-chart.json +94 -0
- package/ai/catalog/components/good-search.json +60 -0
- package/ai/catalog/components/good-section.json +43 -0
- package/ai/catalog/components/good-select-country.json +205 -0
- package/ai/catalog/components/good-select-font.json +111 -0
- package/ai/catalog/components/good-select.json +217 -0
- package/ai/catalog/components/good-separator.json +59 -0
- package/ai/catalog/components/good-settings.json +60 -0
- package/ai/catalog/components/good-sidebar-container.json +112 -0
- package/ai/catalog/components/good-sidebar-item.json +210 -0
- package/ai/catalog/components/good-sidebar-menu-container.json +80 -0
- package/ai/catalog/components/good-sidebar-submenu-group.json +98 -0
- package/ai/catalog/components/good-sidebar-submenu-item.json +113 -0
- package/ai/catalog/components/good-signature-pad.json +115 -0
- package/ai/catalog/components/good-sparkline.json +188 -0
- package/ai/catalog/components/good-status-icon.json +425 -0
- package/ai/catalog/components/good-subheading.json +67 -0
- package/ai/catalog/components/good-subnav.json +132 -0
- package/ai/catalog/components/good-summary.json +43 -0
- package/ai/catalog/components/good-switch.json +167 -0
- package/ai/catalog/components/good-tab.json +129 -0
- package/ai/catalog/components/good-table.json +294 -0
- package/ai/catalog/components/good-tabs.json +90 -0
- package/ai/catalog/components/good-textarea.json +194 -0
- package/ai/catalog/components/good-theme-toggle.json +57 -0
- package/ai/catalog/components/good-timeline-section.json +105 -0
- package/ai/catalog/components/good-timeline-step.json +248 -0
- package/ai/catalog/components/good-timeline.json +302 -0
- package/ai/catalog/components/good-topbar-dropdown-item.json +115 -0
- package/ai/catalog/components/good-topbar-dropdown-menu.json +85 -0
- package/ai/catalog/components/good-topbar-menu-container.json +96 -0
- package/ai/catalog/components/good-topbar-menu-item.json +99 -0
- package/ai/catalog/components/good-topbar-submenu.json +77 -0
- package/ai/catalog/components/good-topbar.json +259 -0
- package/ai/catalog/components/good-world-map.json +145 -0
- package/ai/catalog/components/goodCardActions.json +33 -0
- package/ai/catalog/components/goodDropdownFooter.json +33 -0
- package/ai/catalog/components/goodDropdownHeader.json +33 -0
- package/ai/catalog/components/goodExpandableHeader.json +33 -0
- package/ai/catalog/components/ng-template-goodListboxItem.json +33 -0
- package/ai/catalog/components/ng-template-goodTableCell.json +43 -0
- package/ai/catalog/index.json +1484 -0
- package/ai/catalog/index.schema.json +13 -0
- package/ai/examples/angular.json +26 -0
- package/ai/examples/edit-form.html +13 -0
- package/ai/examples/edit-form.ts +18 -0
- package/ai/examples/index.html +1 -0
- package/ai/examples/login.html +11 -0
- package/ai/examples/login.ts +14 -0
- package/ai/examples/main.ts +25 -0
- package/ai/examples/settings.html +10 -0
- package/ai/examples/settings.ts +13 -0
- package/ai/examples/table-view.html +3 -0
- package/ai/examples/table-view.ts +21 -0
- package/ai/examples/tsconfig.json +27 -0
- package/ai/guides/common-mistakes.md +9 -0
- package/ai/guides/component-discovery.md +17 -0
- package/ai/guides/design-tokens.md +10 -0
- package/ai/guides/layout.md +17 -0
- package/ai/guides/page-patterns.md +39 -0
- package/ai/install.mjs +25 -0
- package/ai/manifest.json +6 -0
- package/ai/skill/goodui/SKILL.md +27 -0
- package/angular/projects/goodui/package.json +28 -0
- package/angular/projects/goodui/src/action-bar.css +20 -0
- package/angular/projects/goodui/src/assistant-panel.css +38 -0
- package/angular/projects/goodui/src/calendar.css +161 -0
- package/angular/projects/goodui/src/chart.css +35 -0
- package/angular/projects/goodui/src/color-picker.css +40 -0
- package/angular/projects/goodui/src/error-page.css +24 -0
- package/angular/projects/goodui/src/lib/action-bar.ts +161 -0
- package/angular/projects/goodui/src/lib/action-group.ts +31 -0
- package/angular/projects/goodui/src/lib/action-menu.ts +81 -0
- package/angular/projects/goodui/src/lib/actions.ts +318 -0
- package/angular/projects/goodui/src/lib/alert.ts +60 -0
- package/angular/projects/goodui/src/lib/app-layout.ts +79 -0
- package/angular/projects/goodui/src/lib/assistant-panel.ts +133 -0
- package/angular/projects/goodui/src/lib/badge.ts +47 -0
- package/angular/projects/goodui/src/lib/bar-chart.html +80 -0
- package/angular/projects/goodui/src/lib/bar-chart.ts +233 -0
- package/angular/projects/goodui/src/lib/breadcrumbs.ts +81 -0
- package/angular/projects/goodui/src/lib/button.ts +38 -0
- package/angular/projects/goodui/src/lib/calendar-layout.ts +68 -0
- package/angular/projects/goodui/src/lib/calendar-service.ts +144 -0
- package/angular/projects/goodui/src/lib/calendar-working-hours.ts +65 -0
- package/angular/projects/goodui/src/lib/calendar.html +200 -0
- package/angular/projects/goodui/src/lib/calendar.ts +471 -0
- package/angular/projects/goodui/src/lib/card.ts +64 -0
- package/angular/projects/goodui/src/lib/chart-colors.ts +22 -0
- package/angular/projects/goodui/src/lib/chart-data.ts +269 -0
- package/angular/projects/goodui/src/lib/checkbox.ts +87 -0
- package/angular/projects/goodui/src/lib/code-block.ts +147 -0
- package/angular/projects/goodui/src/lib/color-controls.ts +107 -0
- package/angular/projects/goodui/src/lib/color-picker.ts +142 -0
- package/angular/projects/goodui/src/lib/color-utils.ts +69 -0
- package/angular/projects/goodui/src/lib/country-data.ts +16 -0
- package/angular/projects/goodui/src/lib/date-input.ts +542 -0
- package/angular/projects/goodui/src/lib/dropdown.ts +309 -0
- package/angular/projects/goodui/src/lib/error-page.ts +46 -0
- package/angular/projects/goodui/src/lib/expandable.ts +64 -0
- package/angular/projects/goodui/src/lib/form.ts +12 -0
- package/angular/projects/goodui/src/lib/goodui-config.ts +16 -0
- package/angular/projects/goodui/src/lib/group.ts +45 -0
- package/angular/projects/goodui/src/lib/histogram.html +52 -0
- package/angular/projects/goodui/src/lib/histogram.ts +146 -0
- package/angular/projects/goodui/src/lib/icon.ts +44 -0
- package/angular/projects/goodui/src/lib/image-input.ts +154 -0
- package/angular/projects/goodui/src/lib/image-preview.ts +26 -0
- package/angular/projects/goodui/src/lib/input-phone.ts +305 -0
- package/angular/projects/goodui/src/lib/input.ts +143 -0
- package/angular/projects/goodui/src/lib/line-chart.html +53 -0
- package/angular/projects/goodui/src/lib/line-chart.ts +193 -0
- package/angular/projects/goodui/src/lib/link.ts +46 -0
- package/angular/projects/goodui/src/lib/listbox.ts +254 -0
- package/angular/projects/goodui/src/lib/main-view.ts +39 -0
- package/angular/projects/goodui/src/lib/marker-colors.ts +7 -0
- package/angular/projects/goodui/src/lib/modal.ts +199 -0
- package/angular/projects/goodui/src/lib/models.ts +115 -0
- package/angular/projects/goodui/src/lib/month-calendar.ts +289 -0
- package/angular/projects/goodui/src/lib/notification-center.ts +170 -0
- package/angular/projects/goodui/src/lib/notification-host.ts +86 -0
- package/angular/projects/goodui/src/lib/number-input.ts +180 -0
- package/angular/projects/goodui/src/lib/pdf-preview.ts +242 -0
- package/angular/projects/goodui/src/lib/pdf-worker.generated.ts +2 -0
- package/angular/projects/goodui/src/lib/pin-input.ts +193 -0
- package/angular/projects/goodui/src/lib/progress.ts +93 -0
- package/angular/projects/goodui/src/lib/provide-goodui.ts +15 -0
- package/angular/projects/goodui/src/lib/radio-group.ts +94 -0
- package/angular/projects/goodui/src/lib/range-slider.ts +313 -0
- package/angular/projects/goodui/src/lib/rating.ts +90 -0
- package/angular/projects/goodui/src/lib/required-control.ts +4 -0
- package/angular/projects/goodui/src/lib/resizable.ts +168 -0
- package/angular/projects/goodui/src/lib/rich-text-command.ts +111 -0
- package/angular/projects/goodui/src/lib/rich-text-editor.html +193 -0
- package/angular/projects/goodui/src/lib/rich-text-editor.ts +864 -0
- package/angular/projects/goodui/src/lib/rich-text-sanitize.ts +99 -0
- package/angular/projects/goodui/src/lib/scatter-chart.html +48 -0
- package/angular/projects/goodui/src/lib/scatter-chart.ts +150 -0
- package/angular/projects/goodui/src/lib/select-country.ts +104 -0
- package/angular/projects/goodui/src/lib/select-font.ts +189 -0
- package/angular/projects/goodui/src/lib/select.ts +336 -0
- package/angular/projects/goodui/src/lib/sidebar.ts +232 -0
- package/angular/projects/goodui/src/lib/signature-pad.ts +238 -0
- package/angular/projects/goodui/src/lib/sparkline.html +15 -0
- package/angular/projects/goodui/src/lib/sparkline.ts +106 -0
- package/angular/projects/goodui/src/lib/status-icon.ts +79 -0
- package/angular/projects/goodui/src/lib/subnav.ts +156 -0
- package/angular/projects/goodui/src/lib/switch.ts +54 -0
- package/angular/projects/goodui/src/lib/table.ts +538 -0
- package/angular/projects/goodui/src/lib/tabs.ts +251 -0
- package/angular/projects/goodui/src/lib/textarea.ts +83 -0
- package/angular/projects/goodui/src/lib/theme.ts +49 -0
- package/angular/projects/goodui/src/lib/timeline.ts +252 -0
- package/angular/projects/goodui/src/lib/topbar.ts +402 -0
- package/angular/projects/goodui/src/lib/typography.ts +250 -0
- package/angular/projects/goodui/src/lib/world-map-data.ts +3 -0
- package/angular/projects/goodui/src/lib/world-map.html +73 -0
- package/angular/projects/goodui/src/lib/world-map.ts +391 -0
- package/angular/projects/goodui/src/month-calendar.css +47 -0
- package/angular/projects/goodui/src/pdf-preview.css +25 -0
- package/angular/projects/goodui/src/progress.css +38 -0
- package/angular/projects/goodui/src/public-api.ts +74 -0
- package/angular/projects/goodui/src/range-slider.css +54 -0
- package/angular/projects/goodui/src/resizable.css +32 -0
- package/angular/projects/goodui/src/rich-text-editor.css +33 -0
- package/angular/projects/goodui/src/select-font.css +16 -0
- package/angular/projects/goodui/src/signature-pad.css +14 -0
- package/angular/projects/goodui/src/styles.css +1105 -0
- package/angular/projects/goodui/src/timeline.css +138 -0
- package/angular/projects/goodui/src/tokens.generated.css +754 -0
- package/design/component-map.json +2233 -0
- package/design-tokens/penpot.tokens.json +3339 -0
- package/design.md +452 -0
- package/guides/README.md +17 -0
- package/guides/components/action-bar.md +43 -0
- package/guides/components/action-group.md +43 -0
- package/guides/components/action-menu.md +22 -0
- package/guides/components/alert.md +28 -0
- package/guides/components/assistant-panel.md +50 -0
- package/guides/components/avatar-menu.md +34 -0
- package/guides/components/badge.md +39 -0
- package/guides/components/bar-chart.md +40 -0
- package/guides/components/breadcrumbs.md +37 -0
- package/guides/components/button.md +40 -0
- package/guides/components/calendar.md +166 -0
- package/guides/components/card.md +62 -0
- package/guides/components/chart-axis.md +5 -0
- package/guides/components/chart-bar.md +5 -0
- package/guides/components/chart-data.md +58 -0
- package/guides/components/chart-histogram.md +16 -0
- package/guides/components/chart-line.md +5 -0
- package/guides/components/chart-scatter.md +14 -0
- package/guides/components/checkbox.md +36 -0
- package/guides/components/code-block.md +35 -0
- package/guides/components/color-controls.md +22 -0
- package/guides/components/column.md +5 -0
- package/guides/components/columns.md +13 -0
- package/guides/components/date-input.md +62 -0
- package/guides/components/detail-list.md +25 -0
- package/guides/components/dropdown.md +48 -0
- package/guides/components/error-page.md +31 -0
- package/guides/components/expandable.md +36 -0
- package/guides/components/form.md +49 -0
- package/guides/components/group.md +41 -0
- package/guides/components/histogram.md +45 -0
- package/guides/components/icon.md +13 -0
- package/guides/components/image-input.md +34 -0
- package/guides/components/input-phone.md +45 -0
- package/guides/components/input.md +59 -0
- package/guides/components/line-chart.md +37 -0
- package/guides/components/link.md +31 -0
- package/guides/components/listbox.md +109 -0
- package/guides/components/main-menu.md +11 -0
- package/guides/components/main-view.md +21 -0
- package/guides/components/modal.md +58 -0
- package/guides/components/month-calendar.md +88 -0
- package/guides/components/notifications.md +76 -0
- package/guides/components/number-input.md +21 -0
- package/guides/components/pdf-preview.md +38 -0
- package/guides/components/pin-input.md +37 -0
- package/guides/components/progress.md +41 -0
- package/guides/components/radio-group.md +41 -0
- package/guides/components/range-slider.md +42 -0
- package/guides/components/rating.md +39 -0
- package/guides/components/resizable-pane.md +3 -0
- package/guides/components/resizable.md +75 -0
- package/guides/components/rich-text-editor.md +113 -0
- package/guides/components/scatter-chart.md +43 -0
- package/guides/components/search.md +9 -0
- package/guides/components/select-font.md +16 -0
- package/guides/components/select.md +65 -0
- package/guides/components/settings.md +11 -0
- package/guides/components/sidebar.md +47 -0
- package/guides/components/signature-pad.md +45 -0
- package/guides/components/sparkline.md +31 -0
- package/guides/components/status-icon.md +32 -0
- package/guides/components/submenus.md +30 -0
- package/guides/components/subnav.md +54 -0
- package/guides/components/switch.md +48 -0
- package/guides/components/table.md +256 -0
- package/guides/components/tabs.md +46 -0
- package/guides/components/textarea.md +44 -0
- package/guides/components/theme-toggle.md +33 -0
- package/guides/components/timeline-section.md +7 -0
- package/guides/components/timeline-step.md +12 -0
- package/guides/components/timeline.md +179 -0
- package/guides/components/topbar.md +83 -0
- package/guides/components/typography.md +155 -0
- package/guides/components/world-map.md +72 -0
- package/guides/contributing/design-to-code.md +261 -0
- package/guides/deployment/drone.md +77 -0
- package/guides/examples/user-registration.md +11 -0
- package/guides/foundations/naming.md +7 -0
- package/guides/foundations/tokens.md +203 -0
- package/guides/intro.md +80 -0
- package/guides/layout/app-layout.md +64 -0
- package/guides/layout/layout-rules.md +16 -0
- package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.html +22 -0
- package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.ts +111 -0
- package/homepage/src/app/examples/calendar-workspace/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.html +166 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.ts +134 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/cloudhoster-store.ts +92 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.html +93 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.ts +115 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.html +202 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.ts +143 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.html +70 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.ts +44 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/home-page.html +70 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/home-page.ts +32 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/source-code.generated.ts +12 -0
- package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.html +208 -0
- package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.ts +214 -0
- package/homepage/src/app/examples/case-studies/vpshoster/overview-page.html +35 -0
- package/homepage/src/app/examples/case-studies/vpshoster/overview-page.ts +17 -0
- package/homepage/src/app/examples/case-studies/vpshoster/servers-page.html +111 -0
- package/homepage/src/app/examples/case-studies/vpshoster/servers-page.ts +206 -0
- package/homepage/src/app/examples/case-studies/vpshoster/source-code.generated.ts +6 -0
- package/homepage/src/app/examples/case-studies/vpshoster/vps-store.ts +92 -0
- package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.html +35 -0
- package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.ts +17 -0
- package/homepage/src/app/examples/error-pages/error-pages-example-page.html +27 -0
- package/homepage/src/app/examples/error-pages/error-pages-example-page.ts +34 -0
- package/homepage/src/app/examples/error-pages/not-found-page.html +8 -0
- package/homepage/src/app/examples/error-pages/not-found-page.ts +19 -0
- package/homepage/src/app/examples/error-pages/server-error-page.html +8 -0
- package/homepage/src/app/examples/error-pages/server-error-page.ts +20 -0
- package/homepage/src/app/examples/error-pages/source-code.generated.ts +7 -0
- package/homepage/src/app/examples/mail-compose/mail-compose-page.html +25 -0
- package/homepage/src/app/examples/mail-compose/mail-compose-page.ts +28 -0
- package/homepage/src/app/examples/mail-workspace/mail-workspace-page.html +59 -0
- package/homepage/src/app/examples/mail-workspace/mail-workspace-page.ts +128 -0
- package/homepage/src/app/examples/mail-workspace/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/notifications/notifications-page.html +51 -0
- package/homepage/src/app/examples/notifications/notifications-page.ts +133 -0
- package/homepage/src/app/examples/notifications/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/pdf-reader/pdf-reader-page.html +27 -0
- package/homepage/src/app/examples/pdf-reader/pdf-reader-page.ts +39 -0
- package/homepage/src/app/examples/pdf-reader/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/user-registration/source-code.generated.ts +5 -0
- package/homepage/src/app/examples/user-registration/user-registration-example-page.html +11 -0
- package/homepage/src/app/examples/user-registration/user-registration-example-page.ts +21 -0
- package/homepage/src/app/examples/user-registration/user-registration-form.html +116 -0
- package/homepage/src/app/examples/user-registration/user-registration-form.ts +93 -0
- package/homepage/src/app/examples/user-registration/user-registration-page.html +11 -0
- package/homepage/src/app/examples/user-registration/user-registration-page.ts +23 -0
- package/package.json +2 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<good-card>
|
|
2
|
+
<good-card-header [title]="title()" [headingLevel]="3">
|
|
3
|
+
@if (showDataToggle()) {
|
|
4
|
+
<good-button goodCardActions variant="ghost" size="small" [iconOnly]="true"
|
|
5
|
+
[icon]="dataVisible() ? chartIcon : tableIcon" [ariaPressed]="dataVisible()"
|
|
6
|
+
[ariaLabel]="dataVisible() ? 'Show chart' : 'Show data'"
|
|
7
|
+
(click)="dataVisible.set(!dataVisible())" />
|
|
8
|
+
}
|
|
9
|
+
</good-card-header>
|
|
10
|
+
<div class="good-chart-config" aria-hidden="true"><ng-content /></div>
|
|
11
|
+
@if (resolved().errors.length) {
|
|
12
|
+
<div class="good-chart-message" role="alert">{{ resolved().errors.join(' ') }}</div>
|
|
13
|
+
} @else if (!resolved().lines.length || !tableRows().length) {
|
|
14
|
+
<div class="good-chart-message">No data to display.</div>
|
|
15
|
+
} @else if (dataVisible()) {
|
|
16
|
+
<p class="good-chart-table-hint">Scroll horizontally to see all series.</p>
|
|
17
|
+
<good-table [label]="title() + ' data'" tableStyle="compact" [data]="tableRows()"
|
|
18
|
+
[columns]="tableColumns()" [reorderable]="false" />
|
|
19
|
+
} @else {
|
|
20
|
+
<div #plot class="good-chart-plot">
|
|
21
|
+
@if (orientation() === 'horizontal') {
|
|
22
|
+
<svg [attr.viewBox]="'0 0 ' + width() + ' ' + horizontalHeight()" role="img"
|
|
23
|
+
[attr.aria-label]="ariaLabel() || title()" [style.height.px]="horizontalHeight()"
|
|
24
|
+
preserveAspectRatio="xMidYMid meet">
|
|
25
|
+
@for (tick of horizontalValueTicks(); track $index) {
|
|
26
|
+
<line class="good-chart-grid" [attr.x1]="tick.x" [attr.x2]="tick.x"
|
|
27
|
+
[attr.y1]="top" [attr.y2]="top + horizontalPlotHeight()" />
|
|
28
|
+
<text class="good-chart-tick good-chart-x-tick" [attr.x]="tick.x"
|
|
29
|
+
[attr.y]="top + horizontalPlotHeight() + 19">{{ tick.label }}</text>
|
|
30
|
+
}
|
|
31
|
+
@for (tick of horizontalCategoryTicks(); track $index) {
|
|
32
|
+
<text class="good-chart-tick good-chart-y-tick" [attr.x]="horizontalLeft() - 10"
|
|
33
|
+
[attr.y]="tick.y + 4">{{ tick.label }}</text>
|
|
34
|
+
}
|
|
35
|
+
<line class="good-chart-baseline" [attr.x1]="horizontalValueX(baseline())"
|
|
36
|
+
[attr.x2]="horizontalValueX(baseline())" [attr.y1]="top"
|
|
37
|
+
[attr.y2]="top + horizontalPlotHeight()" />
|
|
38
|
+
@for (bar of horizontalBars(); track bar.id) {
|
|
39
|
+
<rect class="good-chart-bar" [attr.x]="bar.x" [attr.y]="bar.y"
|
|
40
|
+
[attr.width]="bar.width" [attr.height]="bar.height" [attr.fill]="bar.color" rx="2">
|
|
41
|
+
<title>{{ bar.title }}</title>
|
|
42
|
+
</rect>
|
|
43
|
+
}
|
|
44
|
+
</svg>
|
|
45
|
+
@if (xAxis().label) { <span class="good-chart-y-label">{{ xAxis().label }}</span> }
|
|
46
|
+
@if (yAxis().label) { <span class="good-chart-x-label">{{ yAxis().label }}</span> }
|
|
47
|
+
} @else {
|
|
48
|
+
<svg [attr.viewBox]="'0 0 ' + width() + ' ' + height" role="img"
|
|
49
|
+
[attr.aria-label]="ariaLabel() || title()" preserveAspectRatio="xMidYMid meet">
|
|
50
|
+
@for (tick of yTicks(); track $index) {
|
|
51
|
+
<line class="good-chart-grid" [attr.x1]="left" [attr.x2]="width() - right"
|
|
52
|
+
[attr.y1]="tick.y" [attr.y2]="tick.y" />
|
|
53
|
+
<text class="good-chart-tick good-chart-y-tick" [attr.x]="left - 9" [attr.y]="tick.y + 4">{{ tick.label }}</text>
|
|
54
|
+
}
|
|
55
|
+
<line class="good-chart-baseline" [attr.x1]="left" [attr.x2]="width() - right"
|
|
56
|
+
[attr.y1]="yPosition(baseline())" [attr.y2]="yPosition(baseline())" />
|
|
57
|
+
@for (tick of xTicks(); track $index) {
|
|
58
|
+
@if (tick.visible) {
|
|
59
|
+
<text class="good-chart-tick good-chart-x-tick" [attr.x]="tick.x"
|
|
60
|
+
[attr.y]="top + plotHeight + 19">{{ tick.label }}</text>
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
@for (bar of bars(); track bar.id) {
|
|
64
|
+
<rect class="good-chart-bar" [attr.x]="bar.x" [attr.y]="bar.y" [attr.width]="bar.width"
|
|
65
|
+
[attr.height]="bar.height" [attr.fill]="bar.color" rx="2">
|
|
66
|
+
<title>{{ bar.title }}</title>
|
|
67
|
+
</rect>
|
|
68
|
+
}
|
|
69
|
+
</svg>
|
|
70
|
+
@if (yAxis().label) { <span class="good-chart-y-label">{{ yAxis().label }}</span> }
|
|
71
|
+
@if (xAxis().label) { <span class="good-chart-x-label">{{ xAxis().label }}</span> }
|
|
72
|
+
}
|
|
73
|
+
</div>
|
|
74
|
+
<div class="good-chart-legend" aria-label="Series legend">
|
|
75
|
+
@for (item of legend(); track item.id) {
|
|
76
|
+
<span class="good-chart-legend-item"><i [style.background]="item.color" aria-hidden="true"></i>{{ item.label }}</span>
|
|
77
|
+
}
|
|
78
|
+
</div>
|
|
79
|
+
}
|
|
80
|
+
</good-card>
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ElementRef, computed, contentChildren, effect, input, signal, viewChild } from '@angular/core';
|
|
2
|
+
import { LucideChartColumn, LucideTable2 } from '@lucide/angular';
|
|
3
|
+
import { GoodButtonComponent } from './button';
|
|
4
|
+
import { GoodCardActionsDirective, GoodCardComponent, GoodCardHeaderComponent } from './card';
|
|
5
|
+
import { resolveChartColor } from './chart-colors';
|
|
6
|
+
import { GoodChartAxisDefinition, GoodChartDataSource, GoodChartSeriesDefinition, resolveChartSeries } from './chart-data';
|
|
7
|
+
import { GoodChartAxisComponent } from './line-chart';
|
|
8
|
+
import { GoodTableColumn, GoodTableComponent } from './table';
|
|
9
|
+
|
|
10
|
+
@Component({ selector: 'good-chart-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
|
+
host: { style: 'display:none' }, template: '' })
|
|
12
|
+
export class GoodChartBarComponent {
|
|
13
|
+
readonly source = input.required<string>();
|
|
14
|
+
readonly xKey = input<string | undefined>(undefined);
|
|
15
|
+
readonly yKey = input.required<string>();
|
|
16
|
+
readonly label = input('');
|
|
17
|
+
readonly color = input('');
|
|
18
|
+
|
|
19
|
+
definition(): GoodChartSeriesDefinition {
|
|
20
|
+
return { source: this.source(), xKey: this.xKey(), yKey: this.yKey(), label: this.label(), color: this.color() };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface ChartBar { id: string; x: number; y: number; width: number; height: number; color: string; title: string }
|
|
25
|
+
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'good-bar-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
+
imports: [GoodButtonComponent, GoodCardComponent, GoodCardHeaderComponent, GoodCardActionsDirective, GoodTableComponent],
|
|
29
|
+
host: { class: 'good-bar-chart' }, templateUrl: './bar-chart.html',
|
|
30
|
+
})
|
|
31
|
+
export class GoodBarChartComponent {
|
|
32
|
+
readonly title = input.required<string>();
|
|
33
|
+
readonly ariaLabel = input('');
|
|
34
|
+
readonly sources = input.required<readonly GoodChartDataSource[]>();
|
|
35
|
+
readonly colors = input<readonly string[]>([]);
|
|
36
|
+
readonly showDataToggle = input(false);
|
|
37
|
+
/** Rotates the same source categories and measures without changing their declarative keys. */
|
|
38
|
+
readonly orientation = input<'vertical' | 'horizontal'>('vertical');
|
|
39
|
+
readonly tableIcon = LucideTable2;
|
|
40
|
+
readonly chartIcon = LucideChartColumn;
|
|
41
|
+
readonly axes = contentChildren(GoodChartAxisComponent);
|
|
42
|
+
readonly barDefinitions = contentChildren(GoodChartBarComponent);
|
|
43
|
+
readonly plotElement = viewChild<ElementRef<HTMLElement>>('plot');
|
|
44
|
+
readonly dataVisible = signal(false);
|
|
45
|
+
readonly width = signal(700);
|
|
46
|
+
private readonly observePlot = effect(onCleanup => {
|
|
47
|
+
const element = this.plotElement()?.nativeElement;
|
|
48
|
+
if (!element || typeof ResizeObserver === 'undefined') return;
|
|
49
|
+
const observer = new ResizeObserver(entries => this.width.set(Math.max(280, Math.round(entries[0].contentRect.width))));
|
|
50
|
+
observer.observe(element);
|
|
51
|
+
onCleanup(() => observer.disconnect());
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
readonly xAxis = computed<GoodChartAxisDefinition>(() => this.axes().find(axis => axis.position() === 'x')?.definition() ?? { type: 'category' });
|
|
55
|
+
readonly yAxis = computed<GoodChartAxisDefinition>(() => this.axes().find(axis => axis.position() === 'y')?.definition() ?? { type: 'number' });
|
|
56
|
+
readonly resolved = computed(() => resolveChartSeries(this.sources(), this.barDefinitions().map(bar => bar.definition()), this.xAxis(), 'Bar'));
|
|
57
|
+
readonly height = 300;
|
|
58
|
+
readonly left = 55;
|
|
59
|
+
readonly top = 16;
|
|
60
|
+
readonly bottom = 47;
|
|
61
|
+
readonly right = 18;
|
|
62
|
+
readonly plotWidth = computed(() => Math.max(100, this.width() - this.left - this.right));
|
|
63
|
+
readonly plotHeight = this.height - this.top - this.bottom;
|
|
64
|
+
|
|
65
|
+
readonly xValues = computed<readonly (string | number)[]>(() => {
|
|
66
|
+
const values = new Set<string | number>();
|
|
67
|
+
for (const line of this.resolved().lines) for (const point of line.points) values.add(point.x);
|
|
68
|
+
const ordered = [...values];
|
|
69
|
+
return this.xAxis().type === 'category' ? ordered : ordered.sort((a, b) => Number(a) - Number(b));
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
readonly xDomain = computed<[number, number]>(() => {
|
|
73
|
+
const values = this.xValues().map(Number).filter(Number.isFinite);
|
|
74
|
+
const axis = this.xAxis();
|
|
75
|
+
const bound = (value: number | string | Date | null | undefined): number | null => {
|
|
76
|
+
if (value == null) return null;
|
|
77
|
+
const n = axis.type === 'time' ? new Date(value).getTime() : Number(value);
|
|
78
|
+
return Number.isFinite(n) ? n : null;
|
|
79
|
+
};
|
|
80
|
+
const min = bound(axis.min) ?? Math.min(...values);
|
|
81
|
+
const max = bound(axis.max) ?? Math.max(...values);
|
|
82
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];
|
|
83
|
+
return min === max ? [min - 1, max + 1] : [min, max];
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
readonly yDomain = computed<[number, number]>(() => {
|
|
87
|
+
const values = this.resolved().lines.flatMap(line => line.points.map(point => point.y));
|
|
88
|
+
const axis = this.yAxis();
|
|
89
|
+
const requestedMin = typeof axis.min === 'number' && Number.isFinite(axis.min) ? axis.min : null;
|
|
90
|
+
const requestedMax = typeof axis.max === 'number' && Number.isFinite(axis.max) ? axis.max : null;
|
|
91
|
+
const rawMin = Math.min(0, ...values);
|
|
92
|
+
const rawMax = Math.max(0, ...values);
|
|
93
|
+
const padding = Math.max(1, (rawMax - rawMin) * .08);
|
|
94
|
+
const min = requestedMin ?? (rawMin < 0 ? rawMin - padding : 0);
|
|
95
|
+
const max = requestedMax ?? (rawMax > 0 ? rawMax + padding : 1);
|
|
96
|
+
return min < max ? [min, max] : [min - 1, min + 1];
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
readonly yTicks = computed(() => {
|
|
100
|
+
const [min, max] = this.yDomain();
|
|
101
|
+
const count = Math.max(2, Math.min(10, Math.round(this.yAxis().ticks ?? 5)));
|
|
102
|
+
return Array.from({ length: count }, (_, index) => {
|
|
103
|
+
const value = min + (max - min) * index / (count - 1);
|
|
104
|
+
return { y: this.yPosition(value), label: this.formatNumber(value, this.yAxis().precision) };
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
readonly xTicks = computed(() => {
|
|
109
|
+
const axis = this.xAxis();
|
|
110
|
+
const maxLabels = Math.max(2, Math.floor(this.plotWidth() / 58));
|
|
111
|
+
if (axis.type === 'category') {
|
|
112
|
+
const values = this.xValues();
|
|
113
|
+
const step = Math.max(1, Math.ceil(values.length / maxLabels));
|
|
114
|
+
return values.map((value, index) => ({ x: this.xPosition(value), label: String(value),
|
|
115
|
+
visible: index % step === 0 || (index === values.length - 1 && (index - 1) % step !== 0) }));
|
|
116
|
+
}
|
|
117
|
+
const [min, max] = this.xDomain();
|
|
118
|
+
const count = Math.max(2, Math.min(maxLabels, Math.round(axis.ticks ?? 5)));
|
|
119
|
+
return Array.from({ length: count }, (_, index) => {
|
|
120
|
+
const value = min + (max - min) * index / (count - 1);
|
|
121
|
+
return { x: this.xPosition(value), label: axis.type === 'time' ? this.formatTime(value) : this.formatNumber(value, axis.precision), visible: true };
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
readonly bandWidth = computed(() => {
|
|
126
|
+
const positions = this.xValues().map(x => this.xPosition(x));
|
|
127
|
+
const distances = positions.slice(1).map((x, index) => x - positions[index]).filter(distance => distance > 0);
|
|
128
|
+
const spacing = distances.length ? Math.min(...distances) : this.plotWidth();
|
|
129
|
+
return Math.max(6, Math.min(88, spacing * .72));
|
|
130
|
+
});
|
|
131
|
+
readonly baseline = computed(() => {
|
|
132
|
+
const [min, max] = this.yDomain();
|
|
133
|
+
return Math.max(min, Math.min(max, 0));
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
readonly bars = computed<readonly ChartBar[]>(() => {
|
|
137
|
+
const lines = this.resolved().lines;
|
|
138
|
+
const barWidth = this.bandWidth() / Math.max(1, lines.length);
|
|
139
|
+
const [min, max] = this.yDomain();
|
|
140
|
+
const zeroY = this.yPosition(this.baseline());
|
|
141
|
+
return lines.flatMap((line, seriesIndex) => line.points.map(point => {
|
|
142
|
+
const valueY = this.yPosition(Math.max(min, Math.min(max, point.y)));
|
|
143
|
+
const x = this.xPosition(point.x) - this.bandWidth() / 2 + seriesIndex * barWidth + 1;
|
|
144
|
+
return { id: `${line.id}:${point.x}`, x, y: Math.min(zeroY, valueY), width: Math.max(2, barWidth - 2),
|
|
145
|
+
height: Math.abs(zeroY - valueY), color: resolveChartColor(line.color, this.colors(), seriesIndex),
|
|
146
|
+
title: `${line.label}, ${this.formatX(point.x)}: ${this.formatNumber(point.y, undefined)}` };
|
|
147
|
+
}));
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
readonly horizontalHeight = computed(() => Math.max(300, this.xValues().length * 46 + this.top + this.bottom));
|
|
151
|
+
readonly horizontalLeft = computed(() => Math.min(160, Math.max(70,
|
|
152
|
+
...this.xValues().map(value => this.formatX(value).length * 7 + 16))));
|
|
153
|
+
readonly horizontalPlotWidth = computed(() => Math.max(100, this.width() - this.horizontalLeft() - this.right));
|
|
154
|
+
readonly horizontalPlotHeight = computed(() => this.horizontalHeight() - this.top - this.bottom);
|
|
155
|
+
readonly horizontalValueTicks = computed(() => {
|
|
156
|
+
const [min, max] = this.yDomain();
|
|
157
|
+
const count = Math.max(2, Math.min(Math.floor(this.horizontalPlotWidth() / 58), Math.round(this.yAxis().ticks ?? 5)));
|
|
158
|
+
return Array.from({ length: count }, (_, index) => {
|
|
159
|
+
const value = min + (max - min) * index / (count - 1);
|
|
160
|
+
return { x: this.horizontalValueX(value), label: this.formatNumber(value, this.yAxis().precision) };
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
readonly horizontalCategoryTicks = computed(() => this.xValues().map((value, index) => ({
|
|
164
|
+
y: this.top + (index + .5) * this.horizontalPlotHeight() / Math.max(1, this.xValues().length),
|
|
165
|
+
label: this.formatX(value),
|
|
166
|
+
})));
|
|
167
|
+
readonly horizontalBars = computed<readonly ChartBar[]>(() => {
|
|
168
|
+
const lines = this.resolved().lines;
|
|
169
|
+
const values = this.xValues();
|
|
170
|
+
const groupHeight = this.horizontalPlotHeight() / Math.max(1, values.length);
|
|
171
|
+
const barHeight = Math.min(22, groupHeight * .72 / Math.max(1, lines.length));
|
|
172
|
+
const [min, max] = this.yDomain();
|
|
173
|
+
const zeroX = this.horizontalValueX(this.baseline());
|
|
174
|
+
return lines.flatMap((line, seriesIndex) => line.points.map(point => {
|
|
175
|
+
const index = values.indexOf(point.x);
|
|
176
|
+
const valueX = this.horizontalValueX(Math.max(min, Math.min(max, point.y)));
|
|
177
|
+
return { id: `${line.id}:${point.x}`, x: Math.min(zeroX, valueX),
|
|
178
|
+
y: this.top + (index + .5) * groupHeight - lines.length * barHeight / 2 + seriesIndex * barHeight,
|
|
179
|
+
width: Math.abs(valueX - zeroX), height: Math.max(2, barHeight - 2),
|
|
180
|
+
color: resolveChartColor(line.color, this.colors(), seriesIndex),
|
|
181
|
+
title: `${line.label}, ${this.formatX(point.x)}: ${this.formatNumber(point.y, undefined)}` };
|
|
182
|
+
}));
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
readonly legend = computed(() => this.resolved().lines.map((line, index) => ({
|
|
186
|
+
id: line.id, label: line.label, color: resolveChartColor(line.color, this.colors(), index),
|
|
187
|
+
})));
|
|
188
|
+
|
|
189
|
+
readonly tableRows = computed(() => this.xValues().map(x => {
|
|
190
|
+
const row: Record<string, string | number> = { x: this.formatX(x) };
|
|
191
|
+
this.resolved().lines.forEach((line, index) => {
|
|
192
|
+
row[`bar${index}`] = line.points.find(point => point.x === x)?.y ?? '—';
|
|
193
|
+
});
|
|
194
|
+
return row;
|
|
195
|
+
}));
|
|
196
|
+
|
|
197
|
+
readonly tableColumns = computed<GoodTableColumn<Record<string, string | number>>[]>(() => [
|
|
198
|
+
{ accessorKey: 'x', header: this.xAxis().label || 'X' },
|
|
199
|
+
...this.resolved().lines.map((line, index) => ({ accessorKey: `bar${index}`, header: line.label, meta: { align: 'end' as const } })),
|
|
200
|
+
]);
|
|
201
|
+
|
|
202
|
+
xPosition(value: string | number): number {
|
|
203
|
+
if (this.xAxis().type === 'category') {
|
|
204
|
+
const index = this.xValues().indexOf(value);
|
|
205
|
+
return this.left + (index + .5) * this.plotWidth() / Math.max(1, this.xValues().length);
|
|
206
|
+
}
|
|
207
|
+
const [min, max] = this.xDomain();
|
|
208
|
+
const inset = Math.min(44, this.plotWidth() * .12);
|
|
209
|
+
return this.left + inset + (Number(value) - min) * (this.plotWidth() - inset * 2) / (max - min);
|
|
210
|
+
}
|
|
211
|
+
yPosition(value: number): number {
|
|
212
|
+
const [min, max] = this.yDomain();
|
|
213
|
+
return this.top + (max - value) * this.plotHeight / (max - min);
|
|
214
|
+
}
|
|
215
|
+
horizontalValueX(value: number): number {
|
|
216
|
+
const [min, max] = this.yDomain();
|
|
217
|
+
return this.horizontalLeft() + (value - min) * this.horizontalPlotWidth() / (max - min);
|
|
218
|
+
}
|
|
219
|
+
formatNumber(value: number, precision: number | undefined): string {
|
|
220
|
+
const digits = precision == null ? (Number.isInteger(value) ? 0 : 1) : Math.max(0, Math.min(4, Math.round(precision)));
|
|
221
|
+
return new Intl.NumberFormat('en-US', { maximumFractionDigits: digits, minimumFractionDigits: digits }).format(value);
|
|
222
|
+
}
|
|
223
|
+
formatTime(time: number): string {
|
|
224
|
+
const group = this.xAxis().groupBy;
|
|
225
|
+
const options: Intl.DateTimeFormatOptions = group === 'year' ? { year: 'numeric', timeZone: 'UTC' } :
|
|
226
|
+
group === 'month' ? { month: 'short', year: '2-digit', timeZone: 'UTC' } :
|
|
227
|
+
{ month: 'short', day: 'numeric', timeZone: 'UTC' };
|
|
228
|
+
return new Intl.DateTimeFormat('en-US', options).format(time);
|
|
229
|
+
}
|
|
230
|
+
formatX(value: string | number): string {
|
|
231
|
+
return this.xAxis().type === 'time' ? this.formatTime(Number(value)) : String(value);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
2
|
+
import { RouterLink } from '@angular/router';
|
|
3
|
+
import { LucideChevronRight, LucideDynamicIcon } from '@lucide/angular';
|
|
4
|
+
import { GoodButtonIcon } from './models';
|
|
5
|
+
import { GoodDropdownComponent, GoodDropdownItem } from './dropdown';
|
|
6
|
+
|
|
7
|
+
export interface GoodBreadcrumbItem {
|
|
8
|
+
label: string;
|
|
9
|
+
route?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type BreadcrumbNode = { kind: 'item'; item: GoodBreadcrumbItem; index: number } | { kind: 'overflow'; items: readonly GoodDropdownItem[] };
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'good-breadcrumbs',
|
|
16
|
+
standalone: true,
|
|
17
|
+
imports: [RouterLink, LucideDynamicIcon, GoodDropdownComponent],
|
|
18
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
19
|
+
host: { class: 'good-breadcrumbs', '[class.good-breadcrumbs-card]': 'card()' },
|
|
20
|
+
template: `
|
|
21
|
+
<nav [attr.aria-label]="ariaLabel()">
|
|
22
|
+
<ol class="good-breadcrumbs-list">
|
|
23
|
+
@for (node of visibleNodes(); track node.kind === 'item' ? node.index : 'overflow'; let first = $first) {
|
|
24
|
+
<li class="good-breadcrumbs-entry">
|
|
25
|
+
@if (!first) {
|
|
26
|
+
<span class="good-breadcrumbs-separator" aria-hidden="true">
|
|
27
|
+
@if (separatorIcon(); as icon) { <svg [lucideIcon]="icon" [size]="14"></svg> }
|
|
28
|
+
@else { {{ separator() }} }
|
|
29
|
+
</span>
|
|
30
|
+
}
|
|
31
|
+
@if (node.kind === 'overflow') {
|
|
32
|
+
<good-dropdown class="good-breadcrumbs-overflow" [items]="node.items" menuLabel="Hidden breadcrumb pages"
|
|
33
|
+
[showChevron]="false" variant="ghost" size="small" placement="bottom-start">
|
|
34
|
+
<span goodDropdownTrigger>…</span>
|
|
35
|
+
</good-dropdown>
|
|
36
|
+
} @else if (node.index === items().length - 1) {
|
|
37
|
+
<span class="good-breadcrumbs-current" aria-current="page">{{ node.item.label }}</span>
|
|
38
|
+
} @else if (node.item.route) {
|
|
39
|
+
<a class="good-breadcrumbs-link" [routerLink]="node.item.route" [attr.aria-label]="node.index === 0 && homeIcon() ? node.item.label : null">
|
|
40
|
+
@if (node.index === 0 && homeIcon(); as icon) { <svg [lucideIcon]="icon" [size]="16" aria-hidden="true"></svg> }
|
|
41
|
+
@else { {{ node.item.label }} }
|
|
42
|
+
</a>
|
|
43
|
+
} @else {
|
|
44
|
+
<span class="good-breadcrumbs-label" [attr.aria-label]="node.index === 0 && homeIcon() ? node.item.label : null">
|
|
45
|
+
@if (node.index === 0 && homeIcon(); as icon) { <svg [lucideIcon]="icon" [size]="16" aria-hidden="true"></svg> }
|
|
46
|
+
@else { {{ node.item.label }} }
|
|
47
|
+
</span>
|
|
48
|
+
}
|
|
49
|
+
</li>
|
|
50
|
+
}
|
|
51
|
+
</ol>
|
|
52
|
+
</nav>
|
|
53
|
+
`,
|
|
54
|
+
})
|
|
55
|
+
export class GoodBreadcrumbsComponent {
|
|
56
|
+
readonly items = input<readonly GoodBreadcrumbItem[]>([]);
|
|
57
|
+
readonly homeIcon = input<GoodButtonIcon>();
|
|
58
|
+
readonly separator = input<GoodButtonIcon | string>(LucideChevronRight);
|
|
59
|
+
readonly separatorIcon = computed(() => typeof this.separator() === 'string' ? null : this.separator() as GoodButtonIcon);
|
|
60
|
+
readonly maxItems = input<number | null>(null);
|
|
61
|
+
readonly card = input(false);
|
|
62
|
+
readonly ariaLabel = input('Breadcrumb');
|
|
63
|
+
|
|
64
|
+
readonly visibleNodes = computed<readonly BreadcrumbNode[]>(() => {
|
|
65
|
+
const items = this.items();
|
|
66
|
+
const limit = this.maxItems();
|
|
67
|
+
const count = limit === null || !Number.isFinite(limit) ? null : Math.max(3, Math.trunc(limit));
|
|
68
|
+
if (count === null || items.length <= count) {
|
|
69
|
+
return items.map((item, index) => ({ kind: 'item', item, index }));
|
|
70
|
+
}
|
|
71
|
+
const tailStart = items.length - (count - 2);
|
|
72
|
+
const hidden = items.slice(1, tailStart).map((item, index): GoodDropdownItem => ({
|
|
73
|
+
id: `breadcrumb-${index + 1}`, label: item.label, route: item.route, disabled: !item.route,
|
|
74
|
+
}));
|
|
75
|
+
return [
|
|
76
|
+
{ kind: 'item', item: items[0], index: 0 },
|
|
77
|
+
{ kind: 'overflow', items: hidden },
|
|
78
|
+
...items.slice(tailStart).map((item, offset) => ({ kind: 'item' as const, item, index: tailStart + offset })),
|
|
79
|
+
];
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
2
|
+
import { LucideDynamicIcon } from '@lucide/angular';
|
|
3
|
+
import { GoodButtonIcon, GoodButtonSize, GoodButtonVariant } from './models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'good-button',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [LucideDynamicIcon],
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
template: `
|
|
11
|
+
<button class="good-button-control" [class.good-button-icon-only]="iconOnly()" [type]="type()"
|
|
12
|
+
[attr.data-variant]="variant()" [attr.data-size]="size()"
|
|
13
|
+
[disabled]="disabled()" [attr.aria-label]="ariaLabel() || null"
|
|
14
|
+
[attr.aria-pressed]="ariaPressed()"
|
|
15
|
+
[attr.aria-expanded]="ariaExpanded()" [attr.aria-controls]="ariaControls() || null"
|
|
16
|
+
[attr.aria-haspopup]="hasPopup() || null">
|
|
17
|
+
@if (icon(); as iconData) { <svg class="good-button-icon" [lucideIcon]="iconData" [size]="iconSize()" aria-hidden="true"></svg> }
|
|
18
|
+
@if (!iconOnly()) { <span class="good-button-label"><ng-content /></span> }
|
|
19
|
+
@if (endIcon(); as iconData) { <svg class="good-button-icon good-button-end-icon" [lucideIcon]="iconData" [size]="iconSize()" aria-hidden="true"></svg> }
|
|
20
|
+
</button>
|
|
21
|
+
`,
|
|
22
|
+
host: { class: 'good-button' },
|
|
23
|
+
})
|
|
24
|
+
export class GoodButtonComponent {
|
|
25
|
+
readonly icon = input<GoodButtonIcon>();
|
|
26
|
+
readonly endIcon = input<GoodButtonIcon>();
|
|
27
|
+
readonly iconOnly = input(false);
|
|
28
|
+
readonly variant = input<GoodButtonVariant>('default');
|
|
29
|
+
readonly size = input<GoodButtonSize>('default');
|
|
30
|
+
readonly iconSize = computed(() => ({ small: 14, default: 16, large: 20 })[this.size()]);
|
|
31
|
+
readonly ariaLabel = input('');
|
|
32
|
+
readonly ariaPressed = input<boolean | null>(null);
|
|
33
|
+
readonly disabled = input(false);
|
|
34
|
+
readonly type = input<'button' | 'submit' | 'reset'>('button');
|
|
35
|
+
readonly ariaExpanded = input<boolean | null>(null);
|
|
36
|
+
readonly ariaControls = input('');
|
|
37
|
+
readonly hasPopup = input('');
|
|
38
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { GoodCalendarEvent, goodCalendarAddDays, goodCalendarStartOfDay, goodCalendarStartOfWeek } from './calendar-service';
|
|
2
|
+
|
|
3
|
+
export interface GoodCalendarTimedPlacement {
|
|
4
|
+
event: GoodCalendarEvent;
|
|
5
|
+
startMinute: number;
|
|
6
|
+
endMinute: number;
|
|
7
|
+
column: number;
|
|
8
|
+
columns: number;
|
|
9
|
+
continuesBefore: boolean;
|
|
10
|
+
continuesAfter: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function goodCalendarEventsOnDay(events: readonly GoodCalendarEvent[], day: Date): GoodCalendarEvent[] {
|
|
14
|
+
const start = goodCalendarStartOfDay(day).getTime();
|
|
15
|
+
const end = goodCalendarAddDays(day, 1).getTime();
|
|
16
|
+
return events.filter(event => event.start.getTime() < end && event.end.getTime() > start)
|
|
17
|
+
.sort((a, b) => Number(!!b.allDay) - Number(!!a.allDay) || a.start.getTime() - b.start.getTime() || a.title.localeCompare(b.title));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function goodCalendarMonthDays(date: Date, weekStartsOn = 1): Date[] {
|
|
21
|
+
const first = goodCalendarStartOfWeek(new Date(date.getFullYear(), date.getMonth(), 1), weekStartsOn);
|
|
22
|
+
const last = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
23
|
+
const elapsed = Math.round((Date.UTC(last.getFullYear(), last.getMonth(), last.getDate()) - Date.UTC(first.getFullYear(), first.getMonth(), first.getDate())) / 86_400_000);
|
|
24
|
+
const count = Math.max(35, Math.ceil((elapsed + 1) / 7) * 7);
|
|
25
|
+
return Array.from({ length: count }, (_, index) => goodCalendarAddDays(first, index));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Assign a stable, non-overlapping lane to every timed segment in one day. */
|
|
29
|
+
export function goodCalendarTimedPlacements(events: readonly GoodCalendarEvent[], day: Date): GoodCalendarTimedPlacement[] {
|
|
30
|
+
const dayStart = goodCalendarStartOfDay(day);
|
|
31
|
+
const dayEnd = goodCalendarAddDays(dayStart, 1);
|
|
32
|
+
const slices = goodCalendarEventsOnDay(events, day).filter(event => !event.allDay).map(event => {
|
|
33
|
+
const start = event.start < dayStart ? dayStart : event.start;
|
|
34
|
+
const end = event.end > dayEnd ? dayEnd : event.end;
|
|
35
|
+
return {
|
|
36
|
+
event,
|
|
37
|
+
startMinute: event.start < dayStart ? 0 : start.getHours() * 60 + start.getMinutes(),
|
|
38
|
+
endMinute: event.end >= dayEnd ? 1440 : end.getHours() * 60 + end.getMinutes(),
|
|
39
|
+
column: 0,
|
|
40
|
+
columns: 1,
|
|
41
|
+
continuesBefore: event.start < dayStart,
|
|
42
|
+
continuesAfter: event.end > dayEnd,
|
|
43
|
+
};
|
|
44
|
+
}).sort((a, b) => a.startMinute - b.startMinute || b.endMinute - a.endMinute || a.event.id.localeCompare(b.event.id));
|
|
45
|
+
|
|
46
|
+
let cluster: typeof slices = [];
|
|
47
|
+
let clusterEnd = -1;
|
|
48
|
+
const finish = () => {
|
|
49
|
+
if (!cluster.length) return;
|
|
50
|
+
const laneEnds: number[] = [];
|
|
51
|
+
for (const slice of cluster) {
|
|
52
|
+
let lane = laneEnds.findIndex(end => end <= slice.startMinute);
|
|
53
|
+
if (lane < 0) lane = laneEnds.length;
|
|
54
|
+
laneEnds[lane] = slice.endMinute;
|
|
55
|
+
slice.column = lane;
|
|
56
|
+
}
|
|
57
|
+
for (const slice of cluster) slice.columns = laneEnds.length;
|
|
58
|
+
cluster = [];
|
|
59
|
+
clusterEnd = -1;
|
|
60
|
+
};
|
|
61
|
+
for (const slice of slices) {
|
|
62
|
+
if (cluster.length && slice.startMinute >= clusterEnd) finish();
|
|
63
|
+
cluster.push(slice);
|
|
64
|
+
clusterEnd = Math.max(clusterEnd, slice.endMinute);
|
|
65
|
+
}
|
|
66
|
+
finish();
|
|
67
|
+
return slices;
|
|
68
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Injectable, signal } from '@angular/core';
|
|
2
|
+
import { GoodMarkerColor } from './marker-colors';
|
|
3
|
+
|
|
4
|
+
export type GoodCalendarView = 'month' | 'week' | 'day' | 'list';
|
|
5
|
+
export type GoodCalendarTone = 'brand' | 'secondary' | 'success' | 'warning' | 'destructive' | 'info';
|
|
6
|
+
|
|
7
|
+
/** Timed dates are local Date values or ISO timestamps with an offset. End is exclusive. */
|
|
8
|
+
export interface GoodCalendarEventInput {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
start: Date | string;
|
|
12
|
+
end: Date | string;
|
|
13
|
+
allDay?: boolean;
|
|
14
|
+
tone?: GoodCalendarTone;
|
|
15
|
+
/** A domain category color; takes precedence over tone when supplied. */
|
|
16
|
+
marker?: GoodMarkerColor;
|
|
17
|
+
description?: string;
|
|
18
|
+
draggable?: boolean;
|
|
19
|
+
/** Opt in to changing the end with a pointer or keyboard. */
|
|
20
|
+
resizable?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface GoodCalendarEvent extends Omit<GoodCalendarEventInput, 'start' | 'end'> {
|
|
24
|
+
start: Date;
|
|
25
|
+
end: Date;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface GoodCalendarMove {
|
|
29
|
+
event: GoodCalendarEvent;
|
|
30
|
+
previousStart: Date;
|
|
31
|
+
previousEnd: Date;
|
|
32
|
+
start: Date;
|
|
33
|
+
end: Date;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Start stays fixed while the end changes. In controlled mode, persist and supply the proposed end yourself. */
|
|
37
|
+
export interface GoodCalendarResize {
|
|
38
|
+
event: GoodCalendarEvent;
|
|
39
|
+
previousStart: Date;
|
|
40
|
+
previousEnd: Date;
|
|
41
|
+
start: Date;
|
|
42
|
+
end: Date;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GoodCalendarRange { start: Date; end: Date; view: GoodCalendarView; }
|
|
46
|
+
|
|
47
|
+
export function goodCalendarStartOfDay(value: Date): Date {
|
|
48
|
+
return new Date(value.getFullYear(), value.getMonth(), value.getDate());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function goodCalendarAddDays(value: Date, days: number): Date {
|
|
52
|
+
const result = new Date(value);
|
|
53
|
+
result.setDate(result.getDate() + days);
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function goodCalendarStartOfWeek(value: Date, weekStartsOn = 1): Date {
|
|
58
|
+
const day = goodCalendarStartOfDay(value);
|
|
59
|
+
const first = ((weekStartsOn % 7) + 7) % 7;
|
|
60
|
+
return goodCalendarAddDays(day, -((day.getDay() - first + 7) % 7));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function goodCalendarDayKey(value: Date): string {
|
|
64
|
+
return `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, '0')}-${String(value.getDate()).padStart(2, '0')}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parseDate(value: Date | string): Date {
|
|
68
|
+
if (value instanceof Date) return new Date(value);
|
|
69
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
70
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
71
|
+
const result = new Date(year, month - 1, day);
|
|
72
|
+
return result.getFullYear() === year && result.getMonth() === month - 1 && result.getDate() === day ? result : new Date(Number.NaN);
|
|
73
|
+
}
|
|
74
|
+
return new Date(value);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function goodCalendarNormalizeEvent(input: GoodCalendarEventInput): GoodCalendarEvent {
|
|
78
|
+
const start = parseDate(input.start);
|
|
79
|
+
const end = parseDate(input.end);
|
|
80
|
+
if (!input.id || !input.title.trim() || !Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime()) || end <= start) {
|
|
81
|
+
throw new RangeError('Calendar events need an id, a title, and an end after the start.');
|
|
82
|
+
}
|
|
83
|
+
if (input.allDay && [start, end].some(date => date.getHours() || date.getMinutes() || date.getSeconds() || date.getMilliseconds())) {
|
|
84
|
+
throw new RangeError('All-day calendar events must begin and end at local midnight.');
|
|
85
|
+
}
|
|
86
|
+
return { ...input, start, end };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Preserve the duration when moving a timed event; preserve calendar-day length for all-day events. */
|
|
90
|
+
export function goodCalendarMoveEvent(event: GoodCalendarEvent, start: Date): GoodCalendarEvent {
|
|
91
|
+
if (!Number.isFinite(start.getTime())) throw new RangeError('The new event start must be a valid date.');
|
|
92
|
+
if (!event.allDay) return { ...event, start: new Date(start), end: new Date(start.getTime() + event.end.getTime() - event.start.getTime()) };
|
|
93
|
+
const oldStart = goodCalendarStartOfDay(event.start);
|
|
94
|
+
const oldEnd = goodCalendarStartOfDay(event.end);
|
|
95
|
+
const dayCount = Math.round((Date.UTC(oldEnd.getFullYear(), oldEnd.getMonth(), oldEnd.getDate()) - Date.UTC(oldStart.getFullYear(), oldStart.getMonth(), oldStart.getDate())) / 86_400_000);
|
|
96
|
+
const nextStart = goodCalendarStartOfDay(start);
|
|
97
|
+
return { ...event, start: nextStart, end: goodCalendarAddDays(nextStart, Math.max(1, dayCount)) };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function goodCalendarResizeEvent(event: GoodCalendarEvent, end: Date): GoodCalendarEvent {
|
|
101
|
+
if (!Number.isFinite(end.getTime()) || end <= event.start) throw new RangeError('The new calendar event end must be after its start.');
|
|
102
|
+
if (event.allDay && [end.getHours(), end.getMinutes(), end.getSeconds(), end.getMilliseconds()].some(Boolean)) {
|
|
103
|
+
throw new RangeError('An all-day calendar event must end at local midnight.');
|
|
104
|
+
}
|
|
105
|
+
return { ...event, end: new Date(end) };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@Injectable({ providedIn: 'root' })
|
|
109
|
+
export class GoodCalendarService {
|
|
110
|
+
private readonly state = signal<readonly GoodCalendarEvent[]>([]);
|
|
111
|
+
readonly events = this.state.asReadonly();
|
|
112
|
+
|
|
113
|
+
setEvents(events: readonly GoodCalendarEventInput[]): void {
|
|
114
|
+
const normalized = events.map(goodCalendarNormalizeEvent);
|
|
115
|
+
if (new Set(normalized.map(event => event.id)).size !== normalized.length) throw new RangeError('Calendar event ids must be unique.');
|
|
116
|
+
this.state.set(normalized);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
upsertEvent(input: GoodCalendarEventInput): void {
|
|
120
|
+
const event = goodCalendarNormalizeEvent(input);
|
|
121
|
+
this.state.update(events => events.some(current => current.id === event.id)
|
|
122
|
+
? events.map(current => current.id === event.id ? event : current)
|
|
123
|
+
: [...events, event]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
removeEvent(id: string): void { this.state.update(events => events.filter(event => event.id !== id)); }
|
|
127
|
+
clear(): void { this.state.set([]); }
|
|
128
|
+
|
|
129
|
+
moveEvent(id: string, start: Date): GoodCalendarEvent | null {
|
|
130
|
+
const current = this.state().find(event => event.id === id);
|
|
131
|
+
if (!current) return null;
|
|
132
|
+
const moved = goodCalendarMoveEvent(current, start);
|
|
133
|
+
this.state.update(events => events.map(event => event.id === id ? moved : event));
|
|
134
|
+
return moved;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
resizeEvent(id: string, end: Date): GoodCalendarEvent | null {
|
|
138
|
+
const current = this.state().find(event => event.id === id);
|
|
139
|
+
if (!current) return null;
|
|
140
|
+
const resized = goodCalendarResizeEvent(current, end);
|
|
141
|
+
this.state.update(events => events.map(event => event.id === id ? resized : event));
|
|
142
|
+
return resized;
|
|
143
|
+
}
|
|
144
|
+
}
|