@f-ewald/components 1.44.0 → 1.46.0

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/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,OAA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BAAsB,GAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,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,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 { UiTooltip, type UiTooltipPlacement } from \"./ui-tooltip.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 DataTableAlign, 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 { KindIcon, type KindIconStyle } from \"./kind-icon.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"]}
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,EAA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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 { UiTooltip, type UiTooltipPlacement } from \"./ui-tooltip.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 DataTableAlign, type DataTableColumn } from \"./data-table.js\";\nexport { TileGrid } from \"./tile-grid.js\";\nexport { TreeView, type TreeNode } from \"./tree-view.js\";\nexport { PixelFire } from \"./pixel-fire.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 { KindIcon, type KindIconStyle } from \"./kind-icon.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"]}
@@ -0,0 +1,69 @@
1
+ import { LitElement, type PropertyValues } from "lit";
2
+ /**
3
+ * Pixelated, 8-bit style fire in the manner of old computer games. By default
4
+ * it is pinned full width to the bottom of the viewport as a decorative,
5
+ * click-through overlay; `contained` pins it to the bottom of the nearest
6
+ * positioned ancestor instead.
7
+ *
8
+ * The strip's height is set with `--pixel-fire-height` (default `8rem`). It
9
+ * paints at `z-index: 30`, above ordinary page content but below `app-shell`'s
10
+ * chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`
11
+ * it draws one still frame instead of animating. The canvas is hidden from
12
+ * assistive technology.
13
+ *
14
+ * @element pixel-fire
15
+ */
16
+ export declare class PixelFire extends LitElement {
17
+ /** Size of one fire pixel in CSS pixels; larger values look chunkier. */
18
+ pixelSize: number;
19
+ /**
20
+ * Heat of the fire's source, from `0` to `1`. Lowering it shortens the
21
+ * flames; `0` lets the fire burn out.
22
+ */
23
+ intensity: number;
24
+ /**
25
+ * Pins the fire to the bottom of the nearest positioned ancestor instead of
26
+ * the viewport.
27
+ */
28
+ contained: boolean;
29
+ private _cols;
30
+ private _rows;
31
+ private _heat;
32
+ private _cooling;
33
+ private _time;
34
+ private _image?;
35
+ private _frame?;
36
+ private _lastStep;
37
+ private _resizeObserver?;
38
+ private _motionQuery?;
39
+ static styles: import("lit").CSSResult[];
40
+ connectedCallback(): void;
41
+ disconnectedCallback(): void;
42
+ protected firstUpdated(): void;
43
+ protected updated(changed: PropertyValues<this>): void;
44
+ render(): import("lit-html").TemplateResult<1>;
45
+ private get _canvas();
46
+ private get _cellSize();
47
+ private get _sourceHeat();
48
+ /** Rebuilds the fire grid to cover the host's current box, then restarts it. */
49
+ private readonly _resize;
50
+ /** Animates the fire, or draws one settled frame under reduced motion. */
51
+ private readonly _restart;
52
+ private _stop;
53
+ private readonly _tick;
54
+ /**
55
+ * Advances the fire one step: the bottom row is fed with heat and every cell
56
+ * rises one row, drifting sideways and cooling at random.
57
+ *
58
+ * @returns Whether any cell is still burning.
59
+ */
60
+ private _step;
61
+ /** Paints the heat grid to the canvas through the palette. */
62
+ private _draw;
63
+ }
64
+ declare global {
65
+ interface HTMLElementTagNameMap {
66
+ "pixel-fire": PixelFire;
67
+ }
68
+ }
69
+ //# sourceMappingURL=pixel-fire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixel-fire.d.ts","sourceRoot":"","sources":["../src/pixel-fire.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AA4EjE;;;;;;;;;;;;;GAaG;AACH,qBACa,SAAU,SAAQ,UAAU;IACvC,yEAAyE;IAEzE,SAAS,EAAE,MAAM,CAAK;IAEtB;;;OAGG;IAEH,SAAS,EAAE,MAAM,CAAK;IAEtB;;;OAGG;IAEH,SAAS,EAAE,OAAO,CAAS;IAE3B,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,MAAM,CAAC,CAAY;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,YAAY,CAAC,CAAiB;IAEtC,OAAgB,MAAM,4BA6BpB;IAEO,iBAAiB,IAAI,IAAI,CAMjC;IAEQ,oBAAoB,IAAI,IAAI,CAOpC;IAED,UAAmB,YAAY,IAAI,IAAI,CAEtC;IAED,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAQ9D;IAEQ,MAAM,yCAEd;IAED,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,KAAK,SAAS,GAEpB;IAED,OAAO,KAAK,WAAW,GAGtB;IAED,gFAAgF;IAChF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAgBtB;IAEF,0EAA0E;IAC1E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CASvB;IAEF,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,QAAQ,CAAC,KAAK,CASpB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,KAAK;IAsBb,8DAA8D;IAC9D,OAAO,CAAC,KAAK;CAiBd;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
@@ -0,0 +1,296 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, css, html } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { tokens } from "./tokens.js";
10
+ /**
11
+ * The classic 8-bit fire ramp, from cold (index 0, drawn transparent) to the
12
+ * white-hot base. Literal colors by design: the retro palette is the effect
13
+ * and stays independent of the theme.
14
+ */
15
+ const PALETTE = [
16
+ [0x07, 0x07, 0x07], [0x1f, 0x07, 0x07], [0x2f, 0x0f, 0x07], [0x47, 0x0f, 0x07],
17
+ [0x57, 0x17, 0x07], [0x67, 0x1f, 0x07], [0x77, 0x1f, 0x07], [0x8f, 0x27, 0x07],
18
+ [0x9f, 0x2f, 0x07], [0xaf, 0x3f, 0x07], [0xbf, 0x47, 0x07], [0xc7, 0x47, 0x07],
19
+ [0xdf, 0x4f, 0x07], [0xdf, 0x57, 0x07], [0xdf, 0x57, 0x07], [0xd7, 0x5f, 0x07],
20
+ [0xd7, 0x5f, 0x07], [0xd7, 0x67, 0x0f], [0xcf, 0x6f, 0x0f], [0xcf, 0x77, 0x0f],
21
+ [0xcf, 0x7f, 0x0f], [0xcf, 0x87, 0x17], [0xc7, 0x87, 0x17], [0xc7, 0x8f, 0x17],
22
+ [0xc7, 0x97, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0xa7, 0x27],
23
+ [0xbf, 0xa7, 0x27], [0xbf, 0xaf, 0x2f], [0xb7, 0xaf, 0x2f], [0xb7, 0xb7, 0x2f],
24
+ [0xb7, 0xb7, 0x37], [0xcf, 0xcf, 0x6f], [0xdf, 0xdf, 0x9f], [0xef, 0xef, 0xc7],
25
+ [0xff, 0xff, 0xff],
26
+ ];
27
+ const MAX_HEAT = PALETTE.length - 1;
28
+ /** Fraction of the strip's height the tallest flames reach at full intensity. */
29
+ const FLAME_REACH = 0.8;
30
+ /** Simulation steps per second; the low rate is part of the retro look. */
31
+ const STEPS_PER_SECOND = 30;
32
+ const STEP_MS = 1000 / STEPS_PER_SECOND;
33
+ /** Share of cooling that follows the rising cooling map rather than per-cell noise. */
34
+ const MAP_WEIGHT = 0.7;
35
+ /** Coldest palette steps, which fade in from transparent so flame tips read as smoke. */
36
+ const SMOKE_STEPS = 6;
37
+ /**
38
+ * Builds a smooth, high-contrast noise field with a mean of `0.5`. It wraps
39
+ * vertically so it can scroll upward with the flames, carving them into
40
+ * rising tongues.
41
+ */
42
+ function coolingMap(cols, rows) {
43
+ let map = new Float32Array(cols * rows);
44
+ for (let i = 0; i < map.length; i++)
45
+ map[i] = Math.random();
46
+ for (let pass = 0; pass < 4; pass++)
47
+ map = blur(map, cols, rows);
48
+ let min = Infinity;
49
+ let max = -Infinity;
50
+ for (const value of map) {
51
+ min = Math.min(min, value);
52
+ max = Math.max(max, value);
53
+ }
54
+ const range = max - min || 1;
55
+ let sum = 0;
56
+ for (let i = 0; i < map.length; i++) {
57
+ map[i] = ((map[i] - min) / range) ** 2;
58
+ sum += map[i];
59
+ }
60
+ const scale = (0.5 * map.length) / (sum || 1);
61
+ for (let i = 0; i < map.length; i++)
62
+ map[i] *= scale;
63
+ return map;
64
+ }
65
+ /** 3×3 box blur that clamps horizontally and wraps vertically. */
66
+ function blur(source, cols, rows) {
67
+ const out = new Float32Array(source.length);
68
+ for (let y = 0; y < rows; y++) {
69
+ for (let x = 0; x < cols; x++) {
70
+ let sum = 0;
71
+ for (let dy = -1; dy <= 1; dy++) {
72
+ const row = ((y + dy + rows) % rows) * cols;
73
+ for (let dx = -1; dx <= 1; dx++) {
74
+ sum += source[row + Math.min(cols - 1, Math.max(0, x + dx))];
75
+ }
76
+ }
77
+ out[y * cols + x] = sum / 9;
78
+ }
79
+ }
80
+ return out;
81
+ }
82
+ /**
83
+ * Pixelated, 8-bit style fire in the manner of old computer games. By default
84
+ * it is pinned full width to the bottom of the viewport as a decorative,
85
+ * click-through overlay; `contained` pins it to the bottom of the nearest
86
+ * positioned ancestor instead.
87
+ *
88
+ * The strip's height is set with `--pixel-fire-height` (default `8rem`). It
89
+ * paints at `z-index: 30`, above ordinary page content but below `app-shell`'s
90
+ * chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`
91
+ * it draws one still frame instead of animating. The canvas is hidden from
92
+ * assistive technology.
93
+ *
94
+ * @element pixel-fire
95
+ */
96
+ let PixelFire = class PixelFire extends LitElement {
97
+ constructor() {
98
+ super(...arguments);
99
+ /** Size of one fire pixel in CSS pixels; larger values look chunkier. */
100
+ this.pixelSize = 4;
101
+ /**
102
+ * Heat of the fire's source, from `0` to `1`. Lowering it shortens the
103
+ * flames; `0` lets the fire burn out.
104
+ */
105
+ this.intensity = 1;
106
+ /**
107
+ * Pins the fire to the bottom of the nearest positioned ancestor instead of
108
+ * the viewport.
109
+ */
110
+ this.contained = false;
111
+ this._cols = 0;
112
+ this._rows = 0;
113
+ this._heat = new Float32Array(0);
114
+ this._cooling = new Float32Array(0);
115
+ this._time = 0;
116
+ this._lastStep = 0;
117
+ /** Rebuilds the fire grid to cover the host's current box, then restarts it. */
118
+ this._resize = () => {
119
+ const canvas = this._canvas;
120
+ if (!canvas)
121
+ return;
122
+ const size = this._cellSize;
123
+ const cols = Math.ceil(this.clientWidth / size);
124
+ const rows = Math.ceil(this.clientHeight / size);
125
+ this._cols = cols;
126
+ this._rows = rows;
127
+ this._heat = new Float32Array(cols * rows);
128
+ this._cooling = coolingMap(cols, rows);
129
+ canvas.width = cols;
130
+ canvas.height = rows;
131
+ canvas.style.width = `${cols * size}px`;
132
+ canvas.style.height = `${rows * size}px`;
133
+ this._image = cols > 0 && rows > 0 ? new ImageData(cols, rows) : undefined;
134
+ this._restart();
135
+ };
136
+ /** Animates the fire, or draws one settled frame under reduced motion. */
137
+ this._restart = () => {
138
+ this._stop();
139
+ if (!this._image)
140
+ return;
141
+ if (this._motionQuery?.matches) {
142
+ for (let i = 0; i < this._rows * 2; i++)
143
+ this._step();
144
+ this._draw();
145
+ return;
146
+ }
147
+ this._frame = window.requestAnimationFrame(this._tick);
148
+ };
149
+ this._tick = (time) => {
150
+ this._frame = undefined;
151
+ if (time - this._lastStep >= STEP_MS) {
152
+ this._lastStep = time;
153
+ const burning = this._step();
154
+ this._draw();
155
+ if (!burning)
156
+ return;
157
+ }
158
+ this._frame = window.requestAnimationFrame(this._tick);
159
+ };
160
+ }
161
+ static { this.styles = [
162
+ tokens,
163
+ css `
164
+ :host {
165
+ display: block;
166
+ position: fixed;
167
+ inset: auto 0 0 0;
168
+ z-index: 30;
169
+ height: var(--pixel-fire-height, 8rem);
170
+ overflow: hidden;
171
+ pointer-events: none;
172
+ }
173
+
174
+ :host([contained]) {
175
+ position: absolute;
176
+ }
177
+
178
+ :host([hidden]) {
179
+ display: none;
180
+ }
181
+
182
+ canvas {
183
+ position: absolute;
184
+ left: 0;
185
+ bottom: 0;
186
+ display: block;
187
+ image-rendering: pixelated;
188
+ }
189
+ `,
190
+ ]; }
191
+ connectedCallback() {
192
+ super.connectedCallback();
193
+ this._motionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
194
+ this._motionQuery.addEventListener("change", this._restart);
195
+ this._resizeObserver = new ResizeObserver(this._resize);
196
+ this._resizeObserver.observe(this);
197
+ }
198
+ disconnectedCallback() {
199
+ super.disconnectedCallback();
200
+ this._motionQuery?.removeEventListener("change", this._restart);
201
+ this._motionQuery = undefined;
202
+ this._resizeObserver?.disconnect();
203
+ this._resizeObserver = undefined;
204
+ this._stop();
205
+ }
206
+ firstUpdated() {
207
+ this._resize();
208
+ }
209
+ updated(changed) {
210
+ if (changed.has("pixelSize") && changed.get("pixelSize") !== undefined) {
211
+ this._resize();
212
+ return;
213
+ }
214
+ if (changed.has("intensity") && changed.get("intensity") !== undefined) {
215
+ this._restart();
216
+ }
217
+ }
218
+ render() {
219
+ return html `<canvas aria-hidden="true"></canvas>`;
220
+ }
221
+ get _canvas() {
222
+ return this.renderRoot.querySelector("canvas");
223
+ }
224
+ get _cellSize() {
225
+ return Math.max(1, Math.round(this.pixelSize) || 1);
226
+ }
227
+ get _sourceHeat() {
228
+ const intensity = Number.isFinite(this.intensity) ? this.intensity : 1;
229
+ return Math.min(1, Math.max(0, intensity)) * MAX_HEAT;
230
+ }
231
+ _stop() {
232
+ if (this._frame === undefined)
233
+ return;
234
+ window.cancelAnimationFrame(this._frame);
235
+ this._frame = undefined;
236
+ }
237
+ /**
238
+ * Advances the fire one step: the bottom row is fed with heat and every cell
239
+ * rises one row, drifting sideways and cooling at random.
240
+ *
241
+ * @returns Whether any cell is still burning.
242
+ */
243
+ _step() {
244
+ const cols = this._cols;
245
+ const rows = this._rows;
246
+ const heat = this._heat;
247
+ const cooling = this._cooling;
248
+ const meanCooling = MAX_HEAT / Math.max(1, (rows - 1) * FLAME_REACH);
249
+ this._time = (this._time + 1) % rows;
250
+ heat.fill(this._sourceHeat, (rows - 1) * cols);
251
+ for (let y = 0; y < rows - 1; y++) {
252
+ const mapRow = ((y + this._time) % rows) * cols;
253
+ for (let x = 0; x < cols; x++) {
254
+ const below = heat[(y + 1) * cols + x];
255
+ const drift = Math.min(cols - 1, Math.max(0, x + Math.round(Math.random() * 2 - 1)));
256
+ const local = MAP_WEIGHT * cooling[mapRow + x] + (1 - MAP_WEIGHT) * Math.random();
257
+ heat[y * cols + drift] = Math.max(0, below - 2 * meanCooling * local);
258
+ }
259
+ }
260
+ // Cells no drift landed on keep their old heat, so scan the whole grid.
261
+ return heat.some((value) => value > 0);
262
+ }
263
+ /** Paints the heat grid to the canvas through the palette. */
264
+ _draw() {
265
+ const image = this._image;
266
+ const context = this._canvas?.getContext("2d");
267
+ if (!image || !context)
268
+ return;
269
+ const data = image.data;
270
+ const heat = this._heat;
271
+ for (let i = 0; i < heat.length; i++) {
272
+ const index = Math.min(MAX_HEAT, Math.floor(heat[i]));
273
+ const [r, g, b] = PALETTE[index];
274
+ const offset = i * 4;
275
+ data[offset] = r;
276
+ data[offset + 1] = g;
277
+ data[offset + 2] = b;
278
+ data[offset + 3] = Math.min(255, Math.round((255 * index) / SMOKE_STEPS));
279
+ }
280
+ context.putImageData(image, 0, 0);
281
+ }
282
+ };
283
+ __decorate([
284
+ property({ type: Number, attribute: "pixel-size" })
285
+ ], PixelFire.prototype, "pixelSize", void 0);
286
+ __decorate([
287
+ property({ type: Number })
288
+ ], PixelFire.prototype, "intensity", void 0);
289
+ __decorate([
290
+ property({ type: Boolean, reflect: true })
291
+ ], PixelFire.prototype, "contained", void 0);
292
+ PixelFire = __decorate([
293
+ customElement("pixel-fire")
294
+ ], PixelFire);
295
+ export { PixelFire };
296
+ //# sourceMappingURL=pixel-fire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixel-fire.js","sourceRoot":"","sources":["../src/pixel-fire.ts"],"names":[],"m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it\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * The classic 8-bit fire ramp, from cold (index 0, drawn transparent) to the\n * white-hot base. Literal colors by design: the retro palette is the effect\n * and stays independent of the theme.\n */\nconst PALETTE: ReadonlyArray<readonly [number, number, number]> = [\n [0x07, 0x07, 0x07], [0x1f, 0x07, 0x07], [0x2f, 0x0f, 0x07], [0x47, 0x0f, 0x07],\n [0x57, 0x17, 0x07], [0x67, 0x1f, 0x07], [0x77, 0x1f, 0x07], [0x8f, 0x27, 0x07],\n [0x9f, 0x2f, 0x07], [0xaf, 0x3f, 0x07], [0xbf, 0x47, 0x07], [0xc7, 0x47, 0x07],\n [0xdf, 0x4f, 0x07], [0xdf, 0x57, 0x07], [0xdf, 0x57, 0x07], [0xd7, 0x5f, 0x07],\n [0xd7, 0x5f, 0x07], [0xd7, 0x67, 0x0f], [0xcf, 0x6f, 0x0f], [0xcf, 0x77, 0x0f],\n [0xcf, 0x7f, 0x0f], [0xcf, 0x87, 0x17], [0xc7, 0x87, 0x17], [0xc7, 0x8f, 0x17],\n [0xc7, 0x97, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0xa7, 0x27],\n [0xbf, 0xa7, 0x27], [0xbf, 0xaf, 0x2f], [0xb7, 0xaf, 0x2f], [0xb7, 0xb7, 0x2f],\n [0xb7, 0xb7, 0x37], [0xcf, 0xcf, 0x6f], [0xdf, 0xdf, 0x9f], [0xef, 0xef, 0xc7],\n [0xff, 0xff, 0xff],\n];\nconst MAX_HEAT = PALETTE.length - 1;\n/** Fraction of the strip's height the tallest flames reach at full intensity. */\nconst FLAME_REACH = 0.8;\n/** Simulation steps per second; the low rate is part of the retro look. */\nconst STEPS_PER_SECOND = 30;\nconst STEP_MS = 1000 / STEPS_PER_SECOND;\n/** Share of cooling that follows the rising cooling map rather than per-cell noise. */\nconst MAP_WEIGHT = 0.7;\n/** Coldest palette steps, which fade in from transparent so flame tips read as smoke. */\nconst SMOKE_STEPS = 6;\n\n/**\n * Builds a smooth, high-contrast noise field with a mean of `0.5`. It wraps\n * vertically so it can scroll upward with the flames, carving them into\n * rising tongues.\n */\nfunction coolingMap(cols: number, rows: number): Float32Array {\n let map: Float32Array = new Float32Array(cols * rows);\n for (let i = 0; i < map.length; i++) map[i] = Math.random();\n for (let pass = 0; pass < 4; pass++) map = blur(map, cols, rows);\n let min = Infinity;\n let max = -Infinity;\n for (const value of map) {\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n const range = max - min || 1;\n let sum = 0;\n for (let i = 0; i < map.length; i++) {\n map[i] = ((map[i] - min) / range) ** 2;\n sum += map[i];\n }\n const scale = (0.5 * map.length) / (sum || 1);\n for (let i = 0; i < map.length; i++) map[i] *= scale;\n return map;\n}\n\n/** 3×3 box blur that clamps horizontally and wraps vertically. */\nfunction blur(source: Float32Array, cols: number, rows: number): Float32Array {\n const out = new Float32Array(source.length);\n for (let y = 0; y < rows; y++) {\n for (let x = 0; x < cols; x++) {\n let sum = 0;\n for (let dy = -1; dy <= 1; dy++) {\n const row = ((y + dy + rows) % rows) * cols;\n for (let dx = -1; dx <= 1; dx++) {\n sum += source[row + Math.min(cols - 1, Math.max(0, x + dx))];\n }\n }\n out[y * cols + x] = sum / 9;\n }\n }\n return out;\n}\n\n/**\n * Pixelated, 8-bit style fire in the manner of old computer games. By default\n * it is pinned full width to the bottom of the viewport as a decorative,\n * click-through overlay; `contained` pins it to the bottom of the nearest\n * positioned ancestor instead.\n *\n * The strip's height is set with `--pixel-fire-height` (default `8rem`). It\n * paints at `z-index: 30`, above ordinary page content but below `app-shell`'s\n * chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`\n * it draws one still frame instead of animating. The canvas is hidden from\n * assistive technology.\n *\n * @element pixel-fire\n */\n@customElement(\"pixel-fire\")\nexport class PixelFire extends LitElement {\n /** Size of one fire pixel in CSS pixels; larger values look chunkier. */\n @property({ type: Number, attribute: \"pixel-size\" })\n pixelSize: number = 4;\n\n /**\n * Heat of the fire's source, from `0` to `1`. Lowering it shortens the\n * flames; `0` lets the fire burn out.\n */\n @property({ type: Number })\n intensity: number = 1;\n\n /**\n * Pins the fire to the bottom of the nearest positioned ancestor instead of\n * the viewport.\n */\n @property({ type: Boolean, reflect: true })\n contained: boolean = false;\n\n private _cols = 0;\n private _rows = 0;\n private _heat = new Float32Array(0);\n private _cooling: Float32Array = new Float32Array(0);\n private _time = 0;\n private _image?: ImageData;\n private _frame?: number;\n private _lastStep = 0;\n private _resizeObserver?: ResizeObserver;\n private _motionQuery?: MediaQueryList;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: fixed;\n inset: auto 0 0 0;\n z-index: 30;\n height: var(--pixel-fire-height, 8rem);\n overflow: hidden;\n pointer-events: none;\n }\n\n :host([contained]) {\n position: absolute;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n canvas {\n position: absolute;\n left: 0;\n bottom: 0;\n display: block;\n image-rendering: pixelated;\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._motionQuery = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n this._motionQuery.addEventListener(\"change\", this._restart);\n this._resizeObserver = new ResizeObserver(this._resize);\n this._resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._motionQuery?.removeEventListener(\"change\", this._restart);\n this._motionQuery = undefined;\n this._resizeObserver?.disconnect();\n this._resizeObserver = undefined;\n this._stop();\n }\n\n protected override firstUpdated(): void {\n this._resize();\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (changed.has(\"pixelSize\") && changed.get(\"pixelSize\") !== undefined) {\n this._resize();\n return;\n }\n if (changed.has(\"intensity\") && changed.get(\"intensity\") !== undefined) {\n this._restart();\n }\n }\n\n override render() {\n return html`<canvas aria-hidden=\"true\"></canvas>`;\n }\n\n private get _canvas(): HTMLCanvasElement | null {\n return this.renderRoot.querySelector(\"canvas\");\n }\n\n private get _cellSize(): number {\n return Math.max(1, Math.round(this.pixelSize) || 1);\n }\n\n private get _sourceHeat(): number {\n const intensity = Number.isFinite(this.intensity) ? this.intensity : 1;\n return Math.min(1, Math.max(0, intensity)) * MAX_HEAT;\n }\n\n /** Rebuilds the fire grid to cover the host's current box, then restarts it. */\n private readonly _resize = (): void => {\n const canvas = this._canvas;\n if (!canvas) return;\n const size = this._cellSize;\n const cols = Math.ceil(this.clientWidth / size);\n const rows = Math.ceil(this.clientHeight / size);\n this._cols = cols;\n this._rows = rows;\n this._heat = new Float32Array(cols * rows);\n this._cooling = coolingMap(cols, rows);\n canvas.width = cols;\n canvas.height = rows;\n canvas.style.width = `${cols * size}px`;\n canvas.style.height = `${rows * size}px`;\n this._image = cols > 0 && rows > 0 ? new ImageData(cols, rows) : undefined;\n this._restart();\n };\n\n /** Animates the fire, or draws one settled frame under reduced motion. */\n private readonly _restart = (): void => {\n this._stop();\n if (!this._image) return;\n if (this._motionQuery?.matches) {\n for (let i = 0; i < this._rows * 2; i++) this._step();\n this._draw();\n return;\n }\n this._frame = window.requestAnimationFrame(this._tick);\n };\n\n private _stop(): void {\n if (this._frame === undefined) return;\n window.cancelAnimationFrame(this._frame);\n this._frame = undefined;\n }\n\n private readonly _tick = (time: number): void => {\n this._frame = undefined;\n if (time - this._lastStep >= STEP_MS) {\n this._lastStep = time;\n const burning = this._step();\n this._draw();\n if (!burning) return;\n }\n this._frame = window.requestAnimationFrame(this._tick);\n };\n\n /**\n * Advances the fire one step: the bottom row is fed with heat and every cell\n * rises one row, drifting sideways and cooling at random.\n *\n * @returns Whether any cell is still burning.\n */\n private _step(): boolean {\n const cols = this._cols;\n const rows = this._rows;\n const heat = this._heat;\n const cooling = this._cooling;\n const meanCooling = MAX_HEAT / Math.max(1, (rows - 1) * FLAME_REACH);\n this._time = (this._time + 1) % rows;\n\n heat.fill(this._sourceHeat, (rows - 1) * cols);\n for (let y = 0; y < rows - 1; y++) {\n const mapRow = ((y + this._time) % rows) * cols;\n for (let x = 0; x < cols; x++) {\n const below = heat[(y + 1) * cols + x];\n const drift = Math.min(cols - 1, Math.max(0, x + Math.round(Math.random() * 2 - 1)));\n const local = MAP_WEIGHT * cooling[mapRow + x] + (1 - MAP_WEIGHT) * Math.random();\n heat[y * cols + drift] = Math.max(0, below - 2 * meanCooling * local);\n }\n }\n // Cells no drift landed on keep their old heat, so scan the whole grid.\n return heat.some((value) => value > 0);\n }\n\n /** Paints the heat grid to the canvas through the palette. */\n private _draw(): void {\n const image = this._image;\n const context = this._canvas?.getContext(\"2d\");\n if (!image || !context) return;\n const data = image.data;\n const heat = this._heat;\n for (let i = 0; i < heat.length; i++) {\n const index = Math.min(MAX_HEAT, Math.floor(heat[i]));\n const [r, g, b] = PALETTE[index];\n const offset = i * 4;\n data[offset] = r;\n data[offset + 1] = g;\n data[offset + 2] = b;\n data[offset + 3] = Math.min(255, Math.round((255 * index) / SMOKE_STEPS));\n }\n context.putImageData(image, 0, 0);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pixel-fire\": PixelFire;\n }\n}\n"]}
@@ -8,6 +8,12 @@ export declare const DAG_LABEL_OFFSET_PLAIN = 8;
8
8
  export declare const DAG_MIN_NODE_WIDTH = 48;
9
9
  /** Widest node card, in pixels; longer labels are shortened with an ellipsis. */
10
10
  export declare const DAG_MAX_NODE_WIDTH = 200;
11
+ /** Height of an edge label's box, in pixels. */
12
+ export declare const DAG_EDGE_LABEL_HEIGHT = 16;
13
+ /** Space on each side of an edge label's text, inside its box. */
14
+ export declare const DAG_EDGE_LABEL_PADDING = 4;
15
+ /** Widest edge label box, in pixels; longer labels are shortened with an ellipsis. */
16
+ export declare const DAG_MAX_EDGE_LABEL_WIDTH = 140;
11
17
  /** Flow direction of the layers: left to right or top to bottom. */
12
18
  export type DagDirection = "LR" | "TB";
13
19
  /** Returns the rendered width of a label in pixels. */
@@ -32,12 +38,25 @@ export interface DagLayoutNode extends DagPoint {
32
38
  width: number;
33
39
  label: string;
34
40
  }
41
+ /** One edge to lay out; a `label` gets room of its own between the two nodes. */
42
+ export interface DagLayoutEdgeInput {
43
+ source: string;
44
+ target: string;
45
+ label?: string;
46
+ }
47
+ /** A positioned edge label: its box is centered at `(x, y)` and sized to its (possibly shortened) text. */
48
+ export interface DagLayoutEdgeLabel extends DagPoint {
49
+ text: string;
50
+ width: number;
51
+ }
35
52
  /** A routed edge; `backward` edges run against the flow direction and close a cycle. */
36
53
  export interface DagLayoutEdge {
37
54
  source: string;
38
55
  target: string;
39
56
  points: DagPoint[];
40
57
  backward: boolean;
58
+ /** Present when the input edge has a non-empty label. */
59
+ label?: DagLayoutEdgeLabel;
41
60
  }
42
61
  /** Positioned nodes and routed edges, in input-independent order. */
43
62
  export interface DagLayout {
@@ -50,11 +69,9 @@ export declare function fitLabel(text: string, maxWidth: number, measure: Measur
50
69
  * Lays out a directed graph in layers (Sugiyama-style, via dagre) so every edge points along `direction`.
51
70
  *
52
71
  * Cycles are broken only to assign layers: every edge is returned, and the ones that close a cycle are marked
53
- * `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored. The result
54
- * does not depend on input order.
72
+ * `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored (the last
73
+ * duplicate wins). Labeled edges reserve room for their label midway along the edge. The result does not depend
74
+ * on input order.
55
75
  */
56
- export declare function layoutDag(nodes: DagLayoutInput[], edges: Array<{
57
- source: string;
58
- target: string;
59
- }>, direction?: DagDirection, measure?: MeasureText): DagLayout;
76
+ export declare function layoutDag(nodes: DagLayoutInput[], edges: DagLayoutEdgeInput[], direction?: DagDirection, measure?: MeasureText): DagLayout;
60
77
  //# sourceMappingURL=dag-layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dag-layout.d.ts","sourceRoot":"","sources":["../../src/utils/dag-layout.ts"],"names":[],"mappings":"AAEA,4CAA4C;AAC5C,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,KA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,QAAQ;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2GAA2G;AAC3G,MAAM,WAAW,kBAAmB,SAAQ,QAAQ;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,qEAAqE;AACrE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAKrF;AAcD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,kBAAkB,EAAE,EAC3B,SAAS,GAAE,YAAmB,EAC9B,OAAO,GAAE,WAAkC,GAC1C,SAAS,CA6DX"}
@@ -10,6 +10,12 @@ const LABEL_PADDING_END = 10;
10
10
  export const DAG_MIN_NODE_WIDTH = 48;
11
11
  /** Widest node card, in pixels; longer labels are shortened with an ellipsis. */
12
12
  export const DAG_MAX_NODE_WIDTH = 200;
13
+ /** Height of an edge label's box, in pixels. */
14
+ export const DAG_EDGE_LABEL_HEIGHT = 16;
15
+ /** Space on each side of an edge label's text, inside its box. */
16
+ export const DAG_EDGE_LABEL_PADDING = 4;
17
+ /** Widest edge label box, in pixels; longer labels are shortened with an ellipsis. */
18
+ export const DAG_MAX_EDGE_LABEL_WIDTH = 140;
13
19
  const RANK_GAP = 90;
14
20
  const NODE_GAP = 6;
15
21
  const ELLIPSIS = "…";
@@ -30,12 +36,17 @@ function nodeSize(node, measure) {
30
36
  const width = Math.ceil(offset + measure(label) + LABEL_PADDING_END);
31
37
  return { label, width: Math.min(DAG_MAX_NODE_WIDTH, Math.max(DAG_MIN_NODE_WIDTH, width)) };
32
38
  }
39
+ function edgeLabelSize(text, measure) {
40
+ const fitted = fitLabel(text, DAG_MAX_EDGE_LABEL_WIDTH - 2 * DAG_EDGE_LABEL_PADDING, measure);
41
+ return { text: fitted, width: Math.ceil(measure(fitted) + 2 * DAG_EDGE_LABEL_PADDING) };
42
+ }
33
43
  /**
34
44
  * Lays out a directed graph in layers (Sugiyama-style, via dagre) so every edge points along `direction`.
35
45
  *
36
46
  * Cycles are broken only to assign layers: every edge is returned, and the ones that close a cycle are marked
37
- * `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored. The result
38
- * does not depend on input order.
47
+ * `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored (the last
48
+ * duplicate wins). Labeled edges reserve room for their label midway along the edge. The result does not depend
49
+ * on input order.
39
50
  */
40
51
  export function layoutDag(nodes, edges, direction = "LR", measure = approximateTextWidth) {
41
52
  if (nodes.length === 0)
@@ -58,10 +69,15 @@ export function layoutDag(nodes, edges, direction = "LR", measure = approximateT
58
69
  const known = new Set(sizes.keys());
59
70
  const unique = new Map(edges
60
71
  .filter((edge) => known.has(edge.source) && known.has(edge.target) && edge.source !== edge.target)
61
- .map((edge) => [`${edge.source}\u0000${edge.target}`, { source: edge.source, target: edge.target }]));
72
+ .map((edge) => [`${edge.source}\u0000${edge.target}`, edge]));
62
73
  const kept = [...unique.values()].sort((a, b) => a.source.localeCompare(b.source) || a.target.localeCompare(b.target));
63
- for (const edge of kept)
64
- graph.setEdge(edge.source, edge.target);
74
+ const labels = new Map(kept
75
+ .filter((edge) => edge.label)
76
+ .map((edge) => [edge, edgeLabelSize(edge.label, measure)]));
77
+ for (const edge of kept) {
78
+ const label = labels.get(edge);
79
+ graph.setEdge(edge.source, edge.target, label ? { width: label.width, height: DAG_EDGE_LABEL_HEIGHT, labelpos: "c" } : {});
80
+ }
65
81
  layout(graph);
66
82
  const positioned = new Map(sorted.map((node) => {
67
83
  const { x, y } = graph.node(node.id);
@@ -70,11 +86,17 @@ export function layoutDag(nodes, edges, direction = "LR", measure = approximateT
70
86
  const axis = direction === "LR" ? "x" : "y";
71
87
  return {
72
88
  nodes: [...positioned.values()],
73
- edges: kept.map((edge) => ({
74
- ...edge,
75
- points: graph.edge(edge.source, edge.target).points.map(({ x, y }) => ({ x, y })),
76
- backward: positioned.get(edge.target)[axis] < positioned.get(edge.source)[axis],
77
- })),
89
+ edges: kept.map((edge) => {
90
+ const routed = graph.edge(edge.source, edge.target);
91
+ const label = labels.get(edge);
92
+ return {
93
+ source: edge.source,
94
+ target: edge.target,
95
+ points: routed.points.map(({ x, y }) => ({ x, y })),
96
+ backward: positioned.get(edge.target)[axis] < positioned.get(edge.source)[axis],
97
+ ...(label ? { label: { ...label, x: routed.x, y: routed.y } } : {}),
98
+ };
99
+ }),
78
100
  };
79
101
  }
80
102
  //# sourceMappingURL=dag-layout.js.map