@fileverse-dev/ddoc 6.0.0-drop-in.3 → 6.0.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 (46) hide show
  1. package/README.md +18 -89
  2. package/dist/ddoc-persistence-C2ay3lLb.mjs +370 -0
  3. package/dist/headless-editor-utils.es.js +1 -1
  4. package/dist/{index-eP_xxZsk.mjs → index-D9uM5S2Y.mjs} +30 -30
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.es.js +12073 -12098
  7. package/dist/{markdown-source-pane-D-8OmL1r.mjs → markdown-source-pane-DWliRVLH.mjs} +287 -287
  8. package/dist/package/components/editor-toolbar.d.ts +1 -2
  9. package/dist/package/components/fullscreen-toolbar.d.ts +2 -2
  10. package/dist/package/components/mobile-toolbar.d.ts +1 -2
  11. package/dist/package/components/tabs/document-mobile-tab-panel.d.ts +1 -3
  12. package/dist/package/components/tabs/document-tabs-sidebar.d.ts +1 -2
  13. package/dist/package/components/toc/document-outline.d.ts +1 -1
  14. package/dist/package/components/toc/toc.d.ts +1 -1
  15. package/dist/package/components/toc/types.d.ts +0 -7
  16. package/dist/package/hooks/use-export-headless-editor-content.d.ts +6 -2
  17. package/dist/package/hooks/use-focus-mode.d.ts +3 -1
  18. package/dist/package/hooks/use-headless-editor.d.ts +12 -4
  19. package/dist/package/hooks/use-tab-editor.d.ts +1 -4
  20. package/dist/package/hooks/use-tab-manager.d.ts +3 -1
  21. package/dist/package/hooks/use-yjs-setup.d.ts +7 -1
  22. package/dist/package/persistence/compaction.d.ts +27 -0
  23. package/dist/package/persistence/content-fingerprint.d.ts +27 -0
  24. package/dist/package/persistence/ddoc-persistence.d.ts +96 -0
  25. package/dist/package/persistence/index.d.ts +2 -0
  26. package/dist/package/persistence/provider-lifecycle.d.ts +37 -0
  27. package/dist/package/sync-local/SyncManager.d.ts +8 -1
  28. package/dist/package/sync-local/types/index.d.ts +2 -0
  29. package/dist/package/types.d.ts +25 -43
  30. package/dist/package/use-ddoc-editor.d.ts +1 -3
  31. package/dist/package/utils/responsive.d.ts +1 -3
  32. package/dist/persistence.d.ts +1 -0
  33. package/dist/persistence.es.js +10 -0
  34. package/dist/{split-view-toolbar-NTimkQK1.mjs → split-view-toolbar-CbVFNI6B.mjs} +1 -1
  35. package/dist/style.css +1 -1
  36. package/dist/tab-utils-CAcIp-Dt.mjs +313 -0
  37. package/dist/{use-headless-editor-KdKS6vWp.mjs → use-headless-editor-C1g_Z67w.mjs} +11491 -11814
  38. package/package.json +7 -3
  39. package/tailwind.preset.cjs +0 -42
  40. package/dist/package/components/editor-navbar.d.ts +0 -12
  41. package/dist/package/hooks/use-canvas-metrics.d.ts +0 -16
  42. package/dist/package/hooks/use-controllable-state.d.ts +0 -3
  43. package/dist/package/hooks/use-editor-media-query.d.ts +0 -4
  44. package/dist/package/utils/container-query-support.d.ts +0 -1
  45. package/dist/package/utils/editor-width-store.d.ts +0 -6
  46. package/dist/package/utils/stats-publisher.d.ts +0 -8
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "6.0.0-drop-in.3",
5
+ "version": "6.0.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/fileverse/fileverse-ddocs.git"
@@ -18,6 +18,10 @@
18
18
  "import": "./dist/headless-editor-utils.es.js",
19
19
  "types": "./dist/headless-editor-utils.d.ts"
20
20
  },
21
+ "./persistence": {
22
+ "import": "./dist/persistence.es.js",
23
+ "types": "./dist/persistence.d.ts"
24
+ },
21
25
  "./styles": "./dist/style.css",
22
26
  "./types": "./dist/package/types.d.ts",
23
27
  "./tailwind": "./tailwind.preset.cjs"
@@ -131,7 +135,7 @@
131
135
  "vaul": "^0.9.1",
132
136
  "vite-plugin-dts": "^3.6.3",
133
137
  "ws": "^8.18.0",
134
- "y-indexeddb": "^9.0.12",
138
+ "y-indexeddb": "9.0.12",
135
139
  "y-prosemirror": "^1.2.5",
136
140
  "y-protocols": "^1.0.6",
137
141
  "zustand": "^5.0.12"
@@ -163,7 +167,6 @@
163
167
  "file-entry-cache": "6.0.1"
164
168
  },
165
169
  "devDependencies": {
166
- "fake-indexeddb": "^6.2.5",
167
170
  "@testing-library/jest-dom": "^6.4.0",
168
171
  "@testing-library/react": "^16.0.0",
169
172
  "@types/dompurify": "^3.0.5",
@@ -183,6 +186,7 @@
183
186
  "eslint-plugin-prettier": "^5.2.1",
184
187
  "eslint-plugin-react-hooks": "^4.6.0",
185
188
  "eslint-plugin-react-refresh": "^0.4.4",
189
+ "fake-indexeddb": "^6.2.5",
186
190
  "husky": "^9.1.7",
187
191
  "jsdom": "^25.0.0",
188
192
  "lint-staged": "^15.2.10",
@@ -1,16 +1,8 @@
1
1
  // This file is the `@fileverse-dev/ddoc/tailwind` preset. It composes the ui preset
2
2
  // (dark mode, theme, design-system classes) and adds the `mobile` screen.
3
- // It also adds the ddoc-* variants (docs/DROP_IN_EDITOR.md §2.9).
4
3
  // Consumers: `presets: [require('@fileverse-dev/ddoc/tailwind')]` and add
5
4
  // node_modules/@fileverse-dev/ddoc/dist/**/*.{js,mjs} plus
6
5
  // node_modules/@fileverse/ui/dist/**/*.{js,mjs} to `content` (the dist is chunked).
7
- const plugin = require('tailwindcss/plugin');
8
-
9
- // Same widths as the screens, evaluated against the editor root when the
10
- // element is inside one and against the window otherwise. :where() keeps the
11
- // window form at the specificity of a screen variant.
12
- const DDOC_BREAKPOINTS = { sm: 640, md: 768, mobile: 960, lg: 1024, xl: 1280 };
13
-
14
6
  module.exports = {
15
7
  presets: [require('@fileverse/ui/tailwind')],
16
8
  theme: {
@@ -20,38 +12,4 @@ module.exports = {
20
12
  },
21
13
  },
22
14
  },
23
- plugins: [
24
- plugin(({ addVariant, matchVariant }) => {
25
- const breakpoints = Object.entries(DDOC_BREAKPOINTS);
26
- // Registration order is CSS order. Like Tailwind's screens: max variants
27
- // first, widest first, so the narrower one wins; then min, ascending.
28
- for (const [name, px] of [...breakpoints].reverse()) {
29
- addVariant(`ddoc-max-${name}`, [
30
- `@container ddoc-editor (max-width: ${px - 0.02}px)`,
31
- `@media (max-width: ${px - 0.02}px) { &:where(:not(.ddoc-editor-cq *)) }`,
32
- ]);
33
- }
34
- for (const [name, px] of breakpoints) {
35
- addVariant(`ddoc-${name}`, [
36
- `@container ddoc-editor (min-width: ${px}px)`,
37
- `@media (min-width: ${px}px) { &:where(:not(.ddoc-editor-cq *)) }`,
38
- ]);
39
- }
40
- // One-off widths: ddoc-min-[1410px]: and ddoc-max-[1280px]: (inclusive).
41
- for (const bound of ['min', 'max']) {
42
- matchVariant(
43
- `ddoc-${bound}`,
44
- (value) => [
45
- `@container ddoc-editor (${bound}-width: ${value})`,
46
- `@media (${bound}-width: ${value}) { &:where(:not(.ddoc-editor-cq *)) }`,
47
- ],
48
- {
49
- sort: (a, z) =>
50
- (parseFloat(a.value) - parseFloat(z.value)) *
51
- (bound === 'min' ? 1 : -1),
52
- },
53
- );
54
- }
55
- }),
56
- ],
57
15
  };
@@ -1,12 +0,0 @@
1
- import { Editor } from '@tiptap/react';
2
- import { DdocProps } from '../types';
3
-
4
- type EditorNavbarProps = {
5
- editor: Editor | null;
6
- renderNavbar?: DdocProps['renderNavbar'];
7
- /** undefined: in flow. null: host element not attached yet, render nothing. */
8
- container?: HTMLElement | null;
9
- isHidden: boolean;
10
- };
11
- export declare const EditorNavbar: ({ editor, renderNavbar, container, isHidden, }: EditorNavbarProps) => import("react/jsx-runtime").JSX.Element | null;
12
- export {};
@@ -1,16 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { EditorWidthStore } from '../utils/editor-width-store';
3
-
4
- export declare const computeWidthDecisions: (width: number, scaledWidth: number, leftWidth: number) => {
5
- shouldHideRight: boolean;
6
- shouldScroll: boolean;
7
- };
8
- type WidthDecisions = ReturnType<typeof computeWidthDecisions>;
9
- export declare const useCanvasMetrics: ({ canvasRef, rootRef, scaledWidth, leftWidth, widthStore, }: {
10
- canvasRef: RefObject<HTMLElement | null>;
11
- rootRef: RefObject<HTMLElement | null>;
12
- scaledWidth: number;
13
- leftWidth: number;
14
- widthStore?: EditorWidthStore;
15
- }) => WidthDecisions;
16
- export {};
@@ -1,3 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
-
3
- export declare const useControllableState: <T>(value: T | undefined, defaultValue: T, onChange?: (next: T) => void, legacySetter?: (next: T) => void) => [T, Dispatch<SetStateAction<T>>];
@@ -1,4 +0,0 @@
1
- import { EditorWidthStore } from '../utils/editor-width-store';
2
-
3
- export declare const EditorWidthContext: import('react').Context<EditorWidthStore | null>;
4
- export declare const useEditorMediaQuery: (query: string, store?: EditorWidthStore) => boolean;
@@ -1 +0,0 @@
1
- export declare const canUseEditorContainerQueries: () => boolean;
@@ -1,6 +0,0 @@
1
- export type EditorWidthStore = {
2
- get(): number | null;
3
- set(width: number): void;
4
- subscribe(listener: () => void): () => void;
5
- };
6
- export declare const createEditorWidthStore: () => EditorWidthStore;
@@ -1,8 +0,0 @@
1
- import { DdocStats } from '../types';
2
-
3
- export declare const createStatsPublisher: (emit: (stats: DdocStats) => void) => {
4
- beginTab(pages: number | null): void;
5
- publish(patch: Partial<DdocStats>, options?: {
6
- tick?: boolean;
7
- }): void;
8
- };