@realiizlabs/admin 0.8.0 → 0.8.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.
- package/dist/auth-ui/index.cjs +56 -0
- package/dist/auth-ui/index.cjs.map +1 -1
- package/dist/auth-ui/index.js +1 -1
- package/dist/chunk-CE2DRQBD.js +98 -0
- package/dist/chunk-CE2DRQBD.js.map +1 -0
- package/dist/{chunk-FGKT5FD4.js → chunk-J6FI73PF.js} +31 -4
- package/dist/chunk-J6FI73PF.js.map +1 -0
- package/dist/forms/index.cjs +29 -2
- package/dist/forms/index.cjs.map +1 -1
- package/dist/forms/index.d.cts +2 -2
- package/dist/forms/index.d.ts +2 -2
- package/dist/forms/index.js +1 -1
- package/dist/forms-ui/index.cjs +770 -39
- package/dist/forms-ui/index.cjs.map +1 -1
- package/dist/forms-ui/index.d.cts +123 -12
- package/dist/forms-ui/index.d.ts +123 -12
- package/dist/forms-ui/index.js +691 -41
- package/dist/forms-ui/index.js.map +1 -1
- package/dist/git/index.cjs +16 -4
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.d.cts +25 -2
- package/dist/git/index.d.ts +25 -2
- package/dist/git/index.js +15 -5
- package/dist/git/index.js.map +1 -1
- package/dist/shell/index.cjs +248 -77
- package/dist/shell/index.cjs.map +1 -1
- package/dist/shell/index.d.cts +29 -5
- package/dist/shell/index.d.ts +29 -5
- package/dist/shell/index.js +247 -79
- package/dist/shell/index.js.map +1 -1
- package/dist/{types-DsSMscTh.d.cts → types-DyryuIX1.d.cts} +24 -1
- package/dist/{types-DsSMscTh.d.ts → types-DyryuIX1.d.ts} +24 -1
- package/package.json +1 -1
- package/dist/chunk-4OCBMOEP.js +0 -42
- package/dist/chunk-4OCBMOEP.js.map +0 -1
- package/dist/chunk-FGKT5FD4.js.map +0 -1
|
@@ -1,7 +1,78 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { C as ContentTypeEntry } from '../types-DyryuIX1.cjs';
|
|
3
4
|
import 'zod';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Control strings ↔ frontmatter values. Pure.
|
|
8
|
+
*
|
|
9
|
+
* Controls hold strings (or booleans / Files). The schema wants typed values.
|
|
10
|
+
* `toControl` seeds a control from an existing frontmatter value — including
|
|
11
|
+
* a Date from a previously-parsed file — and `toValue` assembles what goes to
|
|
12
|
+
* safeParse. Anything the schema then coerces (dates) is the schema's business.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Stand-in path for an image chosen but not yet uploaded — replaced by ADMIN-06. */
|
|
16
|
+
declare const PENDING_UPLOAD_PREFIX = "pending-upload/";
|
|
17
|
+
|
|
18
|
+
type LabelRenderer = (label: string, help: string) => ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Advisory length gauge. The bar is the whole scale (a bit past the max so
|
|
21
|
+
* "over" has room to show), a green band marks the target range, and the fill
|
|
22
|
+
* grows with the text in the state's colour: grey while short, green in range,
|
|
23
|
+
* red past it. The words repeat only what the bar can't: the count and a verdict.
|
|
24
|
+
*/
|
|
25
|
+
declare function LengthGauge({ length: raw, range, suffix }: {
|
|
26
|
+
length: number;
|
|
27
|
+
range: [number, number];
|
|
28
|
+
suffix?: string;
|
|
29
|
+
}): react.JSX.Element;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Toolbar edits — pure functions (text, selStart, selEnd) → { text, a, b }.
|
|
33
|
+
*
|
|
34
|
+
* Every formatting tool TOGGLES, like the surveillance-review report editor:
|
|
35
|
+
* bold on bold text un-bolds; H2 on an H2 line removes it; H3 on an H2 line
|
|
36
|
+
* swaps it; link anywhere inside a link removes it. `activeTools` reports which
|
|
37
|
+
* of them the caret is currently "in", so the buttons can light up and say what
|
|
38
|
+
* they're about to do.
|
|
39
|
+
*/
|
|
40
|
+
type Edit = {
|
|
41
|
+
text: string;
|
|
42
|
+
a: number;
|
|
43
|
+
b: number;
|
|
44
|
+
};
|
|
45
|
+
type Apply = (s: string, a: number, b: number) => Edit;
|
|
46
|
+
interface Tool {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
apply: Apply;
|
|
50
|
+
}
|
|
51
|
+
declare const TOOLS: Tool[];
|
|
52
|
+
|
|
53
|
+
interface MarkdownEditorProps {
|
|
54
|
+
id: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
value: string;
|
|
57
|
+
onChange: (v: string) => void;
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/** Host-supplied renderer returning HTML. Errors should be returned as `{ error }`. */
|
|
60
|
+
renderPreview?: (markdown: string) => Promise<{
|
|
61
|
+
html: string;
|
|
62
|
+
} | {
|
|
63
|
+
error: string;
|
|
64
|
+
}>;
|
|
65
|
+
/** Extra class on the preview body, e.g. the site's own prose class so it matches the blog. */
|
|
66
|
+
previewClassName?: string;
|
|
67
|
+
minHeight?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Name of the site's tooltip MDX component, e.g. "Term" → a toolbar button that wraps the
|
|
70
|
+
* selection as `<Term definition="">word</Term>`. Off unless the site has such a component.
|
|
71
|
+
*/
|
|
72
|
+
termComponent?: string;
|
|
73
|
+
}
|
|
74
|
+
declare function MarkdownEditor({ id, name, value, onChange, placeholder, renderPreview, previewClassName, minHeight, termComponent }: MarkdownEditorProps): react.JSX.Element;
|
|
75
|
+
|
|
5
76
|
interface ContentFormSubmission {
|
|
6
77
|
frontmatter: Record<string, unknown>;
|
|
7
78
|
body: string;
|
|
@@ -23,19 +94,59 @@ interface ContentFormProps {
|
|
|
23
94
|
*/
|
|
24
95
|
showBody?: boolean;
|
|
25
96
|
bodyLabel?: string;
|
|
97
|
+
/** Host-supplied Markdown/MDX renderer for the Preview tab. Without it the editor is edit-only. */
|
|
98
|
+
renderPreview?: MarkdownEditorProps["renderPreview"];
|
|
99
|
+
previewClassName?: string;
|
|
100
|
+
/** Site tooltip MDX component name (e.g. "Term") to expose as a toolbar button. */
|
|
101
|
+
termComponent?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Put Cancel/Save in a bar that the host can pin to the bottom of the page
|
|
104
|
+
* (`.realiiz-form__bar`; the shell makes it sticky). The bar also reports
|
|
105
|
+
* "Unsaved changes" / "No changes yet", or `status` when the host supplies one.
|
|
106
|
+
*/
|
|
107
|
+
stickyBar?: boolean;
|
|
108
|
+
status?: ReactNode;
|
|
109
|
+
/** Extra controls in the bar, before Cancel/Save — e.g. a link to review a pending change. */
|
|
110
|
+
barExtra?: ReactNode;
|
|
111
|
+
/** Rendered after the fields and before the bar — the right place for a quiet destructive action (remove this item). */
|
|
112
|
+
footer?: ReactNode;
|
|
113
|
+
/** Draw a field label that has `.meta({ help })` — pass the site's tooltip component so labels explain themselves. */
|
|
114
|
+
renderLabel?: LabelRenderer;
|
|
115
|
+
/**
|
|
116
|
+
* Fill `target` from `source` while the person types, until they edit `target`
|
|
117
|
+
* themselves — e.g. { source: "title", target: "slug" } for a web address.
|
|
118
|
+
* Only kicks in when `target` started empty (a new item), never on an existing one.
|
|
119
|
+
*/
|
|
120
|
+
derive?: {
|
|
121
|
+
source: string;
|
|
122
|
+
target: string;
|
|
123
|
+
transform?: (value: string) => string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Warn before leaving with unsaved edits: the browser's own prompt on close/reload,
|
|
127
|
+
* and a confirm on in-app link clicks (which never fire beforeunload). Default true.
|
|
128
|
+
*/
|
|
129
|
+
guardUnsaved?: boolean;
|
|
26
130
|
}
|
|
27
|
-
|
|
131
|
+
/** "Hello, World! 2026" → "hello-world-2026" — the same rule the blog's slug regex enforces. */
|
|
132
|
+
declare function slugify(s: string): string;
|
|
133
|
+
declare function ContentForm({ entry, initialValues, initialBody, onSubmit, onCancel, submitLabel, className, showBody, bodyLabel, renderPreview, previewClassName, termComponent, stickyBar, status, barExtra, footer, renderLabel, derive, guardUnsaved }: ContentFormProps): react.JSX.Element;
|
|
28
134
|
|
|
29
135
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `toControl` seeds a control from an existing frontmatter value — including
|
|
34
|
-
* a Date from a previously-parsed file — and `toValue` assembles what goes to
|
|
35
|
-
* safeParse. Anything the schema then coerces (dates) is the schema's business.
|
|
136
|
+
* ChipsInput — tags as chips. Enter or comma adds, × or Backspace-on-empty
|
|
137
|
+
* removes. The value is a string[]; the schema's length/regex rules still run
|
|
138
|
+
* on submit, this is only a nicer way to type them.
|
|
36
139
|
*/
|
|
140
|
+
declare function ChipsInput({ id, name, value, onChange, onBlur, placeholder, invalid, max }: {
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
value: string[];
|
|
144
|
+
onChange: (v: string[]) => void;
|
|
145
|
+
onBlur: () => void;
|
|
146
|
+
placeholder?: string;
|
|
147
|
+
invalid?: boolean;
|
|
148
|
+
/** When the schema says exactly N, show "n of N". */
|
|
149
|
+
max?: number;
|
|
150
|
+
}): react.JSX.Element;
|
|
37
151
|
|
|
38
|
-
|
|
39
|
-
declare const PENDING_UPLOAD_PREFIX = "pending-upload/";
|
|
40
|
-
|
|
41
|
-
export { ContentForm, type ContentFormProps, type ContentFormSubmission, PENDING_UPLOAD_PREFIX };
|
|
152
|
+
export { ChipsInput, ContentForm, type ContentFormProps, type ContentFormSubmission, type LabelRenderer, LengthGauge, MarkdownEditor, type MarkdownEditorProps, PENDING_UPLOAD_PREFIX, TOOLS, slugify };
|
package/dist/forms-ui/index.d.ts
CHANGED
|
@@ -1,7 +1,78 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { C as ContentTypeEntry } from '../types-DyryuIX1.js';
|
|
3
4
|
import 'zod';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Control strings ↔ frontmatter values. Pure.
|
|
8
|
+
*
|
|
9
|
+
* Controls hold strings (or booleans / Files). The schema wants typed values.
|
|
10
|
+
* `toControl` seeds a control from an existing frontmatter value — including
|
|
11
|
+
* a Date from a previously-parsed file — and `toValue` assembles what goes to
|
|
12
|
+
* safeParse. Anything the schema then coerces (dates) is the schema's business.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Stand-in path for an image chosen but not yet uploaded — replaced by ADMIN-06. */
|
|
16
|
+
declare const PENDING_UPLOAD_PREFIX = "pending-upload/";
|
|
17
|
+
|
|
18
|
+
type LabelRenderer = (label: string, help: string) => ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Advisory length gauge. The bar is the whole scale (a bit past the max so
|
|
21
|
+
* "over" has room to show), a green band marks the target range, and the fill
|
|
22
|
+
* grows with the text in the state's colour: grey while short, green in range,
|
|
23
|
+
* red past it. The words repeat only what the bar can't: the count and a verdict.
|
|
24
|
+
*/
|
|
25
|
+
declare function LengthGauge({ length: raw, range, suffix }: {
|
|
26
|
+
length: number;
|
|
27
|
+
range: [number, number];
|
|
28
|
+
suffix?: string;
|
|
29
|
+
}): react.JSX.Element;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Toolbar edits — pure functions (text, selStart, selEnd) → { text, a, b }.
|
|
33
|
+
*
|
|
34
|
+
* Every formatting tool TOGGLES, like the surveillance-review report editor:
|
|
35
|
+
* bold on bold text un-bolds; H2 on an H2 line removes it; H3 on an H2 line
|
|
36
|
+
* swaps it; link anywhere inside a link removes it. `activeTools` reports which
|
|
37
|
+
* of them the caret is currently "in", so the buttons can light up and say what
|
|
38
|
+
* they're about to do.
|
|
39
|
+
*/
|
|
40
|
+
type Edit = {
|
|
41
|
+
text: string;
|
|
42
|
+
a: number;
|
|
43
|
+
b: number;
|
|
44
|
+
};
|
|
45
|
+
type Apply = (s: string, a: number, b: number) => Edit;
|
|
46
|
+
interface Tool {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
apply: Apply;
|
|
50
|
+
}
|
|
51
|
+
declare const TOOLS: Tool[];
|
|
52
|
+
|
|
53
|
+
interface MarkdownEditorProps {
|
|
54
|
+
id: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
value: string;
|
|
57
|
+
onChange: (v: string) => void;
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/** Host-supplied renderer returning HTML. Errors should be returned as `{ error }`. */
|
|
60
|
+
renderPreview?: (markdown: string) => Promise<{
|
|
61
|
+
html: string;
|
|
62
|
+
} | {
|
|
63
|
+
error: string;
|
|
64
|
+
}>;
|
|
65
|
+
/** Extra class on the preview body, e.g. the site's own prose class so it matches the blog. */
|
|
66
|
+
previewClassName?: string;
|
|
67
|
+
minHeight?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Name of the site's tooltip MDX component, e.g. "Term" → a toolbar button that wraps the
|
|
70
|
+
* selection as `<Term definition="">word</Term>`. Off unless the site has such a component.
|
|
71
|
+
*/
|
|
72
|
+
termComponent?: string;
|
|
73
|
+
}
|
|
74
|
+
declare function MarkdownEditor({ id, name, value, onChange, placeholder, renderPreview, previewClassName, minHeight, termComponent }: MarkdownEditorProps): react.JSX.Element;
|
|
75
|
+
|
|
5
76
|
interface ContentFormSubmission {
|
|
6
77
|
frontmatter: Record<string, unknown>;
|
|
7
78
|
body: string;
|
|
@@ -23,19 +94,59 @@ interface ContentFormProps {
|
|
|
23
94
|
*/
|
|
24
95
|
showBody?: boolean;
|
|
25
96
|
bodyLabel?: string;
|
|
97
|
+
/** Host-supplied Markdown/MDX renderer for the Preview tab. Without it the editor is edit-only. */
|
|
98
|
+
renderPreview?: MarkdownEditorProps["renderPreview"];
|
|
99
|
+
previewClassName?: string;
|
|
100
|
+
/** Site tooltip MDX component name (e.g. "Term") to expose as a toolbar button. */
|
|
101
|
+
termComponent?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Put Cancel/Save in a bar that the host can pin to the bottom of the page
|
|
104
|
+
* (`.realiiz-form__bar`; the shell makes it sticky). The bar also reports
|
|
105
|
+
* "Unsaved changes" / "No changes yet", or `status` when the host supplies one.
|
|
106
|
+
*/
|
|
107
|
+
stickyBar?: boolean;
|
|
108
|
+
status?: ReactNode;
|
|
109
|
+
/** Extra controls in the bar, before Cancel/Save — e.g. a link to review a pending change. */
|
|
110
|
+
barExtra?: ReactNode;
|
|
111
|
+
/** Rendered after the fields and before the bar — the right place for a quiet destructive action (remove this item). */
|
|
112
|
+
footer?: ReactNode;
|
|
113
|
+
/** Draw a field label that has `.meta({ help })` — pass the site's tooltip component so labels explain themselves. */
|
|
114
|
+
renderLabel?: LabelRenderer;
|
|
115
|
+
/**
|
|
116
|
+
* Fill `target` from `source` while the person types, until they edit `target`
|
|
117
|
+
* themselves — e.g. { source: "title", target: "slug" } for a web address.
|
|
118
|
+
* Only kicks in when `target` started empty (a new item), never on an existing one.
|
|
119
|
+
*/
|
|
120
|
+
derive?: {
|
|
121
|
+
source: string;
|
|
122
|
+
target: string;
|
|
123
|
+
transform?: (value: string) => string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Warn before leaving with unsaved edits: the browser's own prompt on close/reload,
|
|
127
|
+
* and a confirm on in-app link clicks (which never fire beforeunload). Default true.
|
|
128
|
+
*/
|
|
129
|
+
guardUnsaved?: boolean;
|
|
26
130
|
}
|
|
27
|
-
|
|
131
|
+
/** "Hello, World! 2026" → "hello-world-2026" — the same rule the blog's slug regex enforces. */
|
|
132
|
+
declare function slugify(s: string): string;
|
|
133
|
+
declare function ContentForm({ entry, initialValues, initialBody, onSubmit, onCancel, submitLabel, className, showBody, bodyLabel, renderPreview, previewClassName, termComponent, stickyBar, status, barExtra, footer, renderLabel, derive, guardUnsaved }: ContentFormProps): react.JSX.Element;
|
|
28
134
|
|
|
29
135
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `toControl` seeds a control from an existing frontmatter value — including
|
|
34
|
-
* a Date from a previously-parsed file — and `toValue` assembles what goes to
|
|
35
|
-
* safeParse. Anything the schema then coerces (dates) is the schema's business.
|
|
136
|
+
* ChipsInput — tags as chips. Enter or comma adds, × or Backspace-on-empty
|
|
137
|
+
* removes. The value is a string[]; the schema's length/regex rules still run
|
|
138
|
+
* on submit, this is only a nicer way to type them.
|
|
36
139
|
*/
|
|
140
|
+
declare function ChipsInput({ id, name, value, onChange, onBlur, placeholder, invalid, max }: {
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
value: string[];
|
|
144
|
+
onChange: (v: string[]) => void;
|
|
145
|
+
onBlur: () => void;
|
|
146
|
+
placeholder?: string;
|
|
147
|
+
invalid?: boolean;
|
|
148
|
+
/** When the schema says exactly N, show "n of N". */
|
|
149
|
+
max?: number;
|
|
150
|
+
}): react.JSX.Element;
|
|
37
151
|
|
|
38
|
-
|
|
39
|
-
declare const PENDING_UPLOAD_PREFIX = "pending-upload/";
|
|
40
|
-
|
|
41
|
-
export { ContentForm, type ContentFormProps, type ContentFormSubmission, PENDING_UPLOAD_PREFIX };
|
|
152
|
+
export { ChipsInput, ContentForm, type ContentFormProps, type ContentFormSubmission, type LabelRenderer, LengthGauge, MarkdownEditor, type MarkdownEditorProps, PENDING_UPLOAD_PREFIX, TOOLS, slugify };
|