@pure-ds/core 0.5.6 β 0.5.7
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/INTELLISENSE.md +3 -3
- package/package.json +7 -5
- package/packages/pds-cli/bin/pds-bootstrap.js +291 -0
- package/packages/pds-cli/bin/pds-static.js +1 -1
- package/packages/pds-cli/bin/postinstall.mjs +23 -15
- package/packages/pds-cli/bin/sync-assets.js +1 -1
- package/public/assets/js/app.js +2 -2
- package/public/assets/js/pds-manager.js +1 -1
- package/public/assets/js/pds.js +3 -3
- package/public/assets/pds/vscode-custom-data.json +4 -4
- package/readme.md +35 -21
- package/src/js/pds-core/pds-registry.js +1 -1
- package/src/js/pds.js +1 -1
package/INTELLISENSE.md
CHANGED
|
@@ -20,14 +20,14 @@ Pure Design System provides comprehensive IntelliSense support for both HTML and
|
|
|
20
20
|
|
|
21
21
|
## π¦ Generation
|
|
22
22
|
|
|
23
|
-
IntelliSense data is automatically generated when you
|
|
23
|
+
IntelliSense data is automatically generated when you build PDS assets:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# Generate all IntelliSense data (recommended)
|
|
27
27
|
npm run pds:dx
|
|
28
28
|
|
|
29
|
-
# Or as part of full
|
|
30
|
-
npm run pds:
|
|
29
|
+
# Or as part of full build
|
|
30
|
+
npm run pds:build
|
|
31
31
|
|
|
32
32
|
# Or generate individually
|
|
33
33
|
npm run pds:manifest # HTML IntelliSense only
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure-ds/core",
|
|
3
3
|
"shortname": "pds",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.7",
|
|
5
5
|
"description": "Pure Design System - Why develop a Design System when you can generate one?",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"module": "./public/assets/js/pds.js",
|
|
27
27
|
"types": "./dist/types/pds.d.ts",
|
|
28
28
|
"bin": {
|
|
29
|
-
"pds-
|
|
29
|
+
"pds-build": "packages/pds-cli/bin/pds-static.js",
|
|
30
30
|
"pds-sync-assets": "packages/pds-cli/bin/sync-assets.js",
|
|
31
31
|
"pds-build-icons": "packages/pds-cli/bin/pds-build-icons.js",
|
|
32
32
|
"pds-setup-copilot": "packages/pds-cli/bin/pds-setup-copilot.js",
|
|
33
|
-
"pds-init-config": "packages/pds-cli/bin/pds-init-config.js"
|
|
33
|
+
"pds-init-config": "packages/pds-cli/bin/pds-init-config.js",
|
|
34
|
+
"pds-bootstrap": "packages/pds-cli/bin/pds-bootstrap.js"
|
|
34
35
|
},
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
@@ -75,9 +76,10 @@
|
|
|
75
76
|
"build": "node esbuild-build.js",
|
|
76
77
|
"types": "tsc -p tsconfig.json && node scripts/sync-types.mjs",
|
|
77
78
|
"postinstall": "node packages/pds-cli/bin/postinstall.mjs",
|
|
78
|
-
"prepds:
|
|
79
|
-
"pds:
|
|
79
|
+
"prepds:build": "npm run types",
|
|
80
|
+
"pds:build": "node packages/pds-cli/bin/pds-static.js",
|
|
80
81
|
"pds:build-icons": "node packages/pds-cli/bin/pds-build-icons.js",
|
|
82
|
+
"pds:bootstrap": "node packages/pds-cli/bin/pds-bootstrap.js",
|
|
81
83
|
"pds:manifest": "node packages/pds-cli/bin/generate-manifest.js",
|
|
82
84
|
"pds:css-data": "node packages/pds-cli/bin/generate-css-data.js",
|
|
83
85
|
"pds:dx": "node packages/pds-cli/bin/pds-dx.js",
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFile, writeFile, mkdir, access } from 'fs/promises';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
|
|
7
|
+
const projectRoot = process.cwd();
|
|
8
|
+
|
|
9
|
+
function log(message) {
|
|
10
|
+
console.log(message);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function ensureDir(dirPath) {
|
|
14
|
+
await mkdir(dirPath, { recursive: true });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function writeFileIfMissing(filePath, content) {
|
|
18
|
+
try {
|
|
19
|
+
await access(filePath);
|
|
20
|
+
log(`βͺοΈ Skipping existing ${path.relative(projectRoot, filePath)}`);
|
|
21
|
+
return false;
|
|
22
|
+
} catch {
|
|
23
|
+
await ensureDir(path.dirname(filePath));
|
|
24
|
+
await writeFile(filePath, content, 'utf8');
|
|
25
|
+
log(`β
Created ${path.relative(projectRoot, filePath)}`);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getNpmCommand() {
|
|
31
|
+
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function readPackageJson() {
|
|
35
|
+
const pkgPath = path.join(projectRoot, 'package.json');
|
|
36
|
+
const raw = await readFile(pkgPath, 'utf8');
|
|
37
|
+
return { pkgPath, pkg: JSON.parse(raw) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function writePackageJson(pkgPath, pkg) {
|
|
41
|
+
await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function buildIndexHtml() {
|
|
45
|
+
return `<!doctype html>
|
|
46
|
+
<html lang="en">
|
|
47
|
+
<head>
|
|
48
|
+
<meta charset="UTF-8" />
|
|
49
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
50
|
+
<title>Pure Design System</title>
|
|
51
|
+
|
|
52
|
+
<!-- PDS Styles -->
|
|
53
|
+
<link rel="stylesheet" href="/assets/css/app.css" />
|
|
54
|
+
|
|
55
|
+
<!-- Import Map for Lit components -->
|
|
56
|
+
<script type="importmap">
|
|
57
|
+
{
|
|
58
|
+
"imports": {
|
|
59
|
+
"#pds/lit": "/assets/js/lit.js"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<!-- App Script -->
|
|
65
|
+
<script type="module" src="/assets/js/app.js" defer></script>
|
|
66
|
+
</head>
|
|
67
|
+
|
|
68
|
+
<body class="container">
|
|
69
|
+
<header class="stack-sm">
|
|
70
|
+
<p class="badge">Pure Design System</p>
|
|
71
|
+
<h1>Design systems, generated.</h1>
|
|
72
|
+
<p class="text-muted">This starter is ready for your custom tokens, components, and brand.</p>
|
|
73
|
+
</header>
|
|
74
|
+
|
|
75
|
+
<main></main>
|
|
76
|
+
|
|
77
|
+
<footer class="text-sm text-muted">
|
|
78
|
+
<small>© 2026 Pure Design System</small>
|
|
79
|
+
</footer>
|
|
80
|
+
</body>
|
|
81
|
+
</html>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function buildAppCss() {
|
|
86
|
+
return `html:not(.pds-ready) {
|
|
87
|
+
opacity: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main {
|
|
91
|
+
margin-top: var(--spacing-8);
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function buildWcHome() {
|
|
97
|
+
return `customElements.define(
|
|
98
|
+
"wc-home",
|
|
99
|
+
class extends HTMLElement {
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
this.innerHTML = /*html*/ \`
|
|
102
|
+
<article class="card text-center border-gradient surface-translucent-50">
|
|
103
|
+
<header>
|
|
104
|
+
<h1>Welcome to Pure Design System</h1>
|
|
105
|
+
<h2>Beautiful backgrounds generated from your color palette</h2>
|
|
106
|
+
</header>
|
|
107
|
+
<div class="stack-lg">
|
|
108
|
+
<p>
|
|
109
|
+
This is a demo of a web component using Pure Design System.
|
|
110
|
+
It showcases the design tokens, components, and utilities provided by PDS.
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
|
+
<nav class="flex justify-center gap-sm">
|
|
114
|
+
<button class="btn-primary btn-lg" data-enhanced-btn-working="true">
|
|
115
|
+
Get Started
|
|
116
|
+
</button>
|
|
117
|
+
<button class="btn-secondary btn-lg" data-enhanced-btn-working="true">
|
|
118
|
+
Learn More
|
|
119
|
+
</button>
|
|
120
|
+
</nav>
|
|
121
|
+
</article>
|
|
122
|
+
\`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function buildAppJs() {
|
|
130
|
+
return `import { PDS } from '@pure-ds/core';
|
|
131
|
+
import { config } from '../../pds.config.js';
|
|
132
|
+
|
|
133
|
+
await PDS.start(config);
|
|
134
|
+
PDS.theme = 'light';
|
|
135
|
+
|
|
136
|
+
await import('/assets/wc/wc-home.js');
|
|
137
|
+
|
|
138
|
+
const main = document.querySelector('main');
|
|
139
|
+
if (main && !main.querySelector('wc-home')) {
|
|
140
|
+
main.innerHTML = '<wc-home></wc-home>';
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function buildEsbuildDevCjs() {
|
|
146
|
+
return `const esbuild = require('esbuild');
|
|
147
|
+
|
|
148
|
+
async function start() {
|
|
149
|
+
const ctx = await esbuild.context({
|
|
150
|
+
entryPoints: ['src/js/app.js'],
|
|
151
|
+
outdir: 'public/assets/js',
|
|
152
|
+
bundle: true,
|
|
153
|
+
format: 'esm',
|
|
154
|
+
sourcemap: true,
|
|
155
|
+
publicPath: '/assets/js',
|
|
156
|
+
external: ['/assets/wc/*'],
|
|
157
|
+
logLevel: 'info'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
await ctx.watch();
|
|
161
|
+
const { host, port } = await ctx.serve({ servedir: 'public', port: 4173 });
|
|
162
|
+
console.log('Dev server running at http://' + host + ':' + port);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
start().catch((err) => {
|
|
166
|
+
console.error(err);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
});
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function buildEsbuildDevEsm() {
|
|
173
|
+
return `import esbuild from 'esbuild';
|
|
174
|
+
|
|
175
|
+
const ctx = await esbuild.context({
|
|
176
|
+
entryPoints: ['src/js/app.js'],
|
|
177
|
+
outdir: 'public/assets/js',
|
|
178
|
+
bundle: true,
|
|
179
|
+
format: 'esm',
|
|
180
|
+
sourcemap: true,
|
|
181
|
+
publicPath: '/assets/js',
|
|
182
|
+
external: ['/assets/wc/*'],
|
|
183
|
+
logLevel: 'info'
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
await ctx.watch();
|
|
187
|
+
const { host, port } = await ctx.serve({ servedir: 'public', port: 4173 });
|
|
188
|
+
console.log('Dev server running at http://' + host + ':' + port);
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async function ensurePackageScripts(pkg, pkgPath) {
|
|
193
|
+
pkg.scripts = pkg.scripts || {};
|
|
194
|
+
let changed = false;
|
|
195
|
+
|
|
196
|
+
if (!pkg.scripts.dev) {
|
|
197
|
+
pkg.scripts.dev = 'node esbuild-dev.js';
|
|
198
|
+
changed = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (!pkg.scripts['pds:bootstrap']) {
|
|
202
|
+
pkg.scripts['pds:bootstrap'] = 'pds-bootstrap';
|
|
203
|
+
changed = true;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (changed) {
|
|
207
|
+
await writePackageJson(pkgPath, pkg);
|
|
208
|
+
log('β
Updated package.json scripts');
|
|
209
|
+
} else {
|
|
210
|
+
log('βͺοΈ package.json scripts already configured');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function ensureEsbuildDependency(pkg, pkgPath) {
|
|
215
|
+
const version = '^0.19.0';
|
|
216
|
+
const hasDev = pkg.devDependencies && pkg.devDependencies.esbuild;
|
|
217
|
+
const hasDep = pkg.dependencies && pkg.dependencies.esbuild;
|
|
218
|
+
|
|
219
|
+
if (hasDev || hasDep) {
|
|
220
|
+
log('βͺοΈ esbuild already installed');
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const npmCmd = getNpmCommand();
|
|
225
|
+
log('π¦ Installing esbuild...');
|
|
226
|
+
|
|
227
|
+
await new Promise((resolve, reject) => {
|
|
228
|
+
const child = spawn(npmCmd, ['install', '--save-dev', `esbuild@${version}`], {
|
|
229
|
+
cwd: projectRoot,
|
|
230
|
+
stdio: 'inherit',
|
|
231
|
+
shell: true
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
child.on('exit', (code) => {
|
|
235
|
+
if (code === 0) resolve();
|
|
236
|
+
else reject(new Error(`npm install failed with code ${code}`));
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
const updated = JSON.parse(await readFile(pkgPath, 'utf8'));
|
|
241
|
+
Object.assign(pkg, updated);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function runDevServer() {
|
|
246
|
+
const npmCmd = getNpmCommand();
|
|
247
|
+
log('π Starting dev server...');
|
|
248
|
+
|
|
249
|
+
await new Promise((resolve, reject) => {
|
|
250
|
+
const child = spawn(npmCmd, ['run', 'dev'], {
|
|
251
|
+
cwd: projectRoot,
|
|
252
|
+
stdio: 'inherit',
|
|
253
|
+
shell: true
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
child.on('exit', (code) => {
|
|
257
|
+
if (code === 0) resolve();
|
|
258
|
+
else reject(new Error(`npm run dev exited with code ${code}`));
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function main() {
|
|
264
|
+
log('\nβ‘ PDS Bootstrap\n');
|
|
265
|
+
|
|
266
|
+
const { pkgPath, pkg } = await readPackageJson();
|
|
267
|
+
const isModule = pkg.type === 'module';
|
|
268
|
+
|
|
269
|
+
await ensurePackageScripts(pkg, pkgPath);
|
|
270
|
+
await ensureEsbuildDependency(pkg, pkgPath);
|
|
271
|
+
|
|
272
|
+
await writeFileIfMissing(path.join(projectRoot, 'public', 'index.html'), buildIndexHtml());
|
|
273
|
+
await writeFileIfMissing(path.join(projectRoot, 'public', 'assets', 'css', 'app.css'), buildAppCss());
|
|
274
|
+
await writeFileIfMissing(path.join(projectRoot, 'src', 'js', 'app.js'), buildAppJs());
|
|
275
|
+
await writeFileIfMissing(
|
|
276
|
+
path.join(projectRoot, 'public', 'assets', 'wc', 'wc-home.js'),
|
|
277
|
+
buildWcHome()
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
const esbuildDevPath = path.join(projectRoot, 'esbuild-dev.js');
|
|
281
|
+
const esbuildDevContent = isModule ? buildEsbuildDevEsm() : buildEsbuildDevCjs();
|
|
282
|
+
await writeFileIfMissing(esbuildDevPath, esbuildDevContent);
|
|
283
|
+
|
|
284
|
+
log('\nβ
Bootstrap files ready.\n');
|
|
285
|
+
await runDevServer();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
main().catch((err) => {
|
|
289
|
+
console.error('β Bootstrap failed:', err?.message || err);
|
|
290
|
+
process.exit(1);
|
|
291
|
+
});
|
|
@@ -601,7 +601,7 @@ if (process.argv[1]) {
|
|
|
601
601
|
const scriptPath = fileURLToPath(import.meta.url);
|
|
602
602
|
const argPath = process.argv[1];
|
|
603
603
|
// Check if this is the main module being executed
|
|
604
|
-
if (argPath === scriptPath || argPath.endsWith('pds-static.js') || argPath.endsWith('pds-
|
|
604
|
+
if (argPath === scriptPath || argPath.endsWith('pds-static.js') || argPath.endsWith('pds-build')) {
|
|
605
605
|
main();
|
|
606
606
|
}
|
|
607
607
|
}
|
|
@@ -110,9 +110,9 @@ async function findConsumerRoot() {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Ensure consumer package.json contains a handy
|
|
113
|
+
* Ensure consumer package.json contains a handy build script
|
|
114
114
|
*/
|
|
115
|
-
async function
|
|
115
|
+
async function ensureBuildScript(consumerRoot) {
|
|
116
116
|
try {
|
|
117
117
|
const consumerPkgPath = path.join(consumerRoot, 'package.json');
|
|
118
118
|
const consumerPkgRaw = await readFile(consumerPkgPath, 'utf8');
|
|
@@ -120,8 +120,8 @@ async function ensureExportScript(consumerRoot) {
|
|
|
120
120
|
|
|
121
121
|
consumerPkg.scripts = consumerPkg.scripts || {};
|
|
122
122
|
|
|
123
|
-
const desiredScriptName = 'pds:
|
|
124
|
-
const desiredScriptCmd = 'pds-
|
|
123
|
+
const desiredScriptName = 'pds:build';
|
|
124
|
+
const desiredScriptCmd = 'pds-build';
|
|
125
125
|
|
|
126
126
|
if (!consumerPkg.scripts[desiredScriptName]) {
|
|
127
127
|
consumerPkg.scripts[desiredScriptName] = desiredScriptCmd;
|
|
@@ -131,7 +131,7 @@ async function ensureExportScript(consumerRoot) {
|
|
|
131
131
|
console.log(`π§ Script "${desiredScriptName}" already present in consumer package.json`);
|
|
132
132
|
}
|
|
133
133
|
} catch (e) {
|
|
134
|
-
console.warn('β οΈ Could not ensure pds:
|
|
134
|
+
console.warn('β οΈ Could not ensure pds:build script in consumer package.json:', e.message);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -418,8 +418,8 @@ async function copyPdsAssets() {
|
|
|
418
418
|
// Copy Copilot instructions to consumer project
|
|
419
419
|
await copyCopilotInstructions(consumerRoot);
|
|
420
420
|
|
|
421
|
-
// Proactively add
|
|
422
|
-
await
|
|
421
|
+
// Proactively add build & build-icons scripts to consumer package.json (still helpful)
|
|
422
|
+
await ensureBuildScript(consumerRoot);
|
|
423
423
|
try {
|
|
424
424
|
const consumerPkgPath = path.join(consumerRoot, 'package.json');
|
|
425
425
|
const pkgRaw = await readFile(consumerPkgPath, 'utf8');
|
|
@@ -432,26 +432,34 @@ async function copyPdsAssets() {
|
|
|
432
432
|
await writeFile(consumerPkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
|
433
433
|
console.log(`π§© Added "${buildIconsName}" script to consumer package.json`);
|
|
434
434
|
}
|
|
435
|
+
|
|
436
|
+
const bootstrapName = 'pds:bootstrap';
|
|
437
|
+
const bootstrapCmd = 'pds-bootstrap';
|
|
438
|
+
if (!pkgJson.scripts[bootstrapName]) {
|
|
439
|
+
pkgJson.scripts[bootstrapName] = bootstrapCmd;
|
|
440
|
+
await writeFile(consumerPkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
|
441
|
+
console.log(`π§© Added "${bootstrapName}" script to consumer package.json`);
|
|
442
|
+
}
|
|
435
443
|
} catch (e) {
|
|
436
444
|
console.warn('β οΈ Could not ensure pds:build-icons script in consumer package.json:', e?.message || e);
|
|
437
445
|
}
|
|
438
446
|
|
|
439
447
|
// NEW BEHAVIOR: We no longer copy web components automatically to /auto-define/.
|
|
440
|
-
// Reason: static
|
|
448
|
+
// Reason: static build (pds:build) is now the single source of truth for placing
|
|
441
449
|
// components under [static.root]/components/ (see pds.config.js). This reduces
|
|
442
450
|
// side-effects during npm install and avoids stale/legacy /auto-define/ layout.
|
|
443
451
|
console.log('π« Skipping legacy auto-copy of components to ./public/auto-define/.');
|
|
444
452
|
|
|
445
|
-
// Auto-run pds:
|
|
453
|
+
// Auto-run pds:build by default (can be disabled with PDS_SKIP_EXPORT)
|
|
446
454
|
if (
|
|
447
455
|
process.env.PDS_SKIP_EXPORT === '1' ||
|
|
448
456
|
process.env.PDS_SKIP_EXPORT === 'true' ||
|
|
449
457
|
process.env.npm_config_pds_skip_export === 'true'
|
|
450
458
|
) {
|
|
451
|
-
console.log('βοΈ Skipping pds:
|
|
452
|
-
console.log('π¦ To generate static assets run: npm run pds:
|
|
459
|
+
console.log('βοΈ Skipping pds:build (PDS_SKIP_EXPORT set)');
|
|
460
|
+
console.log('π¦ To generate static assets run: npm run pds:build');
|
|
453
461
|
} else {
|
|
454
|
-
console.log('π Running pds:
|
|
462
|
+
console.log('π Running pds:build automatically...');
|
|
455
463
|
const staticModuleUrl = pathToFileURL(path.join(__dirname, 'pds-static.js')).href;
|
|
456
464
|
const previousEnv = {
|
|
457
465
|
PDS_POSTINSTALL: process.env.PDS_POSTINSTALL,
|
|
@@ -467,8 +475,8 @@ async function copyPdsAssets() {
|
|
|
467
475
|
const { runPdsStatic } = await import(staticModuleUrl);
|
|
468
476
|
await runPdsStatic({ cwd: consumerRoot });
|
|
469
477
|
} catch (e) {
|
|
470
|
-
console.error('β Auto-
|
|
471
|
-
console.log('π‘ You can run it manually: npm run pds:
|
|
478
|
+
console.error('β Auto-build failed:', e?.message || e);
|
|
479
|
+
console.log('π‘ You can run it manually: npm run pds:build');
|
|
472
480
|
} finally {
|
|
473
481
|
if (previousEnv.PDS_POSTINSTALL === undefined) {
|
|
474
482
|
delete process.env.PDS_POSTINSTALL;
|
|
@@ -510,7 +518,7 @@ async function copyPdsAssets() {
|
|
|
510
518
|
}
|
|
511
519
|
} catch (error) {
|
|
512
520
|
console.error('β PDS postinstall failed (non-fatal):', error.message);
|
|
513
|
-
console.log('π‘ Static
|
|
521
|
+
console.log('π‘ Static build still available via: npm run pds:build');
|
|
514
522
|
process.exitCode = 1;
|
|
515
523
|
}
|
|
516
524
|
}
|
|
@@ -199,7 +199,7 @@ async function syncAssets(options = {}) {
|
|
|
199
199
|
}
|
|
200
200
|
await syncDirectory(autoDefineSource, autoDefineTarget, 'components/');
|
|
201
201
|
|
|
202
|
-
// Note: icons are not synced in this flow; use pds:
|
|
202
|
+
// Note: icons are not synced in this flow; use pds:build if needed
|
|
203
203
|
|
|
204
204
|
// Update tracking file
|
|
205
205
|
if (!dryRun) {
|
package/public/assets/js/app.js
CHANGED
|
@@ -3168,7 +3168,7 @@ export const ${e} = new CSSStyleSheet();
|
|
|
3168
3168
|
${e}.replaceSync(\`${a}\`);
|
|
3169
3169
|
|
|
3170
3170
|
export const ${e}CSS = \`${a}\`;
|
|
3171
|
-
`}};function Ne(r={},e={}){let t=Number(e.minContrast||4.5),a=n=>{let c=String(n||"").replace("#",""),p=c.length===3?c.split("").map(l=>l+l).join(""):c,d=parseInt(p||"0",16);return{r:d>>16&255,g:d>>8&255,b:d&255}},o=n=>{let{r:c,g:p,b:d}=a(n),l=[c/255,p/255,d/255].map(h=>h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4));return .2126*l[0]+.7152*l[1]+.0722*l[2]},i=(n,c)=>{if(!n||!c)return 0;let p=o(n),d=o(c),l=Math.max(p,d),h=Math.min(p,d);return(l+.05)/(h+.05)},s=[];try{let c=new ae({design:structuredClone(r)}).tokens.colors,p={surfaceBg:c.surface?.base,surfaceText:c.gray?.[900]||"#000000",primaryFill:c.interactive?.light?.fill||c.primary?.[600],primaryText:c.interactive?.light?.text||c.primary?.[600]},d=i(p.primaryFill,"#ffffff");d<t&&s.push({path:"/colors/primary",message:`Primary button contrast too low in light theme (${d.toFixed(2)} < ${t}). Choose a darker primary.`,ratio:d,min:t,context:"light/btn-primary"});let l=i(p.surfaceBg,p.surfaceText);l<t&&s.push({path:"/colors/background",message:`Base text contrast on surface (light) is too low (${l.toFixed(2)} < ${t}). Adjust background or secondary (gray).`,ratio:l,min:t,context:"light/surface-text"});let h=i(p.primaryText,p.surfaceBg);h<t&&s.push({path:"/colors/primary",message:`Primary text on surface is too low for outline/link styles (light) (${h.toFixed(2)} < ${t}). Choose a darker primary or lighter surface.`,ratio:h,min:t,context:"light/outline"});let g=c.dark;if(g){let y={surfaceBg:g.surface?.base||c.surface?.inverse,primaryFill:c.interactive?.dark?.fill||g.primary?.[600],primaryText:c.interactive?.dark?.text||g.primary?.[600]},k=i(y.primaryFill,"#ffffff");k<t&&s.push({path:"/colors/darkMode/primary",message:`Primary button contrast too low in dark theme (${k.toFixed(2)} < ${t}). Override darkMode.primary or pick a brighter hue.`,ratio:k,min:t,context:"dark/btn-primary"});let f=i(y.primaryText,y.surfaceBg);f<t&&s.push({path:"/colors/darkMode/primary",message:`Primary text on surface is too low for outline/link styles (dark) (${f.toFixed(2)} < ${t}). Override darkMode.primary/background.`,ratio:f,min:t,context:"dark/outline"})}}catch(n){s.push({path:"/",message:`Validation failed: ${String(n?.message||n)}`,ratio:0,min:0})}return{ok:s.length===0,issues:s}}var it=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(t){console.error(`[PDS Registry] Failed to load static ${e}:`,t),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:
|
|
3171
|
+
`}};function Ne(r={},e={}){let t=Number(e.minContrast||4.5),a=n=>{let c=String(n||"").replace("#",""),p=c.length===3?c.split("").map(l=>l+l).join(""):c,d=parseInt(p||"0",16);return{r:d>>16&255,g:d>>8&255,b:d&255}},o=n=>{let{r:c,g:p,b:d}=a(n),l=[c/255,p/255,d/255].map(h=>h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4));return .2126*l[0]+.7152*l[1]+.0722*l[2]},i=(n,c)=>{if(!n||!c)return 0;let p=o(n),d=o(c),l=Math.max(p,d),h=Math.min(p,d);return(l+.05)/(h+.05)},s=[];try{let c=new ae({design:structuredClone(r)}).tokens.colors,p={surfaceBg:c.surface?.base,surfaceText:c.gray?.[900]||"#000000",primaryFill:c.interactive?.light?.fill||c.primary?.[600],primaryText:c.interactive?.light?.text||c.primary?.[600]},d=i(p.primaryFill,"#ffffff");d<t&&s.push({path:"/colors/primary",message:`Primary button contrast too low in light theme (${d.toFixed(2)} < ${t}). Choose a darker primary.`,ratio:d,min:t,context:"light/btn-primary"});let l=i(p.surfaceBg,p.surfaceText);l<t&&s.push({path:"/colors/background",message:`Base text contrast on surface (light) is too low (${l.toFixed(2)} < ${t}). Adjust background or secondary (gray).`,ratio:l,min:t,context:"light/surface-text"});let h=i(p.primaryText,p.surfaceBg);h<t&&s.push({path:"/colors/primary",message:`Primary text on surface is too low for outline/link styles (light) (${h.toFixed(2)} < ${t}). Choose a darker primary or lighter surface.`,ratio:h,min:t,context:"light/outline"});let g=c.dark;if(g){let y={surfaceBg:g.surface?.base||c.surface?.inverse,primaryFill:c.interactive?.dark?.fill||g.primary?.[600],primaryText:c.interactive?.dark?.text||g.primary?.[600]},k=i(y.primaryFill,"#ffffff");k<t&&s.push({path:"/colors/darkMode/primary",message:`Primary button contrast too low in dark theme (${k.toFixed(2)} < ${t}). Override darkMode.primary or pick a brighter hue.`,ratio:k,min:t,context:"dark/btn-primary"});let f=i(y.primaryText,y.surfaceBg);f<t&&s.push({path:"/colors/darkMode/primary",message:`Primary text on surface is too low for outline/link styles (dark) (${f.toFixed(2)} < ${t}). Override darkMode.primary/background.`,ratio:f,min:t,context:"dark/outline"})}}catch(n){s.push({path:"/",message:`Validation failed: ${String(n?.message||n)}`,ratio:0,min:0})}return{ok:s.length===0,issues:s}}var it=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(t){console.error(`[PDS Registry] Failed to load static ${e}:`,t),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let a=new CSSStyleSheet;return a.replaceSync("/* Failed to load "+e+" */"),a}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},ie=new it;function jr(r){try{if(typeof document>"u")return;if(typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype){let a=new CSSStyleSheet;a.replaceSync(r),a._pds=!0;let o=(document.adoptedStyleSheets||[]).filter(i=>i._pds!==!0);document.adoptedStyleSheets=[...o,a];return}let e="pds-runtime-stylesheet",t=document.getElementById(e);if(!t){t=document.createElement("style"),t.id=e,t.type="text/css";let a=document.head||document.getElementsByTagName("head")[0];a?a.appendChild(t):document.documentElement.appendChild(t)}t.textContent=r}catch(e){console.warn("installRuntimeStyles failed:",e)}}function Wt(r){let e=r;if(!e||typeof e!="object"){console.error("[Runtime] applyStyles requires an explicit generator instance in live mode");return}let t=e.layeredCSS||e.css||"";if(!t){e.options?.log?.("warn","[Runtime] No CSS available on generator to apply");return}jr(t)}async function Ut(r,e=[],t=null){try{let a=t?.primitivesStylesheet?t.primitivesStylesheet:await ie.getStylesheet("primitives");r.adoptedStyleSheets=[a,...e]}catch(a){let o=r.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt primitives:`,a),r.adoptedStyleSheets=e}}async function qt(r,e=["primitives"],t=[],a=null){try{let i=(await Promise.all(e.map(async s=>{if(a)switch(s){case"tokens":return a.tokensStylesheet;case"primitives":return a.primitivesStylesheet;case"components":return a.componentsStylesheet;case"utilities":return a.utilitiesStylesheet;default:break}return ie.getStylesheet(s)}))).filter(s=>s!==null);r.adoptedStyleSheets=[...i,...t]}catch(o){let i=r.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${i}> failed to adopt layers:`,o),r.adoptedStyleSheets=t}}function Gt(r){let e=new CSSStyleSheet;return e.replaceSync(r),e}var Be={mode:"live",preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(r,e,...t){console[r](e,...t)}};async function Vt(r,e={}){return e={...{title:"Confirm",type:"confirm",buttons:{ok:{name:"OK",primary:!0},cancel:{name:"Cancel",cancel:!0}}},...e},new Promise(a=>{let o=document.createElement("dialog");Be.options?.liquidGlassEffects&&o.classList.add("liquid-glass"),e.size&&o.classList.add(`dialog-${e.size}`),e.type&&o.classList.add(`dialog-${e.type}`),e.class&&(Array.isArray(e.class)?o.classList.add(...e.class):o.classList.add(e.class)),e.maxHeight&&o.style.setProperty("--dialog-max-height",e.maxHeight);let i=Object.entries(e.buttons).map(([n,c])=>{let p=c.primary?"btn-primary btn-sm":"btn-outline btn-sm";return`<button type="${c.cancel?"button":"submit"}" class="${p}" value="${n}">${c.name}</button>`});if(e.useForm){let n=document.createElement("div");typeof r=="object"&&r._$litType$?N(r,n):typeof r=="string"?n.textContent=r:N(r,n);let c=n.querySelector("form");if(c){o.innerHTML=`
|
|
3172
3172
|
<header>
|
|
3173
3173
|
<h2>${e.title}</h2>
|
|
3174
3174
|
</header>
|
|
@@ -3197,7 +3197,7 @@ Add this to your HTML <head>:
|
|
|
3197
3197
|
<script type="importmap">
|
|
3198
3198
|
{ "imports": { "#pds/lit": "./path/to/lit.js" } }
|
|
3199
3199
|
<\/script>
|
|
3200
|
-
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${f}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${f}>:`,$)},...g,mapper:f=>{if(customElements.get(f))return null;if(typeof o=="function")try{let $=o(f);return $===void 0?l(f):$}catch($){return console.warn("Custom autoDefine.mapper error; falling back to default:",$?.message||$),l(f)}return l(f)}};d&&(p=new d(k),a.length>0&&typeof d.define=="function"&&await d.define(...a,{baseURL:t,mapper:k.mapper,onError:k.onError}))}return{autoDefiner:p,mergedEnhancers:c}}var ut=class extends EventTarget{},m=new ut;m.initializing=!1;m.currentPreset=null;var ir=(r="")=>String(r).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),io=function(r="log",e,...t){if(this?.debug||this?.design?.debug||!1||r==="error"||r==="warn"){let o=console[r]||console.log;t.length>0?o(e,...t):o(e)}};async function so(r,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let t=e?.runtimeConfigURL||`${r}pds-runtime-config.json`;try{let a=await fetch(t,{cache:"no-store"});return a.ok?await a.json():null}catch{return null}}m.registry=ie;m.adoptLayers=qt;m.adoptPrimitives=Ut;m.createStylesheet=Gt;m.isLiveMode=()=>ie.isLive;m.ask=Vt;m.toast=P;function sr(r){let e=typeof CustomEvent=="function";try{let t=e?new CustomEvent("pds:ready",{detail:r}):new Event("pds:ready");m.dispatchEvent(t)}catch{}if(typeof document<"u")if(e){let t={detail:r,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",t))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",t))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}Object.defineProperty(m,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=m);var pt="pure-ds-theme",Y=null,ve=null;function He(r){try{if(typeof document>"u")return;let e="light";r?r==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=r:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function We(r){try{if(Y&&ve){try{typeof Y.removeEventListener=="function"?Y.removeEventListener("change",ve):typeof Y.removeListener=="function"&&Y.removeListener(ve)}catch{}Y=null,ve=null}if(r==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),t=a=>{let o=a?.matches===void 0?e.matches:a.matches;try{let i=o?"dark":"light";document.documentElement.setAttribute("data-theme",i),m.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:i,source:"system"}}))}catch{}};Y=e,ve=t,typeof e.addEventListener=="function"?e.addEventListener("change",t):typeof e.addListener=="function"&&e.addListener(t)}}catch{}}Object.defineProperty(m,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(pt)||null}catch{return null}},set(r){try{if(typeof window>"u")return;r==null?localStorage.removeItem(pt):localStorage.setItem(pt,r),He(r),We(r),m.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"api"}}))}catch{}}});m._applyResolvedTheme=He;m._setupSystemListenerIfNeeded=We;m.defaultEnhancers=st;async function no(r){let e=r&&r.mode||"live",{mode:t,...a}=r||{};if(e==="static")return co(a);let o=dt(a,{resolvePublicAssetURL:nt}),i=a?.managerURL||a?.public?.managerURL||a?.manager?.url||new URL("core/pds-manager.js",o).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:s}=await import(i);return s(m,a,{emitReady:sr,applyResolvedTheme:He,setupSystemListenerIfNeeded:We})}m.start=no;async function co(r){if(!r||typeof r!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=r.applyGlobalStyles??!0,t=r.manageTheme??!0,a=r.themeStorageKey??"pure-ds-theme",o=r.staticPaths??{},i=dt(r,{resolvePublicAssetURL:nt}),s=r&&r.autoDefine||null,n;s&&s.baseURL?n=Oe(je(s.baseURL,{preferModule:!1})):n=`${i}components/`;let c=s&&Array.isArray(s.predefine)&&s.predefine||[],p=s&&typeof s.mapper=="function"&&s.mapper||null;try{er(m);let{resolvedTheme:d}=or({manageTheme:t,themeStorageKey:a,applyResolvedTheme:He,setupSystemListenerIfNeeded:We}),l=await so(i,r),h=l?.config?.design||l?.design||null,g=l?.config?.preset||l?.preset||"default",y=l?.presetId||ir(g)||"default",k=h?{[String(y).toLowerCase()]:h,...String(y).toLowerCase()!=="default"?{default:h}:{}}:null,f=r?.design&&typeof r.design=="object"?se(r.design):null,$=ir(r?.preset||"default")||"default",Z=f?{[String($).toLowerCase()]:f,...String($).toLowerCase()!=="default"?{default:f}:{}}:null,A=k||r?.presets||Z||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:
|
|
3200
|
+
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${f}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${f}>:`,$)},...g,mapper:f=>{if(customElements.get(f))return null;if(typeof o=="function")try{let $=o(f);return $===void 0?l(f):$}catch($){return console.warn("Custom autoDefine.mapper error; falling back to default:",$?.message||$),l(f)}return l(f)}};d&&(p=new d(k),a.length>0&&typeof d.define=="function"&&await d.define(...a,{baseURL:t,mapper:k.mapper,onError:k.onError}))}return{autoDefiner:p,mergedEnhancers:c}}var ut=class extends EventTarget{},m=new ut;m.initializing=!1;m.currentPreset=null;var ir=(r="")=>String(r).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),io=function(r="log",e,...t){if(this?.debug||this?.design?.debug||!1||r==="error"||r==="warn"){let o=console[r]||console.log;t.length>0?o(e,...t):o(e)}};async function so(r,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let t=e?.runtimeConfigURL||`${r}pds-runtime-config.json`;try{let a=await fetch(t,{cache:"no-store"});return a.ok?await a.json():null}catch{return null}}m.registry=ie;m.adoptLayers=qt;m.adoptPrimitives=Ut;m.createStylesheet=Gt;m.isLiveMode=()=>ie.isLive;m.ask=Vt;m.toast=P;function sr(r){let e=typeof CustomEvent=="function";try{let t=e?new CustomEvent("pds:ready",{detail:r}):new Event("pds:ready");m.dispatchEvent(t)}catch{}if(typeof document<"u")if(e){let t={detail:r,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",t))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",t))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}Object.defineProperty(m,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=m);var pt="pure-ds-theme",Y=null,ve=null;function He(r){try{if(typeof document>"u")return;let e="light";r?r==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=r:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function We(r){try{if(Y&&ve){try{typeof Y.removeEventListener=="function"?Y.removeEventListener("change",ve):typeof Y.removeListener=="function"&&Y.removeListener(ve)}catch{}Y=null,ve=null}if(r==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),t=a=>{let o=a?.matches===void 0?e.matches:a.matches;try{let i=o?"dark":"light";document.documentElement.setAttribute("data-theme",i),m.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:i,source:"system"}}))}catch{}};Y=e,ve=t,typeof e.addEventListener=="function"?e.addEventListener("change",t):typeof e.addListener=="function"&&e.addListener(t)}}catch{}}Object.defineProperty(m,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(pt)||null}catch{return null}},set(r){try{if(typeof window>"u")return;r==null?localStorage.removeItem(pt):localStorage.setItem(pt,r),He(r),We(r),m.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"api"}}))}catch{}}});m._applyResolvedTheme=He;m._setupSystemListenerIfNeeded=We;m.defaultEnhancers=st;async function no(r){let e=r&&r.mode||"live",{mode:t,...a}=r||{};if(e==="static")return co(a);let o=dt(a,{resolvePublicAssetURL:nt}),i=a?.managerURL||a?.public?.managerURL||a?.manager?.url||new URL("core/pds-manager.js",o).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:s}=await import(i);return s(m,a,{emitReady:sr,applyResolvedTheme:He,setupSystemListenerIfNeeded:We})}m.start=no;async function co(r){if(!r||typeof r!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=r.applyGlobalStyles??!0,t=r.manageTheme??!0,a=r.themeStorageKey??"pure-ds-theme",o=r.staticPaths??{},i=dt(r,{resolvePublicAssetURL:nt}),s=r&&r.autoDefine||null,n;s&&s.baseURL?n=Oe(je(s.baseURL,{preferModule:!1})):n=`${i}components/`;let c=s&&Array.isArray(s.predefine)&&s.predefine||[],p=s&&typeof s.mapper=="function"&&s.mapper||null;try{er(m);let{resolvedTheme:d}=or({manageTheme:t,themeStorageKey:a,applyResolvedTheme:He,setupSystemListenerIfNeeded:We}),l=await so(i,r),h=l?.config?.design||l?.design||null,g=l?.config?.preset||l?.preset||"default",y=l?.presetId||ir(g)||"default",k=h?{[String(y).toLowerCase()]:h,...String(y).toLowerCase()!=="default"?{default:h}:{}}:null,f=r?.design&&typeof r.design=="object"?se(r.design):null,$=ir(r?.preset||"default")||"default",Z=f?{[String($).toLowerCase()]:f,...String($).toLowerCase()!=="default"?{default:f}:{}}:null,A=k||r?.presets||Z||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:build or provide config.presets/config.design.");let H=l?.config?{...l.config,...r,preset:r?.preset||y,design:f||h||l?.config?.design}:r,D=rr(H,{},{presets:A,defaultLog:io}),le=D.enhancers,Q={tokens:`${i}styles/pds-tokens.css.js`,primitives:`${i}styles/pds-primitives.css.js`,components:`${i}styles/pds-components.css.js`,utilities:`${i}styles/pds-utilities.css.js`,styles:`${i}styles/pds-styles.css.js`},we=l?.paths||{};if(o={...Q,...we,...o},m.registry.setStaticMode(o),e&&typeof document<"u")try{let E=await m.registry.getStylesheet("styles");if(E){E._pds=!0;let R=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...R,E]}}catch(E){console.warn("Failed to apply static styles:",E)}let _=null,W=[];try{let E=await ar({autoDefineBaseURL:n,autoDefinePreload:c,autoDefineMapper:p,enhancers:le,autoDefineOverrides:s||null,autoDefinePreferModule:!(s&&s.baseURL)},{baseEnhancers:st});_=E.autoDefiner,W=E.mergedEnhancers||[]}catch(E){console.error("\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}let X=se(r);return m.currentConfig=Object.freeze({mode:"static",...structuredClone(X),design:structuredClone(D.generatorConfig.design),preset:D.generatorConfig.preset,theme:d,enhancers:W}),sr({mode:"static",config:D.generatorConfig,theme:d,autoDefiner:_}),{config:D.generatorConfig,theme:d,autoDefiner:_}}catch(d){throw m.dispatchEvent(new CustomEvent("pds:error",{detail:{error:d}})),d}}function ht(r){return r&&typeof r=="object"&&!Array.isArray(r)}function ne(r,e){let t={...r};return ht(r)&&ht(e)&&Object.keys(e).forEach(a=>{ht(e[a])?a in r?t[a]=ne(r[a],e[a]):Object.assign(t,{[a]:e[a]}):Object.assign(t,{[a]:e[a]})}),t}function nr(r){let e=r.replace(/['"]/g,"").trim();if(["system-ui","-apple-system","sans-serif","serif","monospace","cursive","fantasy","ui-sans-serif","ui-serif","ui-monospace","ui-rounded"].includes(e.toLowerCase()))return!0;let o=document.createElement("canvas").getContext("2d");if(!o)return!1;let i="mmmmmmmmmmlli",s="72px",n="monospace";o.font=`${s} ${n}`;let c=o.measureText(i).width;o.font=`${s} "${e}", ${n}`;let p=o.measureText(i).width;return c!==p}function lo(r){return r?r.split(",").map(a=>a.trim())[0].replace(/['"]/g,"").trim():null}async function po(r,e={}){if(!r)return Promise.resolve();let{weights:t=[400,500,600,700],italic:a=!1}=e,o=lo(r);if(!o||nr(o))return Promise.resolve();let i=encodeURIComponent(o);return document.querySelector(`link[href*="fonts.googleapis.com"][href*="${i}"]`)?(console.log(`Font "${o}" is already loading or loaded`),Promise.resolve()):(console.log(`Loading font "${o}" from Google Fonts...`),new Promise((n,c)=>{let p=document.createElement("link");p.rel="stylesheet";let d=a?`ital,wght@0,${t.join(";0,")};1,${t.join(";1,")}`:`wght@${t.join(";")}`;p.href=`https://fonts.googleapis.com/css2?family=${i}:${d}&display=swap`,p.setAttribute("data-font-loader",o),p.onload=()=>{console.log(`Successfully loaded font "${o}"`),n()},p.onerror=()=>{console.warn(`Failed to load font "${o}" from Google Fonts`),c(new Error(`Failed to load font: ${o}`))},document.head.appendChild(p),setTimeout(()=>{nr(o)||console.warn(`Font "${o}" did not load within timeout`),n()},5e3)}))}async function cr(r){if(!r)return Promise.resolve();let e=new Set;r.fontFamilyHeadings&&e.add(r.fontFamilyHeadings),r.fontFamilyBody&&e.add(r.fontFamilyBody),r.fontFamilyMono&&e.add(r.fontFamilyMono);let t=Array.from(e).map(a=>po(a).catch(o=>{console.warn(`Could not load font: ${a}`,o)}));await Promise.all(t)}function lr(r){return new DOMParser().parseFromString(r,"text/html").body.childNodes}function dr(r,e=100){let t;return function(...o){let i=()=>{clearTimeout(t),r(...o)};clearTimeout(t),t=setTimeout(i,e)}}function Ue(r){setTimeout(r,0)}function pr(r){try{if(typeof r!="string"||r.indexOf(`
|
|
3201
3201
|
`)!==-1||r.indexOf(" ")!==-1||r.startsWith("#/"))return!1;let e=new URL(r,window.location.origin);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function ur(r,e,t){let a=window.screen.width/2-e/2,o=window.screen.height/2-t/2;return window.open(r,"",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=${e}, height=${t}, top=${o}, left=${a}`)}var gt={result:"ac-suggestion",item:"ac-itm"},ce=class r extends EventTarget{constructor(e,t,a){super(),this.settings={emptyResultsText:"",...a},this.container=e,this.input=t,this.input.setAttribute("autocomplete","off"),this.categories=a.categories||{},this.caches=new Map,Ue(this.attach.bind(this))}static connect(e,t){let a=e.target;if(!a._autoComplete){if(!t?.categories)throw Error("Missing autocomplete settings");a._autoComplete=new r(a.parentNode,a,t),e.type==="focus"&&setTimeout(()=>{a._autoComplete.focusHandler(e)},100)}return a._autoComplete}on(e,t){return this.input.addEventListener(e,t),this}attach(){this.resultsDiv=document.createElement("div"),this.resultsDiv.title="",this.resultsDiv.classList.add(gt.result),this.container.offsetWidth>100&&(this.resultsDiv.style.width=this.container.offsetWidth),this.resultsDiv.addEventListener("mousedown",this.resultClick.bind(this)),this.container.classList.add("ac-container"),this.input.classList.add("ac-input");let e=getComputedStyle(this.input);this.container.style.setProperty("--ac-bg-default",e.backgroundColor),this.container.style.setProperty("--ac-color-default",e.color);let t=getComputedStyle(this.input).accentColor;t!=="auto"&&this.container.style.setProperty("--ac-accent-color",t),(this.container?.shadowRoot??this.container).appendChild(this.resultsDiv),this.controller().clear("attach"),this.on("input",dr(this.inputHandler.bind(this),this.settings.throttleInputMs??300)).on("focus",this.focusHandler.bind(this)).on("focusout",this.blurHandler.bind(this)).on("keyup",this.keyUpHandler.bind(this)).on("keydown",this.keyDownHandler.bind(this))}controller(){let e=this.internalController();return typeof this.settings.controller=="function"&&(e=this.settings.controller(this)??e),e}internalController(){return{show:this.show.bind(this),hide:this.hide.bind(this),clear:this.clear.bind(this),empty:()=>{}}}moveResult(e){this.controller().show();let t=this.acItems.length;this.rowIndex=this.rowIndex+e,this.rowIndex<=0?this.rowIndex=0:this.rowIndex>t-1&&(this.rowIndex=0);for(let o of this.acItems)o.classList.remove("selected");let a=this.getSelectedDiv();a?(a.classList.add("selected"),a.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})):this.focusHandler({target:this.input})}getSelectedDiv(){return this.resultsDiv.querySelector(`div:nth-child(${this.rowIndex+1})`)}selectResult(e){if(e=e||this.getSelectedDiv(),e){let t=parseInt(e.getAttribute("data-index"));this.resultClicked=!0;let a=this.results[t],o=this.categories[a.category]??{};o.action=o.action??this.setText.bind(this),o.newTab&&(this.tabWindow=ur("about:blank"));let i={...a,search:this.input.value};e.classList.add("ac-active"),setTimeout(()=>{this.controller().hide("result-selected"),i.action?i.action(i):(o.action(i),o.newTab&&(i.url?this.tabWindow.location.href=i.url:this.tabWindow.close()));var s=new Event("change",{bubbles:!0});this.input.dispatchEvent(s),this.controller().clear("result-selected");let n=new Event("result-selected");n.detail=i,this.input.dispatchEvent(n)},0)}}setText(e){this.container.autoCompleteInput||(this.container.value=e.text),this.controller().hide("settext")}resultClick(e){this.selectResult(e.target.closest(`.${gt.item}`))}blurHandler(){setTimeout(()=>{this.resultClicked||this.controller().clear("blurred"),this.resultClicked=!1},100)}clear(){this.settings.debug||this.resultsDiv&&(this.resultsDiv.innerHTML="",this.controller().hide("clear"),this.cacheTmr&&clearTimeout(this.cacheTmr),this.cacheTmr=setTimeout(()=>{this.caches.clear()},60*1e3*5))}show(){if(!this.resultsDiv.classList.contains("ac-active")){let e=this.getViewBounds();this.resultsDiv.style.position="absolute",e.rect.width>100&&(this.resultsDiv.style.width=`${e.rect.width}px`),this.settings.direction=this.settings.direction??e.suggestedDirection,this.resultsDiv.setAttribute("data-direction",this.settings.direction),this.settings.direction==="up"?(this.resultsDiv.style.top="unset",this.resultsDiv.style.bottom=`${e.rect.height+20}px`,this.rowIndex=this.acItems.length):(this.resultsDiv.style.bottom="unset",this.resultsDiv.style.top=`${e.rect.height}px`,this.rowIndex=-1),this.resultsDiv.style.maxWidth="unset",this.resultsDiv.classList.toggle("ac-active",!0)}}getViewBounds(){let e=this.input.getBoundingClientRect();return{rect:e,suggestedDirection:e.top+e.height+500>window.innerHeight?"up":"down"}}hide(){this.resultsDiv.classList.toggle("ac-active",!1)}empty(){this.resultsDiv.innerHTML=`<div class="ac-empty">${this.settings.emptyResultsText}</div>`,this.controller().show()}inputHandler(e){this.cacheTmr&&clearTimeout(this.cacheTmr);let t={search:e.target.value,categories:this.categories};this.container.classList.add("search-running"),this.getItems(t,e).then(a=>{this.controller().clear("new-results"),this.resultsHandler(a,t),this.container.classList.remove("search-running")})}keyDownHandler(e){switch(e.key){case"Enter":e.stopPropagation(),e.preventDefault();break;case"ArrowDown":Ue(this.moveResult(1));break;case"ArrowUp":Ue(this.moveResult(-1));break}}keyUpHandler(e){switch(e.key){case"Escape":this.controller().hide("escape");break;case"Enter":this.getSelectedDiv()&&(this.container.preventEnter=!0,e.stopPropagation(),e.preventDefault(),this.selectResult(),setTimeout(()=>{this.container.preventEnter=!1},10));break;default:break}}focusHandler(e){this.controller().clear("focus");let t=e.target.value;this.suggest(t,e)}suggest(e,t){this.input.focus();let a={suggest:!0,search:e||"",categories:this.categories};this.getItems(a,t).then(o=>{this.input.dispatchEvent(new CustomEvent("show-results",{detail:{results:o}})),this.resultsHandler(o,a)})}sort(e,t){return e.sort((a,o)=>{let i=t.categories[a.category],s=t.categories[o.category],n=typeof i.sortIndex=="function"?i.sortIndex(t):i.sortIndex??0;return(typeof s.sortIndex=="function"?s.sortIndex(t):s.sortIndex??0)>n?1:-1})}resultsHandler(e,t){this.results=e,this.rowIndex=-1;let a=0,o=(i,s)=>`
|
|
3202
3202
|
<div title="${s.tooltip||""}" data-index="${a}" class="${`${gt.item} cat-${s.category} ${s.class??""}`.trim()}">
|
|
3203
3203
|
${this.handleImageOrIcon(s)}
|
|
@@ -3184,7 +3184,7 @@ export const ${t} = new CSSStyleSheet();
|
|
|
3184
3184
|
${t}.replaceSync(\`${a}\`);
|
|
3185
3185
|
|
|
3186
3186
|
export const ${t}CSS = \`${a}\`;
|
|
3187
|
-
`}};var K=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(e){console.error(`[PDS Registry] Failed to load static ${t}:`,e),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:
|
|
3187
|
+
`}};var K=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(e){console.error(`[PDS Registry] Failed to load static ${t}:`,e),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let a=new CSSStyleSheet;return a.replaceSync("/* Failed to load "+t+" */"),a}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},X=new K;function Pe(n){try{if(typeof document>"u")return;if(typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype){let a=new CSSStyleSheet;a.replaceSync(n),a._pds=!0;let r=(document.adoptedStyleSheets||[]).filter(o=>o._pds!==!0);document.adoptedStyleSheets=[...r,a];return}let t="pds-runtime-stylesheet",e=document.getElementById(t);if(!e){e=document.createElement("style"),e.id=t,e.type="text/css";let a=document.head||document.getElementsByTagName("head")[0];a?a.appendChild(e):document.documentElement.appendChild(e)}e.textContent=n}catch(t){console.warn("installRuntimeStyles failed:",t)}}function V(n){let t=n;if(!t||typeof t!="object"){console.error("[Runtime] applyStyles requires an explicit generator instance in live mode");return}let e=t.layeredCSS||t.css||"";if(!e){t.options?.log?.("warn","[Runtime] No CSS available on generator to apply");return}Pe(e)}async function le(n,t=[],e=null){try{let a=e?.primitivesStylesheet?e.primitivesStylesheet:await X.getStylesheet("primitives");n.adoptedStyleSheets=[a,...t]}catch(a){let r=n.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,a),n.adoptedStyleSheets=t}}async function de(n,t=["primitives"],e=[],a=null){try{let o=(await Promise.all(t.map(async i=>{if(a)switch(i){case"tokens":return a.tokensStylesheet;case"primitives":return a.primitivesStylesheet;case"components":return a.componentsStylesheet;case"utilities":return a.utilitiesStylesheet;default:break}return X.getStylesheet(i)}))).filter(i=>i!==null);n.adoptedStyleSheets=[...o,...e]}catch(r){let o=n.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),n.adoptedStyleSheets=e}}var Ie=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"button, a[class*='btn-']"}];function Ue(n){n.dataset.enhancedAccordion||(n.dataset.enhancedAccordion="true",n.addEventListener("toggle",t=>{t.target.open&&t.target.parentElement===n&&n.querySelectorAll(":scope > details[open]").forEach(e=>{e!==t.target&&(e.open=!1)})},!0))}function Oe(n){if(n.dataset.enhancedDropdown)return;n.dataset.enhancedDropdown="true";let t=n.querySelector("menu");if(!t)return;let e=n.querySelector("[data-dropdown-toggle]")||n.querySelector("button");e&&!e.hasAttribute("type")&&e.setAttribute("type","button"),t.id||(t.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),t.setAttribute("role",t.getAttribute("role")||"menu"),t.hasAttribute("aria-hidden")||t.setAttribute("aria-hidden","true"),e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded","false"));let a=()=>{let c=(n.getAttribute("data-mode")||"auto").toLowerCase();if(c==="up"||c==="down")return c;let l=n.getBoundingClientRect(),d=Math.max(0,window.innerHeight-l.bottom);return Math.max(0,l.top)>d?"up":"down"},r=()=>{n.dataset.dropdownDirection=a(),t.setAttribute("aria-hidden","false"),e?.setAttribute("aria-expanded","true")},o=()=>{t.setAttribute("aria-hidden","true"),e?.setAttribute("aria-expanded","false")},i=()=>{t.getAttribute("aria-hidden")==="false"?o():r()};e?.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),i()}),document.addEventListener("click",c=>{n.contains(c.target)||o()}),n.addEventListener("keydown",c=>{c.key==="Escape"&&(o(),e?.focus())}),n.addEventListener("focusout",c=>{(!c.relatedTarget||!n.contains(c.relatedTarget))&&o()})}function He(n){if(n.dataset.enhancedToggle)return;n.dataset.enhancedToggle="true";let t=n.querySelector('input[type="checkbox"]');if(!t)return;n.hasAttribute("tabindex")||n.setAttribute("tabindex","0"),n.setAttribute("role","switch"),n.setAttribute("aria-checked",t.checked?"true":"false");let e=document.createElement("span");e.className="toggle-switch",e.setAttribute("role","presentation"),e.setAttribute("aria-hidden","true");let a=document.createElement("span");a.className="toggle-knob",e.appendChild(a),n.insertBefore(e,t.nextSibling);let r=()=>{n.setAttribute("aria-checked",t.checked?"true":"false")},o=()=>{t.disabled||(t.checked=!t.checked,r(),t.dispatchEvent(new Event("change",{bubbles:!0})))};n.addEventListener("click",i=>{i.preventDefault(),o()}),n.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),t.addEventListener("change",r)}function qe(n){if(n.dataset.enhancedRange)return;let t=n.closest("label"),e=t?.classList.contains("range-output"),a=n.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${a}-output`;if(n.id=a,e){let o=t.querySelector("span");if(o&&!o.classList.contains("range-output-wrapper")){let i=document.createElement("span");i.className="range-output-wrapper",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center";let c=document.createElement("span");c.textContent=o.textContent,i.appendChild(c);let l=document.createElement("output");l.id=r,l.setAttribute("for",a),l.style.color="var(--surface-text-secondary, var(--color-text-secondary))",l.style.fontSize="0.875rem",l.textContent=n.value,i.appendChild(l),o.textContent="",o.appendChild(i);let d=()=>{l.textContent=n.value};n.addEventListener("input",d)}}else{let o=n.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",n.parentNode?.insertBefore(o,n),o.appendChild(n)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",a),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let c=()=>{let s=parseFloat(n.min)||0,p=parseFloat(n.max)||100,g=parseFloat(n.value),h=(g-s)/(p-s);i.style.left=`calc(${h*100}% )`,i.textContent=String(g)},l=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");n.addEventListener("input",c),n.addEventListener("pointerdown",l),n.addEventListener("pointerup",d),n.addEventListener("pointerleave",d),n.addEventListener("focus",l),n.addEventListener("blur",d),c()}n.dataset.enhancedRange="1"}function Ge(n){if(n.dataset.enhancedRequired)return;n.dataset.enhancedRequired="true";let t=e=>{let a=e.closest("label");if(!a||a.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",a.querySelector("span").appendChild(r);let o=e.closest("form");if(o&&!o.querySelector(".required-legend")){let i=document.createElement("small");i.classList.add("required-legend"),i.textContent="* Required fields",o.insertBefore(i,o.querySelector(".form-actions")||o.lastElementChild)}};n.querySelectorAll("[required]").forEach(e=>{t(e)})}function _e(n){if(n.dataset.enhancedOpenGroup)return;n.dataset.enhancedOpenGroup="true",n.classList.add("flex","flex-wrap","buttons");let t=document.createElement("input");t.type="text",t.placeholder="Add item...",t.classList.add("input-text","input-sm"),t.style.width="auto";let e=n.querySelector('input[type="radio"], input[type="checkbox"]');n.appendChild(t),t.addEventListener("keydown",a=>{if(a.key==="Enter"||a.key==="Tab"){let r=t.value.trim();if(r){a.preventDefault();let o=e.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,c=document.createElement("label"),l=document.createElement("span");l.setAttribute("data-label",""),l.textContent=r;let d=document.createElement("input");d.type=o,d.name=e.name||n.getAttribute("data-name")||"open-group",d.value=r,d.id=i,c.appendChild(l),c.appendChild(d),n.insertBefore(c,t),t.value=""}}else if(a.key==="Backspace"&&t.value===""){a.preventDefault();let r=n.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function Ve(n){if(n.dataset.enhancedBtnWorking)return;n.dataset.enhancedBtnWorking="true";let t=null,e=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=n.classList.contains("btn-working"),c=n.querySelector("pds-icon");if(i)if(c)t||(t=c.getAttribute("icon")),c.setAttribute("icon","circle-notch");else{let l=document.createElement("pds-icon");l.setAttribute("icon","circle-notch"),l.setAttribute("size","sm"),n.insertBefore(l,n.firstChild),e=!0}else o.oldValue?.includes("btn-working")&&c&&(e?(c.remove(),e=!1):t&&(c.setAttribute("icon",t),t=null))}})}).observe(n,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var Qe=new Map([[".accordion",Ue],["nav[data-dropdown]",Oe],["label[data-toggle]",He],['input[type="range"]',qe],["form[data-required]",Ge],["fieldset[role=group][data-open]",_e],["button, a[class*='btn-']",Ve]]),pe=Ie.map(n=>({...n,run:Qe.get(n.selector)||(()=>{})}));var ue=[{selector:".accordion",description:"Ensures only one <details> element can be open at a time within the accordion.",demoHtml:`
|
|
3188
3188
|
<div class="accordion">
|
|
3189
3189
|
<details>
|
|
3190
3190
|
<summary>Section 1</summary>
|
package/public/assets/js/pds.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var yt=Object.defineProperty;var gt=(t,e)=>()=>(t&&(e=t(t=0)),e);var bt=(t,e)=>{for(var s in e)yt(t,s,{get:e[s],enumerable:!0})};var ot={};bt(ot,{AutoDefiner:()=>Pe});async function Kt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(l,u,f)=>f.toUpperCase()),c=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let l=r(d),f=await import(l instanceof URL?l.href:new URL(l,i).href),m=f?.default??f?.[a(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${a(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(l){throw o(d,l),l}};return Promise.all(s.map(c))}var Pe,it=gt(()=>{Pe=class{constructor(e={}){let{baseURL:s,mapper:n,onError:r,predicate:o=()=>!0,attributeModule:i="data-module",root:a=document,scanExisting:c=!0,debounceMs:d=16,observeShadows:l=!0,enhancers:u=[],patchAttachShadow:f=!0}=e,m=new Set,$=new Set,x=new Set,g=new Map,w=new WeakMap,H=new WeakMap,A=0,D=!1,L=null,Z=p=>{if(!p||!u.length)return;let y=H.get(p);y||(y=new Set,H.set(p,y));for(let h of u)if(!(!h.selector||!h.run)&&!y.has(h.selector))try{p.matches&&p.matches(h.selector)&&(h.run(p),y.add(h.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${h.selector}":`,v)}},I=(p,y)=>{if(!D&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!$.has(p)&&!x.has(p)){if(y&&y.getAttribute){let h=y.getAttribute(i);h&&!g.has(p)&&g.set(p,h)}m.add(p),oe()}},oe=()=>{A||(A=setTimeout(z,d))},E=p=>{if(p){if(p.nodeType===1){let y=p,h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(y=>{let h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)})}},M=p=>{if(!p||w.has(p))return;E(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{E(B)}),v.type==="attributes"&&v.target&&E(v.target)});y.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(h=>h.selector).filter(h=>h.startsWith("data-"))]}),w.set(p,y)};async function z(){if(clearTimeout(A),A=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>$.add(y));try{let y=h=>g.get(h)??(n?n(h):`${h}.js`);await Kt(...p,{baseURL:s,mapper:y,onError:(h,v)=>{x.add(h),r?.(h,v)}})}catch{}finally{p.forEach(y=>$.delete(y))}}let S=a===document?document.documentElement:a,R=new MutationObserver(p=>{for(let y of p)y.addedNodes?.forEach(h=>{E(h)}),y.type==="attributes"&&y.target&&E(y.target)});if(R.observe(S,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),l&&f&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(h){let v=p.call(this,h);if(h&&h.mode==="open"){M(v);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&I(B,this)}return v},L=()=>Element.prototype.attachShadow=p}return c&&E(S),{stop(){D=!0,R.disconnect(),L&&L(),A&&(clearTimeout(A),A=0),w.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=s,a=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(u,f,m)=>m.toUpperCase()),d=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let u=o(l),m=await import(u instanceof URL?u.href:new URL(u,a).href),$=m?.default??m?.[c(l)];if(!$){if(customElements.get(l))return{tag:l,status:"self-defined"};throw new Error(`No export found for ${l}. Expected default export or named export "${c(l)}".`)}return customElements.get(l)?{tag:l,status:"race-already-defined"}:(customElements.define(l,$),{tag:l,status:"defined"})}catch(u){throw i(l,u),u}};return Promise.all(n.map(d))}}});var me=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(s){console.error(`[PDS Registry] Failed to load static ${e}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:export' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+e+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Ue(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function Oe(t,e=["primitives"],s=[],n=null){try{let o=(await Promise.all(e.map(async i=>{if(n)switch(i){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...s]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=s}}function Ne(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var ie=globalThis,ce=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qe=Symbol(),je=new WeakMap,ae=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==qe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o,s=this.t;if(ce&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=je.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&je.set(s,e))}return e}toString(){return this.cssText}},He=t=>new ae(typeof t=="string"?t:t+"",void 0,qe);var Ie=(t,e)=>{if(ce)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),r=ie.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,t.appendChild(n)}},ye=ce?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return He(s)})(t):t;var{is:$t,defineProperty:_t,getOwnPropertyDescriptor:wt,getOwnPropertyNames:St,getOwnPropertySymbols:At,getPrototypeOf:Et}=Object,le=globalThis,ze=le.trustedTypes,vt=ze?ze.emptyScript:"",Lt=le.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?vt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},Fe=(t,e)=>!$t(t,e),Be={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Fe};Symbol.metadata??=Symbol("metadata"),le.litPropertyMetadata??=new WeakMap;var P=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Be){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,s);r!==void 0&&_t(this.prototype,e,r)}}static getPropertyDescriptor(e,s,n){let{get:r,set:o}=wt(this.prototype,e)??{get(){return this[s]},set(i){this[s]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Be}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=Et(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,n=[...St(s),...At(s)];for(let r of n)this.createProperty(r,s[r])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,r]of s)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let r=this._$Eu(s,n);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let s=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)s.unshift(ye(r))}else e!==void 0&&s.push(ye(e));return s}static _$Eu(e,s){let n=s.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,s=this.constructor.elementProperties;for(let n of s.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ie(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,s,n){this._$AK(e,n)}_$ET(e,s){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:ge).toAttribute(s,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,s){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),i=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ge;this._$Em=r;let a=i.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??Fe)(o,s)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:r,wrapped:o},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??s??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:i}=o,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let e=!1,s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(s)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Lt?.({ReactiveElement:P}),(le.reactiveElementVersions??=[]).push("2.1.1");var Ee=globalThis,de=Ee.trustedTypes,We=de?de.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Xe="?"+k,Ct=`<${Xe}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,xt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
|
|
1
|
+
var yt=Object.defineProperty;var gt=(t,e)=>()=>(t&&(e=t(t=0)),e);var bt=(t,e)=>{for(var s in e)yt(t,s,{get:e[s],enumerable:!0})};var ot={};bt(ot,{AutoDefiner:()=>Pe});async function Kt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(l,u,f)=>f.toUpperCase()),c=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let l=r(d),f=await import(l instanceof URL?l.href:new URL(l,i).href),m=f?.default??f?.[a(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${a(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(l){throw o(d,l),l}};return Promise.all(s.map(c))}var Pe,it=gt(()=>{Pe=class{constructor(e={}){let{baseURL:s,mapper:n,onError:r,predicate:o=()=>!0,attributeModule:i="data-module",root:a=document,scanExisting:c=!0,debounceMs:d=16,observeShadows:l=!0,enhancers:u=[],patchAttachShadow:f=!0}=e,m=new Set,$=new Set,x=new Set,g=new Map,w=new WeakMap,H=new WeakMap,A=0,D=!1,L=null,Z=p=>{if(!p||!u.length)return;let y=H.get(p);y||(y=new Set,H.set(p,y));for(let h of u)if(!(!h.selector||!h.run)&&!y.has(h.selector))try{p.matches&&p.matches(h.selector)&&(h.run(p),y.add(h.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${h.selector}":`,v)}},I=(p,y)=>{if(!D&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!$.has(p)&&!x.has(p)){if(y&&y.getAttribute){let h=y.getAttribute(i);h&&!g.has(p)&&g.set(p,h)}m.add(p),oe()}},oe=()=>{A||(A=setTimeout(z,d))},E=p=>{if(p){if(p.nodeType===1){let y=p,h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(y=>{let h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)})}},M=p=>{if(!p||w.has(p))return;E(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{E(B)}),v.type==="attributes"&&v.target&&E(v.target)});y.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(h=>h.selector).filter(h=>h.startsWith("data-"))]}),w.set(p,y)};async function z(){if(clearTimeout(A),A=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>$.add(y));try{let y=h=>g.get(h)??(n?n(h):`${h}.js`);await Kt(...p,{baseURL:s,mapper:y,onError:(h,v)=>{x.add(h),r?.(h,v)}})}catch{}finally{p.forEach(y=>$.delete(y))}}let S=a===document?document.documentElement:a,R=new MutationObserver(p=>{for(let y of p)y.addedNodes?.forEach(h=>{E(h)}),y.type==="attributes"&&y.target&&E(y.target)});if(R.observe(S,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),l&&f&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(h){let v=p.call(this,h);if(h&&h.mode==="open"){M(v);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&I(B,this)}return v},L=()=>Element.prototype.attachShadow=p}return c&&E(S),{stop(){D=!0,R.disconnect(),L&&L(),A&&(clearTimeout(A),A=0),w.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=s,a=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(u,f,m)=>m.toUpperCase()),d=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let u=o(l),m=await import(u instanceof URL?u.href:new URL(u,a).href),$=m?.default??m?.[c(l)];if(!$){if(customElements.get(l))return{tag:l,status:"self-defined"};throw new Error(`No export found for ${l}. Expected default export or named export "${c(l)}".`)}return customElements.get(l)?{tag:l,status:"race-already-defined"}:(customElements.define(l,$),{tag:l,status:"defined"})}catch(u){throw i(l,u),u}};return Promise.all(n.map(d))}}});var me=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(s){console.error(`[PDS Registry] Failed to load static ${e}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+e+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Ue(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function Oe(t,e=["primitives"],s=[],n=null){try{let o=(await Promise.all(e.map(async i=>{if(n)switch(i){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...s]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=s}}function Ne(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var ie=globalThis,ce=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qe=Symbol(),je=new WeakMap,ae=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==qe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o,s=this.t;if(ce&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=je.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&je.set(s,e))}return e}toString(){return this.cssText}},He=t=>new ae(typeof t=="string"?t:t+"",void 0,qe);var Ie=(t,e)=>{if(ce)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),r=ie.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,t.appendChild(n)}},ye=ce?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return He(s)})(t):t;var{is:$t,defineProperty:_t,getOwnPropertyDescriptor:wt,getOwnPropertyNames:St,getOwnPropertySymbols:At,getPrototypeOf:Et}=Object,le=globalThis,ze=le.trustedTypes,vt=ze?ze.emptyScript:"",Lt=le.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?vt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},Fe=(t,e)=>!$t(t,e),Be={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Fe};Symbol.metadata??=Symbol("metadata"),le.litPropertyMetadata??=new WeakMap;var P=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Be){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,s);r!==void 0&&_t(this.prototype,e,r)}}static getPropertyDescriptor(e,s,n){let{get:r,set:o}=wt(this.prototype,e)??{get(){return this[s]},set(i){this[s]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Be}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=Et(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,n=[...St(s),...At(s)];for(let r of n)this.createProperty(r,s[r])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,r]of s)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let r=this._$Eu(s,n);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let s=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)s.unshift(ye(r))}else e!==void 0&&s.push(ye(e));return s}static _$Eu(e,s){let n=s.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,s=this.constructor.elementProperties;for(let n of s.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ie(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,s,n){this._$AK(e,n)}_$ET(e,s){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:ge).toAttribute(s,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,s){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),i=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ge;this._$Em=r;let a=i.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??Fe)(o,s)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:r,wrapped:o},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??s??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:i}=o,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let e=!1,s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(s)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Lt?.({ReactiveElement:P}),(le.reactiveElementVersions??=[]).push("2.1.1");var Ee=globalThis,de=Ee.trustedTypes,We=de?de.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Xe="?"+k,Ct=`<${Xe}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,xt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
|
|
2
2
|
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ve=/-->/g,Ke=/>/g,T=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Ze=/"/g,Ye=/^(?:script|style|textarea|title)$/i,Le=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),cs=Le(1),ls=Le(2),ds=Le(3),N=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Je=new WeakMap,U=O.createTreeWalker(O,129);function et(t,e){if(!ve(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return We!==void 0?We.createHTML(e):e}var Rt=(t,e)=>{let s=t.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",i=Q;for(let a=0;a<s;a++){let c=t[a],d,l,u=-1,f=0;for(;f<c.length&&(i.lastIndex=f,l=i.exec(c),l!==null);)f=i.lastIndex,i===Q?l[1]==="!--"?i=Ve:l[1]!==void 0?i=Ke:l[2]!==void 0?(Ye.test(l[2])&&(r=RegExp("</"+l[2],"g")),i=T):l[3]!==void 0&&(i=T):i===T?l[0]===">"?(i=r??Q,u=-1):l[1]===void 0?u=-2:(u=i.lastIndex-l[2].length,d=l[1],i=l[3]===void 0?T:l[3]==='"'?Ze:Ge):i===Ze||i===Ge?i=T:i===Ve||i===Ke?i=Q:(i=T,r=void 0);let m=i===T&&t[a+1].startsWith("/>")?" ":"";o+=i===Q?c+Ct:u>=0?(n.push(d),c.slice(0,u)+Qe+c.slice(u)+k+m):c+k+(u===-2?a:m)}return[et(t,o+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ee=class t{constructor({strings:e,_$litType$:s},n){let r;this.parts=[];let o=0,i=0,a=e.length-1,c=this.parts,[d,l]=Rt(e,s);if(this.el=t.createElement(d,n),U.currentNode=this.el.content,s===2||s===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=U.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(Qe)){let f=l[i++],m=r.getAttribute(u).split(k),$=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:$[2],strings:m,ctor:$[1]==="."?_e:$[1]==="?"?we:$[1]==="@"?Se:V}),r.removeAttribute(u)}else u.startsWith(k)&&(c.push({type:6,index:o}),r.removeAttribute(u));if(Ye.test(r.tagName)){let u=r.textContent.split(k),f=u.length-1;if(f>0){r.textContent=de?de.emptyScript:"";for(let m=0;m<f;m++)r.append(u[m],X()),U.nextNode(),c.push({type:2,index:++o});r.append(u[f],X())}}}else if(r.nodeType===8)if(r.data===Xe)c.push({type:2,index:o});else{let u=-1;for(;(u=r.data.indexOf(k,u+1))!==-1;)c.push({type:7,index:o}),u+=k.length-1}o++}}static createElement(e,s){let n=O.createElement("template");return n.innerHTML=e,n}};function W(t,e,s=t,n){if(e===N)return e;let r=n!==void 0?s._$Co?.[n]:s._$Cl,o=Y(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,s,n)),n!==void 0?(s._$Co??=[])[n]=r:s._$Cl=r),r!==void 0&&(e=W(t,r._$AS(t,e.values),r,n)),e}var $e=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:s},parts:n}=this._$AD,r=(e?.creationScope??O).importNode(s,!0);U.currentNode=r;let o=U.nextNode(),i=0,a=0,c=n[0];for(;c!==void 0;){if(i===c.index){let d;c.type===2?d=new te(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new Ae(o,this,e)),this._$AV.push(d),c=n[++a]}i!==c?.index&&(o=U.nextNode(),i++)}return U.currentNode=O,r}p(e){let s=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,s),s+=n.strings.length-2):n._$AI(e[s])),s++}},te=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,n,r){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=W(this,e,s),Y(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==N&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):xt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==_&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){let{values:s,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ee.createElement(et(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new $e(r,this),i=o.u(this.options);o.p(s),this.T(i),this._$AH=o}}_$AC(e){let s=Je.get(e.strings);return s===void 0&&Je.set(e.strings,s=new ee(e)),s}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,n,r=0;for(let o of e)r===s.length?s.push(n=new t(this.O(X()),this.O(X()),this,this.options)):n=s[r],n._$AI(o),r++;r<s.length&&(this._$AR(n&&n._$AB.nextSibling,r),s.length=r)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},V=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,n,r,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=s,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=_}_$AI(e,s=this,n,r){let o=this.strings,i=!1;if(o===void 0)e=W(this,e,s,0),i=!Y(e)||e!==this._$AH&&e!==N,i&&(this._$AH=e);else{let a=e,c,d;for(e=o[0],c=0;c<o.length-1;c++)d=W(this,a[n+c],s,c),d===N&&(d=this._$AH[c]),i||=!Y(d)||d!==this._$AH[c],d===_?e=_:e!==_&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}i&&!r&&this.j(e)}j(e){e===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},_e=class extends V{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_?void 0:e}},we=class extends V{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==_)}},Se=class extends V{constructor(e,s,n,r,o){super(e,s,n,r,o),this.type=5}_$AI(e,s=this){if((e=W(this,e,s,0)??_)===N)return;let n=this._$AH,r=e===_&&n!==_||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==_&&(n===_||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ae=class{constructor(e,s,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}};var Pt=Ee.litHtmlPolyfillSupport;Pt?.(ee,te),(Ee.litHtmlVersions??=[]).push("3.3.1");var j=(t,e,s)=>{let n=s?.renderBefore??e,r=n._$litPart$;if(r===void 0){let o=s?.renderBefore??null;n._$litPart$=r=new te(e.insertBefore(X(),o),o,void 0,s??{})}return r._$AI(t),r};var Ce=globalThis,K=class extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=j(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}};K._$litElement$=!0,K.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:K});var kt=Ce.litElementPolyfillSupport;kt?.({LitElement:K});(Ce.litElementVersions??=[]).push("4.2.1");var tt={mode:"
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Ze=/"/g,Ye=/^(?:script|style|textarea|title)$/i,Le=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),cs=Le(1),ls=Le(2),ds=Le(3),N=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Je=new WeakMap,U=O.createTreeWalker(O,129);function et(t,e){if(!ve(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return We!==void 0?We.createHTML(e):e}var Rt=(t,e)=>{let s=t.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",i=Q;for(let a=0;a<s;a++){let c=t[a],d,l,u=-1,f=0;for(;f<c.length&&(i.lastIndex=f,l=i.exec(c),l!==null);)f=i.lastIndex,i===Q?l[1]==="!--"?i=Ve:l[1]!==void 0?i=Ke:l[2]!==void 0?(Ye.test(l[2])&&(r=RegExp("</"+l[2],"g")),i=T):l[3]!==void 0&&(i=T):i===T?l[0]===">"?(i=r??Q,u=-1):l[1]===void 0?u=-2:(u=i.lastIndex-l[2].length,d=l[1],i=l[3]===void 0?T:l[3]==='"'?Ze:Ge):i===Ze||i===Ge?i=T:i===Ve||i===Ke?i=Q:(i=T,r=void 0);let m=i===T&&t[a+1].startsWith("/>")?" ":"";o+=i===Q?c+Ct:u>=0?(n.push(d),c.slice(0,u)+Qe+c.slice(u)+k+m):c+k+(u===-2?a:m)}return[et(t,o+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ee=class t{constructor({strings:e,_$litType$:s},n){let r;this.parts=[];let o=0,i=0,a=e.length-1,c=this.parts,[d,l]=Rt(e,s);if(this.el=t.createElement(d,n),U.currentNode=this.el.content,s===2||s===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=U.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(Qe)){let f=l[i++],m=r.getAttribute(u).split(k),$=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:$[2],strings:m,ctor:$[1]==="."?_e:$[1]==="?"?we:$[1]==="@"?Se:V}),r.removeAttribute(u)}else u.startsWith(k)&&(c.push({type:6,index:o}),r.removeAttribute(u));if(Ye.test(r.tagName)){let u=r.textContent.split(k),f=u.length-1;if(f>0){r.textContent=de?de.emptyScript:"";for(let m=0;m<f;m++)r.append(u[m],X()),U.nextNode(),c.push({type:2,index:++o});r.append(u[f],X())}}}else if(r.nodeType===8)if(r.data===Xe)c.push({type:2,index:o});else{let u=-1;for(;(u=r.data.indexOf(k,u+1))!==-1;)c.push({type:7,index:o}),u+=k.length-1}o++}}static createElement(e,s){let n=O.createElement("template");return n.innerHTML=e,n}};function W(t,e,s=t,n){if(e===N)return e;let r=n!==void 0?s._$Co?.[n]:s._$Cl,o=Y(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,s,n)),n!==void 0?(s._$Co??=[])[n]=r:s._$Cl=r),r!==void 0&&(e=W(t,r._$AS(t,e.values),r,n)),e}var $e=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:s},parts:n}=this._$AD,r=(e?.creationScope??O).importNode(s,!0);U.currentNode=r;let o=U.nextNode(),i=0,a=0,c=n[0];for(;c!==void 0;){if(i===c.index){let d;c.type===2?d=new te(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new Ae(o,this,e)),this._$AV.push(d),c=n[++a]}i!==c?.index&&(o=U.nextNode(),i++)}return U.currentNode=O,r}p(e){let s=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,s),s+=n.strings.length-2):n._$AI(e[s])),s++}},te=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,n,r){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=W(this,e,s),Y(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==N&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):xt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==_&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){let{values:s,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ee.createElement(et(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new $e(r,this),i=o.u(this.options);o.p(s),this.T(i),this._$AH=o}}_$AC(e){let s=Je.get(e.strings);return s===void 0&&Je.set(e.strings,s=new ee(e)),s}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,n,r=0;for(let o of e)r===s.length?s.push(n=new t(this.O(X()),this.O(X()),this,this.options)):n=s[r],n._$AI(o),r++;r<s.length&&(this._$AR(n&&n._$AB.nextSibling,r),s.length=r)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},V=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,n,r,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=s,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=_}_$AI(e,s=this,n,r){let o=this.strings,i=!1;if(o===void 0)e=W(this,e,s,0),i=!Y(e)||e!==this._$AH&&e!==N,i&&(this._$AH=e);else{let a=e,c,d;for(e=o[0],c=0;c<o.length-1;c++)d=W(this,a[n+c],s,c),d===N&&(d=this._$AH[c]),i||=!Y(d)||d!==this._$AH[c],d===_?e=_:e!==_&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}i&&!r&&this.j(e)}j(e){e===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},_e=class extends V{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_?void 0:e}},we=class extends V{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==_)}},Se=class extends V{constructor(e,s,n,r,o){super(e,s,n,r,o),this.type=5}_$AI(e,s=this){if((e=W(this,e,s,0)??_)===N)return;let n=this._$AH,r=e===_&&n!==_||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==_&&(n===_||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ae=class{constructor(e,s,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}};var Pt=Ee.litHtmlPolyfillSupport;Pt?.(ee,te),(Ee.litHtmlVersions??=[]).push("3.3.1");var j=(t,e,s)=>{let n=s?.renderBefore??e,r=n._$litPart$;if(r===void 0){let o=s?.renderBefore??null;n._$litPart$=r=new te(e.insertBefore(X(),o),o,void 0,s??{})}return r._$AI(t),r};var Ce=globalThis,K=class extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=j(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}};K._$litElement$=!0,K.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:K});var kt=Ce.litElementPolyfillSupport;kt?.({LitElement:K});(Ce.litElementVersions??=[]).push("4.2.1");var tt={mode:"live",preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(t,e,...s){console[t](e,...s)}};async function st(t,e={}){return e={...{title:"Confirm",type:"confirm",buttons:{ok:{name:"OK",primary:!0},cancel:{name:"Cancel",cancel:!0}}},...e},new Promise(n=>{let r=document.createElement("dialog");tt.options?.liquidGlassEffects&&r.classList.add("liquid-glass"),e.size&&r.classList.add(`dialog-${e.size}`),e.type&&r.classList.add(`dialog-${e.type}`),e.class&&(Array.isArray(e.class)?r.classList.add(...e.class):r.classList.add(e.class)),e.maxHeight&&r.style.setProperty("--dialog-max-height",e.maxHeight);let o=Object.entries(e.buttons).map(([a,c])=>{let d=c.primary?"btn-primary btn-sm":"btn-outline btn-sm";return`<button type="${c.cancel?"button":"submit"}" class="${d}" value="${a}">${c.name}</button>`});if(e.useForm){let a=document.createElement("div");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a);let c=a.querySelector("form");if(c){r.innerHTML=`
|
|
4
4
|
<header>
|
|
5
5
|
<h2>${e.title}</h2>
|
|
6
6
|
</header>
|
|
@@ -29,7 +29,7 @@ Add this to your HTML <head>:
|
|
|
29
29
|
<script type="importmap">
|
|
30
30
|
{ "imports": { "#pds/lit": "./path/to/lit.js" } }
|
|
31
31
|
<\/script>
|
|
32
|
-
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${g}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${g}>:`,w)},...m,mapper:g=>{if(customElements.get(g))return null;if(typeof r=="function")try{let w=r(g);return w===void 0?u(g):w}catch(w){return console.warn("Custom autoDefine.mapper error; falling back to default:",w?.message||w),u(g)}return u(g)}};l&&(d=new l(x),n.length>0&&typeof l.define=="function"&&await l.define(...n,{baseURL:s,mapper:x.mapper,onError:x.onError}))}return{autoDefiner:d,mergedEnhancers:c}}var Te=class extends EventTarget{},b=new Te;b.initializing=!1;b.currentPreset=null;var ft=(t="")=>String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Zt=function(t="log",e,...s){if(this?.debug||this?.design?.debug||!1||t==="error"||t==="warn"){let r=console[t]||console.log;s.length>0?r(e,...s):r(e)}};async function Jt(t,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let s=e?.runtimeConfigURL||`${t}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}b.registry=F;b.adoptLayers=Oe;b.adoptPrimitives=Ue;b.createStylesheet=Ne;b.isLiveMode=()=>F.isLive;b.ask=st;b.toast=C;function mt(t){let e=typeof CustomEvent=="function";try{let s=e?new CustomEvent("pds:ready",{detail:t}):new Event("pds:ready");b.dispatchEvent(s)}catch{}if(typeof document<"u")if(e){let s={detail:t,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}Object.defineProperty(b,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=b);var Me="pure-ds-theme",q=null,re=null;function he(t){try{if(typeof document>"u")return;let e="light";t?t==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=t:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function fe(t){try{if(q&&re){try{typeof q.removeEventListener=="function"?q.removeEventListener("change",re):typeof q.removeListener=="function"&&q.removeListener(re)}catch{}q=null,re=null}if(t==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let r=n?.matches===void 0?e.matches:n.matches;try{let o=r?"dark":"light";document.documentElement.setAttribute("data-theme",o),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};q=e,re=s,typeof e.addEventListener=="function"?e.addEventListener("change",s):typeof e.addListener=="function"&&e.addListener(s)}}catch{}}Object.defineProperty(b,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Me)||null}catch{return null}},set(t){try{if(typeof window>"u")return;t==null?localStorage.removeItem(Me):localStorage.setItem(Me,t),he(t),fe(t),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:t,source:"api"}}))}catch{}}});b._applyResolvedTheme=he;b._setupSystemListenerIfNeeded=fe;b.defaultEnhancers=xe;async function Qt(t){let e=t&&t.mode||"live",{mode:s,...n}=t||{};if(e==="static")return Xt(n);let r=De(n,{resolvePublicAssetURL:Re}),o=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",r).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(o);return i(b,n,{emitReady:mt,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe})}b.start=Qt;async function Xt(t){if(!t||typeof t!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=t.applyGlobalStyles??!0,s=t.manageTheme??!0,n=t.themeStorageKey??"pure-ds-theme",r=t.staticPaths??{},o=De(t,{resolvePublicAssetURL:Re}),i=t&&t.autoDefine||null,a;i&&i.baseURL?a=ue(pe(i.baseURL,{preferModule:!1})):a=`${o}components/`;let c=i&&Array.isArray(i.predefine)&&i.predefine||[],d=i&&typeof i.mapper=="function"&&i.mapper||null;try{lt(b);let{resolvedTheme:l}=pt({manageTheme:s,themeStorageKey:n,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe}),u=await Jt(o,t),f=u?.config?.design||u?.design||null,m=u?.config?.preset||u?.preset||"default",$=u?.presetId||ft(m)||"default",x=f?{[String($).toLowerCase()]:f,...String($).toLowerCase()!=="default"?{default:f}:{}}:null,g=t?.design&&typeof t.design=="object"?G(t.design):null,w=ft(t?.preset||"default")||"default",H=g?{[String(w).toLowerCase()]:g,...String(w).toLowerCase()!=="default"?{default:g}:{}}:null,A=x||t?.presets||H||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:
|
|
32
|
+
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${g}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${g}>:`,w)},...m,mapper:g=>{if(customElements.get(g))return null;if(typeof r=="function")try{let w=r(g);return w===void 0?u(g):w}catch(w){return console.warn("Custom autoDefine.mapper error; falling back to default:",w?.message||w),u(g)}return u(g)}};l&&(d=new l(x),n.length>0&&typeof l.define=="function"&&await l.define(...n,{baseURL:s,mapper:x.mapper,onError:x.onError}))}return{autoDefiner:d,mergedEnhancers:c}}var Te=class extends EventTarget{},b=new Te;b.initializing=!1;b.currentPreset=null;var ft=(t="")=>String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Zt=function(t="log",e,...s){if(this?.debug||this?.design?.debug||!1||t==="error"||t==="warn"){let r=console[t]||console.log;s.length>0?r(e,...s):r(e)}};async function Jt(t,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let s=e?.runtimeConfigURL||`${t}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}b.registry=F;b.adoptLayers=Oe;b.adoptPrimitives=Ue;b.createStylesheet=Ne;b.isLiveMode=()=>F.isLive;b.ask=st;b.toast=C;function mt(t){let e=typeof CustomEvent=="function";try{let s=e?new CustomEvent("pds:ready",{detail:t}):new Event("pds:ready");b.dispatchEvent(s)}catch{}if(typeof document<"u")if(e){let s={detail:t,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}Object.defineProperty(b,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=b);var Me="pure-ds-theme",q=null,re=null;function he(t){try{if(typeof document>"u")return;let e="light";t?t==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=t:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function fe(t){try{if(q&&re){try{typeof q.removeEventListener=="function"?q.removeEventListener("change",re):typeof q.removeListener=="function"&&q.removeListener(re)}catch{}q=null,re=null}if(t==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let r=n?.matches===void 0?e.matches:n.matches;try{let o=r?"dark":"light";document.documentElement.setAttribute("data-theme",o),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};q=e,re=s,typeof e.addEventListener=="function"?e.addEventListener("change",s):typeof e.addListener=="function"&&e.addListener(s)}}catch{}}Object.defineProperty(b,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Me)||null}catch{return null}},set(t){try{if(typeof window>"u")return;t==null?localStorage.removeItem(Me):localStorage.setItem(Me,t),he(t),fe(t),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:t,source:"api"}}))}catch{}}});b._applyResolvedTheme=he;b._setupSystemListenerIfNeeded=fe;b.defaultEnhancers=xe;async function Qt(t){let e=t&&t.mode||"live",{mode:s,...n}=t||{};if(e==="static")return Xt(n);let r=De(n,{resolvePublicAssetURL:Re}),o=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",r).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(o);return i(b,n,{emitReady:mt,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe})}b.start=Qt;async function Xt(t){if(!t||typeof t!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=t.applyGlobalStyles??!0,s=t.manageTheme??!0,n=t.themeStorageKey??"pure-ds-theme",r=t.staticPaths??{},o=De(t,{resolvePublicAssetURL:Re}),i=t&&t.autoDefine||null,a;i&&i.baseURL?a=ue(pe(i.baseURL,{preferModule:!1})):a=`${o}components/`;let c=i&&Array.isArray(i.predefine)&&i.predefine||[],d=i&&typeof i.mapper=="function"&&i.mapper||null;try{lt(b);let{resolvedTheme:l}=pt({manageTheme:s,themeStorageKey:n,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe}),u=await Jt(o,t),f=u?.config?.design||u?.design||null,m=u?.config?.preset||u?.preset||"default",$=u?.presetId||ft(m)||"default",x=f?{[String($).toLowerCase()]:f,...String($).toLowerCase()!=="default"?{default:f}:{}}:null,g=t?.design&&typeof t.design=="object"?G(t.design):null,w=ft(t?.preset||"default")||"default",H=g?{[String(w).toLowerCase()]:g,...String(w).toLowerCase()!=="default"?{default:g}:{}}:null,A=x||t?.presets||H||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:build or provide config.presets/config.design.");let D=u?.config?{...u.config,...t,preset:t?.preset||$,design:g||f||u?.config?.design}:t,L=ut(D,{},{presets:A,defaultLog:Zt}),Z=L.enhancers,I={tokens:`${o}styles/pds-tokens.css.js`,primitives:`${o}styles/pds-primitives.css.js`,components:`${o}styles/pds-components.css.js`,utilities:`${o}styles/pds-utilities.css.js`,styles:`${o}styles/pds-styles.css.js`},oe=u?.paths||{};if(r={...I,...oe,...r},b.registry.setStaticMode(r),e&&typeof document<"u")try{let S=await b.registry.getStylesheet("styles");if(S){S._pds=!0;let R=(document.adoptedStyleSheets||[]).filter(p=>p._pds!==!0);document.adoptedStyleSheets=[...R,S]}}catch(S){console.warn("Failed to apply static styles:",S)}let E=null,M=[];try{let S=await ht({autoDefineBaseURL:a,autoDefinePreload:c,autoDefineMapper:d,enhancers:Z,autoDefineOverrides:i||null,autoDefinePreferModule:!(i&&i.baseURL)},{baseEnhancers:xe});E=S.autoDefiner,M=S.mergedEnhancers||[]}catch(S){console.error("\u274C Failed to initialize AutoDefiner/Enhancers (static):",S)}let z=G(t);return b.currentConfig=Object.freeze({mode:"static",...structuredClone(z),design:structuredClone(L.generatorConfig.design),preset:L.generatorConfig.preset,theme:l,enhancers:M}),mt({mode:"static",config:L.generatorConfig,theme:l,autoDefiner:E}),{config:L.generatorConfig,theme:l,autoDefiner:E}}catch(l){throw b.dispatchEvent(new CustomEvent("pds:error",{detail:{error:l}})),l}}export{b as PDS};
|
|
33
33
|
/*! Bundled license information:
|
|
34
34
|
|
|
35
35
|
@lit/reactive-element/css-tag.js:
|
|
@@ -807,22 +807,22 @@
|
|
|
807
807
|
"globalAttributes": [
|
|
808
808
|
{
|
|
809
809
|
"name": "data-dropdown",
|
|
810
|
-
"description": "
|
|
810
|
+
"description": "Progressive enhancement: nav[data-dropdown]",
|
|
811
811
|
"valueSet": "v"
|
|
812
812
|
},
|
|
813
813
|
{
|
|
814
814
|
"name": "data-toggle",
|
|
815
|
-
"description": "
|
|
815
|
+
"description": "Progressive enhancement: label[data-toggle]",
|
|
816
816
|
"valueSet": "v"
|
|
817
817
|
},
|
|
818
818
|
{
|
|
819
819
|
"name": "data-required",
|
|
820
|
-
"description": "
|
|
820
|
+
"description": "Progressive enhancement: form[data-required]",
|
|
821
821
|
"valueSet": "v"
|
|
822
822
|
},
|
|
823
823
|
{
|
|
824
824
|
"name": "data-open",
|
|
825
|
-
"description": "
|
|
825
|
+
"description": "Progressive enhancement: fieldset[role=group][data-open]",
|
|
826
826
|
"valueSet": "v"
|
|
827
827
|
}
|
|
828
828
|
]
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
ο»Ώ# Pure Design System (PDS)
|
|
2
2
|
|
|
3
|
-
> β οΈ **Beta Software** - APIs are stabilizing but may still change. Pin versions in production: `"@pure-ds/core": "~0.
|
|
3
|
+
> β οΈ **Beta Software** - APIs are stabilizing but may still change. Pin versions in production: `"@pure-ds/core": "~0.5.6"`
|
|
4
4
|
|
|
5
5
|
[](https://github.com/mvneerven/pure-ds/actions/workflows/ci.yml)
|
|
6
6
|
[](#license)
|
|
@@ -49,7 +49,7 @@ await PDS.start(config);
|
|
|
49
49
|
|
|
50
50
|
## The PDS Philosophy
|
|
51
51
|
|
|
52
|
-
### Semantic Classes First
|
|
52
|
+
### HTML and Semantic Classes First
|
|
53
53
|
PDS generates **high-level primitives** that style semantic HTML:
|
|
54
54
|
|
|
55
55
|
```html
|
|
@@ -58,7 +58,12 @@ PDS generates **high-level primitives** that style semantic HTML:
|
|
|
58
58
|
<div class="alert alert-success">Done!</div>
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
HTML is a great starting point. There's no need to have components for stuff that HTML can do on its own, or with the help of a pinch of CSS and/or a dash of JavaScript. The [Pure Web Manifesto](https://pureweb.dev/manifesto) is a great set of principles.
|
|
62
|
+
|
|
63
|
+
Also, PDS is not a component library. Yes, there are a couple of (optional, lazy-loaded, components), but they are only for more complex widgets, like a TabStrip, a Drag & Drop uploader, a Rich Text Editor, etc.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Layout Utilities
|
|
62
67
|
A **small set** of layout utilities for composition:
|
|
63
68
|
|
|
64
69
|
```html
|
|
@@ -83,11 +88,11 @@ The **only** valid `style=""` in PDS sets CSS custom properties:
|
|
|
83
88
|
|
|
84
89
|
## Why PDS Exists
|
|
85
90
|
|
|
86
|
-
|
|
|
91
|
+
| Other Libs | The PDS Way |
|
|
87
92
|
|-------------|-------------|
|
|
88
93
|
| `class="flex items-center gap-4 p-6 bg-white rounded-lg shadow-md"` | `class="card"` |
|
|
89
94
|
| `style="color: #007acc;"` | Uses `--color-primary-500` token |
|
|
90
|
-
| Import a Button component | `<button class="btn-primary">` |
|
|
95
|
+
| Import a `<Button>` component | `<button class="btn-primary">` |
|
|
91
96
|
| 47 utility classes per element | Semantic class + maybe one layout utility |
|
|
92
97
|
|
|
93
98
|
**The result:** Readable HTML. Inspectable CSS. Sites that work without JS. Code that lasts decades.
|
|
@@ -99,9 +104,9 @@ PDS follows the [Pure Web Manifesto](https://pureweb.dev/manifesto)βsustainabl
|
|
|
99
104
|
## Key Features
|
|
100
105
|
|
|
101
106
|
- π¨ **Configuration-Driven** β Single source of truth generates everything
|
|
102
|
-
- π **Live or Static** β Runtime generation or pre-built
|
|
107
|
+
- π **Live or Static** β Runtime generation or pre-built CSS
|
|
103
108
|
- π― **Framework Agnostic** β Vanilla, Lit, React, Vue, Svelte, Next.js
|
|
104
|
-
- π **Web Standards** β
|
|
109
|
+
- π **Web Standards** β `HTMLElement` API, Constructable Stylesheets, Shadow DOM, etc.
|
|
105
110
|
- π§© **Progressive Enhancement** β Semantic HTML first, enhance where needed
|
|
106
111
|
- βΏ **Accessibility Built-in** β WCAG AA validation, contrast checking
|
|
107
112
|
- π¦ **Zero Build Required** β Works directly in browsers
|
|
@@ -132,9 +137,9 @@ PDS follows the [Pure Web Manifesto](https://pureweb.dev/manifesto)βsustainabl
|
|
|
132
137
|
|
|
133
138
|
---
|
|
134
139
|
|
|
135
|
-
## The
|
|
140
|
+
## The Four Layers
|
|
136
141
|
|
|
137
|
-
PDS is built on **three fully optional layers**, each powered by your config:
|
|
142
|
+
PDS is built on **three fully optional layers**, each powered by your config, and a great DX layer on top:
|
|
138
143
|
|
|
139
144
|
### 1. Styles β Deterministic Global CSS
|
|
140
145
|
|
|
@@ -174,8 +179,17 @@ A growing set of PDS components:
|
|
|
174
179
|
|
|
175
180
|
Auto-defined when used. Lazy-loaded via dynamic imports. Styled by your tokens. Zero dependencies.
|
|
176
181
|
|
|
182
|
+
|
|
183
|
+
### 4: DX - Built-in Storybook & LLM Support
|
|
184
|
+
|
|
185
|
+
Install `@pure-ds/storybook` and get a cloned PDS Storybook instance right where you code, inside your project. Then add some `.stories.js` and see them immediately pop up.
|
|
186
|
+
|
|
187
|
+
Install `@pure-ds/core` and get instant PDS AI Coding Instrucions at your fingertips (GitHub Copilot & Cursor support built in)
|
|
188
|
+
|
|
177
189
|
### How It Works
|
|
178
190
|
|
|
191
|
+
It all starts with your `pds.confog.js` file in the root of the project (auto-generated when installing)
|
|
192
|
+
|
|
179
193
|
```
|
|
180
194
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
181
195
|
β Configuration β
|
|
@@ -251,13 +265,13 @@ npm install @pure-ds/core
|
|
|
251
265
|
During installation, PDS automatically:
|
|
252
266
|
- Creates a default `pds.config.js` (if one doesn't exist)
|
|
253
267
|
- Copies Copilot/AI instructions to `.github/copilot-instructions.md`
|
|
254
|
-
- Adds `pds:
|
|
255
|
-
- Runs `pds:
|
|
268
|
+
- Adds `pds:build` and `pds:build-icons` scripts to your `package.json`
|
|
269
|
+
- Runs `pds:build` to generate static assets
|
|
256
270
|
|
|
257
271
|
To manually re-sync assets:
|
|
258
272
|
|
|
259
273
|
```bash
|
|
260
|
-
npm run pds:
|
|
274
|
+
npm run pds:build
|
|
261
275
|
```
|
|
262
276
|
|
|
263
277
|
### Lit Import Convention
|
|
@@ -328,10 +342,10 @@ await PDS.start({
|
|
|
328
342
|
|
|
329
343
|
Pre-generate assets for production:
|
|
330
344
|
|
|
331
|
-
**1.
|
|
345
|
+
**1. Build static files:**
|
|
332
346
|
|
|
333
347
|
```bash
|
|
334
|
-
npm run pds:
|
|
348
|
+
npm run pds:build
|
|
335
349
|
```
|
|
336
350
|
|
|
337
351
|
This creates:
|
|
@@ -1562,13 +1576,13 @@ await PDS.start({ design: myPreset });
|
|
|
1562
1576
|
|
|
1563
1577
|
---
|
|
1564
1578
|
|
|
1565
|
-
## CLI &
|
|
1579
|
+
## CLI & Build
|
|
1566
1580
|
|
|
1567
1581
|
### Available Scripts
|
|
1568
1582
|
|
|
1569
1583
|
| Script | Description |
|
|
1570
1584
|
|--------|-------------|
|
|
1571
|
-
| `npm run pds:
|
|
1585
|
+
| `npm run pds:build` | Full build: styles, components, icons, and IntelliSense data |
|
|
1572
1586
|
| `npm run pds:dx` | Generate all IntelliSense data (HTML + CSS) |
|
|
1573
1587
|
| `npm run pds:manifest` | Generate HTML IntelliSense (Custom Elements Manifest) |
|
|
1574
1588
|
| `npm run pds:css-data` | Generate CSS IntelliSense (tokens, classes, attributes) |
|
|
@@ -1596,10 +1610,10 @@ This generates a `pds.config.js` with:
|
|
|
1596
1610
|
|
|
1597
1611
|
**Note:** During `npm install`, PDS automatically creates this file if it doesn't exist.
|
|
1598
1612
|
|
|
1599
|
-
###
|
|
1613
|
+
### Build Static Assets
|
|
1600
1614
|
|
|
1601
1615
|
```bash
|
|
1602
|
-
npm run pds:
|
|
1616
|
+
npm run pds:build
|
|
1603
1617
|
```
|
|
1604
1618
|
|
|
1605
1619
|
**Output:**
|
|
@@ -1707,14 +1721,14 @@ Reload VS Code: **Ctrl+Shift+P** β **Developer: Reload Window**
|
|
|
1707
1721
|
|
|
1708
1722
|
### Generation
|
|
1709
1723
|
|
|
1710
|
-
IntelliSense data is automatically generated with
|
|
1724
|
+
IntelliSense data is automatically generated with build:
|
|
1711
1725
|
|
|
1712
1726
|
```bash
|
|
1713
1727
|
# Generate all IntelliSense data (HTML + CSS)
|
|
1714
1728
|
npm run pds:dx
|
|
1715
1729
|
|
|
1716
|
-
# Or as part of full
|
|
1717
|
-
npm run pds:
|
|
1730
|
+
# Or as part of full build
|
|
1731
|
+
npm run pds:build
|
|
1718
1732
|
|
|
1719
1733
|
# Or generate individually
|
|
1720
1734
|
npm run pds:manifest # HTML IntelliSense only
|
|
@@ -51,7 +51,7 @@ class PDSRegistry {
|
|
|
51
51
|
// No access to config in static mode, fall back to console
|
|
52
52
|
console.error(`[PDS Registry] Failed to load static ${layer}:`, error);
|
|
53
53
|
console.error(`[PDS Registry] Looking for: ${this._staticPaths[layer]}`);
|
|
54
|
-
console.error(`[PDS Registry] Make sure you've run 'npm run pds:
|
|
54
|
+
console.error(`[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path`);
|
|
55
55
|
// Return empty stylesheet as fallback
|
|
56
56
|
const fallback = new CSSStyleSheet();
|
|
57
57
|
fallback.replaceSync("/* Failed to load " + layer + " */");
|
package/src/js/pds.js
CHANGED
|
@@ -443,7 +443,7 @@ async function staticInit(config) {
|
|
|
443
443
|
const presets = runtimePresets || config?.presets || inlinePresets || {};
|
|
444
444
|
if (!Object.keys(presets || {}).length) {
|
|
445
445
|
throw new Error(
|
|
446
|
-
"PDS static mode requires preset data. Run pds:
|
|
446
|
+
"PDS static mode requires preset data. Run pds:build or provide config.presets/config.design."
|
|
447
447
|
);
|
|
448
448
|
}
|
|
449
449
|
const normalizedInput = runtimeConfig?.config
|