@pontive/pontkit-core 1.34.1 → 1.35.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/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/pont2/core/index.d.ts +2 -0
- package/dist/pont2/core/messages.d.ts +71 -0
- package/dist/pont2/core/url.d.ts +19 -0
- package/dist/pont2/index.mjs +1677 -1423
- package/dist/pont2/index.mjs.map +1 -1
- package/dist/pont2/kit/auth-field/password-field.d.ts +4 -1
- package/dist/pont2/kit/consent/consent-api.d.ts +53 -0
- package/dist/pont2/kit/consent/consent.d.ts +83 -0
- package/dist/pont2/kit/countdown/countdown.d.ts +2 -2
- package/dist/pont2/kit/flow-widget/flow-widget.d.ts +37 -6
- package/dist/pont2/kit/index.d.ts +1 -0
- package/dist/pont2/kit/layout/flow-error.d.ts +24 -1
- package/dist/pont2/kit/layout/layout.d.ts +9 -2
- package/dist/pont2/kit/link/link.d.ts +43 -4
- package/dist/pont2/styles.css +33 -2
- package/package.json +1 -1
|
@@ -4,7 +4,9 @@ export * from './attrs';
|
|
|
4
4
|
export * from './ids';
|
|
5
5
|
export * from './events';
|
|
6
6
|
export * from './icons';
|
|
7
|
+
export * from './messages';
|
|
7
8
|
export * from './names';
|
|
9
|
+
export * from './url';
|
|
8
10
|
export * from './controllers/roving-focus';
|
|
9
11
|
export * from './controllers/action';
|
|
10
12
|
export * from './controllers/copy';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* # The kit's own words: a message table (decision D8 of the migration plan)
|
|
4
|
+
*
|
|
5
|
+
* Text no render spec carries, which a kit element writes itself: a connection
|
|
6
|
+
* error, "Start again", the password toggle's and the spinner's labels. The
|
|
7
|
+
* sign-in runtime sends it with every flow response, already in the flow's
|
|
8
|
+
* language and the instance's wording (branding-svc `pkg/message`, the codes
|
|
9
|
+
* marked Client; the SDK exposes them as `messages` on start results and flow
|
|
10
|
+
* events). Whatever receives a set calls `setMessages`, and every place that
|
|
11
|
+
* would write English reads `msg(code)` instead.
|
|
12
|
+
*
|
|
13
|
+
* English is the fallback. It is only needed before the page has heard from the
|
|
14
|
+
* server, for example when a flow fails to start because the network is down.
|
|
15
|
+
* Once a set has arrived it is kept, so a later failure that never reaches the
|
|
16
|
+
* server is still worded in the page's language.
|
|
17
|
+
*
|
|
18
|
+
* The table is **page-wide**, as in the legacy kit (`src/i18n/messages.ts`,
|
|
19
|
+
* ported, carry-over §2): every widget on a page speaks the same language, and
|
|
20
|
+
* a set one widget receives (or a stopped instance's refusal, §6) applies to all.
|
|
21
|
+
* Elements that render `msg()` add a `MessagesController`, so text that arrives
|
|
22
|
+
* after they first rendered reaches them.
|
|
23
|
+
*
|
|
24
|
+
* The account widgets' codes (carry-over §3) join this table when they are
|
|
25
|
+
* built (migration tracker I-2, W-7…W-10).
|
|
26
|
+
*/
|
|
27
|
+
export declare const KIT_MESSAGES_EN: {
|
|
28
|
+
readonly connection_failed: "We couldn't reach the server. Check your connection and try again.";
|
|
29
|
+
readonly too_many_attempts: "Too many attempts. Try again later.";
|
|
30
|
+
readonly server_error: "Something went wrong on our side. Please try again.";
|
|
31
|
+
readonly instance_unavailable: "This app isn't available right now.";
|
|
32
|
+
readonly generic_error: "Something went wrong. Please try again.";
|
|
33
|
+
readonly flow_ended: "This sign-in could not be completed.";
|
|
34
|
+
readonly passkey_cancelled: "The passkey request was cancelled or timed out. Please try again.";
|
|
35
|
+
readonly start_again: "Start again";
|
|
36
|
+
readonly continued_elsewhere_title: "You continued in another tab";
|
|
37
|
+
readonly continued_elsewhere_subtitle: "You can close this one.";
|
|
38
|
+
readonly continue_here: "Continue here instead";
|
|
39
|
+
readonly show_password: "Show password";
|
|
40
|
+
readonly hide_password: "Hide password";
|
|
41
|
+
readonly loading: "Loading";
|
|
42
|
+
};
|
|
43
|
+
export type KitMessageCode = keyof typeof KIT_MESSAGES_EN;
|
|
44
|
+
/**
|
|
45
|
+
* Records a set the server sent. Sets merge (a flow response and, later, the
|
|
46
|
+
* widget-messages read carry different codes for the same language). An empty or
|
|
47
|
+
* missing set changes nothing: a response without one says nothing about the
|
|
48
|
+
* language having changed.
|
|
49
|
+
*/
|
|
50
|
+
export declare function setMessages(messages?: Record<string, string> | null, locale?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* The text for a code in the language the page was last served in. A code
|
|
53
|
+
* outside the kit's table needs a `fallback`; without one, the code itself is
|
|
54
|
+
* returned (visible, rather than an empty string).
|
|
55
|
+
*/
|
|
56
|
+
export declare function msg(code: KitMessageCode): string;
|
|
57
|
+
export declare function msg(code: string, fallback: string): string;
|
|
58
|
+
/** The language the page was last served in, for formatting; undefined until the server has said. */
|
|
59
|
+
export declare function currentLocale(): string | undefined;
|
|
60
|
+
/** Calls `listener` whenever a set arrives. Returns the unsubscribe. */
|
|
61
|
+
export declare function onMessagesChanged(listener: () => void): () => void;
|
|
62
|
+
/** Forgets every set. For tests and stories. */
|
|
63
|
+
export declare function resetMessages(): void;
|
|
64
|
+
/** Re-renders its host whenever a set arrives. Add it to every element that renders `msg()`. */
|
|
65
|
+
export declare class MessagesController implements ReactiveController {
|
|
66
|
+
private readonly host;
|
|
67
|
+
private unsubscribe?;
|
|
68
|
+
constructor(host: ReactiveControllerHost);
|
|
69
|
+
hostConnected(): void;
|
|
70
|
+
hostDisconnected(): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URLs a kit element may navigate to or link to.
|
|
3
|
+
*
|
|
4
|
+
* Render specs and attributes are data, so an `href` or a redirect target can
|
|
5
|
+
* be anything, including `javascript:` or `data:`. Every element that turns
|
|
6
|
+
* one into navigation (`pont2-link[href]`, `pont2-countdown[redirect-url]`)
|
|
7
|
+
* goes through `safeUrl` and treats `null` as "don't navigate".
|
|
8
|
+
*/
|
|
9
|
+
/** Resolves `raw` against `base` (the page) and accepts only http(s); otherwise `null`. */
|
|
10
|
+
export declare function safeUrl(raw: string | null | undefined, base?: string): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Stricter than `safeUrl`: an **absolute** http(s) URL with a host, or `null`.
|
|
13
|
+
* For links to pages outside the flow (`pont2-external-link`), whose href is
|
|
14
|
+
* usually a server placeholder filled from the app's settings
|
|
15
|
+
* (`{{consent_privacy_policy_url}}`): empty, still a placeholder, relative or
|
|
16
|
+
* a code-running scheme must not become a link. The legacy
|
|
17
|
+
* `safeExternalHref`, ported.
|
|
18
|
+
*/
|
|
19
|
+
export declare function safeExternalUrl(raw: unknown): string | null;
|