@domainkit/react 0.1.1 → 0.3.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/README.md +51 -5
- package/dist/index.d.mts +1012 -383
- package/dist/index.mjs +662 -646
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +8 -7
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -22,15 +22,18 @@ import "@domainkit/react/styles.css";
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
npm install @domainkit/react domainkit react react-dom
|
|
25
|
+
npm install @domainkit/react domainkit effect@rc @effect/atom-react@rc react react-dom
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
React 19 is required.
|
|
29
|
+
|
|
28
30
|
## Domain lifecycle
|
|
29
31
|
|
|
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.
|
|
32
|
+
When you do have a host-owned transport layer, `Domain.Flow` connects the provider, reviews an exact plan, observes DNS, removes receipt-bound records, and disconnects the current domain grant.
|
|
31
33
|
|
|
32
34
|
```tsx
|
|
33
|
-
import { Domain, DomainKit
|
|
35
|
+
import { Domain, DomainKit } from "@domainkit/react";
|
|
36
|
+
import { Transport } from "domainkit";
|
|
34
37
|
|
|
35
38
|
export function DomainSetup() {
|
|
36
39
|
return (
|
|
@@ -43,16 +46,39 @@ export function DomainSetup() {
|
|
|
43
46
|
|
|
44
47
|
`Provisioning.Flow` accepts `showRecords={false}` when the host already renders the DNS record list with `Records.Table`.
|
|
45
48
|
|
|
49
|
+
Effect applications can compose lifecycle UI directly from `Connection.useModel`,
|
|
50
|
+
`Provisioning.useModel`, `Verification.useModel`, and `Cleanup.useModel`. Each model exposes
|
|
51
|
+
`state` and `command` atoms; dispatch values with the corresponding exported `Command`
|
|
52
|
+
constructors. The packaged controllers and flows consume those same models rather than maintaining
|
|
53
|
+
second state machines.
|
|
54
|
+
|
|
55
|
+
`Operations.List` is the shared provisioning and cleanup review recipe. Hosts can instead assemble
|
|
56
|
+
`Operations.Root`, `Item`, `Kind`, `Type`, `Record`, `Name`, `Value`, `Priority`, and `Reason` with
|
|
57
|
+
Base UI render props.
|
|
58
|
+
|
|
46
59
|
## Transport ownership
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
`DomainKit.Root` receives a `Layer<Transport.Service>`. Controllers run the service through Effect Atom, so request interruption, stale result suppression, and subtree disposal follow the Effect lifecycle. Implement the service with authenticated application endpoints. Do not place provider credentials or provider API clients in the browser.
|
|
62
|
+
|
|
63
|
+
Foreign Promise clients can be adapted once at the boundary:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { Transport } from "domainkit";
|
|
67
|
+
|
|
68
|
+
export const transport = Transport.layerFromAsync({
|
|
69
|
+
connection: api.connections,
|
|
70
|
+
provisioning: api.provisioning,
|
|
71
|
+
verification: api.verification,
|
|
72
|
+
cleanup: api.cleanup,
|
|
73
|
+
});
|
|
74
|
+
```
|
|
49
75
|
|
|
50
76
|
- `connection` detects providers, starts OAuth or token authorization, reuses an existing account, and removes one domain grant while preserving DNS.
|
|
51
77
|
- `provisioning` asks the server for an exact plan and applies only the returned digest.
|
|
52
78
|
- `verification.observe(config)` is the single observation operation. `sources` selects provider evidence, public DNS, or both.
|
|
53
79
|
- `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
80
|
|
|
55
|
-
|
|
81
|
+
Successful outcomes use schema-backed tagged models. Failures travel through the Effect error channel.
|
|
56
82
|
|
|
57
83
|
## Composition and theming
|
|
58
84
|
|
|
@@ -68,6 +94,26 @@ Every semantic component accepts Base UI's `render` prop.
|
|
|
68
94
|
|
|
69
95
|
`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
96
|
|
|
97
|
+
`Connection.Flow` is a recipe over the same parts a host can assemble. `Connection.Root` fills the host column and stretches children. `Connection.Trigger` is a dialog opener: its required `children` supply the label, `render` replaces the button, and it does not inject a provider mark. `Connection.ConnectTrigger` accepts a provider and is the packaged button with a mark and default chrome.
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<Connection.Root status={state._tag}>
|
|
101
|
+
<HostCard>
|
|
102
|
+
<Provider.Mark provider={snapshot.provider} />
|
|
103
|
+
<div>
|
|
104
|
+
<strong>{snapshot.provider.name}</strong>
|
|
105
|
+
<p>Manages DNS for this domain.</p>
|
|
106
|
+
</div>
|
|
107
|
+
<BaseDialog.Root>
|
|
108
|
+
<Connection.Trigger render={<HostButton />}>
|
|
109
|
+
Connect {snapshot.provider.name}
|
|
110
|
+
</Connection.Trigger>
|
|
111
|
+
<Connection.Dialog controller={controller} snapshot={snapshot} />
|
|
112
|
+
</BaseDialog.Root>
|
|
113
|
+
</HostCard>
|
|
114
|
+
</Connection.Root>
|
|
115
|
+
```
|
|
116
|
+
|
|
71
117
|
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
118
|
|
|
73
119
|
```tsx
|