@crewlethq/ui 0.163.4 → 0.165.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 +20 -2
- package/dist/Canvas/Canvas.d.ts +9 -2
- package/dist/Canvas/index.js +1 -1
- package/dist/CanvasBoard/index.js +3 -3
- package/dist/CanvasToolbar/index.js +2 -2
- package/dist/GraphCanvas/index.js +2 -2
- package/dist/Money/Money.d.ts +23 -0
- package/dist/Money/amounts.d.ts +102 -0
- package/dist/Money/index.d.ts +5 -0
- package/dist/Money/index.js +3 -0
- package/dist/Money-SAHKH4UT.css +8 -0
- package/dist/MoneyField/MoneyField.d.ts +54 -0
- package/dist/MoneyField/index.d.ts +3 -0
- package/dist/MoneyField/index.js +19 -0
- package/dist/MoneyField-4PHZWHJL.css +9 -0
- package/dist/ProposalCard/ProposalCard.d.ts +20 -1
- package/dist/ProposalCard/index.d.ts +1 -1
- package/dist/ProposalCard/index.js +6 -1
- package/dist/Rating/Rating.d.ts +35 -0
- package/dist/Rating/index.d.ts +3 -0
- package/dist/Rating/index.js +2 -0
- package/dist/Rating-HVNMNXPK.css +38 -0
- package/dist/TreeCanvas/index.js +2 -2
- package/dist/chunk-3XACYHTW.js +18 -0
- package/dist/{chunk-TXX5QH6H.js → chunk-ABA5XK5H.js} +2 -2
- package/dist/{chunk-A6A4UEIZ.js → chunk-BDDJI6NA.js} +3 -1
- package/dist/{chunk-CP5PFVMZ.js → chunk-DUTG73M4.js} +9 -0
- package/dist/chunk-G6DKKJN6.js +111 -0
- package/dist/{chunk-WBS7ZTIY.js → chunk-GCUJCO3W.js} +17 -1
- package/dist/{chunk-4AFO5QJ4.js → chunk-JSW2QOGC.js} +1 -1
- package/dist/{chunk-5ESIECCX.js → chunk-OKIAXHI6.js} +1 -1
- package/dist/chunk-OMMPRYHF.js +53 -0
- package/dist/chunk-P5QLLUKM.js +28 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.js +48 -44
- package/dist/index.js +48 -44
- package/dist/styles.css +64 -0
- package/package.json +3 -3
- /package/dist/{chunk-XB6SMI7T.js → chunk-BPR6WAZV.js} +0 -0
package/README.md
CHANGED
|
@@ -42,8 +42,8 @@ import { Button } from '@crewlethq/ui/Button'; // 8 KB of CSS, not 182 KB
|
|
|
42
42
|
| ---- | ---------- |
|
|
43
43
|
| Actions | `Button` and `ButtonLink` (variants `primary`, `secondary`, `outline`, `ghost`, `accent`, `danger`; sizes `small`, `medium`, `large`; shapes `square`, `pill`), `IconButton`, `Menu`, `Link`, `Copyable`, `CopyButton`, `DownloadButton`, `Kbd` |
|
|
44
44
|
| Content and text | `Text` (the eight registers and `inherit`; a line cut by `truncate` or `clamp` shows its whole words on hover), `Prose`, `Statement`, `Document`, `DocumentTitle` and `DocumentTitleField`, the Markdown grammar (`parseMarkdown`, `parseMarkdownSpans`, `markdownInline`, `safeHref` and the line readers, with no React in it), `Highlight`, `InlineCode`, `List` and `ListItem`, `DescriptionList`, `Timeline`, `RelativeTime`, `Note`, `Divider` |
|
|
45
|
-
| Forms | `Input`, `Textarea`, `Label`, `FormField`, `FormRow`, `Checkbox`, `CheckboxGroup`, `ConfirmField`, `Select`, `Tag`, `TagsInput`, `DateTimePicker`, `TimeWindowPicker`, `TimeRangePicker`, `ImageUpload`, `CharacterPicker`, `HuePicker`, `AvatarPicker`, `FactList`, `ChoiceList`, `ChoiceCards`, `MemberPicker` (groups granted whole, with members left out or chosen on their own, and `chosenMembers`), `KeyValueRows` (keys and their values as rows under one column head, with `keyValueRowsLabels`), `ChipField` (chosen items as chips inside the field), `PersonRow` (a person or an agent as one row of a list), `Composer`, `MarkdownEditor`, `RichEditor` (with `preloadRichEditor`, and the round trip `roundTripMarkdown` and `canonicalMarkdown` from `@crewlethq/ui/RichEditorMarkdown`) |
|
|
46
|
-
| Data display | `DataGrid` (with `useDataGridDriving`, `useAnyDataGridDriving` and `countDataGridRows`), `DataTable`, `CopyableCell`, `Table`, the read-only table cells (`TableKeyCell`, `TableNumberCell`, `TableDateCell`, `TableEntityCell`, `TableStatusCell`, `TableTagsCell`, `TableTextCell`, `TableTwoLineCell`), `StatCard`, `Meter`, `SegmentedMeter`, `Stepper`, `PricingCard`, `Avatar`, `AvatarStack`, `EntityChip`, `CodeBlock`, `QrCode`, `ObjectHeader`, `FactLine`, `SetByLine` (set, seen, observed or confirmed by, with `SET_BY_VERBS`), `GraphCanvas` (a layered map of clusters, groups and three families of line, with its legend, the card beside an entry, the selection dock and fullscreen, its pure layout `layoutGraph`, the trunks `graphTrunks`, the reach `graphReach` and the keyboard walk `graphStep`), `Skeleton`, `Eyebrow`, `StatGroup`, `PinTile`, `IconTile`, `SettingsTable` (with `SettingsTable.Row`), `CatalogTile` |
|
|
45
|
+
| Forms | `Input`, `Textarea`, `Label`, `FormField`, `FormRow`, `Checkbox`, `CheckboxGroup`, `ConfirmField`, `Select`, `Tag`, `TagsInput`, `DateTimePicker`, `TimeWindowPicker`, `TimeRangePicker`, `ImageUpload`, `CharacterPicker`, `HuePicker`, `AvatarPicker`, `FactList`, `ChoiceList`, `ChoiceCards`, `MemberPicker` (groups granted whole, with members left out or chosen on their own, and `chosenMembers`), `KeyValueRows` (keys and their values as rows under one column head, with `keyValueRowsLabels`), `ChipField` (chosen items as chips inside the field), `PersonRow` (a person or an agent as one row of a list), `Composer`, `MarkdownEditor`, `RichEditor` (with `preloadRichEditor`, and the round trip `roundTripMarkdown` and `canonicalMarkdown` from `@crewlethq/ui/RichEditorMarkdown`), `MoneyField` (an amount typed as text, never a number, with `moneyFieldProblem`) |
|
|
46
|
+
| Data display | `DataGrid` (with `useDataGridDriving`, `useAnyDataGridDriving` and `countDataGridRows`), `DataTable`, `CopyableCell`, `Table`, the read-only table cells (`TableKeyCell`, `TableNumberCell`, `TableDateCell`, `TableEntityCell`, `TableStatusCell`, `TableTagsCell`, `TableTextCell`, `TableTwoLineCell`), `StatCard`, `Meter`, `SegmentedMeter`, `Stepper`, `PricingCard`, `Avatar`, `AvatarStack`, `EntityChip`, `CodeBlock`, `QrCode`, `ObjectHeader`, `FactLine`, `SetByLine` (set, seen, observed or confirmed by, with `SET_BY_VERBS`), `GraphCanvas` (a layered map of clusters, groups and three families of line, with its legend, the card beside an entry, the selection dock and fullscreen, its pure layout `layoutGraph`, the trunks `graphTrunks`, the reach `graphReach` and the keyboard walk `graphStep`), `Skeleton`, `Eyebrow`, `StatGroup`, `PinTile`, `IconTile`, `SettingsTable` (with `SettingsTable.Row`), `CatalogTile`, `Money` (an amount drawn from integer micros, with `formatMoney`, `parseMoney`, `moneyDecimal`, `minorUnits`, `sumByCurrency`, `toMicros` and `decimalOf`), `Rating` (stars, read only) |
|
|
47
47
|
| List screens | `DataView`, and its parts on their own: `DataViewToolbar`, `FilterAxisBar`, `FilterAxisChip`, `FilterPill`, plus the filter model (`filterDefsFromColumns`, `applyColumnFilters`, `filterPredicate`, `blankFilterValue`) |
|
|
48
48
|
| Feedback and overlays | `Callout`, `NoticeList` and `groupNotices` (several notices from one source, each said once), `AttentionList` (what needs a person, as rows in one card), `ConflictNote`, `EditingStatus`, `Toaster`, `Modal` (with `variant="sheet"`), `ConfirmModal`, `CommandPalette`, `Tooltip`, `Popover`, `Announcer` |
|
|
49
49
|
| Documents and review | `DiffView` and `DiffSummary` with the line diff they draw (`compareLines`, `compareSequences`, `changedRuns`, `diffStat`, `collapseDiff`, `firstChangedLines`, `splitLines`, with no React in it), `DiffList`, `VersionCompare`, `CommentThread` |
|
|
@@ -208,6 +208,24 @@ places:
|
|
|
208
208
|
- A surface that pans or zooms dispatches `LAYER_REPOSITION_EVENT` on its host
|
|
209
209
|
when the content beneath it moves, and every panel anchored inside follows.
|
|
210
210
|
|
|
211
|
+
## Changes in 0.165.0
|
|
212
|
+
|
|
213
|
+
### Money, star ratings and a note sent back with a decision
|
|
214
|
+
|
|
215
|
+
- **`Money` and `formatMoney(micros, currency, locale)` draw an amount from integer micros**, one unit being 1,000,000 micros, and never through a float: every step is BigInt arithmetic, and the formatter is handed a decimal string already rounded, which `Intl.NumberFormat` reads exactly. Each currency takes its own ISO 4217 digits (none for JPY, three for KWD, four for CLF) from the kit's own table rather than the locale's data, which differs for some; a code ISO does not list is drawn with every digit it has. Rounding is half away from zero. `signDisplay: 'exceptZero'` draws a change ("+€20.00"), and `notation: 'compact'` rounds on purpose for a small tile. `sumByCurrency` adds amounts within a currency and never across two, and `parseMoney` and `moneyDecimal` read what a person typed into micros and write micros back as the decimal a document stores; a comma before exactly three digits is refused, since it groups thousands for some readers and marks decimals for others. A currency code is read as ISO writes it, so `usd` is USD. For display only: a vendor's own amounts follow the vendor's table. Stories: `Money` Currencies, Signs And Notation, Totals Per Currency.
|
|
216
|
+
- **`MoneyField` is an amount a person types**, such as a spending cap: the text as typed and never a number, the currency inside the field after the amount and read as its description, and a placeholder in the currency's own digits. `moneyFieldProblem` says why an amount is refused in the currency's own terms ("EUR takes at most 2 decimal places."). Stories: `MoneyField` Euros, Yen, Kuwaiti Dinar, Too Many Digits.
|
|
217
|
+
- **`Rating` draws stars, read only**: a review's stars or an app's average to the nearest half star, named by the figure it draws, to a tenth in the reader's locale ("Rated 4.6 out of 5"), in the text's ink and the control edge rather than the warning hue, as the sheet's rating cells are. Stories: `Rating` One Review, Average, Scale.
|
|
218
|
+
- **`ProposalCard` takes `reply`** (`ProposalReply`: `label`, `value`, `onValueChange`, `help`): an optional note the person writes to send back with the decision, under the change while the card can be decided, held while it is carried out and gone once it is settled. Stories: `ProposalCard` Ad Spend Pending, Ad Spend Step Up, Ad Spend Applying, Ad Spend Stale, Public Post Batch.
|
|
219
|
+
- **`@crewlethq/icons` draws nine marketing, growth and app store tiles** with generic glyphs of their own (`google-ads`, `google-adsense`, `google-admob`, `google-analytics`, `google-search-console`, `google-play`, `app-store-connect`, `apple-ads`, `meta-ads`), because their owners allow a third party none of their product icons without leave. Story: `VendorMark` Growth Glyphs.
|
|
220
|
+
|
|
221
|
+
What to change: nothing is required.
|
|
222
|
+
|
|
223
|
+
## Changes in 0.164.0
|
|
224
|
+
|
|
225
|
+
### A map stays fitted when its cards are measured anew
|
|
226
|
+
|
|
227
|
+
**`Canvas` takes `refitKey`**, the sizes its content is drawn at. When it changes, a view still at its last fit fits again, and a view the reader has moved stays; a data push alone still never refits. **`GraphCanvas` passes the sizes its probes measure**, so a card width set through `--crewlet-graph-canvas-card-width`, a density or a font size that changes under a map nobody has moved fits it again. A caller that set a new card width and a new `fitKey` in one render had the fit land on the old layout, since the card's probe measures the new width only after that render.
|
|
228
|
+
|
|
211
229
|
## Changes in 0.161.0
|
|
212
230
|
|
|
213
231
|
### Cards and lists that say what is true, once, to every reader
|
package/dist/Canvas/Canvas.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A pannable, zoomable viewport over positioned content that wires pointers,
|
|
3
3
|
* wheels and keys to `geometry.ts`. It fits once, on the first measured layout,
|
|
4
|
-
* then only on request
|
|
4
|
+
* then only on request, on a resize of an untouched fit (`refitOnResize`), or
|
|
5
|
+
* when an untouched fit's content is drawn at new sizes (`refitKey`).
|
|
5
6
|
*/
|
|
6
7
|
import { type ReactNode, type Ref } from 'react';
|
|
7
8
|
import { type CanvasPoint, type CanvasRect, type CanvasSize, type CanvasView } from './geometry.js';
|
|
@@ -177,6 +178,12 @@ export interface CanvasProps {
|
|
|
177
178
|
* fit runs its own refit.
|
|
178
179
|
*/
|
|
179
180
|
refitOnResize?: boolean | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* The sizes the content is drawn at, such as its items measured from the
|
|
183
|
+
* stylesheet. A new value refits a view still at its last fit, and keeps one
|
|
184
|
+
* the reader moved; a data push alone never refits.
|
|
185
|
+
*/
|
|
186
|
+
refitKey?: unknown;
|
|
180
187
|
/**
|
|
181
188
|
* Whether one finger can pan the canvas, after the tap that activates it.
|
|
182
189
|
* Off, one finger always scrolls the page and only a pinch reaches it.
|
|
@@ -200,7 +207,7 @@ export interface CanvasProps {
|
|
|
200
207
|
ref?: Ref<CanvasHandle> | undefined;
|
|
201
208
|
className?: string | undefined;
|
|
202
209
|
}
|
|
203
|
-
export declare function Canvas({ label, content, children, overlay, controls, controlsPlacement, controlsExtra, controlsActualSize, controlsBelow, controlsStart, overlayEnd, hint, largestItemWidth, dimmed, ground, minZoom, cursor, refitOnResize, touch, labels, onReady, onViewChange, initialView, ref, className, }: CanvasProps): import("react").JSX.Element;
|
|
210
|
+
export declare function Canvas({ label, content, children, overlay, controls, controlsPlacement, controlsExtra, controlsActualSize, controlsBelow, controlsStart, overlayEnd, hint, largestItemWidth, dimmed, ground, minZoom, cursor, refitOnResize, refitKey, touch, labels, onReady, onViewChange, initialView, ref, className, }: CanvasProps): import("react").JSX.Element;
|
|
204
211
|
/**
|
|
205
212
|
* Where a `grid` ground's dots fall for a view: their screen pitch (one to two
|
|
206
213
|
* dotted steps, halving or doubling with the zoom) and the screen point one
|
package/dist/Canvas/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, CANVAS_FIT_PADDING, CANVAS_FOCUS_CONTEXT, CANVAS_MAX_ZOOM, CANVAS_MIN_ZOOM, CANVAS_PAN_MARGIN, CANVAS_PAN_STEP, CANVAS_REVEAL_PADDING, CANVAS_TAP_SLOP, CANVAS_WHEEL_LINE_PX, CANVAS_WHEEL_ZOOM_PER_PIXEL, CANVAS_ZOOM_CEILING, CANVAS_ZOOM_LIMITS, CANVAS_ZOOM_STEP, Canvas, IDENTITY_VIEW, ShortcutTip, anchorView, beyondSlop, clampPan, clampZoom, fitView, gridOf, panBy, pinchView, regionView, revealView, screenRect, toScreen, toWorld, wheelPixels, wheelZoomFactor, zoomAt, zoomLimits } from '../chunk-
|
|
1
|
+
export { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, CANVAS_FIT_PADDING, CANVAS_FOCUS_CONTEXT, CANVAS_MAX_ZOOM, CANVAS_MIN_ZOOM, CANVAS_PAN_MARGIN, CANVAS_PAN_STEP, CANVAS_REVEAL_PADDING, CANVAS_TAP_SLOP, CANVAS_WHEEL_LINE_PX, CANVAS_WHEEL_ZOOM_PER_PIXEL, CANVAS_ZOOM_CEILING, CANVAS_ZOOM_LIMITS, CANVAS_ZOOM_STEP, Canvas, IDENTITY_VIEW, ShortcutTip, anchorView, beyondSlop, clampPan, clampZoom, fitView, gridOf, panBy, pinchView, regionView, revealView, screenRect, toScreen, toWorld, wheelPixels, wheelZoomFactor, zoomAt, zoomLimits } from '../chunk-DUTG73M4.js';
|
|
2
2
|
import '../chunk-CUEPPDBC.js';
|
|
3
3
|
import '../chunk-VBBLHS2Y.js';
|
|
4
4
|
import '../chunk-34K3XN47.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { BOARD_NAME_MIN_CHARS, CANVAS_BOARD_MAX_LIVE, CANVAS_BOARD_MIN_LIVE_WIDTH, CANVAS_BOARD_MIN_ZOOM, CANVAS_NOTE_COLORS, CanvasBoard, TITLE_GLYPH_EM, boardName, boardRoom, liveBoards, titleSize } from '../chunk-
|
|
1
|
+
export { BOARD_NAME_MIN_CHARS, CANVAS_BOARD_MAX_LIVE, CANVAS_BOARD_MIN_LIVE_WIDTH, CANVAS_BOARD_MIN_ZOOM, CANVAS_NOTE_COLORS, CanvasBoard, TITLE_GLYPH_EM, boardName, boardRoom, liveBoards, titleSize } from '../chunk-ABA5XK5H.js';
|
|
2
2
|
import '../chunk-YJPQJVRJ.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-JSW2QOGC.js';
|
|
4
4
|
import '../chunk-NPEI2QAN.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-DUTG73M4.js';
|
|
6
6
|
import '../chunk-CUEPPDBC.js';
|
|
7
7
|
import '../chunk-VBBLHS2Y.js';
|
|
8
8
|
import '../chunk-34K3XN47.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CanvasToolbar, toolForKey } from '../chunk-
|
|
1
|
+
export { CanvasToolbar, toolForKey } from '../chunk-JSW2QOGC.js';
|
|
2
2
|
import '../chunk-NPEI2QAN.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-DUTG73M4.js';
|
|
4
4
|
import '../chunk-CUEPPDBC.js';
|
|
5
5
|
import '../chunk-VBBLHS2Y.js';
|
|
6
6
|
import '../chunk-34K3XN47.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { GRAPH_CANVAS_DETAIL_ZOOM, GRAPH_CANVAS_FIT_FLOOR, GRAPH_CANVAS_FLOW_LIMIT, GRAPH_CANVAS_FOCUS_ZOOM, GRAPH_CANVAS_LABELS, GRAPH_CANVAS_NARROW_WIDTH, GRAPH_CANVAS_TILE_ZOOM, GRAPH_EDGE_FAMILIES, GRAPH_ORDER_SWEEPS, GraphCanvas, graphDetail, graphFocusView, graphItemKey, graphNeighbourhood, graphReach, graphStep, graphTrunks, graphWindow, layoutGraph, placeTrunkLabels, routeGraphEdges } from '../chunk-
|
|
1
|
+
export { GRAPH_CANVAS_DETAIL_ZOOM, GRAPH_CANVAS_FIT_FLOOR, GRAPH_CANVAS_FLOW_LIMIT, GRAPH_CANVAS_FOCUS_ZOOM, GRAPH_CANVAS_LABELS, GRAPH_CANVAS_NARROW_WIDTH, GRAPH_CANVAS_TILE_ZOOM, GRAPH_EDGE_FAMILIES, GRAPH_ORDER_SWEEPS, GraphCanvas, graphDetail, graphFocusView, graphItemKey, graphNeighbourhood, graphReach, graphStep, graphTrunks, graphWindow, layoutGraph, placeTrunkLabels, routeGraphEdges } from '../chunk-BDDJI6NA.js';
|
|
2
2
|
import '../chunk-MY374UUD.js';
|
|
3
3
|
import '../chunk-37FXQ4TH.js';
|
|
4
4
|
import '../chunk-L6HUVA33.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-DUTG73M4.js';
|
|
6
6
|
import '../chunk-CUEPPDBC.js';
|
|
7
7
|
import '../chunk-475DOAWF.js';
|
|
8
8
|
import '../chunk-WSIJDWUG.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import { type FormatMoneyOptions, type Micros } from './amounts.js';
|
|
3
|
+
export interface MoneyProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'>, FormatMoneyOptions {
|
|
4
|
+
/** The amount in micros of `currency` (one unit is 1,000,000): a bigint, a safe integer or a decimal integer string. */
|
|
5
|
+
micros: Micros;
|
|
6
|
+
/** The ISO 4217 code the amount is in: `EUR`, `JPY`, `KWD`. */
|
|
7
|
+
currency: string;
|
|
8
|
+
/** The locale it is read in. Defaults to the reader's own. */
|
|
9
|
+
locale?: string | readonly string[] | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An amount of money, drawn from integer micros and never through a float
|
|
13
|
+
* (`formatMoney`): "€1,250.00", "¥3,400", "KWD 1.250".
|
|
14
|
+
*
|
|
15
|
+
* ONE CURRENCY PER FIGURE. It draws one amount in the currency it was given
|
|
16
|
+
* and adds nothing to it: a total over several currencies is one figure per
|
|
17
|
+
* currency (`sumByCurrency`), never a sum that adds euros to yen.
|
|
18
|
+
*
|
|
19
|
+
* TABULAR AND WHOLE. Its digits take one width each, so a column of amounts
|
|
20
|
+
* lines up, and it never breaks across lines, where "€1,250." over ".00"
|
|
21
|
+
* reads as two figures.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Money({ micros, currency, locale, signDisplay, currencyDisplay, notation, className, ...rest }: MoneyProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Money as integer micros: one unit of a currency is 1,000,000 micros.
|
|
3
|
+
*
|
|
4
|
+
* NEVER A FLOAT. A float holds 0.1 as 0.1000000000000000055 and loses whole
|
|
5
|
+
* units past 2^53, so every step here is BigInt arithmetic on integer micros,
|
|
6
|
+
* and the one hand-off to `Intl.NumberFormat` is a decimal STRING already
|
|
7
|
+
* rounded to the currency's digits, which the formatter reads exactly.
|
|
8
|
+
*
|
|
9
|
+
* ISO 4217 DECIDES THE DIGITS, not the locale's data. CLDR draws some
|
|
10
|
+
* currencies with fewer digits than ISO lists (the Iraqi dinar with none,
|
|
11
|
+
* where ISO says three), so the table below is ISO's own List One, and the
|
|
12
|
+
* formatter is told the digits rather than asked for them.
|
|
13
|
+
*
|
|
14
|
+
* FOR DISPLAY ONLY. A vendor's own amounts follow the vendor's table (some
|
|
15
|
+
* differ from ISO), so nothing here may feed a spending cap or a comparison
|
|
16
|
+
* the engine makes. `parseMoney` reads what a person typed into micros, and
|
|
17
|
+
* the engine parses the decimal string again at its own edge.
|
|
18
|
+
*/
|
|
19
|
+
/** An amount in micros: a bigint, a safe integer, or a decimal integer string (`"-1250000"`). */
|
|
20
|
+
export type Micros = bigint | number | string;
|
|
21
|
+
/**
|
|
22
|
+
* The digits after the decimal point ISO 4217 gives `currency` (2 for EUR,
|
|
23
|
+
* 0 for JPY, 3 for KWD, 4 for CLF), or `undefined` for a code it does not
|
|
24
|
+
* list, in either case. Throws a `RangeError` for anything that is not a
|
|
25
|
+
* three-letter code.
|
|
26
|
+
*/
|
|
27
|
+
export declare function minorUnits(currency: string): number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Reads an amount in micros, exactly. A number must be a safe integer, since
|
|
30
|
+
* past 2^53 the value it holds is already not the one that was sent; a string
|
|
31
|
+
* must be a decimal integer. Anything else is a `RangeError`, never a guess.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toMicros(value: Micros): bigint;
|
|
34
|
+
/**
|
|
35
|
+
* `micros` as a plain decimal string with exactly `digits` after the point,
|
|
36
|
+
* rounded half away from zero: `decimalOf(1_235_000n, 2)` is `"1.24"`, and
|
|
37
|
+
* `decimalOf(-1_235_000n, 2)` is `"-1.24"`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function decimalOf(micros: bigint, digits: number): string;
|
|
40
|
+
export interface FormatMoneyOptions {
|
|
41
|
+
/** Whether a sign is drawn: `exceptZero` for a change ("+€20.00", "−€5.00"). Intl's own values. */
|
|
42
|
+
signDisplay?: 'auto' | 'always' | 'exceptZero' | 'never' | undefined;
|
|
43
|
+
/** How the currency is named: a symbol (the default), the ISO code, or its name. */
|
|
44
|
+
currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name' | undefined;
|
|
45
|
+
/** `compact` for a figure on a small tile ("€1.2K"). Rounds, so never where the exact amount matters. */
|
|
46
|
+
notation?: 'standard' | 'compact' | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `micros` of `currency` in the reader's words: `formatMoney(1_250_000n,
|
|
50
|
+
* 'EUR', 'en-US')` is "€1.25", and `formatMoney(1_250_000n, 'JPY', 'ja-JP')`
|
|
51
|
+
* is "¥1". Rounded half away from zero to the currency's ISO digits; a code
|
|
52
|
+
* ISO does not list is drawn with every digit it has, never rounded to a
|
|
53
|
+
* guess. `locale` defaults to the reader's own.
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatMoney(micros: Micros, currency: string, locale?: string | readonly string[], options?: FormatMoneyOptions): string;
|
|
56
|
+
/**
|
|
57
|
+
* What a person typed as an amount of `currency`, in micros, or the reason it
|
|
58
|
+
* is not one. Digits with at most one decimal point, no more digits after it
|
|
59
|
+
* than the currency has, and no sign, grouping or exponent: an amount typed
|
|
60
|
+
* into a cap or a budget is never negative. A full stop is the decimal point;
|
|
61
|
+
* a comma is read as one too, as many keyboards type it, except before
|
|
62
|
+
* exactly three digits, where "1,500" groups thousands for some readers and
|
|
63
|
+
* marks decimals for others, and is refused rather than guessed.
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseMoney(text: string, currency: string): {
|
|
66
|
+
micros: bigint;
|
|
67
|
+
} | {
|
|
68
|
+
problem: MoneyProblem;
|
|
69
|
+
};
|
|
70
|
+
/** Why a typed amount was refused. */
|
|
71
|
+
export type MoneyProblem = {
|
|
72
|
+
kind: 'empty';
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'not_an_amount';
|
|
75
|
+
}
|
|
76
|
+
/** A comma before exactly three digits, which reads as grouping to some and as decimals to others. */
|
|
77
|
+
| {
|
|
78
|
+
kind: 'ambiguous_comma';
|
|
79
|
+
}
|
|
80
|
+
/** More digits after the point than the currency has: `digits` is how many it takes. */
|
|
81
|
+
| {
|
|
82
|
+
kind: 'too_many_digits';
|
|
83
|
+
digits: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* `micros` as the decimal string a document stores ("50.00", "1500", "1.250"),
|
|
87
|
+
* at the currency's ISO digits: what a caps editor writes back.
|
|
88
|
+
*/
|
|
89
|
+
export declare function moneyDecimal(micros: Micros, currency: string): string;
|
|
90
|
+
/** One amount in one currency. */
|
|
91
|
+
export interface MoneyAmount {
|
|
92
|
+
micros: Micros;
|
|
93
|
+
currency: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* One total per currency, never one across them: euros and yen do not add.
|
|
97
|
+
* Exact (BigInt), in the order each currency first appears.
|
|
98
|
+
*/
|
|
99
|
+
export declare function sumByCurrency(amounts: Iterable<MoneyAmount>): {
|
|
100
|
+
currency: string;
|
|
101
|
+
micros: bigint;
|
|
102
|
+
}[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './Money.css';
|
|
2
|
+
export { Money } from './Money.js';
|
|
3
|
+
export type { MoneyProps } from './Money.js';
|
|
4
|
+
export { decimalOf, formatMoney, minorUnits, moneyDecimal, parseMoney, sumByCurrency, toMicros } from './amounts.js';
|
|
5
|
+
export type { FormatMoneyOptions, Micros, MoneyAmount, MoneyProblem } from './amounts.js';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type FocusEventHandler } from 'react';
|
|
2
|
+
import { type InputWidth } from '../Input/index.js';
|
|
3
|
+
/** Every sentence the field says about an amount it cannot take. */
|
|
4
|
+
export interface MoneyFieldLabels {
|
|
5
|
+
/** Why an empty field is not an amount, where one is required. */
|
|
6
|
+
empty: string;
|
|
7
|
+
/** Why what was typed is not an amount at all. */
|
|
8
|
+
notAnAmount: string;
|
|
9
|
+
/** Why a comma before three digits is refused: it groups thousands for some readers and marks decimals for others. */
|
|
10
|
+
ambiguousComma: string;
|
|
11
|
+
/** Why an amount has more digits after the point than its currency: "EUR takes at most 2 decimal places." */
|
|
12
|
+
tooManyDigits: (currency: string, digits: number) => string;
|
|
13
|
+
}
|
|
14
|
+
export declare const MONEY_FIELD_LABELS: MoneyFieldLabels;
|
|
15
|
+
/**
|
|
16
|
+
* Why `value` is not an amount of `currency`, in a sentence, or `null` where
|
|
17
|
+
* it is one. An empty value says `labels.empty`: whether an amount is
|
|
18
|
+
* required is the form's to decide, so it may ignore that one.
|
|
19
|
+
*/
|
|
20
|
+
export declare function moneyFieldProblem(value: string, currency: string, labels?: Partial<MoneyFieldLabels>): string | null;
|
|
21
|
+
export interface MoneyFieldProps {
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
/** What is typed, as typed: a plain decimal ("50.00"). Never a number, so nothing passes through a float. */
|
|
25
|
+
value: string;
|
|
26
|
+
onValueChange: (value: string) => void;
|
|
27
|
+
/** The ISO 4217 code the amount is in, drawn inside the field after the amount and read as its description. */
|
|
28
|
+
currency: string;
|
|
29
|
+
placeholder?: string | undefined;
|
|
30
|
+
/** Draws the field as refused. The sentence is the form's (`moneyFieldProblem`). */
|
|
31
|
+
error?: boolean | undefined;
|
|
32
|
+
disabled?: boolean | undefined;
|
|
33
|
+
readOnly?: boolean | undefined;
|
|
34
|
+
required?: boolean | undefined;
|
|
35
|
+
autoFocus?: boolean | undefined;
|
|
36
|
+
onBlur?: FocusEventHandler<HTMLInputElement> | undefined;
|
|
37
|
+
width?: InputWidth | undefined;
|
|
38
|
+
'aria-label'?: string | undefined;
|
|
39
|
+
'aria-describedby'?: string | undefined;
|
|
40
|
+
className?: string | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* An amount of money a person types: a spending cap, a budget.
|
|
44
|
+
*
|
|
45
|
+
* A STRING IN, A STRING OUT. The field never turns what is typed into a
|
|
46
|
+
* number, which would pass it through a float; `parseMoney` reads it into
|
|
47
|
+
* micros and `moneyDecimal` writes micros back as the decimal a document
|
|
48
|
+
* stores.
|
|
49
|
+
*
|
|
50
|
+
* THE CURRENCY IS INSIDE THE FIELD, after the amount, and is read as the
|
|
51
|
+
* field's description, so "50" is never read without saying fifty of what.
|
|
52
|
+
* The placeholder shows the currency's own digits ("0.00", "0", "0.000").
|
|
53
|
+
*/
|
|
54
|
+
export declare const MoneyField: import("react").ForwardRefExoticComponent<MoneyFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { MONEY_FIELD_LABELS, MoneyField, moneyFieldProblem } from '../chunk-OMMPRYHF.js';
|
|
2
|
+
import '../chunk-G6DKKJN6.js';
|
|
3
|
+
import '../chunk-XB3ITOJB.js';
|
|
4
|
+
import '../chunk-NICEDVZM.js';
|
|
5
|
+
import '../chunk-JLKO7PSK.js';
|
|
6
|
+
import '../chunk-PJV5HVZY.js';
|
|
7
|
+
import '../chunk-TEXK4RK6.js';
|
|
8
|
+
import '../chunk-XHTQ4X4P.js';
|
|
9
|
+
import '../chunk-TDFLCUBE.js';
|
|
10
|
+
import '../chunk-KIPOJKHG.js';
|
|
11
|
+
import '../chunk-L72URIHR.js';
|
|
12
|
+
import '../chunk-HTS5RJ7S.js';
|
|
13
|
+
import '../chunk-AVJKMQXK.js';
|
|
14
|
+
import '../chunk-EDPMHSLZ.js';
|
|
15
|
+
import '../chunk-4ITETIGZ.js';
|
|
16
|
+
import '../chunk-PQADV6P6.js';
|
|
17
|
+
import '../chunk-WGMKERCR.js';
|
|
18
|
+
import '../chunk-RRRK2KB6.js';
|
|
19
|
+
import '../chunk-ODEQTPFM.js';
|
|
@@ -47,6 +47,19 @@ export interface ProposalConfirmation {
|
|
|
47
47
|
*/
|
|
48
48
|
label: ReactNode;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* A note the person may send back with the decision, to whoever asked for it:
|
|
52
|
+
* why it was denied, or what to do next. Optional to write, and the host
|
|
53
|
+
* sends it with whichever answer is pressed.
|
|
54
|
+
*/
|
|
55
|
+
export interface ProposalReply {
|
|
56
|
+
/** The field's name: "Note to the agent". */
|
|
57
|
+
label: string;
|
|
58
|
+
value: string;
|
|
59
|
+
onValueChange: (value: string) => void;
|
|
60
|
+
/** A line under the field: "Sent with your answer.". */
|
|
61
|
+
help?: ReactNode;
|
|
62
|
+
}
|
|
50
63
|
/**
|
|
51
64
|
* Why the person's own decision was refused while the card stays open to
|
|
52
65
|
* another one: the approval was turned down (a fresh sign-in, a change that
|
|
@@ -230,6 +243,12 @@ export interface ProposalCardProps extends Omit<HTMLAttributes<HTMLElement>, 'ti
|
|
|
230
243
|
*/
|
|
231
244
|
notice?: ReactNode;
|
|
232
245
|
labels?: Partial<ProposalCardLabels> | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* A note the person may write to send back with the decision (see
|
|
248
|
+
* `ProposalReply`): a field under the change while the card can be decided,
|
|
249
|
+
* held while the decision is carried out, and gone once it is settled.
|
|
250
|
+
*/
|
|
251
|
+
reply?: ProposalReply | undefined;
|
|
233
252
|
/** Words for the change list. */
|
|
234
253
|
changeLabels?: Partial<ChangeListLabels> | undefined;
|
|
235
254
|
/** Words for the `DiffList` behind "Show the whole change". */
|
|
@@ -297,4 +316,4 @@ export interface ProposalCardProps extends Omit<HTMLAttributes<HTMLElement>, 'ti
|
|
|
297
316
|
* stays open (`expiresAt`), each with its glyph, so neither the sign-in check
|
|
298
317
|
* nor a refusal for lateness comes as a surprise.
|
|
299
318
|
*/
|
|
300
|
-
export declare function ProposalCard({ title, subtitle, state: given, scope, kind, summary, changes, changesHeading, note, details, tone, confirmation, approveLabel, onApprove, onDecline, onPrepareAgain, onRetry, receipt, failure, failureOutcome, failureHint, approveBlocked, decisionRefusal, caution, stepUp, expiresAt, notice: givenNotice, labels: overrides, changeLabels, diffLabels, className, ...rest }: ProposalCardProps): import("react").JSX.Element;
|
|
319
|
+
export declare function ProposalCard({ title, subtitle, state: given, scope, kind, summary, changes, changesHeading, note, details, tone, confirmation, approveLabel, onApprove, onDecline, onPrepareAgain, onRetry, receipt, failure, failureOutcome, failureHint, approveBlocked, decisionRefusal, caution, stepUp, expiresAt, notice: givenNotice, reply, labels: overrides, changeLabels, diffLabels, className, ...rest }: ProposalCardProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../VisuallyHidden/VisuallyHidden.css';
|
|
2
2
|
import './ProposalCard.css';
|
|
3
3
|
export { PROPOSAL_CARD_LABELS, PROPOSAL_FAILURE_OUTCOMES, PROPOSAL_STATES, PROPOSAL_TONES, ProposalCard } from './ProposalCard.js';
|
|
4
|
-
export type { ProposalCardLabels, ProposalCardProps, ProposalConfirmation, ProposalDecisionRefusal, ProposalFailureOutcome, ProposalKind, ProposalScope, ProposalState, ProposalTone, } from './ProposalCard.js';
|
|
4
|
+
export type { ProposalCardLabels, ProposalCardProps, ProposalConfirmation, ProposalDecisionRefusal, ProposalFailureOutcome, ProposalKind, ProposalReply, ProposalScope, ProposalState, ProposalTone, } from './ProposalCard.js';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export { PROPOSAL_CARD_LABELS, PROPOSAL_FAILURE_OUTCOMES, PROPOSAL_STATES, PROPOSAL_TONES, ProposalCard } from '../chunk-
|
|
1
|
+
export { PROPOSAL_CARD_LABELS, PROPOSAL_FAILURE_OUTCOMES, PROPOSAL_STATES, PROPOSAL_TONES, ProposalCard } from '../chunk-GCUJCO3W.js';
|
|
2
|
+
import '../chunk-DXC4K33F.js';
|
|
3
|
+
import '../chunk-657WR3MX.js';
|
|
2
4
|
import '../chunk-3XXFU4XP.js';
|
|
5
|
+
import '../chunk-ZJGGXYFS.js';
|
|
6
|
+
import '../chunk-KW7T23RT.js';
|
|
3
7
|
import '../chunk-5D7RMXM2.js';
|
|
4
8
|
import '../chunk-7XUP32RY.js';
|
|
5
9
|
import '../chunk-3GIGAGEG.js';
|
|
@@ -21,6 +25,7 @@ import '../chunk-PJV5HVZY.js';
|
|
|
21
25
|
import '../chunk-TEXK4RK6.js';
|
|
22
26
|
import '../chunk-34K3XN47.js';
|
|
23
27
|
import '../chunk-XSPCITPN.js';
|
|
28
|
+
import '../chunk-2YTOOH3A.js';
|
|
24
29
|
import '../chunk-XHTQ4X4P.js';
|
|
25
30
|
import '../chunk-TDFLCUBE.js';
|
|
26
31
|
import '../chunk-KIPOJKHG.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import { type GlyphSizeStep } from '@crewlethq/icons/glyphs';
|
|
3
|
+
/** Every sentence the rating says. */
|
|
4
|
+
export interface RatingLabels {
|
|
5
|
+
/** Its name, read in place of the stars, given the figure as written: "Rated 4.6 out of 5". */
|
|
6
|
+
name: (value: string, max: string) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare const RATING_LABELS: RatingLabels;
|
|
9
|
+
export interface RatingProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
10
|
+
/** The stars given: a whole number for one review, or an average ("4.6"), from 0 to `max`. */
|
|
11
|
+
value: number;
|
|
12
|
+
/** How many stars the scale has. Five by default. */
|
|
13
|
+
max?: number | undefined;
|
|
14
|
+
/** The locale the figure is written in. Defaults to the reader's own. */
|
|
15
|
+
locale?: string | undefined;
|
|
16
|
+
/** The stars' step. `sm` by default, a line of text's. */
|
|
17
|
+
size?: GlyphSizeStep | undefined;
|
|
18
|
+
/** Draws the figure after the stars, for an average whose half stars cannot say 4.6 from 4.4. */
|
|
19
|
+
showValue?: boolean | undefined;
|
|
20
|
+
labels?: Partial<RatingLabels> | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A star rating, read only: a review's stars, or an app's average.
|
|
24
|
+
*
|
|
25
|
+
* TO THE NEAREST HALF STAR, READ EXACTLY. An average fills the stars it rounds
|
|
26
|
+
* to by halves, and its name says the figure itself ("Rated 4.6 out of 5"),
|
|
27
|
+
* so the picture and the words never disagree about anything but the
|
|
28
|
+
* rounding a picture needs. `showValue` draws the figure too.
|
|
29
|
+
*
|
|
30
|
+
* A QUANTITY, NOT A STATE: the stars take the text's ink and the control
|
|
31
|
+
* edge, never the warning hue, which read as an alert (as the sheet's rating
|
|
32
|
+
* cells do). A half star is a filled star cut at its middle, by a class
|
|
33
|
+
* rather than a style attribute a strict Content-Security-Policy would refuse.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Rating({ value, max, locale, size, showValue, labels: overrides, className, ...rest }: RatingProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.crewlet-rating {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--spacing-1);
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.crewlet-rating__star {
|
|
9
|
+
position: relative;
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* A RATING IS A QUANTITY, not a state: the ink and the control edge, never
|
|
14
|
+
the warning hue, which read as an alert. */
|
|
15
|
+
.crewlet-rating__off {
|
|
16
|
+
color: var(--color-border-strong);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.crewlet-rating__on {
|
|
20
|
+
position: absolute;
|
|
21
|
+
inset: 0;
|
|
22
|
+
color: var(--color-text-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Half a star is the filled star cut at its middle, from the reading side. */
|
|
26
|
+
.crewlet-rating__on--half {
|
|
27
|
+
clip-path: inset(0 50% 0 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.crewlet-rating__on--half:dir(rtl) {
|
|
31
|
+
clip-path: inset(0 0 0 50%);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.crewlet-rating__value {
|
|
35
|
+
margin-inline-start: var(--spacing-1);
|
|
36
|
+
color: var(--color-text-secondary);
|
|
37
|
+
font-variant-numeric: tabular-nums;
|
|
38
|
+
}
|
package/dist/TreeCanvas/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { TREE_ADD_MARK_MIN_ZOOM, TreeCanvas } from '../chunk-
|
|
1
|
+
export { TREE_ADD_MARK_MIN_ZOOM, TreeCanvas } from '../chunk-OKIAXHI6.js';
|
|
2
2
|
import '../chunk-MY374UUD.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-DUTG73M4.js';
|
|
4
4
|
import '../chunk-CUEPPDBC.js';
|
|
5
5
|
import '../chunk-SK4BIFTG.js';
|
|
6
6
|
import '../chunk-COS6LJ4K.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { formatMoney } from './chunk-G6DKKJN6.js';
|
|
2
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
+
import './Money-SAHKH4UT.css';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Money({ micros, currency, locale, signDisplay, currencyDisplay, notation, className, ...rest }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"span",
|
|
9
|
+
{
|
|
10
|
+
...rest,
|
|
11
|
+
className: cx("crewlet-money", className),
|
|
12
|
+
"data-currency": currency,
|
|
13
|
+
children: formatMoney(micros, currency, locale, { signDisplay, currencyDisplay, notation })
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Money };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Note } from './chunk-YJPQJVRJ.js';
|
|
2
|
-
import { CanvasToolbar, toolForKey } from './chunk-
|
|
3
|
-
import { IDENTITY_VIEW, Canvas } from './chunk-
|
|
2
|
+
import { CanvasToolbar, toolForKey } from './chunk-JSW2QOGC.js';
|
|
3
|
+
import { IDENTITY_VIEW, Canvas } from './chunk-DUTG73M4.js';
|
|
4
4
|
import { IconButton } from './chunk-XHTQ4X4P.js';
|
|
5
5
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
6
|
import './CanvasBoard-U6LR5F6H.css';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMeasuredSizes, isTypeAheadKey, typeAheadBuffer } from './chunk-MY374UUD.js';
|
|
2
2
|
import { FullscreenToggle } from './chunk-37FXQ4TH.js';
|
|
3
3
|
import { FilterChip } from './chunk-L6HUVA33.js';
|
|
4
|
-
import { CANVAS_FIT_PADDING, Canvas } from './chunk-
|
|
4
|
+
import { CANVAS_FIT_PADDING, Canvas } from './chunk-DUTG73M4.js';
|
|
5
5
|
import { Text } from './chunk-475DOAWF.js';
|
|
6
6
|
import { LayerHost } from './chunk-AVJKMQXK.js';
|
|
7
7
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
@@ -1193,6 +1193,7 @@ function GraphCanvas({
|
|
|
1193
1193
|
margin: pad.height
|
|
1194
1194
|
};
|
|
1195
1195
|
}, [measured, sizes]);
|
|
1196
|
+
const drawnAt = useMemo(() => metrics ? JSON.stringify(metrics) : null, [metrics]);
|
|
1196
1197
|
const emptyLanes = useMemo(() => {
|
|
1197
1198
|
const filled2 = new Set(nodes.map((node) => node.lane));
|
|
1198
1199
|
return bands.flatMap((band) => band.lanes.filter((lane) => !filled2.has(lane.id)));
|
|
@@ -1798,6 +1799,7 @@ function GraphCanvas({
|
|
|
1798
1799
|
labels: text,
|
|
1799
1800
|
minZoom,
|
|
1800
1801
|
refitOnResize: true,
|
|
1802
|
+
refitKey: drawnAt,
|
|
1801
1803
|
initialView: opening,
|
|
1802
1804
|
onViewChange: viewChanged,
|
|
1803
1805
|
children: [
|
|
@@ -194,6 +194,7 @@ function Canvas({
|
|
|
194
194
|
minZoom = CANVAS_MIN_ZOOM,
|
|
195
195
|
cursor = "hand",
|
|
196
196
|
refitOnResize = false,
|
|
197
|
+
refitKey,
|
|
197
198
|
touch = true,
|
|
198
199
|
labels,
|
|
199
200
|
onReady,
|
|
@@ -324,6 +325,14 @@ function Canvas({
|
|
|
324
325
|
if (untouched) fitted.current = viewNow.current;
|
|
325
326
|
}
|
|
326
327
|
}, [ready, size, content, apply, fitOf, refitOnResize]);
|
|
328
|
+
const refitSeen = useRef(refitKey);
|
|
329
|
+
useLayoutEffect(() => {
|
|
330
|
+
const changed = !Object.is(refitSeen.current, refitKey);
|
|
331
|
+
refitSeen.current = refitKey;
|
|
332
|
+
if (!ready || !changed || !content || !sameView(fitted.current, viewNow.current)) return;
|
|
333
|
+
apply(fitOf(content), false);
|
|
334
|
+
fitted.current = viewNow.current;
|
|
335
|
+
}, [ready, refitKey, content, apply, fitOf]);
|
|
327
336
|
const reportView = useRef(onViewChange);
|
|
328
337
|
reportView.current = onViewChange;
|
|
329
338
|
useLayoutEffect(() => {
|