@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,471 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, HostListener, LOCALE_ID, afterNextRender, computed, effect, inject, input, model, output, signal, viewChild } from '@angular/core';
|
|
2
|
+
import { LucideChevronLeft, LucideChevronRight } from '@lucide/angular';
|
|
3
|
+
import { GoodButtonComponent } from './button';
|
|
4
|
+
import {
|
|
5
|
+
GoodCalendarEvent, GoodCalendarEventInput, GoodCalendarMove, GoodCalendarRange, GoodCalendarResize, GoodCalendarService, GoodCalendarView,
|
|
6
|
+
goodCalendarAddDays, goodCalendarDayKey, goodCalendarMoveEvent, goodCalendarNormalizeEvent, goodCalendarResizeEvent,
|
|
7
|
+
goodCalendarStartOfDay, goodCalendarStartOfWeek,
|
|
8
|
+
} from './calendar-service';
|
|
9
|
+
import { GoodCalendarTimedPlacement, goodCalendarEventsOnDay, goodCalendarMonthDays, goodCalendarTimedPlacements } from './calendar-layout';
|
|
10
|
+
import { GOOD_CALENDAR_DEFAULT_NON_WORKING_LABELS, GOOD_CALENDAR_DEFAULT_WORKING_HOURS, GoodCalendarMinuteRange, GoodCalendarNonWorkingLabel, GoodCalendarWorkingPeriod, goodCalendarNonWorkingPeriods } from './calendar-working-hours';
|
|
11
|
+
|
|
12
|
+
export interface GoodCalendarEmptyAction { date: Date; start: Date; end: Date; }
|
|
13
|
+
/** A date-only string is interpreted in the calendar's local time zone. */
|
|
14
|
+
export interface GoodCalendarHoliday { date: Date | string; name: string; }
|
|
15
|
+
|
|
16
|
+
let nextCalendarSidebarId = 0;
|
|
17
|
+
|
|
18
|
+
interface CalendarDay {
|
|
19
|
+
date: Date;
|
|
20
|
+
key: string;
|
|
21
|
+
inMonth: boolean;
|
|
22
|
+
today: boolean;
|
|
23
|
+
holidays: string[];
|
|
24
|
+
events: GoodCalendarEvent[];
|
|
25
|
+
allDay: GoodCalendarEvent[];
|
|
26
|
+
timed: GoodCalendarTimedPlacement[];
|
|
27
|
+
nonWorking: GoodCalendarMinuteRange[];
|
|
28
|
+
fullyNonWorking: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface CalendarDrag {
|
|
32
|
+
event: GoodCalendarEvent;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
moved: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface CalendarResizeDrag extends CalendarDrag { allDay: boolean; offsetMinutes: number; }
|
|
39
|
+
|
|
40
|
+
interface CalendarTarget { key: string; minute: number | null; }
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
selector: 'good-calendar',
|
|
44
|
+
standalone: true,
|
|
45
|
+
imports: [GoodButtonComponent],
|
|
46
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
47
|
+
templateUrl: './calendar.html',
|
|
48
|
+
host: { class: 'good-calendar', '[attr.data-view]': 'view()', '[attr.data-disabled]': 'disabled()', '[attr.data-fill-height]': 'fillHeight()' },
|
|
49
|
+
})
|
|
50
|
+
export class GoodCalendarComponent {
|
|
51
|
+
readonly calendar = inject(GoodCalendarService);
|
|
52
|
+
readonly view = model<GoodCalendarView>('week');
|
|
53
|
+
readonly date = model<Date>(new Date());
|
|
54
|
+
readonly selectedEventId = model<string | null>(null);
|
|
55
|
+
/** Omit this input to use GoodCalendarService. With it, listen to eventMoved and update the source yourself. */
|
|
56
|
+
readonly events = input<readonly GoodCalendarEventInput[] | null>(null);
|
|
57
|
+
readonly locale = input<string | undefined>();
|
|
58
|
+
readonly holidays = input<readonly GoodCalendarHoliday[]>([]);
|
|
59
|
+
readonly weekStartsOn = input(1);
|
|
60
|
+
readonly listDays = input(14);
|
|
61
|
+
readonly snapMinutes = input(15);
|
|
62
|
+
readonly hourHeight = input(64);
|
|
63
|
+
readonly workingHours = input<readonly GoodCalendarWorkingPeriod[]>(GOOD_CALENDAR_DEFAULT_WORKING_HOURS);
|
|
64
|
+
readonly nonWorkingLabels = input<readonly GoodCalendarNonWorkingLabel[]>(GOOD_CALENDAR_DEFAULT_NON_WORKING_LABELS);
|
|
65
|
+
readonly maxMonthEvents = input(3);
|
|
66
|
+
readonly showCurrentTime = input(true);
|
|
67
|
+
/** Show a compact seven-day picker above the day grid in narrow containers. */
|
|
68
|
+
readonly showDayStrip = input(false);
|
|
69
|
+
readonly editable = input(true);
|
|
70
|
+
readonly disabled = input(false);
|
|
71
|
+
readonly label = input('Calendar');
|
|
72
|
+
readonly fillHeight = input(false);
|
|
73
|
+
/** Enables a collapsible panel for projected [goodCalendarSidebar] tools. */
|
|
74
|
+
readonly sidebarEnabled = input(false);
|
|
75
|
+
readonly sidebarOpen = model(false);
|
|
76
|
+
readonly sidebarLabel = input('Calendar tools');
|
|
77
|
+
readonly sidebarId = `good-calendar-sidebar-${++nextCalendarSidebarId}`;
|
|
78
|
+
|
|
79
|
+
readonly eventClicked = output<GoodCalendarEvent>();
|
|
80
|
+
readonly eventSelected = output<GoodCalendarEvent>();
|
|
81
|
+
readonly eventDoubleClicked = output<GoodCalendarEvent>();
|
|
82
|
+
readonly emptyDoubleClicked = output<GoodCalendarEmptyAction>();
|
|
83
|
+
readonly eventMoved = output<GoodCalendarMove>();
|
|
84
|
+
readonly eventResized = output<GoodCalendarResize>();
|
|
85
|
+
readonly rangeChanged = output<GoodCalendarRange>();
|
|
86
|
+
|
|
87
|
+
readonly chevronLeft = LucideChevronLeft;
|
|
88
|
+
readonly chevronRight = LucideChevronRight;
|
|
89
|
+
readonly views: readonly { value: GoodCalendarView; label: string }[] = [
|
|
90
|
+
{ value: 'month', label: 'Month' }, { value: 'week', label: 'Week' },
|
|
91
|
+
{ value: 'day', label: 'Day' }, { value: 'list', label: 'List' },
|
|
92
|
+
];
|
|
93
|
+
readonly dragPreview = signal<{ title: string; x: number; y: number; marker?: GoodCalendarEvent['marker'] } | null>(null);
|
|
94
|
+
readonly dragTarget = signal<CalendarTarget | null>(null);
|
|
95
|
+
readonly resizePreview = signal<{ id: string; end: Date } | null>(null);
|
|
96
|
+
readonly now = signal(new Date());
|
|
97
|
+
readonly nowDayKey = computed(() => goodCalendarDayKey(this.now()));
|
|
98
|
+
readonly todayDay = computed(() => goodCalendarStartOfDay(this.now()).getTime());
|
|
99
|
+
private readonly angularLocale = inject(LOCALE_ID);
|
|
100
|
+
readonly effectiveLocale = computed(() => this.locale() || (this.angularLocale !== 'en-US' ? this.angularLocale : undefined)
|
|
101
|
+
|| (typeof navigator !== 'undefined' ? navigator.language : 'en-US'));
|
|
102
|
+
readonly holidayNames = computed(() => {
|
|
103
|
+
const result = new Map<string, string[]>();
|
|
104
|
+
for (const holiday of this.holidays()) {
|
|
105
|
+
if (typeof holiday.date === 'string' && !/^\d{4}-\d{2}-\d{2}$/.test(holiday.date)) continue;
|
|
106
|
+
const year = typeof holiday.date === 'string' ? Number(holiday.date.slice(0, 4)) : holiday.date.getFullYear();
|
|
107
|
+
const month = typeof holiday.date === 'string' ? Number(holiday.date.slice(5, 7)) - 1 : holiday.date.getMonth();
|
|
108
|
+
const day = typeof holiday.date === 'string' ? Number(holiday.date.slice(8, 10)) : holiday.date.getDate();
|
|
109
|
+
const date = holiday.date instanceof Date ? holiday.date : new Date(year, month, day);
|
|
110
|
+
if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) continue;
|
|
111
|
+
if (Number.isNaN(date.getTime()) || !holiday.name.trim()) continue;
|
|
112
|
+
const key = goodCalendarDayKey(date);
|
|
113
|
+
result.set(key, [...(result.get(key) ?? []), holiday.name.trim()]);
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
});
|
|
117
|
+
readonly nowPosition = computed(() => {
|
|
118
|
+
const now = this.now();
|
|
119
|
+
return (now.getHours() + now.getMinutes() / 60 + now.getSeconds() / 3600) * this.effectiveHourHeight();
|
|
120
|
+
});
|
|
121
|
+
readonly timeScroll = viewChild<ElementRef<HTMLElement>>('timeScroll');
|
|
122
|
+
private readonly destroyRef = inject(DestroyRef);
|
|
123
|
+
private clockTimer: ReturnType<typeof setTimeout> | null = null;
|
|
124
|
+
private activeDrag: CalendarDrag | null = null;
|
|
125
|
+
private activeResize: CalendarResizeDrag | null = null;
|
|
126
|
+
private suppressClick = false;
|
|
127
|
+
|
|
128
|
+
readonly sourceEvents = computed(() => (this.events() ?? this.calendar.events()).map(goodCalendarNormalizeEvent));
|
|
129
|
+
readonly currentDay = computed(() => goodCalendarStartOfDay(this.date()));
|
|
130
|
+
readonly monthLabel = computed(() => new Intl.DateTimeFormat(this.effectiveLocale(), { month: 'long', year: 'numeric' }).format(this.date()));
|
|
131
|
+
readonly periodLabel = computed(() => {
|
|
132
|
+
const date = this.date();
|
|
133
|
+
if (this.view() === 'month') return this.monthLabel();
|
|
134
|
+
if (this.view() === 'day') return new Intl.DateTimeFormat(this.effectiveLocale(), { weekday: 'long', month: 'long', day: 'numeric' }).format(date);
|
|
135
|
+
const start = this.view() === 'week' ? goodCalendarStartOfWeek(date, this.weekStartsOn()) : goodCalendarStartOfDay(date);
|
|
136
|
+
const end = goodCalendarAddDays(start, this.view() === 'week' ? 6 : this.agendaLength() - 1);
|
|
137
|
+
const short = new Intl.DateTimeFormat(this.effectiveLocale(), { month: 'short', day: 'numeric' });
|
|
138
|
+
return `${short.format(start)} – ${short.format(end)}`;
|
|
139
|
+
});
|
|
140
|
+
readonly effectiveHourHeight = computed(() => Math.max(32, this.hourHeight()));
|
|
141
|
+
readonly monthLimit = computed(() => Math.max(0, Math.floor(this.maxMonthEvents())));
|
|
142
|
+
readonly agendaLength = computed(() => Math.max(1, Math.min(366, Math.floor(this.listDays()))));
|
|
143
|
+
readonly weekdayLabels = computed(() => {
|
|
144
|
+
const start = goodCalendarStartOfWeek(new Date(2024, 0, 1), this.weekStartsOn());
|
|
145
|
+
return Array.from({ length: 7 }, (_, index) => new Intl.DateTimeFormat(this.effectiveLocale(), { weekday: 'short' }).format(goodCalendarAddDays(start, index)));
|
|
146
|
+
});
|
|
147
|
+
readonly monthDays = computed(() => goodCalendarMonthDays(this.date(), this.weekStartsOn()).map(date => this.makeDay(date)));
|
|
148
|
+
readonly timeDays = computed(() => {
|
|
149
|
+
const start = this.view() === 'week' ? goodCalendarStartOfWeek(this.date(), this.weekStartsOn()) : this.currentDay();
|
|
150
|
+
return Array.from({ length: this.view() === 'week' ? 7 : 1 }, (_, index) => this.makeDay(goodCalendarAddDays(start, index)));
|
|
151
|
+
});
|
|
152
|
+
readonly dayStripDays = computed(() => {
|
|
153
|
+
const start = goodCalendarStartOfWeek(this.date(), this.weekStartsOn());
|
|
154
|
+
return Array.from({ length: 7 }, (_, index) => goodCalendarAddDays(start, index));
|
|
155
|
+
});
|
|
156
|
+
readonly agendaDays = computed(() => Array.from({ length: this.agendaLength() }, (_, index) => this.makeDay(goodCalendarAddDays(this.currentDay(), index))));
|
|
157
|
+
readonly visibleRange = computed<GoodCalendarRange>(() => {
|
|
158
|
+
const view = this.view();
|
|
159
|
+
const start = view === 'month' ? goodCalendarMonthDays(this.date(), this.weekStartsOn())[0]
|
|
160
|
+
: view === 'week' ? goodCalendarStartOfWeek(this.date(), this.weekStartsOn()) : this.currentDay();
|
|
161
|
+
const count = view === 'month' ? goodCalendarMonthDays(this.date(), this.weekStartsOn()).length
|
|
162
|
+
: view === 'week' ? 7 : view === 'list' ? this.agendaLength() : 1;
|
|
163
|
+
return { start, end: goodCalendarAddDays(start, count), view };
|
|
164
|
+
});
|
|
165
|
+
readonly hours = Array.from({ length: 24 }, (_, index) => index);
|
|
166
|
+
readonly gridMinWidth = computed(() => this.view() === 'week' ? 64 + 7 * 126 : 300);
|
|
167
|
+
readonly gridHeight = computed(() => 24 * this.effectiveHourHeight());
|
|
168
|
+
|
|
169
|
+
constructor() {
|
|
170
|
+
afterNextRender(() => { this.scrollToWorkingHours(); this.tickClock(); });
|
|
171
|
+
this.destroyRef.onDestroy(() => { if (this.clockTimer !== null) clearTimeout(this.clockTimer); });
|
|
172
|
+
effect(() => this.rangeChanged.emit(this.visibleRange()));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private tickClock(): void {
|
|
176
|
+
this.now.set(new Date());
|
|
177
|
+
this.clockTimer = setTimeout(() => this.tickClock(), 60_000 - Date.now() % 60_000 + 20);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private makeDay(date: Date): CalendarDay {
|
|
181
|
+
const events = goodCalendarEventsOnDay(this.sourceEvents(), date);
|
|
182
|
+
const nonWorking = goodCalendarNonWorkingPeriods(date, this.workingHours(), this.nonWorkingLabels());
|
|
183
|
+
return {
|
|
184
|
+
date, key: goodCalendarDayKey(date),
|
|
185
|
+
inMonth: date.getMonth() === this.date().getMonth(),
|
|
186
|
+
today: goodCalendarDayKey(date) === this.nowDayKey(),
|
|
187
|
+
holidays: this.holidayNames().get(goodCalendarDayKey(date)) ?? [],
|
|
188
|
+
events, allDay: events.filter(event => event.allDay),
|
|
189
|
+
timed: goodCalendarTimedPlacements(events, date),
|
|
190
|
+
nonWorking,
|
|
191
|
+
fullyNonWorking: nonWorking.length === 1 && nonWorking[0].startMinute === 0 && nonWorking[0].endMinute === 1440,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
navigate(direction: -1 | 1): void {
|
|
196
|
+
const date = this.date();
|
|
197
|
+
if (this.view() === 'month') {
|
|
198
|
+
const target = new Date(date.getFullYear(), date.getMonth() + direction, 1);
|
|
199
|
+
target.setDate(Math.min(date.getDate(), new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate()));
|
|
200
|
+
this.date.set(target);
|
|
201
|
+
} else this.date.set(goodCalendarAddDays(date, direction * (this.view() === 'week' ? 7 : this.view() === 'list' ? this.agendaLength() : 1)));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
goToday(): void { this.date.set(new Date()); }
|
|
205
|
+
setView(view: GoodCalendarView): void {
|
|
206
|
+
this.view.set(view);
|
|
207
|
+
if (view === 'week' || view === 'day') setTimeout(() => this.scrollToWorkingHours(), 0);
|
|
208
|
+
}
|
|
209
|
+
showDay(date: Date): void { this.date.set(new Date(date)); this.setView('day'); }
|
|
210
|
+
scrollToWorkingHours(): void {
|
|
211
|
+
const viewport = this.timeScroll()?.nativeElement;
|
|
212
|
+
if (viewport) {
|
|
213
|
+
const stickyHeight = (viewport.querySelector('.good-calendar-time-heading')?.clientHeight ?? 0)
|
|
214
|
+
+ (viewport.querySelector('.good-calendar-all-day-label')?.clientHeight ?? 0);
|
|
215
|
+
const visibleMinutes = Math.max(60, (viewport.clientHeight - stickyHeight) / this.effectiveHourHeight() * 60);
|
|
216
|
+
const currentMinute = this.now().getHours() * 60 + this.now().getMinutes();
|
|
217
|
+
const workingStart = this.firstWorkingMinute();
|
|
218
|
+
const startMinute = this.showCurrentTime() && (currentMinute < workingStart || currentMinute > workingStart + visibleMinutes - 60)
|
|
219
|
+
? Math.max(0, Math.min(1440 - visibleMinutes, currentMinute - visibleMinutes / 2)) : workingStart;
|
|
220
|
+
viewport.scrollTop = Math.max(0, startMinute / 60 * this.effectiveHourHeight() - stickyHeight);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private firstWorkingMinute(): number {
|
|
225
|
+
const starts = this.timeDays().filter(day => !day.fullyNonWorking).map(day => {
|
|
226
|
+
const first = day.nonWorking[0];
|
|
227
|
+
return first?.startMinute === 0 ? first.endMinute : 0;
|
|
228
|
+
});
|
|
229
|
+
return starts.length ? Math.min(...starts) : 480;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
dateLabel(date: Date): string { return new Intl.DateTimeFormat(this.effectiveLocale(), { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' }).format(date); }
|
|
233
|
+
dayNumber(date: Date): string { return new Intl.DateTimeFormat(this.effectiveLocale(), { day: 'numeric' }).format(date); }
|
|
234
|
+
dayHeader(date: Date): string { return new Intl.DateTimeFormat(this.effectiveLocale(), { weekday: 'short', day: 'numeric' }).format(date); }
|
|
235
|
+
hourLabel(hour: number): string { return new Intl.DateTimeFormat(this.effectiveLocale(), { hour: 'numeric', minute: '2-digit' }).format(new Date(2024, 0, 1, hour)); }
|
|
236
|
+
timeLabel(date: Date): string { return new Intl.DateTimeFormat(this.effectiveLocale(), { hour: 'numeric', minute: '2-digit' }).format(date); }
|
|
237
|
+
eventTimeOnDay(event: GoodCalendarEvent, day: Date): string {
|
|
238
|
+
return event.allDay ? 'All day' : this.timeLabel(event.start < goodCalendarStartOfDay(day) ? goodCalendarStartOfDay(day) : event.start);
|
|
239
|
+
}
|
|
240
|
+
minuteLabel(minute: number): string { return this.timeLabel(new Date(2024, 0, 1, Math.floor(minute / 60), minute % 60)); }
|
|
241
|
+
eventLabel(event: GoodCalendarEvent): string {
|
|
242
|
+
const format = new Intl.DateTimeFormat(this.effectiveLocale(), { dateStyle: 'medium', timeStyle: event.allDay ? undefined : 'short' });
|
|
243
|
+
if (event.allDay) {
|
|
244
|
+
const lastDay = goodCalendarAddDays(goodCalendarStartOfDay(event.end), -1);
|
|
245
|
+
const start = format.format(event.start);
|
|
246
|
+
const end = format.format(lastDay);
|
|
247
|
+
return `${event.title}, all day, ${start}${start === end ? '' : ` through ${end}`}`;
|
|
248
|
+
}
|
|
249
|
+
return `${event.title}, ${format.format(event.start)} to ${format.format(event.end)}`;
|
|
250
|
+
}
|
|
251
|
+
eventTone(event: GoodCalendarEvent): string { return event.tone ?? 'brand'; }
|
|
252
|
+
top(placement: GoodCalendarTimedPlacement): number { return placement.startMinute / 60 * this.effectiveHourHeight(); }
|
|
253
|
+
height(placement: GoodCalendarTimedPlacement): number { return Math.max(22, (placement.endMinute - placement.startMinute) / 60 * this.effectiveHourHeight() - 2); }
|
|
254
|
+
previewHeight(placement: GoodCalendarTimedPlacement, day: Date): number {
|
|
255
|
+
const preview = this.resizePreview();
|
|
256
|
+
if (!preview || preview.id !== placement.event.id || placement.continuesAfter) return this.height(placement);
|
|
257
|
+
const start = goodCalendarStartOfDay(day);
|
|
258
|
+
const end = goodCalendarAddDays(start, 1);
|
|
259
|
+
if (preview.end <= start || preview.end > end) return this.height(placement);
|
|
260
|
+
const minute = preview.end.getTime() === end.getTime() ? 1440 : preview.end.getHours() * 60 + preview.end.getMinutes();
|
|
261
|
+
return Math.max(22, (minute - placement.startMinute) / 60 * this.effectiveHourHeight() - 2);
|
|
262
|
+
}
|
|
263
|
+
left(placement: GoodCalendarTimedPlacement): number { return placement.column / placement.columns * 100; }
|
|
264
|
+
width(placement: GoodCalendarTimedPlacement): number { return 100 / placement.columns; }
|
|
265
|
+
canResize(event: GoodCalendarEvent): boolean { return this.editable() && !this.disabled() && event.resizable === true; }
|
|
266
|
+
canResizeAllDay(event: GoodCalendarEvent, day: Date): boolean {
|
|
267
|
+
return event.allDay === true && this.canResize(event)
|
|
268
|
+
&& goodCalendarDayKey(goodCalendarAddDays(event.end, -1)) === goodCalendarDayKey(day);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
onEventClick(event: MouseEvent, item: GoodCalendarEvent): void {
|
|
272
|
+
event.stopPropagation();
|
|
273
|
+
if (this.suppressClick || this.disabled()) { event.preventDefault(); return; }
|
|
274
|
+
this.selectedEventId.set(item.id);
|
|
275
|
+
this.eventSelected.emit(item);
|
|
276
|
+
this.eventClicked.emit(item);
|
|
277
|
+
}
|
|
278
|
+
onEventDoubleClick(event: MouseEvent, item: GoodCalendarEvent): void {
|
|
279
|
+
event.stopPropagation();
|
|
280
|
+
if (!this.suppressClick && !this.disabled()) this.eventDoubleClicked.emit(item);
|
|
281
|
+
}
|
|
282
|
+
onEmptyDoubleClick(event: MouseEvent, day: Date, timed = false): void {
|
|
283
|
+
if (this.disabled() || !this.editable() || (event.target as Element).closest('button')) return;
|
|
284
|
+
const start = goodCalendarStartOfDay(day);
|
|
285
|
+
if (timed) {
|
|
286
|
+
const column = event.currentTarget as HTMLElement;
|
|
287
|
+
const ratio = (event.clientY - column.getBoundingClientRect().top) / this.effectiveHourHeight();
|
|
288
|
+
const snap = Math.max(1, this.snapMinutes());
|
|
289
|
+
const minute = Math.max(0, Math.min(1439, Math.floor(ratio * 60 / snap) * snap));
|
|
290
|
+
start.setMinutes(minute);
|
|
291
|
+
}
|
|
292
|
+
const end = timed ? new Date(start.getTime() + 30 * 60_000) : goodCalendarAddDays(start, 1);
|
|
293
|
+
this.emptyDoubleClicked.emit({ date: goodCalendarStartOfDay(day), start, end });
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
onEventPointerDown(event: PointerEvent, item: GoodCalendarEvent): void {
|
|
297
|
+
if (!this.editable() || this.disabled() || this.view() === 'list' || item.draggable === false || (event.pointerType === 'mouse' && event.button !== 0)) return;
|
|
298
|
+
this.activeDrag = { event: item, x: event.clientX, y: event.clientY, moved: false };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
onResizePointerDown(event: PointerEvent, item: GoodCalendarEvent): void {
|
|
302
|
+
event.stopPropagation();
|
|
303
|
+
if (!this.canResize(item) || (event.pointerType === 'mouse' && event.button !== 0)) return;
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
const target = item.allDay ? null : this.calendarTarget(event.clientX, event.clientY, true);
|
|
306
|
+
const targetDay = target ? this.dayFromKey(target.key) : null;
|
|
307
|
+
const endMinute = targetDay && item.end.getTime() === goodCalendarAddDays(targetDay, 1).getTime()
|
|
308
|
+
? 1440 : item.end.getHours() * 60 + item.end.getMinutes();
|
|
309
|
+
const offsetMinutes = targetDay && target && target.minute !== null
|
|
310
|
+
? endMinute - target.minute
|
|
311
|
+
: 0;
|
|
312
|
+
this.activeResize = { event: item, x: event.clientX, y: event.clientY, moved: false, allDay: item.allDay === true, offsetMinutes };
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
@HostListener('document:pointermove', ['$event']) onPointerMove(event: PointerEvent): void {
|
|
316
|
+
const resize = this.activeResize;
|
|
317
|
+
if (resize) {
|
|
318
|
+
if (!resize.moved && Math.hypot(event.clientX - resize.x, event.clientY - resize.y) < 5) return;
|
|
319
|
+
resize.moved = true;
|
|
320
|
+
event.preventDefault();
|
|
321
|
+
const candidate = this.resizeTarget(event.clientX, event.clientY, resize);
|
|
322
|
+
this.resizePreview.set(candidate ? { id: resize.event.id, end: candidate.end } : null);
|
|
323
|
+
this.dragTarget.set(candidate?.target ?? null);
|
|
324
|
+
this.dragPreview.set(candidate ? { title: `Ends ${this.resizeEndLabel(candidate.end, resize.allDay)}`, x: event.clientX + 12, y: event.clientY + 12, marker: resize.event.marker } : null);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const drag = this.activeDrag;
|
|
328
|
+
if (!drag) return;
|
|
329
|
+
if (!drag.moved && Math.hypot(event.clientX - drag.x, event.clientY - drag.y) < 5) return;
|
|
330
|
+
drag.moved = true;
|
|
331
|
+
event.preventDefault();
|
|
332
|
+
this.dragPreview.set({ title: drag.event.title, x: event.clientX + 12, y: event.clientY + 12, marker: drag.event.marker });
|
|
333
|
+
const target = this.calendarTarget(event.clientX, event.clientY);
|
|
334
|
+
this.dragTarget.set(target);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
@HostListener('document:pointerup', ['$event']) onPointerUp(event: PointerEvent): void {
|
|
338
|
+
const resize = this.activeResize;
|
|
339
|
+
if (resize) {
|
|
340
|
+
this.activeResize = null;
|
|
341
|
+
const candidate = resize.moved ? this.resizeTarget(event.clientX, event.clientY, resize) : null;
|
|
342
|
+
this.resizePreview.set(null);
|
|
343
|
+
this.dragPreview.set(null);
|
|
344
|
+
this.dragTarget.set(null);
|
|
345
|
+
if (resize.moved) {
|
|
346
|
+
this.suppressClick = true;
|
|
347
|
+
setTimeout(() => this.suppressClick = false, 0);
|
|
348
|
+
}
|
|
349
|
+
if (candidate && this.canResize(resize.event)) this.commitResize(resize.event, candidate.end);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const drag = this.activeDrag;
|
|
353
|
+
this.activeDrag = null;
|
|
354
|
+
if (!drag) return;
|
|
355
|
+
const target = this.calendarTarget(event.clientX, event.clientY);
|
|
356
|
+
this.dragPreview.set(null);
|
|
357
|
+
this.dragTarget.set(null);
|
|
358
|
+
if (!drag.moved) return;
|
|
359
|
+
this.suppressClick = true;
|
|
360
|
+
setTimeout(() => this.suppressClick = false, 0);
|
|
361
|
+
if (!target) return;
|
|
362
|
+
const [year, month, day] = target.key.split('-').map(Number);
|
|
363
|
+
const start = new Date(year, month - 1, day);
|
|
364
|
+
if (!drag.event.allDay) {
|
|
365
|
+
start.setHours(drag.event.start.getHours(), drag.event.start.getMinutes(), drag.event.start.getSeconds(), drag.event.start.getMilliseconds());
|
|
366
|
+
if (target.minute !== null) start.setHours(0, target.minute, 0, 0);
|
|
367
|
+
}
|
|
368
|
+
this.commitMove(drag.event, start);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@HostListener('document:pointercancel') onPointerCancel(): void {
|
|
372
|
+
this.activeDrag = null;
|
|
373
|
+
this.activeResize = null;
|
|
374
|
+
this.dragPreview.set(null);
|
|
375
|
+
this.dragTarget.set(null);
|
|
376
|
+
this.resizePreview.set(null);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
onEventKeydown(event: KeyboardEvent, item: GoodCalendarEvent): void {
|
|
380
|
+
if (this.disabled()) return;
|
|
381
|
+
if (event.shiftKey && event.key === 'Enter') {
|
|
382
|
+
event.preventDefault();
|
|
383
|
+
this.eventDoubleClicked.emit(item);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (!event.altKey || !this.editable() || this.disabled() || this.view() === 'list' || item.draggable === false) return;
|
|
387
|
+
const horizontal = event.key === 'ArrowLeft' ? -1 : event.key === 'ArrowRight' ? 1 : 0;
|
|
388
|
+
const vertical = event.key === 'ArrowUp' ? -1 : event.key === 'ArrowDown' ? 1 : 0;
|
|
389
|
+
if (!horizontal && !vertical || (item.allDay && vertical)) return;
|
|
390
|
+
event.preventDefault();
|
|
391
|
+
const start = horizontal ? goodCalendarAddDays(item.start, horizontal) : new Date(item.start.getTime() + vertical * Math.max(1, this.snapMinutes()) * 60_000);
|
|
392
|
+
this.commitMove(item, start);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
onResizeHandleKeydown(event: KeyboardEvent, item: GoodCalendarEvent): void {
|
|
396
|
+
if (!this.canResize(item)) return;
|
|
397
|
+
const step = item.allDay
|
|
398
|
+
? event.key === 'ArrowLeft' ? -1 : event.key === 'ArrowRight' ? 1 : 0
|
|
399
|
+
: event.key === 'ArrowUp' ? -1 : event.key === 'ArrowDown' ? 1 : 0;
|
|
400
|
+
if (!step) return;
|
|
401
|
+
event.preventDefault();
|
|
402
|
+
event.stopPropagation();
|
|
403
|
+
const end = item.allDay
|
|
404
|
+
? goodCalendarAddDays(item.end, step)
|
|
405
|
+
: new Date(item.end.getTime() + step * Math.max(1, this.snapMinutes()) * 60_000);
|
|
406
|
+
if (end > item.start) this.commitResize(item, end);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
private resizeEndLabel(end: Date, allDay: boolean): string {
|
|
410
|
+
return new Intl.DateTimeFormat(this.effectiveLocale(), allDay
|
|
411
|
+
? { month: 'short', day: 'numeric' }
|
|
412
|
+
: { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' })
|
|
413
|
+
.format(allDay ? goodCalendarAddDays(end, -1) : end);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
private resizeTarget(x: number, y: number, resize: CalendarResizeDrag): { target: CalendarTarget; end: Date } | null {
|
|
417
|
+
const target = this.calendarTarget(x, y, true);
|
|
418
|
+
if (!target || resize.allDay !== (target.minute === null)) return null;
|
|
419
|
+
const targetDay = this.dayFromKey(target.key);
|
|
420
|
+
let end = resize.allDay
|
|
421
|
+
? goodCalendarAddDays(targetDay, 1)
|
|
422
|
+
: new Date(targetDay.getFullYear(), targetDay.getMonth(), targetDay.getDate(), 0, target.minute! + resize.offsetMinutes);
|
|
423
|
+
if (end <= resize.event.start) {
|
|
424
|
+
end = resize.allDay
|
|
425
|
+
? goodCalendarAddDays(goodCalendarStartOfDay(resize.event.start), 1)
|
|
426
|
+
: new Date(resize.event.start.getTime() + Math.max(1, this.snapMinutes()) * 60_000);
|
|
427
|
+
}
|
|
428
|
+
if (!resize.allDay) {
|
|
429
|
+
const nextDay = goodCalendarAddDays(targetDay, 1);
|
|
430
|
+
if (end >= targetDay && end <= nextDay) {
|
|
431
|
+
target.minute = end.getTime() === nextDay.getTime() ? 1440 : end.getHours() * 60 + end.getMinutes();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return { target, end };
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
private dayFromKey(key: string): Date {
|
|
438
|
+
const [year, month, day] = key.split('-').map(Number);
|
|
439
|
+
return new Date(year, month - 1, day);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
private calendarTarget(x: number, y: number, forEnd = false): CalendarTarget | null {
|
|
443
|
+
const element = document.elementFromPoint(x, y);
|
|
444
|
+
if (!element) return null;
|
|
445
|
+
const day = element.closest<HTMLElement>('[data-calendar-day]');
|
|
446
|
+
if (!day || !this.host.nativeElement.contains(day)) return null;
|
|
447
|
+
const key = day.dataset['calendarDay'];
|
|
448
|
+
if (!key) return null;
|
|
449
|
+
const timed = day.classList.contains('good-calendar-time-day');
|
|
450
|
+
if (!timed) return { key, minute: null };
|
|
451
|
+
const ratio = (y - day.getBoundingClientRect().top) / this.effectiveHourHeight();
|
|
452
|
+
const snap = Math.max(1, this.snapMinutes());
|
|
453
|
+
return { key, minute: Math.max(0, Math.min(forEnd ? 1440 : 1439, Math.round(ratio * 60 / snap) * snap)) };
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);
|
|
457
|
+
|
|
458
|
+
private commitMove(event: GoodCalendarEvent, start: Date): void {
|
|
459
|
+
const moved = goodCalendarMoveEvent(event, start);
|
|
460
|
+
if (moved.start.getTime() === event.start.getTime()) return;
|
|
461
|
+
if (this.events() === null) this.calendar.moveEvent(event.id, start);
|
|
462
|
+
this.eventMoved.emit({ event, previousStart: new Date(event.start), previousEnd: new Date(event.end), start: moved.start, end: moved.end });
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
private commitResize(event: GoodCalendarEvent, end: Date): void {
|
|
466
|
+
if (end.getTime() === event.end.getTime()) return;
|
|
467
|
+
const resized = goodCalendarResizeEvent(event, end);
|
|
468
|
+
if (this.events() === null) this.calendar.resizeEvent(event.id, end);
|
|
469
|
+
this.eventResized.emit({ event, previousStart: new Date(event.start), previousEnd: new Date(event.end), start: resized.start, end: resized.end });
|
|
470
|
+
}
|
|
471
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Directive, input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'good-card',
|
|
5
|
+
standalone: true,
|
|
6
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
7
|
+
host: { class: 'good-card', '[attr.data-mobile-bleed]': 'mobileBleed()' },
|
|
8
|
+
template: `
|
|
9
|
+
<ng-content select="good-card-header" />
|
|
10
|
+
<div class="good-card-body"><ng-content /></div>
|
|
11
|
+
<ng-content select="good-card-footer" />
|
|
12
|
+
`,
|
|
13
|
+
})
|
|
14
|
+
export class GoodCardComponent {
|
|
15
|
+
readonly mobileBleed = input(false);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Directive({
|
|
19
|
+
selector: '[goodCardActions]',
|
|
20
|
+
standalone: true,
|
|
21
|
+
host: { class: 'good-card-actions' },
|
|
22
|
+
})
|
|
23
|
+
export class GoodCardActionsDirective {}
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'good-card-header',
|
|
27
|
+
standalone: true,
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
host: { class: 'good-card-header' },
|
|
30
|
+
template: `
|
|
31
|
+
<header class="good-card-header-content" [attr.data-tone]="backgroundImage() ? 'image' : tone()">
|
|
32
|
+
@if (backgroundImage()) {
|
|
33
|
+
<img class="good-card-header-image" [src]="backgroundImage()" alt="" />
|
|
34
|
+
<span class="good-card-header-scrim" aria-hidden="true"></span>
|
|
35
|
+
}
|
|
36
|
+
<div class="good-card-header-copy">
|
|
37
|
+
@switch (headingLevel()) {
|
|
38
|
+
@case (3) { <h3 class="good-card-title">{{ title() }}</h3> }
|
|
39
|
+
@case (4) { <h4 class="good-card-title">{{ title() }}</h4> }
|
|
40
|
+
@default { <h2 class="good-card-title">{{ title() }}</h2> }
|
|
41
|
+
}
|
|
42
|
+
<ng-content select="[goodCardSubtitle]" />
|
|
43
|
+
</div>
|
|
44
|
+
<ng-content select="[goodCardActions]" />
|
|
45
|
+
</header>
|
|
46
|
+
`,
|
|
47
|
+
})
|
|
48
|
+
export class GoodCardHeaderComponent {
|
|
49
|
+
readonly title = input.required<string>();
|
|
50
|
+
readonly headingLevel = input<2 | 3 | 4>(2);
|
|
51
|
+
readonly tone = input<'default' | 'secondary'>('default');
|
|
52
|
+
readonly backgroundImage = input('');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Component({
|
|
56
|
+
selector: 'good-card-footer',
|
|
57
|
+
standalone: true,
|
|
58
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
59
|
+
host: { class: 'good-card-footer' },
|
|
60
|
+
template: `<footer class="good-card-footer-content" [attr.data-align]="align()"><ng-content /></footer>`,
|
|
61
|
+
})
|
|
62
|
+
export class GoodCardFooterComponent {
|
|
63
|
+
readonly align = input<'start' | 'end' | 'between'>('between');
|
|
64
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GoodMarkerColor } from './marker-colors';
|
|
2
|
+
|
|
3
|
+
/** Theme-aware category and highlight colors, independent of brand and status. */
|
|
4
|
+
const defaultMarkerNames = ['blue', 'teal', 'violet', 'amber', 'rose', 'lime'] satisfies readonly GoodMarkerColor[];
|
|
5
|
+
export const GOOD_CHART_DEFAULT_COLORS: readonly string[] = [
|
|
6
|
+
...defaultMarkerNames.map(name => `var(--good-color-marker-${name})`),
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
const semanticColors = new Set(['accent', 'brand', 'success', 'warning', 'info', 'error', 'muted']);
|
|
10
|
+
const markerColors = new Set([
|
|
11
|
+
'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose', 'red',
|
|
12
|
+
'orange', 'amber', 'yellow', 'lime', 'green', 'teal', 'cyan',
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
/** Per-series color wins over the chart palette; CSS color values are accepted as supplied. */
|
|
16
|
+
export function resolveChartColor(override: string | undefined, colors: readonly string[], index: number): string {
|
|
17
|
+
const palette = colors.length ? colors : GOOD_CHART_DEFAULT_COLORS;
|
|
18
|
+
const value = override?.trim() || palette[index % palette.length]?.trim() || GOOD_CHART_DEFAULT_COLORS[index % GOOD_CHART_DEFAULT_COLORS.length];
|
|
19
|
+
if (semanticColors.has(value)) return `var(--good-color-${value})`;
|
|
20
|
+
if (markerColors.has(value)) return `var(--good-color-marker-${value})`;
|
|
21
|
+
return value;
|
|
22
|
+
}
|