@k2b/ui 0.12.0 → 0.14.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/README.md +1 -1
- package/dist/browser/content/MarkdownView.js +13 -5
- package/dist/browser/content/MarkdownView.js.map +1 -1
- package/dist/browser/content/PdfPreview.js +5 -2
- package/dist/browser/content/PdfPreview.js.map +1 -1
- package/dist/browser/content/index.js +1 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/markdown-info-blocks.js +363 -0
- package/dist/browser/content/markdown-info-blocks.js.map +1 -0
- package/dist/browser/feedback/InstallGuide.js +267 -0
- package/dist/browser/feedback/InstallGuide.js.map +1 -0
- package/dist/browser/feedback/announce.js +50 -0
- package/dist/browser/feedback/announce.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +88 -2
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/feedback/index.js +4 -0
- package/dist/browser/feedback/index.js.map +1 -1
- package/dist/browser/feedback/install.js +99 -0
- package/dist/browser/feedback/install.js.map +1 -0
- package/dist/browser/feedback/prompts.js +11 -1
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/feedback/theme-color.js +15 -0
- package/dist/browser/feedback/theme-color.js.map +1 -0
- package/dist/browser/feedback/toast.js +10 -44
- package/dist/browser/feedback/toast.js.map +1 -1
- package/dist/browser/inputs/QrScanner.js +164 -0
- package/dist/browser/inputs/QrScanner.js.map +1 -0
- package/dist/browser/inputs/index.js +1 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/intl/messages.js +96 -2
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/Discussion.js +2 -1
- package/dist/browser/layout/Discussion.js.map +1 -1
- package/dist/browser/layout/MobileShell.js +284 -0
- package/dist/browser/layout/MobileShell.js.map +1 -0
- package/dist/browser/layout/TabBar.js +69 -0
- package/dist/browser/layout/TabBar.js.map +1 -0
- package/dist/browser/layout/index.js +2 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/surfaces/NoticeCard.js +55 -60
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/index.js +1 -1
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/ssr/content/MarkdownView.js +13 -5
- package/dist/ssr/content/MarkdownView.js.map +1 -1
- package/dist/ssr/content/PdfPreview.js +4 -2
- package/dist/ssr/content/PdfPreview.js.map +1 -1
- package/dist/ssr/content/index.js +1 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/markdown-info-blocks.js +363 -0
- package/dist/ssr/content/markdown-info-blocks.js.map +1 -0
- package/dist/ssr/feedback/InstallGuide.js +201 -0
- package/dist/ssr/feedback/InstallGuide.js.map +1 -0
- package/dist/ssr/feedback/announce.js +50 -0
- package/dist/ssr/feedback/announce.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +88 -2
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/feedback/index.js +4 -0
- package/dist/ssr/feedback/index.js.map +1 -1
- package/dist/ssr/feedback/install.js +99 -0
- package/dist/ssr/feedback/install.js.map +1 -0
- package/dist/ssr/feedback/prompts.js +11 -1
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/feedback/theme-color.js +15 -0
- package/dist/ssr/feedback/theme-color.js.map +1 -0
- package/dist/ssr/feedback/toast.js +10 -44
- package/dist/ssr/feedback/toast.js.map +1 -1
- package/dist/ssr/inputs/QrScanner.js +128 -0
- package/dist/ssr/inputs/QrScanner.js.map +1 -0
- package/dist/ssr/inputs/index.js +1 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/intl/messages.js +96 -2
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/Discussion.js +2 -1
- package/dist/ssr/layout/Discussion.js.map +1 -1
- package/dist/ssr/layout/MobileShell.js +253 -0
- package/dist/ssr/layout/MobileShell.js.map +1 -0
- package/dist/ssr/layout/TabBar.js +25 -0
- package/dist/ssr/layout/TabBar.js.map +1 -0
- package/dist/ssr/layout/index.js +2 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/surfaces/NoticeCard.js +21 -30
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/index.js +1 -1
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tabler.css +1 -1
- package/dist/types/content/MarkdownView.d.ts +6 -2
- package/dist/types/content/index.d.ts +1 -0
- package/dist/types/content/markdown-info-blocks.d.ts +67 -0
- package/dist/types/feedback/InstallGuide.d.ts +26 -0
- package/dist/types/feedback/announce.d.ts +19 -0
- package/dist/types/feedback/dialog-core.d.ts +5 -0
- package/dist/types/feedback/index.d.ts +7 -0
- package/dist/types/feedback/install.d.ts +32 -0
- package/dist/types/feedback/prompts.d.ts +2 -0
- package/dist/types/feedback/theme-color.d.ts +6 -0
- package/dist/types/inputs/QrScanner.d.ts +20 -0
- package/dist/types/inputs/index.d.ts +2 -0
- package/dist/types/intl/messages.d.ts +47 -0
- package/dist/types/layout/MobileShell.d.ts +40 -0
- package/dist/types/layout/TabBar.d.ts +26 -0
- package/dist/types/layout/index.d.ts +4 -0
- package/dist/types/surfaces/NoticeCard.d.ts +4 -4
- package/dist/types/surfaces/index.d.ts +1 -1
- package/package.json +3 -2
|
@@ -26,14 +26,18 @@ export type MarkdownRenderOptions = {
|
|
|
26
26
|
/** Optional protocol allowlist, including trailing colons. Relative URLs resolve as HTTPS. */
|
|
27
27
|
linkProtocols?: readonly string[];
|
|
28
28
|
linkTarget?: "_blank";
|
|
29
|
+
/** Locale for the screen-reader names of untitled info blocks. `MarkdownView` passes the inherited render locale. */
|
|
30
|
+
locale?: string;
|
|
29
31
|
};
|
|
30
32
|
export declare const renderSafeMarkdown: (markdown: string, options?: MarkdownRenderOptions) => string;
|
|
31
33
|
/**
|
|
32
34
|
* Markdown View Component (SSR)
|
|
33
35
|
*
|
|
34
36
|
* Renders untrusted Markdown safely by default. Raw HTML and unsafe link
|
|
35
|
-
* protocols are escaped.
|
|
36
|
-
* `
|
|
37
|
+
* protocols are escaped. Info blocks (`:::note`, `:::info`, `:::success`,
|
|
38
|
+
* `:::warning`, `:::danger`) render as the calm `NoticeCard`. Already-rendered
|
|
39
|
+
* HTML requires the deliberately named `trustedHtml` boundary; the caller owns
|
|
40
|
+
* sanitization in that mode.
|
|
37
41
|
*
|
|
38
42
|
* @example
|
|
39
43
|
* ```tsx
|
|
@@ -31,6 +31,7 @@ export { default as Lightbox } from "./Lightbox";
|
|
|
31
31
|
export type { LogTableEntry } from "./LogEntriesTable";
|
|
32
32
|
export { default as LogEntriesTable } from "./LogEntriesTable";
|
|
33
33
|
export { default as MarkdownView, type MarkdownRenderOptions, type MarkdownViewProps, renderSafeMarkdown } from "./MarkdownView";
|
|
34
|
+
export { type MarkdownInfoBlock, type MarkdownInfoBlockRenderInput, type MarkdownInfoBlockType, markdownInfoBlocks, renderMarkdownInfoBlock, scanMarkdownInfoBlock, } from "./markdown-info-blocks";
|
|
34
35
|
export { Pagination, type PaginationProps } from "./Pagination";
|
|
35
36
|
export type { PdfPreviewProps, PdfPreviewRequest } from "./PdfPreview";
|
|
36
37
|
export { default as PdfPreview } from "./PdfPreview";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type MarkedExtension } from "marked";
|
|
2
|
+
/**
|
|
3
|
+
* Markdown info blocks: one grammar and one look for every Markdown surface.
|
|
4
|
+
*
|
|
5
|
+
* ```markdown
|
|
6
|
+
* :::warning Before deleting
|
|
7
|
+
* Deleting an item cannot be undone.
|
|
8
|
+
* :::
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* The opening line holds `:::`, a type in any letter case, and an optional
|
|
12
|
+
* plain-text title. The block ends at a line holding only `:::`, indented no
|
|
13
|
+
* deeper than the opener; code, lists, quotes, and HTML inside the body cannot
|
|
14
|
+
* end it. The body is ordinary Markdown. A block that is never closed stays
|
|
15
|
+
* ordinary text.
|
|
16
|
+
*/
|
|
17
|
+
declare const TONES: {
|
|
18
|
+
readonly note: "neutral";
|
|
19
|
+
readonly info: "info";
|
|
20
|
+
readonly success: "success";
|
|
21
|
+
readonly warning: "warning";
|
|
22
|
+
readonly danger: "danger";
|
|
23
|
+
};
|
|
24
|
+
export type MarkdownInfoBlockType = keyof typeof TONES;
|
|
25
|
+
export type MarkdownInfoBlock = {
|
|
26
|
+
type: MarkdownInfoBlockType;
|
|
27
|
+
/** Plain-text title from the opening line. */
|
|
28
|
+
title?: string;
|
|
29
|
+
/** Raw Markdown between the opening and closing lines, with `\n` line breaks. */
|
|
30
|
+
body: string;
|
|
31
|
+
/** Source length through the closing line, or the whole source when the block is not closed. */
|
|
32
|
+
length: number;
|
|
33
|
+
closed: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type MarkdownInfoBlockRenderInput = {
|
|
36
|
+
type: MarkdownInfoBlockType;
|
|
37
|
+
title?: string;
|
|
38
|
+
/** Already rendered body HTML. The caller owns its sanitization. */
|
|
39
|
+
bodyHtml: string;
|
|
40
|
+
/** Locale for the screen-reader name of an untitled block. */
|
|
41
|
+
locale?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Reads the info block that starts `source`. Returns `null` when the first
|
|
45
|
+
* line is not an info-block opener. Applications with their own Markdown
|
|
46
|
+
* pipeline use this to recognize exactly the blocks `MarkdownView` renders.
|
|
47
|
+
* Any line endings are accepted; `length` counts `source` as given.
|
|
48
|
+
*/
|
|
49
|
+
export declare const scanMarkdownInfoBlock: (source: string) => MarkdownInfoBlock | null;
|
|
50
|
+
/**
|
|
51
|
+
* Renders an info block as the calm `NoticeCard`: the tone tints the surface,
|
|
52
|
+
* the text stays neutral, and there is no icon. A title is the visible heading
|
|
53
|
+
* and names the block; without one, the localized type name is announced to
|
|
54
|
+
* screen readers only.
|
|
55
|
+
*/
|
|
56
|
+
export declare const renderMarkdownInfoBlock: (input: MarkdownInfoBlockRenderInput) => string;
|
|
57
|
+
/**
|
|
58
|
+
* `marked` extension for info blocks at the top level of a document. Blocks
|
|
59
|
+
* inside lists, quotes, or another block stay ordinary text. The body goes
|
|
60
|
+
* through the host's own Markdown renderer, so its escaping and link rules
|
|
61
|
+
* apply unchanged. Locales that share a UI message catalog get the same
|
|
62
|
+
* extension, so a host may cache one `marked` instance per extension.
|
|
63
|
+
*/
|
|
64
|
+
export declare const markdownInfoBlocks: (options?: {
|
|
65
|
+
locale?: string;
|
|
66
|
+
}) => MarkedExtension;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { InstallPrompt } from "./install";
|
|
3
|
+
export type InstallGuideProps = {
|
|
4
|
+
/** The name people see on their Home Screen, used in the guidance text. */
|
|
5
|
+
appName: string;
|
|
6
|
+
install: InstallPrompt;
|
|
7
|
+
/**
|
|
8
|
+
* The address a browser inside another app copies, to open it in Safari or Chrome. Shown as text when copying
|
|
9
|
+
* fails, so it can be copied by hand.
|
|
10
|
+
*/
|
|
11
|
+
url: string;
|
|
12
|
+
/**
|
|
13
|
+
* An application note under the installation steps or the embedded browser's link, for example what else the
|
|
14
|
+
* installed app enables.
|
|
15
|
+
*/
|
|
16
|
+
note?: string;
|
|
17
|
+
class?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Explains how to install the current page as an app on this platform: the browser's own dialog where it offers
|
|
21
|
+
* one, otherwise the steps for Safari on iPhone, iPad, and Mac, other browsers on iPhone and iPad, Android, and other
|
|
22
|
+
* browsers. A browser inside another app cannot install, so it gets a warning and the link to copy into Safari or
|
|
23
|
+
* Chrome instead. The host owns the surrounding surface, its heading, and dismissal.
|
|
24
|
+
*/
|
|
25
|
+
export declare function InstallGuide(props: InstallGuideProps): JSX.Element;
|
|
26
|
+
export default InstallGuide;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type AnnouncePoliteness = "polite" | "assertive";
|
|
2
|
+
export type AnnounceOptions = {
|
|
3
|
+
/** `polite` waits until the screen reader is idle; `assertive` interrupts it. Defaults to `polite`. */
|
|
4
|
+
politeness?: AnnouncePoliteness;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* One pair of persistent, empty live regions per document, polite and assertive, shared by `announce` and every
|
|
8
|
+
* toast. A region that already exists when its text arrives is announced reliably, unlike one inserted with its text
|
|
9
|
+
* already inside. They sit directly in the body, outside every portal and the toast rail, which moves into a fresh
|
|
10
|
+
* top-layer element for every toast, so no scope that closes takes them along.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ensureLiveRegions: (doc: Document) => HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* Tells screen readers about an outcome without showing anything: a change the screen shows but the focused control
|
|
15
|
+
* does not say, because a shortcut acted, the control was busy, or it was replaced. Each message is its own line, so
|
|
16
|
+
* a burst of messages or the same message twice is still read. Calls without `document`, including during SSR, do
|
|
17
|
+
* nothing.
|
|
18
|
+
*/
|
|
19
|
+
export declare const announce: (message: string, options?: AnnounceOptions) => void;
|
|
@@ -8,6 +8,11 @@ export type OpenDialogOptions = {
|
|
|
8
8
|
initialFocus?: "first-input" | "none" | ((dialog: HTMLDialogElement) => HTMLElement | null);
|
|
9
9
|
cancelBehavior?: "resolve-undefined" | "ignore";
|
|
10
10
|
ariaLabel?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Add a same-URL history entry while the dialog is open, so the browser's or the phone's Back closes the dialog
|
|
13
|
+
* instead of leaving the page. Closing the dialog removes the entry again; the returned promise settles after that.
|
|
14
|
+
*/
|
|
15
|
+
history?: boolean;
|
|
11
16
|
};
|
|
12
17
|
export type DialogRender<T> = (close: DialogClose<T>, context: {
|
|
13
18
|
dialog: HTMLDialogElement;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
export type { AnnounceOptions, AnnouncePoliteness } from "./announce";
|
|
2
|
+
export { announce } from "./announce";
|
|
1
3
|
export type { DialogClose, DialogCore, DialogRender, OpenDialogOptions } from "./dialog-core";
|
|
2
4
|
export { dialogCore } from "./dialog-core";
|
|
3
5
|
export type { HoverPreviewController, HoverPreviewOptions, HoverPreviewPlacement, HoverPreviewProps } from "./HoverPreview";
|
|
4
6
|
export { createHoverPreview, HoverPreview } from "./HoverPreview";
|
|
5
7
|
export type { InlineGuidanceProps } from "./InlineGuidance";
|
|
6
8
|
export { default as InlineGuidance } from "./InlineGuidance";
|
|
9
|
+
export type { InstallGuideProps } from "./InstallGuide";
|
|
10
|
+
export { default as InstallGuide } from "./InstallGuide";
|
|
11
|
+
export type { InstallationPlatform, InstallPrompt } from "./install";
|
|
12
|
+
export { createInstallPrompt, installationPlatform } from "./install";
|
|
7
13
|
export type { ConfirmOptions, DialogOptions, FieldSchema, PromptFieldBase, PromptSearchInput, PromptSearchItem, PromptSearchOptions, } from "./prompts";
|
|
8
14
|
export { createFormState, DialogHeader, prompts } from "./prompts";
|
|
9
15
|
export type { TooltipAnchorProps, TooltipPlacement, TooltipProps, TooltipTriggerProps } from "./Tooltip";
|
|
10
16
|
export { Tooltip } from "./Tooltip";
|
|
17
|
+
export { syncThemeColor } from "./theme-color";
|
|
11
18
|
export type { ToastAction, ToastFn, ToastHandle, ToastOptions, ToastSlot, ToastVariant } from "./toast";
|
|
12
19
|
export { isPointInsideToast, toast } from "./toast";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which installation steps a browser needs. `apple-in-app` and `in-app` are browsers embedded in another app, on
|
|
3
|
+
* iPhone or iPad and elsewhere, which cannot install at all. `apple-browser` is Chrome, Firefox, Edge, or another
|
|
4
|
+
* browser on iPhone or iPad, which installs through its Share menu but less reliably than Safari. `android-browser`
|
|
5
|
+
* is an Android browser other than Chrome.
|
|
6
|
+
*/
|
|
7
|
+
export type InstallationPlatform = "in-app" | "apple-in-app" | "apple-browser" | "apple-mobile" | "apple-desktop" | "android-browser" | "android" | "generic";
|
|
8
|
+
/**
|
|
9
|
+
* Classifies the browser from its user agent; `platform` and `touchPoints` only tell an iPad that reports a Mac apart.
|
|
10
|
+
* A pure function, so the server and the browser compute the same value from the same user agent. Not a device
|
|
11
|
+
* check: an installed app on iPhone may itself look like an embedded browser.
|
|
12
|
+
*/
|
|
13
|
+
export declare function installationPlatform(userAgent: string, platform: string, touchPoints: number): InstallationPlatform;
|
|
14
|
+
export type InstallPrompt = {
|
|
15
|
+
platform: InstallationPlatform;
|
|
16
|
+
/** Running from the Home Screen or as an installed app, or installed during this visit. */
|
|
17
|
+
installed: () => boolean;
|
|
18
|
+
/** The browser offered its own installation dialog, which `install()` opens. */
|
|
19
|
+
canPrompt: () => boolean;
|
|
20
|
+
busy: () => boolean;
|
|
21
|
+
/** The person accepted the browser's dialog; the browser finishes the installation. */
|
|
22
|
+
requested: () => boolean;
|
|
23
|
+
/** The browser's dialog could not be opened. */
|
|
24
|
+
failed: () => boolean;
|
|
25
|
+
/** Opens the browser's dialog once. Call it directly from a click. */
|
|
26
|
+
install: () => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Tracks whether the page runs installed and captures the browser's installation prompt. Browser-only; call it once,
|
|
30
|
+
* when the page loads, under an owner that lives as long as the page: Chrome offers its prompt only once, early.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createInstallPrompt(): InstallPrompt;
|
|
@@ -13,6 +13,8 @@ export interface DialogOptions {
|
|
|
13
13
|
surface?: "default" | "bare";
|
|
14
14
|
header?: false;
|
|
15
15
|
cancelBehavior?: OpenDialogOptions["cancelBehavior"];
|
|
16
|
+
/** Back closes the prompt like Cancel, as in a phone app; see `OpenDialogOptions.history`. */
|
|
17
|
+
history?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export interface ConfirmOptions extends DialogOptions {
|
|
18
20
|
confirmationPhrase?: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gives the browser chrome the page's current background after a theme change: the `html` background, which iOS
|
|
3
|
+
* shows behind the status bar and in overscroll, and every `theme-color` meta element. A `media` attribute is
|
|
4
|
+
* dropped, because the page's chosen theme wins over the system scheme. Browser-only.
|
|
5
|
+
*/
|
|
6
|
+
export declare function syncThemeColor(root?: Element): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type QrScannerError = "denied" | "unavailable";
|
|
3
|
+
export type QrScannerProps = {
|
|
4
|
+
/** Decoded text is untrusted. Return `true` to accept it and stop the camera, `false` to reject it and keep scanning. */
|
|
5
|
+
onResult: (text: string) => boolean;
|
|
6
|
+
/** The page was hidden or left; unmount the scanner. */
|
|
7
|
+
onStop: () => void;
|
|
8
|
+
/** The camera could not start: access was denied, or there is no usable camera. Offer another way in. */
|
|
9
|
+
onError: (reason: QrScannerError) => void;
|
|
10
|
+
/** What to point the camera at. Defaults to a generic QR code hint. */
|
|
11
|
+
instructions?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Scans a QR code with the rear camera. Each mount owns exactly one camera session, which stops when the scanner
|
|
16
|
+
* unmounts, the page is hidden, or a result is accepted. The scanning engine loads only when the scanner mounts.
|
|
17
|
+
* Decoded content is never logged.
|
|
18
|
+
*/
|
|
19
|
+
export declare function QrScanner(props: QrScannerProps): JSX.Element;
|
|
20
|
+
export default QrScanner;
|
|
@@ -27,6 +27,8 @@ export type { MarkdownEditorProps } from "./markdown/MarkdownEditor";
|
|
|
27
27
|
export { MarkdownEditor } from "./markdown/MarkdownEditor";
|
|
28
28
|
export type { NumberInputProps } from "./NumberInput";
|
|
29
29
|
export { NumberInput } from "./NumberInput";
|
|
30
|
+
export type { QrScannerError, QrScannerProps } from "./QrScanner";
|
|
31
|
+
export { QrScanner } from "./QrScanner";
|
|
30
32
|
export type { ChoiceAppearance, SelectGridSize, SelectGroup, SelectOption, SelectProps, SelectSourceOption, SelectView } from "./Select";
|
|
31
33
|
export { Select } from "./Select";
|
|
32
34
|
export type { SelectChipOption, SelectChipProps } from "./SelectChip";
|
|
@@ -33,6 +33,11 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
|
|
|
33
33
|
close: string;
|
|
34
34
|
closeDialog: string;
|
|
35
35
|
copied: string;
|
|
36
|
+
infoBlockNote: string;
|
|
37
|
+
infoBlockInfo: string;
|
|
38
|
+
infoBlockSuccess: string;
|
|
39
|
+
infoBlockWarning: string;
|
|
40
|
+
infoBlockDanger: string;
|
|
36
41
|
copy: string;
|
|
37
42
|
closeLightbox: string;
|
|
38
43
|
couldNotLoadData: string;
|
|
@@ -427,6 +432,48 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
|
|
|
427
432
|
audioUnsupported: string;
|
|
428
433
|
videoUnsupported: string;
|
|
429
434
|
yes: string;
|
|
435
|
+
installApp: string;
|
|
436
|
+
installNative: ({ appName }: {
|
|
437
|
+
appName: string;
|
|
438
|
+
}) => string;
|
|
439
|
+
installRequested: string;
|
|
440
|
+
installFailed: string;
|
|
441
|
+
installOpenShare: string;
|
|
442
|
+
installOpenShareDetail: string;
|
|
443
|
+
installHomeScreen: string;
|
|
444
|
+
installHomeScreenDetail: string;
|
|
445
|
+
installConfirmAdd: string;
|
|
446
|
+
installConfirmAddDetail: string;
|
|
447
|
+
installOpenShareBrowserDetail: string;
|
|
448
|
+
installSafariFallback: string;
|
|
449
|
+
installSafariMenu: string;
|
|
450
|
+
installSafariMenuDetail: string;
|
|
451
|
+
installAddDock: string;
|
|
452
|
+
installAddDockDetail: string;
|
|
453
|
+
installBrowserMenu: string;
|
|
454
|
+
installBrowserMenuDetail: string;
|
|
455
|
+
installAndroidDetail: string;
|
|
456
|
+
installBrowserDetail: string;
|
|
457
|
+
installUnavailable: string;
|
|
458
|
+
installAppleInAppTitle: string;
|
|
459
|
+
installAppleInAppDetail: ({ appName }: {
|
|
460
|
+
appName: string;
|
|
461
|
+
}) => string;
|
|
462
|
+
installInAppTitle: string;
|
|
463
|
+
installInAppDetail: ({ appName }: {
|
|
464
|
+
appName: string;
|
|
465
|
+
}) => string;
|
|
466
|
+
installAppleBrowserTitle: string;
|
|
467
|
+
installAppleBrowserDetail: string;
|
|
468
|
+
installAndroidBrowserTitle: string;
|
|
469
|
+
installAndroidBrowserDetail: string;
|
|
470
|
+
installCopyLink: string;
|
|
471
|
+
installLinkCopied: string;
|
|
472
|
+
installCopyFailed: string;
|
|
473
|
+
qrCameraPreview: string;
|
|
474
|
+
qrCameraStarting: string;
|
|
475
|
+
qrCameraInstructions: string;
|
|
476
|
+
qrCameraPrivacy: string;
|
|
430
477
|
}>;
|
|
431
478
|
export type UiMessages = ReturnType<(typeof uiMessages)["resolve"]>["t"];
|
|
432
479
|
/** Generic component chrome owned by @k2b/ui, resolved from the inherited render locale. */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type MobileShellProps = {
|
|
3
|
+
/** Usually `MobileShell.Header`; it sits above the scroll area and pads the top safe area. */
|
|
4
|
+
header: JSX.Element;
|
|
5
|
+
/** Usually a `TabBar`; it sits below the scroll area and pads the bottom safe area itself. */
|
|
6
|
+
footer?: JSX.Element;
|
|
7
|
+
/** The page content, inside the shell's only scroll area. */
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
export type MobileShellHeaderProps = {
|
|
12
|
+
title: string;
|
|
13
|
+
/** A Back control before the title: a link with `href`, otherwise a button. */
|
|
14
|
+
back?: {
|
|
15
|
+
href?: string;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
/** Controls after the title, such as a menu. */
|
|
20
|
+
actions?: JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Keeps a mounted shell working: the footer height on the body, which the portalled toast rail reads, the room a
|
|
24
|
+
* persistent toast takes from the scroll area, the scroll area's edge fade, and immediate feedback for link taps.
|
|
25
|
+
* The fade is the only cue at the footer's edge, which has no rule. `MobileShell` calls it itself;
|
|
26
|
+
* a page that renders the shell on the server without hydrating it calls it once in the browser. Returns the
|
|
27
|
+
* cleanup.
|
|
28
|
+
*/
|
|
29
|
+
export declare function observeMobileShell(root: HTMLElement): () => void;
|
|
30
|
+
declare function MobileShellRoot(props: MobileShellProps): JSX.Element;
|
|
31
|
+
declare function MobileShellHeader(props: MobileShellHeaderProps): JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* The full-screen frame of a phone app: a header, one scroll area, and an optional footer such as a `TabBar`. While
|
|
34
|
+
* it is mounted, the document itself never scrolls, pinch zoom and rubber-banding are off, and the toast rail sits
|
|
35
|
+
* above the footer. Mount one per page, as the page's layout.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MobileShell: typeof MobileShellRoot & {
|
|
38
|
+
Header: typeof MobileShellHeader;
|
|
39
|
+
};
|
|
40
|
+
export default MobileShell;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type TabBarItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** Icon class, for example `ti ti-home`. */
|
|
6
|
+
icon: string;
|
|
7
|
+
href: string;
|
|
8
|
+
/** The header title of the page this item opens, shown while that page loads. Defaults to `label`. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** The page this item leads to is open. */
|
|
11
|
+
current?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type TabBarProps = {
|
|
14
|
+
/** Accessible name of the navigation landmark. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Up to five destinations; further items are not rendered. Put the rest behind a "More" destination. */
|
|
17
|
+
items: readonly TabBarItem[];
|
|
18
|
+
class?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Bottom navigation between a phone app's top-level pages: native links with equal widths, an icon above each label,
|
|
22
|
+
* and `aria-current="page"` on the open page. Place it in `MobileShell`'s footer; it pads the bottom safe area. There a
|
|
23
|
+
* tab switches at the first touch: the shell shows the item's `title` while its page loads.
|
|
24
|
+
*/
|
|
25
|
+
export declare function TabBar(props: TabBarProps): JSX.Element;
|
|
26
|
+
export default TabBar;
|
|
@@ -15,6 +15,8 @@ export type { DiscussionComposerProps, DiscussionItemProps, DiscussionListProps,
|
|
|
15
15
|
export { default as Discussion } from "./Discussion";
|
|
16
16
|
export type { FloatingWindowClose, FloatingWindowProps, OpenFloatingWindowOptions, } from "./FloatingWindow";
|
|
17
17
|
export { default as FloatingWindow, type FloatingWindowRect, fitFloatingWindowRect, openFloatingWindow, } from "./FloatingWindow";
|
|
18
|
+
export type { MobileShellHeaderProps, MobileShellProps } from "./MobileShell";
|
|
19
|
+
export { default as MobileShell, observeMobileShell } from "./MobileShell";
|
|
18
20
|
export { default as Navigation, type NavigationProps } from "./Navigation";
|
|
19
21
|
export { createNavigation, findNavigationItem, type NavigationController, type NavigationItem, type NavigationOptions, } from "./navigation-model";
|
|
20
22
|
export type { PanelDialogBodyProps, PanelDialogFooterProps, PanelDialogHeaderProps, PanelDialogProps, PanelDialogSectionProps, PanelDialogSurface, PanelDialogTabOption, PanelDialogTabsProps, } from "./PanelDialog";
|
|
@@ -35,3 +37,5 @@ export type { SettingsCollectionActionProps, SettingsCollectionItemActionsProps,
|
|
|
35
37
|
export { default as SettingsCollection } from "./SettingsCollection";
|
|
36
38
|
export type { SettingsModalFooterProps, SettingsModalGroupProps, SettingsModalProps, SettingsModalTabProps, SettingsModalTabTone, } from "./SettingsModal";
|
|
37
39
|
export { default as SettingsModal } from "./SettingsModal";
|
|
40
|
+
export type { TabBarItem, TabBarProps } from "./TabBar";
|
|
41
|
+
export { default as TabBar } from "./TabBar";
|
|
@@ -4,28 +4,28 @@ export type NoticeTone = Extract<IntentTone, "neutral" | "info" | "success" | "w
|
|
|
4
4
|
type NoticeCardContentProps = {
|
|
5
5
|
title: JSX.Element;
|
|
6
6
|
detail?: JSX.Element;
|
|
7
|
+
meta?: JSX.Element;
|
|
7
8
|
children?: JSX.Element;
|
|
8
9
|
} | {
|
|
9
10
|
title?: never;
|
|
10
11
|
detail?: never;
|
|
12
|
+
meta?: never;
|
|
11
13
|
children: JSX.Element;
|
|
12
14
|
};
|
|
13
15
|
export type NoticeCardProps = Omit<JSX.HTMLAttributes<HTMLElement>, "children" | "class" | "title"> & NoticeCardContentProps & {
|
|
14
16
|
tone?: NoticeTone;
|
|
15
|
-
icon?: string | false;
|
|
16
17
|
class?: string;
|
|
17
18
|
bodyClass?: string;
|
|
18
19
|
};
|
|
19
20
|
export declare const NOTICE_CARD_CLASSES: {
|
|
20
21
|
readonly root: "k2b-notice-card";
|
|
21
|
-
readonly inner: "k2b-notice-card__inner";
|
|
22
|
-
readonly icon: "k2b-notice-card__icon";
|
|
23
22
|
readonly content: "k2b-notice-card__content";
|
|
23
|
+
readonly head: "k2b-notice-card__head";
|
|
24
24
|
readonly title: "k2b-notice-card__title";
|
|
25
|
+
readonly meta: "k2b-notice-card__meta";
|
|
25
26
|
readonly description: "k2b-notice-card__description";
|
|
26
27
|
readonly body: "k2b-notice-card__body";
|
|
27
28
|
};
|
|
28
|
-
export declare const NOTICE_CARD_ICONS: Readonly<Record<NoticeTone, string>>;
|
|
29
29
|
declare function NoticeCardComponent(props: NoticeCardProps): JSX.Element;
|
|
30
30
|
export type NoticeGridProps<T> = {
|
|
31
31
|
items: readonly T[];
|
|
@@ -7,7 +7,7 @@ export { LinkCard } from "./LinkCard";
|
|
|
7
7
|
export type { NotFoundStateAction, NotFoundStateProps } from "./NotFoundState";
|
|
8
8
|
export { NotFoundState } from "./NotFoundState";
|
|
9
9
|
export type { NoticeCardProps, NoticeGridProps, NoticeTone } from "./NoticeCard";
|
|
10
|
-
export { NOTICE_CARD_CLASSES,
|
|
10
|
+
export { NOTICE_CARD_CLASSES, NoticeCard } from "./NoticeCard";
|
|
11
11
|
export type { PaperProps, PaperTag } from "./Paper";
|
|
12
12
|
export { Paper } from "./Paper";
|
|
13
13
|
export type { PlaceholderAlign, PlaceholderProps, PlaceholderState, PlaceholderSurface, PlaceholderVariant, } from "./Placeholder";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k2b/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Production-ready components for SolidJS applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"@fontsource/ibm-plex-sans": "5.3.0",
|
|
47
47
|
"@k2b/stdlib": "0.27.0",
|
|
48
48
|
"@tabler/icons-webfont": "3.48.0",
|
|
49
|
-
"marked": "18.0.14"
|
|
49
|
+
"marked": "18.0.14",
|
|
50
|
+
"qr-scanner": "1.4.2"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"@k2b/ssr": "^0.12.0 || ^0.13.0 || ^0.14.0",
|