@pure-ds/storybook 0.4.12 → 0.4.13

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.
Files changed (38) hide show
  1. package/.storybook/docs.css +5 -5
  2. package/.storybook/manager.js +27 -0
  3. package/.storybook/preview.js +33 -16
  4. package/dist/pds-reference.json +291 -65
  5. package/package.json +2 -2
  6. package/public/assets/js/app.js +99 -436
  7. package/public/assets/js/pds.js +124 -461
  8. package/public/assets/pds/components/pds-calendar.js +10 -12
  9. package/public/assets/pds/components/pds-drawer.js +3 -2
  10. package/public/assets/pds/components/pds-scrollrow.js +3 -0
  11. package/public/assets/pds/components/pds-splitpanel.js +6 -7
  12. package/public/assets/pds/vscode-custom-data.json +15 -10
  13. package/src/js/pds-core/pds-enhancers.js +4 -2
  14. package/src/js/pds-core/pds-generator.js +98 -435
  15. package/stories/components/PdsIcon.stories.js +17 -15
  16. package/stories/components/PdsJsonform.stories.js +237 -18
  17. package/stories/components/PdsRichtext.stories.js +23 -112
  18. package/stories/components/PdsScrollrow.stories.js +47 -49
  19. package/stories/components/PdsSplitpanel.stories.js +209 -320
  20. package/stories/components/PdsTabstrip.stories.js +52 -232
  21. package/stories/components/PdsToaster.stories.js +7 -15
  22. package/stories/{primitives → enhancements}/Accordion.stories.js +11 -8
  23. package/stories/enhancements/ButtonWorking.stories.js +127 -0
  24. package/stories/enhancements/Dropdowns.stories.js +16 -7
  25. package/stories/enhancements/OpenGroups.stories.js +9 -6
  26. package/stories/enhancements/RangeSliders.stories.js +10 -11
  27. package/stories/enhancements/RequiredFields.stories.js +6 -5
  28. package/stories/enhancements/Toggles.stories.js +9 -49
  29. package/stories/enhancements/_enhancement-header.js +47 -0
  30. package/stories/foundations/HTMLDefaults.stories.js +2 -2
  31. package/stories/{enhancements → foundations}/MeshGradients.stories.js +323 -323
  32. package/stories/{enhancements → patterns}/InteractiveStates.stories.js +741 -741
  33. package/stories/primitives/Alerts.stories.js +3 -3
  34. package/stories/primitives/Cards.stories.js +24 -6
  35. package/stories/primitives/Media.stories.js +24 -64
  36. package/stories/reference/reference-docs.js +226 -58
  37. package/stories/reference/reference-helpers.js +9 -9
  38. package/stories/components/PdsJsonformUiSchema.stories.js +0 -859
@@ -17,19 +17,19 @@
17
17
  display: none !important;
18
18
  }
19
19
 
20
- /* Show only the description block */
20
+ /* Docs pages use Storybook defaults - no PDS tokens */
21
21
  .sbdocs-wrapper {
22
- background: var(--surface-bg);
23
- color: var(--color-text-primary);
22
+ background: #ffffff;
23
+ color: #333333;
24
24
  }
25
25
 
26
26
  .sbdocs .sbdocs-title,
27
27
  .sbdocs .sbdocs-subtitle {
28
- color: var(--color-text-primary);
28
+ color: #333333;
29
29
  }
30
30
 
31
31
  .sbdocs-description,
32
32
  .sbdocs .sbdocs-p {
33
- color: var(--color-text-secondary);
33
+ color: #666666;
34
34
  line-height: 1.6;
35
35
  }
@@ -3,6 +3,7 @@
3
3
  // Uses experimental_setFilter API to enrich search with PDS ontology concepts
4
4
  // ALL DATA IS LOADED FROM pds-reference.json (Single Source of Truth from pds-ontology.js)
5
5
  import { addons } from '@storybook/manager-api';
6
+ import { STORY_CHANGED } from '@storybook/core-events';
6
7
 
7
8
  const ADDON_ID = 'pds-ontology-filter';
8
9
  const FILTER_ID = 'pds-ontology';
@@ -548,4 +549,30 @@ addons.register(ADDON_ID, (api) => {
548
549
  tags: () => Object.fromEntries([...tagIndex].map(([k, v]) => [k, [...v]])),
549
550
  currentQuery: () => currentQuery
550
551
  };
552
+
553
+ // ═══════════════════════════════════════════════════════════════════════════
554
+ // AUTO-SELECT CODE PANEL FOR ENHANCEMENT STORIES
555
+ // Switch to the "Code" panel when navigating to Enhancement stories
556
+ // ═══════════════════════════════════════════════════════════════════════════
557
+ const CODE_PANEL_ID = 'html-preview/panel';
558
+
559
+ // Listen for story changes and auto-switch panel based on story parameters
560
+ api.on(STORY_CHANGED, (storyId) => {
561
+ if (!storyId) return;
562
+
563
+ // Get the story data to check its parameters
564
+ const story = api.getData(storyId);
565
+ if (!story) return;
566
+
567
+ // Check if this is an Enhancement story (by title path)
568
+ const isEnhancement = story.title?.startsWith('Enhancements/');
569
+
570
+ // Also check parameters.options.selectedPanel
571
+ const selectedPanel = story.parameters?.options?.selectedPanel;
572
+
573
+ if (isEnhancement || selectedPanel === CODE_PANEL_ID) {
574
+ // Switch to Code panel
575
+ api.setSelectedPanel(CODE_PANEL_ID);
576
+ }
577
+ });
551
578
  });
@@ -40,9 +40,23 @@ const getInitialPreset = () => {
40
40
  const initialPreset = getInitialPreset();
41
41
  console.log('🎨 Starting PDS initialization with preset:', initialPreset);
42
42
 
43
+ // Helper to detect docs pages - used to prevent PDS from interfering
44
+ function isDocsPage() {
45
+ try {
46
+ return window.location.search.includes('/docs/') ||
47
+ window.location.search.includes('viewMode=docs') ||
48
+ window.parent?.location?.search?.includes('/docs/');
49
+ } catch {
50
+ return false;
51
+ }
52
+ }
53
+
43
54
  // Wrap top-level await in IIFE for production build compatibility
44
55
  (async () => {
45
56
  PDS.initializing = true;
57
+
58
+ // NEVER apply global styles on init - only apply in story decorator
59
+ // This prevents PDS from affecting docs pages
46
60
  const pdsOptions = {
47
61
  mode: 'live',
48
62
  preset: initialPreset,
@@ -53,8 +67,8 @@ console.log('🎨 Starting PDS initialization with preset:', initialPreset);
53
67
  observeShadows: true,
54
68
  patchAttachShadow: true
55
69
  },
56
- applyGlobalStyles: true,
57
- manageTheme: true
70
+ applyGlobalStyles: false, // Never apply on init - decorator handles this
71
+ manageTheme: false // Never manage on init - decorator handles this
58
72
  };
59
73
 
60
74
  // Merge user config
@@ -79,25 +93,28 @@ console.log('🎨 Starting PDS initialization with preset:', initialPreset);
79
93
  PDS.currentPreset = initialPreset;
80
94
  })();
81
95
 
82
- // Set up persistent style protection - monitor and restore PDS sheets if cleared
83
- let protectionActive = false;
84
- function ensurePDSStyles() {
85
- const sheets = document.adoptedStyleSheets || [];
86
- const hasPDS = sheets.some(s => s._pds === true);
87
-
88
- if (!hasPDS && PDS.Generator.instance) {
89
- console.log('🛡️ PDS sheets missing - restoring...');
90
- PDS.Generator.applyStyles();
91
- }
92
- }
93
-
94
- // Check periodically
95
- setInterval(ensurePDSStyles, 100);
96
+ // Style protection disabled - decorator controls when PDS styles are applied
97
+ // This prevents PDS from affecting docs pages
96
98
 
97
99
  /**
98
100
  * Global decorator to ensure Shadow DOM components get PDS styles and run enhancers
99
101
  */
102
+ // Track current view mode globally for other code to check
103
+ let currentViewMode = 'story';
104
+
100
105
  const withPDS = (story, context) => {
106
+ currentViewMode = context.viewMode;
107
+
108
+ // For docs pages - actively REMOVE PDS styles and skip decorator
109
+ if (context.viewMode === 'docs') {
110
+ // Clear any PDS adopted stylesheets
111
+ if (document.adoptedStyleSheets?.length > 0) {
112
+ const nonPdsSheets = document.adoptedStyleSheets.filter(s => !s._pds);
113
+ document.adoptedStyleSheets = nonPdsSheets;
114
+ }
115
+ return story();
116
+ }
117
+
101
118
  console.log('🎬 withPDS decorator called for:', context.title);
102
119
 
103
120
  // Check adoptedStyleSheets status