@t8/docsgen 0.4.23 → 0.4.25

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/dist/bin.js CHANGED
@@ -436,8 +436,10 @@ function getPreviewContent(url, title) {
436
436
  let previewURL = new URL(`https://codesandbox.io/embed/${sandboxId}`);
437
437
  let content = title ? `<legend>${title}</legend>` : "";
438
438
  previewURL.searchParams.set("view", "preview");
439
+ previewURL.searchParams.set("hidedevtools", "1");
440
+ previewURL.searchParams.set("theme", "dark");
439
441
  if (file) previewURL.searchParams.set("module", file);
440
- let attrs = [`src="${previewURL.href}"`];
442
+ let attrs = ['class="csb"', `src="${previewURL.href}"`];
441
443
  if (title) attrs.push(`title="${title}"`);
442
444
  if (height) attrs.push(`style="height: ${height}px;"`);
443
445
  content += `<iframe ${attrs.join(" ")} sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" loading="lazy"></iframe>`;
@@ -889,19 +891,14 @@ async function getNav(ctx, navItems) {
889
891
  navItemCount++;
890
892
  }
891
893
  } else {
892
- for (let { id, title, items } of navItems) {
894
+ for (let {
895
+ id,
896
+ title
897
+ /*, items */
898
+ } of navItems) {
893
899
  let itemLink = `${root}${contentDir}/${encodeURIComponent(id)}`;
894
900
  s += `
895
901
  <li data-id="${id}"><a href="${itemLink}">${title}</a>`;
896
- if (items.length !== 0) {
897
- s += "\n <ul>";
898
- for (let { id: id2, title: title2 } of items) {
899
- s += `
900
- <li><a href="${itemLink}#${encodeURIComponent(id2)}">${title2}</a></li>`;
901
- navItemCount++;
902
- }
903
- s += "\n </ul>\n";
904
- }
905
902
  s += "</li>";
906
903
  navItemCount++;
907
904
  }
package/dist/css/base.css CHANGED
@@ -185,3 +185,24 @@ html.blank .layout {
185
185
  justify-content: center;
186
186
  overflow: hidden;
187
187
  }
188
+ fieldset.csb {
189
+ --background: #242424;
190
+
191
+ border: 0.05em solid var(--secondary-color);
192
+ padding: 0.25em 0.65em 0.65em;
193
+ margin: var(--block-margin-y) 0;
194
+ }
195
+ fieldset.csb legend {
196
+ font-size: 0.8em;
197
+ color: var(--secondary-color);
198
+ }
199
+ fieldset.csb iframe {
200
+ display: block;
201
+ width: 100%;
202
+ height: 360px;
203
+ background: var(--background);
204
+ border: 2px solid var(--background);
205
+ border-width: 2px 3px;
206
+ box-sizing: border-box;
207
+ overflow: hidden;
208
+ }
@@ -250,21 +250,6 @@ main h2 {
250
250
  main h2:first-child {
251
251
  margin-top: 0;
252
252
  }
253
- main fieldset {
254
- border: 0.05em solid var(--secondary-color);
255
- margin: var(--block-margin-y) 0;
256
- }
257
- main fieldset legend {
258
- font-size: 0.8em;
259
- color: var(--secondary-color);
260
- }
261
- main fieldset iframe {
262
- width: 100%;
263
- height: 360px;
264
- background: var(--code-block-background);
265
- border: none;
266
- overflow: hidden;
267
- }
268
253
 
269
254
  .pagenav {
270
255
  --icon-width: 1.25em;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.4.23",
3
+ "version": "0.4.25",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "type": "module",
@@ -42,21 +42,21 @@ export async function getNav(ctx: Context, navItems: NavItem[]) {
42
42
  navItemCount++;
43
43
  }
44
44
  } else {
45
- for (let { id, title, items } of navItems) {
45
+ for (let { id, title /*, items */ } of navItems) {
46
46
  let itemLink = `${root}${contentDir}/${encodeURIComponent(id)}`;
47
47
 
48
48
  s += `\n<li data-id="${id}"><a href="${itemLink}">${title}</a>`;
49
49
 
50
- if (items.length !== 0) {
51
- s += "\n <ul>";
50
+ // if (items.length !== 0) {
51
+ // s += "\n <ul>";
52
52
 
53
- for (let { id, title } of items) {
54
- s += `\n <li><a href="${itemLink}#${encodeURIComponent(id)}">${title}</a></li>`;
55
- navItemCount++;
56
- }
53
+ // for (let { id, title } of items) {
54
+ // s += `\n <li><a href="${itemLink}#${encodeURIComponent(id)}">${title}</a></li>`;
55
+ // navItemCount++;
56
+ // }
57
57
 
58
- s += "\n </ul>\n";
59
- }
58
+ // s += "\n </ul>\n";
59
+ // }
60
60
 
61
61
  s += "</li>";
62
62
  navItemCount++;
@@ -15,10 +15,12 @@ function getPreviewContent(url: string, title?: string) {
15
15
  let content = title ? `<legend>${title}</legend>` : "";
16
16
 
17
17
  previewURL.searchParams.set("view", "preview");
18
+ previewURL.searchParams.set("hidedevtools", "1");
19
+ previewURL.searchParams.set("theme", "dark");
18
20
 
19
21
  if (file) previewURL.searchParams.set("module", file);
20
22
 
21
- let attrs = [`src="${previewURL.href}"`];
23
+ let attrs = ['class="csb"', `src="${previewURL.href}"`];
22
24
 
23
25
  if (title) attrs.push(`title="${title}"`);
24
26
  if (height) attrs.push(`style="height: ${height}px;"`);
package/src/css/base.css CHANGED
@@ -185,3 +185,24 @@ html.blank .layout {
185
185
  justify-content: center;
186
186
  overflow: hidden;
187
187
  }
188
+ fieldset.csb {
189
+ --background: #242424;
190
+
191
+ border: 0.05em solid var(--secondary-color);
192
+ padding: 0.25em 0.65em 0.65em;
193
+ margin: var(--block-margin-y) 0;
194
+ }
195
+ fieldset.csb legend {
196
+ font-size: 0.8em;
197
+ color: var(--secondary-color);
198
+ }
199
+ fieldset.csb iframe {
200
+ display: block;
201
+ width: 100%;
202
+ height: 360px;
203
+ background: var(--background);
204
+ border: 2px solid var(--background);
205
+ border-width: 2px 3px;
206
+ box-sizing: border-box;
207
+ overflow: hidden;
208
+ }
@@ -250,21 +250,6 @@ main h2 {
250
250
  main h2:first-child {
251
251
  margin-top: 0;
252
252
  }
253
- main fieldset {
254
- border: 0.05em solid var(--secondary-color);
255
- margin: var(--block-margin-y) 0;
256
- }
257
- main fieldset legend {
258
- font-size: 0.8em;
259
- color: var(--secondary-color);
260
- }
261
- main fieldset iframe {
262
- width: 100%;
263
- height: 360px;
264
- background: var(--code-block-background);
265
- border: none;
266
- overflow: hidden;
267
- }
268
253
 
269
254
  .pagenav {
270
255
  --icon-width: 1.25em;