@stencil/storybook-plugin 0.7.0 → 1.0.0-dev.1783525808.72954f8

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 (103) hide show
  1. package/README.md +42 -138
  2. package/dist/docs/{index.d.ts → index.d.mts} +2 -4
  3. package/dist/docs/index.d.mts.map +1 -0
  4. package/dist/{docs-DFb4MYCm.js → docs/index.mjs} +17 -30
  5. package/dist/docs/index.mjs.map +1 -0
  6. package/dist/{entry-preview-Oaye2Q3u.js → entry-preview-6xYusSlJ.mjs} +16 -24
  7. package/dist/entry-preview-6xYusSlJ.mjs.map +1 -0
  8. package/dist/entry-preview-argtypes.d.mts +14 -0
  9. package/dist/entry-preview-argtypes.d.mts.map +1 -0
  10. package/dist/entry-preview-argtypes.mjs +165 -0
  11. package/dist/entry-preview-argtypes.mjs.map +1 -0
  12. package/dist/entry-preview-auto-docs.d.mts +1 -0
  13. package/dist/entry-preview-auto-docs.mjs +11 -0
  14. package/dist/entry-preview-auto-docs.mjs.map +1 -0
  15. package/dist/{entry-preview-docs.d.ts → entry-preview-docs.d.mts} +2 -4
  16. package/dist/entry-preview-docs.d.mts.map +1 -0
  17. package/dist/{entry-preview-docs.js → entry-preview-docs.mjs} +3 -4
  18. package/dist/entry-preview-docs.mjs.map +1 -0
  19. package/dist/{entry-preview.d.ts → entry-preview.d.mts} +2 -5
  20. package/dist/entry-preview.d.mts.map +1 -0
  21. package/dist/entry-preview.mjs +2 -0
  22. package/dist/framework-api-oAIB4EMV.mjs +27 -0
  23. package/dist/framework-api-oAIB4EMV.mjs.map +1 -0
  24. package/dist/index.d.mts +677 -0
  25. package/dist/index.d.mts.map +1 -0
  26. package/dist/index.mjs +32 -0
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/node/{index.d.ts → index.d.mts} +2 -4
  29. package/dist/node/index.d.mts.map +1 -0
  30. package/dist/node/{index.js → index.mjs} +2 -2
  31. package/dist/node/index.mjs.map +1 -0
  32. package/dist/{preset.d.ts → preset.d.mts} +2 -4
  33. package/dist/preset.d.mts.map +1 -0
  34. package/dist/preset.mjs +35 -0
  35. package/dist/preset.mjs.map +1 -0
  36. package/dist/{rollup-parseAst-t-4tfMPG.d.ts → rollup-parseAst-DL0ij9mb.d.mts} +1 -1
  37. package/dist/rollup-parseAst-DL0ij9mb.d.mts.map +1 -0
  38. package/dist/{types-BZP9npQ9.d.cts → types-KTmT9_JX.d.mts} +2 -2
  39. package/dist/types-KTmT9_JX.d.mts.map +1 -0
  40. package/dist/wizard.d.mts +7 -0
  41. package/dist/wizard.d.mts.map +1 -0
  42. package/dist/wizard.mjs +159 -0
  43. package/dist/wizard.mjs.map +1 -0
  44. package/package.json +32 -32
  45. package/preset.js +1 -2
  46. package/dist/chunk-CsX-DzYB.cjs +0 -42
  47. package/dist/docs/index.cjs +0 -4
  48. package/dist/docs/index.d.cts +0 -15
  49. package/dist/docs/index.d.cts.map +0 -1
  50. package/dist/docs/index.d.ts.map +0 -1
  51. package/dist/docs/index.js +0 -3
  52. package/dist/docs-DFb4MYCm.js.map +0 -1
  53. package/dist/docs-ONVKsKI9.cjs +0 -97
  54. package/dist/docs-ONVKsKI9.cjs.map +0 -1
  55. package/dist/entry-preview-BmNVHtoL.cjs +0 -87
  56. package/dist/entry-preview-BmNVHtoL.cjs.map +0 -1
  57. package/dist/entry-preview-Oaye2Q3u.js.map +0 -1
  58. package/dist/entry-preview-argtypes.cjs +0 -182
  59. package/dist/entry-preview-argtypes.cjs.map +0 -1
  60. package/dist/entry-preview-argtypes.d.cts +0 -19
  61. package/dist/entry-preview-argtypes.d.cts.map +0 -1
  62. package/dist/entry-preview-argtypes.d.ts +0 -19
  63. package/dist/entry-preview-argtypes.d.ts.map +0 -1
  64. package/dist/entry-preview-argtypes.js +0 -181
  65. package/dist/entry-preview-argtypes.js.map +0 -1
  66. package/dist/entry-preview-docs.cjs +0 -19
  67. package/dist/entry-preview-docs.cjs.map +0 -1
  68. package/dist/entry-preview-docs.d.cts +0 -11
  69. package/dist/entry-preview-docs.d.cts.map +0 -1
  70. package/dist/entry-preview-docs.d.ts.map +0 -1
  71. package/dist/entry-preview-docs.js.map +0 -1
  72. package/dist/entry-preview.cjs +0 -6
  73. package/dist/entry-preview.d.cts +0 -20
  74. package/dist/entry-preview.d.cts.map +0 -1
  75. package/dist/entry-preview.d.ts.map +0 -1
  76. package/dist/entry-preview.js +0 -3
  77. package/dist/index.cjs +0 -9
  78. package/dist/index.d.cts +0 -65
  79. package/dist/index.d.cts.map +0 -1
  80. package/dist/index.d.ts +0 -40
  81. package/dist/index.d.ts.map +0 -1
  82. package/dist/index.js +0 -5
  83. package/dist/node/index.cjs +0 -9
  84. package/dist/node/index.cjs.map +0 -1
  85. package/dist/node/index.d.cts +0 -9
  86. package/dist/node/index.d.cts.map +0 -1
  87. package/dist/node/index.d.ts.map +0 -1
  88. package/dist/node/index.js.map +0 -1
  89. package/dist/preset.cjs +0 -135
  90. package/dist/preset.cjs.map +0 -1
  91. package/dist/preset.d.cts +0 -11
  92. package/dist/preset.d.cts.map +0 -1
  93. package/dist/preset.d.ts.map +0 -1
  94. package/dist/preset.js +0 -132
  95. package/dist/preset.js.map +0 -1
  96. package/dist/rollup-parseAst-t-4tfMPG.d.ts.map +0 -1
  97. package/dist/src-C4ce9Ps1.cjs +0 -91
  98. package/dist/src-C4ce9Ps1.cjs.map +0 -1
  99. package/dist/src-DWOWXEPY.js +0 -55
  100. package/dist/src-DWOWXEPY.js.map +0 -1
  101. package/dist/types-BZP9npQ9.d.cts.map +0 -1
  102. package/dist/types-DqHtEV5w.d.ts +0 -71
  103. package/dist/types-DqHtEV5w.d.ts.map +0 -1
@@ -1,181 +0,0 @@
1
- import "./entry-preview-Oaye2Q3u.js";
2
- import "./rollup-parseAst-t-4tfMPG.d.ts";
3
- import { getCustomElements, isValidComponent, isValidMetaData } from "./src-DWOWXEPY.js";
4
- import { enhanceArgTypes } from "storybook/internal/docs-tools";
5
- import { logger } from "storybook/internal/client-logger";
6
-
7
- //#region src/docs/infer-type.ts
8
- const inferSBType = (prop) => {
9
- const scalarTypes = [
10
- "string",
11
- "number",
12
- "boolean",
13
- "symbol"
14
- ];
15
- if (prop.type.toLowerCase() in scalarTypes) return {
16
- name: prop.type.toLowerCase(),
17
- raw: prop.type,
18
- required: prop.required
19
- };
20
- if (/^\(.*\)\s*=>\s*.*$/.test(prop.type)) return {
21
- name: "function",
22
- raw: prop.type,
23
- required: prop.required
24
- };
25
- return {
26
- name: "other",
27
- value: prop.type,
28
- raw: prop.type,
29
- required: prop.required
30
- };
31
- };
32
- const mapPropOptions = (prop) => prop.values.filter((value) => ["string", "number"].includes(value.type)).map(({ value }) => value);
33
- const inferControlType = (prop) => {
34
- switch (prop.type) {
35
- case "string":
36
- case "string | undefined": return { type: "text" };
37
- case "number":
38
- case "number | undefined": return { type: "number" };
39
- case "boolean":
40
- case "boolean | undefined": return { type: "boolean" };
41
- case "Date":
42
- case "Date | string": return { type: "date" };
43
- case "function":
44
- case "function | undefined":
45
- case "void":
46
- case "void | undefined": return null;
47
- default:
48
- const values = mapPropOptions(prop);
49
- if (values.length === 0) return { type: "object" };
50
- if (values.length < 5) return { type: "radio" };
51
- return { type: "select" };
52
- }
53
- };
54
-
55
- //#endregion
56
- //#region src/docs/custom-elements.ts
57
- /**
58
- * Formats docsTags (@deprecated, @see, @since) and appends them to the description
59
- */
60
- const formatDocsTags = (docs, docsTags) => {
61
- if (!docsTags || docsTags.length === 0) return docs;
62
- const tagSections = [];
63
- const deprecationSections = [];
64
- const deprecatedTags = docsTags.filter((tag) => tag.name === "deprecated");
65
- if (deprecatedTags.length > 0) deprecatedTags.forEach((tag) => {
66
- if (tag.text) deprecationSections.push(`**⚠️ DEPRECATED:** ${tag.text}`);
67
- else deprecationSections.push(`**⚠️ DEPRECATED**`);
68
- });
69
- const seeTags = docsTags.filter((tag) => tag.name === "see");
70
- if (seeTags.length > 0) {
71
- const seeLinks = seeTags.map((tag) => {
72
- const url = tag.text?.trim();
73
- return url ? `[${url}](${url})` : "";
74
- }).filter(Boolean).join(", ");
75
- if (seeLinks) tagSections.push(`**See:** ${seeLinks}`);
76
- }
77
- const sinceTags = docsTags.filter((tag) => tag.name === "since");
78
- if (sinceTags.length > 0) {
79
- const sinceText = sinceTags.map((tag) => tag.text).filter(Boolean).join(", ");
80
- if (sinceText) tagSections.push(`**Since:** ${sinceText}`);
81
- }
82
- const allSections = [
83
- ...deprecationSections,
84
- docs,
85
- ...tagSections
86
- ].filter(Boolean);
87
- return allSections.join("\n\n");
88
- };
89
- const mapData = (data, category) => data.reduce((acc, item) => {
90
- acc[item.name] = {
91
- name: item.name,
92
- description: formatDocsTags(item.docs, item.docsTags),
93
- control: false,
94
- table: { category }
95
- };
96
- return acc;
97
- }, {});
98
- const mapMethods = (methods) => methods.reduce((acc, method) => {
99
- acc[method.name] = {
100
- name: method.name,
101
- description: formatDocsTags(method.docs, method.docsTags),
102
- control: null,
103
- type: { name: "function" },
104
- table: {
105
- category: "methods",
106
- type: { summary: method.signature }
107
- }
108
- };
109
- return acc;
110
- }, {});
111
- const mapEvent = (events) => events.reduce((acc, event) => {
112
- let name = event.event.replace(/(-|_|:|\.|\s)+(.)?/g, (_match, _separator, chr) => {
113
- return chr ? chr.toUpperCase() : "";
114
- }).replace(/^([A-Z])/, (match) => match.toLowerCase());
115
- name = `on${name.charAt(0).toUpperCase() + name.slice(1)}`;
116
- acc[name] = {
117
- name,
118
- description: formatDocsTags(event.docs, event.docsTags),
119
- control: null,
120
- table: {
121
- category: "events",
122
- type: { summary: event.detail }
123
- },
124
- type: { name: "function" }
125
- };
126
- return acc;
127
- }, {});
128
- const mapProps = (props) => props.reduce((acc, prop) => {
129
- acc[prop.name] = {
130
- name: prop.attr || prop.name,
131
- description: formatDocsTags(prop.docs, prop.docsTags),
132
- control: inferControlType(prop),
133
- table: {
134
- category: "properties",
135
- type: { summary: prop.complexType?.original },
136
- defaultValue: { summary: prop.default }
137
- },
138
- options: mapPropOptions(prop),
139
- type: inferSBType(prop)
140
- };
141
- return acc;
142
- }, {});
143
- const getMetaData = (tagName, manifest) => {
144
- if (!isValidComponent(tagName) || !isValidMetaData(manifest)) return null;
145
- const metaData = manifest.components.find((component) => component.tag.toUpperCase() === tagName.toUpperCase());
146
- if (!metaData) logger.warn(`Component not found in custom-elements.json: ${tagName}`);
147
- return metaData;
148
- };
149
- const extractArgTypesFromElements = (tagName, customElements) => {
150
- const metaData = getMetaData(tagName, customElements);
151
- return metaData && {
152
- ...mapProps(metaData.props),
153
- ...mapEvent(metaData.events),
154
- ...mapMethods(metaData.methods),
155
- ...mapData(metaData.slots, "slots"),
156
- ...mapData(metaData.parts, "parts"),
157
- ...mapData(metaData.styles, "styles")
158
- };
159
- };
160
- const extractArgTypes = (component) => {
161
- const cem = getCustomElements();
162
- const tagName = typeof component === "string" ? component : component?.is;
163
- return extractArgTypesFromElements(tagName, cem);
164
- };
165
- const extractComponentDescription = (component) => {
166
- const tagName = typeof component === "string" ? component : component?.is;
167
- const metaData = getMetaData(tagName, getCustomElements());
168
- return metaData && metaData.docs;
169
- };
170
-
171
- //#endregion
172
- //#region src/entry-preview-argtypes.ts
173
- const parameters = { docs: {
174
- extractArgTypes,
175
- extractComponentDescription
176
- } };
177
- const argTypesEnhancers = [enhanceArgTypes];
178
-
179
- //#endregion
180
- export { argTypesEnhancers, parameters };
181
- //# sourceMappingURL=entry-preview-argtypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview-argtypes.js","names":["prop: JsonDocsProp","scalarTypes: SBScalarType['name'][]","docs: string","docsTags?: DocsTag[]","tagSections: string[]","deprecationSections: string[]","data: T[]","category: string","methods: JsonDocsMethod[]","events: JsonDocsEvent[]","chr: string","props: JsonDocsProp[]","tagName: string","manifest: JsonDocs","customElements: JsonDocs","component: any","argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[]"],"sources":["../src/docs/infer-type.ts","../src/docs/custom-elements.ts","../src/entry-preview-argtypes.ts"],"sourcesContent":["import type { JsonDocsProp } from '@stencil/core/internal';\nimport type { InputType, SBScalarType, SBType } from 'storybook/internal/types';\n\nexport const inferSBType = (prop: JsonDocsProp): SBType => {\n const scalarTypes: SBScalarType['name'][] = ['string', 'number', 'boolean', 'symbol'];\n if (prop.type.toLowerCase() in scalarTypes) {\n return { name: prop.type.toLowerCase(), raw: prop.type, required: prop.required } as SBScalarType;\n }\n\n if (/^\\(.*\\)\\s*=>\\s*.*$/.test(prop.type)) {\n return { name: 'function', raw: prop.type, required: prop.required };\n }\n\n return { name: 'other', value: prop.type, raw: prop.type, required: prop.required };\n};\n\nexport const mapPropOptions = (prop: JsonDocsProp) =>\n prop.values.filter((value) => ['string', 'number'].includes(value.type)).map(({ value }) => value);\n\nexport const inferControlType = (prop: JsonDocsProp): InputType['control'] => {\n switch (prop.type) {\n case 'string':\n case 'string | undefined':\n return { type: 'text' };\n case 'number':\n case 'number | undefined':\n return { type: 'number' };\n case 'boolean':\n case 'boolean | undefined':\n return { type: 'boolean' };\n case 'Date':\n case 'Date | string':\n return { type: 'date' };\n case 'function':\n case 'function | undefined':\n case 'void':\n case 'void | undefined':\n return null;\n default:\n const values = mapPropOptions(prop);\n\n if (values.length === 0) {\n return { type: 'object' };\n }\n if (values.length < 5) {\n return { type: 'radio' };\n }\n return { type: 'select' };\n }\n};\n","import type {\n JsonDocs,\n JsonDocsEvent,\n JsonDocsMethod,\n JsonDocsPart,\n JsonDocsProp,\n JsonDocsSlot,\n JsonDocsStyle,\n} from '@stencil/core/internal';\nimport { logger } from 'storybook/internal/client-logger';\nimport type { ArgTypes } from 'storybook/internal/types';\n\nimport { getCustomElements, isValidComponent, isValidMetaData } from '..';\nimport { inferControlType, inferSBType, mapPropOptions } from './infer-type';\n\ninterface DocsTag {\n name: string;\n text?: string;\n}\n\n/**\n * Formats docsTags (@deprecated, @see, @since) and appends them to the description\n */\nconst formatDocsTags = (docs: string, docsTags?: DocsTag[]): string => {\n if (!docsTags || docsTags.length === 0) {\n return docs;\n }\n\n const tagSections: string[] = [];\n const deprecationSections: string[] = [];\n\n // Handle @deprecated tags - show at the top with emphasis\n const deprecatedTags = docsTags.filter((tag) => tag.name === 'deprecated');\n if (deprecatedTags.length > 0) {\n deprecatedTags.forEach((tag) => {\n if (tag.text) {\n deprecationSections.push(`**⚠️ DEPRECATED:** ${tag.text}`);\n } else {\n deprecationSections.push(`**⚠️ DEPRECATED**`);\n }\n });\n }\n\n // Handle @see tags - create links\n const seeTags = docsTags.filter((tag) => tag.name === 'see');\n if (seeTags.length > 0) {\n const seeLinks = seeTags\n .map((tag) => {\n const url = tag.text?.trim();\n return url ? `[${url}](${url})` : '';\n })\n .filter(Boolean)\n .join(', ');\n if (seeLinks) {\n tagSections.push(`**See:** ${seeLinks}`);\n }\n }\n\n // Handle @since tags\n const sinceTags = docsTags.filter((tag) => tag.name === 'since');\n if (sinceTags.length > 0) {\n const sinceText = sinceTags\n .map((tag) => tag.text)\n .filter(Boolean)\n .join(', ');\n if (sinceText) {\n tagSections.push(`**Since:** ${sinceText}`);\n }\n }\n\n // Combine all sections - deprecation first, then docs, then other tags\n const allSections = [...deprecationSections, docs, ...tagSections].filter(Boolean);\n\n return allSections.join('\\n\\n');\n};\n\nconst mapData = <T extends JsonDocsPart>(data: T[], category: string): ArgTypes =>\n data.reduce<ArgTypes>((acc, item) => {\n acc[item.name] = {\n name: item.name,\n description: formatDocsTags(item.docs, (item as any).docsTags as DocsTag[]),\n control: false,\n table: {\n category,\n },\n };\n return acc;\n }, {});\n\nconst mapMethods = (methods: JsonDocsMethod[]): ArgTypes =>\n methods.reduce<ArgTypes>((acc, method) => {\n acc[method.name] = {\n name: method.name,\n description: formatDocsTags(method.docs, method.docsTags as DocsTag[]),\n control: null,\n type: { name: 'function' },\n table: {\n category: 'methods',\n type: { summary: method.signature },\n },\n };\n return acc;\n }, {});\n\nconst mapEvent = (events: JsonDocsEvent[]): ArgTypes =>\n events.reduce<ArgTypes>((acc, event) => {\n let name = event.event\n .replace(/(-|_|:|\\.|\\s)+(.)?/g, (_match, _separator, chr: string) => {\n return chr ? chr.toUpperCase() : '';\n })\n .replace(/^([A-Z])/, (match) => match.toLowerCase());\n\n name = `on${name.charAt(0).toUpperCase() + name.slice(1)}`;\n\n acc[name] = {\n name,\n description: formatDocsTags(event.docs, event.docsTags as DocsTag[]),\n control: null,\n table: {\n category: 'events',\n type: { summary: event.detail },\n },\n type: { name: 'function' },\n };\n\n return acc;\n }, {});\n\nconst mapProps = (props: JsonDocsProp[]): ArgTypes =>\n props.reduce<ArgTypes>((acc, prop) => {\n acc[prop.name] = {\n name: prop.attr || prop.name,\n description: formatDocsTags(prop.docs, prop.docsTags as DocsTag[]),\n control: inferControlType(prop),\n table: {\n category: 'properties',\n type: { summary: prop.complexType?.original },\n defaultValue: { summary: prop.default },\n },\n options: mapPropOptions(prop),\n type: inferSBType(prop),\n };\n\n return acc;\n }, {});\n\nconst getMetaData = (tagName: string, manifest: JsonDocs) => {\n if (!isValidComponent(tagName) || !isValidMetaData(manifest)) {\n return null;\n }\n const metaData = manifest.components.find((component) => component.tag.toUpperCase() === tagName.toUpperCase());\n if (!metaData) {\n logger.warn(`Component not found in custom-elements.json: ${tagName}`);\n }\n return metaData;\n};\n\nexport const extractArgTypesFromElements = (tagName: string, customElements: JsonDocs) => {\n const metaData = getMetaData(tagName, customElements);\n return (\n metaData && {\n ...mapProps(metaData.props),\n ...mapEvent(metaData.events),\n ...mapMethods(metaData.methods),\n ...mapData<JsonDocsSlot>(metaData.slots, 'slots'),\n ...mapData<JsonDocsPart>(metaData.parts, 'parts'),\n ...mapData<JsonDocsStyle>(metaData.styles, 'styles'),\n }\n );\n};\n\nexport const extractArgTypes = (component: any) => {\n const cem = getCustomElements();\n // Handle both string references (lazy loading) and class references (auto-define)\n const tagName = typeof component === 'string' ? component : component?.is;\n return extractArgTypesFromElements(tagName, cem);\n};\n\nexport const extractComponentDescription = (component: any) => {\n // Handle both string references (lazy loading) and class references (auto-define)\n const tagName = typeof component === 'string' ? component : component?.is;\n const metaData = getMetaData(tagName, getCustomElements());\n return metaData && metaData.docs;\n};\n","import { enhanceArgTypes } from 'storybook/internal/docs-tools';\nimport type { ArgTypesEnhancer } from 'storybook/internal/types';\n\nimport { extractArgTypes, extractComponentDescription } from './docs/custom-elements';\nimport type { StencilRenderer } from './types';\n\nexport const parameters = {\n docs: {\n extractArgTypes,\n extractComponentDescription,\n },\n};\n\nexport const argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[] = [enhanceArgTypes];"],"mappings":";;;;;;;AAGA,MAAa,cAAc,CAACA,SAA+B;CACzD,MAAMC,cAAsC;EAAC;EAAU;EAAU;EAAW;CAAS;AACrF,KAAI,KAAK,KAAK,aAAa,IAAI,YAC7B,QAAO;EAAE,MAAM,KAAK,KAAK,aAAa;EAAE,KAAK,KAAK;EAAM,UAAU,KAAK;CAAU;AAGnF,KAAI,qBAAqB,KAAK,KAAK,KAAK,CACtC,QAAO;EAAE,MAAM;EAAY,KAAK,KAAK;EAAM,UAAU,KAAK;CAAU;AAGtE,QAAO;EAAE,MAAM;EAAS,OAAO,KAAK;EAAM,KAAK,KAAK;EAAM,UAAU,KAAK;CAAU;AACpF;AAED,MAAa,iBAAiB,CAACD,SAC7B,KAAK,OAAO,OAAO,CAAC,UAAU,CAAC,UAAU,QAAS,EAAC,SAAS,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,MAAM;AAEpG,MAAa,mBAAmB,CAACA,SAA6C;AAC5E,SAAQ,KAAK,MAAb;EACE,KAAK;EACL,KAAK,qBACH,QAAO,EAAE,MAAM,OAAQ;EACzB,KAAK;EACL,KAAK,qBACH,QAAO,EAAE,MAAM,SAAU;EAC3B,KAAK;EACL,KAAK,sBACH,QAAO,EAAE,MAAM,UAAW;EAC5B,KAAK;EACL,KAAK,gBACH,QAAO,EAAE,MAAM,OAAQ;EACzB,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,mBACH,QAAO;EACT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ONVKsKI9.cjs');
3
- const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
4
-
5
- //#region src/entry-preview-docs.ts
6
- const decorators = [require_docs.sourceDecorator];
7
- const parameters = { docs: {
8
- story: { inline: true },
9
- source: {
10
- type: storybook_internal_docs_tools.SourceType.DYNAMIC,
11
- language: "html",
12
- format: "dedent"
13
- }
14
- } };
15
-
16
- //#endregion
17
- exports.decorators = decorators;
18
- exports.parameters = parameters;
19
- //# sourceMappingURL=entry-preview-docs.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview-docs.cjs","names":["decorators: DecoratorFunction<StencilRenderer<unknown>>[]","sourceDecorator","parameters: Parameters","SourceType"],"sources":["../src/entry-preview-docs.ts"],"sourcesContent":["import { SourceType } from 'storybook/internal/docs-tools';\nimport type { DecoratorFunction, Parameters } from 'storybook/internal/types';\nimport { sourceDecorator } from './docs';\nimport type { StencilRenderer } from './types';\n\nexport const decorators: DecoratorFunction<StencilRenderer<unknown>>[] = [sourceDecorator];\n\nexport const parameters: Parameters = {\n docs: {\n story: { inline: true },\n source: {\n type: SourceType.DYNAMIC,\n language: 'html',\n format: 'dedent',\n },\n },\n};\n"],"mappings":";;;;;AAKA,MAAaA,aAA4D,CAACC,4BAAgB;AAE1F,MAAaC,aAAyB,EACpC,MAAM;CACJ,OAAO,EAAE,QAAQ,KAAM;CACvB,QAAQ;EACN,MAAMC,yCAAW;EACjB,UAAU;EACV,QAAQ;CACT;AACF,EACF"}
@@ -1,11 +0,0 @@
1
- import { StencilRenderer } from "./types-BZP9npQ9.cjs";
2
- import { DecoratorFunction, Parameters } from "storybook/internal/types";
3
-
4
- //#region src/entry-preview-docs.d.ts
5
- declare const decorators: DecoratorFunction<StencilRenderer<unknown>>[];
6
- declare const parameters: Parameters;
7
- //# sourceMappingURL=entry-preview-docs.d.ts.map
8
-
9
- //#endregion
10
- export { decorators, parameters };
11
- //# sourceMappingURL=entry-preview-docs.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview-docs.d.cts","names":[],"sources":["../src/entry-preview-docs.ts"],"sourcesContent":[],"mappings":";;;;cAKa,YAAY,kBAAkB;cAE9B,YAAY;AAFzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview-docs.d.ts","names":[],"sources":["../src/entry-preview-docs.ts"],"sourcesContent":[],"mappings":";;;;cAKa,YAAY,kBAAkB;cAE9B,YAAY;AAFzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview-docs.js","names":["decorators: DecoratorFunction<StencilRenderer<unknown>>[]","parameters: Parameters"],"sources":["../src/entry-preview-docs.ts"],"sourcesContent":["import { SourceType } from 'storybook/internal/docs-tools';\nimport type { DecoratorFunction, Parameters } from 'storybook/internal/types';\nimport { sourceDecorator } from './docs';\nimport type { StencilRenderer } from './types';\n\nexport const decorators: DecoratorFunction<StencilRenderer<unknown>>[] = [sourceDecorator];\n\nexport const parameters: Parameters = {\n docs: {\n story: { inline: true },\n source: {\n type: SourceType.DYNAMIC,\n language: 'html',\n format: 'dedent',\n },\n },\n};\n"],"mappings":";;;;AAKA,MAAaA,aAA4D,CAAC,eAAgB;AAE1F,MAAaC,aAAyB,EACpC,MAAM;CACJ,OAAO,EAAE,QAAQ,KAAM;CACvB,QAAQ;EACN,MAAM,WAAW;EACjB,UAAU;EACV,QAAQ;CACT;AACF,EACF"}
@@ -1,6 +0,0 @@
1
- const require_entry_preview = require('./entry-preview-BmNVHtoL.cjs');
2
-
3
- exports.argTypesEnhancers = require_entry_preview.argTypesEnhancers;
4
- exports.parameters = require_entry_preview.parameters;
5
- exports.render = require_entry_preview.render;
6
- exports.renderToCanvas = require_entry_preview.renderToCanvas;
@@ -1,20 +0,0 @@
1
- import { StencilRenderer } from "./types-BZP9npQ9.cjs";
2
- import { ArgTypesEnhancer, ArgsStoryFn, Parameters, RenderContext } from "storybook/internal/types";
3
-
4
- //#region src/render.d.ts
5
- declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
6
- declare function renderToCanvas({
7
- storyFn,
8
- showMain,
9
- storyContext
10
- }: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
11
- //# sourceMappingURL=render.d.ts.map
12
- //#endregion
13
- //#region src/entry-preview.d.ts
14
- declare const parameters: Parameters;
15
- declare const argTypesEnhancers: ArgTypesEnhancer[];
16
- //# sourceMappingURL=entry-preview.d.ts.map
17
-
18
- //#endregion
19
- export { argTypesEnhancers, parameters, render, renderToCanvas };
20
- //# sourceMappingURL=entry-preview.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview.d.cts","names":[],"sources":["../src/render.ts","../src/entry-preview.ts"],"sourcesContent":[],"mappings":";;;;cAMa,QAAQ,YAAY;iBA6CjB,cAAA;;;;GACuB,cAAc,0CACpC;AA/CjB;;;cCHa,YAAY;cAIZ,mBAAmB;ADDhC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry-preview.d.ts","names":[],"sources":["../src/render.ts","../src/entry-preview.ts"],"sourcesContent":[],"mappings":";;;;cAMa,QAAQ,YAAY;iBA6CjB,cAAA;;;;GACuB,cAAc,0CACpC;AA/CjB;;;cCHa,YAAY;cAIZ,mBAAmB;ADDhC"}
@@ -1,3 +0,0 @@
1
- import { argTypesEnhancers, parameters, render, renderToCanvas } from "./entry-preview-Oaye2Q3u.js";
2
-
3
- export { argTypesEnhancers, parameters, render, renderToCanvas };
package/dist/index.cjs DELETED
@@ -1,9 +0,0 @@
1
- const require_src = require('./src-C4ce9Ps1.cjs');
2
- require('./entry-preview-BmNVHtoL.cjs');
3
-
4
- exports.getCustomElements = require_src.getCustomElements;
5
- exports.isValidComponent = require_src.isValidComponent;
6
- exports.isValidMetaData = require_src.isValidMetaData;
7
- exports.setCustomElements = require_src.setCustomElements;
8
- exports.setCustomElementsManifest = require_src.setCustomElementsManifest;
9
- exports.setProjectAnnotations = require_src.setProjectAnnotations;
package/dist/index.d.cts DELETED
@@ -1,65 +0,0 @@
1
- import { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig } from "./types-BZP9npQ9.cjs";
2
- import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
3
- import { JsonDocs } from "@stencil/core/internal";
4
-
5
- //#region @types/rollup-parseAst.d.ts
6
-
7
- /**
8
- * Extra type definitions for rollup/parseAst in cases the Rollup version between
9
- * `@stencil/storybook-plugin` and `unplugin-stencil` is different. This may cause
10
- * the following type error:
11
- *
12
- * ```
13
- * [ ERROR ] TypeScript: node_modules/vite/dist/node/index.d.ts:5:41
14
- * Cannot find module 'rollup/parseAst' or its corresponding type
15
- * declarations.
16
- *
17
- * L4: export { rollup as Rollup };
18
- * L5: export { parseAst, parseAstAsync } from 'rollup/parseAst';
19
- * L6: import * as http from 'node:http';
20
- * ```
21
- *
22
- * This file is a workaround to make sure the type definitions are available when
23
- * importing `rollup/parseAst` in `unplugin-stencil`.
24
- */
25
- declare module 'rollup/parseAst' {
26
- export function parseAst(code: string, options?: any): any;
27
- export function parseAstAsync(code: string, options?: any): Promise<any>;
28
- }
29
- //#endregion
30
- //#region src/framework-api.d.ts
31
- declare function isValidComponent(tagName: string): boolean;
32
- declare function isValidMetaData(customElements: JsonDocs): boolean;
33
- /** @param customElements `any` for now as spec is not super stable yet */
34
- declare function setCustomElements(customElements: any): void;
35
- declare function setCustomElementsManifest(customElements: any): void;
36
- declare function getCustomElements(): any;
37
- //# sourceMappingURL=framework-api.d.ts.map
38
-
39
- //#endregion
40
- //#region src/portable-stories.d.ts
41
- /**
42
- * Function that sets the globalConfig of your storybook. The global config is the preview module of
43
- * your .storybook folder.
44
- *
45
- * It should be run a single time, so that your global config (e.g. decorators) is applied to your
46
- * stories when using `composeStories` or `composeStory`.
47
- *
48
- * Example:
49
- *
50
- * ```jsx
51
- * // setup-file.js
52
- * import { setProjectAnnotations } from '@storybook/web-components';
53
- * import projectAnnotations from './.storybook/preview';
54
- *
55
- * setProjectAnnotations(projectAnnotations);
56
- * ```
57
- *
58
- * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
59
- */
60
- declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
61
- //# sourceMappingURL=portable-stories.d.ts.map
62
-
63
- //#endregion
64
- export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
65
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":["Promise","sideEffect"],"sources":["../@types/rollup-parseAst.d.ts","../src/framework-api.ts","../src/portable-stories.tsx"],"sourcesContent":["/**\n * Extra type definitions for rollup/parseAst in cases the Rollup version between\n * `@stencil/storybook-plugin` and `unplugin-stencil` is different. This may cause\n * the following type error:\n *\n * ```\n * [ ERROR ] TypeScript: node_modules/vite/dist/node/index.d.ts:5:41\n * Cannot find module 'rollup/parseAst' or its corresponding type\n * declarations.\n *\n * L4: export { rollup as Rollup };\n * L5: export { parseAst, parseAstAsync } from 'rollup/parseAst';\n * L6: import * as http from 'node:http';\n * ```\n *\n * This file is a workaround to make sure the type definitions are available when\n * importing `rollup/parseAst` in `unplugin-stencil`.\n */\ndeclare module 'rollup/parseAst' {\n export function parseAst(code: string, options?: any): any;\n export function parseAstAsync(code: string, options?: any): Promise<any>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBqE;;;;ACjBrE;AAUA;AAaA;AAIA;AAIA;;;8DDd8DA;AES9D;;;iBD1BgB,gBAAA;iBAUA,eAAA,iBAAgC;;iBAahC,iBAAA;iBAIA,yBAAA;iBAIA,iBAAA,CAAA;;;;;;;;;;;;ADdqD;;;;ACjBrE;AAUA;AAaA;AAIA;AAIA;;;;ACLgB,iBAAA,qBAAA,CAAqB,kBAAA,EACf,gCADe,CAAA,GAAA,CAAA,GACyB,gCADzB,CAAA,GAAA,CAAA,EAAA,CAAA,EAElC,4BAFkC,CAEL,eAFK,CAAA,OAAA,CAAA,CAAA"}
package/dist/index.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import "./rollup-parseAst-t-4tfMPG.js";
2
- import { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig } from "./types-DqHtEV5w.js";
3
- import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
4
- import { JsonDocs } from "@stencil/core/internal";
5
-
6
- //#region src/framework-api.d.ts
7
- declare function isValidComponent(tagName: string): boolean;
8
- declare function isValidMetaData(customElements: JsonDocs): boolean;
9
- /** @param customElements `any` for now as spec is not super stable yet */
10
- declare function setCustomElements(customElements: any): void;
11
- declare function setCustomElementsManifest(customElements: any): void;
12
- declare function getCustomElements(): any;
13
- //# sourceMappingURL=framework-api.d.ts.map
14
-
15
- //#endregion
16
- //#region src/portable-stories.d.ts
17
- /**
18
- * Function that sets the globalConfig of your storybook. The global config is the preview module of
19
- * your .storybook folder.
20
- *
21
- * It should be run a single time, so that your global config (e.g. decorators) is applied to your
22
- * stories when using `composeStories` or `composeStory`.
23
- *
24
- * Example:
25
- *
26
- * ```jsx
27
- * // setup-file.js
28
- * import { setProjectAnnotations } from '@storybook/web-components';
29
- * import projectAnnotations from './.storybook/preview';
30
- *
31
- * setProjectAnnotations(projectAnnotations);
32
- * ```
33
- *
34
- * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
35
- */
36
- declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
37
- //# sourceMappingURL=portable-stories.d.ts.map
38
- //#endregion
39
- export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
40
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/framework-api.ts","../src/portable-stories.tsx"],"sourcesContent":[],"mappings":";;;;;;iBAGgB,gBAAA;iBAUA,eAAA,iBAAgC;;iBAahC,iBAAA;iBAIA,yBAAA;AA3BA,iBA+BA,iBAAA,CAAA,CA/BgB,EAAA,GAAA;AAUhC;;;;;;;;AAVA;AAUA;AAaA;AAIA;AAIA;;;;ACLA;;;;;;AAE+B;iBAFf,qBAAA,qBACM,wCAAwC,0CAC3D,6BAA6B"}
package/dist/index.js DELETED
@@ -1,5 +0,0 @@
1
- import "./entry-preview-Oaye2Q3u.js";
2
- import "./rollup-parseAst-t-4tfMPG.d.ts";
3
- import { getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations } from "./src-DWOWXEPY.js";
4
-
5
- export { getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
@@ -1,9 +0,0 @@
1
-
2
- //#region src/node/index.ts
3
- function defineMain(config) {
4
- return config;
5
- }
6
-
7
- //#endregion
8
- exports.defineMain = defineMain;
9
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["config: StorybookConfig"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { StorybookConfig } from '../types';\n\nexport function defineMain(config: StorybookConfig) {\n return config;\n}\n"],"mappings":";;AAEA,SAAgB,WAAWA,QAAyB;AAClD,QAAO;AACR"}
@@ -1,9 +0,0 @@
1
- import { StorybookConfig } from "../types-BZP9npQ9.cjs";
2
-
3
- //#region src/node/index.d.ts
4
- declare function defineMain(config: StorybookConfig): StorybookConfig;
5
- //# sourceMappingURL=index.d.ts.map
6
-
7
- //#endregion
8
- export { defineMain };
9
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/node/index.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,UAAA,SAAmB,kBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/node/index.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,UAAA,SAAmB,kBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["config: StorybookConfig"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { StorybookConfig } from '../types';\n\nexport function defineMain(config: StorybookConfig) {\n return config;\n}\n"],"mappings":";AAEA,SAAgB,WAAWA,QAAyB;AAClD,QAAO;AACR"}
package/dist/preset.cjs DELETED
@@ -1,135 +0,0 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const fs = require_chunk.__toESM(require("fs"));
3
- const module$1 = require_chunk.__toESM(require("module"));
4
- const path = require_chunk.__toESM(require("path"));
5
- const __stencil_community_unplugin_stencil = require_chunk.__toESM(require("@stencil-community/unplugin-stencil"));
6
- const __stencil_community_unplugin_stencil_vite = require_chunk.__toESM(require("@stencil-community/unplugin-stencil/vite"));
7
- const url = require_chunk.__toESM(require("url"));
8
- const vite = require_chunk.__toESM(require("vite"));
9
-
10
- //#region src/preset.ts
11
- const require$1 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
12
- const getAbsolutePath = (input) => (0, path.dirname)(require$1.resolve((0, path.join)(input, "package.json")));
13
- const __dirname$1 = (0, path.dirname)((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
14
- const renderer = (0, path.join)(__dirname$1, "entry-preview.js");
15
- const UNPLUGIN_STENCIL_NAME = "@stencil-community/unplugin-stencil";
16
- const core = {
17
- builder: (0, path.join)(getAbsolutePath("@storybook/builder-vite"), "dist", "index.js"),
18
- renderer
19
- };
20
- const viteFinal = async (defaultConfig, { configType }) => {
21
- const config = (0, vite.mergeConfig)(defaultConfig, {
22
- build: { target: "es2020" },
23
- plugins: [(0, __stencil_community_unplugin_stencil_vite.default)({ rootPath: defaultConfig.root })]
24
- });
25
- if (configType === "DEVELOPMENT") return (0, vite.mergeConfig)(config, {
26
- build: { rollupOptions: { external: ["@stencil/core"] } },
27
- server: { watch: { ignored: [(0, path.join)(__dirname$1, "**")] } },
28
- plugins: [stencilPreviewReloadPlugin()]
29
- });
30
- return config;
31
- };
32
- /**
33
- * Forces a full preview reload when a Stencil component changes.
34
- *
35
- * `customElements.define()` is permanent, so HMR can't swap the new class in —
36
- * the iframe must reload. We use a custom HMR event (instead of Vite's
37
- * `full-reload`) because Storybook's story-index watcher races us with its own
38
- * `vite-app.js` HMR update and cancels plain reloads.
39
- *
40
- * - Eager: the .tsx is in Vite's graph; our `transform` hook fires after
41
- * unplugin-stencil and emits the reload.
42
- * - Lazy: the .tsx isn't imported, so we run unplugin-stencil ourselves, then
43
- * reload once `@stencil-community/unplugin-stencil` reports the build
44
- * finished (its `stencilBuildEvents` emitter, instead of polling dist/esm).
45
- * - Styles: `@stencil-community/unplugin-stencil` exposes a `style → component`
46
- * map built from each component's `@Component` decorator (AST-parsed, covers
47
- * `styleUrl`, `styleUrls` array, and `styleUrls` mode object). When a tracked
48
- * style file changes we touch every dependent `.tsx` so the eager/lazy paths
49
- * above pick up the rebuild.
50
- * - Global style: the same package resolves `stencil.config#globalStyle`; when
51
- * it changes we touch every known component `.tsx`.
52
- */
53
- function stencilPreviewReloadPlugin() {
54
- let devServer;
55
- let lazyBuildPending = false;
56
- const sendReload = (server) => {
57
- server.ws.send({
58
- type: "custom",
59
- event: "stencil:reload"
60
- });
61
- };
62
- const distEsmFragment = `${path.sep}dist${path.sep}esm${path.sep}`;
63
- const isComponentSource = (id) => id.endsWith(".tsx") && !id.endsWith(".stories.tsx") && !id.includes(`${path.sep}node_modules${path.sep}`) && !id.includes(`${path.sep}.storybook${path.sep}`);
64
- const invalidateDistEsm = (server) => {
65
- for (const cached of server.moduleGraph.idToModuleMap.values()) if (cached.id && cached.id.includes(distEsmFragment) && cached.id.endsWith(".js")) server.moduleGraph.invalidateModule(cached);
66
- };
67
- const touch = (file) => {
68
- try {
69
- const now = /* @__PURE__ */ new Date();
70
- (0, fs.utimesSync)(file, now, now);
71
- } catch {}
72
- };
73
- return {
74
- name: "stencil-preview-reload",
75
- configureServer(server) {
76
- devServer = server;
77
- __stencil_community_unplugin_stencil.stencilBuildEvents.on("buildFinished", () => {
78
- if (!lazyBuildPending || !devServer) return;
79
- lazyBuildPending = false;
80
- invalidateDistEsm(devServer);
81
- sendReload(devServer);
82
- });
83
- server.watcher.on("change", async (file) => {
84
- const { byStyle, byComponent, globalStyle } = (0, __stencil_community_unplugin_stencil.getComponentStyleDependencies)();
85
- const resolved = (0, path.resolve)(file);
86
- if (globalStyle && resolved === globalStyle) {
87
- for (const componentId of byComponent.keys()) touch(componentId);
88
- return;
89
- }
90
- const dependents = byStyle.get(resolved);
91
- if (dependents && dependents.size > 0) {
92
- for (const componentId of dependents) touch(componentId);
93
- return;
94
- }
95
- if (!file.endsWith(".tsx") || file.endsWith(".stories.tsx")) return;
96
- const mod = server.moduleGraph.getModuleById(file);
97
- if (mod && mod.importers.size > 0) return;
98
- const stencilPlugin = server.config.plugins.find((p) => p.name === UNPLUGIN_STENCIL_NAME);
99
- if (!stencilPlugin || typeof stencilPlugin.transform !== "function") return;
100
- lazyBuildPending = true;
101
- try {
102
- const code = (0, fs.readFileSync)(file, "utf-8");
103
- await stencilPlugin.transform.call({ resolve: () => null }, code, file);
104
- } catch {
105
- lazyBuildPending = false;
106
- }
107
- });
108
- },
109
- handleHotUpdate(ctx) {
110
- const { file, modules } = ctx;
111
- if (!file.endsWith(".tsx") || file.endsWith(".stories.tsx")) return;
112
- const mod = modules[0];
113
- if (mod && mod.importers?.size > 0) return;
114
- return [];
115
- },
116
- async transform(_code, id) {
117
- if (!devServer) return;
118
- const cleanId = id.split("?")[0];
119
- if (!isComponentSource(cleanId)) return;
120
- if (lazyBuildPending) return;
121
- sendReload(devServer);
122
- }
123
- };
124
- }
125
- const previewAnnotations = async (input = [], options) => {
126
- const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
127
- const result = [];
128
- return result.concat(input).concat([renderer, (0, path.join)(__dirname$1, "entry-preview-argtypes.js")]).concat(docsEnabled ? [(0, path.join)(__dirname$1, "entry-preview-docs.js")] : []);
129
- };
130
-
131
- //#endregion
132
- exports.core = core;
133
- exports.previewAnnotations = previewAnnotations;
134
- exports.viteFinal = viteFinal;
135
- //# sourceMappingURL=preset.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset.cjs","names":["require","input: I","__dirname","core: StorybookConfig['core']","viteFinal: StorybookConfig['viteFinal']","devServer: ViteDevServer | undefined","server: ViteDevServer","sep","id: string","file: string","ctx: HmrContext","previewAnnotations: StorybookConfig['previewAnnotations']","result: string[]"],"sources":["../src/preset.ts"],"sourcesContent":["/**\n * we can't prefix the Node.js imports with `node:` because it will break\n * within Storybook due to its Vite setup.\n */\nimport { readFileSync, utimesSync } from 'fs';\nimport { createRequire } from 'module';\nimport { dirname, join, resolve, sep } from 'path';\nimport { getComponentStyleDependencies, stencilBuildEvents } from '@stencil-community/unplugin-stencil';\nimport stencil from '@stencil-community/unplugin-stencil/vite';\nimport { fileURLToPath } from 'url';\nimport type { HmrContext, Plugin, ViteDevServer } from 'vite';\nimport { mergeConfig } from 'vite';\nimport { StorybookConfig } from './types';\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'entry-preview.js');\n\nconst UNPLUGIN_STENCIL_NAME = '@stencil-community/unplugin-stencil';\n\nexport const core: StorybookConfig['core'] = {\n builder: join(getAbsolutePath('@storybook/builder-vite'), 'dist', 'index.js'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig['viteFinal'] = async (defaultConfig, { configType }) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n if (configType === 'DEVELOPMENT') {\n return mergeConfig(config, {\n build: {\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n // Don't let Vite watch this plugin's own `dist/`. `tsdown --watch`\n // rewrites those files during plugin development; if Vite picks the\n // change up it re-optimizes deps, bumping the React chunk hash and\n // leaving previously-imported chunks pointing at a torn-down React\n // (`useEffect` becomes null in <DocsContainer>).\n server: {\n watch: {\n ignored: [join(__dirname, '**')],\n },\n },\n plugins: [stencilPreviewReloadPlugin()],\n });\n }\n\n return config;\n};\n\n/**\n * Forces a full preview reload when a Stencil component changes.\n *\n * `customElements.define()` is permanent, so HMR can't swap the new class in —\n * the iframe must reload. We use a custom HMR event (instead of Vite's\n * `full-reload`) because Storybook's story-index watcher races us with its own\n * `vite-app.js` HMR update and cancels plain reloads.\n *\n * - Eager: the .tsx is in Vite's graph; our `transform` hook fires after\n * unplugin-stencil and emits the reload.\n * - Lazy: the .tsx isn't imported, so we run unplugin-stencil ourselves, then\n * reload once `@stencil-community/unplugin-stencil` reports the build\n * finished (its `stencilBuildEvents` emitter, instead of polling dist/esm).\n * - Styles: `@stencil-community/unplugin-stencil` exposes a `style → component`\n * map built from each component's `@Component` decorator (AST-parsed, covers\n * `styleUrl`, `styleUrls` array, and `styleUrls` mode object). When a tracked\n * style file changes we touch every dependent `.tsx` so the eager/lazy paths\n * above pick up the rebuild.\n * - Global style: the same package resolves `stencil.config#globalStyle`; when\n * it changes we touch every known component `.tsx`.\n */\nfunction stencilPreviewReloadPlugin(): Plugin {\n let devServer: ViteDevServer | undefined;\n let lazyBuildPending = false;\n\n const sendReload = (server: ViteDevServer) => {\n server.ws.send({ type: 'custom', event: 'stencil:reload' });\n };\n\n // Match dist/esm module ids on both POSIX and Windows.\n const distEsmFragment = `${sep}dist${sep}esm${sep}`;\n\n const isComponentSource = (id: string): boolean =>\n id.endsWith('.tsx') &&\n !id.endsWith('.stories.tsx') &&\n !id.includes(`${sep}node_modules${sep}`) &&\n !id.includes(`${sep}.storybook${sep}`);\n\n // dist/esm lives outside Vite's watched root, so its module cache never\n // invalidates on its own. Drop it before reloading.\n const invalidateDistEsm = (server: ViteDevServer): void => {\n for (const cached of server.moduleGraph.idToModuleMap.values()) {\n if (cached.id && cached.id.includes(distEsmFragment) && cached.id.endsWith('.js')) {\n server.moduleGraph.invalidateModule(cached);\n }\n }\n };\n\n // Touch a file's mtime so unplugin-stencil recompiles it. The resulting\n // `change` event re-enters the watcher handler and rides the eager/lazy path.\n const touch = (file: string): void => {\n try {\n const now = new Date();\n utimesSync(file, now, now);\n } catch {\n // ignore: best-effort touch\n }\n };\n\n return {\n name: 'stencil-preview-reload',\n\n configureServer(server) {\n devServer = server;\n\n // When unplugin-stencil finishes a (project-wide) Stencil build, the\n // fresh dist/esm chunks are on disk but Vite still has the old versions\n // cached. If we kicked a lazy rebuild, invalidate + reload now.\n stencilBuildEvents.on('buildFinished', () => {\n if (!lazyBuildPending || !devServer) return;\n lazyBuildPending = false;\n invalidateDistEsm(devServer);\n sendReload(devServer);\n });\n\n server.watcher.on('change', async (file: string) => {\n // unplugin-stencil seeds this map at buildStart, so it's populated from\n // the first watcher event for eager, lazy, and globalStyle alike.\n const { byStyle, byComponent, globalStyle } = getComponentStyleDependencies();\n const resolved = resolve(file);\n\n // Global style: baked into every component, so touch every component\n // we know about and let the eager/lazy paths reload.\n if (globalStyle && resolved === globalStyle) {\n for (const componentId of byComponent.keys()) touch(componentId);\n return;\n }\n\n // Component-style change: re-route to every dependent .tsx. Each touch\n // produces a fresh `change` event that flows through the logic below.\n const dependents = byStyle.get(resolved);\n if (dependents && dependents.size > 0) {\n for (const componentId of dependents) touch(componentId);\n return;\n }\n\n if (!file.endsWith('.tsx') || file.endsWith('.stories.tsx')) return;\n\n const mod = server.moduleGraph.getModuleById(file);\n // Eager components are handled by the `transform` hook below.\n if (mod && mod.importers.size > 0) return;\n\n // Lazy: trigger Stencil's build manually. unplugin-stencil's transform\n // resolves before the build flushes to disk, so we set a flag and wait\n // for `stencilBuildEvents.buildFinished` (above) to do the reload.\n const stencilPlugin = server.config.plugins.find((p) => p.name === UNPLUGIN_STENCIL_NAME);\n if (!stencilPlugin || typeof stencilPlugin.transform !== 'function') return;\n\n lazyBuildPending = true;\n try {\n const code = readFileSync(file, 'utf-8');\n await (stencilPlugin.transform as any).call({ resolve: (): null => null }, code, file);\n } catch {\n lazyBuildPending = false;\n }\n });\n },\n\n // Always reload (never HMR) for component .tsx files. Eager modules still\n // need to flow through Vite so unplugin-stencil rebuilds dist.\n handleHotUpdate(ctx: HmrContext) {\n const { file, modules } = ctx;\n if (!file.endsWith('.tsx') || file.endsWith('.stories.tsx')) return;\n const mod = modules[0];\n if (mod && mod.importers?.size > 0) return;\n return [];\n },\n\n async transform(_code, id) {\n if (!devServer) return;\n const cleanId = id.split('?')[0];\n if (!isComponentSource(cleanId)) return;\n if (lazyBuildPending) return;\n sendReload(devServer);\n },\n };\n}\n\nexport const previewAnnotations: StorybookConfig['previewAnnotations'] = async (input = [], options) => {\n const docsEnabled = Object.keys(await options.presets.apply('docs', {}, options)).length > 0;\n const result: string[] = [];\n\n return result\n .concat(input)\n .concat([renderer, join(__dirname, 'entry-preview-argtypes.js')])\n .concat(docsEnabled ? [join(__dirname, 'entry-preview-docs.js')] : []);\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAMA,YAAU,0EAA8B;AAC9C,MAAM,kBAAkB,CAAmBC,UAAgB,kBAAQ,UAAQ,QAAQ,eAAK,OAAO,eAAe,CAAC,CAAC;AAEhH,MAAMC,cAAY,kBAAQ,qEAA8B,CAAC;AAEzD,MAAM,WAAW,eAAKA,aAAW,mBAAmB;AAEpD,MAAM,wBAAwB;AAE9B,MAAaC,OAAgC;CAC3C,SAAS,eAAK,gBAAgB,0BAA0B,EAAE,QAAQ,WAAW;CAC7E;AACD;AAED,MAAaC,YAA0C,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