@pure-ds/storybook 0.7.41 → 0.7.50
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/.storybook/docs.css +6 -3
- package/.storybook/htmlPreview.css +14 -8
- package/.storybook/preview.js +80 -21
- package/.storybook/shiki.js +3 -1
- package/dist/pds-reference.json +332 -49
- package/package.json +2 -2
- package/public/assets/js/app.js +2131 -5
- package/public/assets/js/app.js.map +7 -0
- package/public/assets/js/lit.js +1031 -3
- package/public/assets/js/lit.js.map +7 -0
- package/public/assets/js/pds-ask.js +464 -9
- package/public/assets/js/pds-ask.js.map +7 -0
- package/public/assets/js/pds-autocomplete.js +639 -7
- package/public/assets/js/pds-autocomplete.js.map +7 -0
- package/public/assets/js/pds-enhancers.js +1471 -1
- package/public/assets/js/pds-enhancers.js.map +7 -0
- package/public/assets/js/pds-manager.js +17577 -3221
- package/public/assets/js/pds-manager.js.map +7 -0
- package/public/assets/js/pds-toast.js +30 -1
- package/public/assets/js/pds-toast.js.map +7 -0
- package/public/assets/js/pds.js +1969 -2
- package/public/assets/js/pds.js.map +7 -0
- package/public/assets/pds/components/pds-drawer.js +18 -2
- package/public/assets/pds/components/pds-live-edit.js +1 -1
- package/public/assets/pds/components/pds-toaster.js +55 -11
- package/public/assets/pds/core/pds-ask.js +464 -9
- package/public/assets/pds/core/pds-autocomplete.js +639 -7
- package/public/assets/pds/core/pds-enhancers.js +1471 -1
- package/public/assets/pds/core/pds-manager.js +17577 -3221
- package/public/assets/pds/core/pds-toast.js +30 -1
- package/public/assets/pds/core.js +1969 -2
- package/public/assets/pds/external/lit.js +1031 -3
- package/public/assets/pds/external/shiki.js +1 -1
- package/public/assets/pds/pds-css-complete.json +544 -55
- package/public/assets/pds/pds.css-data.json +154 -0
- package/public/assets/pds/styles/pds-components.css +12 -11
- package/public/assets/pds/styles/pds-components.css.js +24 -22
- package/public/assets/pds/styles/pds-styles.css +12 -11
- package/public/assets/pds/styles/pds-styles.css.js +24 -22
- package/public/assets/pds/vscode-custom-data.json +30 -0
- package/src/js/common/toast.js +8 -0
- package/src/js/external/shiki.js +1 -1
- package/src/js/pds-core/pds-config.js +63 -10
- package/src/js/pds-core/pds-enhancers-meta.js +13 -8
- package/src/js/pds-core/pds-enhancers.js +103 -123
- package/src/js/pds-core/pds-generator.js +787 -226
- package/src/js/pds-core/pds-live.js +9 -6
- package/src/js/pds-core/pds-ontology.js +8 -2
- package/src/js/pds.d.ts +7 -5
- package/src/js/pds.js +4 -4
- package/stories/WhatIsPDS.md +1 -1
- package/stories/components/PdsDrawer.stories.js +554 -240
- package/stories/components/PdsFab.stories.js +2 -2
- package/stories/components/PdsForm.stories.js +3 -3
- package/stories/components/PdsIcon.stories.js +2 -2
- package/stories/components/PdsRating.stories.js +1 -1
- package/stories/components/PdsScrollrow.stories.js +10 -10
- package/stories/components/PdsSplitpanel.stories.js +8 -8
- package/stories/enhancements/Dropdowns.stories.js +19 -17
- package/stories/foundations/Colors.stories.js +1289 -187
- package/stories/foundations/HTMLDefaults.stories.js +3 -3
- package/stories/foundations/Icons.stories.js +20 -20
- package/stories/foundations/SmartSurfaces.stories.js +11 -14
- package/stories/getting-started.md +0 -10
- package/stories/primitives/Badges.stories.js +1 -0
- package/stories/primitives/Cards.stories.js +3 -3
- package/stories/reference/pds-object-docs.js +588 -0
- package/stories/reference/reference-catalog.js +4 -7
- package/stories/reference/reference-docs.js +91 -13
- package/stories/reference/reference-helpers.js +2 -1
- package/stories/utils/PdsAsk.stories.js +4 -8
- package/stories/utils/PdsObjectApi.stories.js +43 -8
- package/stories/utils/PdsParse.stories.js +4 -8
- package/stories/utils/PdsToast.stories.js +66 -9
- package/stories/utils/pds-object-meta.js +42 -0
- package/stories/utils/shiki.js +107 -19
package/.storybook/docs.css
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
/* Override Storybook's default mono font for code panels */
|
|
4
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;
|
|
5
|
+
font-family: var(--pds-shiki-font-family, 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace) !important;
|
|
6
|
+
font-size: var(--pds-shiki-font-size, 13.6px);
|
|
7
|
+
line-height: var(--pds-shiki-line-height, 24px);
|
|
8
|
+
-webkit-font-smoothing: antialiased;
|
|
9
|
+
-moz-osx-font-smoothing: grayscale;
|
|
10
|
+
text-rendering: geometricPrecision;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
/* Hide ALL story previews and interactive elements in Docs */
|
|
@@ -39,13 +39,16 @@
|
|
|
39
39
|
padding: var(--spacing-4, 1rem);
|
|
40
40
|
border-radius: var(--radius-md, 4px);
|
|
41
41
|
overflow-x: auto;
|
|
42
|
-
font-size: 13.6px;
|
|
43
|
-
line-height: 24px;
|
|
44
|
-
tab-size: 2;
|
|
42
|
+
font-size: var(--pds-shiki-font-size, 13.6px);
|
|
43
|
+
line-height: var(--pds-shiki-line-height, 24px);
|
|
44
|
+
tab-size: var(--pds-shiki-tab-size, 2);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.html-source-content pre code {
|
|
48
|
-
font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
48
|
+
font-family: var(--pds-shiki-font-family, 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
|
|
49
|
+
-webkit-font-smoothing: antialiased;
|
|
50
|
+
-moz-osx-font-smoothing: grayscale;
|
|
51
|
+
text-rendering: geometricPrecision;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
/* Fallback pre styling (before Shiki loads) */
|
|
@@ -54,10 +57,13 @@
|
|
|
54
57
|
padding: var(--spacing-4, 1rem);
|
|
55
58
|
border-radius: var(--radius-md, 4px);
|
|
56
59
|
overflow-x: auto;
|
|
57
|
-
font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
58
|
-
font-size: 13.6px;
|
|
59
|
-
line-height: 24px;
|
|
60
|
-
tab-size: 2;
|
|
60
|
+
font-family: var(--pds-shiki-font-family, 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
|
|
61
|
+
font-size: var(--pds-shiki-font-size, 13.6px);
|
|
62
|
+
line-height: var(--pds-shiki-line-height, 24px);
|
|
63
|
+
tab-size: var(--pds-shiki-tab-size, 2);
|
|
64
|
+
-webkit-font-smoothing: antialiased;
|
|
65
|
+
-moz-osx-font-smoothing: grayscale;
|
|
66
|
+
text-rendering: geometricPrecision;
|
|
61
67
|
background: var(--color-surface-raised, #282c34);
|
|
62
68
|
color: var(--color-text-primary, #abb2bf);
|
|
63
69
|
}
|
package/.storybook/preview.js
CHANGED
|
@@ -11,10 +11,14 @@ import { stripFunctions } from '@pds-src/js/pds-core/pds-start-helpers.js';
|
|
|
11
11
|
import { config as userConfig } from '@user/pds-config';
|
|
12
12
|
import { withHTMLExtractor } from './addons/html-preview/preview.js';
|
|
13
13
|
import { withDescription } from './addons/description/preview.js';
|
|
14
|
+
import { ensureSharedShikiStyles, preloadShiki } from './shiki.js';
|
|
14
15
|
import './htmlPreview.css';
|
|
15
16
|
import './docs.css';
|
|
16
17
|
import { toastFormData } from '../stories/utils/toast-utils.js';
|
|
17
18
|
|
|
19
|
+
ensureSharedShikiStyles();
|
|
20
|
+
preloadShiki();
|
|
21
|
+
|
|
18
22
|
// Expose toastFormData globally for inline event handlers
|
|
19
23
|
window.toastFormData = toastFormData;
|
|
20
24
|
|
|
@@ -35,7 +39,7 @@ async function ensurePdsCodeLoaded() {
|
|
|
35
39
|
|
|
36
40
|
for (const specifier of candidates) {
|
|
37
41
|
try {
|
|
38
|
-
await import(specifier);
|
|
42
|
+
await import(/* @vite-ignore */ specifier);
|
|
39
43
|
if (typeof customElements !== 'undefined' && customElements.get('pds-code')) {
|
|
40
44
|
return true;
|
|
41
45
|
}
|
|
@@ -209,14 +213,22 @@ function isDocsPage() {
|
|
|
209
213
|
}
|
|
210
214
|
}
|
|
211
215
|
|
|
212
|
-
function inferCodeLanguage(codeEl) {
|
|
213
|
-
if (!codeEl) return 'html';
|
|
214
|
-
|
|
216
|
+
function inferCodeLanguage(codeEl, preEl) {
|
|
217
|
+
if (!codeEl && !preEl) return 'html';
|
|
218
|
+
|
|
219
|
+
const className = codeEl?.className || '';
|
|
215
220
|
const languageMatch = className.match(/(?:language|lang)-([a-z0-9-]+)/i);
|
|
216
221
|
if (languageMatch?.[1]) {
|
|
217
222
|
return languageMatch[1].toLowerCase();
|
|
218
223
|
}
|
|
219
|
-
|
|
224
|
+
|
|
225
|
+
const preClassName = preEl?.className || '';
|
|
226
|
+
const preLanguageMatch = preClassName.match(/(?:language|lang)-([a-z0-9-]+)/i);
|
|
227
|
+
if (preLanguageMatch?.[1]) {
|
|
228
|
+
return preLanguageMatch[1].toLowerCase();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return codeEl?.getAttribute('data-lang') || preEl?.getAttribute('data-lang') || 'html';
|
|
220
232
|
}
|
|
221
233
|
|
|
222
234
|
function upgradeLegacyCodeBlocks(root) {
|
|
@@ -228,10 +240,19 @@ function upgradeLegacyCodeBlocks(root) {
|
|
|
228
240
|
const preEl = codeEl.parentElement;
|
|
229
241
|
if (!preEl || preEl.closest('pds-code')) return;
|
|
230
242
|
|
|
243
|
+
// Keep Shiki-rendered blocks intact; they already carry correct language + theme.
|
|
244
|
+
if (
|
|
245
|
+
preEl.classList.contains('shiki') ||
|
|
246
|
+
preEl.classList.contains('pds-shiki-block') ||
|
|
247
|
+
preEl.hasAttribute('data-pds-shiki')
|
|
248
|
+
) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
231
252
|
const content = codeEl.textContent || '';
|
|
232
253
|
if (!content.trim()) return;
|
|
233
254
|
|
|
234
|
-
const lang = inferCodeLanguage(codeEl);
|
|
255
|
+
const lang = inferCodeLanguage(codeEl, preEl);
|
|
235
256
|
const pdsCode = document.createElement('pds-code');
|
|
236
257
|
pdsCode.setAttribute('lang', lang);
|
|
237
258
|
pdsCode.code = content;
|
|
@@ -239,6 +260,37 @@ function upgradeLegacyCodeBlocks(root) {
|
|
|
239
260
|
});
|
|
240
261
|
}
|
|
241
262
|
|
|
263
|
+
const observeCodeBlocks = (() => {
|
|
264
|
+
const observedRoots = new WeakSet();
|
|
265
|
+
return (root) => {
|
|
266
|
+
if (!root || observedRoots.has(root)) return;
|
|
267
|
+
|
|
268
|
+
const observer = new MutationObserver(() => {
|
|
269
|
+
upgradeLegacyCodeBlocks(root);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
273
|
+
observedRoots.add(root);
|
|
274
|
+
};
|
|
275
|
+
})();
|
|
276
|
+
|
|
277
|
+
function scheduleCodeBlockUpgrade(root) {
|
|
278
|
+
if (!root) return;
|
|
279
|
+
|
|
280
|
+
const runUpgrade = () => upgradeLegacyCodeBlocks(root);
|
|
281
|
+
runUpgrade();
|
|
282
|
+
requestAnimationFrame(runUpgrade);
|
|
283
|
+
setTimeout(runUpgrade, 60);
|
|
284
|
+
setTimeout(runUpgrade, 220);
|
|
285
|
+
|
|
286
|
+
void ensurePdsCodeLoaded().then(() => {
|
|
287
|
+
runUpgrade();
|
|
288
|
+
observeCodeBlocks(root);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
observeCodeBlocks(root);
|
|
292
|
+
}
|
|
293
|
+
|
|
242
294
|
let liveGenerator = null;
|
|
243
295
|
const setLiveGenerator = (generator) => {
|
|
244
296
|
if (generator && typeof generator === 'object') {
|
|
@@ -414,7 +466,13 @@ const withPDS = (story, context) => {
|
|
|
414
466
|
const nonPdsSheets = document.adoptedStyleSheets.filter(s => !s._pds);
|
|
415
467
|
document.adoptedStyleSheets = nonPdsSheets;
|
|
416
468
|
}
|
|
417
|
-
|
|
469
|
+
const docsStory = story();
|
|
470
|
+
requestAnimationFrame(() => {
|
|
471
|
+
requestAnimationFrame(() => {
|
|
472
|
+
scheduleCodeBlockUpgrade(document.getElementById('docs-root'));
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
return docsStory;
|
|
418
476
|
}
|
|
419
477
|
|
|
420
478
|
console.log('🎬 withPDS decorator called for:', context.title);
|
|
@@ -514,7 +572,7 @@ const withPDS = (story, context) => {
|
|
|
514
572
|
|
|
515
573
|
// Initial adoption - run multiple times to catch lazy components
|
|
516
574
|
setTimeout(() => {
|
|
517
|
-
|
|
575
|
+
scheduleCodeBlockUpgrade(document.querySelector('#storybook-root'));
|
|
518
576
|
}, 0);
|
|
519
577
|
setTimeout(adoptAllShadowStyles, 0);
|
|
520
578
|
setTimeout(adoptAllShadowStyles, 100);
|
|
@@ -1581,6 +1639,7 @@ const withRelatedStories = (story, context) => {
|
|
|
1581
1639
|
requestAnimationFrame(() => {
|
|
1582
1640
|
if (context.viewMode === 'docs') {
|
|
1583
1641
|
pruneDocsStories();
|
|
1642
|
+
scheduleCodeBlockUpgrade(document.getElementById('docs-root'));
|
|
1584
1643
|
renderRelatedFooter(context);
|
|
1585
1644
|
removeRelatedOverlay();
|
|
1586
1645
|
return;
|
|
@@ -1712,19 +1771,6 @@ const preview = {
|
|
|
1712
1771
|
dynamicTitle: true
|
|
1713
1772
|
}
|
|
1714
1773
|
},
|
|
1715
|
-
locale: {
|
|
1716
|
-
name: 'Locale',
|
|
1717
|
-
description: 'PDS locale',
|
|
1718
|
-
defaultValue: initialLocale,
|
|
1719
|
-
toolbar: {
|
|
1720
|
-
icon: 'globe',
|
|
1721
|
-
items: storybookLocales.map((locale) => ({
|
|
1722
|
-
value: locale,
|
|
1723
|
-
title: formatLocaleTitle(locale)
|
|
1724
|
-
})),
|
|
1725
|
-
dynamicTitle: true
|
|
1726
|
-
}
|
|
1727
|
-
},
|
|
1728
1774
|
preset: {
|
|
1729
1775
|
name: 'Preset',
|
|
1730
1776
|
description: 'Design preset',
|
|
@@ -1756,6 +1802,19 @@ const preview = {
|
|
|
1756
1802
|
})),
|
|
1757
1803
|
dynamicTitle: true
|
|
1758
1804
|
}
|
|
1805
|
+
},
|
|
1806
|
+
locale: {
|
|
1807
|
+
name: 'Locale',
|
|
1808
|
+
description: 'PDS locale',
|
|
1809
|
+
defaultValue: initialLocale,
|
|
1810
|
+
toolbar: {
|
|
1811
|
+
icon: 'globe',
|
|
1812
|
+
items: storybookLocales.map((locale) => ({
|
|
1813
|
+
value: locale,
|
|
1814
|
+
title: formatLocaleTitle(locale)
|
|
1815
|
+
})),
|
|
1816
|
+
dynamicTitle: true
|
|
1817
|
+
}
|
|
1759
1818
|
}
|
|
1760
1819
|
}
|
|
1761
1820
|
};
|
package/.storybook/shiki.js
CHANGED