@texonom/nreact 1.4.7 → 1.5.0

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 (131) hide show
  1. package/build/block.d.ts +20 -20
  2. package/build/components/asset-wrapper.d.ts +6 -6
  3. package/build/components/asset.d.ts +7 -7
  4. package/build/components/audio.d.ts +6 -6
  5. package/build/components/checkbox.d.ts +5 -5
  6. package/build/components/eoi.d.ts +7 -7
  7. package/build/components/file.d.ts +6 -6
  8. package/build/components/google-drive.d.ts +6 -6
  9. package/build/components/graceful-image.d.ts +3 -3
  10. package/build/components/header.d.ts +15 -15
  11. package/build/components/lazy-image.d.ts +13 -13
  12. package/build/components/lite-youtube-embed.d.ts +13 -13
  13. package/build/components/page-aside.d.ts +11 -11
  14. package/build/components/page-icon.d.ts +16 -16
  15. package/build/components/page-title.d.ts +12 -12
  16. package/build/components/search-dialog.d.ts +26 -26
  17. package/build/components/search-dialog.d.ts.map +1 -1
  18. package/build/components/sync-pointer-block.d.ts +6 -6
  19. package/build/components/text.d.ts +19 -19
  20. package/build/context.d.ts +64 -64
  21. package/build/context.d.ts.map +1 -1
  22. package/build/icons/check.d.ts +3 -3
  23. package/build/icons/chevron-down-icon.d.ts +2 -2
  24. package/build/icons/clear-icon.d.ts +2 -2
  25. package/build/icons/collection-view-board.d.ts +3 -3
  26. package/build/icons/collection-view-calendar.d.ts +3 -3
  27. package/build/icons/collection-view-gallery.d.ts +3 -3
  28. package/build/icons/collection-view-icon.d.ts +8 -8
  29. package/build/icons/collection-view-list.d.ts +3 -3
  30. package/build/icons/collection-view-table.d.ts +3 -3
  31. package/build/icons/copy.d.ts +3 -3
  32. package/build/icons/default-page-icon.d.ts +2 -2
  33. package/build/icons/empty-icon.d.ts +2 -2
  34. package/build/icons/file-icon.d.ts +2 -2
  35. package/build/icons/link-icon.d.ts +2 -2
  36. package/build/icons/loading-icon.d.ts +2 -2
  37. package/build/icons/property-icon.d.ts +44 -44
  38. package/build/icons/search-icon.d.ts +2 -2
  39. package/build/icons/type-checkbox.d.ts +3 -3
  40. package/build/icons/type-date.d.ts +3 -3
  41. package/build/icons/type-email.d.ts +3 -3
  42. package/build/icons/type-file.d.ts +3 -3
  43. package/build/icons/type-formula.d.ts +3 -3
  44. package/build/icons/type-github.d.ts +3 -3
  45. package/build/icons/type-multi-select.d.ts +3 -3
  46. package/build/icons/type-number.d.ts +3 -3
  47. package/build/icons/type-person-2.d.ts +3 -3
  48. package/build/icons/type-person.d.ts +3 -3
  49. package/build/icons/type-phone-number.d.ts +3 -3
  50. package/build/icons/type-relation.d.ts +3 -3
  51. package/build/icons/type-select.d.ts +3 -3
  52. package/build/icons/type-text.d.ts +3 -3
  53. package/build/icons/type-timestamp.d.ts +3 -3
  54. package/build/icons/type-title.d.ts +3 -3
  55. package/build/icons/type-url.d.ts +3 -3
  56. package/build/index.d.ts +24 -24
  57. package/build/index.js +1405 -675
  58. package/build/index.js.map +1 -0
  59. package/build/next.d.ts +1 -1
  60. package/build/renderer.d.ts +50 -50
  61. package/build/third-party/code.d.ts +7 -16
  62. package/build/third-party/collection-card.d.ts +3 -3
  63. package/build/third-party/collection-card.d.ts.map +1 -1
  64. package/build/third-party/collection-column-title.d.ts +5 -5
  65. package/build/third-party/collection-group.d.ts +3 -3
  66. package/build/third-party/collection-row.d.ts +7 -7
  67. package/build/third-party/collection-utils.d.ts +2 -2
  68. package/build/third-party/collection-view-board.d.ts +3 -3
  69. package/build/third-party/collection-view-gallery.d.ts +3 -3
  70. package/build/third-party/collection-view-list.d.ts +3 -3
  71. package/build/third-party/collection-view-table.d.ts +3 -3
  72. package/build/third-party/collection-view.d.ts +4 -4
  73. package/build/third-party/collection.d.ts +14 -14
  74. package/build/third-party/equation.d.ts +8 -8
  75. package/build/third-party/eval-formula.d.ts +20 -20
  76. package/build/third-party/modal.d.ts +2 -2
  77. package/build/third-party/pdf.d.ts +4 -4
  78. package/build/third-party/property.d.ts +21 -21
  79. package/build/types.d.ts +93 -93
  80. package/build/utils.d.ts +6 -6
  81. package/package.json +13 -13
  82. package/readme.md +59 -0
  83. package/LICENSE +0 -21
  84. package/README.md +0 -19
  85. package/build/.tsbuildinfo +0 -1
  86. package/build/chunk-2U7I3XVC.js +0 -157
  87. package/build/chunk-72RHNPWF.js +0 -1307
  88. package/build/chunk-C6BUIPAM.js +0 -83
  89. package/build/chunk-FCO7MUK6.js +0 -83
  90. package/build/chunk-H4QYS6CQ.js +0 -1185
  91. package/build/chunk-IMWLLIUB.js +0 -1182
  92. package/build/chunk-P7HX4BAT.js +0 -156
  93. package/build/chunk-VP33CFNB.js +0 -1358
  94. package/build/chunk-YMM43AZ3.js +0 -1207
  95. package/build/dev/chunk-64UJZ76E.js +0 -1308
  96. package/build/dev/chunk-64UJZ76E.js.map +0 -1
  97. package/build/dev/chunk-ABDRHJEI.js +0 -157
  98. package/build/dev/chunk-ABDRHJEI.js.map +0 -1
  99. package/build/dev/chunk-N6EDMIQD.js +0 -1359
  100. package/build/dev/chunk-N6EDMIQD.js.map +0 -1
  101. package/build/dev/chunk-OAIRL2FN.js +0 -84
  102. package/build/dev/chunk-OAIRL2FN.js.map +0 -1
  103. package/build/dev/chunk-P3V5A3W4.js +0 -1183
  104. package/build/dev/chunk-P3V5A3W4.js.map +0 -1
  105. package/build/dev/chunk-PM5CWL6O.js +0 -158
  106. package/build/dev/chunk-PM5CWL6O.js.map +0 -1
  107. package/build/dev/chunk-Q4G2SZRD.js +0 -84
  108. package/build/dev/chunk-Q4G2SZRD.js.map +0 -1
  109. package/build/dev/chunk-SEA7YL2O.js +0 -1308
  110. package/build/dev/chunk-SEA7YL2O.js.map +0 -1
  111. package/build/dev/chunk-SVHGWLRK.js +0 -1208
  112. package/build/dev/chunk-SVHGWLRK.js.map +0 -1
  113. package/build/dev/chunk-ZJAJPWJX.js +0 -1186
  114. package/build/dev/chunk-ZJAJPWJX.js.map +0 -1
  115. package/build/dev/index.js +0 -890
  116. package/build/dev/index.js.map +0 -1
  117. package/build/dev/third-party/code.js +0 -140
  118. package/build/dev/third-party/code.js.map +0 -1
  119. package/build/dev/third-party/collection.js +0 -4382
  120. package/build/dev/third-party/collection.js.map +0 -1
  121. package/build/dev/third-party/equation.js +0 -35
  122. package/build/dev/third-party/equation.js.map +0 -1
  123. package/build/dev/third-party/modal.js +0 -8
  124. package/build/dev/third-party/modal.js.map +0 -1
  125. package/build/dev/third-party/pdf.js +0 -21
  126. package/build/dev/third-party/pdf.js.map +0 -1
  127. package/build/third-party/code.js +0 -139
  128. package/build/third-party/collection.js +0 -4381
  129. package/build/third-party/equation.js +0 -34
  130. package/build/third-party/modal.js +0 -7
  131. package/build/third-party/pdf.js +0 -20
@@ -1,17 +1,8 @@
1
- import React from 'react';
2
- import { CodeBlock } from '@texonom/ntypes';
3
- import 'prismjs/components/prism-clike.min.js';
4
- import 'prismjs/components/prism-css-extras.min.js';
5
- import 'prismjs/components/prism-css.min.js';
6
- import 'prismjs/components/prism-javascript.min.js';
7
- import 'prismjs/components/prism-js-extras.min.js';
8
- import 'prismjs/components/prism-json.min.js';
9
- import 'prismjs/components/prism-jsx.min.js';
10
- import 'prismjs/components/prism-tsx.min.js';
11
- import 'prismjs/components/prism-typescript.min.js';
12
- export declare const Code: React.FC<{
13
- block: CodeBlock;
14
- defaultLanguage?: string;
15
- className?: string;
16
- }>;
1
+ import { default as React } from 'react';
2
+ import { CodeBlock } from '@texonom/ntypes';
3
+ export declare const Code: React.FC<{
4
+ block: CodeBlock;
5
+ defaultLanguage?: string;
6
+ className?: string;
7
+ }>;
17
8
  //# sourceMappingURL=code.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { CollectionCardProps } from '../types';
3
- export declare const CollectionCard: React.FC<CollectionCardProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionCardProps } from '../types';
3
+ export declare const CollectionCard: React.FC<CollectionCardProps>;
4
4
  //# sourceMappingURL=collection-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection-card.d.ts","sourceRoot":"","sources":["../../src/third-party/collection-card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG9C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkKxD,CAAA"}
1
+ {"version":3,"file":"collection-card.d.ts","sourceRoot":"","sources":["../../src/third-party/collection-card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG9C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuKxD,CAAA"}
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { CollectionPropertySchema } from '@texonom/ntypes';
3
- export declare const CollectionColumnTitle: React.FC<{
4
- schema: CollectionPropertySchema;
5
- }>;
1
+ import { default as React } from 'react';
2
+ import { CollectionPropertySchema } from '@texonom/ntypes';
3
+ export declare const CollectionColumnTitle: React.FC<{
4
+ schema: CollectionPropertySchema;
5
+ }>;
6
6
  //# sourceMappingURL=collection-column-title.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { CollectionGroupProps } from '../types';
3
- export declare const CollectionGroup: React.FC<CollectionGroupProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionGroupProps } from '../types';
3
+ export declare const CollectionGroup: React.FC<CollectionGroupProps>;
4
4
  //# sourceMappingURL=collection-group.d.ts.map
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { PageBlock } from '@texonom/ntypes';
3
- export declare const CollectionRow: React.FC<{
4
- block: PageBlock;
5
- pageHeader?: boolean;
6
- className?: string;
7
- }>;
1
+ import { default as React } from 'react';
2
+ import { PageBlock } from '@texonom/ntypes';
3
+ export declare const CollectionRow: React.FC<{
4
+ block: PageBlock;
5
+ pageHeader?: boolean;
6
+ className?: string;
7
+ }>;
8
8
  //# sourceMappingURL=collection-row.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { CollectionView, Collection } from '@texonom/ntypes';
2
- export declare function getCollectionGroups(collection: Collection, collectionView: CollectionView, collectionData: any, ...rest: any[]): any;
1
+ import { CollectionView, Collection } from '@texonom/ntypes';
2
+ export declare function getCollectionGroups(collection: Collection, collectionView: CollectionView, collectionData: any, ...rest: any[]): any;
3
3
  //# sourceMappingURL=collection-utils.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { CollectionViewProps } from '../types';
3
- export declare const CollectionViewBoard: React.FC<CollectionViewProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionViewProps } from '../types';
3
+ export declare const CollectionViewBoard: React.FC<CollectionViewProps>;
4
4
  //# sourceMappingURL=collection-view-board.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { CollectionViewProps } from '../types';
3
- export declare const CollectionViewGallery: React.FC<CollectionViewProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionViewProps } from '../types';
3
+ export declare const CollectionViewGallery: React.FC<CollectionViewProps>;
4
4
  //# sourceMappingURL=collection-view-gallery.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { CollectionViewProps } from '../types';
3
- export declare const CollectionViewList: React.FC<CollectionViewProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionViewProps } from '../types';
3
+ export declare const CollectionViewList: React.FC<CollectionViewProps>;
4
4
  //# sourceMappingURL=collection-view-list.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { CollectionViewProps } from '../types';
3
- export declare const CollectionViewTable: React.FC<CollectionViewProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionViewProps } from '../types';
3
+ export declare const CollectionViewTable: React.FC<CollectionViewProps>;
4
4
  //# sourceMappingURL=collection-view-table.d.ts.map
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { CollectionViewProps } from '../types';
3
- export declare const CollectionViewImpl: React.FC<CollectionViewProps>;
4
- export declare const CollectionView: React.NamedExoticComponent<CollectionViewProps>;
1
+ import { default as React } from 'react';
2
+ import { CollectionViewProps } from '../types';
3
+ export declare const CollectionViewImpl: React.FC<CollectionViewProps>;
4
+ export declare const CollectionView: React.NamedExoticComponent<CollectionViewProps>;
5
5
  //# sourceMappingURL=collection-view.d.ts.map
@@ -1,15 +1,15 @@
1
- import React from 'react';
2
- import { NotionContext } from '../context';
3
- import { PropertyImplMemo } from './property';
4
- import type { PageBlock, CollectionViewBlock, CollectionViewPageBlock } from '@texonom/ntypes';
5
- export declare const Collection: React.FC<{
6
- block: CollectionViewBlock | CollectionViewPageBlock | PageBlock;
7
- className?: string;
8
- ctx: NotionContext;
9
- }>;
10
- declare const CollectionViewBlock: React.FC<{
11
- block: CollectionViewBlock | CollectionViewPageBlock;
12
- className?: string;
13
- }>;
14
- export { PropertyImplMemo as Property };
1
+ import { default as React } from 'react';
2
+ import { NotionContext } from '../context';
3
+ import { PropertyImplMemo } from './property';
4
+ import { PageBlock, CollectionViewBlock, CollectionViewPageBlock } from '@texonom/ntypes';
5
+ export declare const Collection: React.FC<{
6
+ block: CollectionViewBlock | CollectionViewPageBlock | PageBlock;
7
+ className?: string;
8
+ ctx: NotionContext;
9
+ }>;
10
+ declare const CollectionViewBlock: React.FC<{
11
+ block: CollectionViewBlock | CollectionViewPageBlock;
12
+ className?: string;
13
+ }>;
14
+ export { PropertyImplMemo as Property };
15
15
  //# sourceMappingURL=collection.d.ts.map
@@ -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,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,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.0",
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/nutils": "^1.5.0",
32
+ "@texonom/ntypes": "^1.5.0"
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.