@f-ewald/components 1.40.3 → 1.42.2
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 +14 -4
- package/custom-elements.json +2017 -131
- package/dist/app-shell.js +1 -1
- package/dist/app-shell.js.map +1 -1
- package/dist/blink-cursor.d.ts +27 -0
- package/dist/blink-cursor.d.ts.map +1 -0
- package/dist/blink-cursor.js +78 -0
- package/dist/blink-cursor.js.map +1 -0
- package/dist/code-diff.d.ts +41 -0
- package/dist/code-diff.d.ts.map +1 -0
- package/dist/code-diff.js +161 -0
- package/dist/code-diff.js.map +1 -0
- package/dist/comment-label.d.ts +26 -0
- package/dist/comment-label.d.ts.map +1 -0
- package/dist/comment-label.js +81 -0
- package/dist/comment-label.js.map +1 -0
- package/dist/confirm-dialog.d.ts +12 -6
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +50 -88
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/dag-graph.d.ts +161 -0
- package/dist/dag-graph.d.ts.map +1 -0
- package/dist/dag-graph.js +724 -0
- package/dist/dag-graph.js.map +1 -0
- package/dist/icons.d.ts +16 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +16 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/modal-dialog.d.ts +16 -13
- package/dist/modal-dialog.d.ts.map +1 -1
- package/dist/modal-dialog.js +69 -104
- package/dist/modal-dialog.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/price-history-chart.js +1 -1
- package/dist/price-history-chart.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +23 -17
- package/dist/progress-bar.js.map +1 -1
- package/dist/slide-panel.d.ts +3 -3
- package/dist/slide-panel.d.ts.map +1 -1
- package/dist/slide-panel.js +38 -22
- package/dist/slide-panel.js.map +1 -1
- package/dist/stat-strip.d.ts +30 -0
- package/dist/stat-strip.d.ts.map +1 -0
- package/dist/stat-strip.js +111 -0
- package/dist/stat-strip.js.map +1 -0
- package/dist/step-ladder.d.ts +46 -0
- package/dist/step-ladder.d.ts.map +1 -0
- package/dist/step-ladder.js +175 -0
- package/dist/step-ladder.js.map +1 -0
- package/dist/terminal-block.d.ts +45 -0
- package/dist/terminal-block.d.ts.map +1 -0
- package/dist/terminal-block.js +113 -0
- package/dist/terminal-block.js.map +1 -0
- package/dist/toast-notification.d.ts +7 -0
- package/dist/toast-notification.d.ts.map +1 -1
- package/dist/toast-notification.js +34 -0
- package/dist/toast-notification.js.map +1 -1
- package/dist/tokens.css +64 -1
- package/dist/tokens.d.ts +58 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +145 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.js +2 -2
- package/dist/ui-button.js.map +1 -1
- package/dist/utils/dag-layout.d.ts +60 -0
- package/dist/utils/dag-layout.d.ts.map +1 -0
- package/dist/utils/dag-layout.js +80 -0
- package/dist/utils/dag-layout.js.map +1 -0
- package/dist/window-chrome.d.ts +34 -0
- package/dist/window-chrome.d.ts.map +1 -0
- package/dist/window-chrome.js +141 -0
- package/dist/window-chrome.js.map +1 -0
- package/docs/app-shell.md +1 -1
- package/docs/blink-cursor.md +45 -0
- package/docs/code-diff.md +64 -0
- package/docs/comment-label.md +49 -0
- package/docs/confirm-dialog.md +4 -3
- package/docs/dag-graph.md +101 -0
- package/docs/design-language.md +43 -21
- package/docs/icons.md +8 -0
- package/docs/layouts/marketing-landing.md +102 -0
- package/docs/modal-dialog.md +9 -9
- package/docs/photo-gallery.md +1 -1
- package/docs/price-history-chart.md +1 -0
- package/docs/slide-panel.md +2 -2
- package/docs/stat-strip.md +57 -0
- package/docs/step-ladder.md +63 -0
- package/docs/terminal-block.md +69 -0
- package/docs/ui-button.md +2 -0
- package/docs/window-chrome.md +64 -0
- package/llms.txt +282 -18
- package/package.json +2 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,YAAY,GAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,GAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,UAAU,GAIX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAA+B,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD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AChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,eAAe,EACf,UAAU,EACV,YAAY,EACZ,SAAS,GAMV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,cAAc,YAAY,CAAC","sourcesContent":["export { AnimateConfetti } from \"./animate-confetti.js\";\nexport { GalleryItem } from \"./gallery-item.js\";\nexport { GalleryItemVariant } from \"./gallery-item-variant.js\";\nexport {\n PhotoGallery,\n type PhotoGalleryChangeReason,\n type PhotoGalleryObjectFit,\n type PhotoGallerySlideChangeDetail,\n} from \"./photo-gallery.js\";\nexport { RevealButton } from \"./reveal-button.js\";\nexport { RomanNumeral } from \"./roman-numeral.js\";\nexport { ConfirmDialog } from \"./confirm-dialog.js\";\nexport { ModalDialog, type ModalDialogSize } from \"./modal-dialog.js\";\nexport { ContentDivider } from \"./content-divider.js\";\nexport {\n ToastNotification,\n notifySuccess,\n notifyError,\n notifyInfo,\n notifyWarning,\n type ToastVariant,\n} from \"./toast-notification.js\";\nexport { ScrollToBottom } from \"./scroll-to-bottom.js\";\nexport {\n ScrollDots,\n type DotSelectDetail,\n type ScrollDotItem,\n type ScrollDotsItem,\n} from \"./scroll-dots.js\";\nexport { ScrollToTop } from \"./scroll-to-top.js\";\nexport { FullscreenButton, type FullscreenChangeDetail } from \"./fullscreen-button.js\";\nexport { SkipLink } from \"./skip-link.js\";\nexport { SlidePanel } from \"./slide-panel.js\";\nexport { CopyLinkButton } from \"./copy-link-button.js\";\nexport { RelativeTime } from \"./relative-time.js\";\nexport { DistanceValue } from \"./distance-value.js\";\nexport { PriceHistoryChart, type PricePoint } from \"./price-history-chart.js\";\nexport { DistributionChart, type DistributionValue } from \"./distribution-chart.js\";\nexport { PercentBarChart, type PercentBarGroup } from \"./percent-bar-chart.js\";\nexport { WeightBarChart, type WeightBarItem } from \"./weight-bar-chart.js\";\nexport {\n AddressAutocomplete,\n type AddressSuggestion,\n} from \"./address-autocomplete.js\";\nexport {\n AutocompleteInput,\n type AutocompleteOption,\n} from \"./autocomplete-input.js\";\nexport { UserAvatar } from \"./user-avatar.js\";\nexport { MapPin } from \"./map-pin.js\";\nexport { MapCircle } from \"./map-circle.js\";\nexport { MapboxMap } from \"./mapbox-map.js\";\nexport { RadioCards, type RadioCardOption } from \"./radio-cards.js\";\nexport { RadioPills, type RadioPillOption } from \"./radio-pills.js\";\nexport { RangeSlider } from \"./range-slider.js\";\nexport { BreadcrumbNav, type BreadcrumbItem, type BreadcrumbNavigateDetail } from \"./breadcrumb-nav.js\";\nexport { ButtonGroup, type ButtonGroupOption } from \"./button-group.js\";\nexport { UiButton, type ButtonVariant } from \"./ui-button.js\";\nexport { StatMeter } from \"./stat-meter.js\";\nexport { ProgressBar } from \"./progress-bar.js\";\nexport { StatusBanner, type StatusBannerVariant } from \"./status-banner.js\";\nexport { UiAdmonition, type AdmonitionVariant } from \"./ui-admonition.js\";\nexport { StatusPill, type StatusPillColor } from \"./status-pill.js\";\nexport { EditableText } from \"./editable-text.js\";\nexport { EmptyState } from \"./empty-state.js\";\nexport { LiveTimer } from \"./live-timer.js\";\nexport { CountdownTimer } from \"./countdown-timer.js\";\nexport { LoadMore } from \"./load-more.js\";\nexport { LoadingSpinner } from \"./loading-spinner.js\";\nexport { LoadingDots } from \"./loading-dots.js\";\nexport {\n ChatMessage,\n type ChatMessageRole,\n type ChatMessageVariant,\n} from \"./chat-message.js\";\nexport { ChevronPanel } from \"./chevron-panel.js\";\nexport { UiCheckbox } from \"./ui-checkbox.js\";\nexport { FormField } from \"./form-field.js\";\nexport { FormSelect, type SelectOption } from \"./form-select.js\";\nexport {\n MultiSelect,\n type MultiSelectOption,\n type MultiSelectVariant,\n} from \"./multi-select.js\";\nexport { DataTable, type DataTableColumn } from \"./data-table.js\";\nexport { TileGrid } from \"./tile-grid.js\";\nexport { TreeView, type TreeNode } from \"./tree-view.js\";\nexport { PopoverPanel } from \"./popover-panel.js\";\nexport {\n DropdownButton,\n type DropdownButtonVariant,\n type DropdownOption,\n} from \"./dropdown-button.js\";\nexport { IconButton } from \"./icon-button.js\";\nexport { KbdHint, type KbdPlatform } from \"./kbd-hint.js\";\nexport { FrameBox } from \"./frame-box.js\";\nexport { AppShell, type SidebarToggleDetail } from \"./app-shell.js\";\nexport { AppSidebar } from \"./app-sidebar.js\";\nexport { ActionBar } from \"./action-bar.js\";\nexport { PageHeader } from \"./page-header.js\";\nexport { PaginationNav, type PageChangeDetail } from \"./pagination-nav.js\";\nexport { FormActions } from \"./form-actions.js\";\nexport { TimelineContainer, type TimelineLayout } from \"./timeline-container.js\";\nexport { TimelineEntry } from \"./timeline-entry.js\";\nexport { CalendarDay } from \"./calendar-day.js\";\nexport { CalendarEntry } from \"./calendar-entry.js\";\nexport { CalendarMonth } from \"./calendar-month.js\";\nexport { CalendarWeek } from \"./calendar-week.js\";\nexport { CalendarYear } from \"./calendar-year.js\";\nexport {\n KanbanBoard,\n type KanbanCardData,\n type KanbanColumnData,\n type KanbanCardMoveDetail,\n type KanbanCardOpenDetail,\n} from \"./kanban-board.js\";\nexport { KanbanColumn } from \"./kanban-column.js\";\nexport { KanbanCard } from \"./kanban-card.js\";\nexport { TextArea } from \"./text-area.js\";\nexport { LinkCard, type LinkCardStatus } from \"./link-card.js\";\nexport { CardGrid } from \"./card-grid.js\";\nexport { MarkdownView } from \"./markdown-view.js\";\nexport { AutoScroll } from \"./auto-scroll.js\";\nexport { SpecList, type SpecListItem } from \"./spec-list.js\";\nexport { SplitHero } from \"./split-hero.js\";\nexport { TabBar, type TabChangeDetail } from \"./tab-bar.js\";\nexport { TabItem } from \"./tab-item.js\";\nexport { MarkdownEditor } from \"./markdown-editor.js\";\nexport {\n parseFrontMatter,\n formatFrontMatterValue,\n type FrontMatterResult,\n} from \"./utils/front-matter.js\";\nexport {\n formatDuration,\n formatClockDuration,\n type DurationFormat,\n} from \"./utils/duration.js\";\nexport { AudioPlayer } from \"./audio-player.js\";\nexport { VideoPlayer } from \"./video-player.js\";\nexport { VoteControl } from \"./vote-control.js\";\nexport { CommentComposer } from \"./comment-composer.js\";\nexport { CronSchedule } from \"./cron-schedule.js\";\nexport {\n CRON_ALIASES,\n CRON_FIELD_BOUNDS,\n CRON_FIELD_LABELS,\n CRON_FIELD_NAMES,\n MONTH_ABBREVIATIONS,\n MONTH_NAMES,\n WEEKDAY_ABBREVIATIONS,\n WEEKDAY_NAMES,\n describeCron,\n detectFrequency,\n expandField,\n fieldFromValues,\n formatCron,\n isEveryValue,\n parseCron,\n type CronExpression,\n type CronField,\n type CronFieldName,\n type CronFrequency,\n type CronTerm,\n} from \"./utils/cron.js\";\nexport {\n tokens,\n tokenValues,\n darkTokenValues,\n gradientTokenValues,\n metroTokenValues,\n blueprintTokenValues,\n} from \"./tokens.js\";\nexport * from \"./icons.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,YAAY,GAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY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L,MAAM,EACN,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAuB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACL,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAA4C,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { AnimateConfetti } from \"./animate-confetti.js\";\nexport { GalleryItem } from \"./gallery-item.js\";\nexport { GalleryItemVariant } from \"./gallery-item-variant.js\";\nexport {\n PhotoGallery,\n type PhotoGalleryChangeReason,\n type PhotoGalleryObjectFit,\n type PhotoGallerySlideChangeDetail,\n} from \"./photo-gallery.js\";\nexport { RevealButton } from \"./reveal-button.js\";\nexport { RomanNumeral } from \"./roman-numeral.js\";\nexport { ConfirmDialog } from \"./confirm-dialog.js\";\nexport { ModalDialog, type ModalDialogSize } from \"./modal-dialog.js\";\nexport { ContentDivider } from \"./content-divider.js\";\nexport {\n ToastNotification,\n notifySuccess,\n notifyError,\n notifyInfo,\n notifyWarning,\n type ToastVariant,\n} from \"./toast-notification.js\";\nexport { ScrollToBottom } from \"./scroll-to-bottom.js\";\nexport {\n ScrollDots,\n type DotSelectDetail,\n type ScrollDotItem,\n type ScrollDotsItem,\n} from \"./scroll-dots.js\";\nexport { ScrollToTop } from \"./scroll-to-top.js\";\nexport { FullscreenButton, type FullscreenChangeDetail } from \"./fullscreen-button.js\";\nexport { SkipLink } from \"./skip-link.js\";\nexport { SlidePanel } from \"./slide-panel.js\";\nexport { CopyLinkButton } from \"./copy-link-button.js\";\nexport { RelativeTime } from \"./relative-time.js\";\nexport { DistanceValue } from \"./distance-value.js\";\nexport { PriceHistoryChart, type PricePoint } from \"./price-history-chart.js\";\nexport { DistributionChart, type DistributionValue } from \"./distribution-chart.js\";\nexport { PercentBarChart, type PercentBarGroup } from \"./percent-bar-chart.js\";\nexport { WeightBarChart, type WeightBarItem } from \"./weight-bar-chart.js\";\nexport {\n DagGraph,\n type DagControl,\n type DagDirection,\n type DagDirectionChangeDetail,\n type DagEdge,\n type DagNode,\n type DagNodeKind,\n type DagNodeSelectDetail,\n} from \"./dag-graph.js\";\nexport {\n AddressAutocomplete,\n type AddressSuggestion,\n} from \"./address-autocomplete.js\";\nexport {\n AutocompleteInput,\n type AutocompleteOption,\n} from \"./autocomplete-input.js\";\nexport { UserAvatar } from \"./user-avatar.js\";\nexport { MapPin } from \"./map-pin.js\";\nexport { MapCircle } from \"./map-circle.js\";\nexport { MapboxMap } from \"./mapbox-map.js\";\nexport { RadioCards, type RadioCardOption } from \"./radio-cards.js\";\nexport { RadioPills, type RadioPillOption } from \"./radio-pills.js\";\nexport { RangeSlider } from \"./range-slider.js\";\nexport { BreadcrumbNav, type BreadcrumbItem, type BreadcrumbNavigateDetail } from \"./breadcrumb-nav.js\";\nexport { ButtonGroup, type ButtonGroupOption } from \"./button-group.js\";\nexport { UiButton, type ButtonVariant } from \"./ui-button.js\";\nexport { StatMeter } from \"./stat-meter.js\";\nexport { ProgressBar } from \"./progress-bar.js\";\nexport { StatusBanner, type StatusBannerVariant } from \"./status-banner.js\";\nexport { UiAdmonition, type AdmonitionVariant } from \"./ui-admonition.js\";\nexport { StatusPill, type StatusPillColor } from \"./status-pill.js\";\nexport { EditableText } from \"./editable-text.js\";\nexport { EmptyState } from \"./empty-state.js\";\nexport { LiveTimer } from \"./live-timer.js\";\nexport { CountdownTimer } from \"./countdown-timer.js\";\nexport { LoadMore } from \"./load-more.js\";\nexport { LoadingSpinner } from \"./loading-spinner.js\";\nexport { LoadingDots } from \"./loading-dots.js\";\nexport {\n ChatMessage,\n type ChatMessageRole,\n type ChatMessageVariant,\n} from \"./chat-message.js\";\nexport { ChevronPanel } from \"./chevron-panel.js\";\nexport { UiCheckbox } from \"./ui-checkbox.js\";\nexport { FormField } from \"./form-field.js\";\nexport { FormSelect, type SelectOption } from \"./form-select.js\";\nexport {\n MultiSelect,\n type MultiSelectOption,\n type MultiSelectVariant,\n} from \"./multi-select.js\";\nexport { DataTable, type DataTableColumn } from \"./data-table.js\";\nexport { TileGrid } from \"./tile-grid.js\";\nexport { TreeView, type TreeNode } from \"./tree-view.js\";\nexport { PopoverPanel } from \"./popover-panel.js\";\nexport {\n DropdownButton,\n type DropdownButtonVariant,\n type DropdownOption,\n} from \"./dropdown-button.js\";\nexport { IconButton } from \"./icon-button.js\";\nexport { KbdHint, type KbdPlatform } from \"./kbd-hint.js\";\nexport { FrameBox } from \"./frame-box.js\";\nexport { AppShell, type SidebarToggleDetail } from \"./app-shell.js\";\nexport { AppSidebar } from \"./app-sidebar.js\";\nexport { ActionBar } from \"./action-bar.js\";\nexport { PageHeader } from \"./page-header.js\";\nexport { PaginationNav, type PageChangeDetail } from \"./pagination-nav.js\";\nexport { FormActions } from \"./form-actions.js\";\nexport { TimelineContainer, type TimelineLayout } from \"./timeline-container.js\";\nexport { TimelineEntry } from \"./timeline-entry.js\";\nexport { CalendarDay } from \"./calendar-day.js\";\nexport { CalendarEntry } from \"./calendar-entry.js\";\nexport { CalendarMonth } from \"./calendar-month.js\";\nexport { CalendarWeek } from \"./calendar-week.js\";\nexport { CalendarYear } from \"./calendar-year.js\";\nexport {\n KanbanBoard,\n type KanbanCardData,\n type KanbanColumnData,\n type KanbanCardMoveDetail,\n type KanbanCardOpenDetail,\n} from \"./kanban-board.js\";\nexport { KanbanColumn } from \"./kanban-column.js\";\nexport { KanbanCard } from \"./kanban-card.js\";\nexport { TextArea } from \"./text-area.js\";\nexport { LinkCard, type LinkCardStatus } from \"./link-card.js\";\nexport { CardGrid } from \"./card-grid.js\";\nexport { MarkdownView } from \"./markdown-view.js\";\nexport { AutoScroll } from \"./auto-scroll.js\";\nexport { SpecList, type SpecListItem } from \"./spec-list.js\";\nexport { SplitHero } from \"./split-hero.js\";\nexport { TabBar, type TabChangeDetail } from \"./tab-bar.js\";\nexport { TabItem } from \"./tab-item.js\";\nexport { MarkdownEditor } from \"./markdown-editor.js\";\nexport {\n parseFrontMatter,\n formatFrontMatterValue,\n type FrontMatterResult,\n} from \"./utils/front-matter.js\";\nexport {\n formatDuration,\n formatClockDuration,\n type DurationFormat,\n} from \"./utils/duration.js\";\nexport { AudioPlayer } from \"./audio-player.js\";\nexport { VideoPlayer } from \"./video-player.js\";\nexport { VoteControl } from \"./vote-control.js\";\nexport { CommentComposer } from \"./comment-composer.js\";\nexport { CronSchedule } from \"./cron-schedule.js\";\nexport {\n CRON_ALIASES,\n CRON_FIELD_BOUNDS,\n CRON_FIELD_LABELS,\n CRON_FIELD_NAMES,\n MONTH_ABBREVIATIONS,\n MONTH_NAMES,\n WEEKDAY_ABBREVIATIONS,\n WEEKDAY_NAMES,\n describeCron,\n detectFrequency,\n expandField,\n fieldFromValues,\n formatCron,\n isEveryValue,\n parseCron,\n type CronExpression,\n type CronField,\n type CronFieldName,\n type CronFrequency,\n type CronTerm,\n} from \"./utils/cron.js\";\nexport {\n tokens,\n tokenValues,\n darkTokenValues,\n gradientTokenValues,\n metroTokenValues,\n blueprintTokenValues,\n developerDarkTokenValues,\n developerLightTokenValues,\n} from \"./tokens.js\";\nexport * from \"./icons.js\";\nexport { BlinkCursor } from \"./blink-cursor.js\";\nexport { CommentLabel } from \"./comment-label.js\";\nexport { StatStrip, type StatStripItem } from \"./stat-strip.js\";\nexport { StepLadder, type StepLadderItem } from \"./step-ladder.js\";\nexport {\n TerminalBlock,\n type TerminalLine,\n type TerminalLineType,\n} from \"./terminal-block.js\";\nexport { CodeDiff, type CodeDiffLine, type CodeDiffLineType } from \"./code-diff.js\";\nexport { WindowChrome } from \"./window-chrome.js\";\n"]}
|
package/dist/mcp-server.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* `docs/layouts/*.md` recipes:
|
|
9
9
|
* - `list_components`: every tag name + one-line description.
|
|
10
10
|
* - `get_component_docs`: the full generated Markdown doc for one tag.
|
|
11
|
-
* - `list_layouts`: every
|
|
11
|
+
* - `list_layouts`: every page template + one-line summary.
|
|
12
12
|
* - `get_layout`: the full recipe for one page template.
|
|
13
13
|
* - `list_icons`: every icon, its default size, and its intended use case.
|
|
14
14
|
*
|
package/dist/mcp-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,2EAA2E;AAC3E,sEAAsE;AACtE,kEAAkE;AAClE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAsBjD,gFAAgF;AAChF,KAAK,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CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,IAAI,qBAAqB,UAAU,EAAE,EAAE,CAAC;QAC5F,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;IACE,KAAK,EAAE,YAAY;IACnB,WAAW,EACT,qEAAqE;QACrE,mEAAmE;QACnE,kEAAkE;QAClE,4DAA4D;QAC5D,uEAAuE;QACvE,sDAAsD;CACzD,EACD,KAAK,IAAI,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;CAC9E,CAAC,CACH,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Stdio MCP server exposing the `@f-ewald/components` catalog to AI coding\n * assistants (Claude Code, etc.) working in a consuming project.\n *\n * Tools, backed by the same `custom-elements.json` and `docs/*.md` this\n * package already generates and ships via `npm run docs`, plus the authored\n * `docs/layouts/*.md` recipes:\n * - `list_components`: every tag name + one-line description.\n * - `get_component_docs`: the full generated Markdown doc for one tag.\n * - `list_layouts`: every dashboard page template + one-line summary.\n * - `get_layout`: the full recipe for one page template.\n * - `list_icons`: every icon, its default size, and its intended use case.\n *\n * No new data source — this is just a different transport over docs that\n * already exist. See `docs/mcp-evaluation.md` for the design rationale.\n */\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport path from \"node:path\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n// This file compiles to dist/mcp-server.js; custom-elements.json and docs/\n// ship alongside dist/ at the package root, whether run from the repo\n// checkout or from an installed node_modules/@f-ewald/components.\nconst packageRoot = path.join(__dirname, \"..\");\nconst docsDir = path.join(packageRoot, \"docs\");\nconst layoutsDir = path.join(docsDir, \"layouts\");\n\n/** One row of the `list_components` result. */\ninterface ComponentSummary {\n tag: string;\n summary: string;\n}\n\n/** One row of the `list_layouts` result. */\ninterface LayoutSummary {\n name: string;\n title: string;\n summary: string;\n}\n\n/** One row of the `list_icons` result. */\ninterface IconSummary {\n name: string;\n defaultSize: number;\n usage: string;\n}\n\n/** Reads the package's own version out of package.json, for server metadata. */\nasync function readPackageVersion(): Promise<string> {\n const text = await readFile(path.join(packageRoot, \"package.json\"), \"utf8\");\n return (JSON.parse(text) as { version: string }).version;\n}\n\n/** Extracts {tag, one-line summary} for every custom element, sorted by tag. */\nasync function listComponents(): Promise<ComponentSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: { declarations?: { customElement?: boolean; tagName: string; description?: string }[] }[];\n };\n const components: ComponentSummary[] = [];\n for (const mod of manifest.modules) {\n for (const decl of mod.declarations ?? []) {\n if (!decl.customElement || !decl.tagName) continue;\n const summary = (decl.description ?? \"\").split(\"\\n\\n\")[0]!.replace(/\\n/g, \" \").trim();\n components.push({ tag: decl.tagName, summary });\n }\n }\n components.sort((a, b) => a.tag.localeCompare(b.tag));\n return components;\n}\n\n/**\n * Extracts {name, defaultSize, usage} for every `icon*` export in\n * `src/icons.ts`, sorted by name. `usage` is the \"use for ...\" guideline\n * `scripts/generate-icons.mjs` writes as a JSDoc comment above each export,\n * which `npm run analyze` lifts into this same `custom-elements.json` — the\n * same source `listComponents` reads, just a different module/kind filter.\n */\nasync function listIcons(): Promise<IconSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: {\n path: string;\n declarations?: {\n kind?: string;\n name: string;\n description?: string;\n parameters?: { default?: string }[];\n }[];\n }[];\n };\n const icons: IconSummary[] = [];\n for (const mod of manifest.modules) {\n if (mod.path !== \"src/icons.ts\") continue;\n for (const decl of mod.declarations ?? []) {\n if (decl.kind !== \"function\" || !decl.name.startsWith(\"icon\")) continue;\n icons.push({\n name: decl.name,\n defaultSize: Number(decl.parameters?.[0]?.default ?? 18),\n usage: decl.description ?? \"\",\n });\n }\n }\n icons.sort((a, b) => a.name.localeCompare(b.name));\n return icons;\n}\n\n/**\n * Extracts {name, title, one-line summary} for every `docs/layouts/*.md`\n * recipe, sorted by name. `name` is the filename without `.md`; `summary` is\n * the recipe's first prose paragraph.\n */\nasync function listLayouts(): Promise<LayoutSummary[]> {\n let files: string[];\n try {\n files = await readdir(layoutsDir);\n } catch {\n return [];\n }\n const layouts: LayoutSummary[] = [];\n for (const file of files) {\n if (!file.endsWith(\".md\")) continue;\n const name = file.slice(0, -3);\n const lines = (await readFile(path.join(layoutsDir, file), \"utf8\")).split(\"\\n\");\n const title = lines.find((line) => line.startsWith(\"# \"))?.slice(2).trim() ?? name;\n let seenTitle = false;\n let summary = \"\";\n for (const line of lines) {\n const text = line.trim();\n if (!seenTitle) {\n if (text.startsWith(\"# \")) seenTitle = true;\n continue;\n }\n if (text === \"\" || text.startsWith(\"#\")) continue;\n summary = text;\n break;\n }\n layouts.push({ name, title, summary });\n }\n layouts.sort((a, b) => a.name.localeCompare(b.name));\n return layouts;\n}\n\nconst server = new McpServer({\n name: \"f-ewald-components\",\n version: await readPackageVersion(),\n});\n\nserver.registerTool(\n \"list_components\",\n {\n title: \"List components\",\n description:\n \"Lists every web component tag in @f-ewald/components with a one-line \" +\n \"description. Call get_component_docs(tag) for the full usage example, \" +\n \"attributes/properties, events, slots, and CSS custom properties of a \" +\n \"specific tag.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listComponents(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_component_docs\",\n {\n title: \"Get component docs\",\n description:\n \"Returns the full generated Markdown documentation (install snippet, \" +\n \"usage example, attributes/properties, events, slots, CSS custom \" +\n \"properties) for one @f-ewald/components tag. Use list_components \" +\n \"first to find valid tags.\",\n inputSchema: { tag: z.string().describe('Component tag name, e.g. \"ui-button\".') },\n },\n async ({ tag }) => {\n try {\n const text = await readFile(path.join(docsDir, `${tag}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n const validTags = (await listComponents()).map((c) => c.tag).join(\", \");\n return {\n content: [{ type: \"text\", text: `No docs found for tag \"${tag}\". Valid tags: ${validTags}` }],\n isError: true,\n };\n }\n },\n);\n\nserver.registerTool(\n \"list_layouts\",\n {\n title: \"List layouts\",\n description:\n \"Lists the dashboard page templates (layout recipes) in \" +\n \"@f-ewald/components — list-only, list+detail, detail-only, and form — \" +\n \"with a one-line summary each. Call get_layout(name) for the full recipe \" +\n \"(which components fill which app-shell slots, example markup, and notes). \" +\n \"Use this to learn the preferred internal-dashboard layout before \" +\n \"composing app-shell, app-sidebar, action-bar, pagination-nav, \" +\n \"form-actions, and page-header.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listLayouts(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_layout\",\n {\n title: \"Get layout recipe\",\n description:\n \"Returns the full Markdown recipe for one dashboard page template: which \" +\n \"components go in which app-shell slots, copy-paste markup, and layout \" +\n \"notes. Use list_layouts first to find valid names.\",\n inputSchema: { name: z.string().describe('Layout name, e.g. \"list-detail\".') },\n },\n async ({ name }) => {\n if (/^[a-z0-9-]+$/.test(name)) {\n try {\n const text = await readFile(path.join(layoutsDir, `${name}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n // Fall through to the not-found response with valid names.\n }\n }\n const validNames = (await listLayouts()).map((layout) => layout.name).join(\", \");\n return {\n content: [{ type: \"text\", text: `No layout named \"${name}\". Valid layouts: ${validNames}` }],\n isError: true,\n };\n },\n);\n\nserver.registerTool(\n \"list_icons\",\n {\n title: \"List icons\",\n description:\n \"Lists every icon in @f-ewald/components/icons.js (e.g. iconPencil) \" +\n \"with its default size in pixels and its intended use case, so an \" +\n \"agent picks the one consistent icon for a given situation (e.g. \" +\n \"delete vs. edit vs. close) instead of guessing. Import as \" +\n '`import { iconPencil } from \"@f-ewald/components/icons.js\"` and call ' +\n \"with an optional size override, e.g. iconPencil(16).\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listIcons(), null, 2) }],\n }),\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n"]}
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,2EAA2E;AAC3E,sEAAsE;AACtE,kEAAkE;AAClE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAA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,EAAE,CAAC;QAC/C,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;IACH,CAAC;IACD,MAAM,UAAU,GAAG,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,IAAI,qBAAqB,UAAU,EAAE,EAAE,CAAC;QAC5F,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;IACE,KAAK,EAAE,YAAY;IACnB,WAAW,EACT,qEAAqE;QACrE,mEAAmE;QACnE,kEAAkE;QAClE,4DAA4D;QAC5D,uEAAuE;QACvE,sDAAsD;CACzD,EACD,KAAK,IAAI,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;CAC9E,CAAC,CACH,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Stdio MCP server exposing the `@f-ewald/components` catalog to AI coding\n * assistants (Claude Code, etc.) working in a consuming project.\n *\n * Tools, backed by the same `custom-elements.json` and `docs/*.md` this\n * package already generates and ships via `npm run docs`, plus the authored\n * `docs/layouts/*.md` recipes:\n * - `list_components`: every tag name + one-line description.\n * - `get_component_docs`: the full generated Markdown doc for one tag.\n * - `list_layouts`: every page template + one-line summary.\n * - `get_layout`: the full recipe for one page template.\n * - `list_icons`: every icon, its default size, and its intended use case.\n *\n * No new data source — this is just a different transport over docs that\n * already exist. See `docs/mcp-evaluation.md` for the design rationale.\n */\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport path from \"node:path\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n// This file compiles to dist/mcp-server.js; custom-elements.json and docs/\n// ship alongside dist/ at the package root, whether run from the repo\n// checkout or from an installed node_modules/@f-ewald/components.\nconst packageRoot = path.join(__dirname, \"..\");\nconst docsDir = path.join(packageRoot, \"docs\");\nconst layoutsDir = path.join(docsDir, \"layouts\");\n\n/** One row of the `list_components` result. */\ninterface ComponentSummary {\n tag: string;\n summary: string;\n}\n\n/** One row of the `list_layouts` result. */\ninterface LayoutSummary {\n name: string;\n title: string;\n summary: string;\n}\n\n/** One row of the `list_icons` result. */\ninterface IconSummary {\n name: string;\n defaultSize: number;\n usage: string;\n}\n\n/** Reads the package's own version out of package.json, for server metadata. */\nasync function readPackageVersion(): Promise<string> {\n const text = await readFile(path.join(packageRoot, \"package.json\"), \"utf8\");\n return (JSON.parse(text) as { version: string }).version;\n}\n\n/** Extracts {tag, one-line summary} for every custom element, sorted by tag. */\nasync function listComponents(): Promise<ComponentSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: { declarations?: { customElement?: boolean; tagName: string; description?: string }[] }[];\n };\n const components: ComponentSummary[] = [];\n for (const mod of manifest.modules) {\n for (const decl of mod.declarations ?? []) {\n if (!decl.customElement || !decl.tagName) continue;\n const summary = (decl.description ?? \"\").split(\"\\n\\n\")[0]!.replace(/\\n/g, \" \").trim();\n components.push({ tag: decl.tagName, summary });\n }\n }\n components.sort((a, b) => a.tag.localeCompare(b.tag));\n return components;\n}\n\n/**\n * Extracts {name, defaultSize, usage} for every `icon*` export in\n * `src/icons.ts`, sorted by name. `usage` is the \"use for ...\" guideline\n * `scripts/generate-icons.mjs` writes as a JSDoc comment above each export,\n * which `npm run analyze` lifts into this same `custom-elements.json` — the\n * same source `listComponents` reads, just a different module/kind filter.\n */\nasync function listIcons(): Promise<IconSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: {\n path: string;\n declarations?: {\n kind?: string;\n name: string;\n description?: string;\n parameters?: { default?: string }[];\n }[];\n }[];\n };\n const icons: IconSummary[] = [];\n for (const mod of manifest.modules) {\n if (mod.path !== \"src/icons.ts\") continue;\n for (const decl of mod.declarations ?? []) {\n if (decl.kind !== \"function\" || !decl.name.startsWith(\"icon\")) continue;\n icons.push({\n name: decl.name,\n defaultSize: Number(decl.parameters?.[0]?.default ?? 18),\n usage: decl.description ?? \"\",\n });\n }\n }\n icons.sort((a, b) => a.name.localeCompare(b.name));\n return icons;\n}\n\n/**\n * Extracts {name, title, one-line summary} for every `docs/layouts/*.md`\n * recipe, sorted by name. `name` is the filename without `.md`; `summary` is\n * the recipe's first prose paragraph.\n */\nasync function listLayouts(): Promise<LayoutSummary[]> {\n let files: string[];\n try {\n files = await readdir(layoutsDir);\n } catch {\n return [];\n }\n const layouts: LayoutSummary[] = [];\n for (const file of files) {\n if (!file.endsWith(\".md\")) continue;\n const name = file.slice(0, -3);\n const lines = (await readFile(path.join(layoutsDir, file), \"utf8\")).split(\"\\n\");\n const title = lines.find((line) => line.startsWith(\"# \"))?.slice(2).trim() ?? name;\n let seenTitle = false;\n let summary = \"\";\n for (const line of lines) {\n const text = line.trim();\n if (!seenTitle) {\n if (text.startsWith(\"# \")) seenTitle = true;\n continue;\n }\n if (text === \"\" || text.startsWith(\"#\")) continue;\n summary = text;\n break;\n }\n layouts.push({ name, title, summary });\n }\n layouts.sort((a, b) => a.name.localeCompare(b.name));\n return layouts;\n}\n\nconst server = new McpServer({\n name: \"f-ewald-components\",\n version: await readPackageVersion(),\n});\n\nserver.registerTool(\n \"list_components\",\n {\n title: \"List components\",\n description:\n \"Lists every web component tag in @f-ewald/components with a one-line \" +\n \"description. Call get_component_docs(tag) for the full usage example, \" +\n \"attributes/properties, events, slots, and CSS custom properties of a \" +\n \"specific tag.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listComponents(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_component_docs\",\n {\n title: \"Get component docs\",\n description:\n \"Returns the full generated Markdown documentation (install snippet, \" +\n \"usage example, attributes/properties, events, slots, CSS custom \" +\n \"properties) for one @f-ewald/components tag. Use list_components \" +\n \"first to find valid tags.\",\n inputSchema: { tag: z.string().describe('Component tag name, e.g. \"ui-button\".') },\n },\n async ({ tag }) => {\n try {\n const text = await readFile(path.join(docsDir, `${tag}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n const validTags = (await listComponents()).map((c) => c.tag).join(\", \");\n return {\n content: [{ type: \"text\", text: `No docs found for tag \"${tag}\". Valid tags: ${validTags}` }],\n isError: true,\n };\n }\n },\n);\n\nserver.registerTool(\n \"list_layouts\",\n {\n title: \"List layouts\",\n description:\n \"Lists the dashboard page templates (layout recipes) in \" +\n \"@f-ewald/components — list-only, list+detail, detail-only, and form — \" +\n \"with a one-line summary each. Call get_layout(name) for the full recipe \" +\n \"(which components fill which app-shell slots, example markup, and notes). \" +\n \"Use this to learn the preferred internal-dashboard layout before \" +\n \"composing app-shell, app-sidebar, action-bar, pagination-nav, \" +\n \"form-actions, and page-header.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listLayouts(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_layout\",\n {\n title: \"Get layout recipe\",\n description:\n \"Returns the full Markdown recipe for one dashboard page template: which \" +\n \"components go in which app-shell slots, copy-paste markup, and layout \" +\n \"notes. Use list_layouts first to find valid names.\",\n inputSchema: { name: z.string().describe('Layout name, e.g. \"list-detail\".') },\n },\n async ({ name }) => {\n if (/^[a-z0-9-]+$/.test(name)) {\n try {\n const text = await readFile(path.join(layoutsDir, `${name}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n // Fall through to the not-found response with valid names.\n }\n }\n const validNames = (await listLayouts()).map((layout) => layout.name).join(\", \");\n return {\n content: [{ type: \"text\", text: `No layout named \"${name}\". Valid layouts: ${validNames}` }],\n isError: true,\n };\n },\n);\n\nserver.registerTool(\n \"list_icons\",\n {\n title: \"List icons\",\n description:\n \"Lists every icon in @f-ewald/components/icons.js (e.g. iconPencil) \" +\n \"with its default size in pixels and its intended use case, so an \" +\n \"agent picks the one consistent icon for a given situation (e.g. \" +\n \"delete vs. edit vs. close) instead of guessing. Import as \" +\n '`import { iconPencil } from \"@f-ewald/components/icons.js\"` and call ' +\n \"with an optional size override, e.g. iconPencil(16).\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listIcons(), null, 2) }],\n }),\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n"]}
|
package/dist/modal-dialog.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { LitElement, type PropertyValues } from "lit";
|
|
2
2
|
export type ModalDialogSize = "default" | "lg" | "fullscreen";
|
|
3
3
|
/**
|
|
4
|
-
* Generic centered modal-dialog shell:
|
|
5
|
-
* close button, and an arbitrary slotted body — the modal
|
|
6
|
-
* `slide-panel` (fixed-edge) and `popover-panel` (anchored).
|
|
7
|
-
* `confirm-dialog`, it has no baked-in actions; the consumer supplies
|
|
8
|
-
* body content (a form, a read-only viewer, a table) and any footer
|
|
9
|
-
* itself. Instant
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
4
|
+
* Generic centered modal-dialog shell: a native modal `<dialog>` card with
|
|
5
|
+
* header chrome, a close button, and an arbitrary slotted body — the modal
|
|
6
|
+
* sibling to `slide-panel` (fixed-edge) and `popover-panel` (anchored).
|
|
7
|
+
* Unlike `confirm-dialog`, it has no baked-in actions; the consumer supplies
|
|
8
|
+
* the body content (a form, a read-only viewer, a table) and any footer
|
|
9
|
+
* buttons itself. Instant open/close, no transition. Because it uses
|
|
10
|
+
* `showModal()`, it renders in the browser's top layer, makes the rest of the
|
|
11
|
+
* page inert, contains focus, and restores focus to the trigger on close;
|
|
12
|
+
* Escape is routed to the topmost layer only (see `utils/layer-stack`).
|
|
13
13
|
*
|
|
14
14
|
* @element modal-dialog
|
|
15
15
|
* @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.
|
|
@@ -30,13 +30,16 @@ export declare class ModalDialog extends LitElement {
|
|
|
30
30
|
size: ModalDialogSize;
|
|
31
31
|
/** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */
|
|
32
32
|
dismissible: boolean;
|
|
33
|
-
private
|
|
33
|
+
private _dialog;
|
|
34
34
|
private _close;
|
|
35
|
-
|
|
35
|
+
/** Native focus delegation doesn't reliably reach slotted light-DOM content, so focus explicitly. */
|
|
36
36
|
private _focusInitial;
|
|
37
|
-
|
|
37
|
+
/** Escape goes to the topmost layer only (a popover opened inside this dialog claims it first). */
|
|
38
38
|
private _onWindowKeydown;
|
|
39
|
-
|
|
39
|
+
/** Native close requests (e.g. a back gesture) are routed through `panel-close`; the consumer owns `open`. */
|
|
40
|
+
private _onCancel;
|
|
41
|
+
/** A click that lands on the `<dialog>` itself, outside its box, is a backdrop click. */
|
|
42
|
+
private _onDialogClick;
|
|
40
43
|
protected updated(changed: PropertyValues): void;
|
|
41
44
|
disconnectedCallback(): void;
|
|
42
45
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-dialog.d.ts","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1E,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"modal-dialog.d.ts","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1E,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,4BAgHpB;IAEF,qCAAqC;IACR,IAAI,UAAS;IAC1C,4EAA4E;IAChE,OAAO,SAAM;IACzB;;;;OAIG;IACS,IAAI,EAAE,eAAe,CAAa;IAC9C,oHAAoH;IACvF,WAAW,UAAS;IAEhC,OAAO,CAAC,OAAO,CAAqB;IAErD,OAAO,CAAC,MAAM;IAId,qGAAqG;IACrG,OAAO,CAAC,aAAa;IAMrB,mGAAmG;IACnG,OAAO,CAAC,gBAAgB,CAEtB;IAEF,8GAA8G;IAC9G,OAAO,CAAC,SAAS,CAGf;IAEF,yFAAyF;IACzF,OAAO,CAAC,cAAc,CAMpB;IAEF,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAYxD;IAEQ,oBAAoB,IAAI,IAAI,CAKpC;IAEQ,MAAM,yCAuBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/modal-dialog.js
CHANGED
|
@@ -5,20 +5,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { LitElement, css, html, nothing } from "lit";
|
|
8
|
-
import { customElement, property } from "lit/decorators.js";
|
|
8
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
9
9
|
import { iconX } from "./icons.js";
|
|
10
10
|
import { tokens } from "./tokens.js";
|
|
11
11
|
import { activateLayer, claimEscape, deactivateLayer, isTopLayer } from "./utils/layer-stack.js";
|
|
12
12
|
/**
|
|
13
|
-
* Generic centered modal-dialog shell:
|
|
14
|
-
* close button, and an arbitrary slotted body — the modal
|
|
15
|
-
* `slide-panel` (fixed-edge) and `popover-panel` (anchored).
|
|
16
|
-
* `confirm-dialog`, it has no baked-in actions; the consumer supplies
|
|
17
|
-
* body content (a form, a read-only viewer, a table) and any footer
|
|
18
|
-
* itself. Instant
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
13
|
+
* Generic centered modal-dialog shell: a native modal `<dialog>` card with
|
|
14
|
+
* header chrome, a close button, and an arbitrary slotted body — the modal
|
|
15
|
+
* sibling to `slide-panel` (fixed-edge) and `popover-panel` (anchored).
|
|
16
|
+
* Unlike `confirm-dialog`, it has no baked-in actions; the consumer supplies
|
|
17
|
+
* the body content (a form, a read-only viewer, a table) and any footer
|
|
18
|
+
* buttons itself. Instant open/close, no transition. Because it uses
|
|
19
|
+
* `showModal()`, it renders in the browser's top layer, makes the rest of the
|
|
20
|
+
* page inert, contains focus, and restores focus to the trigger on close;
|
|
21
|
+
* Escape is routed to the topmost layer only (see `utils/layer-stack`).
|
|
22
22
|
*
|
|
23
23
|
* @element modal-dialog
|
|
24
24
|
* @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.
|
|
@@ -40,65 +40,38 @@ let ModalDialog = class ModalDialog extends LitElement {
|
|
|
40
40
|
this.size = "default";
|
|
41
41
|
/** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */
|
|
42
42
|
this.dismissible = false;
|
|
43
|
-
this.
|
|
44
|
-
this._onDocumentFocusIn = (event) => {
|
|
45
|
-
if (!this.open || !isTopLayer(this) || event.composedPath().includes(this))
|
|
46
|
-
return;
|
|
47
|
-
this._focusInitial();
|
|
48
|
-
};
|
|
43
|
+
/** Escape goes to the topmost layer only (a popover opened inside this dialog claims it first). */
|
|
49
44
|
this._onWindowKeydown = (event) => {
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if (this.open && claimEscape(this, event))
|
|
46
|
+
this._close();
|
|
47
|
+
};
|
|
48
|
+
/** Native close requests (e.g. a back gesture) are routed through `panel-close`; the consumer owns `open`. */
|
|
49
|
+
this._onCancel = (event) => {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
if (this.open && isTopLayer(this))
|
|
53
52
|
this._close();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (event.key !== "Tab")
|
|
57
|
-
return;
|
|
58
|
-
const focusable = this._getFocusableElements();
|
|
59
|
-
if (focusable.length === 0) {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
this._focusInitial();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const active = (this.shadowRoot?.activeElement ?? document.activeElement);
|
|
65
|
-
const index = focusable.indexOf(active);
|
|
66
|
-
if (event.shiftKey && index <= 0) {
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
focusable.at(-1)?.focus();
|
|
69
|
-
}
|
|
70
|
-
else if (!event.shiftKey && index === focusable.length - 1) {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
focusable[0]?.focus();
|
|
73
|
-
}
|
|
74
53
|
};
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
/** A click that lands on the `<dialog>` itself, outside its box, is a backdrop click. */
|
|
55
|
+
this._onDialogClick = (event) => {
|
|
56
|
+
if (!this.dismissible || event.target !== event.currentTarget)
|
|
57
|
+
return;
|
|
58
|
+
const box = this._dialog.getBoundingClientRect();
|
|
59
|
+
const outside = event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
60
|
+
if (outside)
|
|
77
61
|
this._close();
|
|
78
62
|
};
|
|
79
63
|
}
|
|
80
64
|
static { this.styles = [
|
|
81
65
|
tokens,
|
|
82
66
|
css `
|
|
83
|
-
.
|
|
67
|
+
.dialog {
|
|
68
|
+
/* Native modal <dialog>: top layer, inert page behind it, built-in focus containment. */
|
|
84
69
|
position: fixed;
|
|
85
|
-
inset: 0;
|
|
86
|
-
|
|
87
|
-
z-index: var(--component-layer-z, 50);
|
|
88
|
-
display: none;
|
|
89
|
-
align-items: flex-start;
|
|
90
|
-
justify-content: center;
|
|
91
|
-
padding: 10vh 1.25rem 1.25rem;
|
|
92
|
-
box-sizing: border-box;
|
|
93
|
-
}
|
|
94
|
-
.overlay.open {
|
|
95
|
-
display: flex;
|
|
96
|
-
}
|
|
97
|
-
.overlay.fullscreen {
|
|
70
|
+
inset: 0 0 auto 0;
|
|
71
|
+
margin: 10vh auto 0;
|
|
98
72
|
padding: 0;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
.dialog {
|
|
73
|
+
border: 0;
|
|
74
|
+
color: inherit;
|
|
102
75
|
background: var(--ui-surface, #ffffff);
|
|
103
76
|
border-radius: var(--ui-radius, 0.5rem);
|
|
104
77
|
box-shadow: var(
|
|
@@ -109,16 +82,24 @@ let ModalDialog = class ModalDialog extends LitElement {
|
|
|
109
82
|
width: 100%;
|
|
110
83
|
max-width: min(25rem, calc(100vw - 2rem));
|
|
111
84
|
max-height: calc(100vh - 10vh - 1.25rem);
|
|
112
|
-
display: flex;
|
|
113
|
-
flex-direction: column;
|
|
114
85
|
overflow: hidden;
|
|
115
86
|
box-sizing: border-box;
|
|
116
87
|
outline: none;
|
|
117
88
|
}
|
|
89
|
+
/* Scoped to [open]: an author display value would otherwise defeat the UA's display:none. */
|
|
90
|
+
.dialog[open] {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
}
|
|
94
|
+
.dialog::backdrop {
|
|
95
|
+
background: var(--ui-overlay, rgb(15 23 42 / 0.45));
|
|
96
|
+
}
|
|
118
97
|
.dialog.lg {
|
|
119
98
|
max-width: min(60rem, calc(100vw - 2rem));
|
|
120
99
|
}
|
|
121
100
|
.dialog.fullscreen {
|
|
101
|
+
inset: 0;
|
|
102
|
+
margin: 0;
|
|
122
103
|
width: 100vw;
|
|
123
104
|
height: 100vh;
|
|
124
105
|
max-width: 100vw;
|
|
@@ -187,9 +168,8 @@ let ModalDialog = class ModalDialog extends LitElement {
|
|
|
187
168
|
}
|
|
188
169
|
}
|
|
189
170
|
@media (max-width: 48rem) {
|
|
190
|
-
.
|
|
191
|
-
|
|
192
|
-
overflow-y: auto;
|
|
171
|
+
.dialog {
|
|
172
|
+
margin-top: 0.75rem;
|
|
193
173
|
}
|
|
194
174
|
}
|
|
195
175
|
`,
|
|
@@ -197,74 +177,56 @@ let ModalDialog = class ModalDialog extends LitElement {
|
|
|
197
177
|
_close() {
|
|
198
178
|
this.dispatchEvent(new CustomEvent("panel-close", { bubbles: true, composed: true }));
|
|
199
179
|
}
|
|
200
|
-
|
|
201
|
-
const selector = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])";
|
|
202
|
-
const slotted = Array.from(this.querySelectorAll(selector));
|
|
203
|
-
const internal = Array.from(this.shadowRoot?.querySelectorAll(selector) ?? []).filter((element) => element.closest(".dialog") !== null);
|
|
204
|
-
return [...slotted, ...internal].filter((element) => !element.hasAttribute("hidden"));
|
|
205
|
-
}
|
|
180
|
+
/** Native focus delegation doesn't reliably reach slotted light-DOM content, so focus explicitly. */
|
|
206
181
|
_focusInitial() {
|
|
207
182
|
const autofocus = this.querySelector("[autofocus]");
|
|
208
183
|
const close = this.shadowRoot?.querySelector(".close-btn");
|
|
209
|
-
|
|
210
|
-
(autofocus ?? close ?? this._getFocusableElements()[0] ?? dialog)?.focus();
|
|
184
|
+
(autofocus ?? close)?.focus();
|
|
211
185
|
}
|
|
212
186
|
updated(changed) {
|
|
213
187
|
if (!changed.has("open"))
|
|
214
188
|
return;
|
|
215
189
|
if (this.open) {
|
|
216
190
|
activateLayer(this);
|
|
217
|
-
this._previousFocus = document.activeElement;
|
|
218
|
-
document.addEventListener("focusin", this._onDocumentFocusIn, true);
|
|
219
191
|
window.addEventListener("keydown", this._onWindowKeydown, true);
|
|
192
|
+
if (!this._dialog.open)
|
|
193
|
+
this._dialog.showModal();
|
|
220
194
|
this._focusInitial();
|
|
221
195
|
return;
|
|
222
196
|
}
|
|
223
197
|
deactivateLayer(this);
|
|
224
|
-
document.removeEventListener("focusin", this._onDocumentFocusIn, true);
|
|
225
198
|
window.removeEventListener("keydown", this._onWindowKeydown, true);
|
|
226
|
-
if (this.
|
|
227
|
-
this.
|
|
228
|
-
this._previousFocus = null;
|
|
199
|
+
if (this._dialog.open)
|
|
200
|
+
this._dialog.close();
|
|
229
201
|
}
|
|
230
202
|
disconnectedCallback() {
|
|
231
203
|
super.disconnectedCallback();
|
|
232
|
-
document.removeEventListener("focusin", this._onDocumentFocusIn, true);
|
|
233
204
|
window.removeEventListener("keydown", this._onWindowKeydown, true);
|
|
234
205
|
deactivateLayer(this);
|
|
235
|
-
if (this._previousFocus?.isConnected)
|
|
236
|
-
this._previousFocus.focus();
|
|
237
|
-
this._previousFocus = null;
|
|
238
206
|
this.open = false;
|
|
239
207
|
}
|
|
240
208
|
render() {
|
|
241
209
|
const explicitLabel = this.getAttribute("aria-label");
|
|
242
210
|
return html `
|
|
243
|
-
<
|
|
244
|
-
class="
|
|
245
|
-
|
|
211
|
+
<dialog
|
|
212
|
+
class="dialog ${this.size === "lg" ? "lg" : this.size === "fullscreen" ? "fullscreen" : ""}"
|
|
213
|
+
aria-label=${explicitLabel ?? nothing}
|
|
214
|
+
aria-labelledby=${explicitLabel ? nothing : "dialog-title"}
|
|
215
|
+
@click=${this._onDialogClick}
|
|
216
|
+
@cancel=${this._onCancel}
|
|
246
217
|
>
|
|
247
|
-
<div
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
aria-label=${
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
<slot name="title">${this.heading}</slot>
|
|
258
|
-
</span>
|
|
259
|
-
<button class="close-btn" aria-label="Close" @click=${this._close}>
|
|
260
|
-
<span aria-hidden="true">${iconX(18)}</span>
|
|
261
|
-
</button>
|
|
262
|
-
</div>
|
|
263
|
-
<div class="body">
|
|
264
|
-
<slot></slot>
|
|
265
|
-
</div>
|
|
218
|
+
<div class="dialog-header">
|
|
219
|
+
<span id="dialog-title" class="dialog-title">
|
|
220
|
+
<slot name="title">${this.heading}</slot>
|
|
221
|
+
</span>
|
|
222
|
+
<button class="close-btn" aria-label="Close" @click=${this._close}>
|
|
223
|
+
<span aria-hidden="true">${iconX(18)}</span>
|
|
224
|
+
</button>
|
|
225
|
+
</div>
|
|
226
|
+
<div class="body">
|
|
227
|
+
<slot></slot>
|
|
266
228
|
</div>
|
|
267
|
-
</
|
|
229
|
+
</dialog>
|
|
268
230
|
`;
|
|
269
231
|
}
|
|
270
232
|
};
|
|
@@ -280,6 +242,9 @@ __decorate([
|
|
|
280
242
|
__decorate([
|
|
281
243
|
property({ type: Boolean })
|
|
282
244
|
], ModalDialog.prototype, "dismissible", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
query("dialog")
|
|
247
|
+
], ModalDialog.prototype, "_dialog", void 0);
|
|
283
248
|
ModalDialog = __decorate([
|
|
284
249
|
customElement("modal-dialog")
|
|
285
250
|
], ModalDialog);
|
package/dist/modal-dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-dialog.js","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,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CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;;;uBAG7E,aAAa,IAAI,OAAO;4BACnB,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;;;;;mCAKjC,IAAI,CAAC,OAAO;;kEAEmB,IAAI,CAAC,MAAM;yCACpC,KAAK,CAAC,EAAE,CAAC;;;;;;;;KAQ7C,CAAC;IACJ,CAAC;CACF,CAAA;AA9H8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAc;AAE9B;IAAX,QAAQ,EAAE;4CAAc;AAMb;IAAX,QAAQ,EAAE;yCAAmC;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAqB;AAlItC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAsPvB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport { activateLayer, claimEscape, deactivateLayer, isTopLayer } from \"./utils/layer-stack.js\";\n\nexport type ModalDialogSize = \"default\" | \"lg\" | \"fullscreen\";\n\n/**\n * Generic centered modal-dialog shell: overlay + card with header chrome, a\n * close button, and an arbitrary slotted body — the modal sibling to\n * `slide-panel` (fixed-edge) and `popover-panel` (anchored). Unlike\n * `confirm-dialog`, it has no baked-in actions; the consumer supplies the\n * body content (a form, a read-only viewer, a table) and any footer buttons\n * itself. Instant `display:none` → `display:flex` toggle, no transition.\n * Traps focus, closes on Escape, and restores focus to the trigger on\n * close, stacking correctly against other open `confirm-dialog`/\n * `slide-panel`/`popover-panel`/`modal-dialog` layers.\n *\n * @element modal-dialog\n * @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.\n * @slot - Dialog body content.\n * @slot title - Overrides the header title text (falls back to the `heading` property).\n */\n@customElement(\"modal-dialog\")\nexport class ModalDialog extends LitElement {\n static override styles = [\n tokens,\n css`\n .overlay {\n position: fixed;\n inset: 0;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n z-index: var(--component-layer-z, 50);\n display: none;\n align-items: flex-start;\n justify-content: center;\n padding: 10vh 1.25rem 1.25rem;\n box-sizing: border-box;\n }\n .overlay.open {\n display: flex;\n }\n .overlay.fullscreen {\n padding: 0;\n align-items: stretch;\n }\n .dialog {\n background: var(--ui-surface, #ffffff);\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n width: 100%;\n max-width: min(25rem, calc(100vw - 2rem));\n max-height: calc(100vh - 10vh - 1.25rem);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-sizing: border-box;\n outline: none;\n }\n .dialog.lg {\n max-width: min(60rem, calc(100vw - 2rem));\n }\n .dialog.fullscreen {\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n }\n .dialog-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n flex: 0 0 auto;\n }\n .dialog-title {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size-lg, 1rem);\n line-height: var(--ui-line-height-tight, 1.25);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n color: var(--ui-text, #0f172a);\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n padding-right: 0.5rem;\n }\n .close-btn {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n .close-btn:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .close-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .body {\n overflow-y: auto;\n flex: 1 1 auto;\n }\n @media (forced-colors: active) {\n .close-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .overlay {\n padding: 0.75rem;\n overflow-y: auto;\n }\n }\n `,\n ];\n\n /** Whether the dialog is visible. */\n @property({ type: Boolean }) open = false;\n /** Title text shown in the dialog header (overridable via slot=\"title\"). */\n @property() heading = \"\";\n /**\n * `\"lg\"` widens the dialog to 60rem for content like tables; `\"default\"`\n * is 25rem; `\"fullscreen\"` covers the entire viewport edge-to-edge with\n * no border-radius or overlay padding.\n */\n @property() size: ModalDialogSize = \"default\";\n /** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */\n @property({ type: Boolean }) dismissible = false;\n\n private _previousFocus: HTMLElement | null = null;\n\n private _close() {\n this.dispatchEvent(new CustomEvent(\"panel-close\", { bubbles: true, composed: true }));\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const selector =\n \"a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])\";\n const slotted = Array.from(this.querySelectorAll<HTMLElement>(selector));\n const internal = Array.from(\n this.shadowRoot?.querySelectorAll<HTMLElement>(selector) ?? [],\n ).filter((element) => element.closest(\".dialog\") !== null);\n return [...slotted, ...internal].filter((element) => !element.hasAttribute(\"hidden\"));\n }\n\n private _focusInitial(): void {\n const autofocus = this.querySelector<HTMLElement>(\"[autofocus]\");\n const close = this.shadowRoot?.querySelector<HTMLElement>(\".close-btn\");\n const dialog = this.shadowRoot?.querySelector<HTMLElement>(\".dialog\");\n (autofocus ?? close ?? this._getFocusableElements()[0] ?? dialog)?.focus();\n }\n\n private _onDocumentFocusIn = (event: FocusEvent): void => {\n if (!this.open || !isTopLayer(this) || event.composedPath().includes(this)) return;\n this._focusInitial();\n };\n\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (!this.open || !isTopLayer(this)) return;\n if (claimEscape(this, event)) {\n this._close();\n return;\n }\n if (event.key !== \"Tab\") return;\n\n const focusable = this._getFocusableElements();\n if (focusable.length === 0) {\n event.preventDefault();\n this._focusInitial();\n return;\n }\n const active = (this.shadowRoot?.activeElement ?? document.activeElement) as HTMLElement | null;\n const index = focusable.indexOf(active as HTMLElement);\n if (event.shiftKey && index <= 0) {\n event.preventDefault();\n focusable.at(-1)?.focus();\n } else if (!event.shiftKey && index === focusable.length - 1) {\n event.preventDefault();\n focusable[0]?.focus();\n }\n };\n\n private _onOverlayClick = (event: MouseEvent): void => {\n if (this.dismissible && event.target === event.currentTarget) this._close();\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n this._previousFocus = document.activeElement as HTMLElement | null;\n document.addEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.addEventListener(\"keydown\", this._onWindowKeydown, true);\n this._focusInitial();\n return;\n }\n deactivateLayer(this);\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n deactivateLayer(this);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n this.open = false;\n }\n\n override render() {\n const explicitLabel = this.getAttribute(\"aria-label\");\n return html`\n <div\n class=\"overlay ${this.open ? \"open\" : \"\"} ${this.size === \"fullscreen\" ? \"fullscreen\" : \"\"}\"\n @click=${this._onOverlayClick}\n >\n <div\n class=\"dialog ${this.size === \"lg\" ? \"lg\" : this.size === \"fullscreen\" ? \"fullscreen\" : \"\"}\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${explicitLabel ?? nothing}\n aria-labelledby=${explicitLabel ? nothing : \"dialog-title\"}\n tabindex=\"-1\"\n >\n <div class=\"dialog-header\">\n <span id=\"dialog-title\" class=\"dialog-title\">\n <slot name=\"title\">${this.heading}</slot>\n </span>\n <button class=\"close-btn\" aria-label=\"Close\" @click=${this._close}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n <div class=\"body\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"modal-dialog\": ModalDialog;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"modal-dialog.js","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIjG;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAmHL,qCAAqC;QACR,SAAI,GAAG,KAAK,CAAC;QAC1C,4EAA4E;QAChE,YAAO,GAAG,EAAE,CAAC;QACzB;;;;WA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,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAEQ,MAAM;QACb,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACtD,OAAO,IAAI,CAAA;;wBAES,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;qBAC7E,aAAa,IAAI,OAAO;0BACnB,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;iBACjD,IAAI,CAAC,cAAc;kBAClB,IAAI,CAAC,SAAS;;;;iCAIC,IAAI,CAAC,OAAO;;gEAEmB,IAAI,CAAC,MAAM;uCACpC,KAAK,CAAC,EAAE,CAAC;;;;;;;KAO3C,CAAC;IACJ,CAAC;CACF,CAAA;AA1F8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAc;AAE9B;IAAX,QAAQ,EAAE;4CAAc;AAMb;IAAX,QAAQ,EAAE;yCAAmC;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAqB;AAExB;IAAxB,KAAK,CAAC,QAAQ,CAAC;4CAAqC;AAhI1C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA8MvB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, query } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport { activateLayer, claimEscape, deactivateLayer, isTopLayer } from \"./utils/layer-stack.js\";\n\nexport type ModalDialogSize = \"default\" | \"lg\" | \"fullscreen\";\n\n/**\n * Generic centered modal-dialog shell: a native modal `<dialog>` card with\n * header chrome, a close button, and an arbitrary slotted body — the modal\n * sibling to `slide-panel` (fixed-edge) and `popover-panel` (anchored).\n * Unlike `confirm-dialog`, it has no baked-in actions; the consumer supplies\n * the body content (a form, a read-only viewer, a table) and any footer\n * buttons itself. Instant open/close, no transition. Because it uses\n * `showModal()`, it renders in the browser's top layer, makes the rest of the\n * page inert, contains focus, and restores focus to the trigger on close;\n * Escape is routed to the topmost layer only (see `utils/layer-stack`).\n *\n * @element modal-dialog\n * @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.\n * @slot - Dialog body content.\n * @slot title - Overrides the header title text (falls back to the `heading` property).\n */\n@customElement(\"modal-dialog\")\nexport class ModalDialog extends LitElement {\n static override styles = [\n tokens,\n css`\n .dialog {\n /* Native modal <dialog>: top layer, inert page behind it, built-in focus containment. */\n position: fixed;\n inset: 0 0 auto 0;\n margin: 10vh auto 0;\n padding: 0;\n border: 0;\n color: inherit;\n background: var(--ui-surface, #ffffff);\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n width: 100%;\n max-width: min(25rem, calc(100vw - 2rem));\n max-height: calc(100vh - 10vh - 1.25rem);\n overflow: hidden;\n box-sizing: border-box;\n outline: none;\n }\n /* Scoped to [open]: an author display value would otherwise defeat the UA's display:none. */\n .dialog[open] {\n display: flex;\n flex-direction: column;\n }\n .dialog::backdrop {\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n }\n .dialog.lg {\n max-width: min(60rem, calc(100vw - 2rem));\n }\n .dialog.fullscreen {\n inset: 0;\n margin: 0;\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n }\n .dialog-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n flex: 0 0 auto;\n }\n .dialog-title {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size-lg, 1rem);\n line-height: var(--ui-line-height-tight, 1.25);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n color: var(--ui-text, #0f172a);\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n padding-right: 0.5rem;\n }\n .close-btn {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n .close-btn:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .close-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .body {\n overflow-y: auto;\n flex: 1 1 auto;\n }\n @media (forced-colors: active) {\n .close-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .dialog {\n margin-top: 0.75rem;\n }\n }\n `,\n ];\n\n /** Whether the dialog is visible. */\n @property({ type: Boolean }) open = false;\n /** Title text shown in the dialog header (overridable via slot=\"title\"). */\n @property() heading = \"\";\n /**\n * `\"lg\"` widens the dialog to 60rem for content like tables; `\"default\"`\n * is 25rem; `\"fullscreen\"` covers the entire viewport edge-to-edge with\n * no border-radius or overlay padding.\n */\n @property() size: ModalDialogSize = \"default\";\n /** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */\n @property({ type: Boolean }) dismissible = false;\n\n @query(\"dialog\") private _dialog!: HTMLDialogElement;\n\n private _close() {\n this.dispatchEvent(new CustomEvent(\"panel-close\", { bubbles: true, composed: true }));\n }\n\n /** Native focus delegation doesn't reliably reach slotted light-DOM content, so focus explicitly. */\n private _focusInitial(): void {\n const autofocus = this.querySelector<HTMLElement>(\"[autofocus]\");\n const close = this.shadowRoot?.querySelector<HTMLElement>(\".close-btn\");\n (autofocus ?? close)?.focus();\n }\n\n /** Escape goes to the topmost layer only (a popover opened inside this dialog claims it first). */\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (this.open && claimEscape(this, event)) this._close();\n };\n\n /** Native close requests (e.g. a back gesture) are routed through `panel-close`; the consumer owns `open`. */\n private _onCancel = (event: Event): void => {\n event.preventDefault();\n if (this.open && isTopLayer(this)) this._close();\n };\n\n /** A click that lands on the `<dialog>` itself, outside its box, is a backdrop click. */\n private _onDialogClick = (event: MouseEvent): void => {\n if (!this.dismissible || event.target !== event.currentTarget) return;\n const box = this._dialog.getBoundingClientRect();\n const outside =\n event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n if (outside) this._close();\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n window.addEventListener(\"keydown\", this._onWindowKeydown, true);\n if (!this._dialog.open) this._dialog.showModal();\n this._focusInitial();\n return;\n }\n deactivateLayer(this);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n if (this._dialog.open) this._dialog.close();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n deactivateLayer(this);\n this.open = false;\n }\n\n override render() {\n const explicitLabel = this.getAttribute(\"aria-label\");\n return html`\n <dialog\n class=\"dialog ${this.size === \"lg\" ? \"lg\" : this.size === \"fullscreen\" ? \"fullscreen\" : \"\"}\"\n aria-label=${explicitLabel ?? nothing}\n aria-labelledby=${explicitLabel ? nothing : \"dialog-title\"}\n @click=${this._onDialogClick}\n @cancel=${this._onCancel}\n >\n <div class=\"dialog-header\">\n <span id=\"dialog-title\" class=\"dialog-title\">\n <slot name=\"title\">${this.heading}</slot>\n </span>\n <button class=\"close-btn\" aria-label=\"Close\" @click=${this._close}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n <div class=\"body\">\n <slot></slot>\n </div>\n </dialog>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"modal-dialog\": ModalDialog;\n }\n}\n"]}
|
package/dist/photo-gallery.js
CHANGED
|
@@ -159,7 +159,7 @@ let PhotoGallery = class PhotoGallery extends LitElement {
|
|
|
159
159
|
width: 2rem;
|
|
160
160
|
height: 2rem;
|
|
161
161
|
padding: 0;
|
|
162
|
-
color: var(--ui-
|
|
162
|
+
color: var(--ui-overlay-text, #ffffff);
|
|
163
163
|
background: var(--ui-overlay, rgb(15 23 42 / 0.45));
|
|
164
164
|
border-radius: var(--ui-radius-pill, 9999px);
|
|
165
165
|
pointer-events: auto;
|