@cauthyhq/node 0.0.0-stage → 1.0.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 +202 -0
- package/NOTICE +8 -0
- package/README.md +181 -2
- package/dist/cauthy-B6Sm3T8M.d.ts +1035 -0
- package/dist/cauthy-ClP5orP4.d.mts +1035 -0
- package/dist/express.d.mts +25 -0
- package/dist/express.d.ts +25 -0
- package/dist/express.js +103 -0
- package/dist/express.js.map +1 -0
- package/dist/express.mjs +77 -0
- package/dist/express.mjs.map +1 -0
- package/dist/fastify.d.mts +38 -0
- package/dist/fastify.d.ts +38 -0
- package/dist/fastify.js +105 -0
- package/dist/fastify.js.map +1 -0
- package/dist/fastify.mjs +79 -0
- package/dist/fastify.mjs.map +1 -0
- package/dist/hono.d.mts +24 -0
- package/dist/hono.d.ts +24 -0
- package/dist/hono.js +51 -0
- package/dist/hono.js.map +1 -0
- package/dist/hono.mjs +25 -0
- package/dist/hono.mjs.map +1 -0
- package/dist/index.d.mts +138 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +3474 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3410 -0
- package/dist/index.mjs.map +1 -0
- package/dist/keys-D5k0omTb.d.mts +64 -0
- package/dist/keys-D5k0omTb.d.ts +64 -0
- package/dist/keys.d.mts +8 -0
- package/dist/keys.d.ts +8 -0
- package/dist/keys.js +157 -0
- package/dist/keys.js.map +1 -0
- package/dist/keys.mjs +129 -0
- package/dist/keys.mjs.map +1 -0
- package/dist/mcp.d.mts +151 -0
- package/dist/mcp.d.ts +151 -0
- package/dist/mcp.js +410 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mcp.mjs +382 -0
- package/dist/mcp.mjs.map +1 -0
- package/dist/next.d.mts +24 -0
- package/dist/next.d.ts +24 -0
- package/dist/next.js +77 -0
- package/dist/next.js.map +1 -0
- package/dist/next.mjs +52 -0
- package/dist/next.mjs.map +1 -0
- package/dist/testing.d.mts +62 -0
- package/dist/testing.d.ts +62 -0
- package/dist/testing.js +182 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.mjs +156 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/theme.d.mts +183 -0
- package/dist/theme.d.ts +183 -0
- package/dist/theme.js +531 -0
- package/dist/theme.js.map +1 -0
- package/dist/theme.mjs +496 -0
- package/dist/theme.mjs.map +1 -0
- package/package.json +187 -4
package/dist/theme.d.mts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/** How an application looks on Cauthy's hosted pages. Every value is optional. */
|
|
2
|
+
/** One font file the application serves: a family in one weight (or a range) and one style. */
|
|
3
|
+
interface ThemeFont {
|
|
4
|
+
family: string;
|
|
5
|
+
/** An https address of a `.woff2` file. It must answer with `Access-Control-Allow-Origin` for Cauthy's origin. */
|
|
6
|
+
url: string;
|
|
7
|
+
/** `400`, or `"100 900"` for a variable font. Default: 400. */
|
|
8
|
+
weight?: number | string;
|
|
9
|
+
style?: 'normal' | 'italic';
|
|
10
|
+
}
|
|
11
|
+
/** What an application says on its sign-in page, in one language. */
|
|
12
|
+
interface ThemeTexts {
|
|
13
|
+
/** Replaces "Sign in". */
|
|
14
|
+
heading?: string;
|
|
15
|
+
/** Replaces "to continue to …". */
|
|
16
|
+
subheading?: string;
|
|
17
|
+
/** The messages of the split layout's panel, shown one at a time (up to 5). */
|
|
18
|
+
panel?: string[];
|
|
19
|
+
/** Links at the foot of the split layout: privacy, terms (up to 4). */
|
|
20
|
+
links?: {
|
|
21
|
+
label: string;
|
|
22
|
+
url: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
interface CauthyTheme {
|
|
26
|
+
/** The page. Colours are `#rrggbb` or `rgba(r, g, b, a)`. */
|
|
27
|
+
background?: string;
|
|
28
|
+
/** The card, and inputs. */
|
|
29
|
+
surface?: string;
|
|
30
|
+
/** Headings and what is typed. */
|
|
31
|
+
text?: string;
|
|
32
|
+
/** Paragraphs, labels, small print. */
|
|
33
|
+
textMuted?: string;
|
|
34
|
+
border?: string;
|
|
35
|
+
/** The fields and the secondary buttons, when they are not the card's colours. */
|
|
36
|
+
inputBackground?: string;
|
|
37
|
+
inputBorder?: string;
|
|
38
|
+
/** The main button, and what is written on it. */
|
|
39
|
+
primary?: string;
|
|
40
|
+
primaryText?: string;
|
|
41
|
+
/** Links, and the focus ring. */
|
|
42
|
+
accent?: string;
|
|
43
|
+
error?: string;
|
|
44
|
+
errorBackground?: string;
|
|
45
|
+
success?: string;
|
|
46
|
+
successBackground?: string;
|
|
47
|
+
/** Corners of cards and inputs, in pixels (0–40). */
|
|
48
|
+
radius?: number;
|
|
49
|
+
/** Corners of buttons, in pixels (0–40). */
|
|
50
|
+
buttonRadius?: number;
|
|
51
|
+
/** A CSS font-family list: the application's typeface first, a system font after it. */
|
|
52
|
+
fontFamily?: string;
|
|
53
|
+
/** The files of the typefaces `fontFamily` names, for people who do not have them installed. */
|
|
54
|
+
fonts?: ThemeFont[];
|
|
55
|
+
/** An image shown where "Cauthy" is, over https. */
|
|
56
|
+
logoUrl?: string;
|
|
57
|
+
/**
|
|
58
|
+
* How the sign-in pages are laid out: `card` (the default, one card in the
|
|
59
|
+
* middle) or `split` (the form on one side, a panel that presents the
|
|
60
|
+
* application on the other).
|
|
61
|
+
*/
|
|
62
|
+
layout?: 'card' | 'split';
|
|
63
|
+
/** The colours the split layout's backdrop blends, one to four. */
|
|
64
|
+
panelColors?: string[];
|
|
65
|
+
/** The colour of what is written on the panel. */
|
|
66
|
+
panelText?: string;
|
|
67
|
+
/** An https image shown over the panel's messages. */
|
|
68
|
+
panelIconUrl?: string;
|
|
69
|
+
/** The application's own words on the sign-in page, by language (`en`, `es`). */
|
|
70
|
+
texts?: Record<string, ThemeTexts>;
|
|
71
|
+
/**
|
|
72
|
+
* The application's Stackmyth tokens (`--sm-*`), from `tokensFromStackmyth`.
|
|
73
|
+
* Cauthy's pages are drawn with Stackmyth's components, so these make its
|
|
74
|
+
* buttons and fields the application's own. They are laid over the named values.
|
|
75
|
+
*/
|
|
76
|
+
tokens?: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
interface StackmythThemeOptions {
|
|
79
|
+
/**
|
|
80
|
+
* The named theme to read, when the stylesheet keeps several under
|
|
81
|
+
* `[data-theme=…]` (`"acme"`). Without it only what applies to every
|
|
82
|
+
* page (`:root`) is read.
|
|
83
|
+
*/
|
|
84
|
+
theme?: string;
|
|
85
|
+
/** Which of the application's two modes to take. Default: `light`. */
|
|
86
|
+
mode?: 'light' | 'dark';
|
|
87
|
+
logoUrl?: string;
|
|
88
|
+
}
|
|
89
|
+
interface ImportedTheme {
|
|
90
|
+
theme: CauthyTheme;
|
|
91
|
+
/** Tokens that were there and could not be carried over, and why. */
|
|
92
|
+
warnings: string[];
|
|
93
|
+
}
|
|
94
|
+
interface StackmythTokens {
|
|
95
|
+
/** Every `--sm-*` token the stylesheets set for the page, ready for `theme.tokens`. */
|
|
96
|
+
tokens: Record<string, string>;
|
|
97
|
+
/** Tokens that were there and Cauthy would not take, and why. */
|
|
98
|
+
warnings: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Reads an application's Stackmyth tokens out of its stylesheets: every
|
|
102
|
+
* `--sm-*` custom property its theme sets, in the order the sheets are given
|
|
103
|
+
* (a later one wins). Its own names — a brand palette the tokens point at —
|
|
104
|
+
* are written in, so what comes out stands on Stackmyth's names alone.
|
|
105
|
+
*
|
|
106
|
+
* Cauthy's sign-in pages are drawn with Stackmyth's components: these tokens
|
|
107
|
+
* are what makes them look like the application.
|
|
108
|
+
*/
|
|
109
|
+
declare function tokensFromStackmyth(css: string | string[], options?: StackmythThemeOptions): StackmythTokens;
|
|
110
|
+
/** A colour as Cauthy takes it — `#rrggbb` or `rgba(…)` — or null when it is none it can read. */
|
|
111
|
+
declare function toColor(value: string): string | null;
|
|
112
|
+
/**
|
|
113
|
+
* Reads an application's Stackmyth theme out of its stylesheets.
|
|
114
|
+
*
|
|
115
|
+
* Give it the CSS that declares the tokens, in the order the application
|
|
116
|
+
* loads it — Stackmyth's own (`@stackmyth/core/core.vars.css`, or a theme
|
|
117
|
+
* file) and then the application's brand file that re-points them. Tokens
|
|
118
|
+
* that point at the application's own variables are followed. The
|
|
119
|
+
* application's dark mode is left out unless asked for.
|
|
120
|
+
*/
|
|
121
|
+
declare function themeFromStackmyth(css: string | string[], options?: StackmythThemeOptions): ImportedTheme;
|
|
122
|
+
/** The values of a theme a stylesheet can say. */
|
|
123
|
+
type ThemeField = 'background' | 'surface' | 'text' | 'textMuted' | 'border' | 'inputBackground' | 'inputBorder' | 'primary' | 'primaryText' | 'accent' | 'error' | 'errorBackground' | 'success' | 'successBackground' | 'radius' | 'buttonRadius' | 'fontFamily';
|
|
124
|
+
/** How a stylesheet names its look: Stackmyth's tokens, shadcn/ui's (and Tailwind's), or the application's own. */
|
|
125
|
+
type CssFormat = 'stackmyth' | 'shadcn' | 'custom';
|
|
126
|
+
interface CssThemeOptions {
|
|
127
|
+
/** Which names to read. Default: `auto`, told from the stylesheet itself. */
|
|
128
|
+
format?: CssFormat | 'auto';
|
|
129
|
+
/** Which of the application's two modes to take. Default: `light`. */
|
|
130
|
+
mode?: 'light' | 'dark';
|
|
131
|
+
/** The named theme to read, when the stylesheet keeps several under `[data-theme=…]`. */
|
|
132
|
+
theme?: string;
|
|
133
|
+
/** For `custom`: the variable each value is read from, `{ primary: '--brand' }`. */
|
|
134
|
+
map?: Partial<Record<ThemeField, string>>;
|
|
135
|
+
}
|
|
136
|
+
interface CssImportedTheme extends ImportedTheme {
|
|
137
|
+
/** The names that were read. */
|
|
138
|
+
format: CssFormat;
|
|
139
|
+
}
|
|
140
|
+
/** The custom properties a stylesheet sets for the page, by name: what a person picks from to map their own. */
|
|
141
|
+
declare function cssVariables(css: string | string[], options?: Pick<CssThemeOptions, 'mode' | 'theme'>): string[];
|
|
142
|
+
/**
|
|
143
|
+
* Reads an application's look out of its stylesheets, whatever names it uses:
|
|
144
|
+
* Stackmyth's tokens, shadcn/ui's (`--primary`, `--radius`, on Tailwind 3 or
|
|
145
|
+
* 4), or the application's own variables given in `map`. What comes out is a
|
|
146
|
+
* theme of named values, never CSS.
|
|
147
|
+
*/
|
|
148
|
+
declare function themeFromCss(css: string | string[], options?: CssThemeOptions): CssImportedTheme;
|
|
149
|
+
/**
|
|
150
|
+
* A theme as the CSS variables of `@cauthyhq/react/styles.css` (stage 5) (`--cauthy-*`), for
|
|
151
|
+
* the forms an application shows on its own pages. The page's own background,
|
|
152
|
+
* the layout and the words are Cauthy's pages' matter, and left out.
|
|
153
|
+
*/
|
|
154
|
+
declare function themeVariables(theme: CauthyTheme): Record<string, string>;
|
|
155
|
+
/** A theme as Cauthy's API names its values. */
|
|
156
|
+
declare function toWire(theme: CauthyTheme): Record<string, unknown>;
|
|
157
|
+
/** A theme as Cauthy answers it, in this package's names. */
|
|
158
|
+
declare function fromWire(wire: Record<string, unknown>): CauthyTheme;
|
|
159
|
+
interface PushThemeOptions {
|
|
160
|
+
/** Cauthy's address. Default: `CAUTHY_ISSUER`. */
|
|
161
|
+
issuer?: string;
|
|
162
|
+
/** The application's client id. Default: `CAUTHY_CLIENT_ID`. */
|
|
163
|
+
clientId?: string;
|
|
164
|
+
/** The workspace's slug. Default: `CAUTHY_TENANT`. */
|
|
165
|
+
tenant?: string;
|
|
166
|
+
/**
|
|
167
|
+
* A personal access token with `oauth_clients:manage`. Default:
|
|
168
|
+
* `CAUTHY_TOKEN`. It belongs in the deploy pipeline, never in the application.
|
|
169
|
+
*/
|
|
170
|
+
token?: string;
|
|
171
|
+
theme: CauthyTheme;
|
|
172
|
+
fetch?: typeof fetch;
|
|
173
|
+
/** How long the call may take, in milliseconds, before it fails with a `TimeoutError`. Default: 5000. */
|
|
174
|
+
timeoutMs?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Gives the application its look on Cauthy's pages. It replaces the theme: a
|
|
178
|
+
* value left out goes back to Cauthy's own. Run it when the brand changes —
|
|
179
|
+
* from a script or the deploy — not on every request.
|
|
180
|
+
*/
|
|
181
|
+
declare function pushTheme(o: PushThemeOptions): Promise<void>;
|
|
182
|
+
|
|
183
|
+
export { type CauthyTheme, type CssFormat, type CssImportedTheme, type CssThemeOptions, type ImportedTheme, type PushThemeOptions, type StackmythThemeOptions, type StackmythTokens, type ThemeField, type ThemeFont, type ThemeTexts, cssVariables, fromWire, pushTheme, themeFromCss, themeFromStackmyth, themeVariables, toColor, toWire, tokensFromStackmyth };
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/** How an application looks on Cauthy's hosted pages. Every value is optional. */
|
|
2
|
+
/** One font file the application serves: a family in one weight (or a range) and one style. */
|
|
3
|
+
interface ThemeFont {
|
|
4
|
+
family: string;
|
|
5
|
+
/** An https address of a `.woff2` file. It must answer with `Access-Control-Allow-Origin` for Cauthy's origin. */
|
|
6
|
+
url: string;
|
|
7
|
+
/** `400`, or `"100 900"` for a variable font. Default: 400. */
|
|
8
|
+
weight?: number | string;
|
|
9
|
+
style?: 'normal' | 'italic';
|
|
10
|
+
}
|
|
11
|
+
/** What an application says on its sign-in page, in one language. */
|
|
12
|
+
interface ThemeTexts {
|
|
13
|
+
/** Replaces "Sign in". */
|
|
14
|
+
heading?: string;
|
|
15
|
+
/** Replaces "to continue to …". */
|
|
16
|
+
subheading?: string;
|
|
17
|
+
/** The messages of the split layout's panel, shown one at a time (up to 5). */
|
|
18
|
+
panel?: string[];
|
|
19
|
+
/** Links at the foot of the split layout: privacy, terms (up to 4). */
|
|
20
|
+
links?: {
|
|
21
|
+
label: string;
|
|
22
|
+
url: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
interface CauthyTheme {
|
|
26
|
+
/** The page. Colours are `#rrggbb` or `rgba(r, g, b, a)`. */
|
|
27
|
+
background?: string;
|
|
28
|
+
/** The card, and inputs. */
|
|
29
|
+
surface?: string;
|
|
30
|
+
/** Headings and what is typed. */
|
|
31
|
+
text?: string;
|
|
32
|
+
/** Paragraphs, labels, small print. */
|
|
33
|
+
textMuted?: string;
|
|
34
|
+
border?: string;
|
|
35
|
+
/** The fields and the secondary buttons, when they are not the card's colours. */
|
|
36
|
+
inputBackground?: string;
|
|
37
|
+
inputBorder?: string;
|
|
38
|
+
/** The main button, and what is written on it. */
|
|
39
|
+
primary?: string;
|
|
40
|
+
primaryText?: string;
|
|
41
|
+
/** Links, and the focus ring. */
|
|
42
|
+
accent?: string;
|
|
43
|
+
error?: string;
|
|
44
|
+
errorBackground?: string;
|
|
45
|
+
success?: string;
|
|
46
|
+
successBackground?: string;
|
|
47
|
+
/** Corners of cards and inputs, in pixels (0–40). */
|
|
48
|
+
radius?: number;
|
|
49
|
+
/** Corners of buttons, in pixels (0–40). */
|
|
50
|
+
buttonRadius?: number;
|
|
51
|
+
/** A CSS font-family list: the application's typeface first, a system font after it. */
|
|
52
|
+
fontFamily?: string;
|
|
53
|
+
/** The files of the typefaces `fontFamily` names, for people who do not have them installed. */
|
|
54
|
+
fonts?: ThemeFont[];
|
|
55
|
+
/** An image shown where "Cauthy" is, over https. */
|
|
56
|
+
logoUrl?: string;
|
|
57
|
+
/**
|
|
58
|
+
* How the sign-in pages are laid out: `card` (the default, one card in the
|
|
59
|
+
* middle) or `split` (the form on one side, a panel that presents the
|
|
60
|
+
* application on the other).
|
|
61
|
+
*/
|
|
62
|
+
layout?: 'card' | 'split';
|
|
63
|
+
/** The colours the split layout's backdrop blends, one to four. */
|
|
64
|
+
panelColors?: string[];
|
|
65
|
+
/** The colour of what is written on the panel. */
|
|
66
|
+
panelText?: string;
|
|
67
|
+
/** An https image shown over the panel's messages. */
|
|
68
|
+
panelIconUrl?: string;
|
|
69
|
+
/** The application's own words on the sign-in page, by language (`en`, `es`). */
|
|
70
|
+
texts?: Record<string, ThemeTexts>;
|
|
71
|
+
/**
|
|
72
|
+
* The application's Stackmyth tokens (`--sm-*`), from `tokensFromStackmyth`.
|
|
73
|
+
* Cauthy's pages are drawn with Stackmyth's components, so these make its
|
|
74
|
+
* buttons and fields the application's own. They are laid over the named values.
|
|
75
|
+
*/
|
|
76
|
+
tokens?: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
interface StackmythThemeOptions {
|
|
79
|
+
/**
|
|
80
|
+
* The named theme to read, when the stylesheet keeps several under
|
|
81
|
+
* `[data-theme=…]` (`"acme"`). Without it only what applies to every
|
|
82
|
+
* page (`:root`) is read.
|
|
83
|
+
*/
|
|
84
|
+
theme?: string;
|
|
85
|
+
/** Which of the application's two modes to take. Default: `light`. */
|
|
86
|
+
mode?: 'light' | 'dark';
|
|
87
|
+
logoUrl?: string;
|
|
88
|
+
}
|
|
89
|
+
interface ImportedTheme {
|
|
90
|
+
theme: CauthyTheme;
|
|
91
|
+
/** Tokens that were there and could not be carried over, and why. */
|
|
92
|
+
warnings: string[];
|
|
93
|
+
}
|
|
94
|
+
interface StackmythTokens {
|
|
95
|
+
/** Every `--sm-*` token the stylesheets set for the page, ready for `theme.tokens`. */
|
|
96
|
+
tokens: Record<string, string>;
|
|
97
|
+
/** Tokens that were there and Cauthy would not take, and why. */
|
|
98
|
+
warnings: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Reads an application's Stackmyth tokens out of its stylesheets: every
|
|
102
|
+
* `--sm-*` custom property its theme sets, in the order the sheets are given
|
|
103
|
+
* (a later one wins). Its own names — a brand palette the tokens point at —
|
|
104
|
+
* are written in, so what comes out stands on Stackmyth's names alone.
|
|
105
|
+
*
|
|
106
|
+
* Cauthy's sign-in pages are drawn with Stackmyth's components: these tokens
|
|
107
|
+
* are what makes them look like the application.
|
|
108
|
+
*/
|
|
109
|
+
declare function tokensFromStackmyth(css: string | string[], options?: StackmythThemeOptions): StackmythTokens;
|
|
110
|
+
/** A colour as Cauthy takes it — `#rrggbb` or `rgba(…)` — or null when it is none it can read. */
|
|
111
|
+
declare function toColor(value: string): string | null;
|
|
112
|
+
/**
|
|
113
|
+
* Reads an application's Stackmyth theme out of its stylesheets.
|
|
114
|
+
*
|
|
115
|
+
* Give it the CSS that declares the tokens, in the order the application
|
|
116
|
+
* loads it — Stackmyth's own (`@stackmyth/core/core.vars.css`, or a theme
|
|
117
|
+
* file) and then the application's brand file that re-points them. Tokens
|
|
118
|
+
* that point at the application's own variables are followed. The
|
|
119
|
+
* application's dark mode is left out unless asked for.
|
|
120
|
+
*/
|
|
121
|
+
declare function themeFromStackmyth(css: string | string[], options?: StackmythThemeOptions): ImportedTheme;
|
|
122
|
+
/** The values of a theme a stylesheet can say. */
|
|
123
|
+
type ThemeField = 'background' | 'surface' | 'text' | 'textMuted' | 'border' | 'inputBackground' | 'inputBorder' | 'primary' | 'primaryText' | 'accent' | 'error' | 'errorBackground' | 'success' | 'successBackground' | 'radius' | 'buttonRadius' | 'fontFamily';
|
|
124
|
+
/** How a stylesheet names its look: Stackmyth's tokens, shadcn/ui's (and Tailwind's), or the application's own. */
|
|
125
|
+
type CssFormat = 'stackmyth' | 'shadcn' | 'custom';
|
|
126
|
+
interface CssThemeOptions {
|
|
127
|
+
/** Which names to read. Default: `auto`, told from the stylesheet itself. */
|
|
128
|
+
format?: CssFormat | 'auto';
|
|
129
|
+
/** Which of the application's two modes to take. Default: `light`. */
|
|
130
|
+
mode?: 'light' | 'dark';
|
|
131
|
+
/** The named theme to read, when the stylesheet keeps several under `[data-theme=…]`. */
|
|
132
|
+
theme?: string;
|
|
133
|
+
/** For `custom`: the variable each value is read from, `{ primary: '--brand' }`. */
|
|
134
|
+
map?: Partial<Record<ThemeField, string>>;
|
|
135
|
+
}
|
|
136
|
+
interface CssImportedTheme extends ImportedTheme {
|
|
137
|
+
/** The names that were read. */
|
|
138
|
+
format: CssFormat;
|
|
139
|
+
}
|
|
140
|
+
/** The custom properties a stylesheet sets for the page, by name: what a person picks from to map their own. */
|
|
141
|
+
declare function cssVariables(css: string | string[], options?: Pick<CssThemeOptions, 'mode' | 'theme'>): string[];
|
|
142
|
+
/**
|
|
143
|
+
* Reads an application's look out of its stylesheets, whatever names it uses:
|
|
144
|
+
* Stackmyth's tokens, shadcn/ui's (`--primary`, `--radius`, on Tailwind 3 or
|
|
145
|
+
* 4), or the application's own variables given in `map`. What comes out is a
|
|
146
|
+
* theme of named values, never CSS.
|
|
147
|
+
*/
|
|
148
|
+
declare function themeFromCss(css: string | string[], options?: CssThemeOptions): CssImportedTheme;
|
|
149
|
+
/**
|
|
150
|
+
* A theme as the CSS variables of `@cauthyhq/react/styles.css` (stage 5) (`--cauthy-*`), for
|
|
151
|
+
* the forms an application shows on its own pages. The page's own background,
|
|
152
|
+
* the layout and the words are Cauthy's pages' matter, and left out.
|
|
153
|
+
*/
|
|
154
|
+
declare function themeVariables(theme: CauthyTheme): Record<string, string>;
|
|
155
|
+
/** A theme as Cauthy's API names its values. */
|
|
156
|
+
declare function toWire(theme: CauthyTheme): Record<string, unknown>;
|
|
157
|
+
/** A theme as Cauthy answers it, in this package's names. */
|
|
158
|
+
declare function fromWire(wire: Record<string, unknown>): CauthyTheme;
|
|
159
|
+
interface PushThemeOptions {
|
|
160
|
+
/** Cauthy's address. Default: `CAUTHY_ISSUER`. */
|
|
161
|
+
issuer?: string;
|
|
162
|
+
/** The application's client id. Default: `CAUTHY_CLIENT_ID`. */
|
|
163
|
+
clientId?: string;
|
|
164
|
+
/** The workspace's slug. Default: `CAUTHY_TENANT`. */
|
|
165
|
+
tenant?: string;
|
|
166
|
+
/**
|
|
167
|
+
* A personal access token with `oauth_clients:manage`. Default:
|
|
168
|
+
* `CAUTHY_TOKEN`. It belongs in the deploy pipeline, never in the application.
|
|
169
|
+
*/
|
|
170
|
+
token?: string;
|
|
171
|
+
theme: CauthyTheme;
|
|
172
|
+
fetch?: typeof fetch;
|
|
173
|
+
/** How long the call may take, in milliseconds, before it fails with a `TimeoutError`. Default: 5000. */
|
|
174
|
+
timeoutMs?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Gives the application its look on Cauthy's pages. It replaces the theme: a
|
|
178
|
+
* value left out goes back to Cauthy's own. Run it when the brand changes —
|
|
179
|
+
* from a script or the deploy — not on every request.
|
|
180
|
+
*/
|
|
181
|
+
declare function pushTheme(o: PushThemeOptions): Promise<void>;
|
|
182
|
+
|
|
183
|
+
export { type CauthyTheme, type CssFormat, type CssImportedTheme, type CssThemeOptions, type ImportedTheme, type PushThemeOptions, type StackmythThemeOptions, type StackmythTokens, type ThemeField, type ThemeFont, type ThemeTexts, cssVariables, fromWire, pushTheme, themeFromCss, themeFromStackmyth, themeVariables, toColor, toWire, tokensFromStackmyth };
|