@vortexlabs/kirari-react 1.0.0 → 1.0.1

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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +44 -10
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vortexlabs/kirari-react
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ee99c0: Update the package homepage and documentation links to https://kirari.sh.
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  ### Major Changes
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # @vortexlabs/kirari-react
2
2
 
3
- Kirari highlighting as React elements. `<Code>` renders tokens as `<span>`
4
- elements, with no `dangerouslySetInnerHTML` and no hooks, so it works as a
5
- Server Component.
3
+ Syntax highlighting for React 19, built on
4
+ [`@vortexlabs/kirari`](https://github.com/vortexkit/kirari/blob/main/packages/kirari/README.md).
5
+ `<Code>` renders code as React elements and works in Server Components. Use the
6
+ optional streaming hook for code that arrives in chunks.
7
+
8
+ [Documentation](https://kirari.sh/docs/) · [Playground](https://kirari.sh/playground/)
6
9
 
7
10
  ## Install
8
11
 
@@ -19,19 +22,29 @@ import { Code } from '@vortexlabs/kirari-react'
19
22
  import { typescript } from '@vortexlabs/kirari/languages/typescript'
20
23
  import '@vortexlabs/kirari/theme.css'
21
24
 
22
- <Code language={typescript} highlightLines={[1, [3, 4]]}>{source}</Code>
25
+ export const CodeExample = () => (
26
+ <Code language={typescript}>
27
+ {'const greeting: string = "Hello"'}
28
+ </Code>
29
+ )
23
30
  ```
24
31
 
25
32
  Output is `<pre class="kirari"><code>…</code></pre>` with the standard
26
- `kirari-*` classes, so every Kirari theme works. `language` defaults to
33
+ `kirari-*` classes, so every Kirari theme works. Code text is escaped by React;
34
+ the component does not use `dangerouslySetInnerHTML`. `language` defaults to
27
35
  JavaScript. Other props go to the `<pre>`.
28
36
 
37
+ ## Lines and customization
38
+
39
+ Use `highlightLines={[1, [3, 4]]}` to mark line 1 and lines 3–4. Style
40
+ `.kirari-line-highlighted` to choose the highlight's appearance.
41
+
29
42
  | Prop | Effect |
30
43
  | --- | --- |
31
44
  | `lines` | Wrap each line in `<span class="kirari-line" data-line="n">`. |
32
45
  | `highlightLines` | Lines or `[first, last]` ranges get `kirari-line-highlighted`. Implies `lines`. |
33
46
  | `lineClassName` | `(line) => class` for a line wrapper. `line` is `{ number, start, end }`. |
34
- | `decorations` | `{ start, end, className }` source ranges, as in [decorations](../../docs/decorations.md). |
47
+ | `decorations` | `{ start, end, className }` source ranges, as in [decorations](https://github.com/vortexkit/kirari/blob/main/docs/decorations.md). |
35
48
  | `classes` | Extra classes per token type, e.g. `{ keyword: 'kw' }`. |
36
49
  | `tokenClassName` | `(token) => class` per token. |
37
50
  | `tokens` | Pre-scanned tokens instead of `children`. |
@@ -46,15 +59,36 @@ Line numbers are CSS:
46
59
 
47
60
  ```tsx
48
61
  'use client'
62
+
63
+ import { Code } from '@vortexlabs/kirari-react'
49
64
  import { useTokenStream } from '@vortexlabs/kirari-react/stream'
65
+ import { javascript } from '@vortexlabs/kirari/languages/javascript'
66
+ import '@vortexlabs/kirari/theme.css'
67
+
68
+ export const StreamExample = () => {
69
+ const { tokens, write, reset } = useTokenStream(javascript)
50
70
 
51
- const { tokens, write, end, reset } = useTokenStream(javascript)
52
- // write(chunk) as text arrives, then end()
53
- return <Code tokens={tokens} />
71
+ return (
72
+ <>
73
+ <button type="button" onClick={() => write('const count = 42\n')}>
74
+ Append a line
75
+ </button>
76
+ <button type="button" onClick={reset}>Reset</button>
77
+ <Code tokens={tokens} />
78
+ </>
79
+ )
80
+ }
54
81
  ```
55
82
 
56
- - Rescans only the unfinished tail. See [token streaming](../../docs/streaming.md).
83
+ This example adds one chunk per click. In your app, call `write(chunk)` as text
84
+ arrives. The hook also returns `end()`, which closes the stream when it is complete.
85
+
86
+ - Built-in JavaScript, TypeScript, and JSON reuse completed scanning work. Other languages rescan the full source. Long unfinished tokens can still be expensive; see [token streaming](https://github.com/vortexkit/kirari/blob/main/docs/streaming.md).
57
87
  - Changing `language` starts a new, empty stream.
58
88
  - After `end()`, call `reset()` before writing again.
59
89
  - `/stream` is a client module; `<Code>` is not.
60
90
  - Managing tokens yourself? Use `createTokenStream` from `@vortexlabs/kirari/stream` with `applyPatch(tokens, patch)`.
91
+
92
+ ## License
93
+
94
+ [MIT](https://github.com/vortexkit/kirari/blob/main/packages/react/LICENSE) © 2026 [Ugi](https://ugi.dev)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vortexlabs/kirari-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Kirari syntax highlighting as React elements.",
5
5
  "keywords": [
6
6
  "react",
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "author": "Ugi (https://ugi.dev)",
12
12
  "license": "MIT",
13
- "homepage": "https://kirari.vortex.design",
13
+ "homepage": "https://kirari.sh",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git+https://github.com/vortexkit/kirari.git",
@@ -55,7 +55,7 @@
55
55
  "@happy-dom/global-registrator": "^20.14.6",
56
56
  "@types/react": "^19.3.0",
57
57
  "@types/react-dom": "^19.3.0",
58
- "@vortexlabs/kirari": "1.0.0",
58
+ "@vortexlabs/kirari": "1.0.1",
59
59
  "react": "^19.3.1",
60
60
  "react-dom": "^19.3.1"
61
61
  },