@softure-ai/theme-notion 0.18.0 → 0.20.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/CHANGELOG.md +19 -0
- package/README.md +32 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/notion/ResizeHandle.d.ts +25 -0
- package/dist/notion/ResizeHandle.d.ts.map +1 -0
- package/dist/notion/ResizeHandle.js +70 -0
- package/dist/notion/ResizeHandle.js.map +1 -0
- package/dist/notion/SidePanel.d.ts +2 -1
- package/dist/notion/SidePanel.d.ts.map +1 -1
- package/dist/notion/SidePanel.js +2 -2
- package/dist/notion/SidePanel.js.map +1 -1
- package/dist/notion/clamp-size.d.ts +8 -0
- package/dist/notion/clamp-size.d.ts.map +1 -0
- package/dist/notion/clamp-size.js +12 -0
- package/dist/notion/clamp-size.js.map +1 -0
- package/dist/sft-bridge.css +41 -33
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/notion/ResizeHandle.tsx +123 -0
- package/src/notion/SidePanel.tsx +8 -3
- package/src/notion/clamp-size.ts +11 -0
- package/src/sft-bridge.css +41 -33
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done").
|
|
6
6
|
|
|
7
|
+
## 0.20.0
|
|
8
|
+
|
|
9
|
+
- `ResizeHandle` (#1311): a vertical handle on a column's right edge that a pointer drags, or the keyboard steps, to set
|
|
10
|
+
the column's width within `min` and `max`; a double click restores `defaultValue`. A focusable `separator`
|
|
11
|
+
(`aria-controls`, `aria-valuenow/min/max`) that takes no width of its own and shows `ring` while hovered, focused or
|
|
12
|
+
dragged; hidden phone-wide. `onChange` on every width, `onCommit` when a drag, key or reset ends. `RESIZE_HANDLE_STEP` is
|
|
13
|
+
exported beside it, and `clampSize` from a plain module, so a Server Component can read a kept width with it.
|
|
14
|
+
- `SidePanel width` (#1311): optional pixel width on a wide screen; phone-wide `beside` and `list` still cover the canvas.
|
|
15
|
+
New optional prop only.
|
|
16
|
+
- Migration: none.
|
|
17
|
+
|
|
18
|
+
## 0.19.0
|
|
19
|
+
|
|
20
|
+
- `sft-bridge.css` re-points `@softure-ai/ui`'s `--sft-*` tokens everywhere, not only inside a `PageFrame`: on
|
|
21
|
+
`:root`, `.light`, `.dark` and `[data-theme]` as well, outside any `@layer`, so a ui component (a chat screen, a
|
|
22
|
+
card, a form) in the app shell or in a `.dark` band takes the Notion colours, fonts, radii and shadows. Same API and
|
|
23
|
+
imports. Visible change: ui components outside a frame that showed ui's default look now show the theme's; an app
|
|
24
|
+
that wants a token of its own writes its `--sft-*` rule after the import (#1260).
|
|
25
|
+
|
|
7
26
|
## 0.18.0
|
|
8
27
|
|
|
9
28
|
- `DocumentViewer`, `DocumentList`, `DocumentRow` (#1256): documents shown inside the page, never in a new browser
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm i @softure-ai/theme-notion tailwindcss @tailwindcss/postcss
|
|
|
15
15
|
/* app/globals.css */
|
|
16
16
|
@import "tailwindcss";
|
|
17
17
|
@import "@softure-ai/theme-notion/theme.css"; /* tokens, utilities, dark:, animations, the components' classes */
|
|
18
|
-
@import "@softure-ai/theme-notion/sft-bridge.css"; /* optional:
|
|
18
|
+
@import "@softure-ai/theme-notion/sft-bridge.css"; /* optional: @softure-ai/ui components and package pages */
|
|
19
19
|
@import "@softure-ai/theme-notion/base.css"; /* body on the theme's background, text colour and font */
|
|
20
20
|
@import "@softure-ai/theme-notion/page.css"; /* body text 14 px, blue text selection, font smoothing */
|
|
21
21
|
@import "@softure-ai/theme-notion/maplibre.css"; /* only if the app shows MapLibre maps */
|
|
@@ -29,6 +29,12 @@ manager layout.
|
|
|
29
29
|
`theme.css` names the package's components as Tailwind sources, so their classes are generated without the app
|
|
30
30
|
listing `node_modules`. It clears Tailwind's default palette: only the theme's colours exist as utilities.
|
|
31
31
|
|
|
32
|
+
**`@softure-ai/ui` components on the theme.** `sft-bridge.css` points ui's `--sft-*` tokens (colours, fonts, radii,
|
|
33
|
+
shadows) at the Notion tokens on every scheme scope (`:root`, `.light`, `.dark`, `[data-theme]`) and in every
|
|
34
|
+
`PageFrame`, outside any `@layer`, so a ui component takes the theme wherever it sits: a chat panel in the app shell,
|
|
35
|
+
a card in a `.dark` band, or a package page (sign-in, OAuth consent) in a `PageFrame`. Spacing, text sizes and
|
|
36
|
+
durations stay ui's. An app that wants another value for one token writes its own `--sft-*` rule after the import.
|
|
37
|
+
|
|
32
38
|
An app that also renders pages of the SOFTURE packages (on `@softure-ai/ui`'s `--sft-*` tokens) keeps their base by
|
|
33
39
|
taking the scoped preflight instead of Tailwind's:
|
|
34
40
|
|
|
@@ -131,8 +137,8 @@ field, input, input-group, item, kbd, label, popover, progress, radio-group, scr
|
|
|
131
137
|
sidebar, skeleton, sonner (`Toaster`), spinner, switch, table, tabs, textarea, tooltip. Compositions: `Status` (badge, icon,
|
|
132
138
|
word), `PageHeader` (breadcrumb, icon box, title, description, actions), `PropertyList` (fields of one record),
|
|
133
139
|
`DetailTable` (an item's details as a label and value table), `FoldRow` (a list row folding open to a `DetailTable`
|
|
134
|
-
and more, a native `<details>`), `PageFrame` (a page outside the app shell,
|
|
135
|
-
`SidePanel` (a non-modal panel at a side of a canvas, below), `AsidePanelProvider`, `AsidePanelToggle`,
|
|
140
|
+
and more, a native `<details>`), `PageFrame` (a page outside the app shell, such as a package's sign-in page),
|
|
141
|
+
`SidePanel` (a non-modal panel at a side of a canvas, below), `ResizeHandle` (a drag handle that sets a column's width, below), `AsidePanelProvider`, `AsidePanelToggle`,
|
|
136
142
|
`AsidePanel` and `AsidePanelSidebarOpener` (a panel slid in from the right of the app shell, beside the content, below), `SheetMenu`, `SheetMenuItem` and `SheetMenuButton`
|
|
137
143
|
(navigation rows in a side `Sheet`, a phone's drawer, below), `TabBar` (a screen's tabs as links with an optional icon
|
|
138
144
|
and count, the shown tab in the address; `Tabs` keeps it in client state), `MarkPopover` (a counted tag that opens a
|
|
@@ -237,6 +243,26 @@ Escape inside or the close button calls `onClose`, and the caller moves focus ba
|
|
|
237
243
|
</div>
|
|
238
244
|
```
|
|
239
245
|
|
|
246
|
+
`SidePanel width` (pixels, optional) sets its width on a wide screen; phone-wide `beside` and `list` keep covering the
|
|
247
|
+
canvas.
|
|
248
|
+
|
|
249
|
+
**`ResizeHandle`.** A vertical handle on the right edge of a column (a list, a `SidePanel layout="list"`) that sets the
|
|
250
|
+
column's width: a pointer drags it, the arrow keys step it by `RESIZE_HANDLE_STEP` (16 px, Shift four times that), Home
|
|
251
|
+
and End go to `min` and `max`, a double click restores `defaultValue`. It is a focusable `separator` naming its column
|
|
252
|
+
with `aria-controls` and the width with `aria-valuenow`; it takes no width of its own (it lies over the border between
|
|
253
|
+
the columns) and shows `ring` while hovered, focused or dragged; hidden phone-wide. `onChange` gets every width,
|
|
254
|
+
`onCommit` the width once a drag, key or reset ends (the moment to keep it, e.g. in a cookie). `clampSize(value, min,
|
|
255
|
+
max, fallback)` (a plain module, callable in a Server Component) reads a kept width back within the limits.
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
<div className="relative flex h-full">
|
|
259
|
+
<SidePanel id="days" heading="Days" layout="list" isOpen onClose={close} width={width}>…</SidePanel>
|
|
260
|
+
<ResizeHandle label={copy.resizeDays} controls="days" value={width} min={240} max={480} defaultValue={384}
|
|
261
|
+
onChange={setWidth} onCommit={keepWidth} />
|
|
262
|
+
<Map className="flex-1" />
|
|
263
|
+
</div>
|
|
264
|
+
```
|
|
265
|
+
|
|
240
266
|
**`AsidePanel`.** A column of the app shell that slides in from the right, beside `SidebarInset`: the content
|
|
241
267
|
narrows next to it and stays usable (`SidePanel` is a panel over a canvas instead). `AsidePanelProvider` replaces
|
|
242
268
|
`SidebarProvider` (every other prop passes through) and keeps one side panel open at a time: while the panel is open
|
|
@@ -799,6 +825,9 @@ on every pull request that touches `themes/`.
|
|
|
799
825
|
every class in the parity fixture generates CSS on the theme (no unknown token, no cleared default colour).
|
|
800
826
|
6. **Visual regression** (`visual/gallery.spec.ts`): the gallery and each overlay at 1440 and 390 px, light and dark,
|
|
801
827
|
against `visual/baselines/`, in Playwright's Chromium with fonts from npm packages.
|
|
828
|
+
`visual/bridge.spec.ts` does the same for `@softure-ai/ui` components wired as the README says (ui's styles, the
|
|
829
|
+
scoped preflight, the theme, the bridge): the same screen in the app shell, in a `PageFrame` and in a `.dark` band,
|
|
830
|
+
each of ui's colour tokens checked against the Notion colour it paints, a baseline and axe.
|
|
802
831
|
7. **Accessibility**: axe (WCAG 2.1 A and AA, colour contrast included) on the same pages; the token pairs in
|
|
803
832
|
`tests/contrast.test.ts` (see Contrast above) run in `npm test`.
|
|
804
833
|
8. **Inventory** (`tests/inventory.test.ts`): exports, files, the README's component list and the gallery agree.
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
|
|
|
55
55
|
export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
|
|
56
56
|
export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
|
|
57
57
|
export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
|
|
58
|
+
export { clampSize, RESIZE_HANDLE_STEP } from "./notion/clamp-size.js";
|
|
59
|
+
export { ResizeHandle, type ResizeHandleProps } from "./notion/ResizeHandle.js";
|
|
58
60
|
export { RouteLoading, type RouteLoadingProps } from "./notion/RouteLoading.js";
|
|
59
61
|
export { SheetMenu, SheetMenuButton, SheetMenuItem, type SheetMenuButtonProps } from "./notion/SheetMenu.js";
|
|
60
62
|
export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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from "./notion/PageFrame.js";
|
|
58
58
|
export { PageHeader } from "./notion/PageHeader.js";
|
|
59
59
|
export { PropertyList } from "./notion/PropertyList.js";
|
|
60
|
+
export { clampSize, RESIZE_HANDLE_STEP } from "./notion/clamp-size.js";
|
|
61
|
+
export { ResizeHandle } from "./notion/ResizeHandle.js";
|
|
60
62
|
export { RouteLoading } from "./notion/RouteLoading.js";
|
|
61
63
|
export { SheetMenu, SheetMenuButton, SheetMenuItem } from "./notion/SheetMenu.js";
|
|
62
64
|
export { SidePanel } from "./notion/SidePanel.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cA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AE,eAAe,EAAE,aAAa,EAA6B,MAAM,uBAAuB,CAAC;AAC7G,OAAO,EAAE,SAAS,EAA6C,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,YAAY,GAQb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,GAOV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAA+E,MAAM,uBAAuB,CAAC;AAC/H,OAAO,EAAE,QAAQ,EAA4C,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAoE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAqC,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAA0G,MAAM,sBAAsB,CAAC;AACxJ,OAAO,EAAE,aAAa,EAA2B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAqB,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GAOf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAA0C,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,GAQX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ResizeHandleProps {
|
|
2
|
+
/** The handle's accessible name, from the app's message layer (e.g. "Resize the plan column"). */
|
|
3
|
+
readonly label: string;
|
|
4
|
+
/** The id of the column the handle resizes. */
|
|
5
|
+
readonly controls: string;
|
|
6
|
+
/** The column's width in pixels (controlled). */
|
|
7
|
+
readonly value: number;
|
|
8
|
+
readonly min: number;
|
|
9
|
+
readonly max: number;
|
|
10
|
+
/** The width a double click restores. */
|
|
11
|
+
readonly defaultValue: number;
|
|
12
|
+
/** Every new width, during a drag and on each key. */
|
|
13
|
+
readonly onChange: (value: number) => void;
|
|
14
|
+
/** The width once a drag, a key or the reset ends: the moment to keep it. */
|
|
15
|
+
readonly onCommit?: (value: number) => void;
|
|
16
|
+
readonly className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A vertical handle on the right edge of a column that a pointer drags, or the keyboard steps, to set the column's width.
|
|
20
|
+
* It takes no width of its own (it lies over the border between two columns) and shows the theme's ring colour while
|
|
21
|
+
* hovered, focused or dragged. Arrow keys step the width (Shift: four steps), Home and End go to the limits, a double
|
|
22
|
+
* click restores the default. Hidden phone-wide, where the columns stack.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ResizeHandle({ label, controls, value, min, max, defaultValue, onChange, onCommit, className }: ResizeHandleProps): import("react").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=ResizeHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/notion/ResizeHandle.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,iBAAiB;IAChC,kGAAkG;IAClG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAkFhI"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { clampSize, RESIZE_HANDLE_STEP } from "./clamp-size.js";
|
|
6
|
+
const LARGE_STEP_FACTOR = 4;
|
|
7
|
+
/**
|
|
8
|
+
* A vertical handle on the right edge of a column that a pointer drags, or the keyboard steps, to set the column's width.
|
|
9
|
+
* It takes no width of its own (it lies over the border between two columns) and shows the theme's ring colour while
|
|
10
|
+
* hovered, focused or dragged. Arrow keys step the width (Shift: four steps), Home and End go to the limits, a double
|
|
11
|
+
* click restores the default. Hidden phone-wide, where the columns stack.
|
|
12
|
+
*/
|
|
13
|
+
export function ResizeHandle({ label, controls, value, min, max, defaultValue, onChange, onCommit, className }) {
|
|
14
|
+
const dragRef = useRef(null);
|
|
15
|
+
const lastRef = useRef(value);
|
|
16
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
17
|
+
lastRef.current = value;
|
|
18
|
+
function change(next) {
|
|
19
|
+
const clamped = clampSize(next, min, max, defaultValue);
|
|
20
|
+
if (clamped !== lastRef.current) {
|
|
21
|
+
lastRef.current = clamped;
|
|
22
|
+
onChange(clamped);
|
|
23
|
+
}
|
|
24
|
+
return clamped;
|
|
25
|
+
}
|
|
26
|
+
function startDrag(event) {
|
|
27
|
+
if (event.button !== 0)
|
|
28
|
+
return;
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
31
|
+
dragRef.current = { pointerId: event.pointerId, startX: event.clientX, startValue: value };
|
|
32
|
+
setIsDragging(true);
|
|
33
|
+
}
|
|
34
|
+
function moveDrag(event) {
|
|
35
|
+
const drag = dragRef.current;
|
|
36
|
+
if (drag === null || drag.pointerId !== event.pointerId)
|
|
37
|
+
return;
|
|
38
|
+
change(drag.startValue + event.clientX - drag.startX);
|
|
39
|
+
}
|
|
40
|
+
function endDrag(event) {
|
|
41
|
+
const drag = dragRef.current;
|
|
42
|
+
if (drag === null || drag.pointerId !== event.pointerId)
|
|
43
|
+
return;
|
|
44
|
+
dragRef.current = null;
|
|
45
|
+
setIsDragging(false);
|
|
46
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
47
|
+
if (lastRef.current !== drag.startValue)
|
|
48
|
+
onCommit?.(lastRef.current);
|
|
49
|
+
}
|
|
50
|
+
function stepByKey(event) {
|
|
51
|
+
const step = event.shiftKey ? RESIZE_HANDLE_STEP * LARGE_STEP_FACTOR : RESIZE_HANDLE_STEP;
|
|
52
|
+
const targets = { ArrowLeft: value - step, ArrowRight: value + step, Home: min, End: max };
|
|
53
|
+
const target = targets[event.key];
|
|
54
|
+
if (target === undefined)
|
|
55
|
+
return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const before = value;
|
|
58
|
+
const next = change(target);
|
|
59
|
+
if (next !== before)
|
|
60
|
+
onCommit?.(next);
|
|
61
|
+
}
|
|
62
|
+
function restoreDefault() {
|
|
63
|
+
const before = value;
|
|
64
|
+
const next = change(defaultValue);
|
|
65
|
+
if (next !== before)
|
|
66
|
+
onCommit?.(next);
|
|
67
|
+
}
|
|
68
|
+
return (_jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": label, "aria-controls": controls, "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, tabIndex: 0, title: label, "data-slot": "resize-handle", "data-dragging": isDragging ? "true" : undefined, className: cn("relative z-4 -mx-1 w-2 flex-none cursor-col-resize touch-none select-none outline-none max-sm:hidden", "after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 after:-translate-x-1/2 after:bg-transparent after:transition-colors", "hover:after:bg-ring focus-visible:after:bg-ring data-[dragging=true]:after:bg-ring", className), onPointerDown: startDrag, onPointerMove: moveDrag, onPointerUp: endDrag, onPointerCancel: endDrag, onKeyDown: stepByKey, onDoubleClick: restoreDefault }));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=ResizeHandle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizeHandle.js","sourceRoot":"","sources":["../../src/notion/ResizeHandle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAyC,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,CAAC;AA0B5B;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAqB;IAC/H,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;I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C,SAAS,EAC9C,SAAS,EAAE,EAAE,CACX,sGAAsG,EACtG,+HAA+H,EAC/H,oFAAoF,EACpF,SAAS,CACV,EACD,aAAa,EAAE,SAAS,EACxB,aAAa,EAAE,QAAQ,EACvB,WAAW,EAAE,OAAO,EACpB,eAAe,EAAE,OAAO,EACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,cAAc,GAC7B,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -7,7 +7,8 @@ export interface SidePanelProps {
|
|
|
7
7
|
readonly isOpen: boolean;
|
|
8
8
|
readonly onClose: () => void;
|
|
9
9
|
readonly closeLabel?: string;
|
|
10
|
+
readonly width?: number;
|
|
10
11
|
readonly children: ReactNode;
|
|
11
12
|
}
|
|
12
|
-
export declare function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel, children }: SidePanelProps): import("react").JSX.Element;
|
|
13
|
+
export declare function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel, width, children }: SidePanelProps): import("react").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=SidePanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../src/notion/SidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../src/notion/SidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA6D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASlG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,cAAc;IAE7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAE7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAG7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAID,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAqC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,+BA6CzI"}
|
package/dist/notion/SidePanel.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Button } from "../ui/button.js";
|
|
|
7
7
|
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
8
8
|
// A non-modal panel at a side of a canvas (a map) that leaves the canvas usable. Its parent is a `relative` flex row
|
|
9
9
|
// holding the canvas and the panel. Hidden while closed, so its content leaves the reading order.
|
|
10
|
-
export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, children }) {
|
|
10
|
+
export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, width, children }) {
|
|
11
11
|
const panelRef = useRef(null);
|
|
12
12
|
const wasOpenRef = useRef(isOpen);
|
|
13
13
|
const headingId = `${id}-heading`;
|
|
@@ -23,6 +23,6 @@ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = m
|
|
|
23
23
|
event.stopPropagation();
|
|
24
24
|
onClose();
|
|
25
25
|
}
|
|
26
|
-
return (_jsxs("aside", { ref: panelRef, id: id, tabIndex: -1, "data-slot": "side-panel", className: "absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden", "data-layout": layout, hidden: !isOpen, "aria-labelledby": headingId, "data-testid": id, onKeyDown: closeOnEscape, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border py-2 pr-2 pl-4", children: [_jsx("h2", { id: headingId, className: "text-heading-3", children: heading }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": closeLabel, onClick: onClose, children: _jsx(X, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) })] }), _jsx("div", { "data-slot": "side-panel-content", className: "grid flex-1 content-start gap-3 overflow-y-auto p-3", children: children })] }));
|
|
26
|
+
return (_jsxs("aside", { ref: panelRef, id: id, tabIndex: -1, "data-slot": "side-panel", className: "absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden sm:data-[sized=true]:w-(--side-panel-width) sm:data-[sized=true]:flex-none", "data-layout": layout, "data-sized": width === undefined ? undefined : "true", style: width === undefined ? undefined : { "--side-panel-width": `${width}px` }, hidden: !isOpen, "aria-labelledby": headingId, "data-testid": id, onKeyDown: closeOnEscape, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border py-2 pr-2 pl-4", children: [_jsx("h2", { id: headingId, className: "text-heading-3", children: heading }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": closeLabel, onClick: onClose, children: _jsx(X, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) })] }), _jsx("div", { "data-slot": "side-panel-content", className: "grid flex-1 content-start gap-3 overflow-y-auto p-3", children: children })] }));
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=SidePanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanel.js","sourceRoot":"","sources":["../../src/notion/SidePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SidePanel.js","sourceRoot":"","sources":["../../src/notion/SidePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAA0D,MAAM,OAAO,CAAC;AAElG,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAsBrD,qHAAqH;AACrH,kGAAkG;AAClG,MAAM,UAAU,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,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AC,MAAM,gBAAa,UAAU,EAAE,OAAO,EAAE,OAAO,YACxF,KAAC,CAAC,mBAAa,MAAM,EAAC,WAAW,EAAE,iBAAiB,GAAI,GACjD,IACL,EACN,2BAAe,oBAAoB,EAAC,SAAS,EAAC,qDAAqD,YAChG,QAAQ,GACL,IACA,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A `ResizeHandle`'s keyboard step for an arrow key, in pixels; Shift takes four of them. */
|
|
2
|
+
export declare const RESIZE_HANDLE_STEP = 16;
|
|
3
|
+
/**
|
|
4
|
+
* `value` rounded and kept within `min` and `max`; a value that is not a finite number falls back to `fallback` (itself
|
|
5
|
+
* kept within the limits). Plain module, so a Server Component can read a kept width with it (#1311).
|
|
6
|
+
*/
|
|
7
|
+
export declare function clampSize(value: number, min: number, max: number, fallback?: number): number;
|
|
8
|
+
//# sourceMappingURL=clamp-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp-size.d.ts","sourceRoot":"","sources":["../../src/notion/clamp-size.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY,GAAG,MAAM,CAGjG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A `ResizeHandle`'s keyboard step for an arrow key, in pixels; Shift takes four of them. */
|
|
2
|
+
export const RESIZE_HANDLE_STEP = 16;
|
|
3
|
+
/**
|
|
4
|
+
* `value` rounded and kept within `min` and `max`; a value that is not a finite number falls back to `fallback` (itself
|
|
5
|
+
* kept within the limits). Plain module, so a Server Component can read a kept width with it (#1311).
|
|
6
|
+
*/
|
|
7
|
+
export function clampSize(value, min, max, fallback = min) {
|
|
8
|
+
if (!Number.isFinite(value))
|
|
9
|
+
return Math.min(Math.max(fallback, min), max);
|
|
10
|
+
return Math.min(Math.max(Math.round(value), min), max);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=clamp-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp-size.js","sourceRoot":"","sources":["../../src/notion/clamp-size.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,QAAQ,GAAW,GAAG;IACvF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/sft-bridge.css
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* The bridge from the `--sft-*` tokens of @softure-ai/ui to the Notion theme.
|
|
3
|
-
* (sign-in, password, MCP access, OAuth
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The bridge from the `--sft-*` tokens of @softure-ai/ui to the Notion theme. Every ui component (fields, cards,
|
|
3
|
+
* modals, toasts, the chat primitives) and the pages of the SOFTURE packages (sign-in, password, MCP access, OAuth
|
|
4
|
+
* consent) paint with `--sft-*`; here those tokens point at the Notion values, so they take the theme's colours, type,
|
|
5
|
+
* radii and shadows wherever they sit: in the app shell, in a panel, or in a `PageFrame`.
|
|
6
|
+
*
|
|
7
|
+
* On every scheme scope, not `:root` alone: a custom property holding `var()` resolves on the element that declares
|
|
8
|
+
* it and children inherit the result, so an alias on `:root` alone would freeze the root's values inside a `.dark`
|
|
9
|
+
* band of a light page. `[data-page-frame]` stays in the list for a frame inside such a band. Unlayered, so it beats
|
|
10
|
+
* ui's defaults in `@layer softure` on the same element; an app's own `--sft-*` rule after this import still wins.
|
|
11
|
+
* Spacing, text sizes and durations stay the package's: the scales already match, and the theme has no motion tokens.
|
|
8
12
|
*
|
|
9
13
|
* Import it after `theme.css`, through the app's Tailwind (it reads the theme with `--theme()`).
|
|
10
14
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
:root,
|
|
16
|
+
.light,
|
|
17
|
+
.dark,
|
|
18
|
+
[data-theme],
|
|
19
|
+
[data-page-frame] {
|
|
20
|
+
--sft-font-sans: --theme(--font-sans);
|
|
21
|
+
--sft-font-heading: --theme(--font-sans);
|
|
22
|
+
--sft-font-mono: --theme(--font-mono);
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
--sft-radius-control: --theme(--radius-md);
|
|
25
|
+
--sft-radius-card: --theme(--radius-lg);
|
|
26
|
+
--sft-radius-pill: --theme(--radius-full);
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
--sft-color-background: var(--background);
|
|
29
|
+
--sft-color-surface: var(--card);
|
|
30
|
+
--sft-color-surface-raised: var(--popover);
|
|
31
|
+
--sft-color-foreground: var(--foreground);
|
|
32
|
+
--sft-color-muted: var(--muted-foreground);
|
|
33
|
+
--sft-color-border: var(--border);
|
|
34
|
+
--sft-color-border-strong: var(--control-off);
|
|
35
|
+
--sft-color-accent: var(--primary);
|
|
36
|
+
--sft-color-accent-fill: var(--primary);
|
|
37
|
+
--sft-color-accent-fill-hover: var(--primary-hover);
|
|
38
|
+
--sft-color-on-accent: var(--primary-foreground);
|
|
39
|
+
--sft-color-danger: var(--red);
|
|
40
|
+
--sft-color-success: var(--green);
|
|
41
|
+
--sft-color-warning: var(--orange);
|
|
42
|
+
--sft-color-focus: var(--ring);
|
|
43
|
+
--sft-color-overlay: var(--overlay);
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
--sft-shadow-1: var(--shadow-card);
|
|
46
|
+
--sft-shadow-2: var(--shadow-dialog);
|
|
47
|
+
}
|
|
41
48
|
|
|
49
|
+
@layer base {
|
|
42
50
|
/* A page in a frame fills the window: no browser margin, the Notion background behind everything. */
|
|
43
51
|
body:has([data-page-frame]) {
|
|
44
52
|
margin: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/theme-notion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@softure-ai/theme-kit": "^0.1.4",
|
|
65
65
|
"class-variance-authority": "^0.7.1",
|
|
66
66
|
"cmdk": "^1.1.1",
|
|
67
|
-
"lucide-react": "^1.
|
|
67
|
+
"lucide-react": "^1.72.0",
|
|
68
68
|
"pdfjs-dist": "^6.5.438",
|
|
69
69
|
"radix-ui": "^1.8.1",
|
|
70
70
|
"sonner": "^2.0.8",
|
package/src/index.ts
CHANGED
|
@@ -71,6 +71,8 @@ export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
|
|
|
71
71
|
export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
|
|
72
72
|
export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
|
|
73
73
|
export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
|
|
74
|
+
export { clampSize, RESIZE_HANDLE_STEP } from "./notion/clamp-size.js";
|
|
75
|
+
export { ResizeHandle, type ResizeHandleProps } from "./notion/ResizeHandle.js";
|
|
74
76
|
export { RouteLoading, type RouteLoadingProps } from "./notion/RouteLoading.js";
|
|
75
77
|
export { SheetMenu, SheetMenuButton, SheetMenuItem, type SheetMenuButtonProps } from "./notion/SheetMenu.js";
|
|
76
78
|
export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useRef, useState, type KeyboardEvent, type PointerEvent } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
|
|
7
|
+
import { clampSize, RESIZE_HANDLE_STEP } from "./clamp-size.js";
|
|
8
|
+
|
|
9
|
+
const LARGE_STEP_FACTOR = 4;
|
|
10
|
+
|
|
11
|
+
export interface ResizeHandleProps {
|
|
12
|
+
/** The handle's accessible name, from the app's message layer (e.g. "Resize the plan column"). */
|
|
13
|
+
readonly label: string;
|
|
14
|
+
/** The id of the column the handle resizes. */
|
|
15
|
+
readonly controls: string;
|
|
16
|
+
/** The column's width in pixels (controlled). */
|
|
17
|
+
readonly value: number;
|
|
18
|
+
readonly min: number;
|
|
19
|
+
readonly max: number;
|
|
20
|
+
/** The width a double click restores. */
|
|
21
|
+
readonly defaultValue: number;
|
|
22
|
+
/** Every new width, during a drag and on each key. */
|
|
23
|
+
readonly onChange: (value: number) => void;
|
|
24
|
+
/** The width once a drag, a key or the reset ends: the moment to keep it. */
|
|
25
|
+
readonly onCommit?: (value: number) => void;
|
|
26
|
+
readonly className?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Drag {
|
|
30
|
+
readonly pointerId: number;
|
|
31
|
+
readonly startX: number;
|
|
32
|
+
readonly startValue: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A vertical handle on the right edge of a column that a pointer drags, or the keyboard steps, to set the column's width.
|
|
37
|
+
* It takes no width of its own (it lies over the border between two columns) and shows the theme's ring colour while
|
|
38
|
+
* hovered, focused or dragged. Arrow keys step the width (Shift: four steps), Home and End go to the limits, a double
|
|
39
|
+
* click restores the default. Hidden phone-wide, where the columns stack.
|
|
40
|
+
*/
|
|
41
|
+
export function ResizeHandle({ label, controls, value, min, max, defaultValue, onChange, onCommit, className }: ResizeHandleProps) {
|
|
42
|
+
const dragRef = useRef<Drag | null>(null);
|
|
43
|
+
const lastRef = useRef(value);
|
|
44
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
45
|
+
lastRef.current = value;
|
|
46
|
+
|
|
47
|
+
function change(next: number): number {
|
|
48
|
+
const clamped = clampSize(next, min, max, defaultValue);
|
|
49
|
+
if (clamped !== lastRef.current) {
|
|
50
|
+
lastRef.current = clamped;
|
|
51
|
+
onChange(clamped);
|
|
52
|
+
}
|
|
53
|
+
return clamped;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function startDrag(event: PointerEvent<HTMLDivElement>) {
|
|
57
|
+
if (event.button !== 0) return;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
60
|
+
dragRef.current = { pointerId: event.pointerId, startX: event.clientX, startValue: value };
|
|
61
|
+
setIsDragging(true);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function moveDrag(event: PointerEvent<HTMLDivElement>) {
|
|
65
|
+
const drag = dragRef.current;
|
|
66
|
+
if (drag === null || drag.pointerId !== event.pointerId) return;
|
|
67
|
+
change(drag.startValue + event.clientX - drag.startX);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function endDrag(event: PointerEvent<HTMLDivElement>) {
|
|
71
|
+
const drag = dragRef.current;
|
|
72
|
+
if (drag === null || drag.pointerId !== event.pointerId) return;
|
|
73
|
+
dragRef.current = null;
|
|
74
|
+
setIsDragging(false);
|
|
75
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
76
|
+
if (lastRef.current !== drag.startValue) onCommit?.(lastRef.current);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function stepByKey(event: KeyboardEvent<HTMLDivElement>) {
|
|
80
|
+
const step = event.shiftKey ? RESIZE_HANDLE_STEP * LARGE_STEP_FACTOR : RESIZE_HANDLE_STEP;
|
|
81
|
+
const targets: Record<string, number> = { ArrowLeft: value - step, ArrowRight: value + step, Home: min, End: max };
|
|
82
|
+
const target = targets[event.key];
|
|
83
|
+
if (target === undefined) return;
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
const before = value;
|
|
86
|
+
const next = change(target);
|
|
87
|
+
if (next !== before) onCommit?.(next);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function restoreDefault() {
|
|
91
|
+
const before = value;
|
|
92
|
+
const next = change(defaultValue);
|
|
93
|
+
if (next !== before) onCommit?.(next);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
role="separator"
|
|
99
|
+
aria-orientation="vertical"
|
|
100
|
+
aria-label={label}
|
|
101
|
+
aria-controls={controls}
|
|
102
|
+
aria-valuenow={value}
|
|
103
|
+
aria-valuemin={min}
|
|
104
|
+
aria-valuemax={max}
|
|
105
|
+
tabIndex={0}
|
|
106
|
+
title={label}
|
|
107
|
+
data-slot="resize-handle"
|
|
108
|
+
data-dragging={isDragging ? "true" : undefined}
|
|
109
|
+
className={cn(
|
|
110
|
+
"relative z-4 -mx-1 w-2 flex-none cursor-col-resize touch-none select-none outline-none max-sm:hidden",
|
|
111
|
+
"after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 after:-translate-x-1/2 after:bg-transparent after:transition-colors",
|
|
112
|
+
"hover:after:bg-ring focus-visible:after:bg-ring data-[dragging=true]:after:bg-ring",
|
|
113
|
+
className,
|
|
114
|
+
)}
|
|
115
|
+
onPointerDown={startDrag}
|
|
116
|
+
onPointerMove={moveDrag}
|
|
117
|
+
onPointerUp={endDrag}
|
|
118
|
+
onPointerCancel={endDrag}
|
|
119
|
+
onKeyDown={stepByKey}
|
|
120
|
+
onDoubleClick={restoreDefault}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
package/src/notion/SidePanel.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { X } from "lucide-react";
|
|
4
|
-
import { useEffect, useRef, type KeyboardEvent, type ReactNode } from "react";
|
|
4
|
+
import { useEffect, useRef, type CSSProperties, type KeyboardEvent, type ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
import { en as messages } from "../messages/en.js";
|
|
7
7
|
import { Button } from "../ui/button.js";
|
|
@@ -22,12 +22,15 @@ export interface SidePanelProps {
|
|
|
22
22
|
readonly onClose: () => void;
|
|
23
23
|
// The close button's accessible name, from the app's message layer.
|
|
24
24
|
readonly closeLabel?: string;
|
|
25
|
+
// The panel's width in pixels on a wide screen (a `ResizeHandle` sets it); phone-wide `beside` and `list` keep
|
|
26
|
+
// covering the canvas. Without it, the layout's own width.
|
|
27
|
+
readonly width?: number;
|
|
25
28
|
readonly children: ReactNode;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
// A non-modal panel at a side of a canvas (a map) that leaves the canvas usable. Its parent is a `relative` flex row
|
|
29
32
|
// holding the canvas and the panel. Hidden while closed, so its content leaves the reading order.
|
|
30
|
-
export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, children }: SidePanelProps) {
|
|
33
|
+
export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, width, children }: SidePanelProps) {
|
|
31
34
|
const panelRef = useRef<HTMLElement>(null);
|
|
32
35
|
const wasOpenRef = useRef(isOpen);
|
|
33
36
|
const headingId = `${id}-heading`;
|
|
@@ -50,8 +53,10 @@ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = m
|
|
|
50
53
|
id={id}
|
|
51
54
|
tabIndex={-1}
|
|
52
55
|
data-slot="side-panel"
|
|
53
|
-
className="absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden"
|
|
56
|
+
className="absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden sm:data-[sized=true]:w-(--side-panel-width) sm:data-[sized=true]:flex-none"
|
|
54
57
|
data-layout={layout}
|
|
58
|
+
data-sized={width === undefined ? undefined : "true"}
|
|
59
|
+
style={width === undefined ? undefined : ({ "--side-panel-width": `${width}px` } as CSSProperties)}
|
|
55
60
|
hidden={!isOpen}
|
|
56
61
|
aria-labelledby={headingId}
|
|
57
62
|
data-testid={id}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** A `ResizeHandle`'s keyboard step for an arrow key, in pixels; Shift takes four of them. */
|
|
2
|
+
export const RESIZE_HANDLE_STEP = 16;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `value` rounded and kept within `min` and `max`; a value that is not a finite number falls back to `fallback` (itself
|
|
6
|
+
* kept within the limits). Plain module, so a Server Component can read a kept width with it (#1311).
|
|
7
|
+
*/
|
|
8
|
+
export function clampSize(value: number, min: number, max: number, fallback: number = min): number {
|
|
9
|
+
if (!Number.isFinite(value)) return Math.min(Math.max(fallback, min), max);
|
|
10
|
+
return Math.min(Math.max(Math.round(value), min), max);
|
|
11
|
+
}
|
package/src/sft-bridge.css
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* The bridge from the `--sft-*` tokens of @softure-ai/ui to the Notion theme.
|
|
3
|
-
* (sign-in, password, MCP access, OAuth
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The bridge from the `--sft-*` tokens of @softure-ai/ui to the Notion theme. Every ui component (fields, cards,
|
|
3
|
+
* modals, toasts, the chat primitives) and the pages of the SOFTURE packages (sign-in, password, MCP access, OAuth
|
|
4
|
+
* consent) paint with `--sft-*`; here those tokens point at the Notion values, so they take the theme's colours, type,
|
|
5
|
+
* radii and shadows wherever they sit: in the app shell, in a panel, or in a `PageFrame`.
|
|
6
|
+
*
|
|
7
|
+
* On every scheme scope, not `:root` alone: a custom property holding `var()` resolves on the element that declares
|
|
8
|
+
* it and children inherit the result, so an alias on `:root` alone would freeze the root's values inside a `.dark`
|
|
9
|
+
* band of a light page. `[data-page-frame]` stays in the list for a frame inside such a band. Unlayered, so it beats
|
|
10
|
+
* ui's defaults in `@layer softure` on the same element; an app's own `--sft-*` rule after this import still wins.
|
|
11
|
+
* Spacing, text sizes and durations stay the package's: the scales already match, and the theme has no motion tokens.
|
|
8
12
|
*
|
|
9
13
|
* Import it after `theme.css`, through the app's Tailwind (it reads the theme with `--theme()`).
|
|
10
14
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
:root,
|
|
16
|
+
.light,
|
|
17
|
+
.dark,
|
|
18
|
+
[data-theme],
|
|
19
|
+
[data-page-frame] {
|
|
20
|
+
--sft-font-sans: --theme(--font-sans);
|
|
21
|
+
--sft-font-heading: --theme(--font-sans);
|
|
22
|
+
--sft-font-mono: --theme(--font-mono);
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
--sft-radius-control: --theme(--radius-md);
|
|
25
|
+
--sft-radius-card: --theme(--radius-lg);
|
|
26
|
+
--sft-radius-pill: --theme(--radius-full);
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
--sft-color-background: var(--background);
|
|
29
|
+
--sft-color-surface: var(--card);
|
|
30
|
+
--sft-color-surface-raised: var(--popover);
|
|
31
|
+
--sft-color-foreground: var(--foreground);
|
|
32
|
+
--sft-color-muted: var(--muted-foreground);
|
|
33
|
+
--sft-color-border: var(--border);
|
|
34
|
+
--sft-color-border-strong: var(--control-off);
|
|
35
|
+
--sft-color-accent: var(--primary);
|
|
36
|
+
--sft-color-accent-fill: var(--primary);
|
|
37
|
+
--sft-color-accent-fill-hover: var(--primary-hover);
|
|
38
|
+
--sft-color-on-accent: var(--primary-foreground);
|
|
39
|
+
--sft-color-danger: var(--red);
|
|
40
|
+
--sft-color-success: var(--green);
|
|
41
|
+
--sft-color-warning: var(--orange);
|
|
42
|
+
--sft-color-focus: var(--ring);
|
|
43
|
+
--sft-color-overlay: var(--overlay);
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
--sft-shadow-1: var(--shadow-card);
|
|
46
|
+
--sft-shadow-2: var(--shadow-dialog);
|
|
47
|
+
}
|
|
41
48
|
|
|
49
|
+
@layer base {
|
|
42
50
|
/* A page in a frame fills the window: no browser margin, the Notion background behind everything. */
|
|
43
51
|
body:has([data-page-frame]) {
|
|
44
52
|
margin: 0;
|