@prolibu-suite/cobalt-form 0.1.1 → 0.2.1

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 (34) hide show
  1. package/dist/cjs/co-form-wizard.cjs.entry.js +307 -0
  2. package/dist/cjs/co-form.cjs.entry.js +2 -1
  3. package/dist/cjs/cobalt-form.cjs.js +2 -2
  4. package/dist/cjs/index-CLL7Ervz.js +8155 -0
  5. package/dist/cjs/{index-8raPCV5a.js → index-Mpsm3UE7.js} +8 -0
  6. package/dist/cjs/index.cjs.js +151 -8869
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cobalt-form/cobalt-form.esm.js +1 -1
  9. package/dist/cobalt-form/index.esm.js +1 -7
  10. package/dist/cobalt-form/p-2168be6b.entry.js +1 -0
  11. package/dist/cobalt-form/p-7b8f67bc.entry.js +1 -0
  12. package/dist/cobalt-form/p-C1670_IO.js +2 -0
  13. package/dist/cobalt-form/p-CPE0t-C2.js +7 -0
  14. package/dist/collection/collection-manifest.json +2 -1
  15. package/dist/collection/components/co-form/co-form.css +167 -1
  16. package/dist/collection/components/co-form/co-form.js +278 -9
  17. package/dist/collection/components/co-form-wizard/co-form-wizard.css +363 -0
  18. package/dist/collection/components/co-form-wizard/co-form-wizard.js +502 -0
  19. package/dist/components/co-form-wizard.d.ts +11 -0
  20. package/dist/components/co-form-wizard.js +1 -0
  21. package/dist/components/index.js +5 -5
  22. package/dist/esm/co-form-wizard.entry.js +305 -0
  23. package/dist/esm/co-form.entry.js +2 -1
  24. package/dist/esm/cobalt-form.js +3 -3
  25. package/dist/esm/{index-X0Keifac.js → index-C1670_IO.js} +8 -1
  26. package/dist/esm/index-CPE0t-C2.js +8144 -0
  27. package/dist/esm/index.js +147 -8865
  28. package/dist/esm/loader.js +3 -3
  29. package/dist/types/components/co-form/co-form.d.ts +53 -1
  30. package/dist/types/components/co-form-wizard/co-form-wizard.d.ts +118 -0
  31. package/dist/types/components.d.ts +184 -2
  32. package/package.json +7 -4
  33. package/dist/cobalt-form/p-X0Keifac.js +0 -2
  34. package/dist/cobalt-form/p-ef70e055.entry.js +0 -1
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-X0Keifac.js';
2
- export { s as setNonce } from './index-X0Keifac.js';
1
+ import { b as bootstrapLazy } from './index-C1670_IO.js';
2
+ export { s as setNonce } from './index-C1670_IO.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["co-form",[[260,"co-form",{"schema":[1],"initialValues":[1,"initial-values"],"schemaInstance":[16],"refResolver":[16],"locale":[1],"layout":[1],"excludeFields":[1,"exclude-fields"],"disabled":[4],"readOnly":[4,"read-only"],"snapshot":[32],"refStates":[32],"setValue":[64],"getValue":[64],"touch":[64]},null,{"schema":[{"onSchemaChange":0}],"schemaInstance":[{"onSchemaChange":0}],"locale":[{"onSchemaChange":0}]}]]]], options);
8
+ return bootstrapLazy([["co-form",[[260,"co-form",{"schema":[1],"initialValues":[1,"initial-values"],"schemaInstance":[16],"refResolver":[16],"locale":[1],"layout":[1],"excludeFields":[1,"exclude-fields"],"disabled":[4],"readOnly":[4,"read-only"],"columns":[2],"gap":[1],"footerAlign":[1,"footer-align"],"hideFooter":[4,"hide-footer"],"theme":[1],"snapshot":[32],"refStates":[32],"themeStyles":[32],"hasBg":[32],"setValue":[64],"getValue":[64],"touch":[64],"validateAndCollect":[64]},null,{"schema":[{"onSchemaChange":0}],"schemaInstance":[{"onSchemaChange":0}],"locale":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]],["co-form-wizard",[[260,"co-form-wizard",{"schema":[1],"initialValues":[1,"initial-values"],"locale":[1],"layout":[1],"columns":[2],"theme":[1],"currentIndex":[32],"values":[32],"finalScore":[32],"themeStyles":[32],"hasBg":[32]},null,{"schema":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { type FormSchemaLike, type Locale, type RefResolver } from '@prolibu-suite/cobalt-form-core';
2
+ import { type FormSchemaLike, type Locale, type RefResolver, type ThemeSpec } from '@prolibu-suite/cobalt-form-core';
3
3
  /**
4
4
  * Schema-driven form. Renders Cobalt input components from an inline
5
5
  * Prolibu/Mongoose-style JSON schema and emits the validated payload on submit.
@@ -37,6 +37,21 @@ export declare class CoForm {
37
37
  disabled: boolean;
38
38
  /** Read-only mode for all fields. */
39
39
  readOnly: boolean;
40
+ /** Grid columns (1-4). Fields with `full: true` always span all columns. */
41
+ columns: 1 | 2 | 3 | 4;
42
+ /** Spacing between fields. */
43
+ gap: 'sm' | 'md' | 'lg';
44
+ /** Footer alignment for the default submit button. */
45
+ footerAlign: 'start' | 'end' | 'center' | 'between' | 'stretch';
46
+ /** Hide the entire footer (use when embedded in a wizard or custom shell). */
47
+ hideFooter: boolean;
48
+ /**
49
+ * Theme overrides. JSON string OR a ThemeSpec assigned as a JS property.
50
+ * Applied as scoped CSS custom properties on the host so global tokens are
51
+ * never touched. See `@prolibu-suite/cobalt-form-core` `resolveTheme` for
52
+ * accepted shape and defaults.
53
+ */
54
+ theme?: string | ThemeSpec;
40
55
  /** Emits the payload (refs normalized to `_id`) after a successful submit. */
41
56
  coSubmit: EventEmitter<{
42
57
  values: Record<string, any>;
@@ -53,12 +68,34 @@ export declare class CoForm {
53
68
  }>;
54
69
  private snapshot;
55
70
  private refStates;
71
+ /** Resolved theme — applied via <Host> in render() so data-attrs stick. */
72
+ private themeStyles;
73
+ private hasBg;
56
74
  private controller;
57
75
  private fields;
58
76
  private unsubscribe;
59
77
  componentWillLoad(): void;
60
78
  onSchemaChange(): void;
79
+ onThemeChange(): void;
61
80
  disconnectedCallback(): void;
81
+ /**
82
+ * Compute the resolved theme and store in `@State()`. The render method
83
+ * binds the styles + data-attrs via `<Host>` — no imperative setAttribute,
84
+ * which avoids the timing issues we hit with shadow:false.
85
+ */
86
+ private applyTheme;
87
+ /**
88
+ * Background-only styles applied to the Host. The host acts as the
89
+ * backdrop layer (full bleed) while the inner <form> is the centered
90
+ * card surface — same two-layer pattern as the wizard.
91
+ */
92
+ private hostProps;
93
+ /**
94
+ * Data attrs + CSS custom properties on the inner <form>. Stencil's
95
+ * shadow:false doesn't reliably rewrite `:host([attr])`, so the
96
+ * theme-driven selectors target `form[data-...]` instead.
97
+ */
98
+ private formProps;
62
99
  private rebuildController;
63
100
  private resolveSchemaInstance;
64
101
  private parseInitialValues;
@@ -69,6 +106,15 @@ export declare class CoForm {
69
106
  getValue(name: string): Promise<any>;
70
107
  /** Mark a field as touched (forces its errors to be visible). */
71
108
  touch(name: string): Promise<void>;
109
+ /**
110
+ * Validate and return the current values. Used by `<co-form-wizard>` to
111
+ * commit a page before advancing. If validation fails, marks all fields
112
+ * touched (so errors render) and returns `valid: false`.
113
+ */
114
+ validateAndCollect(): Promise<{
115
+ valid: boolean;
116
+ values: Record<string, any>;
117
+ }>;
72
118
  private handleFieldChange;
73
119
  private hasSlotContent;
74
120
  private handleSubmit;
@@ -85,4 +131,10 @@ export declare class CoForm {
85
131
  render(): any;
86
132
  private renderField;
87
133
  private optionsFor;
134
+ /**
135
+ * Renders a dynamic list of subforms. The schema for each row is taken from
136
+ * `itemSchema` (a Mongoose-style property map) on the field's originalAttrs.
137
+ * Values are stored as an array of objects.
138
+ */
139
+ private renderRepeater;
88
140
  }
@@ -0,0 +1,118 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { type PageDefinition, type ScoreResult } from '@prolibu-suite/cobalt-form-core';
3
+ /**
4
+ * Multi-page wrapper around `<co-form>`. Consumes a paged schema (or a flat
5
+ * one, which it auto-wraps as a single page) and renders one page at a time
6
+ * with prev/next/submit navigation.
7
+ *
8
+ * The wizard owns the aggregate `values` and merges per-page updates as the
9
+ * user advances. Pages with `visibleIf` are skipped when their expression
10
+ * evaluates to false against the current values.
11
+ *
12
+ * @slot header - Above the stepper.
13
+ * @slot footer - Below the navigation buttons.
14
+ */
15
+ export declare class CoFormWizard {
16
+ host: HTMLElement;
17
+ /** JSON schema string. Can be paged or flat. */
18
+ schema: string;
19
+ /** Initial values across all pages, JSON-encoded. */
20
+ initialValues?: string;
21
+ /** Locale for AJV error messages. */
22
+ locale: 'en' | 'es' | 'pt';
23
+ /** Layout passed to each page's <co-form>. */
24
+ layout: 'grid' | 'stack';
25
+ /** Number of columns per page. */
26
+ columns: 1 | 2 | 3 | 4;
27
+ /**
28
+ * Theme overrides. Forwarded to each page's `<co-form>`. The wizard
29
+ * itself reads `theme` from the parsed paged schema if not supplied
30
+ * here so authors can ship a single bundled schema.
31
+ */
32
+ theme?: string;
33
+ coSubmit: EventEmitter<{
34
+ values: Record<string, any>;
35
+ score?: ScoreResult;
36
+ }>;
37
+ coPageChange: EventEmitter<{
38
+ index: number;
39
+ page: PageDefinition;
40
+ }>;
41
+ private currentIndex;
42
+ private values;
43
+ private finalScore;
44
+ /**
45
+ * Resolved theme styles for the wizard. Stored as state so render() picks
46
+ * up changes — using `<Host>` to bind the data-attrs + inline styles
47
+ * dodges the `setAttribute()` timing issues we saw with shadow:false.
48
+ */
49
+ private themeStyles;
50
+ private hasBg;
51
+ private paged;
52
+ private currentFormEl;
53
+ componentWillLoad(): void;
54
+ onSchemaChange(): void;
55
+ onThemeChange(): void;
56
+ /**
57
+ * Compute the resolved theme styles and store in `@State()` so render()
58
+ * picks them up via `<Host>`. Children `<co-form>` receive a theme with
59
+ * the background stripped (see `themeForChildren`) so only the wizard's
60
+ * outer surface carries it — avoids the image leaking into each page.
61
+ */
62
+ private applyTheme;
63
+ private parseSchema;
64
+ private parseInitialValues;
65
+ /**
66
+ * Theme JSON forwarded to each child <co-form>. Background is stripped
67
+ * here — the wizard's host paints the backdrop, the inner form sits on
68
+ * a solid "page surface" so inputs stay readable.
69
+ */
70
+ private get themeForChildren();
71
+ /**
72
+ * Pages the user should see in order. Filters out pages whose `visibleIf`
73
+ * evaluates to false against the current values.
74
+ */
75
+ private get activePages();
76
+ private get currentPage();
77
+ private commitCurrentPage;
78
+ private handleNext;
79
+ private handlePrev;
80
+ /**
81
+ * Click on a step in the stepper. Backwards navigation is unrestricted
82
+ * (the user already visited those pages). Forward jumps require the
83
+ * current page to validate first, then we hop one page at a time so we
84
+ * don't silently skip validation of intermediate pages.
85
+ */
86
+ private handleStepClick;
87
+ private handleSubmit;
88
+ private handlePageChange;
89
+ /**
90
+ * Host element gets nothing extra — Stencil's shadow:false doesn't
91
+ * reliably rewrite `:host([attr])` selectors, so we put everything on
92
+ * the inner wrapper instead.
93
+ */
94
+ private hostProps;
95
+ /**
96
+ * Data attributes + inline styles for the inner `.co-form-wizard`
97
+ * wrapper. Scoped CSS targets descendants of this wrapper via normal
98
+ * descendant selectors that work regardless of Stencil scoping.
99
+ * CSS custom properties (accent / radius / header) cascade from here
100
+ * down to children — no need to also put them on the host.
101
+ */
102
+ private wrapperProps;
103
+ render(): any;
104
+ private renderInner;
105
+ /**
106
+ * Smart page-head visibility:
107
+ * - Multi-page → always show (pill + title for progress tracking),
108
+ * unless the page explicitly hides title/description.
109
+ * - Single-page with default title "Page N" and no description → hide
110
+ * entirely; the form title block above already provides the context.
111
+ * - Single-page with a custom title or a description → show the
112
+ * relevant parts only.
113
+ * - Explicit `hideTitle` / `hideDescription` overrides on the page
114
+ * always win.
115
+ */
116
+ private renderPageHead;
117
+ private renderScorePanel;
118
+ }
@@ -5,8 +5,8 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
- import { FormSchemaLike, Locale, RefResolver } from "@prolibu-suite/cobalt-form-core";
9
- export { FormSchemaLike, Locale, RefResolver } from "@prolibu-suite/cobalt-form-core";
8
+ import { FormSchemaLike, Locale, PageDefinition, RefResolver, ScoreResult, ThemeSpec } from "@prolibu-suite/cobalt-form-core";
9
+ export { FormSchemaLike, Locale, PageDefinition, RefResolver, ScoreResult, ThemeSpec } from "@prolibu-suite/cobalt-form-core";
10
10
  export namespace Components {
11
11
  /**
12
12
  * Schema-driven form. Renders Cobalt input components from an inline
@@ -20,6 +20,11 @@ export namespace Components {
20
20
  * {@link RefResolver}.
21
21
  */
22
22
  interface CoForm {
23
+ /**
24
+ * Grid columns (1-4). Fields with `full: true` always span all columns.
25
+ * @default 2
26
+ */
27
+ "columns": 1 | 2 | 3 | 4;
23
28
  /**
24
29
  * Disable all fields.
25
30
  * @default false
@@ -29,10 +34,25 @@ export namespace Components {
29
34
  * Comma-separated list of field names to exclude from rendering.
30
35
  */
31
36
  "excludeFields"?: string;
37
+ /**
38
+ * Footer alignment for the default submit button.
39
+ * @default 'end'
40
+ */
41
+ "footerAlign": 'start' | 'end' | 'center' | 'between' | 'stretch';
42
+ /**
43
+ * Spacing between fields.
44
+ * @default 'lg'
45
+ */
46
+ "gap": 'sm' | 'md' | 'lg';
32
47
  /**
33
48
  * Read the current value of a field.
34
49
  */
35
50
  "getValue": (name: string) => Promise<any>;
51
+ /**
52
+ * Hide the entire footer (use when embedded in a wizard or custom shell).
53
+ * @default false
54
+ */
55
+ "hideFooter": boolean;
36
56
  /**
37
57
  * Initial field values as a JSON string.
38
58
  */
@@ -68,16 +88,65 @@ export namespace Components {
68
88
  * Push a value into the controller from outside (e.g. from slot content).
69
89
  */
70
90
  "setValue": (name: string, value: any) => Promise<void>;
91
+ /**
92
+ * Theme overrides. JSON string OR a ThemeSpec assigned as a JS property. Applied as scoped CSS custom properties on the host so global tokens are never touched. See `@prolibu-suite/cobalt-form-core` `resolveTheme` for accepted shape and defaults.
93
+ */
94
+ "theme"?: string | ThemeSpec;
71
95
  /**
72
96
  * Mark a field as touched (forces its errors to be visible).
73
97
  */
74
98
  "touch": (name: string) => Promise<void>;
99
+ /**
100
+ * Validate and return the current values. Used by `<co-form-wizard>` to commit a page before advancing. If validation fails, marks all fields touched (so errors render) and returns `valid: false`.
101
+ */
102
+ "validateAndCollect": () => Promise<{ valid: boolean; values: Record<string, any>; }>;
103
+ }
104
+ /**
105
+ * Multi-page wrapper around `<co-form>`. Consumes a paged schema (or a flat
106
+ * one, which it auto-wraps as a single page) and renders one page at a time
107
+ * with prev/next/submit navigation.
108
+ * The wizard owns the aggregate `values` and merges per-page updates as the
109
+ * user advances. Pages with `visibleIf` are skipped when their expression
110
+ * evaluates to false against the current values.
111
+ */
112
+ interface CoFormWizard {
113
+ /**
114
+ * Number of columns per page.
115
+ * @default 1
116
+ */
117
+ "columns": 1 | 2 | 3 | 4;
118
+ /**
119
+ * Initial values across all pages, JSON-encoded.
120
+ */
121
+ "initialValues"?: string;
122
+ /**
123
+ * Layout passed to each page's <co-form>.
124
+ * @default 'grid'
125
+ */
126
+ "layout": 'grid' | 'stack';
127
+ /**
128
+ * Locale for AJV error messages.
129
+ * @default 'es'
130
+ */
131
+ "locale": 'en' | 'es' | 'pt';
132
+ /**
133
+ * JSON schema string. Can be paged or flat.
134
+ */
135
+ "schema": string;
136
+ /**
137
+ * Theme overrides. Forwarded to each page's `<co-form>`. The wizard itself reads `theme` from the parsed paged schema if not supplied here so authors can ship a single bundled schema.
138
+ */
139
+ "theme"?: string;
75
140
  }
76
141
  }
77
142
  export interface CoFormCustomEvent<T> extends CustomEvent<T> {
78
143
  detail: T;
79
144
  target: HTMLCoFormElement;
80
145
  }
146
+ export interface CoFormWizardCustomEvent<T> extends CustomEvent<T> {
147
+ detail: T;
148
+ target: HTMLCoFormWizardElement;
149
+ }
81
150
  declare global {
82
151
  interface HTMLCoFormElementEventMap {
83
152
  "coSubmit": { values: Record<string, any> };
@@ -109,8 +178,35 @@ declare global {
109
178
  prototype: HTMLCoFormElement;
110
179
  new (): HTMLCoFormElement;
111
180
  };
181
+ interface HTMLCoFormWizardElementEventMap {
182
+ "coSubmit": { values: Record<string, any>; score?: ScoreResult };
183
+ "coPageChange": { index: number; page: PageDefinition };
184
+ }
185
+ /**
186
+ * Multi-page wrapper around `<co-form>`. Consumes a paged schema (or a flat
187
+ * one, which it auto-wraps as a single page) and renders one page at a time
188
+ * with prev/next/submit navigation.
189
+ * The wizard owns the aggregate `values` and merges per-page updates as the
190
+ * user advances. Pages with `visibleIf` are skipped when their expression
191
+ * evaluates to false against the current values.
192
+ */
193
+ interface HTMLCoFormWizardElement extends Components.CoFormWizard, HTMLStencilElement {
194
+ addEventListener<K extends keyof HTMLCoFormWizardElementEventMap>(type: K, listener: (this: HTMLCoFormWizardElement, ev: CoFormWizardCustomEvent<HTMLCoFormWizardElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
195
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
196
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
197
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
198
+ removeEventListener<K extends keyof HTMLCoFormWizardElementEventMap>(type: K, listener: (this: HTMLCoFormWizardElement, ev: CoFormWizardCustomEvent<HTMLCoFormWizardElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
199
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
200
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
201
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
202
+ }
203
+ var HTMLCoFormWizardElement: {
204
+ prototype: HTMLCoFormWizardElement;
205
+ new (): HTMLCoFormWizardElement;
206
+ };
112
207
  interface HTMLElementTagNameMap {
113
208
  "co-form": HTMLCoFormElement;
209
+ "co-form-wizard": HTMLCoFormWizardElement;
114
210
  }
115
211
  }
116
212
  declare namespace LocalJSX {
@@ -128,6 +224,11 @@ declare namespace LocalJSX {
128
224
  * {@link RefResolver}.
129
225
  */
130
226
  interface CoForm {
227
+ /**
228
+ * Grid columns (1-4). Fields with `full: true` always span all columns.
229
+ * @default 2
230
+ */
231
+ "columns"?: 1 | 2 | 3 | 4;
131
232
  /**
132
233
  * Disable all fields.
133
234
  * @default false
@@ -137,6 +238,21 @@ declare namespace LocalJSX {
137
238
  * Comma-separated list of field names to exclude from rendering.
138
239
  */
139
240
  "excludeFields"?: string;
241
+ /**
242
+ * Footer alignment for the default submit button.
243
+ * @default 'end'
244
+ */
245
+ "footerAlign"?: 'start' | 'end' | 'center' | 'between' | 'stretch';
246
+ /**
247
+ * Spacing between fields.
248
+ * @default 'lg'
249
+ */
250
+ "gap"?: 'sm' | 'md' | 'lg';
251
+ /**
252
+ * Hide the entire footer (use when embedded in a wizard or custom shell).
253
+ * @default false
254
+ */
255
+ "hideFooter"?: boolean;
140
256
  /**
141
257
  * Initial field values as a JSON string.
142
258
  */
@@ -180,6 +296,49 @@ declare namespace LocalJSX {
180
296
  * Pre-built FormSchemaLike — assigned as a JS property, bypasses parsing.
181
297
  */
182
298
  "schemaInstance"?: FormSchemaLike;
299
+ /**
300
+ * Theme overrides. JSON string OR a ThemeSpec assigned as a JS property. Applied as scoped CSS custom properties on the host so global tokens are never touched. See `@prolibu-suite/cobalt-form-core` `resolveTheme` for accepted shape and defaults.
301
+ */
302
+ "theme"?: string | ThemeSpec;
303
+ }
304
+ /**
305
+ * Multi-page wrapper around `<co-form>`. Consumes a paged schema (or a flat
306
+ * one, which it auto-wraps as a single page) and renders one page at a time
307
+ * with prev/next/submit navigation.
308
+ * The wizard owns the aggregate `values` and merges per-page updates as the
309
+ * user advances. Pages with `visibleIf` are skipped when their expression
310
+ * evaluates to false against the current values.
311
+ */
312
+ interface CoFormWizard {
313
+ /**
314
+ * Number of columns per page.
315
+ * @default 1
316
+ */
317
+ "columns"?: 1 | 2 | 3 | 4;
318
+ /**
319
+ * Initial values across all pages, JSON-encoded.
320
+ */
321
+ "initialValues"?: string;
322
+ /**
323
+ * Layout passed to each page's <co-form>.
324
+ * @default 'grid'
325
+ */
326
+ "layout"?: 'grid' | 'stack';
327
+ /**
328
+ * Locale for AJV error messages.
329
+ * @default 'es'
330
+ */
331
+ "locale"?: 'en' | 'es' | 'pt';
332
+ "onCoPageChange"?: (event: CoFormWizardCustomEvent<{ index: number; page: PageDefinition }>) => void;
333
+ "onCoSubmit"?: (event: CoFormWizardCustomEvent<{ values: Record<string, any>; score?: ScoreResult }>) => void;
334
+ /**
335
+ * JSON schema string. Can be paged or flat.
336
+ */
337
+ "schema": string;
338
+ /**
339
+ * Theme overrides. Forwarded to each page's `<co-form>`. The wizard itself reads `theme` from the parsed paged schema if not supplied here so authors can ship a single bundled schema.
340
+ */
341
+ "theme"?: string;
183
342
  }
184
343
 
185
344
  interface CoFormAttributes {
@@ -190,10 +349,24 @@ declare namespace LocalJSX {
190
349
  "excludeFields": string;
191
350
  "disabled": boolean;
192
351
  "readOnly": boolean;
352
+ "columns": 1 | 2 | 3 | 4;
353
+ "gap": 'sm' | 'md' | 'lg';
354
+ "footerAlign": 'start' | 'end' | 'center' | 'between' | 'stretch';
355
+ "hideFooter": boolean;
356
+ "theme": string | ThemeSpec;
357
+ }
358
+ interface CoFormWizardAttributes {
359
+ "schema": string;
360
+ "initialValues": string;
361
+ "locale": 'en' | 'es' | 'pt';
362
+ "layout": 'grid' | 'stack';
363
+ "columns": 1 | 2 | 3 | 4;
364
+ "theme": string;
193
365
  }
194
366
 
195
367
  interface IntrinsicElements {
196
368
  "co-form": Omit<CoForm, keyof CoFormAttributes> & { [K in keyof CoForm & keyof CoFormAttributes]?: CoForm[K] } & { [K in keyof CoForm & keyof CoFormAttributes as `attr:${K}`]?: CoFormAttributes[K] } & { [K in keyof CoForm & keyof CoFormAttributes as `prop:${K}`]?: CoForm[K] } & OneOf<"schema", CoForm["schema"], CoFormAttributes["schema"]>;
369
+ "co-form-wizard": Omit<CoFormWizard, keyof CoFormWizardAttributes> & { [K in keyof CoFormWizard & keyof CoFormWizardAttributes]?: CoFormWizard[K] } & { [K in keyof CoFormWizard & keyof CoFormWizardAttributes as `attr:${K}`]?: CoFormWizardAttributes[K] } & { [K in keyof CoFormWizard & keyof CoFormWizardAttributes as `prop:${K}`]?: CoFormWizard[K] } & OneOf<"schema", CoFormWizard["schema"], CoFormWizardAttributes["schema"]>;
197
370
  }
198
371
  }
199
372
  export { LocalJSX as JSX };
@@ -212,6 +385,15 @@ declare module "@stencil/core" {
212
385
  * {@link RefResolver}.
213
386
  */
214
387
  "co-form": LocalJSX.IntrinsicElements["co-form"] & JSXBase.HTMLAttributes<HTMLCoFormElement>;
388
+ /**
389
+ * Multi-page wrapper around `<co-form>`. Consumes a paged schema (or a flat
390
+ * one, which it auto-wraps as a single page) and renders one page at a time
391
+ * with prev/next/submit navigation.
392
+ * The wizard owns the aggregate `values` and merges per-page updates as the
393
+ * user advances. Pages with `visibleIf` are skipped when their expression
394
+ * evaluates to false against the current values.
395
+ */
396
+ "co-form-wizard": LocalJSX.IntrinsicElements["co-form-wizard"] & JSXBase.HTMLAttributes<HTMLCoFormWizardElement>;
215
397
  }
216
398
  }
217
399
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prolibu-suite/cobalt-form",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Cobalt Form — schema-driven <co-form> Web Component. CDN entry point.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -37,12 +37,14 @@
37
37
  "author": "Prolibu <contact@prolibu.com>",
38
38
  "license": "MIT",
39
39
  "peerDependencies": {
40
- "@prolibu-suite/cobalt-core": "0.1.1"
40
+ "@prolibu-suite/cobalt-core": "0.1.2"
41
41
  },
42
42
  "dependencies": {
43
- "@prolibu-suite/cobalt-form-core": "0.1.1"
43
+ "@prolibu-suite/cobalt-form-core": "0.2.0"
44
44
  },
45
45
  "devDependencies": {
46
+ "@rollup/plugin-commonjs": "^29.0.2",
47
+ "@rollup/plugin-node-resolve": "^16.0.3",
46
48
  "@stencil/core": "^4.43.4"
47
49
  },
48
50
  "publishConfig": {
@@ -51,6 +53,7 @@
51
53
  "scripts": {
52
54
  "build": "stencil build",
53
55
  "dev": "stencil build --dev --watch --serve",
54
- "clean": "rm -rf dist loader www"
56
+ "clean": "rm -rf dist loader www embed/dist",
57
+ "embed": "node embed/build-embed.mjs"
55
58
  }
56
59
  }
@@ -1,2 +0,0 @@
1
- function t(t,n,e){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,n);if(o&&(!e||o.get))return o;t=Object.getPrototypeOf(t)}}var n=(n,e)=>{var o;Object.entries(null!=(o=e.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=n[o],s=t(Object.getPrototypeOf(n),o,!0)||Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(n,o,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),e.l.has(o)?n[o]=e.l.get(o):void 0!==l&&(n[o]=l)}}))},e=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},o=(t,e)=>{e&&(t.__stencil__getHostRef=()=>e,e.i=t,512&e.o.u&&n(t,e))},l=(t,n)=>n in t,s=(t,n)=>(0,console.error)(t,n),i=new Map,r=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="http://www.w3.org/1999/xlink",f="undefined"!=typeof window?window:{},a={u:0,p:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,n,e,o)=>t.addEventListener(n,e,o),rel:(t,n,e,o)=>t.removeEventListener(n,e,o),ce:(t,n)=>new CustomEvent(t,n)},d=t=>Promise.resolve(t),p=(()=>{try{return!!f.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),h=!!p&&(()=>!!f.document&&Object.getOwnPropertyDescriptor(f.document.adoptedStyleSheets,"length").writable)(),v=!1,m=[],y=[],b=(t,n)=>e=>{t.push(e),v||(v=!0,n&&4&a.u?g(w):a.raf(w))},$=t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(t){s(t)}t.length=0},w=()=>{$(m),$(y),(v=m.length>0)&&a.raf(w)},g=t=>d().then(t),j=b(y,!0),S=t=>{const n=E(t,"childNodes");t.tagName&&t.tagName.includes("-")&&t["s-cr"]&&"SLOT-FB"!==t.tagName&&O(n,t.tagName).forEach((t=>{1===t.nodeType&&"SLOT-FB"===t.tagName&&(t.hidden=!!k(t,C(t),!1).length)}));let e=0;for(e=0;e<n.length;e++){const t=n[e];1===t.nodeType&&E(t,"childNodes").length&&S(t)}};function O(t,n,e){let o,l=0,s=[];for(;l<t.length;l++){if(o=t[l],o["s-sr"]&&(!n||o["s-hn"]===n)&&(void 0===e||C(o)===e)&&(s.push(o),void 0!==e))return s;s=[...s,...O(o.childNodes,n,e)]}return s}var k=(t,n,e=!0)=>{const o=[];(e&&t["s-sr"]||!t["s-sr"])&&o.push(t);let l=t;for(;l=l.nextSibling;)C(l)!==n||!e&&l["s-sr"]||o.push(l);return o},N=(t,n)=>1===t.nodeType?null===t.getAttribute("slot")&&""===n||t.getAttribute("slot")===n:t["s-sn"]===n||""===n,C=t=>"string"==typeof t["s-sn"]?t["s-sn"]:1===t.nodeType&&t.getAttribute("slot")||void 0;function E(t,n){if("__"+n in t){const e=t["__"+n];return"function"!=typeof e?e:e.bind(t)}return"function"!=typeof t[n]?t[n]:t[n].bind(t)}function M(t){var n,e,o;return null!=(o=null==(e=null==(n=t.head)?void 0:n.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?o:void 0}var T,L,R=new WeakMap,x=t=>"sc-"+t.h,A=t=>"object"==(t=typeof t)||"function"===t,P=(t,n,...e)=>{let o=null,l=null,s=null,i=!1,r=!1;const c=[],u=n=>{for(let e=0;e<n.length;e++)o=n[e],Array.isArray(o)?u(o):null!=o&&"boolean"!=typeof o&&((i="function"!=typeof t&&!A(o))&&(o+=""),i&&r?c[c.length-1].v+=o:c.push(i?D(null,o):o),r=i)};if(u(e),n){n.key&&(l=n.key),n.name&&(s=n.name);{const t=n.className||n.class;t&&(n.class="object"!=typeof t?t:Object.keys(t).filter((n=>t[n])).join(" "))}}const f=D(t,null);return f.m=n,c.length>0&&(f.$=c),f.j=l,f.S=s,f},D=(t,n)=>({u:0,O:t,v:null!=n?n:null,k:null,$:null,m:null,j:null,S:null}),F={},H=t=>{if(!t)return;const n=Object.keys(t);if(0===n.length)return;let e=!1;for(const o of n){if(e)break;for(const n of t[o])if("string"==typeof n){e=!0;break}}if(!e)return t;const o={};for(const e of n)o[e]=t[e].map((t=>"string"==typeof t?{[t]:0}:t));return o},_=(t,n)=>null==t||A(t)?t:4&n?"false"!==t&&(""===t||!!t):1&n?t+"":t,U=t=>{var n;return null==(n=e(t))?void 0:n.$hostElement$},W=(t,n)=>{const e=U(t);return{emit:t=>z(e,n,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},z=(t,n,e)=>{const o=a.ce(n,e);return t.dispatchEvent(o),o},B=(t,n,o,s,i,r)=>{if(o===s)return;let c=l(t,n),d=n.toLowerCase();if("class"===n){const n=t.classList,e=q(o);let l=q(s);n.remove(...e.filter((t=>t&&!l.includes(t)))),n.add(...l.filter((t=>t&&!e.includes(t))))}else if("style"===n){for(const n in o)s&&null!=s[n]||(n.includes("-")?t.style.removeProperty(n):t.style[n]="");for(const n in s)o&&s[n]===o[n]||(n.includes("-")?t.style.setProperty(n,s[n]):t.style[n]=s[n])}else if("key"===n);else if("ref"===n)s&&pt(s,t);else if(c||"o"!==n[0]||"n"!==n[1]){if("a"===n[0]&&n.startsWith("attr:")){const o=n.slice(5);let l;{const n=e(t);if(n&&n.o&&n.o.t){const t=n.o.t[o];t&&t[1]&&(l=t[1])}}return l||(l=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==s||!1===s?!1===s&&""!==t.getAttribute(l)||t.removeAttribute(l):t.setAttribute(l,!0===s?"":s))}if("p"===n[0]&&n.startsWith("prop:")){const e=n.slice(5);try{t[e]=s}catch(t){}return}{const e=A(s);if((c||e&&null!==s)&&!i)try{if(t.tagName.includes("-"))t[n]!==s&&(t[n]=s);else{const e=null==s?"":s;"list"===n?c=!1:null!=o&&t[n]===e||("function"==typeof t.__lookupSetter__(n)?t[n]=e:t.setAttribute(n,e))}}catch(t){}let l=!1;d!==(d=d.replace(/^xlink\:?/,""))&&(n=d,l=!0),null==s||!1===s?!1===s&&""!==t.getAttribute(n)||(l?t.removeAttributeNS(u,n):t.removeAttribute(n)):(!c||4&r||i)&&!e&&1===t.nodeType&&(s=!0===s?"":s,l?t.setAttributeNS(u,n,s):t.setAttribute(n,s))}}else if(n="-"===n[2]?n.slice(3):l(f,d)?d.slice(2):d[2]+n.slice(3),o||s){const e=n.endsWith(Y);n=n.replace(G,""),o&&a.rel(t,n,o,e),s&&a.ael(t,n,s,e)}},V=/\s/,q=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(V):[]),Y="Capture",G=RegExp(Y+"$"),I=(t,n,e)=>{const o=11===n.k.nodeType&&n.k.host?n.k.host:n.k,l=t&&t.m||{},s=n.m||{};for(const t of Z(Object.keys(l)))t in s||B(o,t,l[t],void 0,e,n.u);for(const t of Z(Object.keys(s)))B(o,t,l[t],s[t],e,n.u)};function Z(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var J=!1,K=!1,Q=!1,X=!1,tt=[],nt=[],et=(t,n,e)=>{var o;const l=n.$[e];let s,i,r,c=0;if(J||(Q=!0,"slot"===l.O&&(l.u|=l.$?2:1)),null!=l.v)s=l.k=f.document.createTextNode(l.v);else if(1&l.u)s=l.k=f.document.createTextNode(""),I(null,l,X);else{if(!f.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(s=l.k=f.document.createElement(!J&&2&l.u?"slot-fb":l.O),I(null,l,X),l.$){const n="template"===l.O?s.content:s;for(c=0;c<l.$.length;++c)i=et(t,l,c),i&&n.appendChild(i)}}return s["s-hn"]=L,3&l.u&&(s["s-sr"]=!0,s["s-cr"]=T,s["s-sn"]=l.S||"",s["s-rf"]=null==(o=l.m)?void 0:o.ref,function(t){if(t.assignedElements||t.assignedNodes||!t["s-sr"])return;const n=n=>function(t){const e=[],o=this["s-sn"];(null==t?void 0:t.flatten)&&console.error("\n Flattening is not supported for Stencil non-shadow slots.\n You can use `.childNodes` to nested slot fallback content.\n If you have a particular use case, please open an issue on the Stencil repo.\n ");const l=this["s-cr"].parentElement;return(l.__childNodes?l.childNodes:(t=>{const n=[];for(let e=0;e<t.length;e++){const o=t[e]["s-nr"]||void 0;o&&o.isConnected&&n.push(o)}return n})(l.childNodes)).forEach((t=>{o===C(t)&&e.push(t)})),n?e.filter((t=>1===t.nodeType)):e}.bind(t);t.assignedElements=n(!0),t.assignedNodes=n(!1)}(s),r=t&&t.$&&t.$[e],r&&r.O===l.O&&t.k&&ot(t.k)),s},ot=t=>{a.u|=1;const n=t.closest(L.toLowerCase());if(null!=n){const e=Array.from(n.__childNodes||n.childNodes).find((t=>t["s-cr"])),o=Array.from(t.__childNodes||t.childNodes);for(const t of e?o.reverse():o)null!=t["s-sh"]&&(ht(n,t,null!=e?e:null),t["s-sh"]=void 0,Q=!0)}a.u&=-2},lt=(t,n)=>{a.u|=1;const e=Array.from(t.__childNodes||t.childNodes);if(t["s-sr"]){let n=t;for(;n=n.nextSibling;)n&&n["s-sn"]===t["s-sn"]&&n["s-sh"]===L&&e.push(n)}for(let t=e.length-1;t>=0;t--){const o=e[t];o["s-hn"]!==L&&o["s-ol"]&&(ht(ct(o).parentNode,o,ct(o)),o["s-ol"].remove(),o["s-ol"]=void 0,o["s-sh"]=void 0,Q=!0),n&&lt(o,n)}a.u&=-2},st=(t,n,e,o,l,s)=>{let i,r=t["s-cr"]&&t["s-cr"].parentNode||t;for("template"===e.O&&(r=r.content);l<=s;++l)o[l]&&(i=et(null,e,l),i&&(o[l].k=i,ht(r,i,ct(n))))},it=(t,n,e)=>{for(let o=n;o<=e;++o){const n=t[o];if(n){const t=n.k;dt(n),t&&(K=!0,t["s-ol"]?t["s-ol"].remove():lt(t,!0),t.remove())}}},rt=(t,n,e=!1)=>t.O===n.O&&("slot"===t.O?t.S===n.S:e?(e&&!t.j&&n.j&&(t.j=n.j),!0):t.j===n.j),ct=t=>t&&t["s-ol"]||t,ut=(t,n,e=!1)=>{const o=n.k=t.k,l=t.$,s=n.$,i=n.v;let r;null==i?("slot"!==n.O||J||t.S!==n.S&&(n.k["s-sn"]=n.S||"",ot(n.k.parentElement)),I(t,n,X),null!==l&&null!==s?((t,n,e,o,l=!1)=>{let s,i,r=0,c=0,u=0,f=0,a=n.length-1,d=n[0],p=n[a],h=o.length-1,v=o[0],m=o[h];const y="template"===e.O?t.content:t;for(;r<=a&&c<=h;)if(null==d)d=n[++r];else if(null==p)p=n[--a];else if(null==v)v=o[++c];else if(null==m)m=o[--h];else if(rt(d,v,l))ut(d,v,l),d=n[++r],v=o[++c];else if(rt(p,m,l))ut(p,m,l),p=n[--a],m=o[--h];else if(rt(d,m,l))"slot"!==d.O&&"slot"!==m.O||lt(d.k.parentNode,!1),ut(d,m,l),ht(y,d.k,p.k.nextSibling),d=n[++r],m=o[--h];else if(rt(p,v,l))"slot"!==d.O&&"slot"!==m.O||lt(p.k.parentNode,!1),ut(p,v,l),ht(y,p.k,d.k),p=n[--a],v=o[++c];else{for(u=-1,f=r;f<=a;++f)if(n[f]&&null!==n[f].j&&n[f].j===v.j){u=f;break}u>=0?(i=n[u],i.O!==v.O?s=et(n&&n[c],e,u):(ut(i,v,l),n[u]=void 0,s=i.k),v=o[++c]):(s=et(n&&n[c],e,c),v=o[++c]),s&&ht(ct(d.k).parentNode,s,ct(d.k))}r>a?st(t,null==o[h+1]?null:o[h+1].k,e,o,c,h):c>h&&it(n,r,a)})(o,l,n,s,e):null!==s?(null!==t.v&&(o.textContent=""),st(o,null,n,s,0,s.length-1)):!e&&null!==l&&it(l,0,l.length-1)):(r=o["s-cr"])?r.parentNode.textContent=i:t.v!==i&&(o.data=i)},ft=[],at=t=>{let n,e,o;const l=t.__childNodes||t.childNodes;for(const t of l){if(t["s-sr"]&&(n=t["s-cr"])&&n.parentNode){e=n.parentNode.__childNodes||n.parentNode.childNodes;const l=t["s-sn"];for(o=e.length-1;o>=0;o--)if(n=e[o],!(n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||n["s-sh"]&&n["s-sh"]===t["s-hn"]))if(N(n,l)){let e=ft.find((t=>t.N===n));K=!0,n["s-sn"]=n["s-sn"]||l,e?(e.N["s-sh"]=t["s-hn"],e.C=t):(n["s-sh"]=t["s-hn"],ft.push({C:t,N:n})),n["s-sr"]&&ft.map((t=>{N(t.N,n["s-sn"])&&(e=ft.find((t=>t.N===n)),e&&!t.C&&(t.C=e.C))}))}else ft.some((t=>t.N===n))||ft.push({N:n})}1===t.nodeType&&at(t)}},dt=t=>{t.m&&t.m.ref&&tt.push((()=>t.m.ref(null))),t.$&&t.$.map(dt)},pt=(t,n)=>{nt.push((()=>t(n)))},ht=(t,n,e,o)=>{if("string"==typeof n["s-sn"]){t.insertBefore(n,e);const{slotNode:l}=function(t,n){var e;if(!(n=n||(null==(e=t["s-ol"])?void 0:e.parentElement)))return{slotNode:null,slotName:""};const o=t["s-sn"]=C(t)||"";return{slotNode:O(E(n,"childNodes"),n.tagName,o)[0],slotName:o}}(n);return l&&!o&&function(t){t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1,composed:!1}))}(l),n}return t.__insertBefore?t.__insertBefore(n,e):null==t?void 0:t.insertBefore(n,e)},vt=(t,n)=>{if(n&&!t.M&&n["s-p"]){const e=n["s-p"].push(new Promise((o=>t.M=()=>{n["s-p"].splice(e-1,1),o()})))}},mt=(t,n)=>{if(t.u|=16,4&t.u)return void(t.u|=512);vt(t,t.T);const e=()=>yt(t,n);if(!n)return j(e);queueMicrotask((()=>{e()}))},yt=(t,n)=>{const e=t.$hostElement$,o=t.i;if(!o)throw Error(`Can't render component <${e.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return n?(t.L&&(t.L=!1,Ot(o,"connectedCallback",void 0,e)),t.R.length&&t.R.forEach((t=>t(e))),l=Ot(o,"componentWillLoad",void 0,e)):l=Ot(o,"componentWillUpdate",void 0,e),l=bt(l,(()=>Ot(o,"componentWillRender",void 0,e))),bt(l,(()=>wt(t,o,n)))},bt=(t,n)=>$t(t)?t.then(n).catch((t=>{console.error(t),n()})):n(),$t=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,wt=async(t,n,e)=>{var o;const l=t.$hostElement$,s=l["s-rc"];e&&(t=>{const n=t.o;((t,n)=>{var e,o,l;const s=x(n),i=r.get(s);if(!f.document)return s;if(t=11===t.nodeType?t:f.document,i)if("string"==typeof i){let l,r=R.get(t=t.head||t);if(r||R.set(t,r=new Set),!r.has(s)){l=f.document.createElement("style"),l.textContent=i;const u=null!=(e=a.A)?e:M(f.document);if(null!=u&&l.setAttribute("nonce",u),!(1&n.u))if("HEAD"===t.nodeName){const n=t.querySelectorAll("link[rel=preconnect]"),e=n.length>0?n[n.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==e?void 0:e.parentNode)===t?e:null)}else if("host"in t)if(p){const n=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;n.replaceSync(i),h?t.adoptedStyleSheets.unshift(n):t.adoptedStyleSheets=[n,...t.adoptedStyleSheets]}else{const n=t.querySelector("style");n?n.textContent=i+n.textContent:t.prepend(l)}else t.append(l);1&n.u&&t.insertBefore(l,null),4&n.u&&(l.textContent+=c),r&&r.add(s)}}else{let n=R.get(t);if(n||R.set(t,n=new Set),!n.has(s)){const e=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(i.constructor===e.CSSStyleSheet)o=i;else{o=new e.CSSStyleSheet;for(let t=0;t<i.cssRules.length;t++)o.insertRule(i.cssRules[t].cssText,t)}h?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],n.add(s)}}})(t.$hostElement$.getRootNode(),n)})(t);gt(t,n,l,e),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const n=null!=(o=l["s-p"])?o:[],e=()=>jt(t);0===n.length?e():(Promise.all(n).then(e).catch(e),t.u|=4,n.length=0)}},gt=(t,n,e,o)=>{try{n=n.render(),t.u&=-17,t.u|=2,((t,n,e=!1)=>{var o,l,s,i,r;const c=t.$hostElement$,u=t.o,d=t.P||D(null,null),p=(t=>t&&t.O===F)(n)?n:P(null,null,n);if(L=c.tagName,e&&p.m)for(const t of Object.keys(p.m))c.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(p.m[t]=c[t]);if(p.O=null,p.u|=4,t.P=p,p.k=d.k=c,J=!1,T=c["s-cr"],K=!1,ut(d,p,e),a.u|=1,Q){at(p.k);for(const t of ft){const n=t.N;if(!n["s-ol"]&&f.document){const t=f.document.createTextNode("");t["s-nr"]=n,ht(n.parentNode,n["s-ol"]=t,n,e)}}for(const t of ft){const n=t.N,r=t.C;if(1===n.nodeType&&e&&(n["s-ih"]=null!=(o=n.hidden)&&o),r){const t=r.parentNode;let o=r.nextSibling;if(o&&1===o.nodeType){let e=null==(l=n["s-ol"])?void 0:l.previousSibling;for(;e;){let l=null!=(s=e["s-nr"])?s:null;if(l&&l["s-sn"]===n["s-sn"]&&t===(l.__parentNode||l.parentNode)){for(l=l.nextSibling;l===n||(null==l?void 0:l["s-sr"]);)l=null==l?void 0:l.nextSibling;if(!l||!l["s-nr"]){o=l;break}}e=e.previousSibling}}if((!o&&t!==(n.__parentNode||n.parentNode)||(n.__nextSibling||n.nextSibling)!==o)&&n!==o){if(ht(t,n,o,e),8===n.nodeType&&n.nodeValue.startsWith("s-nt-")){const t=f.document.createTextNode(n.nodeValue.replace(/^s-nt-/,""));t["s-hn"]=n["s-hn"],t["s-sn"]=n["s-sn"],t["s-sh"]=n["s-sh"],t["s-sr"]=n["s-sr"],t["s-ol"]=n["s-ol"],t["s-ol"]["s-nr"]=t,ht(n.parentNode,t,n,e),n.parentNode.removeChild(n)}1===n.nodeType&&"SLOT-FB"!==n.tagName&&(n.hidden=null!=(i=n["s-ih"])&&i)}n&&"function"==typeof r["s-rf"]&&r["s-rf"](r)}else 1===n.nodeType&&(n.hidden=!0)}}if(K&&S(p.k),a.u&=-2,ft.length=0,!J&&!(1&u.u)&&c["s-cr"]){const t=p.k.__childNodes||p.k.childNodes;for(const n of t)if(n["s-hn"]!==L&&!n["s-sh"])if(e&&null==n["s-ih"]&&(n["s-ih"]=null!=(r=n.hidden)&&r),1===n.nodeType)n.hidden=!0;else if(3===n.nodeType&&n.nodeValue.trim()){const t=f.document.createComment("s-nt-"+n.nodeValue);t["s-sn"]=n["s-sn"],ht(n.parentNode,t,n,e),n.parentNode.removeChild(n)}}T=void 0,tt.forEach((t=>t())),tt.length=0,nt.forEach((t=>t())),nt.length=0})(t,n,o)}catch(n){s(n,t.$hostElement$)}return null},jt=t=>{const n=t.$hostElement$,e=t.i,o=t.T;Ot(e,"componentDidRender",void 0,n),64&t.u?Ot(e,"componentDidUpdate",void 0,n):(t.u|=64,kt(n),Ot(e,"componentDidLoad",void 0,n),t.D(n),o||St()),t.F(n),t.M&&(t.M(),t.M=void 0),512&t.u&&g((()=>mt(t,!1))),t.u&=-517},St=()=>{g((()=>z(f,"appload",{detail:{namespace:"cobalt-form"}})))},Ot=(t,n,e,o)=>{if(t&&t[n])try{return t[n](e)}catch(t){s(t,o)}},kt=t=>t.classList.add("hydrated"),Nt=(t,n,o,l)=>{const i=e(t);if(!i)return;if(!i)throw Error(`Couldn't find host element for "${l.h}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const r=i.$hostElement$,c=i.l.get(n),u=i.u,f=i.i;if(o=_(o,l.t[n][0]),!(8&u&&void 0!==c||o===c||Number.isNaN(c)&&Number.isNaN(o))){if(i.l.set(n,o),l.H){const t=l.H[n];t&&t.map((t=>{try{const[[e,l]]=Object.entries(t);(128&u||1&l)&&(f?f[e](o,c,n):i.R.push((()=>{i.i[e](o,c,n)})))}catch(t){s(t,r)}}))}if(2&u){if(f.componentShouldUpdate&&!1===f.componentShouldUpdate(o,c,n)&&!(16&u))return;16&u||mt(i,!1)}}},Ct=(n,o,l)=>{var s,i;const r=n.prototype;{n.watchers&&!o.H&&(o.H=H(n.watchers)),n.deserializers&&!o._&&(o._=n.deserializers),n.serializers&&!o.U&&(o.U=n.serializers);const c=Object.entries(null!=(s=o.t)?s:{});if(c.map((([n,[s]])=>{if(31&s||2&l&&32&s){const{get:i,set:c}=t(r,n)||{};i&&(o.t[n][0]|=2048),c&&(o.t[n][0]|=4096),(1&l||!i)&&Object.defineProperty(r,n,{get(){{if(!(2048&o.t[n][0]))return((t,n)=>e(this).l.get(n))(0,n);const t=e(this),l=t?t.i:r;if(!l)return;return l[n]}},configurable:!0,enumerable:!0}),Object.defineProperty(r,n,{set(t){const i=e(this);if(i){if(c)return void 0===(32&s?this[n]:i.$hostElement$[n])&&i.l.get(n)&&(t=i.l.get(n)),c.call(this,_(t,s)),void Nt(this,n,t=32&s?this[n]:i.$hostElement$[n],o);{if(!(1&l&&4096&o.t[n][0]))return Nt(this,n,t,o),void(1&l&&!i.i&&i.R.push((()=>{4096&o.t[n][0]&&i.i[n]!==i.l.get(n)&&(i.i[n]=t)})));const e=()=>{const e=i.i[n];!i.l.get(n)&&e&&i.l.set(n,e),i.i[n]=_(t,s),Nt(this,n,i.i[n],o)};i.i?e():i.R.push((()=>{e()}))}}}})}else 1&l&&64&s&&Object.defineProperty(r,n,{value(...t){var o;const l=e(this);return null==(o=null==l?void 0:l.W)?void 0:o.then((()=>{var e;return null==(e=l.i)?void 0:e[n](...t)}))}})})),1&l){const t=new Map;r.attributeChangedCallback=function(n,l,s){a.jmp((()=>{var i;const u=t.get(n),f=e(this);if(this.hasOwnProperty(u)&&(s=this[u],delete this[u]),r.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==s)return;if(null==u){const t=null==f?void 0:f.u;if(f&&t&&!(8&t)&&s!==l){const e=f.i,r=null==(i=o.H)?void 0:i[n];null==r||r.forEach((o=>{const[[i,r]]=Object.entries(o);null!=e[i]&&(128&t||1&r)&&e[i].call(e,s,l,n)}))}return}const a=c.find((([t])=>t===u)),d=a&&4&a[1][0],p=d&&null===s&&void 0===this[u];d&&(s=null!==s&&"false"!==s);const h=Object.getOwnPropertyDescriptor(r,u);p||s==this[u]||h.get&&!h.set||(this[u]=s)}))},n.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=o.H)?i:{}),...c.filter((([t,n])=>31&n[0])).map((([n,e])=>{const o=e[1]||n;return t.set(o,n),o}))]))}}return n},Et=(t,n)=>{Ot(t,"connectedCallback",void 0,n)},Mt=(t,n)=>{Ot(t,"disconnectedCallback",void 0,n||t)},Tt=(t,n={})=>{var o;if(!f.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const l=[],u=n.exclude||[],d=f.customElements,h=f.document.head,v=h.querySelector("meta[charset]"),m=f.document.createElement("style"),y=[];let b,$=!0;Object.assign(a,n),a.p=new URL(n.resourcesUrl||"./",f.document.baseURI).href;let w=!1;if(t.map((t=>{t[1].map((n=>{var o,c;const h={u:n[0],h:n[1],t:n[2],B:n[3]};4&h.u&&(w=!0),h.t=n[2],h.H=H(n[4]),h.U=null!=(o=n[5])?o:{},h._=null!=(c=n[6])?c:{};const v=h.h,m=class extends HTMLElement{"s-p";"s-rc";hasRegisteredEventListeners=!1;constructor(t){super(t),((t,n)=>{const e={u:0,$hostElement$:t,o:n,l:new Map,V:new Map};e.W=new Promise((t=>e.F=t)),e.q=new Promise((t=>e.D=t)),t["s-p"]=[],t["s-rc"]=[],e.R=[];const o=e;t.__stencil__getHostRef=()=>o})(t=this,h)}connectedCallback(){e(this)&&(this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),b&&(clearTimeout(b),b=null),$?y.push(this):a.jmp((()=>(t=>{if(!(1&a.u)){const n=e(t);if(!n)return;const o=n.o,l=()=>{};if(1&n.u)(null==n?void 0:n.i)?Et(n.i,t):(null==n?void 0:n.q)&&n.q.then((()=>Et(n.i,t)));else{n.u|=1,12&o.u&&(t=>{if(!f.document)return;const n=t["s-cr"]=f.document.createComment("");n["s-cn"]=!0,ht(t,n,t.firstChild)})(t);{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){vt(n,n.T=e);break}}o.t&&Object.entries(o.t).map((([n,[e]])=>{if(31&e&&Object.prototype.hasOwnProperty.call(t,n)){const e=t[n];delete t[n],t[n]=e}})),(async(t,n,e)=>{let o;try{if(!(32&n.u)){if(n.u|=32,e.Y){const l=((t,n)=>{const e=t.h.replace(/-/g,"_"),o=t.Y;if(!o)return;const l=i.get(o);return l?l[e]:import(`./${o}.entry.js`).then((t=>(i.set(o,t),t[e])),(t=>{s(t,n.$hostElement$)}))
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(e,n);if(l&&"then"in l){const t=()=>{};o=await l,t()}else o=l;if(!o)throw Error(`Constructor for "${e.h}#${n.G}" was not found`);o.isProxied||(e.H=H(o.watchers),e.U=o.serializers,e._=o.deserializers,Ct(o,e,2),o.isProxied=!0);const r=()=>{};n.u|=8;try{new o(n)}catch(n){s(n,t)}n.u&=-9,n.u|=128,r(),4&e.u?n.L=!0:Et(n.i,t)}else o=t.constructor,customElements.whenDefined(t.localName).then((()=>n.u|=128));if(o&&o.style){let t;"string"==typeof o.style&&(t=o.style);const n=x(e);if(!r.has(n)){const o=()=>{};((t,n,e)=>{let o=r.get(t);p&&e?(o=o||new CSSStyleSheet,"string"==typeof o?o=n:o.replaceSync(n)):o=n,r.set(t,o)})(n,t,!!(1&e.u)),o()}}}const l=n.T,c=()=>mt(n,!0);l&&l["s-rc"]?l["s-rc"].push(c):c()}catch(e){s(e,t),n.M&&(n.M(),n.M=void 0),n.D&&n.D(t)}})(t,n,o)}l()}})(this))))}disconnectedCallback(){a.jmp((()=>(async t=>{if(!(1&a.u)){const n=e(t);(null==n?void 0:n.i)?Mt(n.i,t):(null==n?void 0:n.q)&&n.q.then((()=>Mt(n.i,t)))}R.has(t)&&R.delete(t),t.shadowRoot&&R.has(t.shadowRoot)&&R.delete(t.shadowRoot)})(this))),a.raf((()=>{var t;const n=e(this);if(!n)return;const o=y.findIndex((t=>t===this));o>-1&&y.splice(o,1),(null==(t=null==n?void 0:n.P)?void 0:t.k)instanceof Node&&!n.P.k.isConnected&&delete n.P.k}))}componentOnReady(){var t;return null==(t=e(this))?void 0:t.q}};h.Y=t[0],u.includes(v)||d.get(v)||(l.push(v),d.define(v,Ct(m,h,1)))}))})),l.length>0&&(w&&(m.textContent+=c),m.textContent+=l.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",m.innerHTML.length)){m.setAttribute("data-styles","");const t=null!=(o=a.A)?o:M(f.document);null!=t&&m.setAttribute("nonce",t),h.insertBefore(m,v?v.nextSibling:h.firstChild)}$=!1,y.length?y.map((t=>t.connectedCallback())):a.jmp((()=>b=setTimeout(St,30)))},Lt=t=>a.A=t;export{Tt as b,W as c,U as g,P as h,d as p,o as r,Lt as s}
@@ -1 +0,0 @@
1
- export{CoForm as co_form}from"./index.esm.js";import"./p-X0Keifac.js";