@brillout/docpress 0.2.1 → 0.2.3

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 (40) hide show
  1. package/dist/{chunk-TTLAZ2T2.js → chunk-3QC7HYIF.js} +0 -1
  2. package/dist/{chunk-G2A5MZJA.js → chunk-4G4ACGLN.js} +0 -1
  3. package/dist/{chunk-H5CO4N2X.js → chunk-D4PNWSRD.js} +8 -5
  4. package/dist/{chunk-7HKDCMSZ.js → chunk-MSIQIC6B.js} +4 -3
  5. package/dist/chunk-NVJING6T.js +91 -0
  6. package/dist/{chunk-XUTBTIEE.js → chunk-RZAPSH5Z.js} +20 -19
  7. package/dist/cli/index.js +5 -6
  8. package/dist/components/features/FeatureList.css +0 -1
  9. package/dist/components/features/FeatureList.js +2 -3
  10. package/dist/components/features/initFeatureList.js +2 -3
  11. package/dist/{devServer-534L4U45.js → devServer-UKWIENKN.js} +4 -5
  12. package/dist/index.css +0 -1
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.js +181 -134
  15. package/dist/languages-KXPKJFQL.svg +1 -0
  16. package/dist/renderer/_default.page.client.css +22 -4
  17. package/dist/renderer/_default.page.client.js +6 -6
  18. package/dist/renderer/_default.page.server.css +2 -4
  19. package/dist/renderer/_default.page.server.d.ts +1 -1
  20. package/dist/renderer/_default.page.server.js +249 -223
  21. package/dist/repora-UNKQZ6QP.svg +10 -0
  22. package/package.json +3 -3
  23. package/dist/chunk-7HKDCMSZ.js.map +0 -1
  24. package/dist/chunk-C3OIVLKV.js +0 -75
  25. package/dist/chunk-C3OIVLKV.js.map +0 -1
  26. package/dist/chunk-G2A5MZJA.js.map +0 -1
  27. package/dist/chunk-H5CO4N2X.js.map +0 -1
  28. package/dist/chunk-TTLAZ2T2.js.map +0 -1
  29. package/dist/chunk-XUTBTIEE.js.map +0 -1
  30. package/dist/cli/index.js.map +0 -1
  31. package/dist/components/features/FeatureList.css.map +0 -1
  32. package/dist/components/features/FeatureList.js.map +0 -1
  33. package/dist/components/features/initFeatureList.js.map +0 -1
  34. package/dist/devServer-534L4U45.js.map +0 -1
  35. package/dist/index.css.map +0 -1
  36. package/dist/index.js.map +0 -1
  37. package/dist/renderer/_default.page.client.css.map +0 -1
  38. package/dist/renderer/_default.page.client.js.map +0 -1
  39. package/dist/renderer/_default.page.server.css.map +0 -1
  40. package/dist/renderer/_default.page.server.js.map +0 -1
@@ -5,4 +5,3 @@ var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __f
5
5
  export {
6
6
  __template
7
7
  };
8
- //# sourceMappingURL=chunk-TTLAZ2T2.js.map
@@ -45,4 +45,3 @@ export {
45
45
  assertUsage,
46
46
  isBrowser
47
47
  };
48
- //# sourceMappingURL=chunk-G2A5MZJA.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Emoji
3
- } from "./chunk-7HKDCMSZ.js";
3
+ } from "./chunk-MSIQIC6B.js";
4
4
  import {
5
5
  assert
6
- } from "./chunk-G2A5MZJA.js";
6
+ } from "./chunk-4G4ACGLN.js";
7
7
 
8
8
  // src/components/RepoLink.tsx
9
9
  import React2 from "react";
@@ -15,7 +15,9 @@ function PageContextProvider({
15
15
  pageContext,
16
16
  children
17
17
  }) {
18
- return /* @__PURE__ */ React.createElement(Context.Provider, { value: pageContext }, children);
18
+ return /* @__PURE__ */ React.createElement(Context.Provider, {
19
+ value: pageContext
20
+ }, children);
19
21
  }
20
22
  function usePageContext() {
21
23
  const pageContext = useContext(Context);
@@ -37,7 +39,9 @@ function RepoLink({ path, text, editMode }) {
37
39
  const { githubRepository } = pageContext.config.projectInfo;
38
40
  assert(githubRepository.startsWith("https://github.com/"));
39
41
  const href = `${githubRepository}/${viewMode}/main${path}`;
40
- return /* @__PURE__ */ React2.createElement("a", { href }, text);
42
+ return /* @__PURE__ */ React2.createElement("a", {
43
+ href
44
+ }, text);
41
45
  }
42
46
 
43
47
  // src/headings.ts
@@ -171,4 +175,3 @@ export {
171
175
  getHeadings,
172
176
  parseTitle
173
177
  };
174
- //# sourceMappingURL=chunk-H5CO4N2X.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assert
3
- } from "./chunk-G2A5MZJA.js";
3
+ } from "./chunk-4G4ACGLN.js";
4
4
 
5
5
  // src/utils/filter.ts
6
6
  function filter(obj, predicate) {
@@ -15,7 +15,9 @@ function filter(obj, predicate) {
15
15
 
16
16
  // src/utils/determineSectionUrlHash.ts
17
17
  function determineSectionUrlHash(title) {
18
- const urlHash = title.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-");
18
+ const urlHash = title.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").split(/[^a-z0-9]+/).filter(Boolean).join("-");
19
+ if (urlHash === "")
20
+ return null;
19
21
  return urlHash;
20
22
  }
21
23
  function determineSectionTitle(urlWithHash, titleNormalCase) {
@@ -151,4 +153,3 @@ export {
151
153
  crawlAllFiles,
152
154
  Emoji
153
155
  };
154
- //# sourceMappingURL=chunk-7HKDCMSZ.js.map
@@ -0,0 +1,91 @@
1
+ // src/components/features/FeatureList.tsx
2
+ import React from "react";
3
+
4
+ // src/components/features/chevron.svg
5
+ var chevron_default = "/assets/chevron-R2IYJD62.svg";
6
+
7
+ // src/components/features/FeatureList.tsx
8
+ function FeatureList({ features }) {
9
+ const numberOfFeatures = features.length;
10
+ const numberOfRows = Math.ceil(numberOfFeatures / 2);
11
+ return /* @__PURE__ */ React.createElement("div", {
12
+ id: "features"
13
+ }, Array.from({ length: numberOfRows }, (_, i) => {
14
+ const feature1Id = 2 * i + 0;
15
+ const feature2Id = 2 * i + 1;
16
+ const feature1 = features[feature1Id];
17
+ const feature2 = features[feature2Id];
18
+ const className = ["features-row", feature2 ? "" : "single-column"].filter(Boolean).join(" ");
19
+ return /* @__PURE__ */ React.createElement("div", {
20
+ className,
21
+ key: i
22
+ }, /* @__PURE__ */ React.createElement(Feature, {
23
+ ...{ ...feature1, featureId: feature1Id }
24
+ }), feature2 && /* @__PURE__ */ React.createElement(Feature, {
25
+ ...{ ...feature2, featureId: feature2Id }
26
+ }));
27
+ }));
28
+ }
29
+ function Feature({ title, desc, learnMore, isSecondaryFeature, featureId }) {
30
+ const name = `feature-${featureId}`;
31
+ const rightSide = featureId % 2 === 1;
32
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FeatureHead, {
33
+ name,
34
+ hasLearnMore: !!learnMore,
35
+ isSecondaryFeature
36
+ }, " ", /* @__PURE__ */ React.createElement("h2", null, title), desc), !!learnMore && /* @__PURE__ */ React.createElement(LearnMore, {
37
+ name,
38
+ rightSide
39
+ }, learnMore));
40
+ }
41
+ function FeatureHead({
42
+ children,
43
+ name,
44
+ hasLearnMore,
45
+ isSecondaryFeature,
46
+ className = ""
47
+ }) {
48
+ return /* @__PURE__ */ React.createElement("summary", {
49
+ className: [
50
+ className,
51
+ "feature",
52
+ "colorize-on-hover",
53
+ hasLearnMore && "has-learn-more",
54
+ isSecondaryFeature && "secondary-feature"
55
+ ].filter(Boolean).join(" "),
56
+ id: name && `feature-${name}`,
57
+ style: { cursor: hasLearnMore && "pointer" || void 0 }
58
+ }, children, hasLearnMore && /* @__PURE__ */ React.createElement("div", {
59
+ style: { textAlign: "center", marginTop: "1em" }
60
+ }, /* @__PURE__ */ React.createElement("button", {
61
+ type: "button",
62
+ style: {
63
+ textAlign: "center",
64
+ padding: "0 7px",
65
+ paddingTop: 3,
66
+ paddingBottom: 1,
67
+ display: "inline-block",
68
+ fontSize: "10px",
69
+ textTransform: "uppercase",
70
+ letterSpacing: "1px",
71
+ fontWeight: 600
72
+ }
73
+ }, /* @__PURE__ */ React.createElement("span", {
74
+ className: "decolorize-5"
75
+ }, "Learn more"), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("img", {
76
+ className: "decolorize-4 chevron",
77
+ src: chevron_default,
78
+ height: "7",
79
+ style: { marginTop: 2 }
80
+ }))));
81
+ }
82
+ function LearnMore({ children, name, rightSide }) {
83
+ return /* @__PURE__ */ React.createElement("aside", {
84
+ className: "learn-more " + (rightSide ? "right-side" : ""),
85
+ id: `learn-more-${name}`
86
+ }, children);
87
+ }
88
+
89
+ export {
90
+ FeatureList
91
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  determineSectionUrlHash
3
- } from "./chunk-7HKDCMSZ.js";
3
+ } from "./chunk-MSIQIC6B.js";
4
4
  import {
5
5
  assert
6
- } from "./chunk-G2A5MZJA.js";
6
+ } from "./chunk-4G4ACGLN.js";
7
7
 
8
8
  // src/vite.config.ts
9
9
  import mdx from "@mdx-js/rollup";
@@ -36,13 +36,10 @@ function transform(code) {
36
36
  return line;
37
37
  }
38
38
  if (line.startsWith("#")) {
39
- const { id, headingLevel, title, headingHtml } = parseMarkdownHeading(line);
40
- headings.push({ id, headingLevel, title });
39
+ const { headingId, headingLevel, title, headingHtml } = parseMarkdownHeading(line);
40
+ headings.push({ headingId, headingLevel, title });
41
41
  return headingHtml;
42
42
  }
43
- if (line.startsWith("<h")) {
44
- assert(false, { line });
45
- }
46
43
  return line;
47
44
  }).join("\n");
48
45
  const headingsExportCode = `export const headings = [${headings.map((heading) => JSON.stringify(heading)).join(", ")}];`;
@@ -59,10 +56,13 @@ function parseMarkdownHeading(line) {
59
56
  const titleMdx = lineWords.join(" ");
60
57
  assert(!titleMdx.startsWith(" "), { line, lineWords });
61
58
  assert(titleMdx, { line, lineWords });
62
- const id = determineSectionUrlHash(titleMdx);
59
+ const headingId = determineSectionUrlHash(titleMdx);
63
60
  const title = titleMdx;
64
- const headingHtml = `<h${headingLevel} id="${id}">${parseTitle(title)}</h${headingLevel}>`;
65
- const heading = { headingLevel, title, id, headingHtml };
61
+ const titleParsed = parseTitle(title);
62
+ assert(headingId === null || headingId.length > 0);
63
+ const headingAttrId = headingId === null ? "" : ` id="${headingId}"`;
64
+ const headingHtml = `<h${headingLevel}${headingAttrId}>${titleParsed}</h${headingLevel}>`;
65
+ const heading = { headingLevel, title, headingId, headingHtml };
66
66
  return heading;
67
67
  }
68
68
  function parseTitle(titleMarkdown) {
@@ -121,14 +121,16 @@ var config = {
121
121
  prerender: {
122
122
  noExtraDir: true
123
123
  },
124
- extensions: [{
125
- npmPackageName: "@brillout/docpress",
126
- pageFilesDist: [
127
- "@brillout/docpress/renderer/_default.page.server.js",
128
- "@brillout/docpress/renderer/_default.page.client.js"
129
- ],
130
- assetsDir: "/dist/"
131
- }],
124
+ extensions: [
125
+ {
126
+ npmPackageName: "@brillout/docpress",
127
+ pageFilesDist: [
128
+ "@brillout/docpress/renderer/_default.page.server.js",
129
+ "@brillout/docpress/renderer/_default.page.client.js"
130
+ ],
131
+ assetsDir: "/dist/"
132
+ }
133
+ ],
132
134
  includeAssetsImportedByServer: true,
133
135
  disableAutoFullBuild: true
134
136
  })
@@ -144,4 +146,3 @@ var vite_config_default = config;
144
146
  export {
145
147
  vite_config_default
146
148
  };
147
- //# sourceMappingURL=chunk-XUTBTIEE.js.map
package/dist/cli/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  vite_config_default
3
- } from "../chunk-XUTBTIEE.js";
4
- import "../chunk-7HKDCMSZ.js";
5
- import "../chunk-G2A5MZJA.js";
6
- import "../chunk-TTLAZ2T2.js";
3
+ } from "../chunk-RZAPSH5Z.js";
4
+ import "../chunk-MSIQIC6B.js";
5
+ import "../chunk-4G4ACGLN.js";
6
+ import "../chunk-3QC7HYIF.js";
7
7
 
8
8
  // src/cli/index.ts
9
9
  import { build, preview } from "vite";
@@ -16,7 +16,7 @@ Error.stackTraceLimit = Infinity;
16
16
  cli();
17
17
  async function cli() {
18
18
  if (isDev) {
19
- await import("../devServer-534L4U45.js");
19
+ await import("../devServer-UKWIENKN.js");
20
20
  } else if (isBuild) {
21
21
  await build(vite_config_default);
22
22
  await build({ ...vite_config_default, build: { ssr: true } });
@@ -32,4 +32,3 @@ async function cli() {
32
32
  );
33
33
  }
34
34
  }
35
- //# sourceMappingURL=index.js.map
@@ -109,4 +109,3 @@ aside.learn-more.right-side {
109
109
  .feature.selected .chevron {
110
110
  transform: rotate(180deg);
111
111
  }
112
- /*# sourceMappingURL=FeatureList.css.map */
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  FeatureList
3
- } from "../../chunk-C3OIVLKV.js";
4
- import "../../chunk-TTLAZ2T2.js";
3
+ } from "../../chunk-NVJING6T.js";
4
+ import "../../chunk-3QC7HYIF.js";
5
5
  export {
6
6
  FeatureList
7
7
  };
8
- //# sourceMappingURL=FeatureList.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  assert
3
- } from "../../chunk-G2A5MZJA.js";
4
- import "../../chunk-TTLAZ2T2.js";
3
+ } from "../../chunk-4G4ACGLN.js";
4
+ import "../../chunk-3QC7HYIF.js";
5
5
 
6
6
  // src/components/features/initFeatureList.ts
7
7
  addTwitterWidgets();
@@ -57,4 +57,3 @@ function loadScript(scriptUrl) {
57
57
  function getComputedStyle(el, styleProp) {
58
58
  return window.document.defaultView.getComputedStyle(el).getPropertyValue(styleProp);
59
59
  }
60
- //# sourceMappingURL=initFeatureList.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  vite_config_default
3
- } from "./chunk-XUTBTIEE.js";
4
- import "./chunk-7HKDCMSZ.js";
5
- import "./chunk-G2A5MZJA.js";
6
- import "./chunk-TTLAZ2T2.js";
3
+ } from "./chunk-RZAPSH5Z.js";
4
+ import "./chunk-MSIQIC6B.js";
5
+ import "./chunk-4G4ACGLN.js";
6
+ import "./chunk-3QC7HYIF.js";
7
7
 
8
8
  // src/cli/devServer.ts
9
9
  import express from "express";
@@ -32,4 +32,3 @@ async function startServer() {
32
32
  app.listen(port);
33
33
  console.log(`Server running at http://localhost:${port}`);
34
34
  }
35
- //# sourceMappingURL=devServer-534L4U45.js.map
package/dist/index.css CHANGED
@@ -118,4 +118,3 @@ aside.learn-more.right-side {
118
118
  .feature.selected .chevron {
119
119
  transform: rotate(180deg);
120
120
  }
121
- /*# sourceMappingURL=index.css.map */
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ declare function isBrowser(): boolean;
8
8
 
9
9
  declare function filter<T extends object>(obj: T, predicate: <K extends keyof T>(value: T[K], key: K) => boolean): T;
10
10
 
11
- declare function determineSectionUrlHash(title: string): string;
11
+ declare function determineSectionUrlHash(title: string): string | null;
12
12
  declare function determineSectionTitle(urlWithHash: string, titleNormalCase: boolean): string;
13
13
 
14
14
  declare function jsxToTextContent(node: JSX.Element | string): string;
@@ -36,15 +36,15 @@ type HeadingDefinition = HeadingBase & (({
36
36
  level: 2;
37
37
  isListTitle?: true;
38
38
  sectionTitles?: string[];
39
- url: string;
39
+ url: null | string;
40
40
  } | {
41
41
  level: 3;
42
- url: string;
42
+ url: null | string;
43
43
  });
44
44
  type HeadingBase = {
45
45
  title: string;
46
46
  level: number;
47
- url?: string;
47
+ url?: null | string;
48
48
  titleDocument?: string;
49
49
  titleInNav?: string;
50
50
  };
@@ -79,6 +79,7 @@ type Config = {
79
79
  websiteUrl: string;
80
80
  bannerUrl?: string;
81
81
  twitterHandle: string;
82
+ i18n?: true;
82
83
  };
83
84
 
84
85
  declare function Link(props: {