@pure-ds/core 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CSS-INTELLISENSE-LIMITATION.md +98 -0
  2. package/CSS-INTELLISENSE-QUICK-REF.md +238 -0
  3. package/INTELLISENSE.md +384 -0
  4. package/LICENSE +15 -0
  5. package/custom-elements-manifest.config.js +30 -0
  6. package/custom-elements.json +2003 -0
  7. package/dist/types/index.d.ts +2 -0
  8. package/dist/types/packages/pds-configurator/src/figma-export.d.ts +13 -0
  9. package/dist/types/packages/pds-configurator/src/figma-export.d.ts.map +1 -0
  10. package/dist/types/packages/pds-configurator/src/pds-config-form.d.ts +2 -0
  11. package/dist/types/packages/pds-configurator/src/pds-config-form.d.ts.map +1 -0
  12. package/dist/types/packages/pds-configurator/src/pds-configurator.d.ts +2 -0
  13. package/dist/types/packages/pds-configurator/src/pds-configurator.d.ts.map +1 -0
  14. package/dist/types/packages/pds-configurator/src/pds-demo.d.ts +2 -0
  15. package/dist/types/packages/pds-configurator/src/pds-demo.d.ts.map +1 -0
  16. package/dist/types/pds.config.d.ts +13 -0
  17. package/dist/types/pds.config.d.ts.map +1 -0
  18. package/dist/types/pds.d.ts +408 -0
  19. package/dist/types/public/assets/js/app.d.ts +2 -0
  20. package/dist/types/public/assets/js/app.d.ts.map +1 -0
  21. package/dist/types/public/assets/js/pds.d.ts +23 -0
  22. package/dist/types/public/assets/js/pds.d.ts.map +1 -0
  23. package/dist/types/public/assets/pds/components/pds-calendar.d.ts +23 -0
  24. package/dist/types/public/assets/pds/components/pds-calendar.d.ts.map +1 -0
  25. package/dist/types/public/assets/pds/components/pds-drawer.d.ts +2 -0
  26. package/dist/types/public/assets/pds/components/pds-drawer.d.ts.map +1 -0
  27. package/dist/types/public/assets/pds/components/pds-icon.d.ts +53 -0
  28. package/dist/types/public/assets/pds/components/pds-icon.d.ts.map +1 -0
  29. package/dist/types/public/assets/pds/components/pds-jsonform.d.ts +104 -0
  30. package/dist/types/public/assets/pds/components/pds-jsonform.d.ts.map +1 -0
  31. package/dist/types/public/assets/pds/components/pds-richtext.d.ts +121 -0
  32. package/dist/types/public/assets/pds/components/pds-richtext.d.ts.map +1 -0
  33. package/dist/types/public/assets/pds/components/pds-scrollrow.d.ts +61 -0
  34. package/dist/types/public/assets/pds/components/pds-scrollrow.d.ts.map +1 -0
  35. package/dist/types/public/assets/pds/components/pds-splitpanel.d.ts +1 -0
  36. package/dist/types/public/assets/pds/components/pds-splitpanel.d.ts.map +1 -0
  37. package/dist/types/public/assets/pds/components/pds-tabstrip.d.ts +39 -0
  38. package/dist/types/public/assets/pds/components/pds-tabstrip.d.ts.map +1 -0
  39. package/dist/types/public/assets/pds/components/pds-toaster.d.ts +111 -0
  40. package/dist/types/public/assets/pds/components/pds-toaster.d.ts.map +1 -0
  41. package/dist/types/public/assets/pds/components/pds-upload.d.ts +83 -0
  42. package/dist/types/public/assets/pds/components/pds-upload.d.ts.map +1 -0
  43. package/dist/types/src/js/app.d.ts +2 -0
  44. package/dist/types/src/js/app.d.ts.map +1 -0
  45. package/dist/types/src/js/common/ask.d.ts +22 -0
  46. package/dist/types/src/js/common/ask.d.ts.map +1 -0
  47. package/dist/types/src/js/common/common.d.ts +3 -0
  48. package/dist/types/src/js/common/common.d.ts.map +1 -0
  49. package/dist/types/src/js/common/font-loader.d.ts +24 -0
  50. package/dist/types/src/js/common/font-loader.d.ts.map +1 -0
  51. package/dist/types/src/js/common/msg.d.ts +3 -0
  52. package/dist/types/src/js/common/msg.d.ts.map +1 -0
  53. package/dist/types/src/js/lit.d.ts +25 -0
  54. package/dist/types/src/js/lit.d.ts.map +1 -0
  55. package/dist/types/src/js/pds-configurator/figma-export.d.ts +13 -0
  56. package/dist/types/src/js/pds-configurator/figma-export.d.ts.map +1 -0
  57. package/dist/types/src/js/pds-configurator/pds-config-form.d.ts +2 -0
  58. package/dist/types/src/js/pds-configurator/pds-config-form.d.ts.map +1 -0
  59. package/dist/types/src/js/pds-configurator/pds-configurator.d.ts +2 -0
  60. package/dist/types/src/js/pds-configurator/pds-configurator.d.ts.map +1 -0
  61. package/dist/types/src/js/pds-configurator/pds-demo.d.ts +2 -0
  62. package/dist/types/src/js/pds-configurator/pds-demo.d.ts.map +1 -0
  63. package/dist/types/src/js/pds-core/pds-config.d.ts +758 -0
  64. package/dist/types/src/js/pds-core/pds-config.d.ts.map +1 -0
  65. package/dist/types/src/js/pds-core/pds-enhancer-metadata.d.ts +6 -0
  66. package/dist/types/src/js/pds-core/pds-enhancer-metadata.d.ts.map +1 -0
  67. package/dist/types/src/js/pds-core/pds-enhancers.d.ts +14 -0
  68. package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -0
  69. package/dist/types/src/js/pds-core/pds-enums.d.ts +87 -0
  70. package/dist/types/src/js/pds-core/pds-enums.d.ts.map +1 -0
  71. package/dist/types/src/js/pds-core/pds-generator.d.ts +741 -0
  72. package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -0
  73. package/dist/types/src/js/pds-core/pds-ontology.d.ts +48 -0
  74. package/dist/types/src/js/pds-core/pds-ontology.d.ts.map +1 -0
  75. package/dist/types/src/js/pds-core/pds-paths.d.ts +37 -0
  76. package/dist/types/src/js/pds-core/pds-paths.d.ts.map +1 -0
  77. package/dist/types/src/js/pds-core/pds-query.d.ts +102 -0
  78. package/dist/types/src/js/pds-core/pds-query.d.ts.map +1 -0
  79. package/dist/types/src/js/pds-core/pds-registry.d.ts +40 -0
  80. package/dist/types/src/js/pds-core/pds-registry.d.ts.map +1 -0
  81. package/dist/types/src/js/pds.d.ts +109 -0
  82. package/dist/types/src/js/pds.d.ts.map +1 -0
  83. package/dist/types/src/pds-core/pds-api.d.ts +31 -0
  84. package/dist/types/src/pds-core/pds-api.d.ts.map +1 -0
  85. package/package.json +104 -0
  86. package/packages/pds-cli/README.md +15 -0
  87. package/packages/pds-cli/bin/generate-css-data.js +565 -0
  88. package/packages/pds-cli/bin/generate-manifest.js +352 -0
  89. package/packages/pds-cli/bin/pds-build-icons.js +152 -0
  90. package/packages/pds-cli/bin/pds-dx.js +114 -0
  91. package/packages/pds-cli/bin/pds-static.js +556 -0
  92. package/packages/pds-cli/bin/pds.js +127 -0
  93. package/packages/pds-cli/bin/postinstall.js +380 -0
  94. package/packages/pds-cli/bin/sync-assets.js +252 -0
  95. package/packages/pds-cli/lib/asset-roots.js +47 -0
  96. package/packages/pds-cli/lib/fs-writer.js +75 -0
  97. package/pds.css-data.json +5 -0
  98. package/pds.html-data.json +5 -0
  99. package/public/assets/js/app.js +5719 -0
  100. package/public/assets/js/lit.js +131 -0
  101. package/public/assets/js/pds.js +3423 -0
  102. package/public/assets/pds/components/pds-calendar.js +837 -0
  103. package/public/assets/pds/components/pds-drawer.js +857 -0
  104. package/public/assets/pds/components/pds-icon.js +338 -0
  105. package/public/assets/pds/components/pds-jsonform.js +1775 -0
  106. package/public/assets/pds/components/pds-richtext.js +1035 -0
  107. package/public/assets/pds/components/pds-scrollrow.js +331 -0
  108. package/public/assets/pds/components/pds-splitpanel.js +401 -0
  109. package/public/assets/pds/components/pds-tabstrip.js +251 -0
  110. package/public/assets/pds/components/pds-toaster.js +446 -0
  111. package/public/assets/pds/components/pds-upload.js +657 -0
  112. package/public/assets/pds/custom-elements.json +2003 -0
  113. package/public/assets/pds/icons/pds-icons.svg +498 -0
  114. package/public/assets/pds/pds-css-complete.json +1861 -0
  115. package/public/assets/pds/pds.css-data.json +2152 -0
  116. package/public/assets/pds/vscode-custom-data.json +824 -0
  117. package/readme.md +1870 -0
  118. package/src/js/pds-core/pds-config.js +1162 -0
  119. package/src/js/pds-core/pds-enhancer-metadata.js +75 -0
  120. package/src/js/pds-core/pds-enhancers.js +357 -0
  121. package/src/js/pds-core/pds-enums.js +86 -0
  122. package/src/js/pds-core/pds-generator.js +5317 -0
  123. package/src/js/pds-core/pds-ontology.js +256 -0
  124. package/src/js/pds-core/pds-paths.js +109 -0
  125. package/src/js/pds-core/pds-query.js +571 -0
  126. package/src/js/pds-core/pds-registry.js +129 -0
  127. package/src/js/pds-core/pds.d.ts +129 -0
  128. package/src/js/pds.d.ts +408 -0
  129. package/src/js/pds.js +1579 -0
@@ -0,0 +1,129 @@
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
+ /**
36
+ * Generator - programmatic API to produce tokens, layered CSS and helper modules from a config.
37
+ * Typical usage:
38
+ * const g = new PDS.Generator({ example: true });
39
+ * // tokens may be returned synchronously or via a Promise
40
+ * const tokens = await g.generateTokens?.();
41
+ * const css = await g.generateCSS?.();
42
+ */
43
+ export class Generator {
44
+ constructor(options?: any);
45
+ /** runtime options / config passed to the generator */
46
+ options: any;
47
+ /** generated token object */
48
+ tokens: Record<string, any>;
49
+ /** concatenated CSS (layered) */
50
+ css: string;
51
+ /** Generate the token map (may be async in some implementations) */
52
+ generateTokens?(): Record<string, any> | Promise<Record<string, any>>;
53
+ /** Generate the CSS string (may be async) */
54
+ generateCSS?(): string | Promise<string>;
55
+ }
56
+
57
+ /** Public runtime surface exported as `PDS` */
58
+ export interface PDSEventMap {
59
+ 'pds:ready': CustomEvent<{ mode: 'live' | 'static'; generator?: Generator; config: any; theme: string; autoDefiner?: any }>;
60
+ 'pds:error': CustomEvent<{ error: any }>;
61
+ 'pds:theme:changed': CustomEvent<{ theme: string; requested?: string; source: 'system' | 'programmatic' }>;
62
+ 'pds:design:updated': CustomEvent<{ config: any; designer?: any }>;
63
+ 'pds:design:field:changed': CustomEvent<{ field: string; config: any }>;
64
+ 'pds:inspector:mode:changed': CustomEvent<{ active: boolean }>;
65
+ 'pds:inspector:deactivate': CustomEvent<{}>;
66
+ 'pds:docs:view': CustomEvent<{ file: string }>;
67
+ }
68
+
69
+ export const PDS: {
70
+ /** Generator class to produce design-system artifacts programmatically. */
71
+ Generator: typeof Generator;
72
+ /** Registry singleton to query/adopt styles and control live/static behavior. */
73
+ registry: PDSRegistry;
74
+ /** Presets keyed by id (lowercased). Includes a 'default' preset derived from the baseline config. */
75
+ presets: Record<string, any>;
76
+ /** Ontology metadata about components (shapes vary by implementation) */
77
+ ontology: any;
78
+ /** Adopt multiple named layers into a ShadowRoot. See `LAYER-ARCHITECTURE.md` for layer ordering. */
79
+ adoptLayers: (shadowRoot: ShadowRoot, layers?: string[], additionalSheets?: CSSStyleSheet[]) => Promise<void>;
80
+ /** Convenience to adopt only primitives/styles commonly needed by components. */
81
+ adoptPrimitives: (shadowRoot: ShadowRoot, additionalSheets?: CSSStyleSheet[]) => Promise<void>;
82
+ /** Create a constructable stylesheet from a CSS string. May throw on invalid CSS in some browsers. */
83
+ createStylesheet: (css: string) => CSSStyleSheet;
84
+ /** Utility to inspect whether runtime is running in live mode. */
85
+ isLiveMode: () => boolean;
86
+ /** Find a component definition for a given DOM element, or null if not matched. */
87
+ findComponentForElement: (el: Element) => ComponentDef | null;
88
+ /** Primary unified entry point to start PDS in live or static mode. Default mode is 'live'. */
89
+ start: (config: {
90
+ mode?: 'live' | 'static';
91
+ preset?: string;
92
+ design?: any;
93
+ autoDefine?: {
94
+ baseURL?: string;
95
+ predefine?: string[];
96
+ mapper?: (tag: string) => string | undefined | null | false;
97
+ scanExisting?: boolean;
98
+ observeShadows?: boolean;
99
+ patchAttachShadow?: boolean;
100
+ debounceMs?: number;
101
+ onError?: (tag: string, err: any) => void;
102
+ };
103
+ applyGlobalStyles?: boolean;
104
+ manageTheme?: boolean;
105
+ themeStorageKey?: string;
106
+ // live-only
107
+ preloadStyles?: boolean;
108
+ criticalLayers?: string[];
109
+ // static-only
110
+ staticPaths?: Record<string, string>;
111
+ enhancers?: Array<any>;
112
+ }) => Promise<{ generator?: Generator; config: any; theme: string; autoDefiner?: any }>;
113
+ /** Change the current theme programmatically. Updates localStorage, data-theme attribute, and regenerates styles. */
114
+ setTheme: (theme: 'light' | 'dark' | 'system', options?: {
115
+ storageKey?: string;
116
+ persist?: boolean;
117
+ }) => Promise<string>;
118
+ /** Preload minimal CSS to prevent flash of unstyled content. Call before DOM content renders. */
119
+ preloadCritical: (config: any, options?: {
120
+ theme?: string;
121
+ layers?: string[];
122
+ }) => void;
123
+ /** EventTarget API (strongly typed for common PDS events). */
124
+ addEventListener: <K extends keyof PDSEventMap>(type: K, listener: (ev: PDSEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void;
125
+ removeEventListener: <K extends keyof PDSEventMap>(type: K, listener: (ev: PDSEventMap[K]) => any, options?: boolean | EventListenerOptions) => void;
126
+ dispatchEvent: (event: PDSEventMap[keyof PDSEventMap] | Event) => boolean;
127
+ };
128
+
129
+ export { PDS as default };
@@ -0,0 +1,408 @@
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
+ }