Skip to content

@gpuix/react@0.2.0

Choose a tag to compare

@remorses remorses released this 23 Aug 08:59
· 156 commits to main since this release

Also ships @gpuix/native@0.2.0. CI publishes both packages.

  1. Selectable text everywhere, plus <code>, <diff> and <markdown> — every string GPUIX paints can be selected with a drag and copied with Cmd+C. A drag can start in a plain <text> and end inside a code block.

    <div style={{ display: 'flex', flexDirection: 'column' }}>
      <text>drag from here</text>
      <code code={'and into this code block'} language="ts" />
    </div>

    Opt out with userSelect: 'none'. Read the selection with renderer.getSelectedText().

    <code code={source} language="typescript" showLineNumbers />
    <diff patch={unifiedPatch} wordDiff collapsedPaths={['pnpm-lock.yaml']} />
    <markdown source={readme} onLinkClick={(e) => open(e.value)} />

    Bundled languages: Rust, TypeScript, TSX, JavaScript, JSX, Python, Go, JSON, Bash, TOML, YAML, Markdown, HTML, CSS, C.

  2. Native <input> and <textarea> — caret, mouse selection, IME, clipboard, undo/redo, and grapheme-safe deletion. Enter submits. Shift+Enter inserts a newline in a textarea.

    <textarea value={draft} minRows={1} maxRows={8} onChange={(e) => setDraft(e.value ?? '')} onSubmit={send} />
  3. render() remounts React on the same native windowbun --hot saves remount the tree without a second window.

    import { render } from '@gpuix/react'
    render(<App />, { title: 'My App', width: 800, height: 600 })
  4. Headless Select, Combobox, and Tooltip — unstyled primitives. Import @gpuix/react/select, @gpuix/react/combobox, or @gpuix/react/tooltip and wrap them in local components/ui files.

    import * as SelectPrimitive from '@gpuix/react/select'
    
    <SelectPrimitive.Root value={model} onValueChange={setModel}>
      <SelectPrimitive.Trigger>
        <SelectPrimitive.Value placeholder="Select a model" />
      </SelectPrimitive.Trigger>
      <SelectPrimitive.Content>
        <SelectPrimitive.Item value="sonnet">Sonnet</SelectPrimitive.Item>
      </SelectPrimitive.Content>
    </SelectPrimitive.Root>
  5. <virtual-list> — GPUI builds only rows near the viewport.

    <virtual-list alignment="bottom" followTail estimatedItemHeight={180}>
      {messages.map((message) => <Message key={message.id} message={message} />)}
    </virtual-list>
  6. Tintable local SVG icons

    <svg src="/absolute/path/to/search.svg" style={{ width: 16, height: 16, color: '#b4b4b4' }} />
  7. startFrameLoop() — idle CPU drops from ~73% to ~1%. Default pace is ~125fps.

    import { startFrameLoop } from '@gpuix/react'
    startFrameLoop(renderer)
  8. Native GPUI platform on macOS, Windows, and Linux. Windows runtime validation is still pending.

  9. GPUI upgrade to zed d5dc01f2. Scroll events can report touchPhase: 'cancelled'. Building from source now needs Rust 1.97.1 and the Metal toolchain on macOS.

  10. Style props that were declared and dropped now work — full styles on <text>, plus fontSize, textAlign, rowGap, columnGap, lineHeight, and borderWidth: 0.

  11. autoFocus works and <input> no longer ships a hardcoded look.

  12. Blinking caret every 500ms while focused. Colour is theme.caret.

  13. Clipboard and natural scroll — Cmd+C writes to the system clipboard. Wheel deltas keep the OS sign.

  14. React 19 JSX components can return any ReactNode.