@pontive/pontkit-core 1.34.1 → 1.36.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.
@@ -1,5 +1,6 @@
1
1
  import { nothing, PropertyDeclarations, TemplateResult } from 'lit';
2
2
  import { ActionController } from '../../core/controllers/action';
3
+ import { DesignModeController } from '../../core/design-mode';
3
4
  import { ButtonBase, ButtonOptions } from '../../primitives/button/button';
4
5
  import { AuthProvider } from './providers';
5
6
  export { AUTH_PROVIDERS, PROVIDER_NAMES, providerIcon, type AuthProvider } from './providers';
@@ -95,6 +96,10 @@ export declare class ProviderButton extends AuthButton {
95
96
  static properties: PropertyDeclarations;
96
97
  provider: AuthProvider;
97
98
  prompt: string;
99
+ /** Design mode (core/design-mode.ts): a sample provider until the author picks one. */
100
+ protected readonly design: DesignModeController;
101
+ /** The provider shown: `provider`, or "google" in design mode when none is set (the legacy sample). */
102
+ get shownProvider(): AuthProvider;
98
103
  constructor();
99
104
  protected defaultLabel(): string;
100
105
  protected renderIcon(a: Record<string, string>): TemplateResult<1> | typeof nothing;
@@ -1,4 +1,5 @@
1
1
  import { nothing, PropertyDeclarations, PropertyValues, TemplateResult } from 'lit';
2
+ import { DesignModeController } from '../../core/design-mode';
2
3
  import { Field } from '../../primitives/field/field';
3
4
  import { InputOptions } from '../../primitives/input/input';
4
5
  /**
@@ -229,18 +230,27 @@ export declare function identifierLabel(kinds: readonly IdentifierKind[]): strin
229
230
  * `<pont2-identifier-field>`: the sign-in identifier (email, phone or
230
231
  * username), submitted as `login_id` (the platform's contract).
231
232
  *
232
- * `identifiers` (attribute: space- or comma-separated; property: array) picks
233
+ * `identifiers` (attribute: a JSON array, as the platform writes it, or space- or
234
+ * comma-separated; property: array) picks
233
235
  * the label ("Email or phone") and the input type: `email` or `tel` when it
234
236
  * is exactly one of those, `text` otherwise. `autocomplete="username"`, which
235
237
  * is what password managers look for next to a password. Normalised to
236
238
  * trimmed lower case. Rule: `required` only (no format), as in the legacy kit.
237
239
  *
238
240
  * @tag pont2-identifier-field
239
- * @attr identifiers - e.g. "email phone username"
241
+ * @attr identifiers - e.g. `["email","phone"]` or "email phone username"
240
242
  */
241
243
  export declare class IdentifierField extends AuthField {
242
244
  static properties: PropertyDeclarations;
243
245
  identifiers: IdentifierKind[];
246
+ /** Design mode (core/design-mode.ts): sample identifiers when none are set. */
247
+ protected readonly design: DesignModeController;
248
+ /**
249
+ * The identifiers shown: `identifiers`, or email, username and phone in design mode when none are
250
+ * set. At serve time the platform narrows the authored list to the app's login methods; the
251
+ * designer narrows nothing, and "Identifier" would tell the author nothing (the legacy samples).
252
+ */
253
+ get shownIdentifiers(): IdentifierKind[];
244
254
  constructor();
245
255
  protected defaultName(): string;
246
256
  protected defaultLabel(): string;
@@ -1,5 +1,6 @@
1
1
  import { nothing, PropertyDeclarations, TemplateResult } from 'lit';
2
2
  import { ActionController } from '../../core/controllers/action';
3
+ import { MessagesController } from '../../core/messages';
3
4
  import { InputOptions } from '../../primitives/input/input';
4
5
  import { AuthField, FieldIssue } from './auth-field';
5
6
  export type PasswordRuleName = "uppercase" | "lowercase" | "number" | "special";
@@ -35,7 +36,7 @@ export type SecretFieldVariant = "toggle" | "simple";
35
36
  * never normalised.
36
37
  *
37
38
  * @attr variant - toggle (default) | simple
38
- * @attr show-label - the toggle's accessible name (default "Show password")
39
+ * @attr show-label - the toggle's accessible name (default: the `show_password` message, "Show password" in English)
39
40
  */
40
41
  export declare abstract class SecretField extends AuthField {
41
42
  static properties: PropertyDeclarations;
@@ -43,6 +44,8 @@ export declare abstract class SecretField extends AuthField {
43
44
  showLabel: string;
44
45
  /** Whether the value is currently shown as text. */
45
46
  revealed: boolean;
47
+ /** Re-renders when the page's message table changes (the toggle's name). */
48
+ protected readonly messagesController: MessagesController;
46
49
  constructor();
47
50
  protected inputType(): "text" | "password";
48
51
  protected inputAttrs(): {
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The consent screen's two calls to auth-api (pontive-spec 40 §4.3), ported
3
+ * from the legacy `pont-consent` (carry-over §8).
4
+ *
5
+ * Plain `fetch` rather than the auth SDK: the screen is not an auth flow. The
6
+ * person already has a session, and the session cookie is what proves the
7
+ * consent request is theirs, so every call is same-origin and carries it.
8
+ *
9
+ * GET {base}/auth/v1/consent/{id}?locales=… → { render_spec, locale?, dir? }
10
+ * POST {base}/auth/v1/consent/{id} { event, data } → { redirect_to } | a view to render
11
+ *
12
+ * Errors use the platform envelope `{ error: { code, message } }` (or flat).
13
+ * A 404 means the request expired, was already answered, or isn't this
14
+ * session's; the server doesn't say which, and the way on is the same.
15
+ */
16
+ /** What `GET /auth/v1/consent/{id}` answers, and a re-rendered screen. */
17
+ export interface ConsentView {
18
+ render_spec: string;
19
+ locale?: string;
20
+ dir?: string;
21
+ }
22
+ /** What `POST /auth/v1/consent/{id}` answers. */
23
+ export type ConsentOutcome = {
24
+ redirect_to: string;
25
+ } | ConsentView;
26
+ /** A refused or failed consent call, shaped as `describeFlowError` reads one (`status`, `code`, `message`). */
27
+ export declare class ConsentError extends Error {
28
+ readonly code: string;
29
+ readonly status?: number | undefined;
30
+ constructor(message: string, code: string, status?: number | undefined);
31
+ }
32
+ /** The person-facing sentence for an expired request (a 404). */
33
+ export declare const CONSENT_EXPIRED_EN = "This request has expired. Go back to the app and try again.";
34
+ /** `consent_expired` from the page's message table, else English. */
35
+ export declare const consentExpired: () => string;
36
+ export declare function consentEndpoint(baseUrl: string, id: string): string;
37
+ /** Loads the screen for a consent request. */
38
+ export declare function fetchConsent(baseUrl: string, id: string, options?: {
39
+ locales?: string;
40
+ }): Promise<ConsentView>;
41
+ /**
42
+ * Answers a consent request: `allow` with the ticked scopes (`data.scope`, one
43
+ * space-separated string, which auth-api requires), or `deny`. A 404 is reworded
44
+ * as the expired-request sentence, so the layout's banner shows it as is.
45
+ */
46
+ export declare function submitConsent(baseUrl: string, id: string, event: string, data?: Record<string, unknown>): Promise<ConsentOutcome>;
47
+ /**
48
+ * Whether the browser may be sent to a `redirect_to`. It is the app's
49
+ * registered redirect URI, which may be a native app's custom scheme
50
+ * (`com.example.app:/callback`), so this is not limited to http(s); it only
51
+ * refuses the schemes that run code or read local data in this page.
52
+ */
53
+ export declare function isNavigableRedirect(url: string, base?: string): boolean;
@@ -0,0 +1,83 @@
1
+ import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ import { MessagesController } from '../../core/messages';
4
+ import { BrandingEntitlements } from '../block/branding';
5
+ import { FlowClient, Layout } from '../layout/layout';
6
+ export { CONSENT_EXPIRED_EN, ConsentError, consentEndpoint, consentExpired, fetchConsent, isNavigableRedirect, submitConsent, type ConsentOutcome, type ConsentView, } from './consent-api';
7
+ /**
8
+ * # `<pont2-consent>`: an app asks for access; the person allows or denies
9
+ *
10
+ * ```html
11
+ * <pont2-consent consent-request="cr_123"></pont2-consent>
12
+ * ```
13
+ *
14
+ * The OAuth consent screen (pontive-spec 40 §4.3), ported from the legacy
15
+ * `pont-consent` (carry-over §8). **Not a flow widget:** the person already has
16
+ * a session, so there is no flow to start and no SDK to wait for. The screen is
17
+ * one consent request, which auth-api renders like a flow view (the built-in
18
+ * `authorize_app` widget in the instance's brand and copy) and answers with a
19
+ * redirect.
20
+ *
21
+ * It still renders through `pont2-layout`, with a consent-specific **client**,
22
+ * so the markup, the error banner, the busy state and the branding entitlement
23
+ * work as on every other screen:
24
+ *
25
+ * - **Load:** `GET {base-url}/auth/v1/consent/{consent-request}?locales=…`, same
26
+ * origin with the session cookie (`fetchConsent`). The view's `locale` and
27
+ * `dir` become the element's `lang` and `dir`.
28
+ * - **Answer:** Allow and Deny are submit buttons naming the `allow` / `deny`
29
+ * event; `pont2-scope-list` submits the ticked scopes as `scope`, one
30
+ * space-separated string. The client posts `{ event, data }`
31
+ * (`submitConsent`) and then either sends the browser to `redirect_to` (the
32
+ * app's redirect URI, which may be a custom scheme; only code-running schemes
33
+ * are refused) or renders the screen the server sent back.
34
+ * - **Errors:** a request that expired, was already answered or isn't this
35
+ * session's (404) says "This request has expired. Go back to the app and try
36
+ * again." (`consent_expired`) and offers nothing to retry. Any other failure
37
+ * is worded by `describeFlowError` and offers "Start again", which reloads the
38
+ * request.
39
+ *
40
+ * @tag pont2-consent
41
+ * @attr consent-request - the consent request's id (the page's `consent_request` parameter)
42
+ * @attr base-url - where auth-api is; empty (default) means same origin, which the session cookie needs
43
+ * @attr locales - preferred languages, passed to the load (`?locales=`)
44
+ * @prop branding - the account's branding entitlements (fail closed: the watermark shows)
45
+ */
46
+ export declare class Consent extends HostElement {
47
+ static identity: string;
48
+ static properties: PropertyDeclarations;
49
+ consentRequest: string;
50
+ baseUrl: string;
51
+ locales: string;
52
+ branding: BrandingEntitlements;
53
+ protected renderSpec: string;
54
+ protected loadError: {
55
+ message: string;
56
+ retryable: boolean;
57
+ } | null;
58
+ protected readonly messagesController: MessagesController;
59
+ /** Bumped per load, so only the latest answer lands on the screen. */
60
+ private loadSeq;
61
+ /** The request, server and languages last loaded: a change means load again. */
62
+ private loadedKey;
63
+ /**
64
+ * What the layout calls for Allow / Deny. Stable for the element's lifetime:
65
+ * the layout keeps it across screens.
66
+ */
67
+ readonly client: FlowClient;
68
+ constructor();
69
+ /** The element's layout. */
70
+ get layout(): Layout | null;
71
+ /** Loads (or reloads) the consent request. */
72
+ load(): Promise<void>;
73
+ private show;
74
+ private answer;
75
+ protected willUpdate(_changed: PropertyValues): void;
76
+ protected updated(changed: PropertyValues): void;
77
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
78
+ }
79
+ declare global {
80
+ interface HTMLElementTagNameMap {
81
+ "pont2-consent": Consent;
82
+ }
83
+ }
@@ -1,4 +1,5 @@
1
1
  import { PropertyDeclarations } from 'lit';
2
+ import { DesignModeController } from '../../core/design-mode';
2
3
  import { HostElement } from '../../core/host-element';
3
4
  /** The legacy render-spec values. */
4
5
  export type ContainerType = "flex_column" | "flex_row";
@@ -30,6 +31,8 @@ export declare class Container extends HostElement {
30
31
  type: ContainerType;
31
32
  align: ContainerAlign;
32
33
  justify: ContainerJustify;
34
+ /** Design mode (core/design-mode.ts): outlined and inset on the designer's canvas. */
35
+ protected readonly design: DesignModeController;
33
36
  constructor();
34
37
  protected willUpdate(): void;
35
38
  }
@@ -4,8 +4,8 @@ export interface CountdownEndDetail {
4
4
  /** Where the countdown will navigate (already resolved), or null. */
5
5
  url: string | null;
6
6
  }
7
- /** Resolves `raw` against the page and accepts only http(s) URLs (no `javascript:`, `data:` …). */
8
- export declare function safeRedirect(raw: string, base?: string): string | null;
7
+ /** Kept as countdown's export; the check itself is `safeUrl` (core/url.ts), shared with `pont2-link`. */
8
+ export declare const safeRedirect: (raw: string, base?: string) => string | null;
9
9
  /**
10
10
  * # `<pont2-countdown>`: "Redirecting in 5s…"
11
11
  *
@@ -1,5 +1,6 @@
1
- import { PropertyDeclarations, PropertyValues } from 'lit';
1
+ import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
2
2
  import { HostElement } from '../../core/host-element';
3
+ import { MessagesController } from '../../core/messages';
3
4
  import { BrandingEntitlements } from '../block/branding';
4
5
  import { FlowClient, Layout } from '../layout/layout';
5
6
  /**
@@ -15,7 +16,6 @@ export interface WidgetClient extends FlowClient {
15
16
  export interface FlowStart {
16
17
  render_spec?: unknown;
17
18
  messages?: Record<string, string>;
18
- [key: string]: unknown;
19
19
  }
20
20
  /** The parts of the SDK's `FlowStateChangeEvent` a widget reads. */
21
21
  export interface FlowStateEvent {
@@ -23,7 +23,6 @@ export interface FlowStateEvent {
23
23
  flowType?: string;
24
24
  render_spec?: unknown;
25
25
  messages?: Record<string, string>;
26
- [key: string]: unknown;
27
26
  }
28
27
  /**
29
28
  * Feeds the SDK's asynchronous flow-state changes (a resumed flow, a flow an
@@ -95,7 +94,10 @@ export declare abstract class FlowWidget extends HostElement {
95
94
  protected starting: boolean;
96
95
  protected startError: {
97
96
  message: string;
97
+ restartable: boolean;
98
98
  } | null;
99
+ /** Re-renders when the page's message table changes (the loading label). */
100
+ protected readonly messagesController: MessagesController;
99
101
  /** The SDK's `flowType` this widget runs ("signin", "signup"): which flow-state events apply. */
100
102
  protected abstract readonly flowType: string;
101
103
  private started;
@@ -106,6 +108,8 @@ export declare abstract class FlowWidget extends HostElement {
106
108
  restart(): Promise<void>;
107
109
  /** Applies an SDK flow-state change (what `dispatchFlowState` delivers). */
108
110
  applyFlowState(event: FlowStateEvent): void;
111
+ /** A set the flow sent: this widget's, and the page's message table (core/messages.ts). */
112
+ private receiveMessages;
109
113
  private msg;
110
114
  private continuedElsewhereSpec;
111
115
  private onFlowState;
@@ -114,9 +118,9 @@ export declare abstract class FlowWidget extends HostElement {
114
118
  protected willUpdate(changed: PropertyValues): void;
115
119
  protected updated(changed: PropertyValues): void;
116
120
  private start;
117
- /** The flow id used when `flow-id` is not set. */
118
- protected abstract defaultFlowId(): string;
119
- render(): import('lit-html').TemplateResult<1>;
121
+ /** The flow id used when `flow-id` is not set; `undefined` lets the SDK choose (an invitation). */
122
+ protected abstract defaultFlowId(): string | undefined;
123
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
120
124
  }
121
125
  /**
122
126
  * # `<pont2-signin>`: the sign-in widget
@@ -140,10 +144,37 @@ export declare class SignUp extends FlowWidget {
140
144
  protected readonly flowType = "signup";
141
145
  protected defaultFlowId(): string;
142
146
  }
147
+ /**
148
+ * # `<pont2-invitation>`: accepting an invitation
149
+ *
150
+ * The invitee arrives from an emailed link holding a token and nothing else.
151
+ * They aren't asked who they are, since the invitation already knows: the widget
152
+ * starts the **invitation flow**, which resolves the token, decides whether the
153
+ * invitee signs in or registers, and accepts the invitation once they are
154
+ * authenticated. A port of the legacy `pont-invitation` (migration tracker W-4).
155
+ *
156
+ * It starts with **no flow id**: the SDK takes the invitation flow from the
157
+ * page's path, so the app names that path as `invitationUrl` when it configures
158
+ * the SDK (the legacy provider's `env.invitationUrl`; `<pont2-provider>` will
159
+ * do it, W-1). An invitation answered by the sign-in flow would sign the invitee
160
+ * in and join them to nothing, which is why this is its own element. The page
161
+ * should also drop an existing session before the flow (the legacy
162
+ * `answersInvitation`; the provider's job, W-1).
163
+ *
164
+ * Everything on screen comes from the flow's render spec: the instance's own
165
+ * invitation widgets if it published any, else the built-in ones.
166
+ *
167
+ * @tag pont2-invitation
168
+ */
169
+ export declare class Invitation extends FlowWidget {
170
+ protected readonly flowType = "invitation";
171
+ protected defaultFlowId(): undefined;
172
+ }
143
173
  declare global {
144
174
  interface HTMLElementTagNameMap {
145
175
  "pont2-signin": SignIn;
146
176
  "pont2-signup": SignUp;
177
+ "pont2-invitation": Invitation;
147
178
  }
148
179
  interface DocumentEventMap {
149
180
  "pont2-flow-state": CustomEvent<FlowStateEvent>;
@@ -23,6 +23,7 @@ export * from './qr-code/qr-code';
23
23
  export * from './recovery-codes/recovery-codes';
24
24
  export * from './scope-list/scope-list';
25
25
  export * from './layout/layout';
26
+ export * from './consent/consent';
26
27
  export * from './flow-widget/flow-widget';
27
28
  export * from './flow-widget/preview';
28
29
  export * from './flow-widget/specimens';
@@ -4,18 +4,41 @@
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" | "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";
8
+ /** The flow codes' English (a subset of `KIT_MESSAGES_EN`, core/messages.ts). */
8
9
  export declare const FLOW_MESSAGES_EN: Record<FlowMessageCode, string>;
9
10
  export interface FlowErrorDescription {
10
11
  message: string;
11
12
  /** The flow is over (409): offer "Start again". */
12
13
  restartable: boolean;
14
+ /** The instance has stopped: nothing will work, so offer nothing to retry. */
15
+ unavailable?: boolean;
13
16
  }
17
+ /**
18
+ * A stopped instance (paused, or its owner's Pontive account paused, cancelled or
19
+ * deleted) refuses everything it serves to end users with this one code and no
20
+ * reason (pontive-spec 01, "Who is told why"; carry-over §6).
21
+ */
22
+ export declare const INSTANCE_UNAVAILABLE = "instance_unavailable";
23
+ /** Whether a failed call was refused because the instance has stopped (its own `code`, or its body's). */
24
+ export declare function isInstanceUnavailable(error: unknown): boolean;
25
+ /**
26
+ * Keeps the sentence a stopped instance was refused with. Once stopped, the page
27
+ * can no longer ask for its text, so the auth service words the refusal itself
28
+ * (in the page's language and the instance's copy). Kept in the message table,
29
+ * it is what every widget says for the code from then on, including for
30
+ * refusals from services that only send English.
31
+ */
32
+ export declare function rememberUnavailable(sentence?: string): void;
14
33
  /**
15
34
  * - a cancelled or timed-out WebAuthn prompt (`NotAllowedError` / `AbortError`) → passkey_cancelled
35
+ * - `instance_unavailable` → the refusal's own sentence, kept for the page (rememberUnavailable); not restartable
16
36
  * - 409 → the server's sentence, else flow_ended; restartable
17
37
  * - no response at all (NETWORK_ERROR / TIMEOUT) → connection_failed
18
38
  * - 429 → too_many_attempts; ≥ 500 → server_error
19
39
  * - anything else → the server's sentence, else generic_error
40
+ *
41
+ * Text comes from `messages` when given (a set a caller holds), else the
42
+ * page-wide message table (core/messages.ts), else English.
20
43
  */
21
44
  export declare function describeFlowError(error: unknown, messages?: Partial<Record<string, string>>): FlowErrorDescription;
@@ -1,7 +1,7 @@
1
1
  import { PropertyDeclarations, PropertyValues } from 'lit';
2
2
  import { HostElement } from '../../core/host-element';
3
3
  import { BrandingEntitlements } from '../block/branding';
4
- export { describeFlowError, FLOW_MESSAGES_EN, type FlowErrorDescription, type FlowMessageCode } from './flow-error';
4
+ export { describeFlowError, FLOW_MESSAGES_EN, INSTANCE_UNAVAILABLE, isInstanceUnavailable, rememberUnavailable, type FlowErrorDescription, type FlowMessageCode, } from './flow-error';
5
5
  /**
6
6
  * What the layout needs from an auth client: one method. `Auth` from
7
7
  * `@pontive/oidc-client` satisfies it structurally, so pont2 never imports an
@@ -18,7 +18,6 @@ export interface FlowEventRequest {
18
18
  export interface FlowEventResponse {
19
19
  state?: string;
20
20
  render_spec?: unknown;
21
- [key: string]: unknown;
22
21
  }
23
22
  export interface UnregisteredElementDetail {
24
23
  tag: string;
@@ -84,23 +83,52 @@ export declare class Layout extends HostElement {
84
83
  client: FlowClient | undefined;
85
84
  renderSpec: string;
86
85
  branding: BrandingEntitlements;
86
+ /**
87
+ * The screen is on the designer's canvas: elements render representative examples of themselves
88
+ * instead of their empty state (core/design-mode.ts). The dashboard's widget builder sets it.
89
+ */
90
+ designMode: boolean;
87
91
  messages: Partial<Record<string, string>>;
88
92
  protected busy: boolean;
89
93
  private provider;
94
+ private designProvider;
90
95
  private pending;
91
96
  constructor();
92
97
  /** The layout's form (holds the screen). */
93
98
  get form(): HTMLFormElement | null;
94
99
  /** Runs one flow request (what a `pont2-action` from inside triggers). */
95
100
  run(event: string, data?: Record<string, unknown>): Promise<FlowEventResponse>;
101
+ /** The elements `lockScreen` disabled, to give back exactly those. */
102
+ private locked;
103
+ /**
104
+ * While a request runs, the screen's fields and its other buttons are disabled, as in the legacy
105
+ * kit: nothing can be edited or pressed mid-request (migration tracker F-20, F-35). The button
106
+ * that asked stays busy, focusably (it is not disabled). Elements already disabled are left
107
+ * alone and stay disabled afterwards. The values were read before the request started, so
108
+ * disabling the fields doesn't change what was sent.
109
+ */
110
+ private lockScreen;
111
+ private unlockScreen;
96
112
  private onAction;
97
113
  private onError;
98
- /** Shows a flow error at the top of the screen (after its logo/header). */
114
+ /**
115
+ * Shows a flow error at the top of the screen (after its logo/header). It replaces any error
116
+ * already there, the server's injected banner included (`pont2-alert[status="error"]`), so the
117
+ * screen holds one error at a time, as in the legacy kit (migration tracker F-21).
118
+ */
99
119
  showError(message: string, restartable?: boolean): void;
100
120
  private clearBanner;
101
121
  protected willUpdate(changed: PropertyValues): void;
102
122
  protected updated(changed: PropertyValues): void;
103
123
  private renderScreen;
124
+ /**
125
+ * The layout's form never submits natively. Every submission is either answered here (a
126
+ * `pont2-action` the layout responds to, which prevents it) or it is a mistake: no `client`
127
+ * yet, or a submit button without `event`. A native submission would then be a GET to the
128
+ * current URL with every field, password included, in the query string. So whatever is left
129
+ * unhandled is stopped here, at the form, after the submit buttons' own listeners have run.
130
+ */
131
+ private onFormSubmit;
104
132
  render(): import('lit-html').TemplateResult<1>;
105
133
  }
106
134
  declare global {
@@ -1,4 +1,4 @@
1
- import { PropertyDeclarations, PropertyValues } from 'lit';
1
+ import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
2
2
  import { ActionController } from '../../core/controllers/action';
3
3
  import { HostElement } from '../../core/host-element';
4
4
  export type LinkAlign = "start" | "center" | "end";
@@ -16,7 +16,10 @@ export type LinkAlign = "start" | "center" | "end";
16
16
  * primitive's part:
17
17
  *
18
18
  * - **with `href`**: a real `<a href>` (navigation, middle-click, "open in
19
- * new tab" work), styled as a link;
19
+ * new tab" work), styled as a link. Only an http(s) URL, absolute or
20
+ * relative, is linked (`safeUrl`): a `javascript:`, `data:` or other
21
+ * scheme renders **nothing** and the row is hidden (`data-invalid-href`),
22
+ * because an `href` from a render spec is data, not trusted markup;
20
23
  * - **otherwise**: a `<button type="button">` that requests `event` through
21
24
  * the action protocol (`data: { service }`), busy until it settles, like
22
25
  * the auth buttons. The legacy `service="other"` (no auth call) maps to:
@@ -27,7 +30,7 @@ export type LinkAlign = "start" | "center" | "end";
27
30
  * @attr prompt - text before the link
28
31
  * @attr event - the action requested on press (button form)
29
32
  * @attr service - auth (default) | other: passed in the request's data
30
- * @attr href, target, rel - render a real link instead
33
+ * @attr href, target, rel - render a real link instead (http(s) only; anything else renders nothing)
31
34
  * @attr align - start | center (default) | end
32
35
  * @attr disabled, loading
33
36
  * @cssprop --pont2-link-fg - the row's text (default muted-foreground)
@@ -54,11 +57,47 @@ export declare class Link extends HostElement {
54
57
  get busy(): boolean;
55
58
  /** The native `<a>` or `<button>`. */
56
59
  get control(): HTMLAnchorElement | HTMLButtonElement | null;
60
+ /** `href` is set but is not an http(s) URL: the link renders nothing. */
61
+ protected get invalidHref(): boolean;
57
62
  protected willUpdate(_changed: PropertyValues): void;
58
- render(): import('lit-html').TemplateResult<1>;
63
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
64
+ }
65
+ /**
66
+ * # `<pont2-external-link>`: a page outside the flow, in a new tab
67
+ *
68
+ * ```html
69
+ * <pont2-external-link label="Privacy policy" href="{{consent_privacy_policy_url}}"></pont2-external-link>
70
+ * ```
71
+ *
72
+ * The consent screen's links to an app's privacy policy, terms or homepage. It
73
+ * is `pont2-link`'s `href` form with the rules of the legacy
74
+ * `pont-external-link` (carry-over §7):
75
+ *
76
+ * - only an **absolute** http(s) URL with a host renders (`safeExternalUrl`).
77
+ * The href is usually a server placeholder filled from the app's settings,
78
+ * so empty, still a placeholder, relative or any other scheme renders
79
+ * **nothing** and the row is hidden (`data-invalid-href`);
80
+ * - it always opens a new tab, with `rel="noopener noreferrer"`;
81
+ * - `label` falls back to the URL;
82
+ * - it never requests an action and fires no event, so it is safe on screens
83
+ * that are not an auth flow.
84
+ *
85
+ * Styled by `pont2-link`'s recipe and tokens, so the two read as one kind of
86
+ * thing on a screen.
87
+ *
88
+ * @tag pont2-external-link
89
+ * @attr href - absolute http(s) URL; anything else renders nothing
90
+ * @attr label - link text (default: the URL)
91
+ * @attr prompt - text before the link
92
+ * @attr align - start | center (default) | end
93
+ */
94
+ export declare class ExternalLink extends Link {
95
+ protected get invalidHref(): boolean;
96
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
59
97
  }
60
98
  declare global {
61
99
  interface HTMLElementTagNameMap {
62
100
  "pont2-link": Link;
101
+ "pont2-external-link": ExternalLink;
63
102
  }
64
103
  }
@@ -1,4 +1,5 @@
1
1
  import { nothing, PropertyDeclarations } from 'lit';
2
+ import { DesignModeController } from '../../core/design-mode';
2
3
  import { HostElement } from '../../core/host-element';
3
4
  export type LogoAlign = "start" | "center" | "end";
4
5
  /**
@@ -46,6 +47,8 @@ export declare class Logo extends HostElement {
46
47
  align: LogoAlign;
47
48
  width: string;
48
49
  height: string;
50
+ /** Design mode (core/design-mode.ts): a placeholder mark when no image is set. */
51
+ protected readonly design: DesignModeController;
49
52
  constructor();
50
53
  protected willUpdate(): void;
51
54
  render(): import('lit-html').TemplateResult<1> | typeof nothing;
@@ -1,4 +1,5 @@
1
1
  import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { DesignModeController } from '../../core/design-mode';
2
3
  import { ButtonSize, ButtonVariant } from '../../primitives/button/button';
3
4
  import { Field } from '../../primitives/field/field';
4
5
  import { AuthButtonContent, AuthButtonIconAlign } from '../auth-button/auth-button';
@@ -27,6 +28,7 @@ export declare const providerEvent: (p: AuthProvider) => string;
27
28
  *
28
29
  * ```html
29
30
  * <pont2-provider-field providers="apple google meta"></pont2-provider-field>
31
+ * <pont2-provider-field providers='["google","github"]'></pont2-provider-field> (the form the platform injects)
30
32
  * ```
31
33
  *
32
34
  * **Is a Field** (`extends Field`), as in shadcn's login blocks (`<Field
@@ -73,7 +75,14 @@ export declare class ProviderField extends Field {
73
75
  label: string | undefined;
74
76
  loading: boolean;
75
77
  constructor();
76
- /** The providers actually rendered: known names, first occurrence only. */
78
+ /** Design mode (core/design-mode.ts): sample providers when none are set. */
79
+ protected readonly design: DesignModeController;
80
+ /**
81
+ * The providers actually rendered: known names, first occurrence only. In design mode with none
82
+ * set, three samples (google, apple, github): at serve time the platform injects the app's
83
+ * providers, and three is where the grid switches to icon-only buttons, the arrangement most
84
+ * real screens end up with (the legacy samples).
85
+ */
77
86
  get list(): AuthProvider[];
78
87
  /** The rendered `<pont2-provider-button>` elements. */
79
88
  get buttons(): HTMLElementTagNameMap["pont2-provider-button"][];
@@ -0,0 +1,36 @@
1
+ /**
2
+ * # Legacy markup → pont2 markup: the reference implementation of vocabulary.md
3
+ *
4
+ * `toPont2Markup(legacy)` applies docs/migration/vocabulary.md §2 and §3 to one
5
+ * stored widget's markup. It is **not part of the kit** (not exported from the
6
+ * package). It exists to:
7
+ *
8
+ * - prove S1's exit criterion: every built-in screen, rewritten, renders in
9
+ * `pont2-layout` and keeps its contract (the story `Migration/Built-in screens`);
10
+ * - be the golden reference for the S6 migration in branding-svc (M-2), whose
11
+ * Go implementation must produce the same output for the same input.
12
+ *
13
+ * It uses the browser's HTML parser (a `<template>`), so it runs where the
14
+ * stories run. Placeholders (`{{email}}`) and platform directives (`pont-id`,
15
+ * `requires-condition`, `data-pont-widget`) pass through untouched (§1 rule 3).
16
+ *
17
+ * `legacyContract` / `pont2Contract` read the form keys and events a screen
18
+ * submits, from each vocabulary's own rules, so a rewrite can be checked to
19
+ * keep them (the branding-svc gate does the same comparison at S6).
20
+ */
21
+ /** Rewrites one stored widget's markup into the pont2 vocabulary. */
22
+ export declare function toPont2Markup(legacy: string): string;
23
+ export interface Contract {
24
+ /** Form-data keys, sorted. */
25
+ keys: string[];
26
+ /** Events the screen can fire, sorted. */
27
+ events: string[];
28
+ }
29
+ /** The keys and events a legacy screen submits, by the legacy catalog's rules. */
30
+ export declare function legacyContract(legacy: string): Contract;
31
+ /**
32
+ * The keys and events a **rendered** pont2 screen submits, read from the upgraded
33
+ * elements themselves (their effective `fieldName` and `event`), not from the
34
+ * markup: this is what the browser would send.
35
+ */
36
+ export declare function pont2Contract(root: ParentNode): Contract;