@pontive/pontkit-core 1.27.0 → 1.29.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.
Files changed (69) hide show
  1. package/catalog.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/components/renderers/auth/scope-list/_scope-list.d.ts +1 -1
  4. package/dist/components/renderers/auth/scope-list/scope-list.types.d.ts +1 -1
  5. package/dist/components/widgets/pont-consent/consent-api.d.ts +1 -1
  6. package/dist/components/widgets/pont-consent/pont-consent.d.ts +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/pont2/core/controllers/action.d.ts +79 -0
  10. package/dist/pont2/core/controllers/copy.d.ts +34 -0
  11. package/dist/pont2/core/icons.d.ts +24 -16
  12. package/dist/pont2/core/index.d.ts +2 -0
  13. package/dist/pont2/core/names.d.ts +1 -1
  14. package/dist/pont2/globals.css +19 -7
  15. package/dist/pont2/index.mjs +3349 -1494
  16. package/dist/pont2/index.mjs.map +1 -1
  17. package/dist/pont2/kit/alert/alert.d.ts +2 -1
  18. package/dist/pont2/kit/auth-button/auth-button.d.ts +185 -0
  19. package/dist/pont2/kit/auth-button/providers.d.ts +15 -0
  20. package/dist/pont2/kit/auth-field/auth-field.d.ts +267 -0
  21. package/dist/pont2/kit/auth-field/password-field.d.ts +124 -0
  22. package/dist/pont2/kit/block/block.d.ts +66 -0
  23. package/dist/pont2/kit/block/branding.d.ts +36 -0
  24. package/dist/pont2/kit/container/container.d.ts +40 -0
  25. package/dist/pont2/kit/countdown/countdown.d.ts +64 -0
  26. package/dist/pont2/kit/divider/divider.d.ts +30 -0
  27. package/dist/pont2/kit/edit-identifier/edit-identifier.d.ts +47 -0
  28. package/dist/pont2/kit/flow-widget/flow-widget.d.ts +151 -0
  29. package/dist/pont2/kit/gap/gap.d.ts +36 -0
  30. package/dist/pont2/kit/header/header.d.ts +37 -0
  31. package/dist/pont2/kit/index.d.ts +23 -0
  32. package/dist/pont2/kit/input-otp/input-otp.d.ts +7 -0
  33. package/dist/pont2/kit/layout/flow-error.d.ts +21 -0
  34. package/dist/pont2/kit/layout/layout.d.ts +120 -0
  35. package/dist/pont2/kit/link/link.d.ts +64 -0
  36. package/dist/pont2/kit/logo/logo.d.ts +57 -0
  37. package/dist/pont2/kit/otp-field/otp-field.d.ts +93 -0
  38. package/dist/pont2/kit/otp-field/otp-resend.d.ts +63 -0
  39. package/dist/pont2/kit/provider-field/provider-field.d.ts +87 -0
  40. package/dist/pont2/kit/qr-code/qr-code.d.ts +87 -0
  41. package/dist/pont2/kit/recovery-codes/recovery-codes.d.ts +65 -0
  42. package/dist/pont2/kit/scope-list/scope-list.d.ts +69 -0
  43. package/dist/pont2/kit/scope-list/scope-value.d.ts +16 -0
  44. package/dist/pont2/kit/secret/secret.d.ts +67 -0
  45. package/dist/pont2/kit/story-helpers.d.ts +9 -0
  46. package/dist/pont2/kit/typography/typography.d.ts +74 -0
  47. package/dist/pont2/kit/watermark/pontive-logo.d.ts +8 -0
  48. package/dist/pont2/kit/watermark/watermark.d.ts +44 -0
  49. package/dist/pont2/primitives/card/card.d.ts +3 -1
  50. package/dist/pont2/primitives/dropdown-menu/dropdown-menu.d.ts +5 -0
  51. package/dist/pont2/primitives/popover/popover.d.ts +2 -0
  52. package/dist/pont2/primitives/tooltip/tooltip.d.ts +2 -0
  53. package/dist/pont2/styles.css +3042 -935
  54. package/dist/pont2/theme/apply.d.ts +29 -0
  55. package/dist/pont2/theme/compile.d.ts +23 -0
  56. package/dist/pont2/theme/index.d.ts +23 -0
  57. package/dist/pont2/theme/manifest.d.ts +2 -0
  58. package/dist/pont2/theme/scopes.d.ts +13 -0
  59. package/dist/pont2/theme/shadcn.d.ts +7 -0
  60. package/dist/pont2/theme/tokens.json.d.ts +7009 -0
  61. package/dist/pont2/theme/types.d.ts +92 -0
  62. package/dist/pont2/theme/validate.d.ts +11 -0
  63. package/dist/pont2/theme/value.d.ts +10 -0
  64. package/dist/pont2/theme/vocabulary.d.ts +32 -0
  65. package/dist/pont2/theme.mjs +337 -0
  66. package/dist/pont2/theme.mjs.map +1 -0
  67. package/dist/pont2/tokens.json +7006 -0
  68. package/dist/pont2/with-legacy.css +1 -1
  69. package/package.json +8 -2
@@ -0,0 +1,64 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { ActionController } from '../../core/controllers/action';
3
+ import { HostElement } from '../../core/host-element';
4
+ export type LinkAlign = "start" | "center" | "end";
5
+ /**
6
+ * # `<pont2-link>`: "Don't have an account? Sign up"
7
+ *
8
+ * ```html
9
+ * <pont2-link prompt="Don't have an account?" label="Sign up" event="goto_signup"></pont2-link>
10
+ * <pont2-link label="Privacy policy" href="/privacy" target="_blank"></pont2-link>
11
+ * ```
12
+ *
13
+ * shadcn's login blocks write this as `<div class="text-center text-sm">
14
+ * Don't have an account? <a class="underline underline-offset-4">Sign
15
+ * up</a></div>`. pont2's host is that row; the link is the button
16
+ * primitive's part:
17
+ *
18
+ * - **with `href`**: a real `<a href>` (navigation, middle-click, "open in
19
+ * new tab" work), styled as a link;
20
+ * - **otherwise**: a `<button type="button">` that requests `event` through
21
+ * the action protocol (`data: { service }`), busy until it settles, like
22
+ * the auth buttons. The legacy `service="other"` (no auth call) maps to:
23
+ * don't set `event`, or don't respond.
24
+ *
25
+ * @tag pont2-link
26
+ * @attr label - link text (default "Link")
27
+ * @attr prompt - text before the link
28
+ * @attr event - the action requested on press (button form)
29
+ * @attr service - auth (default) | other: passed in the request's data
30
+ * @attr href, target, rel - render a real link instead
31
+ * @attr align - start | center (default) | end
32
+ * @attr disabled, loading
33
+ * @cssprop --pont2-link-fg - the row's text (default muted-foreground)
34
+ * @cssprop --pont2-link-button-fg, --pont2-link-button-fg-hover - the link (default the row's colour; primary on hover)
35
+ * @fires pont2-action, pont2-action-success, pont2-action-error
36
+ */
37
+ export declare class Link extends HostElement {
38
+ static identity: string;
39
+ static slotName: string;
40
+ static composite: boolean;
41
+ static properties: PropertyDeclarations;
42
+ label: string;
43
+ prompt: string;
44
+ event: string | undefined;
45
+ service: "auth" | "other";
46
+ href: string | undefined;
47
+ target: string | undefined;
48
+ rel: string | undefined;
49
+ align: LinkAlign;
50
+ disabled: boolean;
51
+ loading: boolean;
52
+ protected readonly action: ActionController;
53
+ constructor();
54
+ get busy(): boolean;
55
+ /** The native `<a>` or `<button>`. */
56
+ get control(): HTMLAnchorElement | HTMLButtonElement | null;
57
+ protected willUpdate(_changed: PropertyValues): void;
58
+ render(): import('lit-html').TemplateResult<1>;
59
+ }
60
+ declare global {
61
+ interface HTMLElementTagNameMap {
62
+ "pont2-link": Link;
63
+ }
64
+ }
@@ -0,0 +1,57 @@
1
+ import { nothing, PropertyDeclarations } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ export type LogoAlign = "start" | "center" | "end";
4
+ /**
5
+ * A logo source as an `<img src>`: URLs and `data:` URIs pass through; a bare
6
+ * base64 string is treated as an SVG (the legacy `resolveIconSource` rule).
7
+ * `{{theme}}` in a URL is replaced with `light` or `dark`.
8
+ */
9
+ export declare function logoSource(raw: string | undefined, theme: "light" | "dark"): string;
10
+ /**
11
+ * # `<pont2-logo>`: the application's logo
12
+ *
13
+ * ```html
14
+ * <pont2-logo image-url="https://cdn.example.com/logo-{{theme}}.svg" alt="Acme"></pont2-logo>
15
+ * → <pont2-logo data-pont2-logo data-slot="logo" data-align="center">
16
+ * <img data-logo-theme="light" src="…logo-light.svg" alt="Acme">
17
+ * <img data-logo-theme="dark" src="…logo-dark.svg" alt="Acme"> (only when it differs)
18
+ * </pont2-logo>
19
+ * ```
20
+ *
21
+ * **Always an `<img>`.** The legacy element decoded base64 SVG and injected
22
+ * it as markup (`unsafeSVG`), which runs whatever the SVG contains in the
23
+ * page. An `<img>` renders the same SVG sandboxed (no script, no external
24
+ * fetches), and needs no decoding.
25
+ *
26
+ * **Dark mode by CSS**, not by watching `<html data-theme>`: when the dark
27
+ * source differs (`image-url-dark`, or `{{theme}}` in the URL), both images
28
+ * are rendered and the stylesheet shows the right one under `.dark` /
29
+ * `[data-theme="dark"]` (the pont2 dark-mode switches).
30
+ *
31
+ * @tag pont2-logo
32
+ * @attr image-url - URL, `data:` URI or bare base64 SVG; `{{theme}}` is replaced
33
+ * @attr image-url-dark - dark-mode source (default: `image-url` with `{{theme}}` = dark)
34
+ * @attr alt - default "Logo" (legacy); set the brand name
35
+ * @attr align - start | center (default) | end
36
+ * @attr width, height - CSS lengths for the image
37
+ */
38
+ export declare class Logo extends HostElement {
39
+ static identity: string;
40
+ static slotName: string;
41
+ static composite: boolean;
42
+ static properties: PropertyDeclarations;
43
+ imageUrl: string;
44
+ imageUrlDark: string;
45
+ alt: string;
46
+ align: LogoAlign;
47
+ width: string;
48
+ height: string;
49
+ constructor();
50
+ protected willUpdate(): void;
51
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
52
+ }
53
+ declare global {
54
+ interface HTMLElementTagNameMap {
55
+ "pont2-logo": Logo;
56
+ }
57
+ }
@@ -0,0 +1,93 @@
1
+ import { nothing, PropertyDeclarations, TemplateResult } from 'lit';
2
+ import { ActionController } from '../../core/controllers/action';
3
+ import { InputOTP } from '../../primitives/input-otp/input-otp';
4
+ import { InputOptions } from '../../primitives/input/input';
5
+ import { AuthField, FieldIssue } from '../auth-field/auth-field';
6
+ /** The legacy `pont-otp` layouts, kept for render-spec parity. */
7
+ export type OtpLayout = "digits_only" | "simple" | "with_separator" | "with_spacing";
8
+ /**
9
+ * # `<pont2-otp-field>`: a verification-code field
10
+ *
11
+ * ```html
12
+ * <form>
13
+ * <pont2-otp-field label="Verification code" length="6" layout="with_separator" required></pont2-otp-field>
14
+ * <pont2-submit-button event="verify_code" label="Verify"></pont2-submit-button>
15
+ * </form>
16
+ * ```
17
+ *
18
+ * **Is a Field** (`extends AuthField extends Field`) holding the Input OTP
19
+ * primitive, as shadcn composes it (`<Field><FieldLabel/><InputOTP/>
20
+ * <FieldDescription/></Field>`):
21
+ *
22
+ * ```html
23
+ * <pont2-otp-field data-pont2-field data-slot="field">
24
+ * <label data-pont2-field-label for="…-input">Verification code</label>
25
+ * <pont2-prim-input-otp maxlength="6" name="code" input-id="…-input" …>
26
+ * <div data-pont2-input-otp-group …> <pont2-prim-input-otp-slot index="0"> …×3 </div>
27
+ * <div data-pont2-input-otp-separator …><svg/></div>
28
+ * <div data-pont2-input-otp-group …> …×3 </div>
29
+ * <div data-pont2-input-otp-input-wrapper><input autocomplete="one-time-code" name="code" …></div>
30
+ * </pont2-prim-input-otp>
31
+ * <div data-pont2-field-error role="alert">Please enter the complete verification code.</div>
32
+ * </pont2-otp-field>
33
+ * ```
34
+ *
35
+ * The Input OTP is rendered as its **primitive element** (it has behaviour);
36
+ * its groups and separators are parts, and its slots are elements (kit/input-otp).
37
+ * Everything an auth field does applies: the one native
38
+ * `autocomplete="one-time-code"` input is the form control, validation is
39
+ * native (`required`, then *incomplete*), errors are inline.
40
+ *
41
+ * **Auto-submit** (`auto-submit`): when every slot is filled,
42
+ * - with `event`: requests it through the action protocol, with the same
43
+ * `data: { form, formData }` shape as the submit button (so one flow
44
+ * handler serves both);
45
+ * - without `event`: submits the enclosing form (`form.requestSubmit()`), so
46
+ * its submit button handles the request.
47
+ *
48
+ * @tag pont2-otp-field
49
+ * @attr length - number of characters (default 6)
50
+ * @attr layout - digits_only (one group, default) | simple (2 groups) | with_separator (3 groups) | with_spacing (one slot per group)
51
+ * @attr group-size, separator - explicit grouping (override `layout`)
52
+ * @attr pattern - per-character regex source (default digits; `pattern=""` accepts anything)
53
+ * @attr auto-submit - submit when complete
54
+ * @attr event - the action requested on auto-submit
55
+ * @attr incomplete-error - default "Please enter the complete verification code."
56
+ * @fires pont2-complete - from the Input OTP, `{ value }`
57
+ * @fires pont2-action, pont2-action-success, pont2-action-error - on auto-submit with `event`
58
+ */
59
+ export declare class OtpField extends AuthField {
60
+ static properties: PropertyDeclarations;
61
+ length: number;
62
+ layout: OtpLayout;
63
+ groupSize: number | undefined;
64
+ separator: boolean | undefined;
65
+ autoSubmit: boolean;
66
+ event: string | undefined;
67
+ incompleteError: string;
68
+ protected readonly action: ActionController;
69
+ constructor();
70
+ protected defaultName(): string;
71
+ protected defaultLabel(): string;
72
+ /** The Input OTP primitive element. */
73
+ get otp(): InputOTP | null;
74
+ get control(): HTMLInputElement | null;
75
+ /** `true` while an auto-submit request is pending. */
76
+ get busy(): boolean;
77
+ protected computeIssues(): FieldIssue[];
78
+ protected valueIssues(value: string): FieldIssue[];
79
+ /** Group size and separators from `layout`, unless set explicitly. */
80
+ get grouping(): {
81
+ size: number;
82
+ separator: boolean;
83
+ };
84
+ private onComplete;
85
+ protected onReset: () => void;
86
+ protected renderLabel(): TemplateResult | typeof nothing;
87
+ protected renderControl(o: InputOptions): TemplateResult;
88
+ }
89
+ declare global {
90
+ interface HTMLElementTagNameMap {
91
+ "pont2-otp-field": OtpField;
92
+ }
93
+ }
@@ -0,0 +1,63 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { ActionController } from '../../core/controllers/action';
3
+ import { HostElement } from '../../core/host-element';
4
+ /**
5
+ * # `<pont2-otp-resend>`: "Resend code in 42s", then a resend link
6
+ *
7
+ * ```html
8
+ * <pont2-otp-resend event="resend_code" duration="60"></pont2-otp-resend>
9
+ * ```
10
+ *
11
+ * ```html
12
+ * <pont2-otp-resend data-pont2-otp-resend data-slot="otp-resend">
13
+ * <span data-slot="otp-resend-countdown" role="timer">Resend code in 42s</span>
14
+ * ⟶ when it reaches 0:
15
+ * <button data-pont2-button data-variant="link" data-slot="otp-resend-button" type="button">Resend code</button>
16
+ * </pont2-otp-resend>
17
+ * ```
18
+ *
19
+ * The root is a plain row, so this is a new-name composite on `HostElement`
20
+ * (06-higher-layers: layout renderers). The button is the button primitive's
21
+ * part and requests `event` through the action protocol (`data: { resend:
22
+ * true }`); the countdown restarts when it is pressed, as in the legacy kit.
23
+ *
24
+ * The countdown is `role="timer"` (not announced every second). When it
25
+ * ends, the button appears; focus is not moved.
26
+ *
27
+ * @tag pont2-otp-resend
28
+ * @attr duration - seconds before the button appears (default 60; 0 shows it at once)
29
+ * @attr event - the action requested on press
30
+ * @attr label - button text (default "Resend code")
31
+ * @attr countdown-text - text before the seconds (default "Resend code in ")
32
+ * @cssprop --pont2-otp-resend-fg - the row's text (default muted-foreground)
33
+ * @cssprop --pont2-otp-resend-button-fg, --pont2-otp-resend-button-fg-hover - the link (default the row's colour; primary on hover)
34
+ * @fires pont2-action, pont2-action-success, pont2-action-error
35
+ */
36
+ export declare class OtpResend extends HostElement {
37
+ static identity: string;
38
+ static slotName: string;
39
+ static composite: boolean;
40
+ static properties: PropertyDeclarations;
41
+ duration: number;
42
+ event: string | undefined;
43
+ label: string;
44
+ countdownText: string;
45
+ /** Seconds left. */
46
+ remaining: number;
47
+ protected readonly action: ActionController;
48
+ private timer;
49
+ constructor();
50
+ /** Starts (or restarts) the countdown from `duration`. */
51
+ restart(): void;
52
+ private stop;
53
+ connectedCallback(): void;
54
+ disconnectedCallback(): void;
55
+ protected willUpdate(changed: PropertyValues): void;
56
+ private press;
57
+ render(): import('lit-html').TemplateResult<1>;
58
+ }
59
+ declare global {
60
+ interface HTMLElementTagNameMap {
61
+ "pont2-otp-resend": OtpResend;
62
+ }
63
+ }
@@ -0,0 +1,87 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { ButtonSize, ButtonVariant } from '../../primitives/button/button';
3
+ import { Field } from '../../primitives/field/field';
4
+ import { AuthButtonContent, AuthButtonIconAlign } from '../auth-button/auth-button';
5
+ import { AuthProvider } from '../auth-button/providers';
6
+ /** Per-provider settings that override the field-wide ones (the legacy `overrides`). */
7
+ export interface ProviderOverride {
8
+ provider: AuthProvider;
9
+ label?: string;
10
+ prompt?: string;
11
+ event?: string;
12
+ variant?: ButtonVariant;
13
+ size?: ButtonSize;
14
+ content?: AuthButtonContent;
15
+ iconAlign?: AuthButtonIconAlign;
16
+ disabled?: boolean;
17
+ loading?: boolean;
18
+ }
19
+ /** The legacy column layouts of a 12-column grid, by provider count. */
20
+ export type ProviderColumns = "one" | "three" | "four" | "two-three" | "three-four";
21
+ /** 1–2 → one per row; multiples of 3 → three; 5 → 2 + 3; 7 → 3 + 4; otherwise four (legacy rule). */
22
+ export declare function providerColumns(count: number): ProviderColumns;
23
+ /** The legacy default event per provider: the platform's OAuth sign-in action. */
24
+ export declare const providerEvent: (p: AuthProvider) => string;
25
+ /**
26
+ * # `<pont2-provider-field>`: the "continue with…" button grid
27
+ *
28
+ * ```html
29
+ * <pont2-provider-field providers="apple google meta"></pont2-provider-field>
30
+ * ```
31
+ *
32
+ * **Is a Field** (`extends Field`), as in shadcn's login blocks (`<Field
33
+ * className="grid grid-cols-3 gap-4">` holding the buttons), laid out on the
34
+ * legacy kit's 12-column grid (`data-columns`, see `providerColumns`). It
35
+ * renders one **`<pont2-provider-button>` element** per provider:
36
+ *
37
+ * ```html
38
+ * <pont2-provider-field data-pont2-field data-slot="field" role="group" data-columns="three">
39
+ * <pont2-provider-button provider="apple" content="icon" event="signin_with_oauth(apple)" data-pont2-shell>
40
+ * <button data-pont2-button data-variant="outline" data-provider="apple" aria-label="Continue with Apple">…</button>
41
+ * </pont2-provider-button>
42
+ * …
43
+ * </pont2-provider-field>
44
+ * ```
45
+ *
46
+ * Nesting kit elements is normally forbidden in kit templates. This is the
47
+ * documented exception (docs/10-primitives-and-kit.md §5): each button is an
48
+ * **independent, stateful** element (its own busy state and action request),
49
+ * repeated per item, and its host is `display: contents`, so the grid items
50
+ * are the native buttons and the DOM is shadcn's.
51
+ *
52
+ * Field-wide settings apply to every button; `overrides` (JSON attribute or
53
+ * array property) replaces them for one provider. With more than two
54
+ * providers the buttons default to icon-only (legacy).
55
+ *
56
+ * @tag pont2-provider-field
57
+ * @attr providers - e.g. "apple google github" (duplicates and unknown names are dropped)
58
+ * @attr event - one event for every button (default: `signin_with_oauth(<provider>)` each)
59
+ * @attr variant, size, content, icon-align, prompt, label, disabled, loading - passed to every button
60
+ * @attr overrides - JSON array of per-provider settings, e.g. `[{"provider":"google","label":"Google Workspace"}]`
61
+ */
62
+ export declare class ProviderField extends Field {
63
+ static composite: boolean;
64
+ static properties: PropertyDeclarations;
65
+ providers: AuthProvider[];
66
+ overrides: ProviderOverride[];
67
+ event: string | undefined;
68
+ variant: ButtonVariant | undefined;
69
+ size: ButtonSize | undefined;
70
+ content: AuthButtonContent | undefined;
71
+ iconAlign: AuthButtonIconAlign | undefined;
72
+ prompt: string | undefined;
73
+ label: string | undefined;
74
+ loading: boolean;
75
+ constructor();
76
+ /** The providers actually rendered: known names, first occurrence only. */
77
+ get list(): AuthProvider[];
78
+ /** The rendered `<pont2-provider-button>` elements. */
79
+ get buttons(): HTMLElementTagNameMap["pont2-provider-button"][];
80
+ protected willUpdate(changed: PropertyValues): void;
81
+ render(): unknown;
82
+ }
83
+ declare global {
84
+ interface HTMLElementTagNameMap {
85
+ "pont2-provider-field": ProviderField;
86
+ }
87
+ }
@@ -0,0 +1,87 @@
1
+ import { nothing, PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ export type QrErrorCorrection = "L" | "M" | "Q" | "H";
4
+ /**
5
+ * One SVG path covering every dark module of `text`'s QR code, plus the
6
+ * code's size. `null` when the text cannot be encoded.
7
+ */
8
+ export declare function qrPath(text: string, level: QrErrorCorrection): {
9
+ d: string;
10
+ size: number;
11
+ } | null;
12
+ export interface QrDetail {
13
+ url: string;
14
+ }
15
+ /**
16
+ * # `<pont2-qr-code>`: the authenticator-app enrolment QR code
17
+ *
18
+ * ```html
19
+ * <pont2-qr-code url="otpauth://totp/Acme:ada@example.com?secret=…&issuer=Acme" timeout="30"></pont2-qr-code>
20
+ * ```
21
+ *
22
+ * ```html
23
+ * <pont2-qr-code data-pont2-qr-code data-slot="qr-code" [data-obscured]>
24
+ * <svg data-slot="qr-code-image" role="img" aria-label="QR code" viewBox="0 0 37 37">
25
+ * <rect …white…/><path d="M4 4h1v1h-1z…"/>
26
+ * </svg>
27
+ * <div data-slot="qr-code-overlay"> (when obscured)
28
+ * <button data-pont2-button type="button">Show QR code</button>
29
+ * </div>
30
+ * </pont2-qr-code>
31
+ * ```
32
+ *
33
+ * **An SVG built from the code's modules** (`qrcode`'s `create()` matrix →
34
+ * one `<path>`), not a canvas: crisp at any size and zoom, no pixel-ratio
35
+ * maths, nothing injected as markup. Always dark-on-white with the
36
+ * 4-module quiet zone, whatever the theme: inverted codes do not scan
37
+ * everywhere.
38
+ *
39
+ * **Obscured after `timeout` seconds** (it encodes the TOTP secret): the
40
+ * code fades and a "Show QR code" button brings it back for another
41
+ * `timeout`. `timeout="0"` never obscures.
42
+ *
43
+ * @tag pont2-qr-code
44
+ * @attr url - the text to encode (an `otpauth://` URI)
45
+ * @attr timeout - seconds before obscuring (default 10)
46
+ * @attr error-correction - L | M (default) | Q | H
47
+ * @attr label - accessible name of the image (default "QR code")
48
+ * @attr reveal-label - the button text (default "Show QR code")
49
+ * @attr disabled - never obscures, and disables the button
50
+ * @cssprop --pont2-qr-code-width - the image width (default 12rem)
51
+ * @fires pont2-qr-obscured, pont2-qr-revealed - `{ url }`
52
+ * @fires pont2-qr-error - `{ url }` when the text cannot be encoded
53
+ */
54
+ export declare class QrCode extends HostElement {
55
+ static identity: string;
56
+ static slotName: string;
57
+ static composite: boolean;
58
+ static properties: PropertyDeclarations;
59
+ url: string;
60
+ timeout: number;
61
+ errorCorrection: QrErrorCorrection;
62
+ label: string;
63
+ revealLabel: string;
64
+ disabled: boolean;
65
+ obscured: boolean;
66
+ private timer;
67
+ private path;
68
+ constructor();
69
+ /** Shows the code again and restarts the timeout. */
70
+ reveal(): void;
71
+ private startTimer;
72
+ connectedCallback(): void;
73
+ disconnectedCallback(): void;
74
+ protected willUpdate(changed: PropertyValues): void;
75
+ private onReveal;
76
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
77
+ }
78
+ declare global {
79
+ interface HTMLElementTagNameMap {
80
+ "pont2-qr-code": QrCode;
81
+ }
82
+ interface HTMLElementEventMap {
83
+ "pont2-qr-obscured": CustomEvent<QrDetail>;
84
+ "pont2-qr-revealed": CustomEvent<QrDetail>;
85
+ "pont2-qr-error": CustomEvent<QrDetail>;
86
+ }
87
+ }
@@ -0,0 +1,65 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { CopyController } from '../../core/controllers/copy';
3
+ import { HostElement } from '../../core/host-element';
4
+ /**
5
+ * # `<pont2-recovery-codes>`: one-time recovery codes after MFA enrolment
6
+ *
7
+ * ```html
8
+ * <pont2-recovery-codes codes='["a1b2-c3d4","e5f6-g7h8"]'></pont2-recovery-codes>
9
+ * ```
10
+ *
11
+ * ```html
12
+ * <pont2-recovery-codes data-pont2-recovery-codes data-slot="recovery-codes">
13
+ * <p data-slot="recovery-codes-title">Recovery codes</p>
14
+ * <p data-slot="recovery-codes-description">Use these codes if you lose access…</p>
15
+ * <ul data-slot="recovery-codes-list"><li>a1b2-c3d4</li>…</ul>
16
+ * <div data-slot="recovery-codes-actions">
17
+ * <button data-pont2-button data-variant="outline">Copy codes</button>
18
+ * <button data-pont2-button data-variant="outline">Download codes</button>
19
+ * </div>
20
+ * <span data-slot="recovery-codes-copied" role="status">Copied!</span>
21
+ * </pont2-recovery-codes>
22
+ * ```
23
+ *
24
+ * Buttons are the button primitive's parts, the list is a monospace grid,
25
+ * "Copied!" is announced (`role="status"`). Events carry **no codes**
26
+ * (`pont2-copied` / `pont2-copy-error` with `{ kind: "recovery-codes" }`,
27
+ * `pont2-recovery-codes-downloaded`); the legacy events included them.
28
+ *
29
+ * @tag pont2-recovery-codes
30
+ * @attr codes - JSON array or whitespace-separated list; `.codes` is an array
31
+ * @attr title-text, description, empty-text, copy-label, download-label, copied-text - copy
32
+ * @attr filename - download file name (default "recovery-codes.txt")
33
+ * @attr disabled
34
+ * @cssprop --pont2-recovery-codes-list-bg, --pont2-recovery-codes-list-radius - the code list's surface (default muted, radius-md)
35
+ * @fires pont2-copied, pont2-copy-error, pont2-recovery-codes-downloaded
36
+ */
37
+ export declare class RecoveryCodes extends HostElement {
38
+ static identity: string;
39
+ static slotName: string;
40
+ static composite: boolean;
41
+ static properties: PropertyDeclarations;
42
+ codes: string[];
43
+ titleText: string;
44
+ description: string;
45
+ emptyText: string;
46
+ copyLabel: string;
47
+ downloadLabel: string;
48
+ copiedText: string;
49
+ filename: string;
50
+ disabled: boolean;
51
+ protected readonly clipboard: CopyController;
52
+ constructor();
53
+ private get text();
54
+ copy(): Promise<boolean>;
55
+ download(): void;
56
+ render(): import('lit-html').TemplateResult<1>;
57
+ }
58
+ declare global {
59
+ interface HTMLElementTagNameMap {
60
+ "pont2-recovery-codes": RecoveryCodes;
61
+ }
62
+ interface HTMLElementEventMap {
63
+ "pont2-recovery-codes-downloaded": CustomEvent<Record<string, never>>;
64
+ }
65
+ }
@@ -0,0 +1,69 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { FormControlElement } from '../../core/form-control';
3
+ import { ConsentScope } from './scope-value';
4
+ export { isScopeChecked, normalizeScopes, scopeListValue, type ConsentScope } from './scope-value';
5
+ /**
6
+ * # `<pont2-scope-list>`: OAuth consent scopes
7
+ *
8
+ * ```html
9
+ * <form>
10
+ * <pont2-scope-list name="scope"
11
+ * scopes='[{"scope":"openid","label":"Sign you in","required":true},{"scope":"email","label":"See your email"}]'>
12
+ * </pont2-scope-list>
13
+ * </form>
14
+ * → FormData: scope=openid email
15
+ * ```
16
+ *
17
+ * ```html
18
+ * <pont2-scope-list data-pont2-scope-list data-slot="scope-list" role="list">
19
+ * <div role="listitem" data-slot="scope-list-item" data-scope="openid" data-required>
20
+ * <label data-slot="scope-list-label">
21
+ * <pont2-prim-checkbox checked disabled required></pont2-prim-checkbox>
22
+ * <span data-slot="scope-list-text">Sign you in</span>
23
+ * </label>
24
+ * </div>
25
+ * …
26
+ * </pont2-scope-list>
27
+ * ```
28
+ *
29
+ * **Form-associated** (`extends FormControlElement`): it submits the ticked
30
+ * scopes, space-separated (OAuth `scope` syntax), under `name` (default
31
+ * `scope`), resets, restores and follows `<fieldset disabled>` natively. The
32
+ * legacy element exposed `.value` for its custom form to read.
33
+ *
34
+ * Each row is a **Checkbox primitive element** (it has behaviour) inside a
35
+ * native `<label>`; the checkboxes have no `name`, so only the list submits.
36
+ * Required scopes are always ticked and disabled. Scopes default to ticked;
37
+ * the user unticks what they do not grant.
38
+ *
39
+ * @tag pont2-scope-list
40
+ * @attr scopes - JSON array of `{ scope, label?, required?, granted? }`; `.scopes` is an array
41
+ * @attr name - default "scope"
42
+ * @attr disabled
43
+ * @fires input, change - when a scope is toggled (read `.value`)
44
+ */
45
+ export declare class ScopeList extends FormControlElement {
46
+ static identity: string;
47
+ static slotName: string;
48
+ static role: string;
49
+ static composite: boolean;
50
+ static properties: PropertyDeclarations;
51
+ scopes: ConsentScope[];
52
+ protected unticked: Set<string>;
53
+ constructor();
54
+ /** The normalised scope list. */
55
+ get list(): ConsentScope[];
56
+ /** The submitted value: ticked scopes, space-separated. */
57
+ get value(): string;
58
+ protected get hostFocusable(): boolean;
59
+ protected formValue(): string | null;
60
+ protected resetToDefault(): void;
61
+ protected restoreState(state: string | File | FormData | null): void;
62
+ private toggle;
63
+ render(): unknown;
64
+ }
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ "pont2-scope-list": ScopeList;
68
+ }
69
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Pure value logic of the scope list (ported from the legacy
3
+ * scope-list.value.ts, which has the same tests).
4
+ */
5
+ export interface ConsentScope {
6
+ scope: string;
7
+ label: string;
8
+ granted?: boolean;
9
+ required?: boolean;
10
+ }
11
+ /** Drops malformed and duplicate entries; trims names; label defaults to the scope. */
12
+ export declare function normalizeScopes(scopes: unknown): ConsentScope[];
13
+ /** Required scopes are always ticked; others unless the user unticked them. */
14
+ export declare function isScopeChecked(scope: ConsentScope, unticked: ReadonlySet<string>): boolean;
15
+ /** The submitted value: ticked scope names, space-separated (OAuth `scope` syntax). */
16
+ export declare function scopeListValue(scopes: ConsentScope[], unticked: ReadonlySet<string>): string;
@@ -0,0 +1,67 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { CopyController } from '../../core/controllers/copy';
3
+ import { HostElement } from '../../core/host-element';
4
+ /**
5
+ * # `<pont2-secret>`: the "Can't scan?" manual TOTP secret
6
+ *
7
+ * ```html
8
+ * <pont2-secret secret="JBSWY3DPEHPK3PXP" issuer="Acme" account="ada@example.com"></pont2-secret>
9
+ * ```
10
+ *
11
+ * ```html
12
+ * <pont2-secret data-pont2-secret data-slot="secret">
13
+ * <p data-slot="secret-title">Can't scan?</p>
14
+ * <div data-pont2-input-group …>
15
+ * <input data-pont2-input-group-input readonly value="JBSWY3DPEHPK3PXP" aria-label="Manual secret">
16
+ * <div data-pont2-input-group-addon data-align="inline-end">
17
+ * <button … aria-label="Copy secret"><svg/></button>
18
+ * </div>
19
+ * </div>
20
+ * <span data-slot="secret-copied" role="status">Copied!</span> (after copying)
21
+ * <dl data-slot="secret-metadata"><div><dt>Issuer</dt><dd>Acme</dd></div><div><dt>Account</dt><dd>…</dd></div></dl>
22
+ * </pont2-secret>
23
+ * ```
24
+ *
25
+ * Built from InputGroup parts (shadcn's input + addon button). Differences
26
+ * from the legacy element, each deliberate:
27
+ * - the input is **readonly**, not disabled: it can be focused and selected
28
+ * (copy by hand, screen readers read it); monospace, spaced for reading;
29
+ * - "Copied!" is a `role="status"` live region, so it is announced;
30
+ * - the copy events (`pont2-copied` / `pont2-copy-error`, `{ kind: "secret" }`)
31
+ * **do not carry the secret** (the legacy `pont-secret:copied` did);
32
+ * - issuer/account are a description list (`<dl>`), their semantic form.
33
+ *
34
+ * @tag pont2-secret
35
+ * @attr secret, issuer, account
36
+ * @attr title-text - default "Can't scan?" (`title` would be a native tooltip)
37
+ * @attr secret-label, issuer-label, account-label, copy-label, copied-text - copy
38
+ * @attr disabled - disables the copy button
39
+ * @fires pont2-copied, pont2-copy-error - `{ kind: "secret" }`
40
+ */
41
+ export declare class Secret extends HostElement {
42
+ static identity: string;
43
+ static slotName: string;
44
+ static composite: boolean;
45
+ static properties: PropertyDeclarations;
46
+ secret: string;
47
+ issuer: string;
48
+ account: string;
49
+ titleText: string;
50
+ secretLabel: string;
51
+ issuerLabel: string;
52
+ accountLabel: string;
53
+ copyLabel: string;
54
+ copiedText: string;
55
+ disabled: boolean;
56
+ protected readonly clipboard: CopyController;
57
+ private inputId;
58
+ constructor();
59
+ /** Copies the secret (also what the button does). */
60
+ copy(): Promise<boolean>;
61
+ render(): import('lit-html').TemplateResult<1>;
62
+ }
63
+ declare global {
64
+ interface HTMLElementTagNameMap {
65
+ "pont2-secret": Secret;
66
+ }
67
+ }