@k2b/ui 0.54.0 → 0.55.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.
Files changed (68) hide show
  1. package/dist/browser/content/MapDialog.js +686 -0
  2. package/dist/browser/content/MapDialog.js.map +1 -0
  3. package/dist/browser/content/MapTile.js +139 -0
  4. package/dist/browser/content/MapTile.js.map +1 -0
  5. package/dist/browser/content/MapView.js +19 -8
  6. package/dist/browser/content/MapView.js.map +1 -1
  7. package/dist/browser/content/PdfPages.js +1 -1
  8. package/dist/browser/content/PdfPages.js.map +1 -1
  9. package/dist/browser/content/index.js +3 -0
  10. package/dist/browser/content/index.js.map +1 -1
  11. package/dist/browser/content/map-dialog-messages.js +47 -0
  12. package/dist/browser/content/map-dialog-messages.js.map +1 -0
  13. package/dist/browser/content/map-navigation.js +15 -0
  14. package/dist/browser/content/map-navigation.js.map +1 -0
  15. package/dist/browser/content/map-view-messages.js +4 -0
  16. package/dist/browser/content/map-view-messages.js.map +1 -1
  17. package/dist/browser/content/map-view-types.js.map +1 -1
  18. package/dist/browser/feedback/dialog-core.js +21 -9
  19. package/dist/browser/feedback/dialog-core.js.map +1 -1
  20. package/dist/browser/layout/Breadcrumbs.js +97 -0
  21. package/dist/browser/layout/Breadcrumbs.js.map +1 -0
  22. package/dist/browser/layout/index.js +1 -0
  23. package/dist/browser/layout/index.js.map +1 -1
  24. package/dist/browser/surfaces/Skeleton.js +32 -0
  25. package/dist/browser/surfaces/Skeleton.js.map +1 -1
  26. package/dist/browser/surfaces/index.js +1 -1
  27. package/dist/browser/surfaces/index.js.map +1 -1
  28. package/dist/ssr/content/MapDialog.js +469 -0
  29. package/dist/ssr/content/MapDialog.js.map +1 -0
  30. package/dist/ssr/content/MapTile.js +92 -0
  31. package/dist/ssr/content/MapTile.js.map +1 -0
  32. package/dist/ssr/content/MapView.js +12 -8
  33. package/dist/ssr/content/MapView.js.map +1 -1
  34. package/dist/ssr/content/PdfPages.js +1 -1
  35. package/dist/ssr/content/PdfPages.js.map +1 -1
  36. package/dist/ssr/content/index.js +3 -0
  37. package/dist/ssr/content/index.js.map +1 -1
  38. package/dist/ssr/content/map-dialog-messages.js +47 -0
  39. package/dist/ssr/content/map-dialog-messages.js.map +1 -0
  40. package/dist/ssr/content/map-navigation.js +15 -0
  41. package/dist/ssr/content/map-navigation.js.map +1 -0
  42. package/dist/ssr/content/map-view-messages.js +4 -0
  43. package/dist/ssr/content/map-view-messages.js.map +1 -1
  44. package/dist/ssr/content/map-view-types.js.map +1 -1
  45. package/dist/ssr/feedback/dialog-core.js +21 -9
  46. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  47. package/dist/ssr/layout/Breadcrumbs.js +62 -0
  48. package/dist/ssr/layout/Breadcrumbs.js.map +1 -0
  49. package/dist/ssr/layout/index.js +1 -0
  50. package/dist/ssr/layout/index.js.map +1 -1
  51. package/dist/ssr/surfaces/Skeleton.js +32 -0
  52. package/dist/ssr/surfaces/Skeleton.js.map +1 -1
  53. package/dist/ssr/surfaces/index.js +1 -1
  54. package/dist/ssr/surfaces/index.js.map +1 -1
  55. package/dist/styles.css +1 -1
  56. package/dist/types/content/MapDialog.d.ts +105 -0
  57. package/dist/types/content/MapTile.d.ts +37 -0
  58. package/dist/types/content/index.d.ts +3 -0
  59. package/dist/types/content/map-dialog-messages.d.ts +19 -0
  60. package/dist/types/content/map-navigation.d.ts +13 -0
  61. package/dist/types/content/map-view-messages.d.ts +2 -0
  62. package/dist/types/content/map-view-types.d.ts +5 -0
  63. package/dist/types/feedback/dialog-core.d.ts +6 -0
  64. package/dist/types/layout/Breadcrumbs.d.ts +19 -0
  65. package/dist/types/layout/index.d.ts +1 -0
  66. package/dist/types/surfaces/Skeleton.d.ts +13 -1
  67. package/dist/types/surfaces/index.d.ts +1 -1
  68. package/package.json +1 -1
@@ -0,0 +1,105 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { MapViewFit, MapViewLine, MapViewMarker, MapViewOwnLocation, MapViewPoint, MapViewTone } from "./map-view-types";
3
+ /** A link the host gives a place, such as "Open contact". Only http(s) and same-origin paths are rendered. */
4
+ export type MapPlaceLink = {
5
+ label: string;
6
+ href: string;
7
+ icon?: string;
8
+ };
9
+ /** Where a place's information comes from. `tone: "ai"` marks a suggestion that an account without a person made. */
10
+ export type MapPlaceSource = {
11
+ label: string;
12
+ icon?: string;
13
+ tone?: "ai";
14
+ };
15
+ export type MapPlace = {
16
+ id: string;
17
+ name: string;
18
+ /** Without a point the place is listed but has no pin; navigation then uses the address text. */
19
+ point?: MapViewPoint;
20
+ /** A number, a single letter, or "+", as on MapView markers. */
21
+ mark?: number | string;
22
+ tone?: MapViewTone;
23
+ /** The heading of the place's group in the list, such as the search that found it; shown where the group starts. */
24
+ group?: string;
25
+ /** Second line in the list. */
26
+ subtitle?: string;
27
+ /** Right column of the list row, for example a leg's minutes and kilometres. */
28
+ trailing?: string;
29
+ trailingDetail?: string;
30
+ address?: string;
31
+ hours?: string;
32
+ note?: string;
33
+ source?: MapPlaceSource;
34
+ links?: MapPlaceLink[];
35
+ /** `false` for a place that is not a destination yet, such as a candidate to choose: no navigation link. */
36
+ navigate?: boolean;
37
+ };
38
+ export type MapDialogFact = {
39
+ value: string;
40
+ label: string;
41
+ };
42
+ export type MapDialogMenuItem = {
43
+ label: string;
44
+ icon?: string;
45
+ disabled?: boolean;
46
+ onSelect: () => void;
47
+ };
48
+ /** What the host's map needs; spread it onto MapView or a wrapper of it. */
49
+ export type MapDialogMapView = {
50
+ height: number;
51
+ padding: number;
52
+ markers: MapViewMarker[];
53
+ lines?: MapViewLine[];
54
+ fit?: MapViewFit;
55
+ selectedId?: string;
56
+ onSelect: (id: string) => void;
57
+ ownLocation?: MapViewOwnLocation;
58
+ onLocate: () => void;
59
+ /** A message about the own location, for MapView's `notice`. */
60
+ notice?: JSX.Element;
61
+ };
62
+ export type MapDialogProps = {
63
+ title: string;
64
+ /** Large figures under the title, such as distance and driving time. */
65
+ facts?: MapDialogFact[];
66
+ /** A chip under the title when there are no facts, such as "12 places". */
67
+ count?: string;
68
+ /** Name of the list for assistive technology, such as "Stops". */
69
+ listLabel?: string;
70
+ places: MapPlace[];
71
+ lines?: MapViewLine[];
72
+ /** Pins beyond the places, such as a proposed stop; drawn but not listed. */
73
+ markers?: MapViewMarker[];
74
+ fit?: MapViewFit;
75
+ /** Controlled selection; otherwise the first place is selected. */
76
+ selectedId?: string;
77
+ onSelect?: (id: string) => void;
78
+ loading?: boolean;
79
+ /** Replaces the list when there are no places, for example with an action that widens the search. */
80
+ empty?: JSX.Element;
81
+ /** Renders the map; the dialog supplies its height, pins, lines, and selection. */
82
+ map: (view: MapDialogMapView) => JSX.Element;
83
+ menu?: MapDialogMenuItem[];
84
+ /** More actions beside the navigation link of the selected place. */
85
+ placeActions?: (place: MapPlace) => JSX.Element;
86
+ /** A short line under the actions, such as why one of them is unavailable right now. */
87
+ placeHint?: (place: MapPlace) => string | undefined;
88
+ /** Host content above the list, such as a confirmation or a recovery. */
89
+ notice?: JSX.Element;
90
+ /** The source line at the bottom. */
91
+ provenance?: JSX.Element;
92
+ /** The person's location after "Show my location", for example to start a route there. */
93
+ onLocation?: (location: MapViewOwnLocation) => void;
94
+ onClose: () => void;
95
+ };
96
+ /** Only web links and same-origin paths; any other scheme is dropped. */
97
+ export declare const safeMapLink: (href: string) => {
98
+ href: string;
99
+ external: boolean;
100
+ } | null;
101
+ /**
102
+ * The full map: map and list side by side in a dialog, on a phone the map on the whole screen with the list as a
103
+ * sheet. Map and list share one selection; the selected place shows its details and a navigation link.
104
+ */
105
+ export declare function MapDialog(props: MapDialogProps): JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { type JSX } from "solid-js";
2
+ /** The query parameter that names the open map dialog, so a reload opens it again. */
3
+ export declare const MAP_DIALOG_PARAM = "map";
4
+ /** Dialog options for MapDialog: a large dialog, the whole screen below 48rem; Back closes it. */
5
+ export declare const mapDialogOptions: {
6
+ panelClassName: string;
7
+ contentClassName: string;
8
+ history: true;
9
+ };
10
+ export type MapTileProps = {
11
+ /** Accessible name of the whole tile, such as "Open map: Delivery Thursday, 86.4 km, 4 stops". */
12
+ label: string;
13
+ /** The short summary in the pill, such as "86.4 km · 1 h 32 min · A → B → C". */
14
+ summary: JSX.Element;
15
+ /** The places are still loading: the pill shows progress and the tile does not open yet. */
16
+ loading?: boolean;
17
+ /** Renders the dialog content, normally a MapDialog; `close` closes the dialog. */
18
+ dialog: (close: () => void) => JSX.Element;
19
+ /**
20
+ * A stable id of this map on the page. While its dialog is open the URL carries `?map=<restoreId>`, and a reload
21
+ * opens the dialog again. Omit it for maps without a stable id; their dialog stays closed after a reload.
22
+ */
23
+ restoreId?: string;
24
+ /**
25
+ * More query parameters the dialog's address carries with `restoreId`, so a reload reaches the tile again, such as
26
+ * the message of a long conversation that holds the map.
27
+ */
28
+ restoreQuery?: Record<string, string>;
29
+ /** The still map, for example `<MapView still … />`, in the size of the tile. */
30
+ children: JSX.Element;
31
+ class?: string;
32
+ };
33
+ /**
34
+ * A small map that is one button: the map image with a summary pill on it. Activating it opens the full map in a
35
+ * dialog. Back, Escape, and the close button close the dialog; focus returns to the tile.
36
+ */
37
+ export declare function MapTile(props: MapTileProps): JSX.Element;
@@ -47,12 +47,15 @@ export { LoadMore } from "./LoadMore";
47
47
  export type { LogTableEntry } from "./LogEntriesTable";
48
48
  export { default as LogEntriesTable } from "./LogEntriesTable";
49
49
  export { MapAttribution } from "./MapAttribution";
50
+ export { MapDialog, type MapDialogFact, type MapDialogMapView, type MapDialogMenuItem, type MapDialogProps, type MapPlace, type MapPlaceLink, type MapPlaceSource, } from "./MapDialog";
51
+ export { MAP_DIALOG_PARAM, MapTile, type MapTileProps, mapDialogOptions } from "./MapTile";
50
52
  export { MapView } from "./MapView";
51
53
  export { MapViewFrame } from "./MapViewFrame";
52
54
  export { default as MarkdownView, type MarkdownRenderOptions, type MarkdownViewProps, renderSafeMarkdown } from "./MarkdownView";
53
55
  export { type MatchRange, MatchText, type MatchTextProps, matchParts } from "./MatchText";
54
56
  export type { MessageEventGroupProps, MessageEventRowProps, MessageGroupEntry, MessageRowAction, MessageRowAttachment, MessageRowAuthor, MessageRowFile, MessageRowMedia, MessageRowOrigin, MessageRowProgress, MessageRowProps, MessageRowQuote, MessageRowReaction, MessageRowStatus, MessageRowThread, MessageSystemRowProps, } from "./MessageRow";
55
57
  export { MessageEventGroup, MessageEventRow, MessageRow, MessageSystemRow, startsMessageGroup } from "./MessageRow";
58
+ export { type GeoNavigationPlatform, geoNavigationHref, geoNavigationPlatform } from "./map-navigation";
56
59
  export { type MapPaletteColors, type MapTheme, mapPalette } from "./map-palette";
57
60
  export { type MapStyleOptions, mapAttribution, mapStyle } from "./map-style";
58
61
  export { MAP_SNAPSHOT_MAX_PIXELS, MapSnapshotError, type MapSnapshotErrorCode } from "./map-view-snapshot";
@@ -0,0 +1,19 @@
1
+ import type { GeoNavigationPlatform } from "./map-navigation";
2
+ export declare const useMapDialogMessages: () => () => {
3
+ open: string;
4
+ close: string;
5
+ more: string;
6
+ places: string;
7
+ copyAddress: string;
8
+ copied: string;
9
+ navigate: ({ platform }: {
10
+ platform: GeoNavigationPlatform;
11
+ }) => string;
12
+ loading: string;
13
+ empty: string;
14
+ enlarge: string;
15
+ shrink: string;
16
+ noLocation: string;
17
+ locationFailed: string;
18
+ };
19
+ export declare const checkMapDialogMessages: () => import("@k2b/stdlib").CatalogIssue[];
@@ -0,0 +1,13 @@
1
+ import type { MapViewPoint } from "./map-view-types";
2
+ export type GeoNavigationPlatform = "android" | "ios" | "desktop";
3
+ /** Phones open their own maps app; everything else gets OpenStreetMap. */
4
+ export declare const geoNavigationPlatform: (userAgent: string) => GeoNavigationPlatform;
5
+ /**
6
+ * A link into a navigation app. There is no live navigation; the link leaves the page only on click and carries
7
+ * just the destination and an optional name. Without a point it navigates to the address text.
8
+ */
9
+ export declare const geoNavigationHref: (target: {
10
+ point?: MapViewPoint | null;
11
+ text: string;
12
+ name?: string;
13
+ }, platform: GeoNavigationPlatform) => string;
@@ -9,9 +9,11 @@ export declare const useMapViewMessages: () => () => {
9
9
  locate: string;
10
10
  loading: string;
11
11
  error: string;
12
+ errorShort: string;
12
13
  retry: string;
13
14
  reload: string;
14
15
  noWebgl: string;
16
+ noWebglShort: string;
15
17
  ownLocation: string;
16
18
  canvasTitle: string;
17
19
  gestureWindows: string;
@@ -68,6 +68,11 @@ export type MapViewProps = Omit<MapViewFrameProps, "attribution"> & {
68
68
  /** Browser-only handle; remains safely callable after disposal (rejects disposed). */
69
69
  ref?: (handle: MapViewHandle) => void;
70
70
  attribution: JSX.Element;
71
+ /**
72
+ * A calm picture: the map image loads, but there are no controls, gestures, pin selection, or info tile, and pins
73
+ * are labelled images. MapTile uses it; its own button opens the full map.
74
+ */
75
+ still?: boolean;
71
76
  onSelect?: (id: string) => void;
72
77
  infoTile?: (marker: MapViewMarker) => JSX.Element;
73
78
  notice?: JSX.Element;
@@ -21,6 +21,12 @@ export type OpenDialogOptions = {
21
21
  * A traversal that `@k2b/ssr/nav` hides from popstate listeners reaches this core through `ssr:nav-popstate`.
22
22
  */
23
23
  history?: boolean;
24
+ /**
25
+ * With `history`, the URL of the dialog's own entry, such as the page URL with a query parameter that names the
26
+ * dialog. Closing returns to the entry below with its own URL. A reload on that entry keeps the URL; opening a
27
+ * dialog with the same `historyUrl` then resumes the entry instead of adding another above it.
28
+ */
29
+ historyUrl?: string;
24
30
  };
25
31
  export type DialogRender<T> = (close: DialogClose<T>, context: {
26
32
  dialog: HTMLDialogElement;
@@ -0,0 +1,19 @@
1
+ import { type JSX } from "solid-js";
2
+ export type BreadcrumbItem = {
3
+ label: string;
4
+ };
5
+ export type BreadcrumbsProps = {
6
+ /** The path from the top: every item but the last is a link, the last is the current place. */
7
+ items: readonly BreadcrumbItem[];
8
+ /** Names the path for assistive technology, for example "Path". */
9
+ label: string;
10
+ /** Called with the index of the link that was activated; never for the current place. */
11
+ onSelect: (index: number) => void;
12
+ disabled?: boolean;
13
+ class?: string;
14
+ };
15
+ /**
16
+ * A path inside a dialog or panel: the levels above as blue text links, the current level as text. It stays on one
17
+ * line; a long path scrolls sideways with a fade on the side where more follows, and shows its end after each change.
18
+ */
19
+ export declare function Breadcrumbs(props: BreadcrumbsProps): JSX.Element;
@@ -10,6 +10,7 @@ export { installAppWorkspaceController, parkWorkspaceDetailDrawers } from "./app
10
10
  export type { AppWorkspaceLayoutState, AppWorkspaceResizeKind, } from "./app-workspace-state";
11
11
  export { APP_WORKSPACE_DETAIL_DEFAULT, APP_WORKSPACE_DETAIL_MAX, APP_WORKSPACE_DETAIL_MIN, APP_WORKSPACE_DRAWER_DEFAULT, APP_WORKSPACE_DRAWER_MAX, APP_WORKSPACE_DRAWER_MIN, APP_WORKSPACE_MAIN_MIN, APP_WORKSPACE_MAIN_MIN_HEIGHT, APP_WORKSPACE_PANE_DEFAULT, APP_WORKSPACE_PANE_MAX, APP_WORKSPACE_PANE_MIN, APP_WORKSPACE_SIDEBAR_COLLAPSE_THRESHOLD, APP_WORKSPACE_SIDEBAR_COLLAPSED, APP_WORKSPACE_SIDEBAR_DEFAULT, APP_WORKSPACE_SIDEBAR_MAX, APP_WORKSPACE_SIDEBAR_MIN, appWorkspaceLayoutStyle, appWorkspacePanelVariable, appWorkspaceResizeLimits, normalizeAppWorkspaceLayoutState, parseAppWorkspaceLayoutState, resolveAppWorkspaceSidebarWidth, safeAppWorkspacePanelId, serializeAppWorkspaceLayoutState, shouldCollapseAppWorkspaceSidebar, } from "./app-workspace-state";
12
12
  export { type BottomSheetProps, bottomSheetAdaptiveOptions, bottomSheetOptions, default as BottomSheet } from "./BottomSheet";
13
+ export { type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps } from "./Breadcrumbs";
13
14
  export type { DataPanelProps } from "./DataPanel";
14
15
  export { DataPanel } from "./DataPanel";
15
16
  export type { DetailPanelActionButtonProps, DetailPanelActionCheckbox, DetailPanelActionLinkProps, DetailPanelActionProps, DetailPanelActionSecondary, DetailPanelBodyProps, DetailPanelGroupProps, DetailPanelHeaderProps, DetailPanelProps, DetailPanelRowProps, DetailPanelSummaryProps, } from "./DetailPanel";
@@ -1,6 +1,18 @@
1
- import type { JSX } from "solid-js";
1
+ import { type Accessor, type JSX } from "solid-js";
2
2
  export type SkeletonProps = {
3
3
  class?: string;
4
4
  };
5
5
  /** Decorative loading geometry. The consumer owns dimensions and one accessible loading status. */
6
6
  export declare function Skeleton(props: SkeletonProps): JSX.Element;
7
+ export type DelayedLoadingOptions = {
8
+ /** How long `pending` must last before the loading state shows. Defaults to 200 ms. */
9
+ delay?: number;
10
+ /** How long a shown loading state stays at least, also when the answer arrives sooner. Defaults to 300 ms. */
11
+ minimum?: number;
12
+ };
13
+ /**
14
+ * Whether a loading state, such as `Skeleton` rows, should show for `pending`: only once it lasted `delay`, then for at
15
+ * least `minimum`. A fast answer never flashes placeholders, and a slow one never blinks them away. Until it is true,
16
+ * keep the previous content in place. It starts false, so server and first client render agree.
17
+ */
18
+ export declare function createDelayedLoading(pending: Accessor<boolean>, options?: DelayedLoadingOptions): Accessor<boolean>;
@@ -32,7 +32,7 @@ export type { ResourceCardColor, ResourceCardProps, ResourceCardState } from "./
32
32
  export { ResourceCard } from "./ResourceCard";
33
33
  export type { SectionFrame, SectionPartProps, SectionProps, SectionSize, SectionState, SectionTone } from "./Section";
34
34
  export { Section } from "./Section";
35
- export { Skeleton, type SkeletonProps } from "./Skeleton";
35
+ export { createDelayedLoading, type DelayedLoadingOptions, Skeleton, type SkeletonProps } from "./Skeleton";
36
36
  export type { StatCellAccent, StatCellCompare, StatCellDelta, StatCellProps, StatCellSize, StatCellTone } from "./StatCell";
37
37
  export { StatCell } from "./StatCell";
38
38
  export type { StatGridAction, StatGridColumns, StatGridProps, StatGridSize, StatGridSurface, } from "./StatGrid";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2b/ui",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Production-ready components for SolidJS applications.",
5
5
  "repository": {
6
6
  "type": "git",