@k2b/ui 0.57.0 → 0.58.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/browser/actions/Dropdown.js +4 -3
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/menu-rows.js +1 -1
- package/dist/browser/actions/menu-rows.js.map +1 -1
- package/dist/browser/content/PdfPages.js +159 -44
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/PdfViewer.js +59 -21
- package/dist/browser/content/PdfViewer.js.map +1 -1
- package/dist/browser/content/pdf-viewer-engine.js +1 -1
- package/dist/browser/layout/FloatingWindow.js +122 -75
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/Panes.js +640 -212
- package/dist/browser/layout/Panes.js.map +1 -1
- package/dist/browser/layout/index.js +1 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/panes-layout.js +169 -0
- package/dist/browser/layout/panes-layout.js.map +1 -1
- package/dist/browser/layout/panes-messages.js +108 -2
- package/dist/browser/layout/panes-messages.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +4 -4
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/menu-rows.js +1 -1
- package/dist/ssr/actions/menu-rows.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +159 -44
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/PdfViewer.js +40 -8
- package/dist/ssr/content/PdfViewer.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +37 -15
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/Panes.js +396 -41
- package/dist/ssr/layout/Panes.js.map +1 -1
- package/dist/ssr/layout/index.js +1 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/panes-layout.js +169 -0
- package/dist/ssr/layout/panes-layout.js.map +1 -1
- package/dist/ssr/layout/panes-messages.js +108 -2
- package/dist/ssr/layout/panes-messages.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +4 -3
- package/dist/types/content/PdfPages.d.ts +8 -3
- package/dist/types/content/PdfViewer.d.ts +12 -4
- package/dist/types/layout/FloatingWindow.d.ts +6 -0
- package/dist/types/layout/Panes.d.ts +15 -0
- package/dist/types/layout/index.d.ts +2 -2
- package/dist/types/layout/panes-layout.d.ts +51 -0
- package/dist/types/layout/panes-messages.d.ts +55 -0
- package/package.json +1 -1
|
@@ -76,10 +76,11 @@ export type DropdownChoice = DropdownActionBase & {
|
|
|
76
76
|
export type DropdownSection = {
|
|
77
77
|
sectionLabel?: string;
|
|
78
78
|
/**
|
|
79
|
-
* `row` sets a few short radio choices, such as a sort direction, side by side as one segmented row.
|
|
80
|
-
*
|
|
79
|
+
* `row` sets a few short radio choices, such as a sort direction, side by side as one segmented row. `tiles` sets
|
|
80
|
+
* a few choices that a picture tells apart, such as arrangements, side by side as tiles with the icon above the
|
|
81
|
+
* label. Give either a `sectionLabel`: the label names the choice above the row and for screen readers.
|
|
81
82
|
*/
|
|
82
|
-
layout?: "row";
|
|
83
|
+
layout?: "row" | "tiles";
|
|
83
84
|
/** A quiet action at the end of the section label, such as "All"; it needs a `sectionLabel` and keeps the menu open. */
|
|
84
85
|
labelAction?: DropdownSecondaryAction;
|
|
85
86
|
items: readonly (DropdownAction | DropdownChoice)[];
|
|
@@ -24,7 +24,10 @@ export type PdfPagesProps = {
|
|
|
24
24
|
fit?: "width" | "page";
|
|
25
25
|
/** Shows only this page (zero-based) instead of all pages one below the other. */
|
|
26
26
|
page?: number;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The first visible page of a document is drawn; a host can drop its loading state. A new `data` calls it again once
|
|
29
|
+
* its pages have replaced the previous document's.
|
|
30
|
+
*/
|
|
28
31
|
onReady?: (document: {
|
|
29
32
|
pages: number;
|
|
30
33
|
}) => void;
|
|
@@ -57,7 +60,9 @@ export declare const fittedPageWidth: (fit: "width" | "page", area: {
|
|
|
57
60
|
export declare const commonPageWidth: (pages: readonly PdfPageSize[]) => number;
|
|
58
61
|
/**
|
|
59
62
|
* The pages behind `PdfViewer`, loaded only once a document shows. A PDF drawn by pdf.js in every browser: pages as
|
|
60
|
-
* images in one scroll area, an invisible text layer over each page to select, copy, and find text, and a small pill.
|
|
61
|
-
* keep their size, so the scroll bar is right from the start.
|
|
63
|
+
* images in one scroll area, an invisible text layer over each page to select, copy, and find text, and a small pill.
|
|
64
|
+
* Only pages near the view are drawn; the others keep their size, so the scroll bar is right from the start. Every page
|
|
65
|
+
* gets its text, near pages first, so the browser's find reaches the whole document. Printing and forms stay with the
|
|
66
|
+
* browser's own viewer.
|
|
62
67
|
*/
|
|
63
68
|
export default function PdfPages(props: PdfPagesProps): JSX.Element;
|
|
@@ -6,10 +6,13 @@ export type PdfViewerProps = {
|
|
|
6
6
|
title: string;
|
|
7
7
|
/**
|
|
8
8
|
* The PDF to show: its bytes, or the address of one on this site, which the viewer fetches. A new value shows that
|
|
9
|
-
* document. Pass either `data` or `request`.
|
|
9
|
+
* document; the shown pages stay until its first pages are drawn. Pass either `data` or `request`.
|
|
10
10
|
*/
|
|
11
11
|
data?: Blob | ArrayBuffer | string;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Requests the PDF: at once with `autoLoad`, otherwise from the action in the empty state. A new request replaces a
|
|
14
|
+
* running one, and the shown pages stay while it loads.
|
|
15
|
+
*/
|
|
13
16
|
request?: PdfViewerRequest;
|
|
14
17
|
/** Runs `request` as soon as the viewer shows. Without it, the person starts it. */
|
|
15
18
|
autoLoad?: boolean;
|
|
@@ -39,7 +42,10 @@ export type PdfViewerProps = {
|
|
|
39
42
|
fit?: "width" | "page";
|
|
40
43
|
/** Shows only this page (zero-based) instead of all pages one below the other. */
|
|
41
44
|
page?: number;
|
|
42
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The first visible page is drawn, again for each new document; `pages` counts the document's pages, such as for a
|
|
47
|
+
* host's "4 pages".
|
|
48
|
+
*/
|
|
43
49
|
onReady?: (document: {
|
|
44
50
|
pages: number;
|
|
45
51
|
}) => void;
|
|
@@ -52,6 +58,8 @@ export type PdfViewerProps = {
|
|
|
52
58
|
/**
|
|
53
59
|
* Shows a PDF with pdf.js on a grey, rounded ground: pages as images with selectable text and a small pill for the
|
|
54
60
|
* page, zoom, and fit. Pass the document as `data`, or a `request` that loads it; the viewer shows the empty, loading,
|
|
55
|
-
* and error states in the same area, so nothing around it moves.
|
|
61
|
+
* and error states in the same area, so nothing around it moves. A new document loads behind the shown pages, which
|
|
62
|
+
* keep their zoom and, for the same pages under the same title, their scroll position; a thin line on the top edge
|
|
63
|
+
* shows a longer wait, and a failed load replaces the pages with its error.
|
|
56
64
|
*/
|
|
57
65
|
export default function PdfViewer(props: PdfViewerProps): JSX.Element;
|
|
@@ -38,6 +38,12 @@ export type FloatingWindowProps = {
|
|
|
38
38
|
minWidth?: number;
|
|
39
39
|
minHeight?: number;
|
|
40
40
|
accent?: string;
|
|
41
|
+
/**
|
|
42
|
+
* `text` names the size control beside its icon ("Maximize" / "Restore size"), for a window whose size changes what
|
|
43
|
+
* it shows, such as a composer that spreads out into panes when large. The control keeps one width in both states.
|
|
44
|
+
* Defaults to `icon`.
|
|
45
|
+
*/
|
|
46
|
+
sizeControl?: "icon" | "text";
|
|
41
47
|
class?: string;
|
|
42
48
|
resolveScope?: () => HTMLElement | null | undefined;
|
|
43
49
|
};
|
|
@@ -16,9 +16,24 @@ export type PanesProps = {
|
|
|
16
16
|
resizable?: boolean;
|
|
17
17
|
split?: false | "horizontal" | "vertical" | "both";
|
|
18
18
|
onAddItem?: (targetItemId: string | null) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The application's own arrangement. "Reset arrangement" in the Arrange menu returns to it, choosing its preset
|
|
21
|
+
* restores its sizes, and a double click on a boundary restores that boundary's size.
|
|
22
|
+
*/
|
|
23
|
+
defaultLayout?: PanesLayout;
|
|
24
|
+
/**
|
|
25
|
+
* The one-time hint at the first tab grip that panes can be arranged. The application decides on the server
|
|
26
|
+
* whether it was seen and stores the dismissal, so a dismissed hint never renders again.
|
|
27
|
+
*/
|
|
28
|
+
arrangeHint?: {
|
|
29
|
+
open: boolean;
|
|
30
|
+
onDismiss: () => void;
|
|
31
|
+
};
|
|
19
32
|
ariaLabel?: string;
|
|
20
33
|
class?: string;
|
|
21
34
|
};
|
|
35
|
+
/** Below this width of its own container, Panes shows every item as one row of tabs and never stores that. */
|
|
36
|
+
export declare const PANES_NARROW_WIDTH = 640;
|
|
22
37
|
type DropMeta = {
|
|
23
38
|
target: PanesDropTarget;
|
|
24
39
|
label: string;
|
|
@@ -38,8 +38,8 @@ export { PersonPopover, type PersonPopoverAction, type PersonPopoverError, type
|
|
|
38
38
|
export type { PullToRefreshProps, PullToRefreshState } from "./PullToRefresh";
|
|
39
39
|
export { default as PullToRefresh } from "./PullToRefresh";
|
|
40
40
|
export { installPageTitleController } from "./page-title-controller";
|
|
41
|
-
export type { AddPanesItemOptions, PanesDirection, PanesGroup, PanesIntent, PanesLayout, PanesNode, PanesPath, PanesPathSegment, PanesSide, PanesSplit, } from "./panes-layout";
|
|
42
|
-
export { activatePanesItem, addPanesItem, applyPanesIntent, createPanesLayout, isPanesItemVisible, PANES_LAYOUT_VERSION, parsePanesLayout, reconcilePanesLayout, removePanesItem, resizePanesSplit, } from "./panes-layout";
|
|
41
|
+
export type { AddPanesItemOptions, PanesDirection, PanesGroup, PanesIntent, PanesLayout, PanesNode, PanesPath, PanesPathSegment, PanesPreset, PanesSide, PanesSplit, } from "./panes-layout";
|
|
42
|
+
export { activatePanesItem, addPanesItem, applyPanesIntent, applyPanesPreset, createPanesLayout, isPanesItemVisible, PANES_LAYOUT_VERSION, parsePanesLayout, reconcilePanesLayout, removePanesItem, resizePanesSplit, } from "./panes-layout";
|
|
43
43
|
export { default as ResizeSeparator, type ResizeSeparatorProps } from "./ResizeSeparator";
|
|
44
44
|
export { attachResizeSeparator, type ResizeSeparatorOptions } from "./resize-separator";
|
|
45
45
|
export type { ScrollAreaProps } from "./ScrollArea";
|
|
@@ -61,3 +61,54 @@ export declare const reconcilePanesLayout: (layout: PanesLayout, desiredOpenItem
|
|
|
61
61
|
export declare const resizePanesSplit: (layout: PanesLayout, path: PanesPath, ratio: number) => PanesLayout;
|
|
62
62
|
export declare const samePanesIntent: (left: PanesIntent | null, right: PanesIntent | null) => boolean;
|
|
63
63
|
export declare const getPanesDropTargets: (layout: PanesLayout, itemId: string, options: PanesDropTargetOptions) => PanesDropTarget[];
|
|
64
|
+
/** The item IDs of a layout in tree order: left before right, top before bottom, tabs in their order. */
|
|
65
|
+
export declare const panesItemOrder: (layout: PanesLayout) => string[];
|
|
66
|
+
/** Whether two layouts place the same items the same way, regardless of split ratios and active tabs. */
|
|
67
|
+
export declare const samePanesArrangement: (left: PanesLayout, right: PanesLayout) => boolean;
|
|
68
|
+
/** Whether two layouts place the same items the same way with the same split ratios, regardless of active tabs. */
|
|
69
|
+
export declare const samePanesSizes: (left: PanesLayout, right: PanesLayout) => boolean;
|
|
70
|
+
/** The named arrangements offered by the Arrange menu. */
|
|
71
|
+
export declare const PANES_PRESETS: readonly ["two", "three", "stacked", "tabs"];
|
|
72
|
+
export type PanesPreset = (typeof PANES_PRESETS)[number];
|
|
73
|
+
/** Whether `preset` can arrange `count` items when only the `split` directions are allowed. */
|
|
74
|
+
export declare const canApplyPanesPreset: (preset: PanesPreset, count: number, split: PanesDropTargetOptions["split"]) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Arranges `itemIds`, in this order, as a named preset: `two` puts the first item beside the rest as tabs, `three`
|
|
77
|
+
* puts the first two items beside the rest, `stacked` puts the first item beside the second above the rest, and
|
|
78
|
+
* `tabs` keeps every item in one group. `active` stays the visible tab of its group. A `fallback` layout with the
|
|
79
|
+
* same arrangement lends its split ratios, so choosing an application's default arrangement restores its sizes.
|
|
80
|
+
* Returns `null` when there are too few items.
|
|
81
|
+
*/
|
|
82
|
+
export declare const applyPanesPreset: (preset: PanesPreset, itemIds: readonly string[], options?: {
|
|
83
|
+
active?: string;
|
|
84
|
+
fallback?: PanesLayout;
|
|
85
|
+
}) => PanesLayout | null;
|
|
86
|
+
/** The preset whose arrangement `layout` has for `itemIds`, if any. */
|
|
87
|
+
export declare const getPanesPreset: (layout: PanesLayout, itemIds: readonly string[]) => PanesPreset | null;
|
|
88
|
+
/** The split ratio at `path` in `layout`, when a split with that direction is there. */
|
|
89
|
+
export declare const getPanesSplitRatio: (layout: PanesLayout | undefined, path: PanesPath, direction: PanesDirection) => number | null;
|
|
90
|
+
/**
|
|
91
|
+
* One group with every item in tree order, for a container too narrow for side-by-side panes. It is shown, never
|
|
92
|
+
* stored: the stored layout stays as it is and returns once the container is wide enough again.
|
|
93
|
+
*/
|
|
94
|
+
export declare const projectPanesLayout: (layout: PanesLayout, active: string | null) => PanesLayout;
|
|
95
|
+
export type PanesMove = {
|
|
96
|
+
kind: "split";
|
|
97
|
+
side: PanesSide;
|
|
98
|
+
targetItemId: string;
|
|
99
|
+
intent: PanesIntent;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "group";
|
|
102
|
+
targetItemId: string;
|
|
103
|
+
intent: PanesIntent;
|
|
104
|
+
} | {
|
|
105
|
+
kind: "tab";
|
|
106
|
+
direction: "previous" | "next";
|
|
107
|
+
intent: PanesIntent;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Every place `itemId` can move to, as menu entries: each drop target that changes the arrangement, with the tab
|
|
111
|
+
* order inside its own group as one step to either side. Positions inside another group's tab row are reached by
|
|
112
|
+
* joining that group, then stepping.
|
|
113
|
+
*/
|
|
114
|
+
export declare const getPanesMoves: (layout: PanesLayout, itemId: string, options: PanesDropTargetOptions) => PanesMove[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
type Side = "left" | "right" | "top" | "bottom";
|
|
2
|
+
type Preset = "two" | "three" | "stacked" | "tabs";
|
|
1
3
|
declare const panesMessages: import("@k2b/stdlib").Catalog<{
|
|
2
4
|
addPane: string;
|
|
3
5
|
addToNamed: ({ name }: {
|
|
@@ -14,6 +16,59 @@ declare const panesMessages: import("@k2b/stdlib").Catalog<{
|
|
|
14
16
|
paneTabs: string;
|
|
15
17
|
paneWorkspace: string;
|
|
16
18
|
resizePanes: string;
|
|
19
|
+
resizeHint: ({ direction }: {
|
|
20
|
+
direction: "horizontal" | "vertical";
|
|
21
|
+
}) => string;
|
|
22
|
+
noPane: string;
|
|
23
|
+
arrange: string;
|
|
24
|
+
arrangement: string;
|
|
25
|
+
preset: ({ preset }: {
|
|
26
|
+
preset: Preset;
|
|
27
|
+
}) => string;
|
|
28
|
+
moveNamed: ({ name }: {
|
|
29
|
+
name: string;
|
|
30
|
+
}) => string;
|
|
31
|
+
moveBeside: ({ side, name }: {
|
|
32
|
+
side: Side;
|
|
33
|
+
name: string;
|
|
34
|
+
}) => string;
|
|
35
|
+
moveIntoGroup: ({ name }: {
|
|
36
|
+
name: string;
|
|
37
|
+
}) => string;
|
|
38
|
+
moveTabPrevious: string;
|
|
39
|
+
moveTabNext: string;
|
|
40
|
+
ctrlKey: string;
|
|
41
|
+
resetArrangement: string;
|
|
42
|
+
arrangeNote: string;
|
|
43
|
+
arrangeHint: string;
|
|
44
|
+
arrangeHintDetail: string;
|
|
45
|
+
moved: ({ name, place }: {
|
|
46
|
+
name: string;
|
|
47
|
+
place: string;
|
|
48
|
+
}) => string;
|
|
49
|
+
arranged: ({ preset }: {
|
|
50
|
+
preset: string;
|
|
51
|
+
}) => string;
|
|
52
|
+
pickedUp: ({ name }: {
|
|
53
|
+
name: string;
|
|
54
|
+
}) => string;
|
|
55
|
+
dragOver: ({ name, place }: {
|
|
56
|
+
name: string;
|
|
57
|
+
place: string;
|
|
58
|
+
}) => string;
|
|
59
|
+
notOverPane: ({ name }: {
|
|
60
|
+
name: string;
|
|
61
|
+
}) => string;
|
|
62
|
+
dropped: ({ name, place }: {
|
|
63
|
+
name: string;
|
|
64
|
+
place: string;
|
|
65
|
+
}) => string;
|
|
66
|
+
notMoved: ({ name }: {
|
|
67
|
+
name: string;
|
|
68
|
+
}) => string;
|
|
69
|
+
cancelled: ({ name }: {
|
|
70
|
+
name: string;
|
|
71
|
+
}) => string;
|
|
17
72
|
}>;
|
|
18
73
|
export type PanesMessages = ReturnType<(typeof panesMessages)["resolve"]>["t"];
|
|
19
74
|
/** Resolved from the inherited render locale. */
|