@pontive/pontkit-core 1.26.0 → 1.28.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 (93) hide show
  1. package/catalog.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/pont2/core/attrs.d.ts +22 -0
  4. package/dist/pont2/core/controllers/action.d.ts +79 -0
  5. package/dist/pont2/core/controllers/copy.d.ts +34 -0
  6. package/dist/pont2/core/controllers/roving-focus.d.ts +38 -0
  7. package/dist/pont2/core/events.d.ts +28 -0
  8. package/dist/pont2/core/form-control.d.ts +70 -0
  9. package/dist/pont2/core/host-element.d.ts +129 -0
  10. package/dist/pont2/core/icons.d.ts +28 -0
  11. package/dist/pont2/core/ids.d.ts +6 -0
  12. package/dist/pont2/core/index.d.ts +10 -0
  13. package/dist/pont2/core/names.d.ts +78 -0
  14. package/dist/pont2/core/popup/anchored.d.ts +48 -0
  15. package/dist/pont2/core/popup/index.d.ts +5 -0
  16. package/dist/pont2/core/popup/list.d.ts +38 -0
  17. package/dist/pont2/core/popup/popup-content.d.ts +68 -0
  18. package/dist/pont2/core/popup/popup-root.d.ts +94 -0
  19. package/dist/pont2/core/popup/position.d.ts +73 -0
  20. package/dist/pont2/globals.css +109 -0
  21. package/dist/pont2/index.d.ts +44 -0
  22. package/dist/pont2/index.mjs +5660 -0
  23. package/dist/pont2/index.mjs.map +1 -0
  24. package/dist/pont2/kit/alert/alert.d.ts +62 -0
  25. package/dist/pont2/kit/aliases.d.ts +33 -0
  26. package/dist/pont2/kit/auth-button/auth-button.d.ts +185 -0
  27. package/dist/pont2/kit/auth-button/providers.d.ts +15 -0
  28. package/dist/pont2/kit/auth-field/auth-field.d.ts +267 -0
  29. package/dist/pont2/kit/auth-field/password-field.d.ts +124 -0
  30. package/dist/pont2/kit/avatar/avatar.d.ts +52 -0
  31. package/dist/pont2/kit/block/block.d.ts +64 -0
  32. package/dist/pont2/kit/block/branding.d.ts +36 -0
  33. package/dist/pont2/kit/container/container.d.ts +40 -0
  34. package/dist/pont2/kit/countdown/countdown.d.ts +64 -0
  35. package/dist/pont2/kit/divider/divider.d.ts +30 -0
  36. package/dist/pont2/kit/edit-identifier/edit-identifier.d.ts +47 -0
  37. package/dist/pont2/kit/flow-widget/flow-widget.d.ts +151 -0
  38. package/dist/pont2/kit/gap/gap.d.ts +36 -0
  39. package/dist/pont2/kit/header/header.d.ts +37 -0
  40. package/dist/pont2/kit/index.d.ts +26 -0
  41. package/dist/pont2/kit/input-otp/input-otp.d.ts +59 -0
  42. package/dist/pont2/kit/layout/flow-error.d.ts +21 -0
  43. package/dist/pont2/kit/layout/layout.d.ts +120 -0
  44. package/dist/pont2/kit/link/link.d.ts +62 -0
  45. package/dist/pont2/kit/logo/logo.d.ts +57 -0
  46. package/dist/pont2/kit/otp-field/otp-field.d.ts +93 -0
  47. package/dist/pont2/kit/otp-field/otp-resend.d.ts +61 -0
  48. package/dist/pont2/kit/provider-field/provider-field.d.ts +87 -0
  49. package/dist/pont2/kit/qr-code/qr-code.d.ts +86 -0
  50. package/dist/pont2/kit/recovery-codes/recovery-codes.d.ts +64 -0
  51. package/dist/pont2/kit/scope-list/scope-list.d.ts +69 -0
  52. package/dist/pont2/kit/scope-list/scope-value.d.ts +16 -0
  53. package/dist/pont2/kit/secret/secret.d.ts +67 -0
  54. package/dist/pont2/kit/story-helpers.d.ts +9 -0
  55. package/dist/pont2/kit/typography/typography.d.ts +70 -0
  56. package/dist/pont2/kit/watermark/pontive-logo.d.ts +8 -0
  57. package/dist/pont2/kit/watermark/watermark.d.ts +42 -0
  58. package/dist/pont2/primitives/alert/alert.d.ts +49 -0
  59. package/dist/pont2/primitives/avatar/avatar.d.ts +89 -0
  60. package/dist/pont2/primitives/badge/badge.d.ts +30 -0
  61. package/dist/pont2/primitives/button/button.d.ts +113 -0
  62. package/dist/pont2/primitives/button-group/button-group.d.ts +55 -0
  63. package/dist/pont2/primitives/card/card.d.ts +63 -0
  64. package/dist/pont2/primitives/checkbox/checkbox.d.ts +54 -0
  65. package/dist/pont2/primitives/combobox/combobox.d.ts +213 -0
  66. package/dist/pont2/primitives/dropdown-menu/dropdown-menu.d.ts +267 -0
  67. package/dist/pont2/primitives/empty/empty.d.ts +60 -0
  68. package/dist/pont2/primitives/field/field.d.ts +146 -0
  69. package/dist/pont2/primitives/input/input.d.ts +47 -0
  70. package/dist/pont2/primitives/input-group/input-group.d.ts +97 -0
  71. package/dist/pont2/primitives/input-otp/input-otp.d.ts +121 -0
  72. package/dist/pont2/primitives/input-otp/otp.d.ts +22 -0
  73. package/dist/pont2/primitives/item/item.d.ts +100 -0
  74. package/dist/pont2/primitives/kbd/kbd.d.ts +29 -0
  75. package/dist/pont2/primitives/label/label.d.ts +37 -0
  76. package/dist/pont2/primitives/native-select/native-select.d.ts +59 -0
  77. package/dist/pont2/primitives/popover/popover.d.ts +85 -0
  78. package/dist/pont2/primitives/progress/progress.d.ts +80 -0
  79. package/dist/pont2/primitives/radio-group/radio-group.d.ts +93 -0
  80. package/dist/pont2/primitives/select/select.d.ts +184 -0
  81. package/dist/pont2/primitives/separator/separator.d.ts +34 -0
  82. package/dist/pont2/primitives/skeleton/skeleton.d.ts +18 -0
  83. package/dist/pont2/primitives/slider/slider-math.d.ts +42 -0
  84. package/dist/pont2/primitives/slider/slider.d.ts +85 -0
  85. package/dist/pont2/primitives/spinner/spinner.d.ts +29 -0
  86. package/dist/pont2/primitives/switch/switch.d.ts +55 -0
  87. package/dist/pont2/primitives/table/table.d.ts +55 -0
  88. package/dist/pont2/primitives/tabs/tabs.d.ts +126 -0
  89. package/dist/pont2/primitives/textarea/textarea.d.ts +41 -0
  90. package/dist/pont2/primitives/tooltip/tooltip.d.ts +69 -0
  91. package/dist/pont2/styles.css +4839 -0
  92. package/dist/pont2/with-legacy.css +10 -0
  93. package/package.json +16 -4
@@ -0,0 +1,124 @@
1
+ import { nothing, PropertyDeclarations, TemplateResult } from 'lit';
2
+ import { ActionController } from '../../core/controllers/action';
3
+ import { InputOptions } from '../../primitives/input/input';
4
+ import { AuthField, FieldIssue } from './auth-field';
5
+ export type PasswordRuleName = "uppercase" | "lowercase" | "number" | "special";
6
+ /** A rule: a named one, or your own `pattern`, each with an optional message. */
7
+ export type PasswordRule = {
8
+ name: PasswordRuleName;
9
+ error?: string;
10
+ } | {
11
+ pattern: string;
12
+ error?: string;
13
+ };
14
+ /** The legacy named patterns (field.defs.ts). */
15
+ export declare const PASSWORD_RULE_PATTERNS: Record<PasswordRuleName, RegExp>;
16
+ export declare const DEFAULT_PASSWORD_RULES: PasswordRule[];
17
+ export type SecretFieldVariant = "toggle" | "simple";
18
+ /**
19
+ * A field whose value is secret: `type="password"`, and with
20
+ * `variant="toggle"` (default) a show/hide button, built as shadcn builds it,
21
+ * from InputGroup parts:
22
+ *
23
+ * ```html
24
+ * <div data-pont2-input-group data-slot="input-group" role="group">
25
+ * <input data-pont2-input data-pont2-input-group-input data-slot="input-group-control" type="password" …>
26
+ * <div data-pont2-input-group-addon data-slot="input-group-addon" data-align="inline-end" role="group">
27
+ * <button data-pont2-button data-pont2-input-group-button data-variant="ghost" data-size="icon-xs"
28
+ * aria-label="Show password" aria-pressed="false" aria-controls="…-input"><svg/></button>
29
+ * </div>
30
+ * </div>
31
+ * ```
32
+ *
33
+ * The toggle is a *toggle button* (`aria-pressed`, a stable name), the
34
+ * WAI-ARIA pattern, rather than a button whose name flips. The value is
35
+ * never normalised.
36
+ *
37
+ * @attr variant - toggle (default) | simple
38
+ * @attr show-label - the toggle's accessible name (default "Show password")
39
+ */
40
+ export declare abstract class SecretField extends AuthField {
41
+ static properties: PropertyDeclarations;
42
+ variant: SecretFieldVariant;
43
+ showLabel: string;
44
+ /** Whether the value is currently shown as text. */
45
+ revealed: boolean;
46
+ constructor();
47
+ protected inputType(): "text" | "password";
48
+ protected inputAttrs(): {
49
+ autocapitalize: string;
50
+ spellcheck: string;
51
+ };
52
+ private toggle;
53
+ protected renderControl(o: InputOptions): TemplateResult;
54
+ }
55
+ /**
56
+ * # `<pont2-password-field>`
57
+ *
58
+ * `autocomplete="current-password"` by default (set `new-password` on
59
+ * sign-up screens), name `password`. Rules: `minlength`, `maxlength`, then
60
+ * **every** `rules` entry; all failing rules are listed (shadcn's FieldError
61
+ * list). Defaults are the legacy four: uppercase, lowercase, number, special.
62
+ *
63
+ * `forgot` adds a "Forgot your password?" link-styled button beside the label
64
+ * (shadcn's login block layout). It requests `forgot-event` through the
65
+ * action protocol (`pont2-action` with `data: { forgot: true }`), exactly
66
+ * like the auth buttons, and is busy until the response settles.
67
+ *
68
+ * @tag pont2-password-field
69
+ * @attr rules - JSON array of `{ name }` / `{ pattern }` rules with optional `error`; `rules="[]"` disables them
70
+ * @attr forgot - show the forgot-password link
71
+ * @attr forgot-label - its text (default "Forgot your password?")
72
+ * @attr forgot-event - the action it requests
73
+ * @fires pont2-action, pont2-action-success, pont2-action-error - from the forgot link
74
+ */
75
+ export declare class PasswordField extends SecretField {
76
+ static properties: PropertyDeclarations;
77
+ rules: PasswordRule[];
78
+ forgot: boolean;
79
+ forgotLabel: string;
80
+ forgotEvent: string | undefined;
81
+ protected readonly forgotAction: ActionController;
82
+ constructor();
83
+ protected defaultName(): string;
84
+ protected defaultLabel(): string;
85
+ protected defaultAutocomplete(): string;
86
+ protected valueIssues(value: string): FieldIssue[];
87
+ protected renderLabel(): TemplateResult | typeof nothing;
88
+ }
89
+ /**
90
+ * # `<pont2-confirm-field>`: repeat a password
91
+ *
92
+ * Valid when its value equals the `pair` field's (default: the first
93
+ * `pont2-password-field` in the same form, else in the document). It
94
+ * re-validates as either changes. `autocomplete="new-password"`, name
95
+ * `confirm`. Unlike the legacy kit, the pair's value is never put in an event.
96
+ *
97
+ * @tag pont2-confirm-field
98
+ * @attr pair - CSS selector of the field to match (default "pont2-password-field")
99
+ * @attr match-error - default "Passwords do not match."
100
+ */
101
+ export declare class ConfirmField extends SecretField {
102
+ static properties: PropertyDeclarations;
103
+ pair: string;
104
+ matchError: string;
105
+ private scope;
106
+ constructor();
107
+ protected defaultName(): string;
108
+ protected defaultLabel(): string;
109
+ protected defaultAutocomplete(): string;
110
+ /** The element being matched (a pont2 field or any element with `.value`). */
111
+ get pairElement(): (Element & {
112
+ value?: string;
113
+ }) | null;
114
+ protected valueIssues(value: string): FieldIssue[];
115
+ private onScopeInput;
116
+ connectedCallback(): void;
117
+ disconnectedCallback(): void;
118
+ }
119
+ declare global {
120
+ interface HTMLElementTagNameMap {
121
+ "pont2-password-field": PasswordField;
122
+ "pont2-confirm-field": ConfirmField;
123
+ }
124
+ }
@@ -0,0 +1,52 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { Avatar } from '../../primitives/avatar/avatar';
3
+ /** "Ada Lovelace" → "AL", "ada" → "A". At most two letters, upper-cased. */
4
+ export declare function initials(name: string): string;
5
+ /**
6
+ * # `<pont2-avatar>`: kit composite over `<pont2-prim-avatar>`
7
+ *
8
+ * ```html
9
+ * <pont2-avatar src="/u/42.png" alt="Ada Lovelace" badge></pont2-avatar>
10
+ * ```
11
+ *
12
+ * renders the primitive's DOM:
13
+ *
14
+ * ```html
15
+ * <pont2-avatar data-pont2-avatar data-slot="avatar" data-size="default" data-image-loading-status="loaded">
16
+ * <img src="/u/42.png" alt="Ada Lovelace" data-pont2-avatar-image data-slot="avatar-image">
17
+ * <span data-pont2-avatar-fallback data-slot="avatar-fallback">AL</span>
18
+ * <span data-pont2-avatar-badge data-slot="avatar-badge"></span>
19
+ * </pont2-avatar>
20
+ * ```
21
+ *
22
+ * - **It is a primitive Avatar** (`extends Avatar`): the primitive watches the
23
+ * rendered `<img>` and swaps image and fallback on
24
+ * `data-image-loading-status` as usual.
25
+ * - **Fallback text:** `fallback`, else the initials of `alt`. When `alt` is
26
+ * set the fallback is announced as an image named by `alt` (not as "AL"):
27
+ * only one of image and fallback is ever displayed, so nothing is read twice.
28
+ * - **Badge:** `badge` shows shadcn's status dot. For an icon inside the
29
+ * badge, use the primitive form.
30
+ *
31
+ * @tag pont2-avatar
32
+ * @attr src - image URL (no image is rendered without it)
33
+ * @attr alt - image alternative text; also the source of the default initials
34
+ * @attr fallback - fallback text (defaults to the initials of `alt`)
35
+ * @attr size - default | sm | lg (primitive)
36
+ * @attr badge - show the badge dot
37
+ */
38
+ export declare class KitAvatar extends Avatar {
39
+ static composite: boolean;
40
+ static properties: PropertyDeclarations;
41
+ src: string;
42
+ alt: string;
43
+ fallback: string;
44
+ badge: boolean;
45
+ constructor();
46
+ protected render(): import('lit-html').TemplateResult<1>;
47
+ }
48
+ declare global {
49
+ interface HTMLElementTagNameMap {
50
+ "pont2-avatar": KitAvatar;
51
+ }
52
+ }
@@ -0,0 +1,64 @@
1
+ import { nothing, PropertyDeclarations } from 'lit';
2
+ import { Card } from '../../primitives/card/card';
3
+ export { BrandingController, brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from './branding';
4
+ export type BlockAlign = "stretch" | "start" | "center" | "end";
5
+ export type BlockJustify = "start" | "center" | "end";
6
+ /**
7
+ * # `<pont2-block>`: the screen shell
8
+ *
9
+ * ```html
10
+ * <pont2-block>
11
+ * <pont2-header>…</pont2-header>
12
+ * <form>…</form>
13
+ * </pont2-block>
14
+ * ```
15
+ *
16
+ * **Is a Card** (`extends Card`): the host is the card, the screen's content
17
+ * is its children, **left where they are**, and the block adds one thing of
18
+ * its own, the watermark footer:
19
+ *
20
+ * ```html
21
+ * <pont2-block data-pont2-card data-slot="card" data-align="stretch" data-justify="start">
22
+ * …the screen (author / render-spec content)…
23
+ * <div data-pont2-card-footer data-slot="card-footer" data-border="top">
24
+ * <span data-pont2-watermark data-slot="watermark" data-variant="muted">Powered by <svg/></span>
25
+ * </div>
26
+ * </pont2-block>
27
+ * ```
28
+ *
29
+ * The legacy `pont-block` rendered `pont-card > [card] > pont-card-content >
30
+ * [card-content]` and then **moved** the spec's children into it
31
+ * (`moveLightDomChildrenInto`), the relocation pattern host-as-root exists to
32
+ * remove. pont2 moves nothing: the card's inline padding (CardContent's
33
+ * `px-(--card-spacing)`) is on the host, and the footer bleeds to the edges.
34
+ *
35
+ * **Watermark entitlement** (docs/branding-entitlements.md): the footer is
36
+ * rendered unless the branding context says `showWatermark: false`. There is
37
+ * no attribute or property for it, and it fails closed. It is part of the
38
+ * shell, not the content, so a screen author cannot delete it.
39
+ *
40
+ * Not a props-driven composite (`composite = false`): a block *contains* the
41
+ * screen. Lit renders the footer after the author's children.
42
+ *
43
+ * @tag pont2-block
44
+ * @attr align - stretch (default) | start | center | end: the content's cross-axis alignment
45
+ * @attr justify - start (default) | center | end: when the block is taller than its content
46
+ * @attr size - default | sm (the Card primitive's spacing)
47
+ * @cssprop --pont2-block-width - max width on wider screens (default 24rem)
48
+ * @cssprop --pont2-block-gap - gap between children (default 1rem)
49
+ */
50
+ export declare class Block extends Card {
51
+ static composite: boolean;
52
+ static properties: PropertyDeclarations;
53
+ align: BlockAlign;
54
+ justify: BlockJustify;
55
+ private branding;
56
+ constructor();
57
+ protected willUpdate(): void;
58
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
59
+ }
60
+ declare global {
61
+ interface HTMLElementTagNameMap {
62
+ "pont2-block": Block;
63
+ }
64
+ }
@@ -0,0 +1,36 @@
1
+ import { ReactiveElement } from 'lit';
2
+ /**
3
+ * Account-level branding entitlements, the pont2 side of
4
+ * docs/branding-entitlements.md (same rule, same shape):
5
+ *
6
+ * > A branding entitlement is a fact about the account, resolved by the
7
+ * > backend, delivered as context. An element that renders branding *asks*
8
+ * > for it. It is never *told* by its own markup.
9
+ *
10
+ * So there is no attribute, property or other escape hatch on any pont2
11
+ * element; the flow host (the future pont2 widgets/layout) provides
12
+ * `brandingContext` from the backend response, and Storybook provides it with
13
+ * a `ContextProvider`.
14
+ *
15
+ * The context is the Context Community Protocol (`context-request` events)
16
+ * through `@lit/context`. Its key is `pont2:branding`, separate from the
17
+ * legacy `pont:branding` (docs/08-parallel-constraints.md §4).
18
+ */
19
+ export interface BrandingEntitlements {
20
+ /** Whether the Pontive watermark must be rendered on the screen shell. */
21
+ showWatermark: boolean;
22
+ }
23
+ /** Fail closed: no provider, or an old backend, means the watermark shows. */
24
+ export declare const DEFAULT_BRANDING: BrandingEntitlements;
25
+ export declare const brandingContext: {
26
+ __context__: BrandingEntitlements;
27
+ };
28
+ /**
29
+ * Reads the entitlements for one element (subscribing, so a late or changed
30
+ * provider value re-renders it). Deliberately no attribute override.
31
+ */
32
+ export declare class BrandingController {
33
+ private consumer;
34
+ constructor(host: ReactiveElement);
35
+ get showWatermark(): boolean;
36
+ }
@@ -0,0 +1,40 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ /** The legacy render-spec values. */
4
+ export type ContainerType = "flex_column" | "flex_row";
5
+ export type ContainerAlign = "stretch" | "start" | "center" | "end";
6
+ export type ContainerJustify = "start" | "center" | "end" | "between";
7
+ /**
8
+ * # `<pont2-container>`: a flex group of screen elements
9
+ *
10
+ * ```html
11
+ * <pont2-container type="flex_row" justify="between">…</pont2-container>
12
+ * → <pont2-container data-pont2-container data-slot="container" data-type="flex_row" data-justify="between">…</pont2-container>
13
+ * ```
14
+ *
15
+ * Tier 1 host-as-root: the host is the flex box and the children stay where
16
+ * they are (the legacy element rendered an inner `div` and moved the children
17
+ * into it). Not a composite: it contains content.
18
+ *
19
+ * @tag pont2-container
20
+ * @attr type - flex_column (default) | flex_row
21
+ * @attr align - stretch (default) | start | center | end (cross axis)
22
+ * @attr justify - start (default) | center | end | between (main axis)
23
+ * @cssprop --pont2-container-gap - default 1rem
24
+ */
25
+ export declare class Container extends HostElement {
26
+ static identity: string;
27
+ static slotName: string;
28
+ static composite: boolean;
29
+ static properties: PropertyDeclarations;
30
+ type: ContainerType;
31
+ align: ContainerAlign;
32
+ justify: ContainerJustify;
33
+ constructor();
34
+ protected willUpdate(): void;
35
+ }
36
+ declare global {
37
+ interface HTMLElementTagNameMap {
38
+ "pont2-container": Container;
39
+ }
40
+ }
@@ -0,0 +1,64 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ export interface CountdownEndDetail {
4
+ /** Where the countdown will navigate (already resolved), or null. */
5
+ url: string | null;
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;
9
+ /**
10
+ * # `<pont2-countdown>`: "Redirecting in 5s…"
11
+ *
12
+ * ```html
13
+ * <pont2-countdown content="Redirecting you in" duration="5" redirect-url="/dashboard"></pont2-countdown>
14
+ * → <pont2-countdown data-pont2-countdown data-slot="countdown" role="timer">Redirecting you in 5s…</pont2-countdown>
15
+ * ```
16
+ *
17
+ * Host-as-root (the legacy element rendered a `div` inside its tag). Counts
18
+ * down once a second; at zero it fires a **cancelable** `pont2-countdown-end`
19
+ * and, unless a listener prevents it, navigates to `redirect-url`.
20
+ *
21
+ * **Only http(s) URLs are followed.** Render specs are author-editable HTML,
22
+ * so a `javascript:` or `data:` redirect would be script injection; those are
23
+ * refused (the event still fires, with `url: null`). The legacy element
24
+ * assigned `location.href` unconditionally and defaulted to `/`; pont2 has no
25
+ * default: without `redirect-url` it only fires the event.
26
+ *
27
+ * `role="timer"`: assistive technology is not interrupted every second.
28
+ *
29
+ * @tag pont2-countdown
30
+ * @attr duration - seconds (default 5)
31
+ * @attr content - text before the seconds
32
+ * @attr redirect-url - where to go at zero (http/https, relative URLs resolve against the page)
33
+ * @fires pont2-countdown-end - `{ url }`, cancelable: `preventDefault()` stops the redirect
34
+ */
35
+ export declare class Countdown extends HostElement {
36
+ static identity: string;
37
+ static slotName: string;
38
+ static role: string;
39
+ static composite: boolean;
40
+ static properties: PropertyDeclarations;
41
+ duration: number;
42
+ content: string;
43
+ redirectUrl: string;
44
+ /** Seconds left. */
45
+ remaining: number;
46
+ private timer;
47
+ constructor();
48
+ /** (Re)starts from `duration`. */
49
+ restart(): void;
50
+ private stop;
51
+ private end;
52
+ connectedCallback(): void;
53
+ disconnectedCallback(): void;
54
+ protected willUpdate(changed: PropertyValues): void;
55
+ render(): import('lit-html').TemplateResult<1>;
56
+ }
57
+ declare global {
58
+ interface HTMLElementTagNameMap {
59
+ "pont2-countdown": Countdown;
60
+ }
61
+ interface HTMLElementEventMap {
62
+ "pont2-countdown-end": CustomEvent<CountdownEndDetail>;
63
+ }
64
+ }
@@ -0,0 +1,30 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { FieldSeparator } from '../../primitives/field/field';
3
+ /**
4
+ * # `<pont2-divider>`: "Or continue with"
5
+ *
6
+ * ```html
7
+ * <pont2-divider label="Or continue with"></pont2-divider>
8
+ * ```
9
+ *
10
+ * **Is a FieldSeparator** (`extends FieldSeparator`), as shadcn's login
11
+ * blocks write it (`<FieldSeparator>Or continue with</FieldSeparator>`): one
12
+ * node, the rule halves drawn by the primitive's `::before`/`::after`, the
13
+ * label a text node. Without a label it is a plain rule
14
+ * (`data-content="false"`).
15
+ *
16
+ * @tag pont2-divider
17
+ * @attr label - text in the middle
18
+ */
19
+ export declare class Divider extends FieldSeparator {
20
+ static composite: boolean;
21
+ static properties: PropertyDeclarations;
22
+ label: string;
23
+ constructor();
24
+ render(): string;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ "pont2-divider": Divider;
29
+ }
30
+ }
@@ -0,0 +1,47 @@
1
+ import { PropertyDeclarations } from 'lit';
2
+ import { ActionController } from '../../core/controllers/action';
3
+ import { HostElement } from '../../core/host-element';
4
+ /**
5
+ * # `<pont2-edit-identifier>`: "ada@example.com ✎"
6
+ *
7
+ * The identifier the user entered on the previous step, with a button to go
8
+ * back and change it.
9
+ *
10
+ * ```html
11
+ * <pont2-edit-identifier identifier="ada@example.com" event="change_identifier"></pont2-edit-identifier>
12
+ * → <pont2-edit-identifier data-pont2-edit-identifier data-slot="edit-identifier">
13
+ * <span data-slot="edit-identifier-value">ada@example.com</span>
14
+ * <button data-pont2-button data-variant="ghost" data-size="icon-xs" aria-label="Change ada@example.com" type="button"><svg/></button>
15
+ * </pont2-edit-identifier>
16
+ * ```
17
+ *
18
+ * The button is the button primitive's part and requests `event` through the
19
+ * action protocol (`data: { identifier }`), busy until it settles. The
20
+ * legacy element made the *whole* element a click target and its icon button
21
+ * had no accessible name; here only the button acts, and it is named
22
+ * ("Change ada@example.com", `label` + the identifier).
23
+ *
24
+ * @tag pont2-edit-identifier
25
+ * @attr identifier - the value shown
26
+ * @attr event - the action requested on press
27
+ * @attr label - the button's accessible name prefix (default "Change")
28
+ * @fires pont2-action, pont2-action-success, pont2-action-error
29
+ */
30
+ export declare class EditIdentifier extends HostElement {
31
+ static identity: string;
32
+ static slotName: string;
33
+ static composite: boolean;
34
+ static properties: PropertyDeclarations;
35
+ identifier: string;
36
+ event: string | undefined;
37
+ label: string;
38
+ protected readonly action: ActionController;
39
+ constructor();
40
+ get control(): HTMLButtonElement | null;
41
+ render(): import('lit-html').TemplateResult<1>;
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ "pont2-edit-identifier": EditIdentifier;
46
+ }
47
+ }
@@ -0,0 +1,151 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ import { BrandingEntitlements } from '../block/branding';
4
+ import { FlowClient, Layout } from '../layout/layout';
5
+ /**
6
+ * What a widget needs from an auth client: the layout's `processLoginflowEvent`
7
+ * plus `startLoginflow`, and optionally `whenConfigured`. The SDK's `Auth`
8
+ * satisfies it structurally (docs/kit/layout.md, option (b)).
9
+ */
10
+ export interface WidgetClient extends FlowClient {
11
+ startLoginflow(flowId?: string): Promise<FlowStart>;
12
+ whenConfigured?(): Promise<void>;
13
+ }
14
+ /** The parts of the SDK's `StartLoginflowResponse` a widget reads. */
15
+ export interface FlowStart {
16
+ render_spec?: unknown;
17
+ messages?: Record<string, string>;
18
+ [key: string]: unknown;
19
+ }
20
+ /** The parts of the SDK's `FlowStateChangeEvent` a widget reads. */
21
+ export interface FlowStateEvent {
22
+ eventType: string;
23
+ flowType?: string;
24
+ render_spec?: unknown;
25
+ messages?: Record<string, string>;
26
+ [key: string]: unknown;
27
+ }
28
+ /**
29
+ * Feeds the SDK's asynchronous flow-state changes (a resumed flow, a flow an
30
+ * emailed link continued, "continued in another tab") to every connected
31
+ * pont2 flow widget of that `flowType`.
32
+ *
33
+ * The SDK reports them only through the one `onFlowStateChange` callback of
34
+ * `Auth.configure()` (which replaces the whole configuration), so the widget
35
+ * cannot subscribe by itself; the app that configures `Auth` passes this:
36
+ *
37
+ * ```ts
38
+ * Auth.configure({ …config, onFlowStateChange: dispatchFlowState });
39
+ * ```
40
+ */
41
+ export declare function dispatchFlowState(event: FlowStateEvent): void;
42
+ /** Text placed in a double-quoted attribute of markup built as a string. */
43
+ export declare function escapeAttr(value: string): string;
44
+ /**
45
+ * # FlowWidget: the base of `<pont2-signin>` / `<pont2-signup>`
46
+ *
47
+ * ```ts
48
+ * import { Auth } from "@pontive/oidc-client";
49
+ * import { dispatchFlowState } from "@pontive/pontkit-core/pont2";
50
+ *
51
+ * Auth.configure({ …, onFlowStateChange: dispatchFlowState });
52
+ * document.querySelector("pont2-signin")!.client = Auth;
53
+ * ```
54
+ *
55
+ * ```html
56
+ * <pont2-signin data-pont2-flow-widget data-slot="flow-widget" data-state="screen">
57
+ * <pont2-layout>…the current screen…</pont2-layout>
58
+ * </pont2-signin>
59
+ * ```
60
+ *
61
+ * It **starts the flow** (`client.startLoginflow(flowId)`, after
62
+ * `client.whenConfigured()` when the client has one), renders **one
63
+ * `pont2-layout`** with the screen, the client, the branding entitlements and
64
+ * the flow's localised messages, and keeps it current:
65
+ *
66
+ * - each request's next screen is rendered by the layout itself;
67
+ * - asynchronous changes arrive through `dispatchFlowState` (see above): a new
68
+ * `render_spec`, new `messages`, or `flow_continued_elsewhere`, which shows
69
+ * "You continued in another tab" with a "Continue here instead" link
70
+ * (`continue_here`, handled by the SDK);
71
+ * - "Start again" in the layout (`pont2-layout-restart`), or `restart()`,
72
+ * starts the flow over;
73
+ * - a flow that fails to start shows the error in the layout, restartable.
74
+ *
75
+ * Until the first screen arrives it shows a spinner (`data-state="loading"`).
76
+ *
77
+ * Nesting `pont2-layout` in a kit template is the allow-listed case (docs/10
78
+ * §5 rule 6): the layout is the stateful flow host, one per widget.
79
+ *
80
+ * @prop client - `WidgetClient` (e.g. the SDK's `Auth`); the flow starts once it is set and the widget is connected
81
+ * @prop branding - `BrandingEntitlements` from the backend (attribute-less; fails closed)
82
+ * @attr flow-id - the flow to start (each widget has a default)
83
+ * @fires pont2-flow-response - (from the layout) after every successful request
84
+ */
85
+ export declare abstract class FlowWidget extends HostElement {
86
+ static identity: string;
87
+ static slotName: string;
88
+ static composite: boolean;
89
+ static properties: PropertyDeclarations;
90
+ client: WidgetClient | undefined;
91
+ branding: BrandingEntitlements;
92
+ flowId: string;
93
+ protected renderSpec: string;
94
+ protected messages: Partial<Record<string, string>>;
95
+ protected starting: boolean;
96
+ protected startError: {
97
+ message: string;
98
+ } | null;
99
+ /** The SDK's `flowType` this widget runs ("signin", "signup"): which flow-state events apply. */
100
+ protected abstract readonly flowType: string;
101
+ private started;
102
+ constructor();
103
+ /** The widget's layout. */
104
+ get layout(): Layout | null;
105
+ /** Starts the flow over. */
106
+ restart(): Promise<void>;
107
+ /** Applies an SDK flow-state change (what `dispatchFlowState` delivers). */
108
+ applyFlowState(event: FlowStateEvent): void;
109
+ private msg;
110
+ private continuedElsewhereSpec;
111
+ private onFlowState;
112
+ connectedCallback(): void;
113
+ disconnectedCallback(): void;
114
+ protected willUpdate(changed: PropertyValues): void;
115
+ protected updated(changed: PropertyValues): void;
116
+ 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>;
120
+ }
121
+ /**
122
+ * # `<pont2-signin>`: the sign-in widget
123
+ *
124
+ * Runs `sys_signin-flow-passkey` (the legacy default) unless `flow-id` says otherwise.
125
+ *
126
+ * @tag pont2-signin
127
+ */
128
+ export declare class SignIn extends FlowWidget {
129
+ protected readonly flowType = "signin";
130
+ protected defaultFlowId(): string;
131
+ }
132
+ /**
133
+ * # `<pont2-signup>`: the sign-up widget
134
+ *
135
+ * Runs `sys_signup-flow` (the legacy default) unless `flow-id` says otherwise.
136
+ *
137
+ * @tag pont2-signup
138
+ */
139
+ export declare class SignUp extends FlowWidget {
140
+ protected readonly flowType = "signup";
141
+ protected defaultFlowId(): string;
142
+ }
143
+ declare global {
144
+ interface HTMLElementTagNameMap {
145
+ "pont2-signin": SignIn;
146
+ "pont2-signup": SignUp;
147
+ }
148
+ interface DocumentEventMap {
149
+ "pont2-flow-state": CustomEvent<FlowStateEvent>;
150
+ }
151
+ }
@@ -0,0 +1,36 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { HostElement } from '../../core/host-element';
3
+ export type GapType = "vertical" | "horizontal";
4
+ /**
5
+ * # `<pont2-gap>`: a fixed spacer
6
+ *
7
+ * ```html
8
+ * <pont2-gap size="24px"></pont2-gap>
9
+ * → <pont2-gap data-pont2-gap data-type="vertical" style="--pont2-gap-size: 24px"></pont2-gap>
10
+ * ```
11
+ *
12
+ * The host *is* the spacer (the legacy element rendered a sized `div` inside
13
+ * itself). The size is any CSS length, passed through the `--pont2-gap-size`
14
+ * custom property on the host, so no inline width/height overrides author CSS.
15
+ * Decorative: `aria-hidden`.
16
+ *
17
+ * @tag pont2-gap
18
+ * @attr size - CSS length (default 8px)
19
+ * @attr type - vertical (default: takes height) | horizontal (takes width)
20
+ */
21
+ export declare class Gap extends HostElement {
22
+ static identity: string;
23
+ static slotName: string;
24
+ static composite: boolean;
25
+ static properties: PropertyDeclarations;
26
+ size: string;
27
+ type: GapType;
28
+ constructor();
29
+ connectedCallback(): void;
30
+ protected willUpdate(changed: PropertyValues): void;
31
+ }
32
+ declare global {
33
+ interface HTMLElementTagNameMap {
34
+ "pont2-gap": Gap;
35
+ }
36
+ }