@pontive/pontkit-core 1.50.0 → 1.52.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.
@@ -4,7 +4,7 @@
4
4
  * from the legacy kit), with the same English and the same message codes, so
5
5
  * a flow's localised `messages` (keyed by code) apply unchanged.
6
6
  */
7
- export type FlowMessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "instance_unavailable" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here";
7
+ export type FlowMessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "instance_unavailable" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here" | "scope_not_allowed";
8
8
  /** The flow codes' English (a subset of `KIT_MESSAGES_EN`, core/messages.ts). */
9
9
  export declare const FLOW_MESSAGES_EN: Record<FlowMessageCode, string>;
10
10
  export interface FlowErrorDescription {
@@ -20,6 +20,13 @@ export interface FlowErrorDescription {
20
20
  * reason (pontive-spec 01, "Who is told why"; carry-over §6).
21
21
  */
22
22
  export declare const INSTANCE_UNAVAILABLE = "instance_unavailable";
23
+ /**
24
+ * The sign-in runtime refused to start a flow because the app asked for a scope
25
+ * it does not allow (identity-svc's `invalid_scope`). The person can do nothing
26
+ * about it, so the kit says so in its own words; the server's detail is for the
27
+ * app's developer, and the flow widget logs the error.
28
+ */
29
+ export declare const INVALID_SCOPE = "invalid_scope";
23
30
  /** Whether a failed call was refused because the instance has stopped (its own `code`, or its body's). */
24
31
  export declare function isInstanceUnavailable(error: unknown): boolean;
25
32
  /**
@@ -33,12 +40,24 @@ export declare function rememberUnavailable(sentence?: string): void;
33
40
  /**
34
41
  * - a cancelled or timed-out WebAuthn prompt (`NotAllowedError` / `AbortError`) → passkey_cancelled
35
42
  * - `instance_unavailable` → the refusal's own sentence, kept for the page (rememberUnavailable); not restartable
36
- * - 409 → the server's sentence, else flow_ended; restartable
43
+ * - `invalid_scope` (a flow start asking for a scope the app does not allow) → scope_not_allowed
44
+ * - 409 → the code's message, else the server's sentence, else flow_ended; restartable
37
45
  * - no response at all (NETWORK_ERROR / TIMEOUT) → connection_failed
38
46
  * - 429 → too_many_attempts; ≥ 500 → server_error
39
- * - anything else → the server's sentence, else generic_error
47
+ * - anything else → the code's message, else the server's sentence, else generic_error
40
48
  *
41
49
  * Text comes from `messages` when given (a set a caller holds), else the
42
- * page-wide message table (core/messages.ts), else English.
50
+ * page-wide message table (core/messages.ts), else English. "The code's
51
+ * message" is the text for the refusal's `error.code` when the kit has one:
52
+ * that text is localised (branding-svc), the server's own is English only, so
53
+ * the server's sentence (without a leading code, serverSentence) is the
54
+ * fallback for a code the kit has no message for.
43
55
  */
44
56
  export declare function describeFlowError(error: unknown, messages?: Partial<Record<string, string>>): FlowErrorDescription;
57
+ /** `message` without a leading error code (CODE_PREFIX), when it has one. */
58
+ export declare function stripCodePrefix(message: string, code?: string): string;
59
+ /**
60
+ * A server message fit to show: a sentence, not "HTTP 400" or something with code in backticks,
61
+ * and without a leading error code (stripCodePrefix).
62
+ */
63
+ export declare function serverSentence(message?: string, code?: string): string | undefined;
package/dist/styles.css CHANGED
@@ -832,6 +832,14 @@
832
832
 
833
833
  --pont-sem-color-ghost: var(--pont-ref-color-transparent);
834
834
  --pont-sem-color-ghost-hover: var(--pont-sem-color-muted);
835
+
836
+ --pont-sem-color-inverse: var(--pont-sem-color-fg);
837
+ --pont-sem-color-inverse-fg: var(--pont-sem-color-bg);
838
+ --pont-sem-color-inverse-subtle: color-mix(
839
+ in oklab,
840
+ var(--pont-sem-color-bg) 20%,
841
+ var(--pont-ref-color-transparent)
842
+ );
835
843
  }
836
844
  }
837
845
 
@@ -1145,6 +1153,14 @@
1145
1153
  var(--pont-sem-color-muted) 50%,
1146
1154
  var(--pont-ref-color-transparent)
1147
1155
  );
1156
+
1157
+ --pont-sem-color-inverse: var(--pont-sem-color-fg);
1158
+ --pont-sem-color-inverse-fg: var(--pont-sem-color-bg);
1159
+ --pont-sem-color-inverse-subtle: color-mix(
1160
+ in oklab,
1161
+ var(--pont-sem-color-bg) 10%,
1162
+ var(--pont-ref-color-transparent)
1163
+ );
1148
1164
  }
1149
1165
  }
1150
1166
 
@@ -4062,8 +4078,8 @@
4062
4078
  * group: "inline-flex items-center" + .cn-kbd-group (gap-1)
4063
4079
  *
4064
4080
  * Tokens (docs/11-tokens.md): `--pont-kbd-*`. Inside a tooltip the kbd
4065
- * switches to the inverted colours (`--pont-kbd-tooltip-bg`, with a dark
4066
- * default for shadcn's `dark:` fill; docs/11-tokens.md §6).
4081
+ * switches to the inverted colours (`--pont-kbd-tooltip-bg`, defaulting to
4082
+ * `--pont-sem-color-inverse-subtle`; docs/11-tokens.md §6).
4067
4083
  */
4068
4084
  @layer pont.primitives {
4069
4085
  /* ------------------------------------------------------------------ */
@@ -4083,17 +4099,12 @@
4083
4099
  --_pont-kbd-font-weight: var(--pont-kbd-font-weight, var(--pont-ref-typography-weight-medium));
4084
4100
  }
4085
4101
 
4086
- /* in-data-[slot=tooltip-content]: the inverted tooltip colours */
4102
+ /* in-data-[slot=tooltip-content]: the inverted tooltip colours (shadcn's
4103
+ bg-background/20, dark:bg-background/10, which sem-color-inverse-subtle carries) */
4087
4104
  [data-slot="tooltip-content"] :is(pont-prim-kbd, pont-kbd, [data-pont-kbd]) {
4088
4105
  /** @token Background in a tooltip */
4089
- --_pont-kbd-bg: var(--pont-kbd-tooltip-bg, color-mix(in oklab, var(--pont-sem-color-bg) 20%, transparent));
4090
- --_pont-kbd-fg: var(--pont-sem-color-bg);
4091
- }
4092
-
4093
- /* dark default: shadcn's dark:in-data-[slot=tooltip-content]:bg-background/10 */
4094
- :where(.dark, [data-theme="dark"]) [data-slot="tooltip-content"] :is(pont-prim-kbd, pont-kbd, [data-pont-kbd]),
4095
- [data-slot="tooltip-content"] :is(pont-prim-kbd, pont-kbd, [data-pont-kbd]):where(.dark, [data-theme="dark"]) {
4096
- --_pont-kbd-bg: var(--pont-kbd-tooltip-bg, color-mix(in oklab, var(--pont-sem-color-bg) 10%, transparent));
4106
+ --_pont-kbd-bg: var(--pont-kbd-tooltip-bg, var(--pont-sem-color-inverse-subtle));
4107
+ --_pont-kbd-fg: var(--pont-sem-color-inverse-fg);
4097
4108
  }
4098
4109
 
4099
4110
  /* ------------------------------------------------------------------ */
@@ -8407,9 +8418,9 @@
8407
8418
 
8408
8419
  :is(pont-prim-tooltip-content, [data-pont-tooltip-content]) {
8409
8420
  /** @token Background */
8410
- --_pont-tooltip-bg: var(--pont-tooltip-bg, var(--pont-sem-color-fg));
8421
+ --_pont-tooltip-bg: var(--pont-tooltip-bg, var(--pont-sem-color-inverse));
8411
8422
  /** @token Text */
8412
- --_pont-tooltip-fg: var(--pont-tooltip-fg, var(--pont-sem-color-bg));
8423
+ --_pont-tooltip-fg: var(--pont-tooltip-fg, var(--pont-sem-color-inverse-fg));
8413
8424
  /** @token Corner radius */
8414
8425
  --_pont-tooltip-radius: var(--pont-tooltip-radius, var(--pont-ref-radius-md));
8415
8426
  /** @token Maximum width */