@pure-ds/core 0.5.20 → 0.5.22
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/dist/types/pds.d.ts +0 -1
- package/dist/types/public/assets/js/pds-manager.d.ts +5 -5
- package/dist/types/public/assets/js/pds.d.ts +3 -1
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-drawer.d.ts +1 -0
- package/dist/types/public/assets/pds/components/pds-drawer.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts +0 -3
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/dist/types/src/js/pds.d.ts +2 -0
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pds-cli/bin/generate-css-data.js +7 -2
- package/packages/pds-cli/bin/pds-bootstrap.js +13 -77
- package/packages/pds-cli/bin/postinstall.mjs +2 -61
- package/packages/pds-cli/bin/templates/starter-templates.js +62 -0
- package/public/assets/js/app.js +16 -16
- package/public/assets/js/pds-manager.js +47 -47
- package/public/assets/js/pds.js +5 -5
- package/public/assets/pds/components/pds-drawer.js +142 -2
- package/readme.md +4 -162
- package/src/js/pds-core/pds-live.js +0 -26
- package/src/js/pds-core/pds-start-helpers.js +0 -60
- package/src/js/pds.d.ts +0 -1
- package/src/js/pds.js +26 -39
package/dist/types/pds.d.ts
CHANGED
|
@@ -298,7 +298,6 @@ export class PDS extends EventTarget {
|
|
|
298
298
|
readonly autoDefiner?: any;
|
|
299
299
|
|
|
300
300
|
// Instance helpers
|
|
301
|
-
setTheme?(theme: 'light' | 'dark' | 'system', options?: { storageKey?: string; persist?: boolean }): Promise<string>;
|
|
302
301
|
preloadCritical?(config: any, options?: { theme?: string; layers?: string[] }): void;
|
|
303
302
|
}
|
|
304
303
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
declare function
|
|
1
|
+
export { nt as startLive };
|
|
2
|
+
declare function nt(n: any, t: any, { emitReady: e, applyResolvedTheme: a, setupSystemListenerIfNeeded: r }: {
|
|
3
3
|
emitReady: any;
|
|
4
4
|
applyResolvedTheme: any;
|
|
5
5
|
setupSystemListenerIfNeeded: any;
|
|
@@ -604,8 +604,8 @@ declare function it(n: any, t: any, { emitReady: e, applyResolvedTheme: a, setup
|
|
|
604
604
|
};
|
|
605
605
|
"__#private@#l"(t: any): number;
|
|
606
606
|
"__#private@#c"(t: any, e: any): number;
|
|
607
|
-
"__#private@#h"(t: any, e?: number): string;
|
|
608
607
|
"__#private@#m"(t: any, e?: number): string;
|
|
608
|
+
"__#private@#h"(t: any, e?: number): string;
|
|
609
609
|
"__#private@#z"(t: any, e: any, a?: number): string;
|
|
610
610
|
"__#private@#M"(t: any, e: any, a: any): string;
|
|
611
611
|
"__#private@#F"(t: any): {
|
|
@@ -732,8 +732,8 @@ declare function it(n: any, t: any, { emitReady: e, applyResolvedTheme: a, setup
|
|
|
732
732
|
"__#private@#Z"(t: any): string;
|
|
733
733
|
"__#private@#J"(t: any): string;
|
|
734
734
|
"__#private@#Y"(t: any): string;
|
|
735
|
-
"__#private@#K"(): string;
|
|
736
735
|
"__#private@#X"(): string;
|
|
736
|
+
"__#private@#K"(): string;
|
|
737
737
|
"__#private@#ee"(): "" | "/* Liquid glass utility (opt-in via options.liquidGlassEffects) */\n.liquid-glass {\n border-radius: var(--radius-lg);\n /* Subtle translucent fill blended with surface */\n background: color-mix(in oklab, var(--color-surface-subtle) 45%, transparent);\n\n background-image: linear-gradient(\n 135deg,\n rgba(255,255,255,0.35),\n rgba(255,255,255,0.12)\n );\n /* Frosted glass blur + saturation */\n -webkit-backdrop-filter: blur(12px) saturate(140%);\n backdrop-filter: blur(12px) saturate(140%);\n /* Soft inner highlight and outer depth */\n box-shadow:\n inset 0 1px 0 rgba(255,255,255,0.6),\n inset 0 -40px 80px rgba(255,255,255,0.12),\n 0 10px 30px rgba(0,0,0,0.10);\n /* Glossy border with slight light and dark edges */\n border: 1px solid color-mix(in oklab, var(--color-primary-500) 22%, transparent);\n outline: 1px solid color-mix(in oklab, #ffffff 18%, transparent);\n outline-offset: -1px;\n}\n\nhtml[data-theme=\"dark\"] .liquid-glass {\n background: color-mix(in oklab, var(--color-surface-inverse) 45%, transparent);\n background-image: linear-gradient(\n 135deg,\n color-mix(in oklab, var(--color-primary-300) 40%, transparent),\n color-mix(in oklab, var(--color-surface-overlay) 48%, transparent)\n );\n box-shadow:\n inset 0 1px 0 rgba(255,255,255,0.12),\n inset 0 -40px 80px rgba(0,0,0,0.55),\n 0 18px 38px rgba(0,0,0,0.65);\n border: 1px solid color-mix(in oklab, var(--color-primary-300) 26%, transparent);\n outline: 1px solid color-mix(in oklab, #ffffff 16%, transparent);\n}\n\n/* Fallback when backdrop-filter isn't supported */\n@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {\n .liquid-glass {\n /* Strengthen fill a bit to compensate for lack of blur */\n background: color-mix(in oklab, var(--color-surface-subtle) 70%, rgba(255,255,255,0.4));\n box-shadow:\n inset 0 1px 0 rgba(255,255,255,0.6),\n 0 10px 24px rgba(0,0,0,0.08);\n }\n\n html[data-theme=\"dark\"] .liquid-glass {\n background: color-mix(in oklab, var(--color-surface-inverse) 70%, transparent);\n box-shadow:\n inset 0 1px 0 rgba(255,255,255,0.1),\n 0 18px 32px rgba(0,0,0,0.58);\n }\n}\n";
|
|
738
738
|
"__#private@#te"(): string;
|
|
739
739
|
"__#private@#re"(): string;
|
|
@@ -748,8 +748,8 @@ declare function it(n: any, t: any, { emitReady: e, applyResolvedTheme: a, setup
|
|
|
748
748
|
"__#private@#pe"(): string;
|
|
749
749
|
"__#private@#ue"(): string;
|
|
750
750
|
"__#private@#ge"(): string;
|
|
751
|
-
"__#private@#he"(): string;
|
|
752
751
|
"__#private@#me"(): string;
|
|
752
|
+
"__#private@#he"(): string;
|
|
753
753
|
"__#private@#o"(t: any): {
|
|
754
754
|
h: number;
|
|
755
755
|
s: number;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { b as PDS };
|
|
2
1
|
declare var b: {
|
|
3
2
|
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
4
3
|
dispatchEvent(event: Event): boolean;
|
|
5
4
|
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
6
5
|
};
|
|
6
|
+
declare function qs(t: any): void;
|
|
7
|
+
declare function Hs(t: any): void;
|
|
8
|
+
export { b as PDS, qs as applyResolvedTheme, Hs as setupSystemListenerIfNeeded };
|
|
7
9
|
//# sourceMappingURL=pds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../../public/assets/js/pds.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../../public/assets/js/pds.js"],"names":[],"mappings":"AA+BooB;;;;EAAQ;AAAwyC,kCAAkX;AAAA,kCAA6pB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-drawer.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-drawer.js"],"names":[],"mappings":"AAAA,uBAAuB;AAEvB;;;;;;;;;;;;;;;;;;GAkBG;AACH;
|
|
1
|
+
{"version":3,"file":"pds-drawer.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-drawer.js"],"names":[],"mappings":"AAAA,uBAAuB;AAEvB;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACE,uCAAsB;IA8BtB,0CASC;IAhBC,eAAkB;IAClB,kBAAyB;IACzB,cAAqB;IACrB,mBAAoB;IACpB,mBAAoB;IACpB,oBAAuB;IAuBzB,cANU,OAAO,EAoBhB;IAtBD;;;;OAIG;IACH,YAHU,OAAO,CAKhB;IA0BD,kBAPU,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,EAc5C;IAhBD;;;;;OAKG;IACH,gBAJU,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAM5C;IAmBD,cAPU,QAAQ,GAAG,MAAM,EAY1B;IAdD;;;;;OAKG;IACH,YAJU,QAAQ,GAAG,MAAM,CAM1B;IAiBD,mBAPU,MAAM,EAkBf;IApBD;;;;;OAKG;IACH,iBAJU,MAAM,CAMf;IAuBD,mBAPU,MAAM,EAkBf;IApBD;;;;;OAKG;IACH,iBAJU,MAAM,CAMf;IAuBD,mBAPU,OAAO,EAYhB;IAdD;;;;;OAKG;IACH,iBAJU,OAAO,CAMhB;IAQD,iEA0CC;IAED,mCAgLC;IAED,6BAeC;IAID;;;;OAIG;IACH,0BAEC;IAED;;;;OAIG;IACH,2BAEC;IAED;;;;OAIG;IACH,4BAEC;IAED;;;;;;;;;;;;;;OAcG;IACH,yBAXW,GAAG,GAAC,WAAW,GAAC,MAAM,YAE9B;QAAyC,MAAM,GAAvC,GAAG,GAAC,WAAW,GAAC,MAAM;QACkB,QAAQ,GAAhD,QAAQ,GAAC,KAAK,GAAC,MAAM,GAAC,OAAO;QACZ,SAAS,GAA1B,MAAM;QACW,SAAS,GAA1B,MAAM;QACY,SAAS,GAA3B,OAAO;QACW,YAAY,GAA9B,OAAO;QACU,YAAY,GAA7B,MAAM;KACd,GAAU,OAAO,CAAC,IAAI,CAAC,CA6BzB;IAED;;;;OAIG;IACH;;;;;;;OAOG;IACH,+BAJW,GAAG,GAAC,WAAW,GAAC,MAAM,kBACtB,GAAG,GAAC,WAAW,GAAC,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAyDzB;IAED;;;;OAIG;IACH,4BAEC;;CAwaF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-live.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-live.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-live.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-live.js"],"names":[],"mappings":"AA8IA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6NC;0BAvWyB,oBAAoB"}
|
|
@@ -48,9 +48,6 @@ export function resolveThemeAndApply({ manageTheme, themeStorageKey, applyResolv
|
|
|
48
48
|
resolvedTheme: string;
|
|
49
49
|
storedTheme: string;
|
|
50
50
|
};
|
|
51
|
-
export function createSetTheme({ PDS, defaultStorageKey, setupSystemListenerIfNeeded, onApply, }?: {
|
|
52
|
-
defaultStorageKey?: string;
|
|
53
|
-
}): (theme: any, options?: {}) => Promise<any>;
|
|
54
51
|
export function resolveRuntimeAssetRoot(config: any, { resolvePublicAssetURL }: {
|
|
55
52
|
resolvePublicAssetURL: any;
|
|
56
53
|
}): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-start-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-start-helpers.js"],"names":[],"mappings":"AAmBA,sEAgCC;AAiBD,mDASC;AA6BD,8CAsBC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGC;AAGD;;;;;;;;EAmCC;
|
|
1
|
+
{"version":3,"file":"pds-start-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-start-helpers.js"],"names":[],"mappings":"AAmBA,sEAgCC;AAiBD,mDASC;AA6BD,8CAsBC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGC;AAGD;;;;;;;;EAmCC;AAED;;QASC;AAGD;;;;;GAmIC;AAnZM,qDAGI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../src/js/pds.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../src/js/pds.js"],"names":[],"mappings":"AA6KA,mDAsBC;AAGD,4DAuCC;;;;;;;;;;;;;;;;;;;;;;;;;cAtNa,OAAO,4BAA4B,EAAE,WAAW;;;;iBAChD,CAAC,SAAS,CAAC,EAAE,OAAO,6BAA6B,EAAE,SAAS,KAAK,IAAI;;;;iBACrE,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;;qBAChG,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;;sBAC7E,CAAC,GAAG,EAAC,MAAM,KAAK,aAAa;;AAW3C,+BAA+B;AAC/B,kBADW,MAAM,GAAG,OAAO,CACD;AArC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;GAIG;AACH;CAAoC"}
|
package/package.json
CHANGED
|
@@ -395,14 +395,19 @@ function extractDataAttributes(ontology) {
|
|
|
395
395
|
|
|
396
396
|
if (ontology.enhancements) {
|
|
397
397
|
for (const enhancement of ontology.enhancements) {
|
|
398
|
+
const selector = typeof enhancement === 'string'
|
|
399
|
+
? enhancement
|
|
400
|
+
: enhancement?.selector || enhancement?.demoHtml || '';
|
|
401
|
+
if (typeof selector !== 'string') continue;
|
|
402
|
+
|
|
398
403
|
// Extract data attributes from selectors like "[data-dropdown]"
|
|
399
|
-
const matches =
|
|
404
|
+
const matches = selector.match(/\[data-([^\]]+)\]/g);
|
|
400
405
|
if (matches) {
|
|
401
406
|
for (const match of matches) {
|
|
402
407
|
const attrName = match.slice(1, -1); // Remove [ and ]
|
|
403
408
|
attributes.push({
|
|
404
409
|
name: attrName,
|
|
405
|
-
description: `Enhancement: ${
|
|
410
|
+
description: `Enhancement: ${selector}`,
|
|
406
411
|
category: 'Data Enhancements'
|
|
407
412
|
});
|
|
408
413
|
}
|
|
@@ -4,6 +4,7 @@ import { readFile, writeFile, mkdir, access } from 'fs/promises';
|
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { spawn } from 'child_process';
|
|
7
|
+
import { buildStarterPdsConfig } from './templates/starter-templates.js';
|
|
7
8
|
|
|
8
9
|
const projectRoot = process.cwd();
|
|
9
10
|
|
|
@@ -201,7 +202,7 @@ customElements.define(
|
|
|
201
202
|
</p>
|
|
202
203
|
</div>
|
|
203
204
|
<nav>
|
|
204
|
-
<a target="_blank" href="https://github.com/Pure-Web-Foundation/pure-ds/blob/main/
|
|
205
|
+
<a target="_blank" href="https://github.com/Pure-Web-Foundation/pure-ds/blob/main/getting-started.md" class="btn btn-primary btn-lg">
|
|
205
206
|
<pds-icon icon="rocket"></pds-icon> Get Started
|
|
206
207
|
</a>
|
|
207
208
|
<a target="_blank" href="https://puredesignsystem.z6.web.core.windows.net/storybook/" class="btn btn-secondary btn-lg">
|
|
@@ -231,11 +232,9 @@ customElements.define(
|
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
async connectedCallback() {
|
|
234
|
-
const componentStyles = PDS.createStylesheet(
|
|
235
|
-
:host {
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
\`);
|
|
235
|
+
const componentStyles = PDS.createStylesheet(
|
|
236
|
+
"\n :host {\n display: block;\n }\n "
|
|
237
|
+
);
|
|
239
238
|
|
|
240
239
|
await PDS.adoptLayers(
|
|
241
240
|
this.shadowRoot,
|
|
@@ -243,40 +242,15 @@ customElements.define(
|
|
|
243
242
|
[componentStyles],
|
|
244
243
|
);
|
|
245
244
|
|
|
246
|
-
this.shadowRoot.innerHTML +=
|
|
247
|
-
<form>
|
|
248
|
-
<fieldset role="radiogroup" aria-label="Theme" class="buttons">
|
|
249
|
-
<legend>Theme</legend>
|
|
250
|
-
<label>
|
|
251
|
-
<input type="radio" name="theme" value="system">
|
|
252
|
-
<span>
|
|
253
|
-
<pds-icon icon="moon-stars"></pds-icon>
|
|
254
|
-
System
|
|
255
|
-
</span>
|
|
256
|
-
</label>
|
|
257
|
-
<label>
|
|
258
|
-
<input type="radio" name="theme" value="light">
|
|
259
|
-
<span>
|
|
260
|
-
<pds-icon icon="sun"></pds-icon>
|
|
261
|
-
Light
|
|
262
|
-
</span>
|
|
263
|
-
</label>
|
|
264
|
-
<label>
|
|
265
|
-
<input type="radio" name="theme" value="dark">
|
|
266
|
-
<span>
|
|
267
|
-
<pds-icon icon="moon"></pds-icon>
|
|
268
|
-
Dark
|
|
269
|
-
</span>
|
|
270
|
-
</label>
|
|
271
|
-
</fieldset>
|
|
272
|
-
</form>\`;
|
|
245
|
+
this.shadowRoot.innerHTML +=
|
|
246
|
+
"\n <form>\n <fieldset role=\"radiogroup\" aria-label=\"Theme\" class=\"buttons\">\n <legend>Theme</legend>\n <label>\n <input type=\"radio\" name=\"theme\" value=\"system\">\n <span>\n <pds-icon icon=\"moon-stars\"></pds-icon>\n System\n </span>\n </label>\n <label>\n <input type=\"radio\" name=\"theme\" value=\"light\">\n <span>\n <pds-icon icon=\"sun\"></pds-icon>\n Light\n </span>\n </label>\n <label>\n <input type=\"radio\" name=\"theme\" value=\"dark\">\n <span>\n <pds-icon icon=\"moon\"></pds-icon>\n Dark\n </span>\n </label>\n </fieldset>\n </form>";
|
|
273
247
|
|
|
274
248
|
this.#updateCheckedState();
|
|
275
249
|
|
|
276
250
|
this.shadowRoot.addEventListener("change", (e) => {
|
|
277
251
|
if (e.target.type === "radio" && e.target.name === "theme") {
|
|
278
|
-
PDS.
|
|
279
|
-
PDS.toast(
|
|
252
|
+
PDS.theme = e.target.value;
|
|
253
|
+
PDS.toast("Theme changed to " + e.target.value, { duration: 2000 });
|
|
280
254
|
}
|
|
281
255
|
});
|
|
282
256
|
|
|
@@ -323,8 +297,9 @@ const parseHTML = (html) => {
|
|
|
323
297
|
};
|
|
324
298
|
|
|
325
299
|
const settingsBtn = parseHTML(
|
|
326
|
-
|
|
327
|
-
|
|
300
|
+
\`<button id="settings-btn" class="icon-only btn-xs btn-outline" aria-label="Settings">
|
|
301
|
+
<pds-icon icon="gear"></pds-icon>
|
|
302
|
+
</button>\`,
|
|
328
303
|
)[0];
|
|
329
304
|
|
|
330
305
|
document.body.appendChild(settingsBtn);
|
|
@@ -342,46 +317,7 @@ settingsBtn.addEventListener("click", () => {
|
|
|
342
317
|
}
|
|
343
318
|
|
|
344
319
|
function buildPdsConfig() {
|
|
345
|
-
return
|
|
346
|
-
? globalThis.PDS.defaultEnhancers
|
|
347
|
-
: [];
|
|
348
|
-
|
|
349
|
-
export const config = {
|
|
350
|
-
mode: "static",
|
|
351
|
-
preset: "social-feed",
|
|
352
|
-
|
|
353
|
-
autoDefine: {
|
|
354
|
-
predefine: ["pds-icon", "pds-drawer", "pds-toaster"],
|
|
355
|
-
|
|
356
|
-
// Custom component paths
|
|
357
|
-
mapper: (tag) => {
|
|
358
|
-
if (tag.startsWith("my-")) return \`/assets/my/\${tag}.js\`;
|
|
359
|
-
|
|
360
|
-
// Return nothing to use PDS default mapping
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
enhancers: [
|
|
364
|
-
...defaultEnhancers,
|
|
365
|
-
{
|
|
366
|
-
selector: ".hero",
|
|
367
|
-
description: "Adds tooltip on hover",
|
|
368
|
-
run: (element) => {
|
|
369
|
-
let angle = 135;
|
|
370
|
-
const speed = 0.5;
|
|
371
|
-
|
|
372
|
-
function animate() {
|
|
373
|
-
angle = (angle + speed) % 360;
|
|
374
|
-
element.style.setProperty("--gradient-angle", \`\${angle}deg\`);
|
|
375
|
-
requestAnimationFrame(animate);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
animate();
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
],
|
|
382
|
-
},
|
|
383
|
-
};
|
|
384
|
-
`;
|
|
320
|
+
return buildStarterPdsConfig();
|
|
385
321
|
}
|
|
386
322
|
|
|
387
323
|
function buildEsbuildDevCjs() {
|
|
@@ -10,6 +10,7 @@ import { readFileSync } from 'fs';
|
|
|
10
10
|
import { createHash } from 'crypto';
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
13
|
+
import { buildStarterPdsConfig } from './templates/starter-templates.js';
|
|
13
14
|
|
|
14
15
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
16
|
const repoRoot = path.resolve(__dirname, '../../../');
|
|
@@ -156,67 +157,7 @@ async function ensurePdsConfig(consumerRoot, force = false) {
|
|
|
156
157
|
// File doesn't exist, create it
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
const defaultConfig =
|
|
160
|
-
? globalThis.PDS.defaultEnhancers
|
|
161
|
-
: [];
|
|
162
|
-
|
|
163
|
-
export const config = {
|
|
164
|
-
mode: "static",
|
|
165
|
-
preset: "social-feed",
|
|
166
|
-
|
|
167
|
-
autoDefine: {
|
|
168
|
-
predefine: ["pds-icon", "pds-drawer", "pds-toaster"],
|
|
169
|
-
|
|
170
|
-
// Custom component paths
|
|
171
|
-
mapper: (tag) => {
|
|
172
|
-
if (tag.startsWith("my-")) return \`/assets/my/\${tag}.js\`;
|
|
173
|
-
|
|
174
|
-
// Return nothing to use PDS default mapping
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
enhancers: [
|
|
178
|
-
...defaultEnhancers,
|
|
179
|
-
{
|
|
180
|
-
selector: ".hero",
|
|
181
|
-
description: "Adds tooltip on hover",
|
|
182
|
-
run: (element) => {
|
|
183
|
-
// make the border-gradient in PDS rotate slowly
|
|
184
|
-
let angle = 135;
|
|
185
|
-
const speed = 0.5; // degrees per frame (~30 degrees/second at 60fps)
|
|
186
|
-
|
|
187
|
-
function animate() {
|
|
188
|
-
angle = (angle + speed) % 360;
|
|
189
|
-
element.style.setProperty("--gradient-angle", \`\${angle}deg\`);
|
|
190
|
-
requestAnimationFrame(animate);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
animate();
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
// Uncomment to override preset design tokens:
|
|
200
|
-
// design: {
|
|
201
|
-
// colors: {
|
|
202
|
-
// primary: '#007acc',
|
|
203
|
-
// secondary: '#5c2d91',
|
|
204
|
-
// accent: '#ec4899'
|
|
205
|
-
// },
|
|
206
|
-
// typography: {
|
|
207
|
-
// fontFamilyHeadings: 'Inter, sans-serif',
|
|
208
|
-
// fontFamilyBody: 'Inter, sans-serif',
|
|
209
|
-
// baseFontSize: 16,
|
|
210
|
-
// fontScale: 1.25
|
|
211
|
-
// },
|
|
212
|
-
// spatialRhythm: {
|
|
213
|
-
// baseUnit: 8,
|
|
214
|
-
// scaleRatio: 1.5
|
|
215
|
-
// }
|
|
216
|
-
// }
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
`;
|
|
160
|
+
const defaultConfig = buildStarterPdsConfig();
|
|
220
161
|
|
|
221
162
|
await writeFile(configPath, defaultConfig, 'utf8');
|
|
222
163
|
console.log('📝 Created default pds.config.js');
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export function buildStarterPdsConfig() {
|
|
2
|
+
return `const defaultEnhancers = Array.isArray(globalThis.PDS?.defaultEnhancers)
|
|
3
|
+
? globalThis.PDS.defaultEnhancers
|
|
4
|
+
: [];
|
|
5
|
+
|
|
6
|
+
export const config = {
|
|
7
|
+
mode: "static",
|
|
8
|
+
preset: "social-feed",
|
|
9
|
+
|
|
10
|
+
autoDefine: {
|
|
11
|
+
predefine: ["pds-icon", "pds-drawer", "pds-toaster"],
|
|
12
|
+
|
|
13
|
+
// Custom component paths
|
|
14
|
+
mapper: (tag) => {
|
|
15
|
+
if (tag.startsWith("my-")) return \`/assets/my/\${tag}.js\`;
|
|
16
|
+
|
|
17
|
+
// Return nothing to use PDS default mapping
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
enhancers: [
|
|
21
|
+
...defaultEnhancers,
|
|
22
|
+
{
|
|
23
|
+
selector: ".hero",
|
|
24
|
+
description: "Make PDS border-gradient rotate slowly",
|
|
25
|
+
run: (element) => {
|
|
26
|
+
let angle = 135;
|
|
27
|
+
const speed = 0.5; // degrees per frame (~30 degrees/second at 60fps)
|
|
28
|
+
|
|
29
|
+
function animate() {
|
|
30
|
+
angle = (angle + speed) % 360;
|
|
31
|
+
element.style.setProperty("--gradient-angle", \`\${angle}deg\`);
|
|
32
|
+
requestAnimationFrame(animate);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
animate();
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Uncomment to override preset design tokens:
|
|
42
|
+
// design: {
|
|
43
|
+
// colors: {
|
|
44
|
+
// primary: '#007acc',
|
|
45
|
+
// secondary: '#5c2d91',
|
|
46
|
+
// accent: '#ec4899'
|
|
47
|
+
// },
|
|
48
|
+
// typography: {
|
|
49
|
+
// fontFamilyHeadings: 'Inter, sans-serif',
|
|
50
|
+
// fontFamilyBody: 'Inter, sans-serif',
|
|
51
|
+
// baseFontSize: 16,
|
|
52
|
+
// fontScale: 1.25
|
|
53
|
+
// },
|
|
54
|
+
// spatialRhythm: {
|
|
55
|
+
// baseUnit: 8,
|
|
56
|
+
// scaleRatio: 1.5
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
};
|
|
61
|
+
`;
|
|
62
|
+
}
|