@pure-ds/core 0.5.39 → 0.5.41
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/.cursorrules +3 -1
- package/.github/copilot-instructions.md +3 -1
- package/dist/types/public/assets/pds/components/pds-fab.d.ts.map +1 -1
- package/dist/types/src/js/lit.d.ts +19 -0
- package/dist/types/src/js/lit.d.ts.map +1 -1
- package/package.json +2 -1
- package/packages/pds-cli/bin/pds-static.js +17 -0
- package/packages/pds-cli/bin/templates/bootstrap/public/index.html +1 -1
- package/public/assets/js/app.js +19 -14
- package/public/assets/js/lit.js +3 -3
- package/public/assets/pds/components/pds-fab.js +4 -6
- package/public/assets/pds/external/lit.js +131 -0
- package/readme.md +53 -2
package/.cursorrules
CHANGED
|
@@ -359,12 +359,14 @@ This component uses `import { ... } from "#pds/lit"` and **requires** an import
|
|
|
359
359
|
<script type="importmap">
|
|
360
360
|
{
|
|
361
361
|
"imports": {
|
|
362
|
-
"#pds/lit": "/assets/
|
|
362
|
+
"#pds/lit": "/assets/pds/external/lit.js"
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
</script>
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
+
**Note:** `#pds/lit` is a convenience bundle that re-exports Lit and adds PDS helpers (`lazyProps`, `msg()`, `loadLocale()`). If a project prefers its own Lit bundle, it must provide equivalents and map `#pds/lit` accordingly.
|
|
369
|
+
|
|
368
370
|
**When generating code with lazy-loaded components, ALWAYS wait for definition:**
|
|
369
371
|
|
|
370
372
|
```javascript
|
|
@@ -359,12 +359,14 @@ This component uses `import { ... } from "#pds/lit"` and **requires** an import
|
|
|
359
359
|
<script type="importmap">
|
|
360
360
|
{
|
|
361
361
|
"imports": {
|
|
362
|
-
"#pds/lit": "/assets/
|
|
362
|
+
"#pds/lit": "/assets/pds/external/lit.js"
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
</script>
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
+
**Note:** `#pds/lit` is a convenience bundle that re-exports Lit and adds PDS helpers (`lazyProps`, `msg()`, `loadLocale()`). If a project prefers its own Lit bundle, it must provide equivalents and map `#pds/lit` accordingly.
|
|
369
|
+
|
|
368
370
|
**When generating code with lazy-loaded components, ALWAYS wait for definition:**
|
|
369
371
|
|
|
370
372
|
```javascript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-fab.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-fab.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAkBE,0CAEC;IAUD,cANU,OAAO,EAsBhB;IAxBD;;;;OAIG;IACH,YAHU,OAAO,CAKhB;IA4BD,gBAPU,MAAM,EAef;IAjBD;;;;;OAKG;IACH,cAJU,MAAM,CAMf;IAoBD,gBAPU,MAAM,EAef;IAjBD;;;;;OAKG;IACH,cAJU,MAAM,CAMf;IAyBD,oBAPU,MAAM,EAef;IAtBD;;;;;;;;;;OAUG;IACH,kBAJU,MAAM,CAMf;IAkBD,oBALU,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,EAa7E;IAfD;;;OAGG;IACH,kBAFU,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAI7E;IAWD,oEAsCC;IAED,0BAKC;IAED,6BAEC;;
|
|
1
|
+
{"version":3,"file":"pds-fab.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-fab.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAkBE,0CAEC;IAUD,cANU,OAAO,EAsBhB;IAxBD;;;;OAIG;IACH,YAHU,OAAO,CAKhB;IA4BD,gBAPU,MAAM,EAef;IAjBD;;;;;OAKG;IACH,cAJU,MAAM,CAMf;IAoBD,gBAPU,MAAM,EAef;IAjBD;;;;;OAKG;IACH,cAJU,MAAM,CAMf;IAyBD,oBAPU,MAAM,EAef;IAtBD;;;;;;;;;;OAUG;IACH,kBAJU,MAAM,CAMf;IAkBD,oBALU,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,EAa7E;IAfD;;;OAGG;IACH,kBAFU,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAI7E;IAWD,oEAsCC;IAED,0BAKC;IAED,6BAEC;;CA2YF"}
|
|
@@ -15,10 +15,29 @@ export { until } from "lit/directives/until.js";
|
|
|
15
15
|
export { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
16
16
|
export { unsafeSVG } from "lit/directives/unsafe-svg.js";
|
|
17
17
|
export { msg } from "./common/msg.js";
|
|
18
|
+
/**
|
|
19
|
+
* Applies properties to an element after it's defined (for lazy-loaded components)
|
|
20
|
+
* @param {Object} props - Properties to set on the element
|
|
21
|
+
* @returns {import('lit/directive.js').DirectiveResult}
|
|
22
|
+
*/
|
|
23
|
+
export const lazyProps: (_props?: any) => import("lit-html/directive.js").DirectiveResult<typeof LazyPropsDirective>;
|
|
18
24
|
import { LitElement } from "lit";
|
|
19
25
|
import { nothing } from "lit";
|
|
20
26
|
import { svg } from "lit";
|
|
21
27
|
import { render } from "lit";
|
|
28
|
+
/**
|
|
29
|
+
* Directive that waits for a custom element to be defined before setting properties
|
|
30
|
+
* Useful for lazy-loaded web components
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* html`<pds-fab ${lazyProps({ satellites: [...], open: true })}></pds-fab>`
|
|
34
|
+
*/
|
|
35
|
+
declare class LazyPropsDirective extends Directive {
|
|
36
|
+
render(_props: any): symbol;
|
|
37
|
+
update(part: any, [props]: [any]): symbol;
|
|
38
|
+
#private;
|
|
39
|
+
}
|
|
40
|
+
import { Directive } from "lit/directive.js";
|
|
22
41
|
export { LitElement, nothing, svg, render };
|
|
23
42
|
export { ref, createRef } from "lit/directives/ref.js";
|
|
24
43
|
export { html as staticHtml, unsafeStatic } from "lit/static-html.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lit.d.ts","sourceRoot":"","sources":["../../../../src/js/lit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lit.d.ts","sourceRoot":"","sources":["../../../../src/js/lit.js"],"names":[],"mappings":"AAiFA;;;GAGG;AACH,0DAMC;AAtFD,0CAA0C;AAC1C,mBADW,cAAc,OAAO,EAAE,IAAI,CACV;AAE5B,yCAAyC;AACzC,kBADW,cAAc,OAAO,EAAE,GAAG,CACX;;;;;;;;;AAiE1B;;;;GAIG;AACH,qHAAuD;2BA9E0B,KAAK;wBAAL,KAAK;oBAAL,KAAK;uBAAL,KAAK;AA4BtF;;;;;;GAMG;AACH;IAIE,4BAEC;IAED,0CAaC;;CAeF;0BA7CoC,kBAAkB"}
|
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.41",
|
|
5
5
|
"description": "Pure Design System - Why develop a Design System when you can generate one?",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"dist/types/",
|
|
49
49
|
"public/assets/js/",
|
|
50
50
|
"public/assets/pds/components/",
|
|
51
|
+
"public/assets/pds/external/",
|
|
51
52
|
"public/assets/pds/vscode-custom-data.json",
|
|
52
53
|
"public/assets/pds/pds.css-data.json",
|
|
53
54
|
"public/assets/pds/pds-css-complete.json",
|
|
@@ -447,6 +447,22 @@ async function main(options = {}) {
|
|
|
447
447
|
log(`⚠️ Failed to copy pds-manager.js: ${e?.message || e}`, 'yellow');
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
+
// 4c) Copy Lit bundle into target/external for #pds/lit import map
|
|
451
|
+
try {
|
|
452
|
+
const litSource = path.join(repoRoot, 'public/assets/js/lit.js');
|
|
453
|
+
if (!existsSync(litSource)) {
|
|
454
|
+
log('⚠️ lit.js not found in package assets; skipping copy', 'yellow');
|
|
455
|
+
} else {
|
|
456
|
+
const externalDir = path.join(targetDir, 'external');
|
|
457
|
+
await mkdir(externalDir, { recursive: true });
|
|
458
|
+
const litTarget = path.join(externalDir, 'lit.js');
|
|
459
|
+
await copyFile(litSource, litTarget);
|
|
460
|
+
log(`✅ Copied Lit bundle → ${path.relative(process.cwd(), litTarget)}`, 'green');
|
|
461
|
+
}
|
|
462
|
+
} catch (e) {
|
|
463
|
+
log(`⚠️ Failed to copy lit.js: ${e?.message || e}`, 'yellow');
|
|
464
|
+
}
|
|
465
|
+
|
|
450
466
|
// 5) Generate CSS layers into target/styles
|
|
451
467
|
log('🧬 Generating styles...', 'bold');
|
|
452
468
|
const { Generator } = await loadGenerator();
|
|
@@ -588,6 +604,7 @@ async function main(options = {}) {
|
|
|
588
604
|
log('✅ PDS static assets ready', 'green');
|
|
589
605
|
log(`📍 Location: ${path.relative(process.cwd(), targetDir)}`);
|
|
590
606
|
log('• components → components/*.js');
|
|
607
|
+
log('• external → external/lit.js');
|
|
591
608
|
log('• styles → styles/pds-*.css (+ .css.js modules)');
|
|
592
609
|
log('• intellisense → custom-elements.json, vscode-custom-data.json');
|
|
593
610
|
log('• intellisense → pds.css-data.json, pds-css-complete.json');
|