@texonom/nreact 1.4.7 → 1.5.1

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 (141) hide show
  1. package/build/_commonjsHelpers-bAxELxBV.js +9 -0
  2. package/build/_commonjsHelpers-bAxELxBV.js.map +1 -0
  3. package/build/asset-wrapper-CmbIDPIw.js +921 -0
  4. package/build/asset-wrapper-CmbIDPIw.js.map +1 -0
  5. package/build/block.d.ts +20 -20
  6. package/build/collection-column-title-l4hmVo49.js +99 -0
  7. package/build/collection-column-title-l4hmVo49.js.map +1 -0
  8. package/build/components/asset-wrapper.d.ts +6 -6
  9. package/build/components/asset.d.ts +7 -7
  10. package/build/components/audio.d.ts +6 -6
  11. package/build/components/checkbox.d.ts +5 -5
  12. package/build/components/eoi.d.ts +7 -7
  13. package/build/components/file.d.ts +6 -6
  14. package/build/components/google-drive.d.ts +6 -6
  15. package/build/components/graceful-image.d.ts +3 -3
  16. package/build/components/header.d.ts +15 -15
  17. package/build/components/lazy-image.d.ts +13 -13
  18. package/build/components/lite-youtube-embed.d.ts +13 -13
  19. package/build/components/page-aside.d.ts +11 -11
  20. package/build/components/page-icon.d.ts +16 -16
  21. package/build/components/page-title.d.ts +12 -12
  22. package/build/components/search-dialog.d.ts +26 -26
  23. package/build/components/search-dialog.d.ts.map +1 -1
  24. package/build/components/sync-pointer-block.d.ts +6 -6
  25. package/build/components/text.d.ts +19 -19
  26. package/build/context.d.ts +64 -64
  27. package/build/context.d.ts.map +1 -1
  28. package/build/icons/check.d.ts +3 -3
  29. package/build/icons/chevron-down-icon.d.ts +2 -2
  30. package/build/icons/clear-icon.d.ts +2 -2
  31. package/build/icons/collection-view-board.d.ts +3 -3
  32. package/build/icons/collection-view-calendar.d.ts +3 -3
  33. package/build/icons/collection-view-gallery.d.ts +3 -3
  34. package/build/icons/collection-view-icon.d.ts +8 -8
  35. package/build/icons/collection-view-list.d.ts +3 -3
  36. package/build/icons/collection-view-table.d.ts +3 -3
  37. package/build/icons/copy.d.ts +3 -3
  38. package/build/icons/default-page-icon.d.ts +2 -2
  39. package/build/icons/empty-icon.d.ts +2 -2
  40. package/build/icons/file-icon.d.ts +2 -2
  41. package/build/icons/link-icon.d.ts +2 -2
  42. package/build/icons/loading-icon.d.ts +2 -2
  43. package/build/icons/property-icon.d.ts +44 -44
  44. package/build/icons/search-icon.d.ts +2 -2
  45. package/build/icons/type-checkbox.d.ts +3 -3
  46. package/build/icons/type-date.d.ts +3 -3
  47. package/build/icons/type-email.d.ts +3 -3
  48. package/build/icons/type-file.d.ts +3 -3
  49. package/build/icons/type-formula.d.ts +3 -3
  50. package/build/icons/type-github.d.ts +3 -3
  51. package/build/icons/type-multi-select.d.ts +3 -3
  52. package/build/icons/type-number.d.ts +3 -3
  53. package/build/icons/type-person-2.d.ts +3 -3
  54. package/build/icons/type-person.d.ts +3 -3
  55. package/build/icons/type-phone-number.d.ts +3 -3
  56. package/build/icons/type-relation.d.ts +3 -3
  57. package/build/icons/type-select.d.ts +3 -3
  58. package/build/icons/type-text.d.ts +3 -3
  59. package/build/icons/type-timestamp.d.ts +3 -3
  60. package/build/icons/type-title.d.ts +3 -3
  61. package/build/icons/type-url.d.ts +3 -3
  62. package/build/index.d.ts +24 -24
  63. package/build/index.js +478 -691
  64. package/build/index.js.map +1 -0
  65. package/build/next.d.ts +1 -1
  66. package/build/renderer.d.ts +50 -50
  67. package/build/third-party/code.d.ts +7 -16
  68. package/build/third-party/code.js +174 -114
  69. package/build/third-party/code.js.map +1 -0
  70. package/build/third-party/collection-card.d.ts +3 -3
  71. package/build/third-party/collection-card.d.ts.map +1 -1
  72. package/build/third-party/collection-column-title.d.ts +5 -5
  73. package/build/third-party/collection-group.d.ts +3 -3
  74. package/build/third-party/collection-row.d.ts +7 -7
  75. package/build/third-party/collection-utils.d.ts +2 -2
  76. package/build/third-party/collection-view-board.d.ts +3 -3
  77. package/build/third-party/collection-view-gallery.d.ts +3 -3
  78. package/build/third-party/collection-view-list.d.ts +3 -3
  79. package/build/third-party/collection-view-table.d.ts +3 -3
  80. package/build/third-party/collection-view.d.ts +4 -4
  81. package/build/third-party/collection.d.ts +14 -14
  82. package/build/third-party/collection.js +2295 -3321
  83. package/build/third-party/collection.js.map +1 -0
  84. package/build/third-party/equation.d.ts +8 -8
  85. package/build/third-party/equation.js +35 -25
  86. package/build/third-party/equation.js.map +1 -0
  87. package/build/third-party/eval-formula.d.ts +20 -20
  88. package/build/third-party/modal.d.ts +2 -2
  89. package/build/third-party/modal.js +3 -5
  90. package/build/third-party/modal.js.map +1 -0
  91. package/build/third-party/pdf.d.ts +4 -4
  92. package/build/third-party/property.d.ts +21 -21
  93. package/build/types.d.ts +93 -93
  94. package/build/utils.d.ts +6 -6
  95. package/package.json +13 -13
  96. package/readme.md +59 -0
  97. package/LICENSE +0 -21
  98. package/README.md +0 -19
  99. package/build/.tsbuildinfo +0 -1
  100. package/build/chunk-2U7I3XVC.js +0 -157
  101. package/build/chunk-72RHNPWF.js +0 -1307
  102. package/build/chunk-C6BUIPAM.js +0 -83
  103. package/build/chunk-FCO7MUK6.js +0 -83
  104. package/build/chunk-H4QYS6CQ.js +0 -1185
  105. package/build/chunk-IMWLLIUB.js +0 -1182
  106. package/build/chunk-P7HX4BAT.js +0 -156
  107. package/build/chunk-VP33CFNB.js +0 -1358
  108. package/build/chunk-YMM43AZ3.js +0 -1207
  109. package/build/dev/chunk-64UJZ76E.js +0 -1308
  110. package/build/dev/chunk-64UJZ76E.js.map +0 -1
  111. package/build/dev/chunk-ABDRHJEI.js +0 -157
  112. package/build/dev/chunk-ABDRHJEI.js.map +0 -1
  113. package/build/dev/chunk-N6EDMIQD.js +0 -1359
  114. package/build/dev/chunk-N6EDMIQD.js.map +0 -1
  115. package/build/dev/chunk-OAIRL2FN.js +0 -84
  116. package/build/dev/chunk-OAIRL2FN.js.map +0 -1
  117. package/build/dev/chunk-P3V5A3W4.js +0 -1183
  118. package/build/dev/chunk-P3V5A3W4.js.map +0 -1
  119. package/build/dev/chunk-PM5CWL6O.js +0 -158
  120. package/build/dev/chunk-PM5CWL6O.js.map +0 -1
  121. package/build/dev/chunk-Q4G2SZRD.js +0 -84
  122. package/build/dev/chunk-Q4G2SZRD.js.map +0 -1
  123. package/build/dev/chunk-SEA7YL2O.js +0 -1308
  124. package/build/dev/chunk-SEA7YL2O.js.map +0 -1
  125. package/build/dev/chunk-SVHGWLRK.js +0 -1208
  126. package/build/dev/chunk-SVHGWLRK.js.map +0 -1
  127. package/build/dev/chunk-ZJAJPWJX.js +0 -1186
  128. package/build/dev/chunk-ZJAJPWJX.js.map +0 -1
  129. package/build/dev/index.js +0 -890
  130. package/build/dev/index.js.map +0 -1
  131. package/build/dev/third-party/code.js +0 -140
  132. package/build/dev/third-party/code.js.map +0 -1
  133. package/build/dev/third-party/collection.js +0 -4382
  134. package/build/dev/third-party/collection.js.map +0 -1
  135. package/build/dev/third-party/equation.js +0 -35
  136. package/build/dev/third-party/equation.js.map +0 -1
  137. package/build/dev/third-party/modal.js +0 -8
  138. package/build/dev/third-party/modal.js.map +0 -1
  139. package/build/dev/third-party/pdf.js +0 -21
  140. package/build/dev/third-party/pdf.js.map +0 -1
  141. package/build/third-party/pdf.js +0 -20
@@ -1,9 +1,9 @@
1
- import React from 'react';
2
- import { EquationBlock } from '@texonom/ntypes';
3
- export declare const Equation: React.FC<{
4
- block: EquationBlock;
5
- math?: string;
6
- inline?: boolean;
7
- className?: string;
8
- }>;
1
+ import { default as React } from 'react';
2
+ import { EquationBlock } from '@texonom/ntypes';
3
+ export declare const Equation: React.FC<{
4
+ block: EquationBlock;
5
+ math?: string;
6
+ inline?: boolean;
7
+ className?: string;
8
+ }>;
9
9
  //# sourceMappingURL=equation.d.ts.map
@@ -1,34 +1,44 @@
1
- import {
2
- useNotionContext
3
- } from "../chunk-YMM43AZ3.js";
4
- import {
5
- __objRest,
6
- __spreadValues
7
- } from "../chunk-C6BUIPAM.js";
8
-
9
- // src/third-party/equation.tsx
10
- import React from "react";
11
- import Katex from "@matejmazur/react-katex";
12
- import { getBlockTitle } from "@texonom/nutils";
13
- var katexSettings = {
14
- throwOnError: false,
15
- strict: false
1
+ var x = Object.defineProperty;
2
+ var r = Object.getOwnPropertySymbols;
3
+ var s = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
4
+ var a = (o, t, e) => t in o ? x(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, c = (o, t) => {
5
+ for (var e in t || (t = {}))
6
+ s.call(t, e) && a(o, e, t[e]);
7
+ if (r)
8
+ for (var e of r(t))
9
+ l.call(t, e) && a(o, e, t[e]);
10
+ return o;
16
11
  };
17
- var Equation = (_a) => {
18
- var _b = _a, { block, math, inline = false, className } = _b, rest = __objRest(_b, ["block", "math", "inline", "className"]);
19
- const { recordMap } = useNotionContext();
20
- math = math || getBlockTitle(block, recordMap);
21
- if (!math) return null;
22
- return /* @__PURE__ */ React.createElement(
12
+ var u = (o, t) => {
13
+ var e = {};
14
+ for (var n in o)
15
+ s.call(o, n) && t.indexOf(n) < 0 && (e[n] = o[n]);
16
+ if (o != null && r)
17
+ for (var n of r(o))
18
+ t.indexOf(n) < 0 && l.call(o, n) && (e[n] = o[n]);
19
+ return e;
20
+ };
21
+ import f from "react";
22
+ import q from "@matejmazur/react-katex";
23
+ import { getBlockTitle as E } from "@texonom/nutils";
24
+ import { u as b } from "../asset-wrapper-CmbIDPIw.js";
25
+ const g = {
26
+ throwOnError: !1,
27
+ strict: !1
28
+ }, C = (k) => {
29
+ var i = k, { block: o, math: t, inline: e = !1, className: n } = i, m = u(i, ["block", "math", "inline", "className"]);
30
+ const { recordMap: p } = b();
31
+ return t = t || E(o, p), t ? /* @__PURE__ */ f.createElement(
23
32
  "span",
24
33
  {
25
34
  role: "button",
26
35
  tabIndex: 0,
27
- className: `notion-equation ${inline ? "notion-equation-inline" : "notion-equation-block"} ${className || ""}`
36
+ className: `notion-equation ${e ? "notion-equation-inline" : "notion-equation-block"} ${n || ""}`
28
37
  },
29
- /* @__PURE__ */ React.createElement(Katex, __spreadValues({ math, settings: katexSettings }, rest))
30
- );
38
+ /* @__PURE__ */ f.createElement(q, c({ math: t, settings: g }, m))
39
+ ) : null;
31
40
  };
32
41
  export {
33
- Equation
42
+ C as Equation
34
43
  };
44
+ //# sourceMappingURL=equation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equation.js","sources":["../../src/third-party/equation.tsx"],"sourcesContent":["import React from 'react'\n\nimport Katex from '@matejmazur/react-katex'\nimport { EquationBlock } from '@texonom/ntypes'\nimport { getBlockTitle } from '@texonom/nutils'\n\nimport { useNotionContext } from '../context'\n\nconst katexSettings = {\n throwOnError: false,\n strict: false\n}\n\nexport const Equation: React.FC<{\n block: EquationBlock\n math?: string\n inline?: boolean\n className?: string\n}> = ({ block, math, inline = false, className, ...rest }) => {\n const { recordMap } = useNotionContext()\n math = math || getBlockTitle(block, recordMap)\n if (!math) return null\n\n return (\n <span\n role='button'\n tabIndex={0}\n className={`notion-equation ${inline ? 'notion-equation-inline' : 'notion-equation-block'} ${className || ''}`}>\n <Katex math={math} settings={katexSettings} {...rest} />\n </span>\n )\n}\n"],"names":["katexSettings","Equation","_a","_b","block","math","inline","className","rest","__objRest","recordMap","useNotionContext","getBlockTitle","React","Katex","__spreadValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,IAAgB;AAAA,EACpB,cAAc;AAAA,EACd,QAAQ;AACV,GAEaC,IAKR,CAACC,MAAwD;AAAxD,MAAAC,IAAAD,GAAE,SAAAE,GAAO,MAAAC,GAAM,QAAAC,IAAS,IAAO,WAAAC,MAA/BJ,GAA6CK,IAAAC,EAA7CN,GAA6C,CAA3C,SAAO,QAAM,UAAgB;AACnC,QAAM,EAAE,WAAAO,EAAA,IAAcC,EAAA;AAEtB,SADAN,IAAOA,KAAQO,EAAcR,GAAOM,CAAS,GACxCL,IAGH,gBAAAQ,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW,mBAAmBP,IAAS,2BAA2B,uBAAuB,IAAIC,KAAa,EAAE;AAAA,IAAA;AAAA,oCAC3GO,GAAAC,EAAA,EAAM,MAAAV,GAAY,UAAUL,KAAmBQ,EAAM;AAAA,EAAA,IAPxC;AAUpB;"}
@@ -1,21 +1,21 @@
1
- import type { PropertyMap, CollectionPropertySchemaMap, Formula, FormulaResult } from '@texonom/ntypes';
2
- export interface EvalFormulaContext {
3
- properties: PropertyMap;
4
- schema: CollectionPropertySchemaMap;
5
- endDate?: boolean;
6
- }
7
- /**
8
- * Evaluates a Notion formula expression to a result value.
9
- *
10
- * All built-in functions and operators are supported.
11
- *
12
- * NOTE: this needs a lot more testing, especially around covering all the different
13
- * function types and coercing different property values correctly.
14
- *
15
- * It does work for many of our test cases, however.
16
- *
17
- * @param formula - Formula to evaluate.
18
- * @param context - Collection context containing property schema and values.
19
- */
20
- export declare function evalFormula(formula: Formula, context: EvalFormulaContext): FormulaResult;
1
+ import { PropertyMap, CollectionPropertySchemaMap, Formula, FormulaResult } from '@texonom/ntypes';
2
+ export interface EvalFormulaContext {
3
+ properties: PropertyMap;
4
+ schema: CollectionPropertySchemaMap;
5
+ endDate?: boolean;
6
+ }
7
+ /**
8
+ * Evaluates a Notion formula expression to a result value.
9
+ *
10
+ * All built-in functions and operators are supported.
11
+ *
12
+ * NOTE: this needs a lot more testing, especially around covering all the different
13
+ * function types and coercing different property values correctly.
14
+ *
15
+ * It does work for many of our test cases, however.
16
+ *
17
+ * @param formula - Formula to evaluate.
18
+ * @param context - Collection context containing property schema and values.
19
+ */
20
+ export declare function evalFormula(formula: Formula, context: EvalFormulaContext): FormulaResult;
21
21
  //# sourceMappingURL=eval-formula.d.ts.map
@@ -1,3 +1,3 @@
1
- import Modal from 'react-modal';
2
- export { Modal };
1
+ import { default as Modal } from 'react-modal';
2
+ export { Modal };
3
3
  //# sourceMappingURL=modal.d.ts.map
@@ -1,7 +1,5 @@
1
- import "../chunk-C6BUIPAM.js";
2
-
3
- // src/third-party/modal.tsx
4
- import Modal from "react-modal";
1
+ import { default as d } from "react-modal";
5
2
  export {
6
- Modal
3
+ d as Modal
7
4
  };
5
+ //# sourceMappingURL=modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- export declare const Pdf: React.FC<{
3
- file: string;
4
- }>;
1
+ import { default as React } from 'react';
2
+ export declare const Pdf: React.FC<{
3
+ file: string;
4
+ }>;
5
5
  //# sourceMappingURL=pdf.d.ts.map
@@ -1,22 +1,22 @@
1
- import React from 'react';
2
- import type { CollectionPropertySchema, Decoration, Block, Collection } from '@texonom/ntypes';
3
- export interface IPropertyProps {
4
- propertyId?: string;
5
- schema?: CollectionPropertySchema;
6
- data?: Decoration[];
7
- block?: Block;
8
- collection?: Collection;
9
- inline?: boolean;
10
- linkToTitlePage?: boolean;
11
- pageHeader?: boolean;
12
- }
13
- /**
14
- * Renders a single value of structured Notion data according to its schema.
15
- *
16
- * This corresponds to rendering the content of a single cell in a table.
17
- * Property rendering is re-used across all the different types of collection views.
18
- */
19
- export declare const Property: React.FC<IPropertyProps>;
20
- export declare const PropertyImpl: React.FC<IPropertyProps>;
21
- export declare const PropertyImplMemo: React.NamedExoticComponent<IPropertyProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionPropertySchema, Decoration, Block, Collection } from '@texonom/ntypes';
3
+ export interface IPropertyProps {
4
+ propertyId?: string;
5
+ schema?: CollectionPropertySchema;
6
+ data?: Decoration[];
7
+ block?: Block;
8
+ collection?: Collection;
9
+ inline?: boolean;
10
+ linkToTitlePage?: boolean;
11
+ pageHeader?: boolean;
12
+ }
13
+ /**
14
+ * Renders a single value of structured Notion data according to its schema.
15
+ *
16
+ * This corresponds to rendering the content of a single cell in a table.
17
+ * Property rendering is re-used across all the different types of collection views.
18
+ */
19
+ export declare const Property: React.FC<IPropertyProps>;
20
+ export declare const PropertyImpl: React.FC<IPropertyProps>;
21
+ export declare const PropertyImplMemo: React.NamedExoticComponent<IPropertyProps>;
22
22
  //# sourceMappingURL=property.d.ts.map
package/build/types.d.ts CHANGED
@@ -1,94 +1,94 @@
1
- import React from 'react';
2
- import type { ExtendedRecordMap, Block, SearchParams, SearchResults, CollectionView, CollectionQueryResult, PageBlock, CollectionCardCover, CollectionCardCoverSize, CollectionCardCoverAspect, PropertyID, Collection, CodeBlock } from '@texonom/ntypes';
3
- export type MapPageUrlFn = (pageId: string, recordMap?: ExtendedRecordMap | undefined) => string;
4
- export type MapImageUrlFn = (url: string, block: Block) => string;
5
- export type SearchNotionFn = (params: SearchParams) => Promise<SearchResults>;
6
- export type ComponentOverrideFn = (props: any, defaultValueFn: () => React.ReactNode) => any;
7
- export interface NotionComponents {
8
- Image: React.ComponentType<{
9
- [prop: string]: unknown;
10
- }>;
11
- Link: React.ComponentType<{
12
- [prop: string]: unknown;
13
- }>;
14
- PageLink: React.ComponentType<{
15
- [prop: string]: unknown;
16
- }>;
17
- Checkbox: React.FC<{
18
- isChecked: boolean;
19
- blockId: string;
20
- }>;
21
- Code: React.ComponentType<{
22
- block: CodeBlock;
23
- }>;
24
- Equation: any;
25
- Callout?: React.ComponentType<{
26
- [prop: string]: unknown;
27
- }>;
28
- Collection: any;
29
- Property?: React.ComponentType<{
30
- [prop: string]: unknown;
31
- }>;
32
- propertyTextValue: ComponentOverrideFn;
33
- propertySelectValue: ComponentOverrideFn;
34
- propertyRelationValue: ComponentOverrideFn;
35
- propertyFormulaValue: ComponentOverrideFn;
36
- propertyTitleValue: ComponentOverrideFn;
37
- propertyPersonValue: ComponentOverrideFn;
38
- propertyFileValue: ComponentOverrideFn;
39
- propertyCheckboxValue: ComponentOverrideFn;
40
- propertyUrlValue: ComponentOverrideFn;
41
- propertyEmailValue: ComponentOverrideFn;
42
- propertyPhoneNumberValue: ComponentOverrideFn;
43
- propertyNumberValue: ComponentOverrideFn;
44
- propertyLastEditedTimeValue: ComponentOverrideFn;
45
- propertyCreatedTimeValue: ComponentOverrideFn;
46
- propertyDateValue: ComponentOverrideFn;
47
- Pdf: React.ComponentType<{
48
- [prop: string]: unknown;
49
- }>;
50
- Tweet: React.ComponentType<{
51
- [prop: string]: unknown;
52
- }>;
53
- Modal: React.ComponentType<{
54
- [prop: string]: unknown;
55
- }>;
56
- Embed: React.ComponentType<{
57
- [prop: string]: unknown;
58
- }>;
59
- Header: React.ComponentType<{
60
- [prop: string]: unknown;
61
- }>;
62
- nextImage?: any;
63
- nextLink?: any;
64
- }
65
- export interface CollectionViewProps {
66
- collection: Collection;
67
- collectionView: CollectionView;
68
- collectionData: CollectionQueryResult;
69
- padding?: number;
70
- width?: number;
71
- }
72
- export interface CollectionCardProps {
73
- collection: Collection;
74
- block: PageBlock;
75
- cover: CollectionCardCover;
76
- coverSize: CollectionCardCoverSize;
77
- coverAspect: CollectionCardCoverAspect;
78
- properties?: Array<{
79
- property: PropertyID;
80
- visible: boolean;
81
- }>;
82
- className?: string;
83
- }
84
- export interface CollectionGroupProps {
85
- collection: Collection;
86
- collectionViewComponent: React.ElementType;
87
- collectionGroup: any;
88
- hidden: boolean;
89
- schema: any;
90
- value: any;
91
- summaryProps: any;
92
- detailsProps: any;
93
- }
1
+ import { default as React } from 'react';
2
+ import { ExtendedRecordMap, Block, SearchParams, SearchResults, CollectionView, CollectionQueryResult, PageBlock, CollectionCardCover, CollectionCardCoverSize, CollectionCardCoverAspect, PropertyID, Collection, CodeBlock } from '@texonom/ntypes';
3
+ export type MapPageUrlFn = (pageId: string, recordMap?: ExtendedRecordMap | undefined) => string;
4
+ export type MapImageUrlFn = (url: string, block: Block) => string;
5
+ export type SearchNotionFn = (params: SearchParams) => Promise<SearchResults>;
6
+ export type ComponentOverrideFn = (props: any, defaultValueFn: () => React.ReactNode) => any;
7
+ export interface NotionComponents {
8
+ Image: React.ComponentType<{
9
+ [prop: string]: unknown;
10
+ }>;
11
+ Link: React.ComponentType<{
12
+ [prop: string]: unknown;
13
+ }>;
14
+ PageLink: React.ComponentType<{
15
+ [prop: string]: unknown;
16
+ }>;
17
+ Checkbox: React.FC<{
18
+ isChecked: boolean;
19
+ blockId: string;
20
+ }>;
21
+ Code: React.ComponentType<{
22
+ block: CodeBlock;
23
+ }>;
24
+ Equation: any;
25
+ Callout?: React.ComponentType<{
26
+ [prop: string]: unknown;
27
+ }>;
28
+ Collection: any;
29
+ Property?: React.ComponentType<{
30
+ [prop: string]: unknown;
31
+ }>;
32
+ propertyTextValue: ComponentOverrideFn;
33
+ propertySelectValue: ComponentOverrideFn;
34
+ propertyRelationValue: ComponentOverrideFn;
35
+ propertyFormulaValue: ComponentOverrideFn;
36
+ propertyTitleValue: ComponentOverrideFn;
37
+ propertyPersonValue: ComponentOverrideFn;
38
+ propertyFileValue: ComponentOverrideFn;
39
+ propertyCheckboxValue: ComponentOverrideFn;
40
+ propertyUrlValue: ComponentOverrideFn;
41
+ propertyEmailValue: ComponentOverrideFn;
42
+ propertyPhoneNumberValue: ComponentOverrideFn;
43
+ propertyNumberValue: ComponentOverrideFn;
44
+ propertyLastEditedTimeValue: ComponentOverrideFn;
45
+ propertyCreatedTimeValue: ComponentOverrideFn;
46
+ propertyDateValue: ComponentOverrideFn;
47
+ Pdf: React.ComponentType<{
48
+ [prop: string]: unknown;
49
+ }>;
50
+ Tweet: React.ComponentType<{
51
+ [prop: string]: unknown;
52
+ }>;
53
+ Modal: React.ComponentType<{
54
+ [prop: string]: unknown;
55
+ }>;
56
+ Embed: React.ComponentType<{
57
+ [prop: string]: unknown;
58
+ }>;
59
+ Header: React.ComponentType<{
60
+ [prop: string]: unknown;
61
+ }>;
62
+ nextImage?: any;
63
+ nextLink?: any;
64
+ }
65
+ export interface CollectionViewProps {
66
+ collection: Collection;
67
+ collectionView: CollectionView;
68
+ collectionData: CollectionQueryResult;
69
+ padding?: number;
70
+ width?: number;
71
+ }
72
+ export interface CollectionCardProps {
73
+ collection: Collection;
74
+ block: PageBlock;
75
+ cover: CollectionCardCover;
76
+ coverSize: CollectionCardCoverSize;
77
+ coverAspect: CollectionCardCoverAspect;
78
+ properties?: Array<{
79
+ property: PropertyID;
80
+ visible: boolean;
81
+ }>;
82
+ className?: string;
83
+ }
84
+ export interface CollectionGroupProps {
85
+ collection: Collection;
86
+ collectionViewComponent: React.ElementType;
87
+ collectionGroup: any;
88
+ hidden: boolean;
89
+ schema: any;
90
+ value: any;
91
+ summaryProps: any;
92
+ detailsProps: any;
93
+ }
94
94
  //# sourceMappingURL=types.d.ts.map
package/build/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { BlockMap } from '@texonom/ntypes';
2
- export { isUrl, formatDate, formatNotionDateTime } from '@texonom/nutils';
3
- export declare const getListNumber: (blockId: string, blockMap: BlockMap) => number;
4
- export declare const getHashFragmentValue: (url: string) => string;
5
- export declare const isBrowser: boolean;
6
- export declare const getYoutubeId: (url: string) => string | null;
1
+ import { BlockMap } from '@texonom/ntypes';
2
+ export { isUrl, formatDate, formatNotionDateTime } from '@texonom/nutils';
3
+ export declare const getListNumber: (blockId: string, blockMap: BlockMap) => number;
4
+ export declare const getHashFragmentValue: (url: string) => string;
5
+ export declare const isBrowser: boolean;
6
+ export declare const getYoutubeId: (url: string) => string | null;
7
7
  //# sourceMappingURL=utils.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@texonom/nreact",
3
- "version": "1.4.7",
3
+ "version": "1.5.1",
4
4
  "type": "module",
5
5
  "description": "Fast and accurate React renderer for Notion.",
6
6
  "repository": "texonom/notion-node",
@@ -15,32 +15,32 @@
15
15
  "src/styles.css"
16
16
  ],
17
17
  "engines": {
18
- "node": ">=22.16.0"
18
+ "node": ">=22.22.0"
19
19
  },
20
20
  "dependencies": {
21
21
  "@fisch0920/medium-zoom": "^1.0.7",
22
22
  "@matejmazur/react-katex": "^3.1.3",
23
- "katex": "^0.16.22",
23
+ "katex": "^0.16.28",
24
24
  "prismjs": "^1.30.0",
25
25
  "react-fast-compare": "^3.2.2",
26
- "react-hotkeys-hook": "^5.1.0",
26
+ "react-hotkeys-hook": "^5.2.4",
27
27
  "react-image": "^4.1.0",
28
28
  "react-modal": "^3.16.3",
29
- "react-pdf": "^9.2.1",
29
+ "react-pdf": "^10.3.0",
30
30
  "react-use": "^17.6.0",
31
- "@texonom/ntypes": "^1.4.7",
32
- "@texonom/nutils": "^1.4.7"
31
+ "@texonom/ntypes": "^1.5.1",
32
+ "@texonom/nutils": "^1.5.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/lodash.throttle": "^4.1.9",
36
- "@types/node": "^22.15.30",
37
- "@types/react": "^19.1.6",
36
+ "@types/node": "^22.19.11",
37
+ "@types/react": "^19.2.14",
38
38
  "clipboard-copy": "^4.0.1",
39
39
  "date-fns": "^2.30.0",
40
40
  "format-number": "^3.0.0",
41
41
  "lodash.throttle": "^4.1.1",
42
- "react": "^19.1.0",
43
- "react-dom": "^19.1.0"
42
+ "react": "^19.2.4",
43
+ "react-dom": "^19.2.4"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=16",
@@ -53,8 +53,8 @@
53
53
  }
54
54
  },
55
55
  "scripts": {
56
- "build": "tsc && tsup",
57
- "watch": "tsup --watch --silent --onSuccess 'echo build successful'",
56
+ "build": "tsc && vite build",
57
+ "watch": "vite build --watch --mode development",
58
58
  "prerelease": "standard-version --skip.changelog --prerelease",
59
59
  "release": "standard-version --release-as",
60
60
  "pu": "pnpm publish"
package/readme.md ADDED
@@ -0,0 +1,59 @@
1
+ # React Notion X
2
+
3
+ Fast and accurate React renderer for Notion.
4
+
5
+ [![NPM](https://img.shields.io/npm/v/@texonom/nreact.svg)](https://www.npmjs.com/package/@texonom/nreact) [![Build Status](https://github.com/texonom/notion-node/actions/workflows/test.yml/badge.svg)](https://github.com/texonom/notion-node/actions/workflows/test.yml) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
6
+
7
+ ## Features
8
+
9
+ - Render pages from `@texonom/nclient` or `@texonom/ncompat` record maps
10
+ - Built-in search dialog and Table of Contents
11
+ - Lightweight components with sensible defaults
12
+
13
+ Use the renderer as a drop-in component or import pieces for your own UI.
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { NotionRenderer } from '@texonom/nreact'
19
+ ;<NotionRenderer recordMap={recordMap} fullPage />
20
+ ```
21
+
22
+ ```tsx
23
+ // customize links and image urls
24
+ <NotionRenderer
25
+ recordMap={recordMap}
26
+ fullPage
27
+ mapPageUrl={id => `/docs/${id}`}
28
+ mapImageUrl={url => `/api/image/${encodeURIComponent(url)}`}
29
+ components={{
30
+ nextLink: ({ href, children }) => <a href={href}>{children}</a>
31
+ }}
32
+ />
33
+ ```
34
+
35
+ ```tsx
36
+ // use a single component
37
+ import { Text } from '@texonom/nreact'
38
+
39
+ function Title({ value }) {
40
+ return <Text value={value} />
41
+ }
42
+ ```
43
+
44
+ ## API
45
+
46
+ Exports:
47
+
48
+ - `NotionRenderer`
49
+ - block components like `Text`, `Header`, `PageIcon`, `PageAside` and more
50
+ - helper hooks and context
51
+
52
+ ## Difference from the original
53
+
54
+ This fork keeps the renderer from React Notion X but integrates extra features such as backlink rendering and improved property display.
55
+
56
+ ## Source code
57
+
58
+ - `block.tsx` – block type switch
59
+ - `text.tsx` – decoration switch
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Seonglae Cho
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,19 +0,0 @@
1
- # React Notion X
2
-
3
- > Fast and accurate React renderer for Notion.
4
-
5
- [![NPM](https://img.shields.io/npm/v/@texonom/nreact.svg)](https://www.npmjs.com/package/@texonom/nreact) [![Build Status](https://github.com/texonom/notion-node/actions/workflows/test.yml/badge.svg)](https://github.com/texonom/notion-node/actions/workflows/test.yml) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
6
-
7
- ## Docs
8
-
9
- See the [full docs](https://github.com/texonom/notion-node).
10
-
11
- ## Source code
12
-
13
- ### `block.tsx`
14
-
15
- for block type switch case
16
-
17
- ### `text.tsx`
18
-
19
- for decoration switch case