@brillout/docpress 0.4.14 → 0.4.16

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
@@ -150,9 +150,10 @@ type DivSize = {
150
150
  };
151
151
  declare function Sponsors(): JSX.Element;
152
152
 
153
- declare function CodeBlock({ children, lineBreak }: {
153
+ type LineBreak = 'white-space' | 'break-word';
154
+ declare function CodeBlockTransformer({ children, lineBreak }: {
154
155
  children: any;
155
- lineBreak?: true;
156
+ lineBreak: LineBreak;
156
157
  }): JSX.Element;
157
158
 
158
- export { CodeBlock, Config, Construction, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, Warning, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
159
+ export { CodeBlockTransformer, Config, Construction, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, Warning, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
package/dist/index.js CHANGED
@@ -582,25 +582,20 @@ function isIndividual(sponsor) {
582
582
  return "username" in sponsor;
583
583
  }
584
584
 
585
- // src/components/CodeBlock.tsx
585
+ // src/components/CodeBlockTransformer.tsx
586
586
  import React9 from "react";
587
- function CodeBlock({ children, lineBreak }) {
588
- assert(lineBreak, "`lineBreak: true` is currently the only use case for <CodeBlock>");
589
- const style = {};
590
- if (lineBreak) {
591
- objectAssign(style, {
592
- wordWrap: "break-word",
593
- wordBreak: "break-all",
594
- whiteSpace: "initial",
595
- paddingRight: "16px !important"
596
- });
597
- }
598
- return /* @__PURE__ */ React9.createElement("pre", null, /* @__PURE__ */ React9.createElement("code", {
599
- style
600
- }, children));
587
+ function CodeBlockTransformer({ children, lineBreak }) {
588
+ assert(
589
+ lineBreak === "white-space" || lineBreak === "break-word",
590
+ "`lineBreak` is currently the only use case for <CodeBlockTransformer>"
591
+ );
592
+ const className = `with-line-break_${lineBreak}`;
593
+ return /* @__PURE__ */ React9.createElement("div", {
594
+ className
595
+ }, children);
601
596
  }
602
597
  export {
603
- CodeBlock,
598
+ CodeBlockTransformer,
604
599
  Construction,
605
600
  Emoji,
606
601
  FeatureList,
@@ -300,4 +300,15 @@ blockquote > div.paragraph:first-child::before {
300
300
  margin-right: 4px;
301
301
  }
302
302
 
303
+ /* src/components/CodeBlockTransformer.css */
304
+ .with-line-break_white-space code,
305
+ .with-line-break_break-word code {
306
+ white-space: break-spaces;
307
+ padding-right: 16px !important;
308
+ }
309
+ .with-line-break_break-word code {
310
+ word-wrap: break-word;
311
+ word-break: break-all;
312
+ }
313
+
303
314
  /* src/css/index.css */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.4.14",
3
+ "version": "0.4.16",
4
4
  "scripts": {
5
5
  "// Check types while developing": "",
6
6
  "types": "tsc --noEmit --watch",