paintcannon-react 0.0.46 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +66 -2
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -147,8 +147,15 @@ All host components accept these event props:
147
147
  - `onTransitionEnd`
148
148
  - `onScroll`
149
149
 
150
- `onPaste` receives the same `PaintClipboardEvent` as core, including detected terminal image paths
151
- through `event.clipboardData.files`.
150
+ `onPaste` receives the same `PaintClipboardEvent` as core, including image files through
151
+ `event.clipboardData.files`. This also handles images copied from browsers or screenshot tools
152
+ without a backing file on terminals supporting Kitty's rich-paste protocol. Image pastes have
153
+ empty text data; no React-specific handling is needed.
154
+ Use `await paintCannon.supportsRichPaste()` on the core instance to detect copied-image paste
155
+ support before offering it in your UI.
156
+ Inside tmux, core uses DCS passthrough only after confirming `focus-events` is on, so rich-paste
157
+ mode can be released when switching away from the app's pane. Otherwise `supportsRichPaste()`
158
+ returns `false`, leaving ordinary text and file-path paste available.
152
159
 
153
160
  `style` accepts the following CSS property names. Kebab-case and camelCase are
154
161
  both supported:
@@ -233,6 +240,31 @@ both supported:
233
240
  - `font-weight`/`fontWeight` (accepts `"bold"` or `"normal"`)
234
241
  - `text-decoration`/`textDecoration` (accepts `"underline"`, `"line-through"`, or `"none"`)
235
242
 
243
+ Grid template and automatic track props accept the same strings as core: cell lengths,
244
+ percentages, `fr`, `auto`, `min-content`, `max-content`, and `minmax(min, max)`.
245
+ The minimum accepts any of those except `fr`; the maximum accepts all of them.
246
+ Whitespace is allowed inside `minmax()`. For example:
247
+
248
+ ```tsx
249
+ <Div
250
+ style={{
251
+ display: "grid",
252
+ width: "100%",
253
+ gridTemplateColumns: "minmax(0, max-content) minmax(0, max-content)",
254
+ justifyContent: "flex-start",
255
+ }}
256
+ >
257
+ <Div style={{ minWidth: 0, overflowWrap: "anywhere" }}>#</Div>
258
+ <Div style={{ minWidth: 0, overflowWrap: "anywhere" }}>
259
+ A longer cell that can wrap in a narrow terminal.
260
+ </Div>
261
+ </Div>
262
+ ```
263
+
264
+ `minmax(0, 1fr)` uses a zero minimum, unlike bare `1fr`'s automatic minimum.
265
+ Sizes must be non-negative; `repeat()` is not supported.
266
+ See the [full grid track grammar](../paintcannon/README.md#grid-track-sizing).
267
+
236
268
  ### Per-component props:
237
269
 
238
270
  - `Div`: shared props, plus `scrollLeft?: number` and `scrollTop?: number`.
@@ -256,6 +288,38 @@ both supported:
256
288
  - `useAnimation()` for requestAnimationFrame-driven animations that share a
257
289
  single render cycle.
258
290
 
291
+ ## Desktop Notifications
292
+
293
+ Use the core API through `useApp().paintCannon`; no notification-specific React
294
+ wrapper is needed:
295
+
296
+ ```tsx
297
+ function NotifyButton() {
298
+ const { paintCannon } = useApp();
299
+ return (
300
+ <Button
301
+ onClick={() => {
302
+ new paintCannon.Notification("Build complete", { body: "All tests passed." });
303
+ }}
304
+ >
305
+ Notify
306
+ </Button>
307
+ );
308
+ }
309
+ ```
310
+
311
+ `requestPermission()` automatically grants when a backend is available, or returns
312
+ `"denied"` otherwise, without a prompt. Rust selects OSC 99/777/9 or a local macOS/Linux command fallback;
313
+ it never invokes a remote desktop fallback over SSH. Notification lifecycle
314
+ feedback varies by backend. See [the core notification API](../paintcannon/README.md#desktop-notifications)
315
+ for options, events, replacement, and dismissal limitations.
316
+
317
+ Use `await paintCannon.Notification.supportsClose()` to decide whether to render a
318
+ dismiss button. Permission to deliver notifications does not imply dismissal
319
+ support. OSC 99 features, including dismissal, are queried from the terminal at
320
+ runtime. OSC 9/777 and the macOS command fallback cannot dismiss notifications
321
+ programmatically; Otty's current acknowledgement also does not advertise dismissal.
322
+
259
323
  ## Core Runtime
260
324
 
261
325
  This package depends on `paintcannon`, which provides the NAPI-RS native
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paintcannon-react",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "license": "ISC",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "scheduler": "^0.25.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "paintcannon": "^0.0.46",
40
+ "paintcannon": "^0.0.48",
41
41
  "react": "^19.0.0"
42
42
  },
43
43
  "devDependencies": {
@@ -46,6 +46,6 @@
46
46
  "@types/react-reconciler": "^0.33.0",
47
47
  "@types/scheduler": "^0.26.0",
48
48
  "typescript": "^6.0.3",
49
- "vitest": "^4.1.7"
49
+ "vitest": "^4.1.12"
50
50
  }
51
51
  }