@sutrata/editor 0.1.1 → 0.2.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.
- package/README.md +87 -0
- package/dist/ai/VoiceConfirmDialog.d.ts +1 -0
- package/dist/ai/VoiceConfirmDialog.js +6 -6
- package/dist/ai/VoiceToolbar.d.ts +1 -0
- package/dist/ai/VoiceToolbar.js +22 -16
- package/dist/ai/clean-response.d.ts +7 -0
- package/dist/ai/clean-response.js +58 -0
- package/dist/ai/format-transcript.d.ts +3 -0
- package/dist/ai/format-transcript.js +7 -0
- package/dist/ai/prompts.d.ts +8 -1
- package/dist/ai/prompts.js +34 -7
- package/dist/autocomplete/suggestions.js +1 -1
- package/dist/context/DocumentContext.d.ts +28 -4
- package/dist/context/DocumentContext.js +67 -37
- package/dist/editor/EditorView.js +32 -4
- package/dist/editor/SelectionMenu.js +5 -3
- package/dist/editor/external-decorations-plugin.d.ts +23 -0
- package/dist/editor/external-decorations-plugin.js +151 -0
- package/dist/editor/omitted-scene-plugin.d.ts +9 -0
- package/dist/editor/omitted-scene-plugin.js +44 -0
- package/dist/editor/plugins.js +4 -0
- package/dist/editor/private-metadata-plugin.d.ts +10 -0
- package/dist/editor/private-metadata-plugin.js +60 -0
- package/dist/editor/prosemirror-to-sutra.js +179 -74
- package/dist/editor/scene-heading-view.js +2 -0
- package/dist/editor/schema.js +69 -12
- package/dist/editor/sutra-to-prosemirror.d.ts +2 -0
- package/dist/editor/sutra-to-prosemirror.js +32 -34
- package/dist/extensions/ai-provider.d.ts +44 -0
- package/dist/extensions/ai-provider.js +27 -0
- package/dist/extensions/collab.d.ts +21 -0
- package/dist/extensions/collab.js +6 -0
- package/dist/extensions/command-registry.d.ts +49 -0
- package/dist/extensions/command-registry.js +28 -0
- package/dist/extensions/decorations.d.ts +48 -0
- package/dist/extensions/decorations.js +6 -0
- package/dist/extensions/export-registry.d.ts +59 -0
- package/dist/extensions/export-registry.js +10 -0
- package/dist/extensions/panel-registry.d.ts +30 -0
- package/dist/extensions/panel-registry.js +16 -0
- package/dist/extensions/registries.d.ts +15 -0
- package/dist/extensions/registries.js +12 -0
- package/dist/extensions/registry-store.d.ts +26 -0
- package/dist/extensions/registry-store.js +35 -0
- package/dist/extensions/session.d.ts +29 -0
- package/dist/extensions/session.js +20 -0
- package/dist/extensions/speech-provider.d.ts +35 -0
- package/dist/extensions/speech-provider.js +17 -0
- package/dist/file/builtin-exporters.d.ts +9 -0
- package/dist/file/builtin-exporters.js +72 -0
- package/dist/file/docx-exporter.js +7 -4
- package/dist/file/docx-importer.d.ts +9 -0
- package/dist/file/docx-importer.js +47 -19
- package/dist/file/scene-number.d.ts +5 -0
- package/dist/file/scene-number.js +8 -0
- package/dist/file/workflow-reports.js +13 -7
- package/dist/findreplace/FindReplace.js +5 -2
- package/dist/import/AIImportDialog.d.ts +11 -0
- package/dist/import/AIImportDialog.js +112 -0
- package/dist/import/ai-import.d.ts +51 -0
- package/dist/import/ai-import.js +200 -0
- package/dist/import/apply-import.d.ts +7 -0
- package/dist/import/apply-import.js +35 -0
- package/dist/import/extract.d.ts +17 -0
- package/dist/import/extract.js +18 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +7 -0
- package/dist/locales/bn.json +8 -0
- package/dist/locales/en.json +8 -0
- package/dist/locales/gu.json +8 -0
- package/dist/locales/hi.json +8 -0
- package/dist/locales/kn.json +8 -0
- package/dist/locales/ml.json +8 -0
- package/dist/locales/mr.json +8 -0
- package/dist/locales/or.json +8 -0
- package/dist/locales/pa.json +8 -0
- package/dist/locales/si.json +8 -0
- package/dist/locales/ta.json +8 -0
- package/dist/locales/te.json +8 -0
- package/dist/navigator/SceneNavigator.js +125 -131
- package/dist/navigator/StatisticsDialog.js +5 -1
- package/dist/navigator/scene-edits.d.ts +18 -0
- package/dist/navigator/scene-edits.js +143 -0
- package/dist/navigator/scene-list.js +4 -4
- package/dist/navigator/scene-numbering.d.ts +37 -0
- package/dist/navigator/scene-numbering.js +88 -0
- package/dist/settings/SettingsDialog.js +8 -120
- package/dist/shell/AppBar.js +21 -2
- package/dist/shell/AppShell.js +18 -4
- package/dist/shell/ElementToolbar.d.ts +5 -0
- package/dist/shell/ElementToolbar.js +35 -25
- package/dist/shell/LanguageStatus.js +6 -0
- package/dist/shell/StatusBar.js +11 -6
- package/dist/shell/builtin-commands.d.ts +10 -0
- package/dist/shell/builtin-commands.js +43 -0
- package/dist/shell/icons.d.ts +6 -0
- package/dist/shell/icons.js +6 -0
- package/dist/shell/use-commands.d.ts +7 -0
- package/dist/shell/use-commands.js +24 -0
- package/dist/shell/use-panel-context.d.ts +3 -0
- package/dist/shell/use-panel-context.js +39 -0
- package/dist/source/SourceView.js +18 -1
- package/dist/styles/screenplay.css +113 -1
- package/dist/titlepage/ExportDialog.d.ts +5 -0
- package/dist/titlepage/ExportDialog.js +59 -96
- package/package.json +32 -5
- package/dist/ai/OnboardingDialog.d.ts +0 -6
- package/dist/ai/OnboardingDialog.js +0 -115
- package/dist/ai/ai-client.d.ts +0 -71
- package/dist/ai/ai-client.js +0 -494
- package/dist/ai/generated-providers.json +0 -3696
- package/dist/ai/voice-service.d.ts +0 -15
- package/dist/ai/voice-service.js +0 -81
- package/dist/editor/character-view.d.ts +0 -35
- package/dist/editor/character-view.js +0 -112
- package/dist/editor/transliterate-input.d.ts +0 -10
- package/dist/editor/transliterate-input.js +0 -88
- package/dist/extensions/types.d.ts +0 -73
- package/dist/extensions/types.js +0 -12
- package/scripts/copy-assets.mjs +0 -16
- package/scripts/generate-providers.mjs +0 -127
- package/src/ai/OnboardingDialog.tsx +0 -390
- package/src/ai/VoiceConfirmDialog.tsx +0 -137
- package/src/ai/VoiceToolbar.tsx +0 -321
- package/src/ai/ai-client.ts +0 -596
- package/src/ai/commands.ts +0 -164
- package/src/ai/generated-providers.json +0 -3696
- package/src/ai/prompts.ts +0 -62
- package/src/ai/voice-service.ts +0 -96
- package/src/autocomplete/AutocompletePlugin.ts +0 -21
- package/src/autocomplete/suggestions.ts +0 -147
- package/src/context/DocumentContext.tsx +0 -648
- package/src/desktop-api.d.ts +0 -40
- package/src/editor/EditorView.tsx +0 -82
- package/src/editor/SelectionMenu.tsx +0 -152
- package/src/editor/attr-pencil-plugin.ts +0 -172
- package/src/editor/character-decoration-plugin.ts +0 -104
- package/src/editor/editor-bus.ts +0 -51
- package/src/editor/find-highlight-plugin.ts +0 -68
- package/src/editor/frontmatter-field-view.ts +0 -52
- package/src/editor/frontmatter-field.ts +0 -115
- package/src/editor/grapheme-cursor.ts +0 -99
- package/src/editor/ime-plugin.ts +0 -85
- package/src/editor/insert-helper.ts +0 -43
- package/src/editor/keymap.ts +0 -124
- package/src/editor/language-class-plugin.ts +0 -91
- package/src/editor/plugins.ts +0 -26
- package/src/editor/prosemirror-to-sutra.ts +0 -192
- package/src/editor/scene-heading-view.ts +0 -147
- package/src/editor/schema.ts +0 -156
- package/src/editor/sutra-to-prosemirror.ts +0 -156
- package/src/extensions/storage-adapter.ts +0 -65
- package/src/extensions/types.ts +0 -60
- package/src/file/docx-exporter.ts +0 -585
- package/src/file/docx-importer.ts +0 -313
- package/src/file/print-paginator.ts +0 -301
- package/src/file/templates.ts +0 -73
- package/src/file/workflow-reports.ts +0 -820
- package/src/findreplace/FindReplace.tsx +0 -242
- package/src/findreplace/find-engine.ts +0 -97
- package/src/findreplace/scroll-to-match.ts +0 -89
- package/src/fonts/tofu-detect.ts +0 -53
- package/src/i18n/LanguageContext.tsx +0 -207
- package/src/i18n/language-detect.ts +0 -73
- package/src/i18n/useTranslation.tsx +0 -74
- package/src/index.ts +0 -27
- package/src/locales/bn.json +0 -143
- package/src/locales/en.json +0 -143
- package/src/locales/gu.json +0 -143
- package/src/locales/hi.json +0 -143
- package/src/locales/kn.json +0 -143
- package/src/locales/ml.json +0 -143
- package/src/locales/mr.json +0 -143
- package/src/locales/or.json +0 -143
- package/src/locales/pa.json +0 -143
- package/src/locales/si.json +0 -143
- package/src/locales/ta.json +0 -143
- package/src/locales/te.json +0 -143
- package/src/navigator/SceneNavigator.tsx +0 -844
- package/src/navigator/StatisticsDialog.tsx +0 -249
- package/src/navigator/scene-list.ts +0 -84
- package/src/settings/SettingsDialog.tsx +0 -303
- package/src/shell/AppBar.tsx +0 -354
- package/src/shell/AppShell.tsx +0 -71
- package/src/shell/ConfirmDialog.tsx +0 -71
- package/src/shell/ElementToolbar.tsx +0 -175
- package/src/shell/LanguageStatus.tsx +0 -101
- package/src/shell/StatusBar.tsx +0 -135
- package/src/shell/SutrataLogo.tsx +0 -89
- package/src/shell/Toast.tsx +0 -46
- package/src/shell/ToolbarButton.tsx +0 -30
- package/src/shell/VersionHistory.tsx +0 -212
- package/src/shell/Watermark.tsx +0 -9
- package/src/shell/fonts/fonts.css +0 -1133
- package/src/shell/icons.tsx +0 -335
- package/src/shell/toolbar-actions.ts +0 -59
- package/src/source/SourceView.tsx +0 -111
- package/src/source/find-highlight-source.ts +0 -57
- package/src/source/sutra-lang.ts +0 -121
- package/src/spellcheck/dictionaries.ts +0 -21
- package/src/spellcheck/hunspell.ts +0 -110
- package/src/spellcheck/spellcheck-plugin.ts +0 -83
- package/src/styles/StyleDialog.tsx +0 -148
- package/src/styles/builtin-styles.ts +0 -139
- package/src/styles/css-adapter.ts +0 -76
- package/src/styles/docx-adapter.ts +0 -109
- package/src/styles/embed-fonts.ts +0 -81
- package/src/styles/pagination.ts +0 -27
- package/src/styles/print-adapter.ts +0 -288
- package/src/styles/registry.ts +0 -20
- package/src/styles/screenplay.css +0 -3006
- package/src/styles/script-ranges.ts +0 -17
- package/src/styles/types.ts +0 -104
- package/src/styles/validate.ts +0 -114
- package/src/templates/templates.ts +0 -194
- package/src/titlepage/ExportDialog.tsx +0 -494
- package/src/titlepage/TitlePageDialog.tsx +0 -312
- package/src/titlepage/frontmatter-form.ts +0 -280
- package/src/titlepage/languages.ts +0 -37
- package/src/types.ts +0 -7
- package/tests/AppBar.test.tsx +0 -35
- package/tests/AppShell.test.tsx +0 -22
- package/tests/ElementToolbar.test.tsx +0 -36
- package/tests/LanguageStatus.test.tsx +0 -129
- package/tests/SelectionMenu.test.tsx +0 -71
- package/tests/ToolbarButton.test.tsx +0 -24
- package/tests/ai-onboarding.test.ts +0 -102
- package/tests/ai-status.test.tsx +0 -72
- package/tests/ai-structured.test.ts +0 -94
- package/tests/autocomplete/AutocompletePlugin.test.ts +0 -20
- package/tests/autocomplete/suggestions.test.ts +0 -106
- package/tests/document-context.test.tsx +0 -565
- package/tests/docx-importer.test.ts +0 -160
- package/tests/editor/character-decoration-plugin.test.ts +0 -101
- package/tests/editor/character-extension.test.ts +0 -44
- package/tests/editor/grapheme-cursor.test.ts +0 -118
- package/tests/editor/ime-plugin.test.ts +0 -72
- package/tests/editor/inline-note-bridge.test.ts +0 -32
- package/tests/editor/language-class-plugin.test.ts +0 -265
- package/tests/editor/title-page.test.ts +0 -124
- package/tests/embed-fonts.test.ts +0 -17
- package/tests/exporters.test.ts +0 -365
- package/tests/findreplace/FindReplace.test.tsx +0 -391
- package/tests/findreplace/find-engine.test.ts +0 -86
- package/tests/findreplace/scroll-to-match.test.ts +0 -50
- package/tests/fonts/tofu-detect.test.ts +0 -122
- package/tests/i18n/LanguageContext.test.tsx +0 -146
- package/tests/i18n/language-detect.test.ts +0 -54
- package/tests/i18n/locale-parity.test.ts +0 -25
- package/tests/i18n/useTranslation.test.tsx +0 -45
- package/tests/keymap.test.ts +0 -18
- package/tests/navigator/SceneNavigator.test.tsx +0 -177
- package/tests/navigator/StatisticsDialog.test.tsx +0 -63
- package/tests/navigator/scene-list.test.ts +0 -71
- package/tests/print-paginator.test.ts +0 -82
- package/tests/shell/VersionHistory.test.tsx +0 -129
- package/tests/spellcheck/hunspell.test.ts +0 -82
- package/tests/spellcheck/spellcheck-plugin.test.ts +0 -56
- package/tests/styles.test.ts +0 -315
- package/tests/templates/templates.test.ts +0 -83
- package/tests/titlepage/TitlePageDialog.test.tsx +0 -90
- package/tests/titlepage/apply-title-page.test.ts +0 -61
- package/tests/titlepage/frontmatter-form.test.ts +0 -115
- package/tests/toolbar-actions.test.ts +0 -93
- package/tests/voice-commands.test.ts +0 -58
- package/tsconfig.json +0 -17
- package/vitest.config.ts +0 -11
- package/vitest.setup.ts +0 -65
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react'
|
|
2
|
-
import type { VersionEntry } from '../types'
|
|
3
|
-
import type { ScreenplayStyleDefinition } from '../styles/types'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Injected by the embedder (OSS spec §11.5). The OSS app supplies a local
|
|
7
|
-
* implementation (IndexedDB + File System Access API, see @sutrata/app's
|
|
8
|
-
* local-storage-adapter.ts); Sutrata Cloud supplies a networked one.
|
|
9
|
-
*
|
|
10
|
-
* `handle` fields are opaque (`unknown`) on purpose: a web FileSystemFileHandle
|
|
11
|
-
* has no equivalent in a non-web adapter. Callers just thread whatever the
|
|
12
|
-
* adapter returned back into a later saveFile() call without inspecting it.
|
|
13
|
-
*/
|
|
14
|
-
export interface StorageAdapter {
|
|
15
|
-
saveDocument(path: string, content: string): Promise<void>
|
|
16
|
-
loadDocument(path: string): Promise<string | null>
|
|
17
|
-
listVersions(path: string): Promise<VersionEntry[]>
|
|
18
|
-
|
|
19
|
-
openFile(): Promise<{ name: string; content: string; handle: unknown } | null>
|
|
20
|
-
openDocx(): Promise<{ name: string; buffer: ArrayBuffer } | null>
|
|
21
|
-
openStyleJson(): Promise<{ name: string; text: string } | null>
|
|
22
|
-
saveFile(
|
|
23
|
-
name: string,
|
|
24
|
-
content: string,
|
|
25
|
-
existingHandle?: unknown,
|
|
26
|
-
): Promise<{ savedName: string; handle: unknown } | null>
|
|
27
|
-
|
|
28
|
-
saveStyle(style: ScreenplayStyleDefinition): Promise<void>
|
|
29
|
-
loadAllStyles(): Promise<ScreenplayStyleDefinition[]>
|
|
30
|
-
deleteStyle(id: string): Promise<void>
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Optional: lets a restored session (see DocumentContext's boot-recovery
|
|
34
|
-
* effect) keep writing straight back to the file the user had open instead
|
|
35
|
-
* of forcing Save As. Adapters without a handle concept (Cloud, or a
|
|
36
|
-
* browser build with no persisted-handle support) simply omit these; the
|
|
37
|
-
* caller feature-detects with `?.`. `restoreFileHandle` should only ever
|
|
38
|
-
* return a handle that's usable without prompting — if permission would
|
|
39
|
-
* need to be re-requested, return null and let the user Save As instead.
|
|
40
|
-
*/
|
|
41
|
-
persistFileHandle?(path: string, handle: unknown): Promise<void>
|
|
42
|
-
restoreFileHandle?(path: string): Promise<unknown | null>
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Optional: delete all saved versions of a document. Used by the version
|
|
46
|
-
* history UI's "clear all versions" action.
|
|
47
|
-
*/
|
|
48
|
-
deleteAllVersions?(path: string): Promise<void>
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Optional: save a version snapshot for a document. Adapters should only
|
|
52
|
-
* persist a new version entry when there is a difference against the previous version.
|
|
53
|
-
*/
|
|
54
|
-
saveVersion?(path: string, content: string): Promise<boolean>
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const StorageAdapterContext = createContext<StorageAdapter | null>(null)
|
|
58
|
-
|
|
59
|
-
export const StorageAdapterProvider = StorageAdapterContext.Provider
|
|
60
|
-
|
|
61
|
-
export function useStorageAdapter(): StorageAdapter {
|
|
62
|
-
const adapter = useContext(StorageAdapterContext)
|
|
63
|
-
if (!adapter) throw new Error('useStorageAdapter must be used inside a StorageAdapterProvider (DocumentProvider supplies one)')
|
|
64
|
-
return adapter
|
|
65
|
-
}
|
package/src/extensions/types.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-only extension-point surface (OSS spec §11.5). These declare the shape
|
|
3
|
-
* embedders (Sutrata Cloud, third-party plugins) will implement, but nothing
|
|
4
|
-
* in @sutrata/editor is wired to them yet — ai-client.ts and voice-service.ts
|
|
5
|
-
* are still direct imports within this package, not injected. Promoting them
|
|
6
|
-
* to real dependency-injected providers (matching StorageAdapter's pattern in
|
|
7
|
-
* ./storage-adapter.ts) is future work; see docs/TODO.
|
|
8
|
-
*
|
|
9
|
-
* [P1 interface, stable by P2] per the OSS spec — these shapes may still
|
|
10
|
-
* change before they're load-bearing.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/** LLM completion with streaming; declares capabilities and data-policy text for disclosure. */
|
|
14
|
-
export interface AIProvider {
|
|
15
|
-
id: string
|
|
16
|
-
displayName: string
|
|
17
|
-
dataPolicyText: string
|
|
18
|
-
complete(prompt: string, opts?: { stream?: boolean }): Promise<string>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Speech-to-text. */
|
|
22
|
-
export interface SpeechProvider {
|
|
23
|
-
id: string
|
|
24
|
-
displayName: string
|
|
25
|
-
transcribe(audio: Blob, opts?: { language?: string }): Promise<string>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Current user identity, permissions (read-only, comment, edit), feature flags. */
|
|
29
|
-
export interface SessionContext {
|
|
30
|
-
userId: string | null
|
|
31
|
-
displayName: string | null
|
|
32
|
-
permission: 'read' | 'comment' | 'edit'
|
|
33
|
-
featureFlags: Record<string, boolean>
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Add side panels, inspector sections, and app-bar items; receives the AST and scene IDs. */
|
|
37
|
-
export interface PanelRegistry {
|
|
38
|
-
registerPanel(panel: { id: string; title: string; render: () => unknown }): void
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Add commands, menu items, keyboard shortcuts. */
|
|
42
|
-
export interface CommandRegistry {
|
|
43
|
-
registerCommand(command: { id: string; label: string; run: () => void; shortcut?: string }): void
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Add export formats and report types. */
|
|
47
|
-
export interface ExportRegistry {
|
|
48
|
-
registerExporter(exporter: { id: string; label: string; run: (text: string) => Promise<Blob> }): void
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Hook to bind the editor state to an external real-time sync provider (e.g. a Yjs document). */
|
|
52
|
-
export interface CollabBinding {
|
|
53
|
-
bind(): () => void
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Render external annotations (comments, breakdown highlights, revision marks) anchored to
|
|
57
|
-
* scene IDs and text ranges. */
|
|
58
|
-
export interface DecorationProvider {
|
|
59
|
-
getDecorations(sceneId: string): Array<{ from: number; to: number; className: string }>
|
|
60
|
-
}
|