@pontive/pontkit-core 1.29.0 → 1.30.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.
@@ -0,0 +1,46 @@
1
+ import { WidgetClient } from './flow-widget';
2
+ export interface PreviewScreen {
3
+ /** A name for a screen picker. */
4
+ label: string;
5
+ /** The widget to preview it in (its tag is `pont2-<flow>`). */
6
+ flow: "signin" | "signup";
7
+ /** The screen, as a render spec would write it. */
8
+ spec: string;
9
+ }
10
+ /** Sample screens for a branding preview, keyed by id. */
11
+ export declare const PREVIEW_SCREENS: {
12
+ readonly signin: {
13
+ readonly label: "Sign in";
14
+ readonly flow: "signin";
15
+ readonly spec: "<pont2-block>\n <pont2-header>\n <pont2-title content=\"Welcome back\"></pont2-title>\n <pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>\n </pont2-header>\n <pont2-provider-field providers=\"google apple github\"></pont2-provider-field>\n <pont2-divider label=\"Or continue with\"></pont2-divider>\n <pont2-identifier-field identifiers=\"email username\" required></pont2-identifier-field>\n <pont2-submit-button event=\"submit_identifier\" label=\"Continue\"></pont2-submit-button>\n <pont2-passkey-button content=\"icon-label\" event=\"passkey\"></pont2-passkey-button>\n <pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>\n</pont2-block>";
16
+ };
17
+ readonly password: {
18
+ readonly label: "Password";
19
+ readonly flow: "signin";
20
+ readonly spec: "<pont2-block>\n <pont2-header>\n <pont2-title content=\"Enter your password\"></pont2-title>\n </pont2-header>\n <pont2-edit-identifier identifier=\"ada@example.com\" event=\"change_identifier\"></pont2-edit-identifier>\n <pont2-password-field required rules=\"[]\" forgot forgot-event=\"forgot_password\"></pont2-password-field>\n <pont2-submit-button event=\"submit_password\" label=\"Sign in\"></pont2-submit-button>\n</pont2-block>";
21
+ };
22
+ readonly verify: {
23
+ readonly label: "Verification code";
24
+ readonly flow: "signin";
25
+ readonly spec: "<pont2-block>\n <pont2-header>\n <pont2-title content=\"Check your email\"></pont2-title>\n <pont2-subtitle content=\"We sent a 6-digit code to ada@example.com\"></pont2-subtitle>\n </pont2-header>\n <pont2-alert status=\"info\" icon description=\"The code expires in 10 minutes.\"></pont2-alert>\n <pont2-container align=\"center\">\n <pont2-otp-field layout=\"simple\" required></pont2-otp-field>\n </pont2-container>\n <pont2-submit-button event=\"verify_code\" label=\"Verify\"></pont2-submit-button>\n <pont2-otp-resend duration=\"30\" event=\"resend_code\"></pont2-otp-resend>\n</pont2-block>";
26
+ };
27
+ readonly signup: {
28
+ readonly label: "Sign up";
29
+ readonly flow: "signup";
30
+ readonly spec: "<pont2-block>\n <pont2-header>\n <pont2-title content=\"Create an account\"></pont2-title>\n <pont2-subtitle content=\"It only takes a minute\"></pont2-subtitle>\n </pont2-header>\n <pont2-name-field required></pont2-name-field>\n <pont2-email-field required></pont2-email-field>\n <pont2-password-field required></pont2-password-field>\n <pont2-confirm-field required></pont2-confirm-field>\n <pont2-submit-button event=\"submit_signup\" label=\"Create account\"></pont2-submit-button>\n <pont2-link prompt=\"Already have an account?\" label=\"Sign in\" event=\"goto_signin\"></pont2-link>\n</pont2-block>";
31
+ };
32
+ };
33
+ export type PreviewScreenId = keyof typeof PREVIEW_SCREENS;
34
+ export interface PreviewClientOptions {
35
+ /** How long each request stays busy, in ms, so busy states can be seen (default 600). */
36
+ delay?: number;
37
+ /** The flow's localised messages (flow errors, "Start again" …). */
38
+ messages?: Record<string, string>;
39
+ }
40
+ /**
41
+ * A `WidgetClient` that shows one screen and never leaves it. Every request
42
+ * (a submit, a provider button, a link) is busy for `delay` ms and then
43
+ * resolves without a new screen, so the screen and what was typed stay put.
44
+ * Nothing is sent anywhere.
45
+ */
46
+ export declare function previewClient(spec: string, options?: PreviewClientOptions): WidgetClient;
@@ -24,3 +24,4 @@ export * from './recovery-codes/recovery-codes';
24
24
  export * from './scope-list/scope-list';
25
25
  export * from './layout/layout';
26
26
  export * from './flow-widget/flow-widget';
27
+ export * from './flow-widget/preview';
@@ -39,14 +39,21 @@
39
39
  * ref/ raw values, global only, never read by components
40
40
  * sem/ design roles; light/dark lives in sem/color.css
41
41
  */
42
- /* ./ref/palette.css */
42
+
43
+ /* ./ref/color.css */
43
44
  /*
44
- * ref · palettes. Raw colour values, never read by components (docs/11-tokens.md §2).
45
- *
46
- * Tailwind v4's hue ramps, in oklch, plus black and white. Steps 50–950.
47
- * Global only: setting a ref token on anything but :root has no effect on
48
- * sem tokens, which are resolved at :root (11 §4).
45
+ * ===========================================================================
46
+ * COLOR REFERENCE TOKENS
47
+ * --pont2-ref-color-*
48
+ * ===========================================================================
49
+ */
50
+
51
+ /*
52
+ * --------------------------------------------------
53
+ * COLOR PALETTE
54
+ * --------------------------------------------------
49
55
  */
56
+
50
57
  @layer pont2.tokens {
51
58
  :root {
52
59
  --pont2-ref-color-red-50: oklch(97.1% 0.013 17.38);
@@ -366,17 +373,12 @@
366
373
  }
367
374
  }
368
375
 
369
- /* ./ref/roles.css */
370
376
  /*
371
- * ref · palette roles. Each role is a whole ramp aliased to a hue ramp, so a
372
- * theme re-points a role (e.g. brand → blue) and every sem token built on it
373
- * follows (docs/11-tokens.md §10).
374
- *
375
- * base neutrals: surfaces, text, borders
376
- * brand primary actions and charts (neutral by default, so the
377
- * defaults look like shadcn's neutral theme)
378
- * destructive, warning, success, info status colours
377
+ * --------------------------------------------------
378
+ * COLOR ROLES
379
+ * --------------------------------------------------
379
380
  */
381
+
380
382
  @layer pont2.tokens {
381
383
  :root {
382
384
  --pont2-ref-color-base-50: var(--pont2-ref-color-neutral-50);
@@ -456,7 +458,7 @@
456
458
  /* ./sem/color.css */
457
459
  /*
458
460
  * sem · colour roles: shadcn's set plus pont2's status colours, built on the
459
- * ref palette roles (ref/roles.css). The theme mode lives here and only here
461
+ * ref colour roles (ref/color.css). The theme mode lives here and only here
460
462
  * (docs/11-tokens.md §6).
461
463
  *
462
464
  * Defaults reproduce shadcn's neutral theme exactly. `primary` and