@fluidframework/react 2.90.0-378676 → 2.91.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 (112) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -0
  3. package/api-report/react.alpha.api.md +8 -8
  4. package/lib/index.d.ts +2 -0
  5. package/lib/index.d.ts.map +1 -1
  6. package/lib/index.js +2 -0
  7. package/lib/index.js.map +1 -1
  8. package/lib/propNode.js.map +1 -1
  9. package/lib/reactSharedTreeView.d.ts +6 -6
  10. package/lib/reactSharedTreeView.d.ts.map +1 -1
  11. package/lib/reactSharedTreeView.js +16 -18
  12. package/lib/reactSharedTreeView.js.map +1 -1
  13. package/lib/test/mochaHooks.js +13 -0
  14. package/lib/test/mochaHooks.js.map +1 -0
  15. package/lib/test/reactSharedTreeView.spec.js +3 -3
  16. package/lib/test/reactSharedTreeView.spec.js.map +1 -1
  17. package/lib/test/text/plainUtils.test.js +75 -0
  18. package/lib/test/text/plainUtils.test.js.map +1 -0
  19. package/lib/test/text/textEditor.test.js +760 -0
  20. package/lib/test/text/textEditor.test.js.map +1 -0
  21. package/lib/test/undoRedo.test.js +62 -0
  22. package/lib/test/undoRedo.test.js.map +1 -0
  23. package/lib/test/useObservation.spec.js +8 -9
  24. package/lib/test/useObservation.spec.js.map +1 -1
  25. package/lib/test/useTree.spec.js +15 -16
  26. package/lib/test/useTree.spec.js.map +1 -1
  27. package/lib/text/formatted/index.d.ts +6 -0
  28. package/lib/text/formatted/index.d.ts.map +1 -0
  29. package/lib/text/formatted/index.js +6 -0
  30. package/lib/text/formatted/index.js.map +1 -0
  31. package/lib/text/formatted/quillFormattedView.d.ts +66 -0
  32. package/lib/text/formatted/quillFormattedView.d.ts.map +1 -0
  33. package/lib/text/formatted/quillFormattedView.js +520 -0
  34. package/lib/text/formatted/quillFormattedView.js.map +1 -0
  35. package/lib/text/index.d.ts +7 -0
  36. package/lib/text/index.d.ts.map +1 -0
  37. package/lib/text/index.js +7 -0
  38. package/lib/text/index.js.map +1 -0
  39. package/lib/text/plain/index.d.ts +7 -0
  40. package/lib/text/plain/index.d.ts.map +1 -0
  41. package/lib/text/plain/index.js +7 -0
  42. package/lib/text/plain/index.js.map +1 -0
  43. package/lib/text/plain/plainTextView.d.ts +14 -0
  44. package/lib/text/plain/plainTextView.d.ts.map +1 -0
  45. package/lib/text/plain/plainTextView.js +70 -0
  46. package/lib/text/plain/plainTextView.js.map +1 -0
  47. package/lib/text/plain/plainUtils.d.ts +23 -0
  48. package/lib/text/plain/plainUtils.d.ts.map +1 -0
  49. package/lib/text/plain/plainUtils.js +51 -0
  50. package/lib/text/plain/plainUtils.js.map +1 -0
  51. package/lib/text/plain/quillView.d.ts +22 -0
  52. package/lib/text/plain/quillView.d.ts.map +1 -0
  53. package/lib/text/plain/quillView.js +106 -0
  54. package/lib/text/plain/quillView.js.map +1 -0
  55. package/lib/undoRedo.d.ts +51 -0
  56. package/lib/undoRedo.d.ts.map +1 -0
  57. package/lib/undoRedo.js +76 -0
  58. package/lib/undoRedo.js.map +1 -0
  59. package/lib/useObservation.js +6 -6
  60. package/lib/useObservation.js.map +1 -1
  61. package/lib/useTree.d.ts +7 -7
  62. package/lib/useTree.d.ts.map +1 -1
  63. package/lib/useTree.js +6 -6
  64. package/lib/useTree.js.map +1 -1
  65. package/package.json +28 -46
  66. package/react.test-files.tar +0 -0
  67. package/src/index.ts +10 -0
  68. package/src/propNode.ts +1 -1
  69. package/src/reactSharedTreeView.tsx +11 -13
  70. package/src/text/formatted/index.ts +11 -0
  71. package/src/text/formatted/quillFormattedView.tsx +627 -0
  72. package/src/text/index.ts +15 -0
  73. package/src/text/plain/index.ts +7 -0
  74. package/src/text/plain/plainTextView.tsx +110 -0
  75. package/src/text/plain/plainUtils.ts +68 -0
  76. package/src/text/plain/quillView.tsx +149 -0
  77. package/src/undoRedo.ts +117 -0
  78. package/src/useObservation.ts +6 -6
  79. package/src/useTree.ts +19 -12
  80. package/tsconfig.json +6 -0
  81. package/api-extractor/api-extractor-lint-alpha.cjs.json +0 -5
  82. package/api-extractor/api-extractor-lint-beta.cjs.json +0 -5
  83. package/api-extractor/api-extractor-lint-public.cjs.json +0 -5
  84. package/dist/alpha.d.ts +0 -45
  85. package/dist/beta.d.ts +0 -15
  86. package/dist/index.d.ts +0 -16
  87. package/dist/index.d.ts.map +0 -1
  88. package/dist/index.js +0 -26
  89. package/dist/index.js.map +0 -1
  90. package/dist/package.json +0 -4
  91. package/dist/propNode.d.ts +0 -114
  92. package/dist/propNode.d.ts.map +0 -1
  93. package/dist/propNode.js +0 -43
  94. package/dist/propNode.js.map +0 -1
  95. package/dist/public.d.ts +0 -15
  96. package/dist/reactSharedTreeView.d.ts +0 -119
  97. package/dist/reactSharedTreeView.d.ts.map +0 -1
  98. package/dist/reactSharedTreeView.js +0 -206
  99. package/dist/reactSharedTreeView.js.map +0 -1
  100. package/dist/simpleIdentifier.d.ts +0 -19
  101. package/dist/simpleIdentifier.d.ts.map +0 -1
  102. package/dist/simpleIdentifier.js +0 -33
  103. package/dist/simpleIdentifier.js.map +0 -1
  104. package/dist/useObservation.d.ts +0 -83
  105. package/dist/useObservation.d.ts.map +0 -1
  106. package/dist/useObservation.js +0 -295
  107. package/dist/useObservation.js.map +0 -1
  108. package/dist/useTree.d.ts +0 -80
  109. package/dist/useTree.d.ts.map +0 -1
  110. package/dist/useTree.js +0 -137
  111. package/dist/useTree.js.map +0 -1
  112. package/tsconfig.cjs.json +0 -7
@@ -20,7 +20,7 @@ import type {
20
20
  InsertableTreeFieldFromImplicitField,
21
21
  } from "@fluidframework/tree";
22
22
  import { configuredSharedTree, FormatValidatorBasic } from "@fluidframework/tree/internal";
23
- import * as React from "react";
23
+ import { type FC, type JSX, useCallback, useEffect, useState } from "react";
24
24
 
25
25
  import { toPropTreeNode, type PropTreeValue } from "./propNode.js";
26
26
 
@@ -138,7 +138,7 @@ export interface IReactTreeDataObject<TSchema extends ImplicitFieldSchema> {
138
138
  * and thus making it a member avoids the user of this from having to explicitly provide the type parameter.
139
139
  * This is an arrow function not a method so it gets the correct this when not called as a member.
140
140
  */
141
- readonly TreeViewComponent: (props: TreeViewProps<TSchema>) => React.JSX.Element;
141
+ readonly TreeViewComponent: (props: TreeViewProps<TSchema>) => JSX.Element;
142
142
  }
143
143
 
144
144
  /**
@@ -149,7 +149,7 @@ export interface TreeViewProps<TSchema extends ImplicitFieldSchema> {
149
149
  /**
150
150
  * Component to display the tree content.
151
151
  */
152
- readonly viewComponent: React.FC<{
152
+ readonly viewComponent: FC<{
153
153
  root: PropTreeValue<TreeFieldFromImplicitField<TSchema>>;
154
154
  }>;
155
155
 
@@ -159,7 +159,7 @@ export interface TreeViewProps<TSchema extends ImplicitFieldSchema> {
159
159
  *
160
160
  * @defaultValue Component which describes the situation (in English) and allows the user to upgrade the schema to match the {@link @fluidframework/tree#TreeViewConfiguration} if possible.
161
161
  */
162
- readonly errorComponent?: React.FC<SchemaIncompatibleProps>;
162
+ readonly errorComponent?: FC<SchemaIncompatibleProps>;
163
163
 
164
164
  // TODO: Once its possible to query the status of individual schema upgrades, provide more options here for handling such cases.
165
165
  }
@@ -203,11 +203,11 @@ export abstract class ReactTreeDataObject<
203
203
  function useViewCompatibility<TSchema extends ImplicitFieldSchema>(
204
204
  view: TreeView<TSchema>,
205
205
  ): SchemaCompatibilityStatus {
206
- const [compatibility, setCompatibility] = React.useState<SchemaCompatibilityStatus>(
206
+ const [compatibility, setCompatibility] = useState<SchemaCompatibilityStatus>(
207
207
  view.compatibility,
208
208
  );
209
209
 
210
- React.useEffect(() => {
210
+ useEffect(() => {
211
211
  const updateCompatibility = (): void => {
212
212
  setCompatibility(view.compatibility);
213
213
  };
@@ -222,11 +222,9 @@ function useViewCompatibility<TSchema extends ImplicitFieldSchema>(
222
222
  function useViewRoot<TSchema extends ImplicitFieldSchema>(
223
223
  view: TreeView<TSchema>,
224
224
  ): TreeFieldFromImplicitField<TSchema> | undefined {
225
- const [root, setRoot] = React.useState<TreeFieldFromImplicitField<TSchema> | undefined>(
226
- undefined,
227
- );
225
+ const [root, setRoot] = useState<TreeFieldFromImplicitField<TSchema> | undefined>(undefined);
228
226
 
229
- React.useEffect(() => {
227
+ useEffect(() => {
230
228
  const updateRoot = (): void => {
231
229
  if (view.compatibility.canView) {
232
230
  setRoot(view.root);
@@ -253,12 +251,12 @@ export function TreeViewComponent<TSchema extends ImplicitFieldSchema>({
253
251
  errorComponent,
254
252
  }: TreeViewProps<TSchema> & {
255
253
  tree: Pick<IReactTreeDataObject<TSchema>, "treeView">;
256
- }): React.JSX.Element {
254
+ }): JSX.Element {
257
255
  const view = tree.treeView;
258
256
 
259
257
  const compatibility = useViewCompatibility(view);
260
258
  const root = useViewRoot(view);
261
- const upgradeSchema = React.useCallback((): void => view.upgradeSchema(), [view]);
259
+ const upgradeSchema = useCallback((): void => view.upgradeSchema(), [view]);
262
260
 
263
261
  // Note: this policy is on the stricter side and ensures that clients will only be able to submit edits when their view schema
264
262
  // supports exactly the same documents as the stored schema.
@@ -302,7 +300,7 @@ function TreeErrorComponent({
302
300
  }: {
303
301
  compatibility: SchemaCompatibilityStatus;
304
302
  upgradeSchema: () => void;
305
- }): React.JSX.Element {
303
+ }): JSX.Element {
306
304
  // eslint-disable-next-line unicorn/prefer-ternary
307
305
  if (compatibility.canUpgrade) {
308
306
  return (
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export {
7
+ FormattedTextAsTree,
8
+ FormattedMainView,
9
+ type FormattedMainViewProps,
10
+ type FormattedEditorHandle,
11
+ } from "./quillFormattedView.js";