@pure-ds/storybook 0.4.15 → 0.4.16

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.
@@ -16,9 +16,9 @@ const CodeBlock = styled.pre`
16
16
  margin: 0;
17
17
  padding: 16px;
18
18
  padding-bottom: ${props => (props.$compact ? '24px' : '60px')}; /* Space for fixed button */
19
- font-family: ${props => props.theme.typography.fonts.mono};
20
- font-size: 13px;
21
- line-height: 1.6;
19
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
20
+ font-size: 13.6px;
21
+ line-height: 24px;
22
22
  color: ${props => props.theme.color.defaultText};
23
23
  background: transparent;
24
24
  tab-size: 2;
@@ -32,6 +32,7 @@ const CodeBlock = styled.pre`
32
32
 
33
33
  .shiki code {
34
34
  background: transparent;
35
+ font-family: inherit !important;
35
36
  }
36
37
  `;
37
38
 
@@ -59,6 +59,29 @@ function extractHTML(element) {
59
59
  return clone.innerHTML || '';
60
60
  }
61
61
 
62
+ /**
63
+ * Strip Lit template comments from rendered HTML
64
+ * Removes markers like <!--?lit$641514976$-->, <!---->, etc.
65
+ */
66
+ function stripLitComments(html) {
67
+ if (!html) return '';
68
+
69
+ // Remove Lit binding markers: <!--?lit$...$-->
70
+ html = html.replace(/<!--\?lit\$[^$]+\$-->/g, '');
71
+
72
+ // Remove empty Lit comments: <!---->
73
+ html = html.replace(/<!---->/g, '');
74
+
75
+ // Remove Lit template marker comments: <!--lit-part...-->
76
+ html = html.replace(/<!--lit-part[^>]*-->/g, '');
77
+ html = html.replace(/<!--\/lit-part-->/g, '');
78
+
79
+ // Clean up any resulting multiple whitespace/newlines
80
+ html = html.replace(/\n\s*\n\s*\n/g, '\n\n');
81
+
82
+ return html;
83
+ }
84
+
62
85
  /**
63
86
  * Transform Lit template result to HTML string
64
87
  */
@@ -72,7 +95,10 @@ async function litToHTML(templateResult) {
72
95
 
73
96
  await new Promise(resolve => setTimeout(resolve, 50));
74
97
 
75
- return formatHTML(temp.innerHTML);
98
+ // Strip Lit comments before formatting
99
+ const cleanedHTML = stripLitComments(temp.innerHTML);
100
+
101
+ return formatHTML(cleanedHTML);
76
102
  }
77
103
 
78
104
  function serializeForDisplay(value) {
@@ -1,5 +1,12 @@
1
1
  /* Custom Docs page styling - hide all examples, show only description */
2
2
 
3
+ /* Override Storybook's default mono font for code panels */
4
+ pre, code, .docblock-source pre, .docblock-source code {
5
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
6
+ font-size: 13.6px;
7
+ line-height: 24px;
8
+ }
9
+
3
10
  /* Hide ALL story previews and interactive elements in Docs */
4
11
  .docs-story,
5
12
  .sbdocs-preview,
@@ -39,13 +39,13 @@
39
39
  padding: var(--spacing-4, 1rem);
40
40
  border-radius: var(--radius-md, 4px);
41
41
  overflow-x: auto;
42
- font-size: 0.875rem;
43
- line-height: 1.6;
42
+ font-size: 13.6px;
43
+ line-height: 24px;
44
44
  tab-size: 2;
45
45
  }
46
46
 
47
47
  .html-source-content pre code {
48
- font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
48
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
49
49
  }
50
50
 
51
51
  /* Fallback pre styling (before Shiki loads) */
@@ -54,9 +54,9 @@
54
54
  padding: var(--spacing-4, 1rem);
55
55
  border-radius: var(--radius-md, 4px);
56
56
  overflow-x: auto;
57
- font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
58
- font-size: 0.875rem;
59
- line-height: 1.6;
57
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
58
+ font-size: 13.6px;
59
+ line-height: 24px;
60
60
  tab-size: 2;
61
61
  background: var(--color-surface-raised, #282c34);
62
62
  color: var(--color-text-primary, #abb2bf);
@@ -67,6 +67,29 @@ export function extractHTML(element) {
67
67
  return clone.innerHTML || '';
68
68
  }
69
69
 
70
+ /**
71
+ * Strip Lit template comments from rendered HTML
72
+ * Removes markers like <!--?lit$641514976$-->, <!---->, etc.
73
+ */
74
+ export function stripLitComments(html) {
75
+ if (!html) return '';
76
+
77
+ // Remove Lit binding markers: <!--?lit$...$-->
78
+ html = html.replace(/<!--\?lit\$[^$]+\$-->/g, '');
79
+
80
+ // Remove empty Lit comments: <!---->
81
+ html = html.replace(/<!---->/g, '');
82
+
83
+ // Remove Lit template marker comments: <!--lit-part...-->
84
+ html = html.replace(/<!--lit-part[^>]*-->/g, '');
85
+ html = html.replace(/<!--\/lit-part-->/g, '');
86
+
87
+ // Clean up any resulting multiple whitespace/newlines
88
+ html = html.replace(/\n\s*\n\s*\n/g, '\n\n');
89
+
90
+ return html;
91
+ }
92
+
70
93
  /**
71
94
  * Transform Lit template result to HTML string
72
95
  */
@@ -81,7 +104,10 @@ export async function litToHTML(templateResult) {
81
104
  // Wait for any custom elements to upgrade
82
105
  await new Promise(resolve => setTimeout(resolve, 50));
83
106
 
84
- return formatHTML(temp.innerHTML);
107
+ // Strip Lit comments before formatting
108
+ const cleanedHTML = stripLitComments(temp.innerHTML);
109
+
110
+ return formatHTML(cleanedHTML);
85
111
  }
86
112
 
87
113
  /**
@@ -0,0 +1,13 @@
1
+ <!-- Source Code Pro font for code panel readability (like React.dev) -->
2
+ <link rel="preconnect" href="https://fonts.googleapis.com">
3
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
4
+ <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600&display=swap" rel="stylesheet">
5
+
6
+ <!-- Override Storybook's default monospace font in the manager frame -->
7
+ <style>
8
+ pre, code, .docblock-source pre, .docblock-source code {
9
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
10
+ font-size: 13.6px;
11
+ line-height: 24px;
12
+ }
13
+ </style>
@@ -1,5 +1,10 @@
1
1
  <!-- PDS runs in LIVE mode - styles are generated dynamically by Generator.applyStyles() -->
2
2
 
3
+ <!-- Source Code Pro font for code readability (like React.dev) -->
4
+ <link rel="preconnect" href="https://fonts.googleapis.com">
5
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
6
+ <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600&display=swap" rel="stylesheet">
7
+
3
8
  <!-- Import map for pds-jsonform and other components that use #pds/lit -->
4
9
  <script type="importmap">
5
10
  {
@@ -1304,7 +1304,7 @@ const preview = {
1304
1304
  ]
1305
1305
  },
1306
1306
  docs: {
1307
- page: DocsPage
1307
+ page: DocsPage,
1308
1308
  },
1309
1309
  options: {
1310
1310
  storySort: {
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-01-09T09:26:50.541Z",
2
+ "generatedAt": "2026-01-09T11:28:21.937Z",
3
3
  "sources": {
4
4
  "customElements": "custom-elements.json",
5
5
  "ontology": "src\\js\\pds-core\\pds-ontology.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pure-ds/storybook",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "Storybook showcase for Pure Design System with live configuration",
5
5
  "type": "module",
6
6
  "private": false,
@@ -37,7 +37,7 @@
37
37
  "pds:build-icons": "pds-build-icons"
38
38
  },
39
39
  "peerDependencies": {
40
- "@pure-ds/core": "^0.4.15"
40
+ "@pure-ds/core": "^0.4.16"
41
41
  },
42
42
  "dependencies": {
43
43
  "@custom-elements-manifest/analyzer": "^0.11.0",
@@ -661,7 +661,17 @@ customElements.define(
661
661
  }
662
662
 
663
663
  if (node.nodeType === Node.COMMENT_NODE) {
664
- return indent(level) + `<!-- ${escapeText(node.textContent)} -->\n`;
664
+ // Skip Lit template comments (empty comments or ?lit$...$)
665
+ const commentText = node.textContent || "";
666
+ if (
667
+ commentText === "" ||
668
+ commentText.startsWith("?lit$") ||
669
+ commentText.startsWith("lit-part") ||
670
+ commentText === "/lit-part"
671
+ ) {
672
+ return "";
673
+ }
674
+ return indent(level) + `<!-- ${escapeText(commentText)} -->\n`;
665
675
  }
666
676
 
667
677
  if (node.nodeType === Node.ELEMENT_NODE) {