@ancientpantheon/khronoton-core 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/CHANGELOG.md +25 -0
- package/README.md +83 -3
- package/dist/PactCodeMirror-HQTGE2K3.js +64 -0
- package/dist/chunk-DK4CDPXH.js +379 -0
- package/dist/chunk-U3F5HEHO.js +1639 -0
- package/dist/context-BKtdrA2B.d.ts +363 -0
- package/dist/handlers/batch.d.ts +21 -0
- package/dist/handlers/batch.js +57 -0
- package/dist/handlers/context.d.ts +94 -0
- package/dist/handlers/context.js +75 -0
- package/dist/handlers/cronoton.d.ts +70 -0
- package/dist/handlers/cronoton.js +165 -0
- package/dist/handlers/execute.d.ts +30 -0
- package/dist/handlers/execute.js +227 -0
- package/dist/handlers/http.d.ts +85 -0
- package/dist/handlers/http.js +84 -0
- package/dist/handlers/index.d.ts +27 -0
- package/dist/handlers/index.js +34 -0
- package/dist/handlers/read.d.ts +29 -0
- package/dist/handlers/read.js +94 -0
- package/dist/hooks/index.d.ts +143 -0
- package/dist/hooks/index.js +2 -0
- package/dist/provider/index.d.ts +421 -0
- package/dist/provider/index.js +675 -0
- package/dist/server/executor-signers.d.ts +29 -0
- package/dist/server/executor-signers.js +60 -0
- package/dist/server/executor.d.ts +53 -0
- package/dist/server/executor.js +280 -0
- package/dist/server/index.d.ts +27 -0
- package/dist/server/index.js +51 -0
- package/dist/server/loop.d.ts +36 -0
- package/dist/server/loop.js +51 -0
- package/dist/server/pure/capability.d.ts +31 -0
- package/dist/server/pure/capability.js +63 -0
- package/dist/server/pure/fingerprint.d.ts +8 -0
- package/dist/server/pure/fingerprint.js +44 -0
- package/dist/server/pure/runtime-args.d.ts +34 -0
- package/dist/server/pure/runtime-args.js +99 -0
- package/dist/server/resolvers.d.ts +140 -0
- package/dist/server/resolvers.js +200 -0
- package/dist/server/schema.d.ts +31 -0
- package/dist/server/schema.js +93 -0
- package/dist/server/seams.d.ts +231 -0
- package/dist/server/seams.js +34 -0
- package/dist/server/store/claim.d.ts +59 -0
- package/dist/server/store/claim.js +97 -0
- package/dist/server/store/cronoton.d.ts +79 -0
- package/dist/server/store/cronoton.js +268 -0
- package/dist/server/store/errors.d.ts +26 -0
- package/dist/server/store/errors.js +40 -0
- package/dist/server/store/fires.d.ts +77 -0
- package/dist/server/store/fires.js +170 -0
- package/dist/server/store/index.d.ts +26 -0
- package/dist/server/store/index.js +33 -0
- package/dist/server/store/manual-batch.d.ts +38 -0
- package/dist/server/store/manual-batch.js +110 -0
- package/dist/server/store/mappers.d.ts +21 -0
- package/dist/server/store/mappers.js +62 -0
- package/dist/server/tick.d.ts +83 -0
- package/dist/server/tick.js +235 -0
- package/dist/server/types.d.ts +220 -0
- package/dist/server/types.js +14 -0
- package/dist/types-u_nUX1Bg.d.ts +222 -0
- package/dist/ui/index.d.ts +235 -0
- package/dist/ui/index.js +3646 -0
- package/dist/ui.css +35 -0
- package/package.json +64 -5
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { a as CodexCronotonFireRow, C as CodexCronotonRow, f as CodexFireMode } from '../types-u_nUX1Bg.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The theming boundary. Every Khronoton UI surface renders inside a
|
|
6
|
+
* `<KhronotonUiRoot>` so the `.khronoton-ui` scope carries the `--khr-*`
|
|
7
|
+
* tokens (see `@ancientpantheon/khronoton-core/ui.css`). Components style
|
|
8
|
+
* exclusively via inline `var(--khr-*)` — no Tailwind/utility classes ship.
|
|
9
|
+
*
|
|
10
|
+
* A consumer recolors by overriding the tokens at `body .khronoton-ui`:
|
|
11
|
+
*
|
|
12
|
+
* ```css
|
|
13
|
+
* body .khronoton-ui { --khr-accent: #d4a04a; --khr-bg: #0d0a07; }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
interface KhronotonUiRootProps {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/** Extra classes merged after the `khronoton-ui` scope class. */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
declare function KhronotonUiRoot({ children, className }: KhronotonUiRootProps): ReactNode;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Presentational status/mode atoms for the codex-cronoton surfaces. Every atom
|
|
25
|
+
* styles ONLY via inline `var(--khr-*)` tokens (see `ui.css`); the state → color
|
|
26
|
+
* + label decisions live in the pure `*Style` maps below so they can be unit
|
|
27
|
+
* tested and reused (e.g. a status legend) without mounting React.
|
|
28
|
+
*/
|
|
29
|
+
type CronotonStatus = CodexCronotonRow["status"];
|
|
30
|
+
type FireStatus = CodexCronotonFireRow["status"];
|
|
31
|
+
type FireMode = CodexFireMode;
|
|
32
|
+
declare function CronotonStatusBadge({ status, }: {
|
|
33
|
+
status: CronotonStatus;
|
|
34
|
+
}): ReactNode;
|
|
35
|
+
declare function FireStatusBadge({ status }: {
|
|
36
|
+
status: FireStatus;
|
|
37
|
+
}): ReactNode;
|
|
38
|
+
declare function ModeChip({ mode }: {
|
|
39
|
+
mode: FireMode;
|
|
40
|
+
}): ReactNode;
|
|
41
|
+
declare function ServerResolverPill(): ReactNode;
|
|
42
|
+
declare function ExternallyFireablePill(): ReactNode;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Viewer access model + the pure disable-rule predicates every codex-cronoton
|
|
46
|
+
* screen shares.
|
|
47
|
+
*
|
|
48
|
+
* Auth tier is NOT part of the provider config — the provider carries only the
|
|
49
|
+
* confirm-gate. The host resolves roles and passes the resulting {@link Access}
|
|
50
|
+
* down as a page-level prop; the UI renders tiers. Keeping every "is this action
|
|
51
|
+
* allowed, and why" decision here (pure, exhaustively tested) means no screen
|
|
52
|
+
* re-implements the disable/tooltip precedence in JSX — they consume these
|
|
53
|
+
* predicates and render the `{disabled, title}` verbatim.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/** logged-out (public read-only) · non-admin (signed in, cannot mutate) · admin. */
|
|
57
|
+
type AccessTier = "logged-out" | "non-admin" | "admin";
|
|
58
|
+
/** The viewer's tier plus, when signed in, their email (rendered in footers). */
|
|
59
|
+
interface Access {
|
|
60
|
+
readonly tier: AccessTier;
|
|
61
|
+
readonly email?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* `<CronotonList>` — the codex-cronoton LIST screen at Hub parity.
|
|
66
|
+
*
|
|
67
|
+
* A single-card table over `useCronotons()`: the three-tier "+ New" control, the
|
|
68
|
+
* six parity columns (Name · Operation/Schedule · Next fire · Last fire · Status ·
|
|
69
|
+
* Actions), the per-row Edit/Pause↔Resume/Execute-Now/Delete actions gated by the
|
|
70
|
+
* shared `access.ts` disable rules, and the native confirm → gated mutation →
|
|
71
|
+
* SSR-style refetch flow from `confirm-flows.ts`. No sort/filter/search/bulk/
|
|
72
|
+
* refresh-button/toasts — the Hub had none (REQ-L09).
|
|
73
|
+
*
|
|
74
|
+
* Router-agnostic: the host resolves the viewer tier (the `access` prop) and
|
|
75
|
+
* supplies navigation callbacks (`onOpen`/`onEdit`/`onNew`) instead of framework
|
|
76
|
+
* `<Link>`s. Theming is inline `var(--khr-*)` only; the page assembly wraps this in
|
|
77
|
+
* `<KhronotonUiRoot>` (this component renders no theming boundary of its own).
|
|
78
|
+
*
|
|
79
|
+
* ── The "Last fire" status ────────────────────────────────────────────────────
|
|
80
|
+
* The Hub coloured the Last-fire cell from a per-row last-fire-status subquery. The
|
|
81
|
+
* generic `CodexCronotonRow` does not carry that natively (the built-in store
|
|
82
|
+
* projection omits it), so the cell reads an OPTIONAL `last_fire_status` a host read
|
|
83
|
+
* may attach; absent ⇒ the "—" placeholder. See {@link CronotonListRow}.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/** The default `robots` policy — the list is publicly readable but not indexable. */
|
|
87
|
+
declare const DEFAULT_LIST_ROBOTS = "noindex,nofollow";
|
|
88
|
+
/**
|
|
89
|
+
* A list row plus the optional last-fire status the host read may attach (the
|
|
90
|
+
* generic {@link CodexCronotonRow} does not model it; see the module note).
|
|
91
|
+
*/
|
|
92
|
+
type CronotonListRow = CodexCronotonRow & {
|
|
93
|
+
last_fire_status?: FireStatus | null;
|
|
94
|
+
};
|
|
95
|
+
interface CronotonListProps {
|
|
96
|
+
/** The viewer tier (+ email) the host resolves; drives every disable rule. */
|
|
97
|
+
access: Access;
|
|
98
|
+
/** Open a cronoton's detail/observe screen (the Name link + logged-out view). */
|
|
99
|
+
onOpen?: (id: string) => void;
|
|
100
|
+
/** Navigate to a cronoton's edit screen (admin-only Edit action). */
|
|
101
|
+
onEdit?: (id: string) => void;
|
|
102
|
+
/** Navigate to the create builder (admin-only "+ New Codex Cronoton"). */
|
|
103
|
+
onNew?: () => void;
|
|
104
|
+
/** The page `robots` meta content (REQ-G07); defaults to noindex,nofollow. */
|
|
105
|
+
robots?: string;
|
|
106
|
+
}
|
|
107
|
+
declare function CronotonList({ access, onOpen, onEdit, onNew, robots, }: CronotonListProps): ReactNode;
|
|
108
|
+
|
|
109
|
+
/** The default `robots` policy — the detail page is readable but not indexable. */
|
|
110
|
+
declare const DEFAULT_DETAIL_ROBOTS = "noindex,nofollow";
|
|
111
|
+
interface DetailProps {
|
|
112
|
+
/** The cronoton to observe. */
|
|
113
|
+
id: string;
|
|
114
|
+
/** The viewer tier (+ email) the host resolves; drives every disable rule. */
|
|
115
|
+
access: Access;
|
|
116
|
+
/** Return to the list screen (the back link). */
|
|
117
|
+
onBack?: () => void;
|
|
118
|
+
/** Navigate to this cronoton's edit screen (admin-only Edit action). */
|
|
119
|
+
onEdit?: (id: string) => void;
|
|
120
|
+
/** Navigate back to the list after a successful delete (the row is gone). */
|
|
121
|
+
onNavigateToList?: () => void;
|
|
122
|
+
/** The page `robots` meta content; defaults to noindex,nofollow. */
|
|
123
|
+
robots?: string;
|
|
124
|
+
}
|
|
125
|
+
declare function Detail({ id, access, onBack, onEdit, onNavigateToList, robots, }: DetailProps): ReactNode;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Builder assembly — the two-pane create/edit form (REQ-B01/B02/B11).
|
|
129
|
+
*
|
|
130
|
+
* This is the single owner of the shared {@link BuilderState}: it hosts the
|
|
131
|
+
* already-built controlled tabs (Config, Payload, Gas Payer, Signatures, Execute)
|
|
132
|
+
* and the Pact editor, wires each tab's `onChange` back into the one state, fetches
|
|
133
|
+
* the signer descriptors exactly once, and routes Commit through the create/edit
|
|
134
|
+
* action hooks (both confirm-gated via `runGated`).
|
|
135
|
+
*
|
|
136
|
+
* onChange contract per tab (the load-bearing detail): every tab EXCEPT Payload
|
|
137
|
+
* emits a full next `BuilderState` (so we pass `setState` directly); `PayloadTab`
|
|
138
|
+
* emits a `PayloadState` slice, which we splice back into the whole state. The tabs
|
|
139
|
+
* are controlled children — nothing owns form state but this component, so a tab
|
|
140
|
+
* switch never loses an edit.
|
|
141
|
+
*
|
|
142
|
+
* Edit mode (`editId`): the persisted row is fetched once and rehydrated through
|
|
143
|
+
* `detailToBuilderState` (payload forced to raw mode, gas price → ANU, signers
|
|
144
|
+
* lossy, schedule preserved, the create-only Row C hidden). Save issues a PATCH via
|
|
145
|
+
* `edit.run` (the patch is the full commit body — `EditPatch = Partial<CommitBody>`)
|
|
146
|
+
* rather than a create POST. On success either path calls `onDone` with the id.
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
/** Default `<meta name="robots">` for the builder route (host-overridable). */
|
|
150
|
+
declare const DEFAULT_BUILDER_ROBOTS = "noindex,nofollow";
|
|
151
|
+
interface BuilderProps {
|
|
152
|
+
/** Present → edit mode: rehydrate this cronoton and PATCH on save. Absent → create. */
|
|
153
|
+
readonly editId?: string;
|
|
154
|
+
/** Viewer tier; the builder is an admin-only surface (the host gates the route). */
|
|
155
|
+
readonly access: Access;
|
|
156
|
+
/** Called with the new/edited id after a successful commit so the host can navigate. */
|
|
157
|
+
readonly onDone?: (id?: string) => void;
|
|
158
|
+
/** Robots directive rendered into `<meta name="robots">`. */
|
|
159
|
+
readonly robots?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The two-pane codex-cronoton builder. Owns `BuilderState`; renders the Pact editor
|
|
163
|
+
* on the left and the header + five-tab bar on the right, feeding every tab the
|
|
164
|
+
* shared state and folding its `onChange` back in.
|
|
165
|
+
*/
|
|
166
|
+
declare function Builder({ editId, access: _access, onDone, robots, }: BuilderProps): ReactNode;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* `<Public>` — the read-only public transparency wrapper over `<Detail>`.
|
|
170
|
+
*
|
|
171
|
+
* This is NOT a fork of Detail: it REUSES `<Detail>` with a fixed logged-out
|
|
172
|
+
* access tier. Detail already gates every control on `access` via the shared
|
|
173
|
+
* predicates, so pinning `access.tier` to `"logged-out"` hides all mutation
|
|
174
|
+
* affordances, the `<ManualBatchCard>` and `<RuntimeArgTriggerCard>` self-suppress
|
|
175
|
+
* to null, and the metadata panel + `<FireHistory>` (with Explorer verify links)
|
|
176
|
+
* remain visible — the whole point of a public transparency view. A public
|
|
177
|
+
* viewer's fire-poll hitting a gated JSON route fails silently: the underlying
|
|
178
|
+
* poller already swallows poll errors, so no error UI is (or should be) added.
|
|
179
|
+
*
|
|
180
|
+
* Detail owns the `<meta name="robots">`, so `robots` is only threaded through —
|
|
181
|
+
* never re-rendered here. Around Detail this adds a public chrome: a top bar
|
|
182
|
+
* announcing the read-only nature and an attribution footer reused verbatim from
|
|
183
|
+
* the list's logged-out footer.
|
|
184
|
+
*
|
|
185
|
+
* ## Mount discipline (REQ-PB03)
|
|
186
|
+
* The tree is browser-only — fire pollers and self-refreshing `RelativeTime`
|
|
187
|
+
* timers must NOT be server-rendered. The host mounts `<Public>` through an
|
|
188
|
+
* `ssr:false` dynamic import (or the framework equivalent):
|
|
189
|
+
*
|
|
190
|
+
* ```tsx
|
|
191
|
+
* import dynamic from "next/dynamic";
|
|
192
|
+
*
|
|
193
|
+
* const Public = dynamic(
|
|
194
|
+
* () => import("@ancientpantheon/khronoton-core/ui").then((m) => m.Public),
|
|
195
|
+
* { ssr: false },
|
|
196
|
+
* );
|
|
197
|
+
*
|
|
198
|
+
* export default function PublicCronotonPage({ params }: { params: { id: string } }) {
|
|
199
|
+
* return (
|
|
200
|
+
* <KhronotonProvider adapter={publicAdapter}>
|
|
201
|
+
* <KhronotonUiRoot>
|
|
202
|
+
* <Public id={params.id} />
|
|
203
|
+
* </KhronotonUiRoot>
|
|
204
|
+
* </KhronotonProvider>
|
|
205
|
+
* );
|
|
206
|
+
* }
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
/** The default `robots` policy for the public view — readable but not indexable. */
|
|
211
|
+
declare const DEFAULT_PUBLIC_ROBOTS = "noindex,nofollow";
|
|
212
|
+
interface PublicProps {
|
|
213
|
+
/** The cronoton to observe read-only. */
|
|
214
|
+
id: string;
|
|
215
|
+
/** The page `robots` meta content; defaults to noindex,nofollow. */
|
|
216
|
+
robots?: string;
|
|
217
|
+
}
|
|
218
|
+
declare function Public({ id, robots }: PublicProps): ReactNode;
|
|
219
|
+
|
|
220
|
+
interface RelativeTimeProps {
|
|
221
|
+
/** ISO-8601 timestamp to render relative to the current instant. */
|
|
222
|
+
iso: string;
|
|
223
|
+
/** Extra classes merged after the component renders as a `<time>` element. */
|
|
224
|
+
className?: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Self-refreshing relative-time label. Re-renders on an interval whose cadence
|
|
228
|
+
* tracks proximity (1s within a minute, 30s otherwise) and tears the interval
|
|
229
|
+
* down on unmount. SSR-safe: no window/timer is touched during a server render —
|
|
230
|
+
* the initial label is computed synchronously and the interval only arms in the
|
|
231
|
+
* browser effect.
|
|
232
|
+
*/
|
|
233
|
+
declare function RelativeTime({ iso, className }: RelativeTimeProps): ReactNode;
|
|
234
|
+
|
|
235
|
+
export { type Access, type AccessTier, Builder, type BuilderProps, CronotonList, type CronotonListProps, type CronotonListRow, CronotonStatusBadge, DEFAULT_BUILDER_ROBOTS, DEFAULT_DETAIL_ROBOTS, DEFAULT_LIST_ROBOTS, DEFAULT_PUBLIC_ROBOTS, Detail, type DetailProps, ExternallyFireablePill, FireStatusBadge, KhronotonUiRoot, type KhronotonUiRootProps, CronotonList as List, ModeChip, Public, type PublicProps, RelativeTime, type RelativeTimeProps, ServerResolverPill };
|