@domainkit/react 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arya Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # @domainkit/react
2
+
3
+ Copy a DNS record. Download a zone file. Then connect the domain if you want DomainKit to do the rest.
4
+
5
+ The presentational record parts take a `DnsRecord[]` and do not need `DomainKit.Root` or a transport.
6
+
7
+ ```tsx
8
+ import { Records } from "@domainkit/react";
9
+ import "@domainkit/react/styles.css";
10
+
11
+ <Records.Table records={records} />
12
+ <Records.CopyValue value="v=spf1 include:example.net ~all" />
13
+ <Records.ZoneFile domain="mail.example.com" records={records} />
14
+ <Records.Card record={records[0]} />
15
+ <Records.Status evidence={{ _tag: "Found", recordId: "mx" }} />
16
+ ```
17
+
18
+ `Records.Table` copies name and value per row. Pass `evidence` to add Found / Missing / Mismatch / Unavailable chips. `Records.Card` is the stacked layout for the same data. `Records.ZoneFile` copies and downloads BIND text via `Records.toZoneFile`.
19
+
20
+ `Table` and `Card` are conveniences over public parts. Hosts that already have a table can assemble `Root`, `Header`, `Body`, `Row`, `Head`, `Cell`, `Value`, `Priority`, and `Status` themselves. `Status` children replace the `_tag` label.
21
+
22
+ ## Install
23
+
24
+ ```sh
25
+ npm install @domainkit/react domainkit react react-dom
26
+ ```
27
+
28
+ ## Domain lifecycle
29
+
30
+ When you do have a host-owned transport, `Domain.Flow` connects the provider, reviews an exact plan, observes DNS, removes receipt-bound records, and disconnects the current domain grant.
31
+
32
+ ```tsx
33
+ import { Domain, DomainKit, type Transport } from "@domainkit/react";
34
+
35
+ export function DomainSetup() {
36
+ return (
37
+ <DomainKit.Root transport={transport}>
38
+ <Domain.Flow domain="example.com" records={records} />
39
+ </DomainKit.Root>
40
+ );
41
+ }
42
+ ```
43
+
44
+ `Provisioning.Flow` accepts `showRecords={false}` when the host already renders the DNS record list with `Records.Table`.
45
+
46
+ ## Transport ownership
47
+
48
+ The browser transport is Promise-based. Implement it with authenticated application endpoints. Do not place provider credentials or provider API clients in the browser.
49
+
50
+ - `connection` detects providers, starts OAuth or token authorization, reuses an existing account, and removes one domain grant while preserving DNS.
51
+ - `provisioning` asks the server for an exact plan and applies only the returned digest.
52
+ - `verification.observe(config)` is the single observation operation. `sources` selects provider evidence, public DNS, or both.
53
+ - `cleanup` creates a fresh receipt-bound deletion plan and applies only its reviewed digest. The server fails closed when records drift or ownership cannot be proven.
54
+
55
+ All outcomes are discriminated with `_tag`.
56
+
57
+ ## Composition and theming
58
+
59
+ Every semantic component accepts Base UI's `render` prop.
60
+
61
+ ```tsx
62
+ <Connection.OAuthAction
63
+ controller={controller}
64
+ label="Connect"
65
+ render={<MyButton variant="primary" />}
66
+ />
67
+ ```
68
+
69
+ `DomainKit.Root` sets theme tokens, messages, provider marks, icons, color scheme, and a portal container. The stylesheet is opt-in and uses `--domainkit-*` CSS custom properties. Record parts pick those tokens up when they sit inside Root; they still function without it.
70
+
71
+ Pass host icons so the package never owns an icon library. `Records.CopyValue` and `Records.ZoneFile` also accept `copyIcon` / `copiedIcon` / `downloadIcon` when you are not wrapping in Root.
72
+
73
+ ```tsx
74
+ <DomainKit.Root
75
+ icons={{
76
+ copy: <Copy />,
77
+ copied: <Check />,
78
+ download: <Download />,
79
+ }}
80
+ transport={transport}
81
+ >
82
+ {children}
83
+ </DomainKit.Root>
84
+ ```
85
+
86
+ ```tsx
87
+ <Records.Root>
88
+ <Records.Header>
89
+ <Records.Row>
90
+ <Records.Head scope="col">Type</Records.Head>
91
+ <Records.Head scope="col">Name</Records.Head>
92
+ <Records.Head scope="col">Value</Records.Head>
93
+ </Records.Row>
94
+ </Records.Header>
95
+ <Records.Body>
96
+ {records.map((record) => (
97
+ <Records.Row key={record.id}>
98
+ <Records.Cell>{record.type}</Records.Cell>
99
+ <Records.Cell>
100
+ <Records.CopyValue value={record.name} />
101
+ </Records.Cell>
102
+ <Records.Cell>
103
+ <Records.Value>
104
+ <Records.CopyValue value={record.value} />
105
+ {record.priority === undefined ? null : <Records.Priority priority={record.priority} />}
106
+ </Records.Value>
107
+ </Records.Cell>
108
+ </Records.Row>
109
+ ))}
110
+ </Records.Body>
111
+ </Records.Root>
112
+ ```
113
+
114
+ ## Server rendering
115
+
116
+ The package is ESM and safe to import on the server. Clipboard and download run in the browser when the user clicks Copy or Download.