@case-framework/survey-editor-ui 0.1.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 (240) hide show
  1. package/README.md +90 -0
  2. package/dist/item-core-registry.cjs.js +2 -0
  3. package/dist/item-core-registry.cjs.js.map +1 -0
  4. package/dist/item-core-registry.es.js +11 -0
  5. package/dist/item-core-registry.es.js.map +1 -0
  6. package/dist/src/components/c-ui/alert-provider.d.ts +18 -0
  7. package/dist/src/components/c-ui/confirm-dialog.d.ts +19 -0
  8. package/dist/src/components/c-ui/confirm-provider.d.ts +15 -0
  9. package/dist/src/components/c-ui/dot-background.d.ts +72 -0
  10. package/dist/src/components/c-ui/filepicker-dropzone.d.ts +38 -0
  11. package/dist/src/components/c-ui/loading-button.d.ts +9 -0
  12. package/dist/src/components/common/content-editable-plain.d.ts +17 -0
  13. package/dist/src/components/common/sortable-tree.d.ts +59 -0
  14. package/dist/src/components/hooks/use-button-shortcut.d.ts +18 -0
  15. package/dist/src/components/hooks/use-document-keydown.d.ts +7 -0
  16. package/dist/src/components/rich-text/content-policy.d.ts +19 -0
  17. package/dist/src/components/rich-text/index.d.ts +6 -0
  18. package/dist/src/components/rich-text/nodes/rich-text-image-node.d.ts +40 -0
  19. package/dist/src/components/rich-text/nodes/rich-text-info-box-node.d.ts +45 -0
  20. package/dist/src/components/rich-text/nodes/survey-rich-text-heading-node.d.ts +27 -0
  21. package/dist/src/components/rich-text/rich-text-block-editor.d.ts +8 -0
  22. package/dist/src/components/rich-text/rich-text-content-view.d.ts +15 -0
  23. package/dist/src/components/rich-text/rich-text-editor-context.d.ts +23 -0
  24. package/dist/src/components/rich-text/rich-text-link-utils.d.ts +1 -0
  25. package/dist/src/components/rich-text/rich-text-survey-content.d.ts +7 -0
  26. package/dist/src/components/rich-text/types.d.ts +6 -0
  27. package/dist/src/components/rich-text-editor/index.d.ts +3 -0
  28. package/dist/src/components/rich-text-editor/plugins/command-handler-plugin.d.ts +5 -0
  29. package/dist/src/components/rich-text-editor/plugins/editable-mode-plugin.d.ts +3 -0
  30. package/dist/src/components/rich-text-editor/plugins/floating-toolbar-plugin.d.ts +11 -0
  31. package/dist/src/components/rich-text-editor/plugins/image-dialog-plugin.d.ts +4 -0
  32. package/dist/src/components/rich-text-editor/plugins/info-box-popover-plugin.d.ts +6 -0
  33. package/dist/src/components/rich-text-editor/plugins/link-popover-plugin.d.ts +6 -0
  34. package/dist/src/components/rich-text-editor/plugins/rich-text-image-asset-deletion-plugin.d.ts +1 -0
  35. package/dist/src/components/rich-text-editor/plugins/slash-command-menu-plugin.d.ts +15 -0
  36. package/dist/src/components/rich-text-editor/plugins/sync-editor-value-plugin.d.ts +4 -0
  37. package/dist/src/components/rich-text-editor/rich-text-editor-utils.d.ts +205 -0
  38. package/dist/src/components/rich-text-editor/rich-text-editor.d.ts +43 -0
  39. package/dist/src/components/rich-text-editor/rich-text-image-editor-commands.d.ts +12 -0
  40. package/dist/src/components/rich-text-editor/rich-text-info-box-commands.d.ts +20 -0
  41. package/dist/src/components/rich-text-editor/style-control-icon.d.ts +5 -0
  42. package/dist/src/components/ui/alert-dialog.d.ts +18 -0
  43. package/dist/src/components/ui/alert.d.ts +10 -0
  44. package/dist/src/components/ui/badge.d.ts +9 -0
  45. package/dist/src/components/ui/breadcrumb.d.ts +11 -0
  46. package/dist/src/components/ui/button.d.ts +10 -0
  47. package/dist/src/components/ui/calendar.d.ts +10 -0
  48. package/dist/src/components/ui/card.d.ts +11 -0
  49. package/dist/src/components/ui/checkbox.d.ts +4 -0
  50. package/dist/src/components/ui/collapsible.d.ts +5 -0
  51. package/dist/src/components/ui/command.d.ts +18 -0
  52. package/dist/src/components/ui/context-menu.d.ts +31 -0
  53. package/dist/src/components/ui/dialog.d.ts +20 -0
  54. package/dist/src/components/ui/dropdown-menu.d.ts +29 -0
  55. package/dist/src/components/ui/field.d.ts +24 -0
  56. package/dist/src/components/ui/input-group.d.ts +16 -0
  57. package/dist/src/components/ui/input.d.ts +3 -0
  58. package/dist/src/components/ui/kbd.d.ts +3 -0
  59. package/dist/src/components/ui/label.d.ts +4 -0
  60. package/dist/src/components/ui/popover.d.ts +10 -0
  61. package/dist/src/components/ui/progress.d.ts +4 -0
  62. package/dist/src/components/ui/radio-group.d.ts +5 -0
  63. package/dist/src/components/ui/resizable.d.ts +7 -0
  64. package/dist/src/components/ui/scroll-area.d.ts +5 -0
  65. package/dist/src/components/ui/select.d.ts +15 -0
  66. package/dist/src/components/ui/separator.d.ts +4 -0
  67. package/dist/src/components/ui/skeleton.d.ts +2 -0
  68. package/dist/src/components/ui/slider.d.ts +4 -0
  69. package/dist/src/components/ui/sonner.d.ts +3 -0
  70. package/dist/src/components/ui/switch.d.ts +6 -0
  71. package/dist/src/components/ui/tabs.d.ts +11 -0
  72. package/dist/src/components/ui/textarea.d.ts +3 -0
  73. package/dist/src/components/ui/toggle-group.d.ts +10 -0
  74. package/dist/src/components/ui/toggle.d.ts +9 -0
  75. package/dist/src/components/ui/tooltip.d.ts +7 -0
  76. package/dist/src/dev/_components/nav-input.d.ts +35 -0
  77. package/dist/src/dev/app.d.ts +2 -0
  78. package/dist/src/dev/localizations/de.d.ts +2 -0
  79. package/dist/src/dev/main.d.ts +0 -0
  80. package/dist/src/index.d.ts +11 -0
  81. package/dist/src/item-core-registry.d.ts +4 -0
  82. package/dist/src/lib/rich-text-link-url.d.ts +2 -0
  83. package/dist/src/lib/survey-assets.d.ts +2 -0
  84. package/dist/src/lib/utils.d.ts +2 -0
  85. package/dist/src/modules/default-item-registry/default-registry-entries.d.ts +2 -0
  86. package/dist/src/modules/default-item-registry/index.d.ts +19 -0
  87. package/dist/src/modules/default-item-registry/item-authoring-state.d.ts +15 -0
  88. package/dist/src/modules/default-item-registry/items/choice/display-order.d.ts +1 -0
  89. package/dist/src/modules/default-item-registry/items/choice/editor/card.d.ts +3 -0
  90. package/dist/src/modules/default-item-registry/items/choice/editor/option-create.d.ts +11 -0
  91. package/dist/src/modules/default-item-registry/items/choice/editor/option-edit-dialog.d.ts +21 -0
  92. package/dist/src/modules/default-item-registry/items/choice/editor/option-editor-fields.d.ts +17 -0
  93. package/dist/src/modules/default-item-registry/items/choice/editor/response-options-list.d.ts +20 -0
  94. package/dist/src/modules/default-item-registry/items/choice/expression-registry.d.ts +3 -0
  95. package/dist/src/modules/default-item-registry/items/choice/model.d.ts +28 -0
  96. package/dist/src/modules/default-item-registry/items/choice/preview/item.d.ts +2 -0
  97. package/dist/src/modules/default-item-registry/items/choice/search-adapter.d.ts +2 -0
  98. package/dist/src/modules/default-item-registry/items/form/editor/card.d.ts +3 -0
  99. package/dist/src/modules/default-item-registry/items/form/editor/config-editor.d.ts +12 -0
  100. package/dist/src/modules/default-item-registry/items/form/editor/field-edit-dialog.d.ts +10 -0
  101. package/dist/src/modules/default-item-registry/items/form/editor/field-group-header-dialog.d.ts +12 -0
  102. package/dist/src/modules/default-item-registry/items/form/editor/field-group-layout-dialog.d.ts +9 -0
  103. package/dist/src/modules/default-item-registry/items/form/editor/field-item-preview.d.ts +15 -0
  104. package/dist/src/modules/default-item-registry/items/form/editor/field-key-dialog.d.ts +10 -0
  105. package/dist/src/modules/default-item-registry/items/form/editor/field-sort-dialog.d.ts +11 -0
  106. package/dist/src/modules/default-item-registry/items/form/editor/field-type-shared.d.ts +12 -0
  107. package/dist/src/modules/default-item-registry/items/form/editor/response-field-groups-list.d.ts +16 -0
  108. package/dist/src/modules/default-item-registry/items/form/model.d.ts +161 -0
  109. package/dist/src/modules/default-item-registry/items/form/preview/item.d.ts +2 -0
  110. package/dist/src/modules/default-item-registry/items/form/search-adapter.d.ts +2 -0
  111. package/dist/src/modules/default-item-registry/items/info/editor-card.d.ts +3 -0
  112. package/dist/src/modules/default-item-registry/items/info/preview/item.d.ts +2 -0
  113. package/dist/src/modules/default-item-registry/items/info/search-adapter.d.ts +2 -0
  114. package/dist/src/modules/default-item-registry/items/structure/group/editor-card.d.ts +3 -0
  115. package/dist/src/modules/default-item-registry/items/structure/page-break/editor-card.d.ts +3 -0
  116. package/dist/src/modules/default-item-registry/items/structure/preview-renderers.d.ts +3 -0
  117. package/dist/src/modules/default-item-registry/items/structure/root/editor-card.d.ts +3 -0
  118. package/dist/src/modules/default-item-registry/shared/preview/question-header.d.ts +6 -0
  119. package/dist/src/modules/default-item-registry/shared/preview/utils.d.ts +3 -0
  120. package/dist/src/modules/default-item-registry/shared/question-editor/deferred-localized-rich-text-field.d.ts +26 -0
  121. package/dist/src/modules/default-item-registry/shared/question-editor/header-editor.d.ts +6 -0
  122. package/dist/src/modules/default-item-registry/shared/question-editor/layout.d.ts +8 -0
  123. package/dist/src/modules/default-item-registry/shared/question-editor/rich-text-editors.d.ts +23 -0
  124. package/dist/src/modules/default-item-registry/shared/question-editor/rich-text-policies.d.ts +8 -0
  125. package/dist/src/modules/default-item-registry/shared/question-editor/toolbar.d.ts +10 -0
  126. package/dist/src/modules/survey-editor/ai/create-provider.d.ts +22 -0
  127. package/dist/src/modules/survey-editor/ai/types.d.ts +11 -0
  128. package/dist/src/modules/survey-editor/ai/use-survey-assistant-integration.d.ts +18 -0
  129. package/dist/src/modules/survey-editor/assets/index.d.ts +4 -0
  130. package/dist/src/modules/survey-editor/assets/survey-image-asset-manager.d.ts +4 -0
  131. package/dist/src/modules/survey-editor/assets/use-survey-assets.d.ts +4 -0
  132. package/dist/src/modules/survey-editor/assets/utils.d.ts +5 -0
  133. package/dist/src/modules/survey-editor/assistant/apply.d.ts +24 -0
  134. package/dist/src/modules/survey-editor/assistant/index.d.ts +2 -0
  135. package/dist/src/modules/survey-editor/assistant/snapshot.d.ts +39 -0
  136. package/dist/src/modules/survey-editor/editor-card/add-items/constants.d.ts +5 -0
  137. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +24 -0
  138. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-target.d.ts +9 -0
  139. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-option-group-navigation.d.ts +20 -0
  140. package/dist/src/modules/survey-editor/editor-card/add-items/types.d.ts +21 -0
  141. package/dist/src/modules/survey-editor/editor-card/add-items/views/back-button.d.ts +5 -0
  142. package/dist/src/modules/survey-editor/editor-card/add-items/views/blank-item-view.d.ts +13 -0
  143. package/dist/src/modules/survey-editor/editor-card/add-items/views/entry-view.d.ts +15 -0
  144. package/dist/src/modules/survey-editor/editor-card/add-items/views/item-type-grid-view.d.ts +30 -0
  145. package/dist/src/modules/survey-editor/editor-card/add-items/views/structure-view.d.ts +16 -0
  146. package/dist/src/modules/survey-editor/editor-card/add-items.d.ts +1 -0
  147. package/dist/src/modules/survey-editor/editor-card/copy-item-dropdown-menu.d.ts +5 -0
  148. package/dist/src/modules/survey-editor/editor-card/delete-item-context-menu.d.ts +5 -0
  149. package/dist/src/modules/survey-editor/editor-card/delete-item-dropdown-menu.d.ts +7 -0
  150. package/dist/src/modules/survey-editor/editor-card/editor-card-tab-trigger.d.ts +15 -0
  151. package/dist/src/modules/survey-editor/editor-card/expression-pseudo-code.d.ts +9 -0
  152. package/dist/src/modules/survey-editor/editor-card/group-items.d.ts +2 -0
  153. package/dist/src/modules/survey-editor/editor-card/hooks/use-armed-shortcut-sequence.d.ts +11 -0
  154. package/dist/src/modules/survey-editor/editor-card/hooks/use-group-list-keyboard.d.ts +30 -0
  155. package/dist/src/modules/survey-editor/editor-card/index.d.ts +2 -0
  156. package/dist/src/modules/survey-editor/editor-card/item-authoring-state-preview.d.ts +16 -0
  157. package/dist/src/modules/survey-editor/editor-card/item-color-menu.d.ts +6 -0
  158. package/dist/src/modules/survey-editor/editor-card/item-color-selector.d.ts +5 -0
  159. package/dist/src/modules/survey-editor/editor-card/item-editor-card-skeleton.d.ts +2 -0
  160. package/dist/src/modules/survey-editor/editor-card/item-editor-card.d.ts +34 -0
  161. package/dist/src/modules/survey-editor/editor-card/item-editor-context.d.ts +23 -0
  162. package/dist/src/modules/survey-editor/editor-card/item-expression-overview.d.ts +33 -0
  163. package/dist/src/modules/survey-editor/editor-card/item-key-editor.d.ts +9 -0
  164. package/dist/src/modules/survey-editor/editor-card/item-label-preview-and-editor.d.ts +10 -0
  165. package/dist/src/modules/survey-editor/editor-card/item-preview.d.ts +8 -0
  166. package/dist/src/modules/survey-editor/editor-card/item-sibling-navigation.d.ts +5 -0
  167. package/dist/src/modules/survey-editor/editor-card/item-type-icon-with-tooltip.d.ts +8 -0
  168. package/dist/src/modules/survey-editor/editor-card/survey-player-item-preview.d.ts +6 -0
  169. package/dist/src/modules/survey-editor/editor-instance-provider.d.ts +9 -0
  170. package/dist/src/modules/survey-editor/hooks/useClipboardValue.d.ts +2 -0
  171. package/dist/src/modules/survey-editor/hooks/useDeleteItem.d.ts +11 -0
  172. package/dist/src/modules/survey-editor/hooks/useEditor.d.ts +12 -0
  173. package/dist/src/modules/survey-editor/hooks/useEditorStateChange.d.ts +18 -0
  174. package/dist/src/modules/survey-editor/hooks/useKeyboardShortcuts.d.ts +7 -0
  175. package/dist/src/modules/survey-editor/index.d.ts +20 -0
  176. package/dist/src/modules/survey-editor/localization/date-fns.d.ts +5 -0
  177. package/dist/src/modules/survey-editor/localization/default-all.d.ts +2 -0
  178. package/dist/src/modules/survey-editor/localization/default-en.d.ts +3 -0
  179. package/dist/src/modules/survey-editor/localization/default-nl.d.ts +2 -0
  180. package/dist/src/modules/survey-editor/localization/index.d.ts +5 -0
  181. package/dist/src/modules/survey-editor/localization/runtime.d.ts +4 -0
  182. package/dist/src/modules/survey-editor/navigation/location.d.ts +6 -0
  183. package/dist/src/modules/survey-editor/navigation/navigation-provider.d.ts +12 -0
  184. package/dist/src/modules/survey-editor/navigation/navigation.d.ts +22 -0
  185. package/dist/src/modules/survey-editor/navigation/types.d.ts +23 -0
  186. package/dist/src/modules/survey-editor/primitives/input-with-ai-popover.d.ts +35 -0
  187. package/dist/src/modules/survey-editor/registry/authoring-state.d.ts +17 -0
  188. package/dist/src/modules/survey-editor/registry/index.d.ts +8 -0
  189. package/dist/src/modules/survey-editor/registry/registry-mappers.d.ts +25 -0
  190. package/dist/src/modules/survey-editor/registry/search-adapter.d.ts +19 -0
  191. package/dist/src/modules/survey-editor/registry/types.d.ts +218 -0
  192. package/dist/src/modules/survey-editor/routes/editor/_components/assistant-authoring-lock.d.ts +7 -0
  193. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot-context.d.ts +6 -0
  194. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot.d.ts +8 -0
  195. package/dist/src/modules/survey-editor/routes/editor/_components/editor-mode-switch.d.ts +7 -0
  196. package/dist/src/modules/survey-editor/routes/editor/_components/editor-workspace.d.ts +30 -0
  197. package/dist/src/modules/survey-editor/routes/editor/_components/footer.d.ts +2 -0
  198. package/dist/src/modules/survey-editor/routes/editor/_components/history-stack.d.ts +2 -0
  199. package/dist/src/modules/survey-editor/routes/editor/_components/main.d.ts +7 -0
  200. package/dist/src/modules/survey-editor/routes/editor/_components/workspace-presets.d.ts +75 -0
  201. package/dist/src/modules/survey-editor/routes/editor/asset-manager/index.d.ts +2 -0
  202. package/dist/src/modules/survey-editor/routes/editor/index.d.ts +7 -0
  203. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/breadcrumbs-nav.d.ts +2 -0
  204. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/item-editor-toolbar.d.ts +6 -0
  205. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/language-picker.d.ts +2 -0
  206. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/search-trigger.d.ts +3 -0
  207. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/survey-search.d.ts +7 -0
  208. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-outline.d.ts +3 -0
  209. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-workspace.d.ts +12 -0
  210. package/dist/src/modules/survey-editor/routes/editor/item-editor/index.d.ts +6 -0
  211. package/dist/src/modules/survey-editor/routes/editor/preview-mode/index.d.ts +7 -0
  212. package/dist/src/modules/survey-editor/routes/editor/preview-mode/page-break-divider.d.ts +6 -0
  213. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-controls.d.ts +15 -0
  214. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-tree.d.ts +26 -0
  215. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-canvas.d.ts +16 -0
  216. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-item.d.ts +13 -0
  217. package/dist/src/modules/survey-editor/routes/editor/preview-mode/use-preview-preferences.d.ts +14 -0
  218. package/dist/src/modules/survey-editor/routes/editor/translation-mode/index.d.ts +2 -0
  219. package/dist/src/modules/survey-editor/session-file.d.ts +13 -0
  220. package/dist/src/modules/survey-editor/store/editor-store-context.d.ts +10 -0
  221. package/dist/src/modules/survey-editor/store/editor-store-provider.d.ts +7 -0
  222. package/dist/src/modules/survey-editor/store/editor-store.d.ts +109 -0
  223. package/dist/src/modules/survey-editor/store/use-editor-store.d.ts +4 -0
  224. package/dist/src/modules/survey-editor/store/useItemNavigation.d.ts +7 -0
  225. package/dist/src/modules/survey-editor/survey-editor-config.d.ts +38 -0
  226. package/dist/src/modules/survey-editor/survey-editor.d.ts +40 -0
  227. package/dist/src/modules/survey-editor/utils/item-type-infos.d.ts +23 -0
  228. package/dist/src/modules/survey-editor/workspace.d.ts +17 -0
  229. package/dist/survey-editor-animations.css +87 -0
  230. package/dist/survey-editor-animations.css.d.ts +2 -0
  231. package/dist/survey-editor-defaults.css +15 -0
  232. package/dist/survey-editor-defaults.css.d.ts +2 -0
  233. package/dist/survey-editor-ui.cjs.js +161 -0
  234. package/dist/survey-editor-ui.cjs.js.map +1 -0
  235. package/dist/survey-editor-ui.css +3 -0
  236. package/dist/survey-editor-ui.css.d.ts +2 -0
  237. package/dist/survey-editor-ui.es.js +50260 -0
  238. package/dist/survey-editor-ui.es.js.map +1 -0
  239. package/dist/vite.svg +1 -0
  240. package/package.json +107 -0
@@ -0,0 +1,109 @@
1
+ import { StoreApi } from 'zustand';
2
+ import { SurveyEditor, Target, SurveyItemClipboardData, CommitMeta, SurveyEditorHistoryCommit, UndoRedoConfig } from '@case-framework/survey-core/editor';
3
+ import { SurveyItemCore, SurveyItemTranslations, RawSurveyItem, TemplateValueDefinition, GroupItemCore, RawSurveyAsset, SurveyCardContent, NavigationContent, Content } from '@case-framework/survey-core';
4
+ import { ComposedEditorItemRegistry, ItemCategory, ItemLocaleMap, ItemRegistryEntry } from '../registry';
5
+ import { SurveyApplyResult, SurveyBatchApplyResult, SurveyChangeSet, SurveyDocumentVersion } from '@case-framework/survey-assistant/protocol';
6
+ interface StartNewSessionOptions {
7
+ surveyKey?: string;
8
+ /** Unified registry entries (recommended, matches SurveyEditor) */
9
+ itemRegistryEntries?: ItemRegistryEntry[];
10
+ /** Merged into default category labels when `itemRegistryEntries` is set. */
11
+ categoryLabels?: Partial<Record<ItemCategory, ItemLocaleMap>>;
12
+ }
13
+ export interface EditorStore {
14
+ /** Current survey/session id when editor is loaded */
15
+ sessionId: string | null;
16
+ /** The SurveyEditor instance - null when no editor is loaded */
17
+ editor: SurveyEditor | null;
18
+ /** Incremented on every mutation; select this to force re-renders when editor changes */
19
+ changeTick: number;
20
+ /** Composed item registry used by editor UI features. */
21
+ editorItemRegistry: ComposedEditorItemRegistry;
22
+ selectedLocale: string;
23
+ /** True while user-authored survey mutations are temporarily paused. */
24
+ userMutationsLocked: boolean;
25
+ /** Set the active editor (call when opening a session) */
26
+ setEditor: (surveyId: string | null, editor: SurveyEditor | null) => void;
27
+ /** Clear the active editor (call when closing/unmounting to avoid stale state on next mount) */
28
+ clearEditor: () => void;
29
+ /** Create and set a new blank survey editor (starts a new session) */
30
+ startNewSession: (options: StartNewSessionOptions) => void;
31
+ setEditorItemRegistry: (registry: ComposedEditorItemRegistry) => void;
32
+ setSelectedLocale: (locale: string) => void;
33
+ setUserMutationsLocked: (locked: boolean) => void;
34
+ undo: () => boolean;
35
+ redo: () => boolean;
36
+ canUndo: () => boolean;
37
+ canRedo: () => boolean;
38
+ commit: (meta: CommitMeta) => void;
39
+ commitByUser: (meta: Omit<CommitMeta, "source">) => void;
40
+ commitIfNeeded: () => void;
41
+ jumpToIndexInHistory: (targetIndex: number) => boolean;
42
+ getUndoMeta: () => CommitMeta | null;
43
+ getRedoMeta: () => CommitMeta | null;
44
+ getUndoRedoHistory: () => Array<{
45
+ index: number;
46
+ meta: CommitMeta;
47
+ timestamp: number;
48
+ memorySize: number;
49
+ isCurrent: boolean;
50
+ }>;
51
+ getCommitsSinceInitial: () => SurveyEditorHistoryCommit[];
52
+ addItem: (target: Target | null, item: SurveyItemCore, content?: SurveyItemTranslations) => void;
53
+ removeItem: (itemId: string, nested?: boolean) => boolean;
54
+ moveItem: (itemId: string, newTarget: Target) => boolean;
55
+ updateItemTranslations: (itemId: string, updatedContent?: SurveyItemTranslations) => boolean;
56
+ copyItem: (itemId: string) => SurveyItemClipboardData;
57
+ pasteItem: (clipboardData: SurveyItemClipboardData, target: Target) => string | null;
58
+ getRootItem: () => GroupItemCore | undefined;
59
+ getItemDataCopy: (itemId: string) => RawSurveyItem;
60
+ updateItem: (itemId: string, rawItemData: RawSurveyItem | Partial<RawSurveyItem>) => void;
61
+ updateSurveyTranslations: (updates: {
62
+ surveyCard?: {
63
+ locale: string;
64
+ content?: SurveyCardContent;
65
+ };
66
+ navigation?: {
67
+ locale: string;
68
+ content?: NavigationContent;
69
+ };
70
+ validationMessages?: {
71
+ locale: string;
72
+ content?: {
73
+ invalidResponse?: Content;
74
+ };
75
+ };
76
+ }) => void;
77
+ getMaxItemsPerPage: () => {
78
+ large: number;
79
+ small: number;
80
+ } | undefined;
81
+ updateMaxItemsPerPage: (value: {
82
+ large: number;
83
+ small: number;
84
+ } | undefined) => void;
85
+ getMetadata: () => {
86
+ [key: string]: string;
87
+ } | undefined;
88
+ updateMetadata: (metadata: {
89
+ [key: string]: string;
90
+ } | undefined) => void;
91
+ applyAssistantChange: (change: SurveyChangeSet, currentPrecondition: SurveyDocumentVersion) => SurveyApplyResult;
92
+ applyAssistantChanges: (changes: SurveyChangeSet[], currentPrecondition: SurveyDocumentVersion) => SurveyBatchApplyResult;
93
+ getTemplateValue: (key: string) => TemplateValueDefinition | undefined;
94
+ getTemplateValues: () => Map<string, TemplateValueDefinition>;
95
+ setTemplateValue: (key: string, templateValue: TemplateValueDefinition) => void;
96
+ removeTemplateValue: (key: string) => void;
97
+ getAsset: (assetId: string) => RawSurveyAsset | undefined;
98
+ getAssets: () => Map<string, RawSurveyAsset>;
99
+ setAsset: (assetId: string, asset: RawSurveyAsset) => void;
100
+ removeAsset: (assetId: string) => void;
101
+ getMemoryUsage: () => {
102
+ totalMB: number;
103
+ entries: number;
104
+ };
105
+ getUndoRedoConfig: () => UndoRedoConfig;
106
+ }
107
+ export type EditorStoreApi = StoreApi<EditorStore>;
108
+ export declare function createEditorStore(): EditorStoreApi;
109
+ export {};
@@ -0,0 +1,4 @@
1
+ import { StoreApi } from 'zustand';
2
+ import { EditorStore } from './editor-store';
3
+ export declare function useEditorStore<T>(selector: (state: EditorStore) => T): T;
4
+ export declare function useEditorStoreApi(): StoreApi<EditorStore>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom hook for managing survey item navigation via state
3
+ */
4
+ export declare const useItemNavigation: () => {
5
+ selectedItemId: string | undefined;
6
+ navigateToItem: (newItemId?: string) => void;
7
+ };
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from 'react';
2
+ import { Locale } from 'date-fns/locale';
3
+ import { SurveyEditorAIProvider } from './ai/types';
4
+ import { LocalizationCatalog, LocalizationTranslate, LocalizationValues } from '@case-framework/ui-localization';
5
+ import { SurveyEditorDateLocales } from './localization/date-fns';
6
+ import { SurveyEditorWorkspace } from './workspace';
7
+ interface SurveyEditorConfigType {
8
+ helpLink: string;
9
+ aiProvider: SurveyEditorAIProvider | null;
10
+ fallbackLocale: string;
11
+ language: string;
12
+ localizations: LocalizationCatalog;
13
+ dateLocales: SurveyEditorDateLocales;
14
+ dateLocale: Locale;
15
+ translate: LocalizationTranslate;
16
+ workspace?: SurveyEditorWorkspace;
17
+ }
18
+ interface SurveyEditorConfigProviderProps {
19
+ children: ReactNode;
20
+ helpLink: string;
21
+ aiProvider?: SurveyEditorAIProvider | null;
22
+ fallbackLocale?: string;
23
+ language?: string;
24
+ localizations?: LocalizationCatalog;
25
+ dateLocales?: SurveyEditorDateLocales;
26
+ workspace?: SurveyEditorWorkspace;
27
+ }
28
+ interface ResolvedSurveyEditorConfigProviderProps extends Omit<SurveyEditorConfigProviderProps, "dateLocales" | "localizations"> {
29
+ dateLocales: SurveyEditorDateLocales;
30
+ localizations: LocalizationCatalog;
31
+ }
32
+ export declare const ResolvedSurveyEditorConfigProvider: React.FC<ResolvedSurveyEditorConfigProviderProps>;
33
+ export declare const SurveyEditorConfigProvider: React.FC<SurveyEditorConfigProviderProps>;
34
+ export declare const useSurveyEditorConfig: () => SurveyEditorConfigType;
35
+ export declare const useSurveyEditorAIProvider: () => SurveyEditorAIProvider | null;
36
+ export declare const useEditorTranslation: (namespace?: string) => ((key: string, values?: LocalizationValues) => string);
37
+ export declare const useEditorDateLocale: () => Locale;
38
+ export {};
@@ -0,0 +1,40 @@
1
+ import { ReactNode } from 'react';
2
+ import { SerializedSurveyEditor } from '@case-framework/survey-core/editor';
3
+ import { EditorStateChangePayload } from './hooks/useEditorStateChange';
4
+ import { SurveyEditorNavigationAdapter } from './navigation/types';
5
+ import { SurveyEditorAssistantController } from './assistant';
6
+ import { ItemCategory, ItemLocaleMap, ItemRegistryEntry } from './registry';
7
+ import { SurveyEditorAIProvider } from './ai/types';
8
+ import { LocalizationCatalog } from '@case-framework/ui-localization';
9
+ import { SurveyEditorDateLocales } from './localization/date-fns';
10
+ import { SurveyEditorWorkspace } from './workspace';
11
+ export type SurveyEditorStateChange = EditorStateChangePayload;
12
+ export interface SurveyEditorProps {
13
+ initialEditorState?: SerializedSurveyEditor;
14
+ initialSessionId?: string;
15
+ fallbackLocale?: string;
16
+ language?: string;
17
+ localizations?: LocalizationCatalog;
18
+ dateLocales?: SurveyEditorDateLocales;
19
+ itemRegistryEntries?: ItemRegistryEntry[];
20
+ /** Override or extend default add-item category headings (merged with built-in defaults). */
21
+ categoryLabels?: Partial<Record<ItemCategory, ItemLocaleMap>>;
22
+ onEditorStateChange?: (change: SurveyEditorStateChange) => void;
23
+ /** Prevent user-authored survey mutations while preserving preview and navigation. */
24
+ readOnly?: boolean;
25
+ /** Optional imperative bridge for a survey assistant host. */
26
+ assistantControllerRef?: React.Ref<SurveyEditorAssistantController | null>;
27
+ /** Optional host-rendered assistant UI shown in the editor workspace. */
28
+ assistantPanel?: ReactNode;
29
+ persistDebounceMs?: number;
30
+ helpLink?: string;
31
+ navigationAdapter?: SurveyEditorNavigationAdapter | null;
32
+ /** Configure the initial main panel and workspace panels. */
33
+ workspace?: SurveyEditorWorkspace;
34
+ aiProvider?: SurveyEditorAIProvider | null;
35
+ onBackRequested?: () => void;
36
+ onSimulatorRequested?: () => void;
37
+ onSaveRequested?: () => void;
38
+ }
39
+ declare const SurveyEditor: React.FC<SurveyEditorProps>;
40
+ export { SurveyEditor };
@@ -0,0 +1,23 @@
1
+ import { SurveyItemCore } from '@case-framework/survey-core';
2
+ import { ComposedEditorItemRegistry, ItemIconComponent } from '../registry';
3
+ export declare const builtInItemColors: readonly ["#404040", "#b91c1c", "#c2410c", "#a16207", "#4d7c0f", "#047857", "#0369a1", "#4338ca", "#7e22ce", "#86198f", "#be123c"];
4
+ export declare const getItemColorFromID: (id: string) => string;
5
+ export declare const getItemColor: (surveyItem: SurveyItemCore) => string | undefined;
6
+ /** Returns the registry key for an item ("root" for root groups, otherwise item.type). */
7
+ export declare const getItemTypeKey: (item: SurveyItemCore) => string;
8
+ export interface ItemTypeInfos {
9
+ key: string;
10
+ label: string;
11
+ description: string;
12
+ defaultItemClassName?: string;
13
+ icon: ItemIconComponent;
14
+ }
15
+ export declare const getItemTypeInfos: (item: SurveyItemCore, registry?: ComposedEditorItemRegistry) => ItemTypeInfos;
16
+ export declare const getItemTypeInfosByType: (itemType: string | undefined, registry?: ComposedEditorItemRegistry) => ItemTypeInfos | undefined;
17
+ /**
18
+ * Hook to access item type infos for a specific item type.
19
+ * Pass an item type string (e.g. "choiceItem", "root") or undefined.
20
+ * Returns undefined when itemType is undefined.
21
+ * Must be used within EditorStoreProvider.
22
+ */
23
+ export declare function useItemTypeInfos(itemType: string | undefined): ItemTypeInfos | undefined;
@@ -0,0 +1,17 @@
1
+ import { SurveyEditorLocation } from './navigation/types';
2
+ export interface SurveyEditorWorkspacePanelOptions {
3
+ /** Whether the panel is visible when this editor is first opened. */
4
+ defaultOpen?: boolean;
5
+ }
6
+ /** Initial layout for a SurveyEditor instance. */
7
+ export interface SurveyEditorWorkspace {
8
+ /**
9
+ * The main panel shown when no navigation adapter is supplied.
10
+ * Defaults to the survey preview.
11
+ */
12
+ initialLocation?: SurveyEditorLocation;
13
+ panels?: {
14
+ outline?: SurveyEditorWorkspacePanelOptions;
15
+ assistant?: SurveyEditorWorkspacePanelOptions;
16
+ };
17
+ }
@@ -0,0 +1,87 @@
1
+ .survey-editor-opening-item {
2
+ --survey-editor-open-item-x: 18%;
3
+ --survey-editor-open-item-y: 0;
4
+ --survey-editor-open-item-accent-shadow:
5
+ 0 0 0 1px color-mix(in oklab, var(--ring) 36%, transparent),
6
+ inset -5px 0 0 color-mix(in oklab, var(--ring) 70%, transparent);
7
+
8
+ height: 100%;
9
+ min-height: 0;
10
+ animation: survey-editor-open-item 180ms cubic-bezier(0.215, 0.61, 0.355, 1);
11
+ will-change: transform, opacity;
12
+ }
13
+
14
+ .survey-editor-opening-item[data-opening-direction="left"] {
15
+ --survey-editor-open-item-x: -18%;
16
+ --survey-editor-open-item-y: 0;
17
+ --survey-editor-open-item-accent-shadow:
18
+ 0 0 0 1px color-mix(in oklab, var(--ring) 36%, transparent),
19
+ inset 5px 0 0 color-mix(in oklab, var(--ring) 70%, transparent);
20
+ }
21
+
22
+ .survey-editor-opening-item[data-opening-direction="right"] {
23
+ --survey-editor-open-item-x: 18%;
24
+ --survey-editor-open-item-y: 0;
25
+ --survey-editor-open-item-accent-shadow:
26
+ 0 0 0 1px color-mix(in oklab, var(--ring) 36%, transparent),
27
+ inset -5px 0 0 color-mix(in oklab, var(--ring) 70%, transparent);
28
+ }
29
+
30
+ .survey-editor-opening-item[data-opening-direction="up"] {
31
+ --survey-editor-open-item-x: 0;
32
+ --survey-editor-open-item-y: -12%;
33
+ --survey-editor-open-item-accent-shadow:
34
+ 0 0 0 1px color-mix(in oklab, var(--ring) 36%, transparent),
35
+ inset 0 5px 0 color-mix(in oklab, var(--ring) 70%, transparent);
36
+ }
37
+
38
+ .survey-editor-opening-item[data-opening-direction="down"] {
39
+ --survey-editor-open-item-x: 0;
40
+ --survey-editor-open-item-y: 12%;
41
+ --survey-editor-open-item-accent-shadow:
42
+ 0 0 0 1px color-mix(in oklab, var(--ring) 36%, transparent),
43
+ inset 0 -5px 0 color-mix(in oklab, var(--ring) 70%, transparent);
44
+ }
45
+
46
+ .survey-editor-opening-item > * {
47
+ animation: survey-editor-open-item-accent 260ms cubic-bezier(0.215, 0.61, 0.355, 1);
48
+ }
49
+
50
+ .survey-editor-opening-preview {
51
+ --survey-editor-open-item-x: -18%;
52
+ --survey-editor-open-item-y: 0;
53
+
54
+ animation: survey-editor-open-item 180ms cubic-bezier(0.215, 0.61, 0.355, 1);
55
+ will-change: transform, opacity;
56
+ }
57
+
58
+ @keyframes survey-editor-open-item {
59
+ from {
60
+ opacity: 0;
61
+ transform: translate(var(--survey-editor-open-item-x), var(--survey-editor-open-item-y));
62
+ }
63
+
64
+ to {
65
+ opacity: 1;
66
+ transform: translate(0, 0);
67
+ }
68
+ }
69
+
70
+ @keyframes survey-editor-open-item-accent {
71
+ 0% {
72
+ box-shadow: var(--survey-editor-open-item-accent-shadow);
73
+ }
74
+
75
+ 100% {
76
+ box-shadow: none;
77
+ }
78
+ }
79
+
80
+ @media (prefers-reduced-motion: reduce) {
81
+ .survey-editor-opening-item,
82
+ .survey-editor-opening-item > *,
83
+ .survey-editor-opening-preview {
84
+ animation: none;
85
+ will-change: auto;
86
+ }
87
+ }
@@ -0,0 +1,2 @@
1
+ declare const css: string;
2
+ export default css;
@@ -0,0 +1,15 @@
1
+ .survey-editor {
2
+ /* Editor card / preview canvas — neutral near-white */
3
+ --surface-bg-color: oklch(99.1% 0 0);
4
+
5
+ /*
6
+ * Rich text emphasis (Lexical + preview). Chosen for strong contrast on
7
+ * --surface-bg-color and clearly distinct hues so “primary” vs “accent” reads
8
+ * in the UI (not tied to global --primary / --accent, which are tuned for chrome).
9
+ *
10
+ * Primary — cool / structural: main wording emphasis (question tone, lead-in).
11
+ * Accent — warm / focal: secondary highlight (callouts, supplementary emphasis).
12
+ */
13
+ --rich-text-editor-primary-color: oklch(0.36 0.12 264);
14
+ --rich-text-editor-accent-color: oklch(0.44 0.15 48);
15
+ }
@@ -0,0 +1,2 @@
1
+ declare const css: string;
2
+ export default css;