@pure-ds/core 0.3.19 → 0.4.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.
- package/custom-elements.json +6 -6
- package/dist/types/pds.config.d.ts +4 -8
- package/dist/types/pds.config.d.ts.map +1 -1
- package/dist/types/pds.d.ts +408 -109
- package/dist/types/public/assets/js/pds.d.ts +3 -3
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-jsonform.d.ts +1 -0
- package/dist/types/public/assets/pds/components/pds-jsonform.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-tabstrip.d.ts +36 -5
- package/dist/types/public/assets/pds/components/pds-tabstrip.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-ontology.d.ts +186 -12
- package/dist/types/src/js/pds-core/pds-ontology.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-query.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/assets/js/app.js +304 -213
- package/public/assets/js/pds.js +172 -81
- package/public/assets/pds/components/pds-tabstrip.js +36 -5
- package/public/assets/pds/custom-elements.json +6 -6
- package/public/assets/pds/pds-css-complete.json +1 -1
- package/public/assets/pds/vscode-custom-data.json +4 -4
- package/src/js/pds-core/pds-generator.js +148 -57
- package/src/js/pds-core/pds-ontology.js +803 -256
- package/src/js/pds-core/pds-query.js +582 -571
package/custom-elements.json
CHANGED
|
@@ -1432,11 +1432,11 @@
|
|
|
1432
1432
|
"declarations": [
|
|
1433
1433
|
{
|
|
1434
1434
|
"kind": "class",
|
|
1435
|
-
"description": "",
|
|
1435
|
+
"description": "A tab panel used as a child of `<pds-tabstrip>`. Each panel becomes a tab\nwith its button label derived from the `label` attribute.",
|
|
1436
1436
|
"name": "TabPanel",
|
|
1437
1437
|
"slots": [
|
|
1438
1438
|
{
|
|
1439
|
-
"description": "Content
|
|
1439
|
+
"description": "Content displayed when this tab is active",
|
|
1440
1440
|
"name": ""
|
|
1441
1441
|
}
|
|
1442
1442
|
],
|
|
@@ -1458,7 +1458,7 @@
|
|
|
1458
1458
|
"type": {
|
|
1459
1459
|
"text": "string"
|
|
1460
1460
|
},
|
|
1461
|
-
"description": "Label
|
|
1461
|
+
"description": "Label text displayed on the tab button",
|
|
1462
1462
|
"name": "label"
|
|
1463
1463
|
},
|
|
1464
1464
|
{
|
|
@@ -1477,7 +1477,7 @@
|
|
|
1477
1477
|
},
|
|
1478
1478
|
{
|
|
1479
1479
|
"kind": "class",
|
|
1480
|
-
"description": "Tab navigation component that
|
|
1480
|
+
"description": "Tab navigation component that displays content in switchable panels.\n\nUse `<pds-tabpanel>` children with a `label` attribute to define each tab.\nThe component auto-generates navigation buttons and handles URL hash synchronization.",
|
|
1481
1481
|
"name": "TabStrip",
|
|
1482
1482
|
"cssProperties": [
|
|
1483
1483
|
{
|
|
@@ -1493,7 +1493,7 @@
|
|
|
1493
1493
|
],
|
|
1494
1494
|
"slots": [
|
|
1495
1495
|
{
|
|
1496
|
-
"description": "
|
|
1496
|
+
"description": "One or more `<pds-tabpanel>` elements, each with a `label` attribute",
|
|
1497
1497
|
"name": ""
|
|
1498
1498
|
}
|
|
1499
1499
|
],
|
|
@@ -1518,7 +1518,7 @@
|
|
|
1518
1518
|
"type": {
|
|
1519
1519
|
"text": "string"
|
|
1520
1520
|
},
|
|
1521
|
-
"description": "Accessible label announced for the tablist",
|
|
1521
|
+
"description": "Accessible label announced for the tablist (default: \"Tabs\")",
|
|
1522
1522
|
"name": "label"
|
|
1523
1523
|
},
|
|
1524
1524
|
{
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
export namespace config {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let root: string;
|
|
6
|
-
}
|
|
7
|
-
export { _static as static };
|
|
8
|
-
export namespace autoDefine {
|
|
2
|
+
let mode: string;
|
|
3
|
+
let preset: string;
|
|
4
|
+
namespace autoDefine {
|
|
9
5
|
let predefine: string[];
|
|
10
6
|
}
|
|
11
|
-
|
|
7
|
+
function log(level: any, message: any, ...data: any[]): void;
|
|
12
8
|
}
|
|
13
9
|
//# sourceMappingURL=pds.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.config.d.ts","sourceRoot":"","sources":["../../pds.config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds.config.d.ts","sourceRoot":"","sources":["../../pds.config.js"],"names":[],"mappings":";;;;;;IAQE,6DAEC"}
|
package/dist/types/pds.d.ts
CHANGED
|
@@ -1,109 +1,408 @@
|
|
|
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
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Runtime registry singleton that controls live vs static behavior.
|
|
3
|
+
* Consumers can call `registry.setDesigner(designer)` to enable live mode
|
|
4
|
+
* or `registry.setStaticMode(paths)` to point to static asset modules.
|
|
5
|
+
*/
|
|
6
|
+
export interface PDSRegistry {
|
|
7
|
+
/** Attach a designer instance and switch the registry to live mode. */
|
|
8
|
+
setDesigner(designer: any, meta?: { presetName?: string }): void;
|
|
9
|
+
/** Switch to static mode and override static paths (keys: tokens, primitives, components, utilities, styles) */
|
|
10
|
+
setStaticMode(paths?: Record<string, string>): void;
|
|
11
|
+
/** Return a constructable stylesheet for the requested layer or null on failure. */
|
|
12
|
+
getStylesheet(layer: string): Promise<CSSStyleSheet | null>;
|
|
13
|
+
/** Return a BLOB URL (live mode only) for layer imports used in CSS */
|
|
14
|
+
getBlobURL(layer: string): string | null;
|
|
15
|
+
/** 'live' or 'static' */
|
|
16
|
+
readonly mode: string;
|
|
17
|
+
/** true when a live designer instance is registered */
|
|
18
|
+
readonly isLive: boolean;
|
|
19
|
+
/** true when a designer instance exists */
|
|
20
|
+
readonly hasDesigner: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A small shape describing component metadata used by the PDS ontology. */
|
|
24
|
+
export interface ComponentDef {
|
|
25
|
+
/** canonical name of the component (e.g., 'Button') */
|
|
26
|
+
name: string;
|
|
27
|
+
/** optional HTML tag name for the component ('pds-button') */
|
|
28
|
+
tag?: string;
|
|
29
|
+
/** documented props and their types/metadata */
|
|
30
|
+
props?: Record<string, any>;
|
|
31
|
+
/** human-friendly description used by the designer */
|
|
32
|
+
description?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Layer information with CSS content and metadata */
|
|
36
|
+
export interface CompiledLayer {
|
|
37
|
+
css: string;
|
|
38
|
+
size: number;
|
|
39
|
+
sizeKB: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Complete compiled state of the design system */
|
|
43
|
+
export interface CompiledState {
|
|
44
|
+
/** Core token groups - the source data used to generate CSS */
|
|
45
|
+
tokens: {
|
|
46
|
+
colors: Record<string, any>;
|
|
47
|
+
spacing: Record<string, any>;
|
|
48
|
+
radius: Record<string, any>;
|
|
49
|
+
borderWidths: Record<string, any>;
|
|
50
|
+
typography: Record<string, any>;
|
|
51
|
+
shadows: Record<string, any>;
|
|
52
|
+
layout: Record<string, any>;
|
|
53
|
+
transitions: Record<string, any>;
|
|
54
|
+
zIndex: Record<string, any>;
|
|
55
|
+
icons: Record<string, any>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Layer information - CSS content and metadata for each layer */
|
|
59
|
+
layers: {
|
|
60
|
+
tokens: CompiledLayer;
|
|
61
|
+
primitives: CompiledLayer;
|
|
62
|
+
components: CompiledLayer;
|
|
63
|
+
utilities: CompiledLayer;
|
|
64
|
+
combined: CompiledLayer;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** Configuration snapshot - what was used to generate this state */
|
|
68
|
+
config: {
|
|
69
|
+
design: any;
|
|
70
|
+
preset: string | null;
|
|
71
|
+
debug: boolean;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Runtime capabilities and environment */
|
|
75
|
+
capabilities: {
|
|
76
|
+
constructableStylesheets: boolean;
|
|
77
|
+
blobURLs: boolean;
|
|
78
|
+
shadowDOM: boolean;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** References to design system metadata */
|
|
82
|
+
references: {
|
|
83
|
+
ontology: any;
|
|
84
|
+
enums: any;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/** Computed metadata about the generated design system */
|
|
88
|
+
meta: {
|
|
89
|
+
generatedAt: string;
|
|
90
|
+
totalSize: number;
|
|
91
|
+
totalSizeKB: string;
|
|
92
|
+
layerCount: number;
|
|
93
|
+
tokenGroups: number;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** Introspection helpers - methods to query the compiled state */
|
|
97
|
+
helpers: {
|
|
98
|
+
getColorScales(): Array<{ name: string; scale: any }>;
|
|
99
|
+
getColorScale(name: string): any;
|
|
100
|
+
getSpacingValues(): Array<{ key: string; value: any }>;
|
|
101
|
+
getTypography(): any;
|
|
102
|
+
getLayerCSS(layer: 'tokens' | 'primitives' | 'components' | 'utilities'): string;
|
|
103
|
+
usesEnumValue(enumGroup: string, value: any): boolean;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Generator - programmatic API to produce tokens, layered CSS and helper modules from a config.
|
|
109
|
+
* Typical usage:
|
|
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,9 +1,9 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var PDS2: {
|
|
2
2
|
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
3
3
|
dispatchEvent(event: Event): boolean;
|
|
4
4
|
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
export function validateDesign(designConfig?: {}, options?: {}): {
|
|
7
7
|
ok: boolean;
|
|
8
8
|
issues: ({
|
|
9
9
|
path: string;
|
|
@@ -19,5 +19,5 @@ declare function zt(n?: {}, e?: {}): {
|
|
|
19
19
|
context?: undefined;
|
|
20
20
|
})[];
|
|
21
21
|
};
|
|
22
|
-
export {
|
|
22
|
+
export { PDS2 as PDS };
|
|
23
23
|
//# sourceMappingURL=pds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../../public/assets/js/pds.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../../public/assets/js/pds.js"],"names":[],"mappings":"AA0jSA;;;;EAAyB;AAyKzB;;;;;;;;;;;;;;;EA+GC"}
|
|
@@ -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;
|
|
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;IAaC,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;IAED,0BAMC;IAGD,+BAyBC;IA+ND,cA2CC;;CA+4CF"}
|