@brillout/docpress 0.5.2 → 0.5.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.
package/dist/index.d.ts CHANGED
@@ -101,13 +101,9 @@ declare function RepoLink({ path, text, editMode }: {
101
101
 
102
102
  declare function P(props: React$1.HTMLProps<HTMLDivElement>): JSX.Element;
103
103
 
104
- declare function Info({ children }: {
105
- children: React$1.ReactNode;
106
- }): JSX.Element;
107
-
108
104
  declare function ReadingRecommendation({ tour, links }: {
109
105
  tour?: true;
110
- links: string[];
106
+ links?: string[];
111
107
  }): JSX.Element;
112
108
 
113
109
  declare function Warning({ children }: {
@@ -162,4 +158,4 @@ declare function CodeBlockTransformer({ children, lineBreak }: {
162
158
  lineBreak: LineBreak;
163
159
  }): JSX.Element;
164
160
 
165
- export { CodeBlockTransformer, Config, Construction, Danger, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Info, Link, NoteWithCustomIcon, NoteWithoutIcon, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, Warning, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
161
+ export { CodeBlockTransformer, Config, Construction, Danger, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Link, NoteWithCustomIcon, NoteWithoutIcon, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, Warning, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
package/dist/index.js CHANGED
@@ -139,78 +139,78 @@ function P(props) {
139
139
  });
140
140
  }
141
141
 
142
- // src/components/Info.tsx
143
- import React3 from "react";
144
- function Info({ children }) {
145
- return /* @__PURE__ */ React3.createElement("blockquote", null, /* @__PURE__ */ React3.createElement(P, null, children));
146
- }
147
-
148
142
  // src/components/ReadingRecommendation.tsx
149
- import React4 from "react";
143
+ import React3 from "react";
150
144
  function ReadingRecommendation({ tour, links }) {
145
+ links ?? (links = []);
146
+ if (!links.length)
147
+ tour = true;
151
148
  const multiple = links.length + (tour ? 1 : 0) > 1;
152
- return /* @__PURE__ */ React4.createElement(Info, null, multiple ? " " : "", /* @__PURE__ */ React4.createElement("b", null, "Reading Recommendation", multiple ? "." : ": "), (() => {
149
+ const intro = /* @__PURE__ */ React3.createElement("b", null, "Reading Recommendation", multiple ? "." : ": ");
150
+ return /* @__PURE__ */ React3.createElement("blockquote", null, (() => {
153
151
  if (!multiple) {
154
- const link = tour ? /* @__PURE__ */ React4.createElement(TourLink, null) : /* @__PURE__ */ React4.createElement(Link, {
152
+ const link = tour ? /* @__PURE__ */ React3.createElement(TourLink, null) : /* @__PURE__ */ React3.createElement(Link, {
155
153
  href: links[0]
156
154
  });
157
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, link, ".");
155
+ return /* @__PURE__ */ React3.createElement("p", null, intro, link);
158
156
  }
159
- return /* @__PURE__ */ React4.createElement("ul", {
157
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("p", null, " ", intro), /* @__PURE__ */ React3.createElement("ul", {
160
158
  style: {
161
159
  marginLeft: 18,
162
160
  marginTop: 11
163
161
  }
164
- }, tour && /* @__PURE__ */ React4.createElement("li", null, /* @__PURE__ */ React4.createElement(TourLink, null)), links.map((link, i) => /* @__PURE__ */ React4.createElement("li", {
162
+ }, tour && /* @__PURE__ */ React3.createElement("li", null, /* @__PURE__ */ React3.createElement(TourLink, null)), links.map((link, i) => /* @__PURE__ */ React3.createElement("li", {
165
163
  key: i
166
- }, /* @__PURE__ */ React4.createElement(Link, {
164
+ }, /* @__PURE__ */ React3.createElement(Link, {
167
165
  href: link
168
- }))));
166
+ })))));
169
167
  })());
170
168
  }
171
169
  function TourLink() {
172
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Link, {
170
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Link, {
173
171
  href: "/react-tour",
174
172
  noBreadcrumb: true
175
- }), " or ", /* @__PURE__ */ React4.createElement(Link, {
173
+ }), " or ", /* @__PURE__ */ React3.createElement(Link, {
176
174
  href: "/vue-tour",
177
175
  noBreadcrumb: true
178
176
  }));
179
177
  }
180
178
 
181
179
  // src/components/Note.tsx
182
- import React5 from "react";
180
+ import React4 from "react";
183
181
  function Warning({ children }) {
184
- return /* @__PURE__ */ React5.createElement(Note, {
182
+ return /* @__PURE__ */ React4.createElement(NoteGeneric, {
185
183
  type: "warning"
186
184
  }, children);
187
185
  }
188
186
  function Construction({ children }) {
189
- return /* @__PURE__ */ React5.createElement(Note, {
187
+ return /* @__PURE__ */ React4.createElement(NoteGeneric, {
190
188
  type: "construction"
191
189
  }, children);
192
190
  }
193
191
  function Danger({ children }) {
194
- return /* @__PURE__ */ React5.createElement(Note, {
192
+ return /* @__PURE__ */ React4.createElement(NoteGeneric, {
195
193
  type: "danger"
196
194
  }, children);
197
195
  }
198
196
  function NoteWithoutIcon({ children }) {
199
- return /* @__PURE__ */ React5.createElement(Note, {
197
+ return /* @__PURE__ */ React4.createElement(NoteGeneric, {
200
198
  icon: null
201
199
  }, children);
202
200
  }
203
201
  function NoteWithCustomIcon({ icon, children }) {
204
- return /* @__PURE__ */ React5.createElement(Note, {
202
+ if (!icon)
203
+ throw new Error(`<NoteWithCustomIcon icon={/*...*/}> property 'icon' is \`${icon}\` which is forbidden`);
204
+ return /* @__PURE__ */ React4.createElement(NoteGeneric, {
205
205
  icon
206
206
  }, children);
207
207
  }
208
- function Note({
208
+ function NoteGeneric({
209
209
  type,
210
210
  icon,
211
211
  children
212
212
  }) {
213
- assert(icon === null || icon || type);
213
+ assert(icon === null || icon || type, { icon, type });
214
214
  let className = "custom-icon";
215
215
  if (type) {
216
216
  className = `${className} type-${type}`;
@@ -233,33 +233,33 @@ function Note({
233
233
  assert(classColor);
234
234
  className = `${className} ${classColor}`;
235
235
  }
236
- return /* @__PURE__ */ React5.createElement("blockquote", {
236
+ return /* @__PURE__ */ React4.createElement("blockquote", {
237
237
  className
238
- }, /* @__PURE__ */ React5.createElement("div", {
238
+ }, /* @__PURE__ */ React4.createElement("div", {
239
239
  style: { marginBottom: 20 }
240
- }), icon, " ", /* @__PURE__ */ React5.createElement("div", {
240
+ }), icon, " ", /* @__PURE__ */ React4.createElement("div", {
241
241
  className: "blockquote-content"
242
- }, children), /* @__PURE__ */ React5.createElement("div", {
242
+ }, children), /* @__PURE__ */ React4.createElement("div", {
243
243
  style: { marginTop: 20 }
244
244
  }));
245
245
  }
246
246
 
247
247
  // src/components/ImportMeta.tsx
248
- import React6 from "react";
248
+ import React5 from "react";
249
249
  function ImportMeta({ prop }) {
250
250
  assert(!prop.startsWith("import"));
251
251
  assert(!prop.startsWith("."));
252
252
  const text = "import.meta." + prop;
253
- return /* @__PURE__ */ React6.createElement("code", null, text);
253
+ return /* @__PURE__ */ React5.createElement("code", null, text);
254
254
  }
255
255
 
256
256
  // src/components/HorizontalLine.tsx
257
- import React7 from "react";
257
+ import React6 from "react";
258
258
  function HorizontalLine({ primary }) {
259
- return /* @__PURE__ */ React7.createElement("div", {
259
+ return /* @__PURE__ */ React6.createElement("div", {
260
260
  className: "header-separator-line " + (primary ? "primary" : ""),
261
261
  style: { textAlign: "center" }
262
- }, /* @__PURE__ */ React7.createElement("hr", {
262
+ }, /* @__PURE__ */ React6.createElement("hr", {
263
263
  style: {
264
264
  display: "inline-block",
265
265
  margin: 0,
@@ -272,7 +272,7 @@ function HorizontalLine({ primary }) {
272
272
  }
273
273
 
274
274
  // src/components/Sponsors.tsx
275
- import React8 from "react";
275
+ import React7 from "react";
276
276
 
277
277
  // src/icons/heart.svg
278
278
  var heart_default = "/assets/heart-OINVKOXO.svg";
@@ -404,9 +404,9 @@ function Sponsors() {
404
404
  const { projectInfo } = pageContext.config;
405
405
  const sponsorsCompanies = sponsorsList.filter(isCompany);
406
406
  const sponsorsIndividuals = sponsorsList.filter(isIndividual);
407
- return /* @__PURE__ */ React8.createElement("div", {
407
+ return /* @__PURE__ */ React7.createElement("div", {
408
408
  style: { textAlign: "center", marginTop: 19 }
409
- }, /* @__PURE__ */ React8.createElement("a", {
409
+ }, /* @__PURE__ */ React7.createElement("a", {
410
410
  className: "button",
411
411
  href: "https://github.com/sponsors/brillout",
412
412
  style: {
@@ -416,19 +416,19 @@ function Sponsors() {
416
416
  padding: "5px 10px",
417
417
  marginBottom: 10
418
418
  }
419
- }, /* @__PURE__ */ React8.createElement("img", {
419
+ }, /* @__PURE__ */ React7.createElement("img", {
420
420
  src: heart_default,
421
421
  height: 22
422
- }), " ", /* @__PURE__ */ React8.createElement("span", {
422
+ }), " ", /* @__PURE__ */ React7.createElement("span", {
423
423
  style: { marginLeft: 7, fontSize: "1.07em" }
424
- }, "Sponsor")), /* @__PURE__ */ React8.createElement("div", null), /* @__PURE__ */ React8.createElement("div", {
424
+ }, "Sponsor")), /* @__PURE__ */ React7.createElement("div", null), /* @__PURE__ */ React7.createElement("div", {
425
425
  style: { maxWidth: 400, display: "inline-block", marginTop: 12, marginBottom: 12 }
426
- }, projectInfo.projectNameJsx || projectInfo.projectName, " is free and open source, made possible by wonderful sponsors."), /* @__PURE__ */ React8.createElement("div", {
426
+ }, projectInfo.projectNameJsx || projectInfo.projectName, " is free and open source, made possible by wonderful sponsors."), /* @__PURE__ */ React7.createElement("div", {
427
427
  style: { display: "flex", flexWrap: "wrap", justifyContent: "space-evenly", alignItems: "end" }
428
- }, sponsorsCompanies.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
428
+ }, sponsorsCompanies.map((sponsor, i) => /* @__PURE__ */ React7.createElement(SponsorDiv, {
429
429
  sponsor,
430
430
  key: i
431
- }))), /* @__PURE__ */ React8.createElement("div", {
431
+ }))), /* @__PURE__ */ React7.createElement("div", {
432
432
  style: {
433
433
  display: "flex",
434
434
  flexWrap: "wrap",
@@ -437,7 +437,7 @@ function Sponsors() {
437
437
  margin: "17px auto",
438
438
  maxWidth: 700
439
439
  }
440
- }, sponsorsIndividuals.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
440
+ }, sponsorsIndividuals.map((sponsor, i) => /* @__PURE__ */ React7.createElement(SponsorDiv, {
441
441
  sponsor,
442
442
  key: i
443
443
  }))));
@@ -472,16 +472,16 @@ function SponsorDiv({ sponsor }) {
472
472
  imgAlt = sponsor.companyName;
473
473
  marginHeight = 20;
474
474
  marginWidth = 10;
475
- label = /* @__PURE__ */ React8.createElement(Label, {
475
+ label = /* @__PURE__ */ React7.createElement(Label, {
476
476
  sponsor
477
477
  });
478
478
  }
479
- return /* @__PURE__ */ React8.createElement("a", {
479
+ return /* @__PURE__ */ React7.createElement("a", {
480
480
  href: website,
481
481
  style: {
482
482
  margin: `${marginHeight}px ${marginWidth}px`
483
483
  }
484
- }, label, /* @__PURE__ */ React8.createElement("div", {
484
+ }, label, /* @__PURE__ */ React7.createElement("div", {
485
485
  style: {
486
486
  backgroundColor,
487
487
  borderRadius: 7,
@@ -494,7 +494,7 @@ function SponsorDiv({ sponsor }) {
494
494
  flexDirection: "column",
495
495
  justifyContent: "center"
496
496
  }
497
- }, /* @__PURE__ */ React8.createElement("img", {
497
+ }, /* @__PURE__ */ React7.createElement("img", {
498
498
  style: { width: `calc(100% - ${padding}px)`, height: height - padding, zIndex: 2, objectFit: "contain" },
499
499
  src: imgSrc,
500
500
  alt: imgAlt
@@ -505,7 +505,7 @@ function Label({ sponsor }) {
505
505
  const labelBg = getLabelBg(sponsor);
506
506
  const labelIcon = getLabelIcon(sponsor);
507
507
  const labelText = getLabelText(sponsor);
508
- return /* @__PURE__ */ React8.createElement("div", {
508
+ return /* @__PURE__ */ React7.createElement("div", {
509
509
  style: {
510
510
  top: 0,
511
511
  display: "flex",
@@ -518,20 +518,20 @@ function Label({ sponsor }) {
518
518
  }
519
519
  function getLabelBg(sponsor) {
520
520
  const height = sponsor.plan === "platinum" ? 32 : 24;
521
- return /* @__PURE__ */ React8.createElement("img", {
521
+ return /* @__PURE__ */ React7.createElement("img", {
522
522
  src: label_default,
523
523
  style: { height, position: "absolute", bottom: 0, zIndex: -1 }
524
524
  });
525
525
  }
526
526
  function getLabelText(sponsor) {
527
527
  if (sponsor.plan === "platinum") {
528
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null);
528
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
529
529
  }
530
530
  let letterSpacing = void 0;
531
531
  if (["bronze", "silver", "gold", "indie"].includes(sponsor.plan)) {
532
532
  letterSpacing = 1;
533
533
  }
534
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, " ", /* @__PURE__ */ React8.createElement("span", {
534
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, " ", /* @__PURE__ */ React7.createElement("span", {
535
535
  style: {
536
536
  zIndex: 1,
537
537
  fontSize: "0.82em",
@@ -546,12 +546,12 @@ function getLabelText(sponsor) {
546
546
  function getLabelIcon(sponsor) {
547
547
  let medalSrc;
548
548
  if (sponsor.plan === "platinum") {
549
- return /* @__PURE__ */ React8.createElement(Emoji, {
549
+ return /* @__PURE__ */ React7.createElement(Emoji, {
550
550
  name: "trophy",
551
551
  style: { fontSize: "1.3em" }
552
552
  });
553
553
  } else if (sponsor.plan === "indie") {
554
- return /* @__PURE__ */ React8.createElement(Emoji, {
554
+ return /* @__PURE__ */ React7.createElement(Emoji, {
555
555
  name: "ribbon",
556
556
  style: { fontSize: "0.9em" }
557
557
  });
@@ -564,7 +564,7 @@ function getLabelIcon(sponsor) {
564
564
  } else {
565
565
  assert(false);
566
566
  }
567
- return /* @__PURE__ */ React8.createElement("img", {
567
+ return /* @__PURE__ */ React7.createElement("img", {
568
568
  src: medalSrc,
569
569
  style: { height: 15, zIndex: 1, marginRight: 5 }
570
570
  });
@@ -604,14 +604,14 @@ function isIndividual(sponsor) {
604
604
  }
605
605
 
606
606
  // src/components/CodeBlockTransformer.tsx
607
- import React9 from "react";
607
+ import React8 from "react";
608
608
  function CodeBlockTransformer({ children, lineBreak }) {
609
609
  assert(
610
610
  lineBreak === "white-space" || lineBreak === "break-word",
611
611
  "`lineBreak` is currently the only use case for <CodeBlockTransformer>"
612
612
  );
613
613
  const className = `with-line-break_${lineBreak}`;
614
- return /* @__PURE__ */ React9.createElement("div", {
614
+ return /* @__PURE__ */ React8.createElement("div", {
615
615
  className
616
616
  }, children);
617
617
  }
@@ -623,7 +623,6 @@ export {
623
623
  FeatureList,
624
624
  HorizontalLine,
625
625
  ImportMeta,
626
- Info,
627
626
  Link,
628
627
  NoteWithCustomIcon,
629
628
  NoteWithoutIcon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "scripts": {
5
5
  "// Check types while developing": "",
6
6
  "types": "tsc --noEmit --watch",