@pure-ds/storybook 0.1.7 → 0.1.8

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.
@@ -42,6 +42,7 @@ console.log('🎨 Starting PDS initialization with preset:', initialPreset);
42
42
 
43
43
  // Wrap top-level await in IIFE for production build compatibility
44
44
  (async () => {
45
+ window.__pdsInitializing = true;
45
46
  const pdsOptions = {
46
47
  mode: 'live',
47
48
  preset: initialPreset,
@@ -69,6 +70,7 @@ console.log('🎨 Starting PDS initialization with preset:', initialPreset);
69
70
  }
70
71
 
71
72
  await PDS.start(pdsOptions);
73
+ window.__pdsInitializing = false;
72
74
 
73
75
  console.log('✨ PDS initialized in live mode for Storybook');
74
76
  console.log('📦 AutoDefiner active at:', PDS.autoDefiner?.config?.baseURL);
@@ -112,7 +114,7 @@ const withPDS = (story, context) => {
112
114
  // Check again after applying
113
115
  const afterSheets = document.adoptedStyleSheets || [];
114
116
  const afterPdsSheets = afterSheets.filter(s => s._pds === true);
115
- } else {
117
+ } else if (!window.__pdsInitializing) {
116
118
  console.warn('⚠️ No designer found!');
117
119
  }
118
120
 
@@ -358,41 +360,6 @@ const expandSemanticTags = (input) => {
358
360
  return expanded;
359
361
  };
360
362
 
361
- const getStoryStore = () => {
362
- if (typeof window === 'undefined') return null;
363
- return window.__STORYBOOK_STORY_STORE__ || null;
364
- };
365
-
366
- const collectStoryIndexTags = (storyId) => {
367
- if (!storyId) return undefined;
368
- const storyStore = getStoryStore();
369
- const index = storyStore?.storyIndex;
370
- if (!index) return undefined;
371
-
372
- const entries = index.entries || index;
373
- const entry = entries?.[storyId];
374
- return entry?.tags;
375
- };
376
-
377
- const collectStoryStoreEntryTags = (storyId) => {
378
- const storyStore = getStoryStore();
379
- if (!storyStore?.fromId || !storyId) return undefined;
380
-
381
- try {
382
- const entry = storyStore.fromId(storyId);
383
- if (!entry) return undefined;
384
-
385
- return mergeTagSets(
386
- entry.meta?.tags,
387
- entry.parameters?.tags,
388
- entry.moduleExport?.default?.tags,
389
- entry.moduleExport?.tags
390
- );
391
- } catch {
392
- return undefined;
393
- }
394
- };
395
-
396
363
  const ensureRelatedStyles = (() => {
397
364
  let injected = false;
398
365
  return () => {
@@ -964,27 +931,14 @@ const getContextTags = (context) => {
964
931
  context.moduleExport?.parameters?.pds?.tags,
965
932
  context.moduleExport?.pds?.tags,
966
933
  context.parameters?.pdsTags,
967
- context.moduleExport?.tags,
968
- collectStoryIndexTags(storyId),
969
- collectStoryStoreEntryTags(storyId)
934
+ context.moduleExport?.tags
970
935
  );
971
936
 
972
937
  if (initial.size > 0) {
973
938
  return expandSemanticTags(initial);
974
939
  }
975
940
 
976
- const fallback = new Set();
977
- const clientApi = typeof window !== 'undefined' ? window.__STORYBOOK_CLIENT_API__ : null;
978
- if (!clientApi?.raw) return fallback;
979
-
980
- clientApi
981
- .raw()
982
- .filter((story) => story?.title === context.title)
983
- .forEach((story) => {
984
- getStoryTags(story).forEach((tag) => fallback.add(tag));
985
- });
986
-
987
- return expandSemanticTags(fallback);
941
+ return expandSemanticTags(new Set());
988
942
  };
989
943
 
990
944
  const getStoryTags = (story) => {
@@ -999,24 +953,13 @@ const getStoryTags = (story) => {
999
953
  story.moduleExport?.pds?.tags,
1000
954
  story.parameters?.pdsTags,
1001
955
  story.moduleExport?.default?.tags,
1002
- story.moduleExport?.tags,
1003
- collectStoryIndexTags(story.id),
1004
- collectStoryStoreEntryTags(story.id)
956
+ story.moduleExport?.tags
1005
957
  );
1006
958
 
1007
959
  if (collected.size > 0) {
1008
960
  return expandSemanticTags(collected);
1009
961
  }
1010
962
 
1011
- const storyStore = getStoryStore();
1012
- const storyIndex = storyStore?.storyIndex;
1013
- if (storyIndex?.entries) {
1014
- const entry = storyIndex.entries[story.id];
1015
- if (entry?.tags) {
1016
- return expandSemanticTags(mergeTagSets(entry.tags));
1017
- }
1018
- }
1019
-
1020
963
  return expandSemanticTags(collected);
1021
964
  };
1022
965
 
@@ -1029,37 +972,6 @@ const getAllStoriesForRelated = () => {
1029
972
  return stories;
1030
973
  }
1031
974
 
1032
- const storyStore = getStoryStore();
1033
- const indexEntries = storyStore?.storyIndex?.entries;
1034
- if (!indexEntries) return stories;
1035
-
1036
- Object.entries(indexEntries).forEach(([storyId, entry]) => {
1037
- if (!entry || entry.type !== 'story') return;
1038
-
1039
- let storeEntry;
1040
- if (storyStore?.fromId) {
1041
- try {
1042
- storeEntry = storyStore.fromId(storyId);
1043
- } catch {}
1044
- }
1045
-
1046
- const parameters = storeEntry?.parameters || storeEntry?.story?.parameters || entry.parameters || {};
1047
- const meta = storeEntry?.meta || { title: entry.title };
1048
- const moduleExport = storeEntry?.moduleExport;
1049
- const tags = mergeTagSets(entry.tags, storeEntry?.tags);
1050
-
1051
- stories.push({
1052
- id: storyId,
1053
- title: storeEntry?.story?.title || entry.title,
1054
- name: entry.name,
1055
- importPath: entry.importPath,
1056
- parameters,
1057
- meta,
1058
- moduleExport,
1059
- tags
1060
- });
1061
- });
1062
-
1063
975
  return stories;
1064
976
  };
1065
977
 
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@pure-ds/storybook",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Storybook showcase for Pure Design System with live configuration",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "bin": {
8
8
  "pds-storybook": "./bin/index.js"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "registry": "https://registry.npmjs.org/"
9
13
  },
10
14
  "files": [
11
15
  "bin",
@@ -28,7 +32,7 @@
28
32
  "storybook:build": "npm run build-storybook"
29
33
  },
30
34
  "peerDependencies": {
31
- "@pure-ds/core": "^0.3.0"
35
+ "@pure-ds/core": "^0.3.1"
32
36
  },
33
37
  "dependencies": {
34
38
  "@custom-elements-manifest/analyzer": "^0.11.0",