@pontive/pontkit-core 1.35.0 → 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,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
  }
@@ -83,18 +83,39 @@ export declare class Layout extends HostElement {
83
83
  client: FlowClient | undefined;
84
84
  renderSpec: string;
85
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;
86
91
  messages: Partial<Record<string, string>>;
87
92
  protected busy: boolean;
88
93
  private provider;
94
+ private designProvider;
89
95
  private pending;
90
96
  constructor();
91
97
  /** The layout's form (holds the screen). */
92
98
  get form(): HTMLFormElement | null;
93
99
  /** Runs one flow request (what a `pont2-action` from inside triggers). */
94
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;
95
112
  private onAction;
96
113
  private onError;
97
- /** 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
+ */
98
119
  showError(message: string, restartable?: boolean): void;
99
120
  private clearBanner;
100
121
  protected willUpdate(changed: PropertyValues): void;
@@ -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;
@@ -6184,6 +6184,34 @@ layer(pont2.tokens);
6184
6184
  [data-pont2-container][data-justify="between"] {
6185
6185
  justify-content: space-between;
6186
6186
  }
6187
+
6188
+ /*
6189
+ * Design mode (the designer's canvas only; core/design-mode.ts). An outline takes no space, so
6190
+ * showing the container doesn't reflow what the author is arranging. The inset does reflow, on
6191
+ * purpose: without it a nested container's outline lands on its parent's and the parent has no
6192
+ * surface left to click or drop onto. Served screens never get these attributes.
6193
+ */
6194
+ [data-pont2-container][data-design] {
6195
+ outline: 1px dotted color-mix(in oklab, var(--pont2-sem-color-foreground) 35%, transparent);
6196
+ outline-offset: -1px;
6197
+ padding: 0.5rem;
6198
+ }
6199
+ [data-pont2-container][data-design-empty] {
6200
+ position: relative;
6201
+ min-height: 3.5rem;
6202
+ }
6203
+ /* Generated content: never part of the authored tree, never a drop target. */
6204
+ [data-pont2-container][data-design-empty]::after {
6205
+ content: "Container";
6206
+ position: absolute;
6207
+ inset: 0;
6208
+ display: flex;
6209
+ align-items: center;
6210
+ justify-content: center;
6211
+ color: var(--pont2-sem-color-muted-foreground);
6212
+ font-size: var(--pont2-sem-text-sm);
6213
+ pointer-events: none;
6214
+ }
6187
6215
  }
6188
6216
 
6189
6217
  /* ../kit/header/header.css */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontive/pontkit-core",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "license": "MIT",
5
5
  "description": "A collection of core components for Pontive",
6
6
  "main": "dist/index.js",