@pure-ds/core 0.3.17 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +6 -3
- package/dist/types/pds.d.ts +109 -408
- package/dist/types/public/assets/pds/components/pds-jsonform.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/assets/pds/components/pds-jsonform.js +406 -297
- package/public/assets/pds/custom-elements.json +6 -3
- package/public/assets/pds/pds-css-complete.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -1306,7 +1306,8 @@
|
|
|
1306
1306
|
},
|
|
1307
1307
|
{
|
|
1308
1308
|
"kind": "method",
|
|
1309
|
-
"name": "updateLayout"
|
|
1309
|
+
"name": "updateLayout",
|
|
1310
|
+
"description": "Updates the layout based on the current viewport width and breakpoint.\nToggles mobile mode and adjusts panel styles."
|
|
1310
1311
|
},
|
|
1311
1312
|
{
|
|
1312
1313
|
"kind": "method",
|
|
@@ -1332,11 +1333,13 @@
|
|
|
1332
1333
|
},
|
|
1333
1334
|
{
|
|
1334
1335
|
"kind": "method",
|
|
1335
|
-
"name": "toggleMobileView"
|
|
1336
|
+
"name": "toggleMobileView",
|
|
1337
|
+
"description": "Toggles the visibility of the primary panel in mobile view."
|
|
1336
1338
|
},
|
|
1337
1339
|
{
|
|
1338
1340
|
"kind": "method",
|
|
1339
|
-
"name": "closeMobileView"
|
|
1341
|
+
"name": "closeMobileView",
|
|
1342
|
+
"description": "Closes the primary panel in mobile view."
|
|
1340
1343
|
},
|
|
1341
1344
|
{
|
|
1342
1345
|
"kind": "method",
|
package/dist/types/pds.d.ts
CHANGED
|
@@ -1,408 +1,109 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* const g = new PDS.Generator({ example: true });
|
|
111
|
-
* // tokens may be returned synchronously or via a Promise
|
|
112
|
-
* const tokens = await g.generateTokens?.();
|
|
113
|
-
* const css = await g.generateCSS?.();
|
|
114
|
-
*/
|
|
115
|
-
export class Generator {
|
|
116
|
-
constructor(options?: any);
|
|
117
|
-
/** runtime options / config passed to the generator */
|
|
118
|
-
options: any;
|
|
119
|
-
/** generated token object */
|
|
120
|
-
tokens: Record<string, any>;
|
|
121
|
-
/** concatenated CSS (layered) */
|
|
122
|
-
css: string;
|
|
123
|
-
/** Complete compiled representation of the design system state */
|
|
124
|
-
readonly compiled: CompiledState;
|
|
125
|
-
/** Generate the token map (may be async in some implementations) */
|
|
126
|
-
generateTokens?(): Record<string, any> | Promise<Record<string, any>>;
|
|
127
|
-
/** Generate the CSS string (may be async) */
|
|
128
|
-
generateCSS?(): string | Promise<string>;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** Public runtime surface exported as `PDS` */
|
|
132
|
-
export interface PDSEventMap {
|
|
133
|
-
'pds:ready': CustomEvent<{ mode: 'live' | 'static'; generator?: Generator; config: any; theme: string; autoDefiner?: any }>;
|
|
134
|
-
'pds:error': CustomEvent<{ error: any }>;
|
|
135
|
-
'pds:theme:changed': CustomEvent<{ theme: string; requested?: string; source: 'system' | 'programmatic' }>;
|
|
136
|
-
'pds:design:updated': CustomEvent<{ config: any; designer?: any }>;
|
|
137
|
-
'pds:design:field:changed': CustomEvent<{ field: string; config: any }>;
|
|
138
|
-
'pds:inspector:mode:changed': CustomEvent<{ active: boolean }>;
|
|
139
|
-
'pds:inspector:deactivate': CustomEvent<{}>;
|
|
140
|
-
'pds:docs:view': CustomEvent<{ file: string }>;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export class PDS extends EventTarget {
|
|
144
|
-
// Static surface
|
|
145
|
-
static Generator: typeof Generator;
|
|
146
|
-
static registry: PDSRegistry;
|
|
147
|
-
static presets: Record<string, any>;
|
|
148
|
-
static ontology: any;
|
|
149
|
-
static adoptLayers: (shadowRoot: ShadowRoot, layers?: string[], additionalSheets?: CSSStyleSheet[]) => Promise<void>;
|
|
150
|
-
static adoptPrimitives: (shadowRoot: ShadowRoot, additionalSheets?: CSSStyleSheet[]) => Promise<void>;
|
|
151
|
-
static createStylesheet: (css: string) => CSSStyleSheet;
|
|
152
|
-
static isLiveMode: () => boolean;
|
|
153
|
-
static findComponentForElement: (el: Element) => ComponentDef | null;
|
|
154
|
-
static validateDesign: (designConfig: any, options?: { minContrast?: number }) => { ok: boolean; issues: Array<{ path: string; message: string; ratio: number; min: number; context?: string }> };
|
|
155
|
-
static validateDesigns: (designs: Array<any> | Record<string, any>, options?: { minContrast?: number }) => { ok: boolean; results: Array<{ name?: string; ok: boolean; issues: Array<{ path: string; message: string; ratio: number; min: number; context?: string }> }> };
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Current configuration after PDS.start() completes - read-only, frozen after initialization.
|
|
159
|
-
* Contains the complete configuration used to initialize PDS, including mode, design, preset, and theme.
|
|
160
|
-
*/
|
|
161
|
-
static readonly currentConfig: any;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Compiled design system state - provides structured access to all generated tokens,
|
|
165
|
-
* layers, and metadata. Available in live mode when a generator is active.
|
|
166
|
-
* Returns null if not in live mode or if no generator is present.
|
|
167
|
-
*/
|
|
168
|
-
static readonly compiled: CompiledState | null;
|
|
169
|
-
|
|
170
|
-
// Static EventTarget-like facade for default instance
|
|
171
|
-
static addEventListener<K extends keyof PDSEventMap>(type: K, listener: (ev: PDSEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
172
|
-
static removeEventListener<K extends keyof PDSEventMap>(type: K, listener: (ev: PDSEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
173
|
-
static dispatchEvent(event: PDSEventMap[keyof PDSEventMap] | Event): boolean;
|
|
174
|
-
|
|
175
|
-
// Static entry point
|
|
176
|
-
static start(config?: {
|
|
177
|
-
mode?: 'live' | 'static';
|
|
178
|
-
preset?: string;
|
|
179
|
-
design?: any;
|
|
180
|
-
autoDefine?: {
|
|
181
|
-
baseURL?: string;
|
|
182
|
-
predefine?: string[];
|
|
183
|
-
mapper?: (tag: string) => string | undefined | null | false;
|
|
184
|
-
scanExisting?: boolean;
|
|
185
|
-
observeShadows?: boolean;
|
|
186
|
-
patchAttachShadow?: boolean;
|
|
187
|
-
debounceMs?: number;
|
|
188
|
-
onError?: (tag: string, err: any) => void;
|
|
189
|
-
};
|
|
190
|
-
applyGlobalStyles?: boolean;
|
|
191
|
-
manageTheme?: boolean;
|
|
192
|
-
themeStorageKey?: string;
|
|
193
|
-
public?: {
|
|
194
|
-
root?: string;
|
|
195
|
-
};
|
|
196
|
-
// live-only
|
|
197
|
-
preloadStyles?: boolean;
|
|
198
|
-
criticalLayers?: string[];
|
|
199
|
-
// static-only
|
|
200
|
-
staticPaths?: Record<string, string>;
|
|
201
|
-
enhancers?: Array<any>;
|
|
202
|
-
}): Promise<PDS>;
|
|
203
|
-
|
|
204
|
-
constructor();
|
|
205
|
-
|
|
206
|
-
// Instance state
|
|
207
|
-
readonly mode: 'live' | 'static';
|
|
208
|
-
readonly generator?: Generator;
|
|
209
|
-
readonly config: any;
|
|
210
|
-
readonly theme: string;
|
|
211
|
-
readonly autoDefiner?: any;
|
|
212
|
-
|
|
213
|
-
// Instance helpers
|
|
214
|
-
setTheme(theme: 'light' | 'dark' | 'system', options?: { storageKey?: string; persist?: boolean }): Promise<string>;
|
|
215
|
-
preloadCritical(config: any, options?: { theme?: string; layers?: string[] }): void;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export { PDS as default };
|
|
219
|
-
|
|
220
|
-
// ===== pds-jsonform Types =====
|
|
221
|
-
|
|
222
|
-
export interface JsonFormOptions {
|
|
223
|
-
widgets?: {
|
|
224
|
-
booleans?: 'toggle' | 'checkbox';
|
|
225
|
-
numbers?: 'input' | 'range';
|
|
226
|
-
selects?: 'standard' | 'dropdown';
|
|
227
|
-
};
|
|
228
|
-
layouts?: {
|
|
229
|
-
fieldsets?: 'default' | 'flex' | 'grid' | 'accordion' | 'tabs' | 'card';
|
|
230
|
-
arrays?: 'default' | 'compact';
|
|
231
|
-
};
|
|
232
|
-
enhancements?: {
|
|
233
|
-
icons?: boolean;
|
|
234
|
-
datalists?: boolean;
|
|
235
|
-
rangeOutput?: boolean;
|
|
236
|
-
};
|
|
237
|
-
validation?: {
|
|
238
|
-
showErrors?: boolean;
|
|
239
|
-
validateOnChange?: boolean;
|
|
240
|
-
};
|
|
241
|
-
// Path-specific options (JSON Pointer paths)
|
|
242
|
-
[path: string]: any;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export interface UISchema {
|
|
246
|
-
// Field-level UI customization (JSON Pointer paths as keys)
|
|
247
|
-
[path: string]: {
|
|
248
|
-
'ui:widget'?: string;
|
|
249
|
-
'ui:layout'?: 'default' | 'flex' | 'grid' | 'accordion' | 'tabs';
|
|
250
|
-
'ui:columns'?: number | 'auto';
|
|
251
|
-
'ui:autoSize'?: 'sm' | 'md' | 'lg' | 'xl';
|
|
252
|
-
'ui:gap'?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
253
|
-
'ui:wrap'?: boolean;
|
|
254
|
-
'ui:direction'?: 'row' | 'column';
|
|
255
|
-
'ui:surface'?: 'card' | 'elevated' | 'dialog';
|
|
256
|
-
'ui:accordion'?: boolean;
|
|
257
|
-
'ui:tabs'?: boolean;
|
|
258
|
-
'ui:defaultOpen'?: number[];
|
|
259
|
-
'ui:dialog'?: boolean;
|
|
260
|
-
'ui:dialogButton'?: string;
|
|
261
|
-
'ui:dialogSize'?: 'sm' | 'lg' | 'xl' | 'full';
|
|
262
|
-
'ui:submitLabel'?: string;
|
|
263
|
-
'ui:cancelLabel'?: string;
|
|
264
|
-
'ui:help'?: string;
|
|
265
|
-
'ui:placeholder'?: string;
|
|
266
|
-
'ui:icon'?: string;
|
|
267
|
-
'ui:iconPosition'?: 'start' | 'end';
|
|
268
|
-
'ui:datalist'?: string[];
|
|
269
|
-
'ui:rows'?: number;
|
|
270
|
-
'ui:min'?: number;
|
|
271
|
-
'ui:max'?: number;
|
|
272
|
-
'ui:dropdown'?: boolean;
|
|
273
|
-
'ui:autocomplete'?: string;
|
|
274
|
-
'ui:accept'?: string;
|
|
275
|
-
'ui:multiple'?: boolean;
|
|
276
|
-
'ui:maxFiles'?: number;
|
|
277
|
-
'ui:maxSize'?: number;
|
|
278
|
-
'ui:submitOnEnter'?: boolean;
|
|
279
|
-
'ui:spellcheck'?: boolean;
|
|
280
|
-
'ui:order'?: string[];
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
export interface JsonFormEvent<T = any> extends CustomEvent {
|
|
285
|
-
detail: T;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export interface JsonFormSubmitDetail {
|
|
289
|
-
json: any;
|
|
290
|
-
formData: FormData;
|
|
291
|
-
valid: boolean;
|
|
292
|
-
issues: Array<{ path?: string; message: string }>;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export interface JsonFormValueChangeDetail {
|
|
296
|
-
name: string;
|
|
297
|
-
value: any;
|
|
298
|
-
validity: { valid: boolean };
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export interface JsonFormArrayEventDetail {
|
|
302
|
-
path: string;
|
|
303
|
-
index?: number;
|
|
304
|
-
from?: number;
|
|
305
|
-
to?: number;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export interface JsonFormDialogEventDetail {
|
|
309
|
-
path: string;
|
|
310
|
-
schema?: any;
|
|
311
|
-
value?: any;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export interface JsonFormRendererContext {
|
|
315
|
-
id: string;
|
|
316
|
-
path: string;
|
|
317
|
-
label: string;
|
|
318
|
-
value: any;
|
|
319
|
-
required: boolean;
|
|
320
|
-
ui: any;
|
|
321
|
-
schema: any;
|
|
322
|
-
get: (path?: string) => any;
|
|
323
|
-
set: (value: any, path?: string) => void;
|
|
324
|
-
attrs: {
|
|
325
|
-
placeholder?: string;
|
|
326
|
-
minLength?: number;
|
|
327
|
-
maxLength?: number;
|
|
328
|
-
min?: number;
|
|
329
|
-
max?: number;
|
|
330
|
-
step?: number;
|
|
331
|
-
pattern?: string;
|
|
332
|
-
readOnly?: boolean;
|
|
333
|
-
required?: boolean;
|
|
334
|
-
autocomplete?: string;
|
|
335
|
-
list?: string;
|
|
336
|
-
};
|
|
337
|
-
host: any;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
export type JsonFormRenderer = (context: JsonFormRendererContext) => any;
|
|
341
|
-
|
|
342
|
-
export interface JsonFormEventMap {
|
|
343
|
-
'pw:schema-resolve': JsonFormEvent<{ schema: any }>;
|
|
344
|
-
'pw:compile-node': JsonFormEvent<{ path: string; schema: any; ui: any; node?: any }>;
|
|
345
|
-
'pw:choose-widget': JsonFormEvent<{ path: string; schema: any; ui: any; widget: string | null }>;
|
|
346
|
-
'pw:before-render-field': JsonFormEvent<{ path: string; schema: any; ui: any; mount?: any; render?: () => any }>;
|
|
347
|
-
'pw:render-field': JsonFormEvent<{ path: string; schema: any; node: any }>;
|
|
348
|
-
'pw:after-render-field': JsonFormEvent<{ path: string; schema: any }>;
|
|
349
|
-
'pw:value-change': JsonFormEvent<JsonFormValueChangeDetail>;
|
|
350
|
-
'pw:array-add': JsonFormEvent<JsonFormArrayEventDetail>;
|
|
351
|
-
'pw:array-remove': JsonFormEvent<JsonFormArrayEventDetail>;
|
|
352
|
-
'pw:array-reorder': JsonFormEvent<JsonFormArrayEventDetail>;
|
|
353
|
-
'pw:serialize': JsonFormEvent<JsonFormSubmitDetail>;
|
|
354
|
-
'pw:submit': JsonFormEvent<JsonFormSubmitDetail>;
|
|
355
|
-
'pw:dialog-open': JsonFormEvent<JsonFormDialogEventDetail>;
|
|
356
|
-
'pw:dialog-submit': JsonFormEvent<JsonFormDialogEventDetail>;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
declare global {
|
|
360
|
-
interface HTMLElementTagNameMap {
|
|
361
|
-
'pds-jsonform': SchemaForm;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export class SchemaForm extends HTMLElement {
|
|
366
|
-
// Properties
|
|
367
|
-
jsonSchema: any;
|
|
368
|
-
uiSchema: UISchema;
|
|
369
|
-
options: JsonFormOptions;
|
|
370
|
-
values: any;
|
|
371
|
-
action?: string;
|
|
372
|
-
method: 'get' | 'post' | 'dialog';
|
|
373
|
-
disabled: boolean;
|
|
374
|
-
hideActions: boolean;
|
|
375
|
-
submitLabel: string;
|
|
376
|
-
resetLabel: string;
|
|
377
|
-
hideReset: boolean;
|
|
378
|
-
hideSubmit: boolean;
|
|
379
|
-
|
|
380
|
-
// Methods
|
|
381
|
-
defineRenderer(widgetKey: string, renderer: JsonFormRenderer): void;
|
|
382
|
-
useValidator(validator: (data: any, schema: any) => Promise<{ valid: boolean; errors?: Array<{ path?: string; message: string }> }>): void;
|
|
383
|
-
getValuesFlat(): Record<string, any>;
|
|
384
|
-
serialize(): { json: any; formData: FormData };
|
|
385
|
-
submit(): Promise<JsonFormSubmitDetail>;
|
|
386
|
-
|
|
387
|
-
// Event listeners
|
|
388
|
-
addEventListener<K extends keyof JsonFormEventMap>(
|
|
389
|
-
type: K,
|
|
390
|
-
listener: (ev: JsonFormEventMap[K]) => any,
|
|
391
|
-
options?: boolean | AddEventListenerOptions
|
|
392
|
-
): void;
|
|
393
|
-
addEventListener(
|
|
394
|
-
type: string,
|
|
395
|
-
listener: EventListenerOrEventListenerObject,
|
|
396
|
-
options?: boolean | AddEventListenerOptions
|
|
397
|
-
): void;
|
|
398
|
-
removeEventListener<K extends keyof JsonFormEventMap>(
|
|
399
|
-
type: K,
|
|
400
|
-
listener: (ev: JsonFormEventMap[K]) => any,
|
|
401
|
-
options?: boolean | EventListenerOptions
|
|
402
|
-
): void;
|
|
403
|
-
removeEventListener(
|
|
404
|
-
type: string,
|
|
405
|
-
listener: EventListenerOrEventListenerObject,
|
|
406
|
-
options?: boolean | EventListenerOptions
|
|
407
|
-
): void;
|
|
408
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Public PDS runtime object exported to consumers.
|
|
3
|
+
*
|
|
4
|
+
* This object exposes the core runtime building blocks for the Pure Design System.
|
|
5
|
+
* It intentionally provides a small, stable surface area so consuming apps can:
|
|
6
|
+
* - programmatically generate design system artifacts (via `Generator`),
|
|
7
|
+
* - adopt styles into Shadow DOM (via `adoptLayers` / `adoptPrimitives`),
|
|
8
|
+
* - query runtime mode and obtain constructable stylesheets (via `registry`).
|
|
9
|
+
*
|
|
10
|
+
* Common events in the PDS ecosystem (emitted by other packages/components):
|
|
11
|
+
* - `design-updated` — emitted by the designer component when the in-memory design changes (detail: { config }).
|
|
12
|
+
* - `pds-generated` — emitted by the PDS configurator when generation completes (detail: { modules, meta }).
|
|
13
|
+
* - `pds-error` — emitted by the PDS configurator when generation fails (detail: Error).
|
|
14
|
+
*
|
|
15
|
+
* Error handling notes:
|
|
16
|
+
* - Methods that perform dynamic imports (e.g. `adoptLayers` via the registry) may log and return fallbacks
|
|
17
|
+
* rather than throwing; consumers should check return values (e.g. null) and listen for `pds-error` in UI flows.
|
|
18
|
+
* - `createStylesheet(css)` will throw synchronously if the provided CSS cannot be parsed by the browser's
|
|
19
|
+
* `CSSStyleSheet.replaceSync()` — callers should guard invalid input or wrap calls in try/catch.
|
|
20
|
+
*/
|
|
21
|
+
export type PDSAPI = {
|
|
22
|
+
/**
|
|
23
|
+
* - Generator class to produce design system assets
|
|
24
|
+
*/
|
|
25
|
+
Generator: typeof import("./pds-core/pds-generator.js").Generator;
|
|
26
|
+
/**
|
|
27
|
+
* - Singleton runtime registry for live/static mode
|
|
28
|
+
*/
|
|
29
|
+
registry: import("./pds-core/pds-registry.js").PDSRegistry;
|
|
30
|
+
/**
|
|
31
|
+
* - Ontology helpers and metadata for components
|
|
32
|
+
*/
|
|
33
|
+
ontology: any;
|
|
34
|
+
/**
|
|
35
|
+
* - Adopt multiple layers into a ShadowRoot. May log errors and fallback to additionalSheets when static imports fail.
|
|
36
|
+
*/
|
|
37
|
+
adoptLayers: (shadowRoot: ShadowRoot, layers?: string[], additionalSheets?: CSSStyleSheet[]) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* - Adopt primitives layer into a ShadowRoot. Designed as a convenience for components.
|
|
40
|
+
*/
|
|
41
|
+
adoptPrimitives: (shadowRoot: ShadowRoot, additionalSheets?: CSSStyleSheet[]) => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* - Create a constructable stylesheet from CSS text.
|
|
44
|
+
*/
|
|
45
|
+
createStylesheet: (css: string) => CSSStyleSheet;
|
|
46
|
+
};
|
|
47
|
+
/** @type {PDSAPI & PDSBase} */
|
|
48
|
+
export const PDS: PDSAPI & PDSBase;
|
|
49
|
+
/**
|
|
50
|
+
* Validate a design configuration for accessibility sanity checks.
|
|
51
|
+
* Currently validates color contrast for primary buttons and base surface text
|
|
52
|
+
* in both light and dark themes.
|
|
53
|
+
*
|
|
54
|
+
* @param {object} designConfig - A full or partial PDS config object
|
|
55
|
+
* @param {object} [options]
|
|
56
|
+
* @param {number} [options.minContrast=4.5] - Minimum contrast ratio for normal text
|
|
57
|
+
* @returns {{ ok: boolean, issues: Array<{path:string, message:string, ratio:number, min:number, context?:string}> }}
|
|
58
|
+
*/
|
|
59
|
+
export function validateDesign(designConfig?: object, options?: {
|
|
60
|
+
minContrast?: number;
|
|
61
|
+
}): {
|
|
62
|
+
ok: boolean;
|
|
63
|
+
issues: Array<{
|
|
64
|
+
path: string;
|
|
65
|
+
message: string;
|
|
66
|
+
ratio: number;
|
|
67
|
+
min: number;
|
|
68
|
+
context?: string;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Public PDS runtime object exported to consumers.
|
|
73
|
+
*
|
|
74
|
+
* This object exposes the core runtime building blocks for the Pure Design System.
|
|
75
|
+
* It intentionally provides a small, stable surface area so consuming apps can:
|
|
76
|
+
* - programmatically generate design system artifacts (via `Generator`),
|
|
77
|
+
* - adopt styles into Shadow DOM (via `adoptLayers` / `adoptPrimitives`),
|
|
78
|
+
* - query runtime mode and obtain constructable stylesheets (via `registry`).
|
|
79
|
+
*
|
|
80
|
+
* Common events in the PDS ecosystem (emitted by other packages/components):
|
|
81
|
+
* - `design-updated` — emitted by the designer component when the in-memory design changes (detail: { config }).
|
|
82
|
+
* - `pds-generated` — emitted by the PDS configurator when generation completes (detail: { modules, meta }).
|
|
83
|
+
* - `pds-error` — emitted by the PDS configurator when generation fails (detail: Error).
|
|
84
|
+
*
|
|
85
|
+
* Error handling notes:
|
|
86
|
+
* - Methods that perform dynamic imports (e.g. `adoptLayers` via the registry) may log and return fallbacks
|
|
87
|
+
* rather than throwing; consumers should check return values (e.g. null) and listen for `pds-error` in UI flows.
|
|
88
|
+
* - `createStylesheet(css)` will throw synchronously if the provided CSS cannot be parsed by the browser's
|
|
89
|
+
* `CSSStyleSheet.replaceSync()` — callers should guard invalid input or wrap calls in try/catch.
|
|
90
|
+
*
|
|
91
|
+
* @typedef {Object} PDSAPI
|
|
92
|
+
* @property {typeof import("./pds-core/pds-generator.js").Generator} Generator - Generator class to produce design system assets
|
|
93
|
+
* @property {import("./pds-core/pds-registry.js").PDSRegistry} registry - Singleton runtime registry for live/static mode
|
|
94
|
+
* @property {any} ontology - Ontology helpers and metadata for components
|
|
95
|
+
* @property {(shadowRoot: ShadowRoot, layers?: string[], additionalSheets?: CSSStyleSheet[]) => Promise<void>} adoptLayers - Adopt multiple layers into a ShadowRoot. May log errors and fallback to additionalSheets when static imports fail.
|
|
96
|
+
* @property {(shadowRoot: ShadowRoot, additionalSheets?: CSSStyleSheet[]) => Promise<void>} adoptPrimitives - Adopt primitives layer into a ShadowRoot. Designed as a convenience for components.
|
|
97
|
+
* @property {(css:string) => CSSStyleSheet} createStylesheet - Create a constructable stylesheet from CSS text. @throws {DOMException} on invalid CSS in some browsers.
|
|
98
|
+
* @property {() => boolean} isLiveMode - Returns true when running in live/designer-backed mode
|
|
99
|
+
* @property {(el: Element) => import("./pds-core/pds-ontology.js").ComponentDef | null} findComponentForElement - Helper to find a component definition for a DOM element
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* Workspace for the Pure Design System runtime API
|
|
103
|
+
* PDS is now an EventTarget so consumers can subscribe to a single, consistent
|
|
104
|
+
* event bus instead of listening on window/document or individual elements.
|
|
105
|
+
*/
|
|
106
|
+
declare class PDSBase extends EventTarget {
|
|
107
|
+
}
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=pds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-jsonform.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-jsonform.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAGF,yBAEC;IAYC,gBAA2B;IAC3B,cAAyB;IACzB,aAAwB;IACxB,YAAuB;IACvB,eAAoB;IACpB,qBAAwB;IACxB,oBAA2B;IAC3B,mBAAyB;IACzB,mBAAsB;IACtB,oBAAuB;IAiBzB,8CAEC;IACD,4BAEC;IAGD,oBAEC;
|
|
1
|
+
{"version":3,"file":"pds-jsonform.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-jsonform.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAGF,yBAEC;IAYC,gBAA2B;IAC3B,cAAyB;IACzB,aAAwB;IACxB,YAAuB;IACvB,eAAoB;IACpB,qBAAwB;IACxB,oBAA2B;IAC3B,mBAAyB;IACzB,mBAAsB;IACtB,oBAAuB;IAiBzB,8CAEC;IACD,4BAEC;IAGD,oBAEC;IAkBD;;;MAIC;IAED,uBAEC;IAGD,+BAyBC;IA+ND,cA8CC;;CA+4CF"}
|