@brillout/docpress 0.3.12 → 0.3.13

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
@@ -128,11 +128,17 @@ type SponsorCompany = {
128
128
  companyLogo: string;
129
129
  website: string;
130
130
  plan: Plan;
131
+ divSize?: Partial<DivSize>;
131
132
  };
132
133
  type SponsorIndividual = {
133
134
  username: string;
134
135
  };
135
136
  type Sponsor = SponsorCompany | SponsorIndividual;
137
+ type DivSize = {
138
+ width: number;
139
+ height: number;
140
+ padding: number;
141
+ };
136
142
  declare function Sponsors(): JSX.Element;
137
143
 
138
144
  declare function CodeBlock({ children, lineBreak }: {
package/dist/index.js CHANGED
@@ -345,7 +345,10 @@ var companies = [
345
345
  companyName: "Optimizers",
346
346
  companyLogo: optimizers_default,
347
347
  plan: "bronze",
348
- website: "https://www.optimizers.nl/"
348
+ website: "https://www.optimizers.nl/",
349
+ divSize: {
350
+ padding: 20
351
+ }
349
352
  },
350
353
  {
351
354
  companyName: "My Favorite Quilt Store",
@@ -372,8 +375,8 @@ var sponsorsList = [...companies, ...individuals];
372
375
  function Sponsors() {
373
376
  const pageContext = usePageContext();
374
377
  const { projectInfo } = pageContext.config;
375
- const sponsorsCompany = sponsorsList.filter((sponsor) => !("username" in sponsor));
376
- const sponsorsHumanidual = sponsorsList.filter((sponsor) => "username" in sponsor);
378
+ const sponsorsCompanies = sponsorsList.filter(isCompany);
379
+ const sponsorsIndividuals = sponsorsList.filter(isIndividual);
377
380
  return /* @__PURE__ */ React8.createElement("div", {
378
381
  style: { textAlign: "center", marginTop: 19 }
379
382
  }, /* @__PURE__ */ React8.createElement("a", {
@@ -395,12 +398,12 @@ function Sponsors() {
395
398
  style: { maxWidth: 400, display: "inline-block", marginTop: 12, marginBottom: 12 }
396
399
  }, projectInfo.projectNameJsx || projectInfo.projectName, " is free and open source, made possible by wonderful sponsors."), /* @__PURE__ */ React8.createElement("div", {
397
400
  style: { display: "flex", flexWrap: "wrap", justifyContent: "space-evenly", alignItems: "end" }
398
- }, sponsorsCompany.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
401
+ }, sponsorsCompanies.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
399
402
  sponsor,
400
403
  key: i
401
404
  }))), /* @__PURE__ */ React8.createElement("div", {
402
- style: { display: "flex", flexWrap: "wrap", justifyContent: "center", alignItems: "end", marginTop: 20 }
403
- }, sponsorsHumanidual.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
405
+ style: { display: "flex", flexWrap: "wrap", justifyContent: "center", alignItems: "end", marginTop: 10 }
406
+ }, sponsorsIndividuals.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
404
407
  sponsor,
405
408
  key: i
406
409
  }))));
@@ -412,32 +415,37 @@ function SponsorDiv({ sponsor }) {
412
415
  let height;
413
416
  let website;
414
417
  let padding;
418
+ let marginHeight;
419
+ let marginWidth;
415
420
  let backgroundColor = "#f0f0f0";
416
421
  let label = null;
417
- if ("username" in sponsor) {
422
+ if (isIndividual(sponsor)) {
418
423
  website = `https://github.com/${sponsor.username}`;
419
424
  imgSrc = `https://github.com/${sponsor.username}.png?size=30`;
420
425
  width = 30;
421
426
  height = 30;
422
427
  padding = 0;
428
+ marginHeight = 10;
429
+ marginWidth = 5;
423
430
  backgroundColor = "none";
424
431
  } else {
425
432
  imgSrc = sponsor.companyLogo;
426
433
  website = sponsor.website;
427
- const size = getSize(sponsor.plan);
434
+ const size = getSize(sponsor);
428
435
  width = size.width;
429
436
  height = size.height;
430
437
  padding = size.padding;
431
438
  imgAlt = sponsor.companyName;
439
+ marginHeight = 20;
440
+ marginWidth = 10;
432
441
  label = /* @__PURE__ */ React8.createElement(Label, {
433
442
  sponsor
434
443
  });
435
444
  }
436
- const marginWidth = 5;
437
445
  return /* @__PURE__ */ React8.createElement("a", {
438
446
  href: website,
439
447
  style: {
440
- margin: `10px ${marginWidth}px`
448
+ margin: `${marginHeight}px ${marginWidth}px`
441
449
  }
442
450
  }, label, /* @__PURE__ */ React8.createElement("div", {
443
451
  style: {
@@ -459,7 +467,7 @@ function SponsorDiv({ sponsor }) {
459
467
  })));
460
468
  }
461
469
  function Label({ sponsor }) {
462
- assert(!("username" in sponsor));
470
+ assert(isCompany(sponsor));
463
471
  const labelBg = getLabelBg(sponsor);
464
472
  const labelIcon = getLabelIcon(sponsor);
465
473
  const labelText = getLabelText(sponsor);
@@ -527,27 +535,39 @@ function getLabelIcon(sponsor) {
527
535
  style: { height: 15, zIndex: 1, marginRight: 5 }
528
536
  });
529
537
  }
530
- function getSize(plan) {
538
+ function getSize(sponsor) {
539
+ const { plan } = sponsor;
540
+ let divSize;
531
541
  if (plan === "platinum") {
532
- return { width: 500, height: 180, padding: 100 };
542
+ divSize = { width: 500, height: 180, padding: 100 };
533
543
  }
534
544
  if (plan === "gold") {
535
- return { width: 400, height: 150, padding: 95 };
545
+ divSize = { width: 400, height: 150, padding: 95 };
536
546
  }
537
547
  if (plan === "silver") {
538
- return { width: 300, height: 100, padding: 45 };
548
+ divSize = { width: 300, height: 100, padding: 45 };
539
549
  }
540
550
  if (plan === "bronze") {
541
- return { width: 200, height: 70, padding: 30 };
551
+ divSize = { width: 200, height: 70, padding: 30 };
542
552
  }
543
553
  if (plan === "indie") {
544
- return { width: 140, height: 50, padding: 20 };
554
+ divSize = { width: 140, height: 50, padding: 20 };
555
+ }
556
+ assert(divSize);
557
+ if (sponsor.divSize) {
558
+ Object.assign(divSize, sponsor.divSize);
545
559
  }
546
- assert(false);
560
+ return divSize;
547
561
  }
548
562
  function capitalizeFirstLetter(word) {
549
563
  return word[0].toUpperCase() + word.slice(1);
550
564
  }
565
+ function isCompany(sponsor) {
566
+ return !isIndividual(sponsor);
567
+ }
568
+ function isIndividual(sponsor) {
569
+ return "username" in sponsor;
570
+ }
551
571
 
552
572
  // src/components/CodeBlock.tsx
553
573
  import React9 from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "scripts": {
5
5
  "// Check types while developing": "",
6
6
  "types": "tsc --noEmit --watch",