@case-framework/survey-ui 0.5.0 → 0.6.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 (94) hide show
  1. package/dist/default-item-cores-C6VK2LFe.js +10 -0
  2. package/dist/default-item-cores-C6VK2LFe.js.map +1 -0
  3. package/dist/default-item-cores-gdu37TFX.mjs +3988 -0
  4. package/dist/default-item-cores-gdu37TFX.mjs.map +1 -0
  5. package/dist/item-core-registry.cjs.js +2 -0
  6. package/dist/item-core-registry.cjs.js.map +1 -0
  7. package/dist/item-core-registry.es.js +11 -0
  8. package/dist/item-core-registry.es.js.map +1 -0
  9. package/dist/src/components/common/sortable-tree.d.ts +59 -0
  10. package/dist/src/components/rich-text/rich-text-content-view.d.ts +6 -2
  11. package/dist/src/components/ui/dialog.d.ts +2 -1
  12. package/dist/src/components/ui/resizable.d.ts +7 -0
  13. package/dist/src/components/ui/toggle.d.ts +1 -1
  14. package/dist/src/dev/localizations/de.d.ts +2 -2
  15. package/dist/src/index.d.ts +7 -4
  16. package/dist/src/item-core-registry.d.ts +4 -0
  17. package/dist/src/modules/default-item-registry/item-authoring-state.d.ts +15 -0
  18. package/dist/src/modules/default-item-registry/items/choice/editor/option-edit-dialog.d.ts +10 -3
  19. package/dist/src/modules/default-item-registry/items/form/model.d.ts +4 -1
  20. package/dist/src/modules/survey-editor/ai/create-provider.d.ts +22 -0
  21. package/dist/src/modules/survey-editor/ai/types.d.ts +6 -83
  22. package/dist/src/modules/survey-editor/ai/use-survey-assistant-integration.d.ts +16 -0
  23. package/dist/src/modules/survey-editor/assistant/apply.d.ts +24 -0
  24. package/dist/src/modules/survey-editor/assistant/index.d.ts +2 -0
  25. package/dist/src/modules/survey-editor/assistant/snapshot.d.ts +39 -0
  26. package/dist/src/modules/survey-editor/editor-card/add-items/constants.d.ts +2 -0
  27. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +4 -5
  28. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-option-group-navigation.d.ts +2 -1
  29. package/dist/src/modules/survey-editor/editor-card/add-items/types.d.ts +1 -1
  30. package/dist/src/modules/survey-editor/editor-card/add-items/views/item-type-grid-view.d.ts +30 -0
  31. package/dist/src/modules/survey-editor/editor-card/delete-item-dropdown-menu.d.ts +3 -1
  32. package/dist/src/modules/survey-editor/editor-card/expression-pseudo-code.d.ts +8 -0
  33. package/dist/src/modules/survey-editor/editor-card/hooks/use-group-list-keyboard.d.ts +1 -1
  34. package/dist/src/modules/survey-editor/editor-card/item-authoring-state-preview.d.ts +16 -0
  35. package/dist/src/modules/survey-editor/editor-card/item-editor-card.d.ts +1 -6
  36. package/dist/src/modules/survey-editor/editor-card/item-editor-context.d.ts +5 -2
  37. package/dist/src/modules/survey-editor/editor-card/item-expression-overview.d.ts +33 -0
  38. package/dist/src/modules/survey-editor/editor-instance-provider.d.ts +2 -0
  39. package/dist/src/modules/survey-editor/hooks/useDeleteItem.d.ts +2 -0
  40. package/dist/src/modules/survey-editor/index.d.ts +5 -2
  41. package/dist/src/modules/survey-editor/localization/date-fns.d.ts +1 -1
  42. package/dist/src/modules/survey-editor/localization/default-all.d.ts +2 -2
  43. package/dist/src/modules/survey-editor/localization/default-en.d.ts +2 -2
  44. package/dist/src/modules/survey-editor/localization/default-nl.d.ts +2 -2
  45. package/dist/src/modules/survey-editor/localization/index.d.ts +0 -2
  46. package/dist/src/modules/survey-editor/localization/runtime.d.ts +4 -4
  47. package/dist/src/modules/survey-editor/navigation/location.d.ts +6 -0
  48. package/dist/src/modules/survey-editor/navigation/navigation-provider.d.ts +2 -1
  49. package/dist/src/modules/survey-editor/navigation/navigation.d.ts +10 -1
  50. package/dist/src/modules/survey-editor/navigation/types.d.ts +6 -1
  51. package/dist/src/modules/survey-editor/primitives/input-with-ai-popover.d.ts +2 -2
  52. package/dist/src/modules/survey-editor/registry/authoring-state.d.ts +17 -0
  53. package/dist/src/modules/survey-editor/registry/index.d.ts +1 -0
  54. package/dist/src/modules/survey-editor/registry/registry-mappers.d.ts +3 -3
  55. package/dist/src/modules/survey-editor/registry/types.d.ts +44 -4
  56. package/dist/src/modules/survey-editor/routes/editor/_components/assistant-authoring-lock.d.ts +7 -0
  57. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot-context.d.ts +6 -0
  58. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot.d.ts +8 -0
  59. package/dist/src/modules/survey-editor/routes/editor/_components/editor-mode-switch.d.ts +7 -0
  60. package/dist/src/modules/survey-editor/routes/editor/_components/editor-workspace.d.ts +30 -0
  61. package/dist/src/modules/survey-editor/routes/editor/_components/footer.d.ts +1 -1
  62. package/dist/src/modules/survey-editor/routes/editor/_components/main.d.ts +1 -1
  63. package/dist/src/modules/survey-editor/routes/editor/_components/workspace-presets.d.ts +75 -0
  64. package/dist/src/modules/survey-editor/routes/editor/index.d.ts +1 -1
  65. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/item-editor-toolbar.d.ts +0 -1
  66. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-outline.d.ts +3 -0
  67. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-workspace.d.ts +12 -0
  68. package/dist/src/modules/survey-editor/routes/editor/item-editor/index.d.ts +0 -1
  69. package/dist/src/modules/survey-editor/routes/editor/preview-mode/index.d.ts +7 -0
  70. package/dist/src/modules/survey-editor/routes/editor/preview-mode/page-break-divider.d.ts +6 -0
  71. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-controls.d.ts +15 -0
  72. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-tree.d.ts +26 -0
  73. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-canvas.d.ts +16 -0
  74. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-item.d.ts +13 -0
  75. package/dist/src/modules/survey-editor/routes/editor/preview-mode/use-preview-preferences.d.ts +14 -0
  76. package/dist/src/modules/survey-editor/store/editor-store.d.ts +7 -1
  77. package/dist/src/modules/survey-editor/survey-editor-config.d.ts +14 -5
  78. package/dist/src/modules/survey-editor/survey-editor.d.ts +14 -2
  79. package/dist/src/modules/survey-editor/workspace.d.ts +17 -0
  80. package/dist/src/modules/survey-player/index.d.ts +0 -1
  81. package/dist/src/modules/survey-player/localization/default-en.d.ts +2 -2
  82. package/dist/src/modules/survey-player/localization/runtime.d.ts +5 -4
  83. package/dist/src/modules/survey-player/survey-context.d.ts +9 -4
  84. package/dist/src/modules/survey-player/survey-player.d.ts +2 -2
  85. package/dist/survey-ui.cjs.js +101 -76
  86. package/dist/survey-ui.cjs.js.map +1 -1
  87. package/dist/survey-ui.css +2 -2
  88. package/dist/survey-ui.es.js +31869 -26677
  89. package/dist/survey-ui.es.js.map +1 -1
  90. package/package.json +26 -12
  91. package/dist/src/modules/default-item-registry/items/choice/editor/option-embedded-form-dialog.d.ts +0 -15
  92. package/dist/src/modules/survey-editor/editor-card/add-items/views/ai-item-view.d.ts +0 -10
  93. package/dist/src/modules/survey-editor/localization/types.d.ts +0 -7
  94. package/dist/src/modules/survey-player/localization/types.d.ts +0 -7
@@ -2,9 +2,12 @@ import { ReactNode } from 'react';
2
2
  interface ItemEditorContextType {
3
3
  addItemDialogOpen: boolean;
4
4
  setAddItemDialogOpen: (open: boolean) => void;
5
- openAddItemDialog: (targetParentId?: string) => void;
5
+ openAddItemDialog: (targetParentId?: string, targetIndex?: number, pendingItemType?: string) => void;
6
6
  closeAddItemDialog: () => void;
7
7
  targetParentId: string | undefined;
8
+ targetIndex: number | undefined;
9
+ pendingItemType: string | undefined;
10
+ clearPendingItemType: () => void;
8
11
  preferredPreviewItemId: string | null;
9
12
  setPreferredPreviewItemId: (itemId: string | null) => void;
10
13
  }
@@ -14,7 +17,7 @@ interface ItemEditorProviderProps {
14
17
  export declare const ItemEditorProvider: React.FC<ItemEditorProviderProps>;
15
18
  export declare const useItemEditor: () => ItemEditorContextType;
16
19
  export declare const useAddItemDialog: () => {
17
- openAddItemDialog: (targetParentId?: string) => void;
20
+ openAddItemDialog: (targetParentId?: string, targetIndex?: number, pendingItemType?: string) => void;
18
21
  closeAddItemDialog: () => void;
19
22
  };
20
23
  export {};
@@ -0,0 +1,33 @@
1
+ import { Expression, SurveyItemCore } from '@case-framework/survey-core';
2
+ export type ItemExpressionScope = "conditions" | "prefills" | "all";
3
+ interface ItemExpressionEntry {
4
+ id: string;
5
+ category: "display" | "disabled" | "validation" | "prefill-condition" | "prefill-value";
6
+ target?: string;
7
+ expression: Expression;
8
+ }
9
+ export declare function getItemExpressionEntries(item: SurveyItemCore, scope?: ItemExpressionScope): ItemExpressionEntry[];
10
+ export declare function countItemExpressions(item: SurveyItemCore, scope?: ItemExpressionScope): number;
11
+ interface ExpressionIconButtonProps {
12
+ expression: Expression;
13
+ title: string;
14
+ className?: string;
15
+ }
16
+ /** A compact condition indicator that opens the same complete read-only expression view. */
17
+ export declare function ExpressionIconButton({ expression, title, className }: ExpressionIconButtonProps): import("react/jsx-runtime").JSX.Element;
18
+ interface ItemExpressionsDialogButtonProps {
19
+ item: SurveyItemCore;
20
+ title: string;
21
+ className?: string;
22
+ scope?: ItemExpressionScope;
23
+ }
24
+ /** Opens all expression-bearing rules for an item from small indicators such as preview badges. */
25
+ export declare function ItemExpressionsDialogButton({ item, title, className, scope, }: ItemExpressionsDialogButtonProps): import("react/jsx-runtime").JSX.Element;
26
+ interface ItemExpressionOverviewProps {
27
+ item: SurveyItemCore;
28
+ scope?: ItemExpressionScope;
29
+ className?: string;
30
+ compact?: boolean;
31
+ }
32
+ export declare function ItemExpressionOverview({ item, scope, className, compact, }: ItemExpressionOverviewProps): import("react/jsx-runtime").JSX.Element;
33
+ export {};
@@ -1,7 +1,9 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { SurveyEditorNavigationAdapter } from './navigation/types';
3
+ import { SurveyEditorWorkspace } from './workspace';
3
4
  interface EditorInstanceProviderProps extends PropsWithChildren {
4
5
  navigationAdapter?: SurveyEditorNavigationAdapter | null;
6
+ workspace?: SurveyEditorWorkspace;
5
7
  }
6
8
  export declare const EditorInstanceProvider: React.FC<EditorInstanceProviderProps>;
7
9
  export {};
@@ -1,5 +1,7 @@
1
1
  interface UseDeleteItemOptions {
2
2
  itemId?: string;
3
+ /** `null` clears focus. `undefined` preserves the default parent-navigation behavior. */
4
+ afterDeleteItemId?: string | null;
3
5
  }
4
6
  export declare function useDeleteItem(options?: UseDeleteItemOptions): {
5
7
  itemId: string | undefined;
@@ -1,11 +1,14 @@
1
1
  export { SurveyEditor } from './survey-editor';
2
2
  export type { SurveyEditorProps, SurveyEditorStateChange } from './survey-editor';
3
+ export type { SurveyEditorWorkspace, SurveyEditorWorkspacePanelOptions } from './workspace';
4
+ export * from './assistant';
5
+ export { createSnapshotSurveyEditorAIProvider, type CreateSnapshotSurveyEditorAIProviderOptions, type SurveyEditorAITaskCacheOptions, type SurveyEditorAITaskExecution, type SurveyEditorAITaskExecutor, } from './ai/create-provider';
6
+ export { useSurveyEditorAssistantIntegration, type UseSurveyEditorAssistantIntegrationOptions, } from './ai/use-survey-assistant-integration';
3
7
  export { EditorInstanceProvider } from './editor-instance-provider';
4
8
  export { useEditorDateLocale, useEditorTranslation } from './survey-editor-config';
5
9
  export type { SurveyEditorNavigationAdapter, SurveyEditorLocation } from './navigation/types';
6
10
  export { DEFAULT_EDITOR_LANGUAGE, DEFAULT_DATE_FNS_LOCALES, defaultSurveyEditorLocalizations, getDateFnsLocale, mergeDateFnsLocales, mergeEditorLocalizations, surveyEditorEnMessages, surveyEditorNlMessages, } from './localization';
7
- export type { EditorLocalizationMessages, EditorTranslationValues, SurveyEditorDateLocales, SurveyEditorLocalizations, } from './localization';
8
- export type { AISuggestedText, BuildSurveyAIContextOptions, GenerateItemFromIntentRequest, GenerateItemFromIntentResult, GeneratedItemIntentSuggestion, SuggestItemKeyRequest, SuggestItemKeyResult, SuggestItemKeySuggestion, SuggestItemLabelRequest, SuggestItemLabelResult, SuggestItemLabelSuggestion, SurveyEditorAIProvider, SurveyAIContextPurpose, SurveyAIContextScope, SurveyAIInvocationMode, SurveyAIRequestOptions, TranslateContentEntry, TranslateContentRequest, TranslateContentResult, } from './ai/types';
11
+ export type { SurveyEditorAIProvider, SurveyAIRequestOptions } from './ai/types';
9
12
  export * from './registry';
10
13
  export { buildSurveyFileName, createBlankEditorState, createEditorStateFromRawSurvey, parseEditorStateFromJsonText, serializeSurveyStateForFile, type ParsedSurveySession, type ParsedSurveySessionFormat, } from './session-file';
11
14
  export { DEFAULT_BLOCK_CONTENT_POLICY, DEFAULT_COMPACT_CONTENT_POLICY, RichTextBlockEditor, RichTextContentView, createRichTextEditorValueFromContent, createRichTextEditorValueFromText, getRichTextContentFromEditorState, isBlockContentPolicyVariant, mergeRichTextContentPolicy, sanitizeContentForPolicy, } from '../../../components/rich-text';
@@ -1,5 +1,5 @@
1
1
  import { Locale } from 'date-fns/locale';
2
2
  export type SurveyEditorDateLocales = Record<string, Locale>;
3
3
  export declare const DEFAULT_DATE_FNS_LOCALES: SurveyEditorDateLocales;
4
- export declare const mergeDateFnsLocales: (dateLocales?: SurveyEditorDateLocales) => SurveyEditorDateLocales;
4
+ export declare const mergeDateFnsLocales: (...sources: Array<SurveyEditorDateLocales | undefined>) => SurveyEditorDateLocales;
5
5
  export declare const getDateFnsLocale: (language: string, dateLocales?: SurveyEditorDateLocales) => Locale;
@@ -1,2 +1,2 @@
1
- import { SurveyEditorLocalizations } from './types';
2
- export declare const defaultSurveyEditorLocalizations: SurveyEditorLocalizations;
1
+ import { LocalizationCatalog } from '@case-framework/ui-localization';
2
+ export declare const defaultSurveyEditorLocalizations: LocalizationCatalog;
@@ -1,3 +1,3 @@
1
- import { EditorLocalizationMessages } from './types';
1
+ import { LocalizationMessages } from '@case-framework/ui-localization';
2
2
  export declare const DEFAULT_EDITOR_LANGUAGE = "en";
3
- export declare const surveyEditorEnMessages: EditorLocalizationMessages;
3
+ export declare const surveyEditorEnMessages: LocalizationMessages;
@@ -1,2 +1,2 @@
1
- import { EditorLocalizationMessages } from './types';
2
- export declare const surveyEditorNlMessages: EditorLocalizationMessages;
1
+ import { LocalizationMessages } from '@case-framework/ui-localization';
2
+ export declare const surveyEditorNlMessages: LocalizationMessages;
@@ -3,5 +3,3 @@ export { defaultSurveyEditorLocalizations } from './default-all';
3
3
  export { surveyEditorNlMessages } from './default-nl';
4
4
  export { createEditorTranslator, createNamespacedEditorTranslator, mergeEditorLocalizations, } from './runtime';
5
5
  export { DEFAULT_DATE_FNS_LOCALES, getDateFnsLocale, mergeDateFnsLocales } from './date-fns';
6
- export type { EditorLocalizationMessages, EditorTranslate, EditorTranslationValues, SurveyEditorLocalizations, } from './types';
7
- export type { SurveyEditorDateLocales } from './date-fns';
@@ -1,4 +1,4 @@
1
- import { EditorTranslate, SurveyEditorLocalizations } from './types';
2
- export declare const mergeEditorLocalizations: (localizations?: SurveyEditorLocalizations) => SurveyEditorLocalizations;
3
- export declare const createEditorTranslator: (language: string, localizations: SurveyEditorLocalizations) => EditorTranslate;
4
- export declare const createNamespacedEditorTranslator: (translate: EditorTranslate, namespace?: string) => EditorTranslate;
1
+ import { LocalizationCatalog, LocalizationTranslate } from '@case-framework/ui-localization';
2
+ export declare const mergeEditorLocalizations: (...sources: Array<LocalizationCatalog | undefined>) => LocalizationCatalog;
3
+ export declare const createEditorTranslator: (language: string, localizations: LocalizationCatalog) => LocalizationTranslate;
4
+ export declare const createNamespacedEditorTranslator: (translate: LocalizationTranslate, namespace?: string) => LocalizationTranslate;
@@ -0,0 +1,6 @@
1
+ import { SurveyEditorLocation } from './types';
2
+ export type ItemFocusedSurveyEditorLocation = Exclude<SurveyEditorLocation, {
3
+ view: "asset-manager";
4
+ }>;
5
+ export declare const surveyEditorLocationSupportsItemFocus: (location: SurveyEditorLocation) => location is ItemFocusedSurveyEditorLocation;
6
+ export declare const getSurveyEditorFocusedItemId: (location: SurveyEditorLocation) => string | undefined;
@@ -1,9 +1,10 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { StoreApi } from 'zustand';
3
3
  import { SurveyEditorNavigationStore } from './navigation';
4
- import { SurveyEditorNavigationAdapter } from './types';
4
+ import { SurveyEditorLocation, SurveyEditorNavigationAdapter } from './types';
5
5
  interface SurveyEditorNavigationStoreProviderProps extends PropsWithChildren {
6
6
  adapter?: SurveyEditorNavigationAdapter | null;
7
+ initialLocation?: SurveyEditorLocation;
7
8
  }
8
9
  export declare const SurveyEditorNavigationStoreProvider: React.FC<SurveyEditorNavigationStoreProviderProps>;
9
10
  export declare function useSurveyEditorNavigationStore<T>(selector: (state: SurveyEditorNavigationStore) => T): T;
@@ -1,13 +1,22 @@
1
1
  import { SurveyEditorLocation, SurveyEditorNavigationAdapter } from './types';
2
2
  import { StoreApi } from 'zustand';
3
+ export interface SurveyEditorAssistantHighlight {
4
+ kind: string;
5
+ itemId?: string;
6
+ componentId?: string;
7
+ label?: string;
8
+ details?: string;
9
+ }
3
10
  export interface SurveyEditorNavigationStore {
4
11
  location: SurveyEditorLocation;
5
12
  history: SurveyEditorLocation[];
13
+ assistantHighlights: Record<string, SurveyEditorAssistantHighlight>;
6
14
  adapter: SurveyEditorNavigationAdapter | null;
7
15
  _adapterUnsubscribe?: () => void;
8
16
  setAdapter: (adapter: SurveyEditorNavigationAdapter) => void;
9
17
  clearAdapter: () => void;
10
18
  navigate: (location: SurveyEditorLocation, replace?: boolean) => void;
19
+ setAssistantHighlight: (source: string, highlight?: SurveyEditorAssistantHighlight) => void;
11
20
  }
12
21
  export type SurveyEditorNavigationStoreApi = StoreApi<SurveyEditorNavigationStore>;
13
- export declare function createSurveyEditorNavigationStore(): SurveyEditorNavigationStoreApi;
22
+ export declare function createSurveyEditorNavigationStore(initialLocation?: SurveyEditorLocation): SurveyEditorNavigationStoreApi;
@@ -4,11 +4,16 @@ export interface ItemEditorLocation {
4
4
  }
5
5
  export interface TranslationModeLocation {
6
6
  view: "translation-mode";
7
+ itemId?: string;
8
+ }
9
+ export interface PreviewModeLocation {
10
+ view: "preview-mode";
11
+ itemId?: string;
7
12
  }
8
13
  export interface AssetManagerLocation {
9
14
  view: "asset-manager";
10
15
  }
11
- export type SurveyEditorLocation = ItemEditorLocation | TranslationModeLocation | AssetManagerLocation;
16
+ export type SurveyEditorLocation = ItemEditorLocation | PreviewModeLocation | TranslationModeLocation | AssetManagerLocation;
12
17
  export interface SurveyEditorNavigationAdapter {
13
18
  getLocation: () => SurveyEditorLocation;
14
19
  navigateTo: (location: SurveyEditorLocation, options?: {
@@ -1,5 +1,5 @@
1
1
  import { FocusEvent, KeyboardEvent } from 'react';
2
- import { SurveyAIInvocationMode } from '../ai/types';
2
+ import { SurveyAssistantTaskInvocationMode } from '@case-framework/survey-assistant/protocol';
3
3
  export interface InputWithAISuggestion {
4
4
  id: string;
5
5
  text: string;
@@ -11,7 +11,7 @@ export interface InputWithAISuggestionsAdapter {
11
11
  maxSuggestions?: number;
12
12
  onSuggest: (input: string, trigger: "typing" | "manual", options?: {
13
13
  signal?: AbortSignal;
14
- mode?: SurveyAIInvocationMode;
14
+ mode?: SurveyAssistantTaskInvocationMode;
15
15
  }) => Promise<InputWithAISuggestion[]>;
16
16
  }
17
17
  interface InputWithAIPopoverProps {
@@ -0,0 +1,17 @@
1
+ import { SurveyItemCore, SurveyItemTranslations } from '@case-framework/survey-core';
2
+ import { EditorItemDefinition, ItemAuthoringState } from './types';
3
+ interface GetItemAuthoringStateOptions {
4
+ item: SurveyItemCore;
5
+ definition?: EditorItemDefinition;
6
+ itemContent?: SurveyItemTranslations;
7
+ locales: string[];
8
+ locale: string;
9
+ }
10
+ /**
11
+ * Conservative fallback for item types without content-aware readiness rules.
12
+ * Built-in items provide content-aware rules; third-party item types can use
13
+ * modification metadata until they define their own readiness criteria.
14
+ */
15
+ export declare function getDefaultItemAuthoringState(item: SurveyItemCore): ItemAuthoringState;
16
+ export declare function getItemAuthoringState({ item, definition, itemContent, locales, locale, }: GetItemAuthoringStateOptions): ItemAuthoringState;
17
+ export {};
@@ -5,3 +5,4 @@
5
5
  export * from './types';
6
6
  export * from './registry-mappers';
7
7
  export * from './search-adapter';
8
+ export * from './authoring-state';
@@ -1,6 +1,6 @@
1
1
  import { AnyItemExpressionDefinition, ItemTypeRegistry, SurveyItemCore } from '@case-framework/survey-core';
2
2
  import { ComposedEditorItemRegistry, EditorItemDefinition, EntriesToComposedEditorRegistryOptions, EntriesToParticipantRegistryOptions, ItemCategory, ItemLocaleMap, ItemRegistryEntry, RegistryValidationOptions, RegistryValidationResult, SurveyPlayerItemRegistry } from './types';
3
- import { SurveyEditorLocalizations } from '../localization';
3
+ import { LocalizationCatalog } from '@case-framework/ui-localization';
4
4
  export declare function mergeCategoryLabelOverrides(base?: Partial<Record<ItemCategory, ItemLocaleMap>>, overrides?: Partial<Record<ItemCategory, ItemLocaleMap>>): Partial<Record<ItemCategory, ItemLocaleMap>> | undefined;
5
5
  export declare function validateRegistryEntries(entries: ItemRegistryEntry[], options: RegistryValidationOptions): RegistryValidationResult;
6
6
  /**
@@ -13,8 +13,8 @@ export declare function entriesToItemTypeRegistry(entries: ItemRegistryEntry[]):
13
13
  * Lightweight: core + renderer only. Use this for survey player / participant app.
14
14
  */
15
15
  export declare function entriesToParticipantRegistry(entries: ItemRegistryEntry[], options?: EntriesToParticipantRegistryOptions): SurveyPlayerItemRegistry;
16
- export declare function localizeRegistryEntries(entries: ItemRegistryEntry[], localizations?: SurveyEditorLocalizations): ItemRegistryEntry[];
17
- export declare function getCategoryLabelsFromLocalizations(localizations?: SurveyEditorLocalizations): Partial<Record<ItemCategory, ItemLocaleMap>> | undefined;
16
+ export declare function localizeRegistryEntries(entries: ItemRegistryEntry[], localizations?: LocalizationCatalog): ItemRegistryEntry[];
17
+ export declare function getCategoryLabelsFromLocalizations(localizations?: LocalizationCatalog): Partial<Record<ItemCategory, ItemLocaleMap>> | undefined;
18
18
  /**
19
19
  * Derive ComposedEditorItemRegistry from unified entries for the editor.
20
20
  * Ensures Group and PageBreak have definitions; uses coreRegistry from entries.
@@ -1,7 +1,8 @@
1
1
  import { AnyItemExpressionDefinition, ItemCoreConstructor, ItemTypeRegistry, RawSurveyItem, SurveyItemCore, RenderedSurveyItem, SurveyItemTranslations } from '@case-framework/survey-core';
2
2
  import { Target } from '@case-framework/survey-core/editor';
3
3
  import { default as React } from 'react';
4
- import { SurveyPlayerLocalizations } from '../../../../modules/survey-player/localization/types';
4
+ import { AssistantItemCapabilityAdapter, SurveyAssistantCapabilitySet } from '@case-framework/survey-assistant/engine';
5
+ import { LocalizationCatalog } from '@case-framework/ui-localization';
5
6
  import { ItemSearchAdapter } from './search-adapter';
6
7
  export type ItemCategory = string;
7
8
  export type ItemLocaleMap = Record<string, string>;
@@ -15,6 +16,12 @@ export interface ItemRendererComponentProps {
15
16
  renderedItem: RenderedSurveyItem;
16
17
  }
17
18
  export type ItemPreviewMode = "interactive" | "static";
19
+ export declare const ItemAuthoringStates: {
20
+ readonly blank: "blank";
21
+ readonly incomplete: "incomplete";
22
+ readonly ready: "ready";
23
+ };
24
+ export type ItemAuthoringState = (typeof ItemAuthoringStates)[keyof typeof ItemAuthoringStates];
18
25
  export interface ItemPreviewComponentProps<TItem extends SurveyItemCore = SurveyItemCore> {
19
26
  item: TItem;
20
27
  itemConfig: TItem["config"];
@@ -22,6 +29,13 @@ export interface ItemPreviewComponentProps<TItem extends SurveyItemCore = Survey
22
29
  locale: string;
23
30
  mode?: ItemPreviewMode;
24
31
  }
32
+ export interface ItemAuthoringStateContext<TItem extends SurveyItemCore = SurveyItemCore> {
33
+ item: TItem;
34
+ itemContent?: SurveyItemTranslations;
35
+ /** All locales available to the survey, used for locale-independent readiness checks. */
36
+ locales: string[];
37
+ locale: string;
38
+ }
25
39
  export interface ItemEditorCapabilities {
26
40
  usesValidationPanel?: boolean;
27
41
  usesTranslationPanel?: boolean;
@@ -36,6 +50,14 @@ export interface ItemInfos {
36
50
  icon: ItemIconComponent;
37
51
  labelByLocale: ItemLocaleMap;
38
52
  descriptionByLocale: ItemLocaleMap;
53
+ /**
54
+ * Optional recommendation shown when an author opens an empty survey preview.
55
+ * Entries are ordered by rank, allowing host registries to curate a simple first-step menu.
56
+ */
57
+ gettingStarted?: {
58
+ rank: number;
59
+ descriptionByLocale?: ItemLocaleMap;
60
+ };
39
61
  defaultItemClassName?: string;
40
62
  categories: ItemCategory[];
41
63
  }
@@ -44,14 +66,24 @@ export interface CreateItemContext {
44
66
  addItem: (target: Target, item: SurveyItemCore, content?: SurveyItemTranslations) => void;
45
67
  };
46
68
  targetParentId: string;
69
+ targetIndex?: number;
70
+ defaultItemKey: string;
47
71
  constructor: ItemCoreConstructor;
48
72
  }
49
73
  export interface EditorItemDefinition {
50
74
  itemType: string;
51
75
  infos: ItemInfos;
76
+ /** Optional assistant support for this item type. */
77
+ assistantCapability?: AssistantItemCapabilityAdapter;
78
+ defaultItemKeyPrefix?: string;
52
79
  editorComponent?: React.ComponentType<ItemEditorComponentProps>;
53
80
  renderComponent?: React.ComponentType<ItemRendererComponentProps>;
54
81
  previewComponent?: React.ComponentType<ItemPreviewComponentProps>;
82
+ /**
83
+ * Returns the editor-only content-readiness state used instead of a participant preview.
84
+ * Omit it to use the metadata-based fallback.
85
+ */
86
+ getAuthoringState?: (context: ItemAuthoringStateContext) => ItemAuthoringState;
55
87
  capabilities?: ItemEditorCapabilities;
56
88
  expressions?: AnyItemExpressionDefinition[];
57
89
  isRootOnly?: boolean;
@@ -64,7 +96,9 @@ export type EditorItemDefinitionRegistry = Record<string, EditorItemDefinition>;
64
96
  export interface ComposedEditorItemRegistry {
65
97
  coreRegistry: ItemTypeRegistry;
66
98
  definitions: EditorItemDefinitionRegistry;
67
- playerLocalizations: SurveyPlayerLocalizations;
99
+ /** Validated assistant capabilities, composed once with the registry. */
100
+ assistantCapabilities: SurveyAssistantCapabilitySet;
101
+ playerLocalizations: LocalizationCatalog;
68
102
  /**
69
103
  * Localized headings for category ids referenced in `ItemInfos.categories`.
70
104
  * Built by `entriesToComposedEditorRegistry` (merged with {@link DEFAULT_CATEGORY_LABELS}).
@@ -81,16 +115,22 @@ export interface ComposedEditorItemRegistry {
81
115
  */
82
116
  export interface ItemRegistryEntry {
83
117
  itemType: string;
118
+ /** Optional assistant support, colocated with the item definition. */
119
+ assistantCapability?: AssistantItemCapabilityAdapter;
84
120
  /** Item core constructor. Omit for built-in types (group, pageBreak) — they use survey-core's built-in registry. Omit for virtual "root" — it maps to Group with isRoot. */
85
121
  constructor?: ItemCoreConstructor;
86
122
  /** Participant renderer. Required for participant app. */
87
123
  renderComponent?: React.ComponentType<ItemRendererComponentProps>;
88
124
  /** Participant/player localization messages contributed by this entry. */
89
- playerLocalizations?: SurveyPlayerLocalizations;
125
+ playerLocalizations?: LocalizationCatalog;
90
126
  /** Editor-only: item preview renderer */
91
127
  previewComponent?: React.ComponentType<ItemPreviewComponentProps>;
128
+ /** Editor-only: determines whether this item is ready for a participant-facing preview. */
129
+ getAuthoringState?: (context: ItemAuthoringStateContext) => ItemAuthoringState;
92
130
  /** Editor-only: display metadata */
93
131
  infos?: ItemInfos;
132
+ /** Editor-only: default prefix for auto-generated data names in a parent group. */
133
+ defaultItemKeyPrefix?: string;
94
134
  /** Editor-only: card/editor UI */
95
135
  editorComponent?: React.ComponentType<ItemEditorComponentProps>;
96
136
  /** Shared: higher-level expression templates available for this item type. */
@@ -113,7 +153,7 @@ export type ItemRegistry = Record<string, ItemRegistryEntry>;
113
153
  export interface SurveyPlayerItemRegistry {
114
154
  coreRegistry: ItemTypeRegistry;
115
155
  getRenderer: (itemType: string) => React.ComponentType<ItemRendererComponentProps> | undefined;
116
- localizations: SurveyPlayerLocalizations;
156
+ localizations: LocalizationCatalog;
117
157
  }
118
158
  export interface EntriesToParticipantRegistryOptions {
119
159
  /** Throw when an entry in the provided list does not define a renderComponent. */
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export declare const AssistantAuthoringLockStatus: () => import("react/jsx-runtime").JSX.Element | null;
3
+ interface UserMutationBoundaryProps extends PropsWithChildren {
4
+ className?: string;
5
+ }
6
+ export declare const UserMutationBoundary: ({ children, className }: UserMutationBoundaryProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface EditorAssistantSlotContextValue {
2
+ available: boolean;
3
+ setTarget: (target: HTMLDivElement | null) => void;
4
+ }
5
+ export declare const EditorAssistantSlotContext: import('react').Context<EditorAssistantSlotContextValue>;
6
+ export declare const useEditorAssistantPanelAvailable: () => boolean;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ interface EditorAssistantPanelProviderProps {
3
+ children: ReactNode;
4
+ panel?: ReactNode;
5
+ }
6
+ export declare const EditorAssistantPanelProvider: ({ children, panel, }: EditorAssistantPanelProviderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const EditorAssistantPanelSlot: () => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ interface EditorModeSwitchProps {
2
+ label: string;
3
+ onClick: () => void;
4
+ className?: string;
5
+ }
6
+ export declare const EditorModeSwitch: ({ label, onClick, className }: EditorModeSwitchProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from 'react';
2
+ export interface EditorWorkspacePanelDefinition {
3
+ id: string;
4
+ label: string;
5
+ content: ReactNode | ((controller: EditorWorkspacePanelController) => ReactNode);
6
+ defaultOpen?: boolean;
7
+ defaultOpenAtViewportWidth?: number;
8
+ defaultSize: number;
9
+ minSize: number;
10
+ maxSize?: number;
11
+ onOpenChange?: (open: boolean) => void;
12
+ allowContentOverflow?: boolean;
13
+ }
14
+ export interface EditorWorkspacePanelController {
15
+ isOpen: boolean;
16
+ open: () => void;
17
+ close: () => void;
18
+ toggle: () => void;
19
+ }
20
+ interface EditorWorkspaceProps {
21
+ id: string;
22
+ toolbar: ReactNode;
23
+ main: ReactNode;
24
+ mainLabel: string;
25
+ primaryMinSize?: number;
26
+ left?: EditorWorkspacePanelDefinition;
27
+ right?: EditorWorkspacePanelDefinition;
28
+ }
29
+ export declare const EditorWorkspace: ({ id, toolbar, main, mainLabel, primaryMinSize, left, right, }: EditorWorkspaceProps) => import("react/jsx-runtime").JSX.Element;
30
+ export {};
@@ -1,2 +1,2 @@
1
- declare const EditorFooter: React.FC;
1
+ declare const EditorFooter: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default EditorFooter;
@@ -1,7 +1,7 @@
1
1
  interface EditorMainProps {
2
2
  onBackRequested?: () => void;
3
- onSimulatorRequested?: () => void;
4
3
  onSaveRequested: () => void;
4
+ onSimulatorRequested?: () => void;
5
5
  }
6
6
  declare const EditorMain: React.FC<EditorMainProps>;
7
7
  export default EditorMain;
@@ -0,0 +1,75 @@
1
+ export declare const editorWorkspacePresets: {
2
+ readonly editing: {
3
+ readonly id: "editing";
4
+ readonly primaryMinSize: 480;
5
+ readonly left: {
6
+ readonly id: "outline";
7
+ readonly defaultOpen: true;
8
+ readonly defaultSize: 240;
9
+ readonly minSize: 160;
10
+ readonly maxSize: 720;
11
+ };
12
+ readonly right: {
13
+ readonly id: "assistant";
14
+ readonly defaultOpen: false;
15
+ readonly defaultOpenAtViewportWidth: 1280;
16
+ readonly defaultSize: 360;
17
+ readonly minSize: 280;
18
+ readonly maxSize: 520;
19
+ readonly allowContentOverflow: true;
20
+ };
21
+ };
22
+ readonly preview: {
23
+ readonly id: "editing";
24
+ readonly primaryMinSize: 480;
25
+ readonly left: {
26
+ readonly id: "outline";
27
+ readonly defaultOpen: true;
28
+ readonly defaultSize: 240;
29
+ readonly minSize: 160;
30
+ readonly maxSize: 720;
31
+ };
32
+ readonly right: {
33
+ readonly id: "assistant";
34
+ readonly defaultOpen: false;
35
+ readonly defaultOpenAtViewportWidth: 1280;
36
+ readonly defaultSize: 360;
37
+ readonly minSize: 280;
38
+ readonly maxSize: 520;
39
+ readonly allowContentOverflow: true;
40
+ };
41
+ };
42
+ readonly translation: {
43
+ readonly id: "translation";
44
+ readonly primaryMinSize: 480;
45
+ readonly left: {
46
+ readonly id: "outline";
47
+ readonly defaultOpen: true;
48
+ readonly defaultSize: 240;
49
+ readonly minSize: 160;
50
+ readonly maxSize: 720;
51
+ };
52
+ readonly right: {
53
+ readonly id: "assistant";
54
+ readonly defaultOpen: false;
55
+ readonly defaultOpenAtViewportWidth: 1280;
56
+ readonly defaultSize: 360;
57
+ readonly minSize: 280;
58
+ readonly maxSize: 520;
59
+ readonly allowContentOverflow: true;
60
+ };
61
+ };
62
+ readonly assets: {
63
+ readonly id: "assets";
64
+ readonly primaryMinSize: 320;
65
+ readonly right: {
66
+ readonly id: "assistant";
67
+ readonly defaultOpen: false;
68
+ readonly defaultOpenAtViewportWidth: 1280;
69
+ readonly defaultSize: 360;
70
+ readonly minSize: 280;
71
+ readonly maxSize: 520;
72
+ readonly allowContentOverflow: true;
73
+ };
74
+ };
75
+ };
@@ -1,7 +1,7 @@
1
1
  interface EditorProps {
2
2
  onBackRequested?: () => void;
3
- onSimulatorRequested?: () => void;
4
3
  onSaveRequested?: () => void;
4
+ onSimulatorRequested?: () => void;
5
5
  }
6
6
  declare const Editor: React.FC<EditorProps>;
7
7
  export default Editor;
@@ -1,6 +1,5 @@
1
1
  interface ItemEditorToolbarProps {
2
2
  onBackRequested?: () => void;
3
- onSimulatorRequested?: () => void;
4
3
  onSaveRequested: () => void;
5
4
  }
6
5
  declare const ItemEditorToolbar: React.FC<ItemEditorToolbarProps>;
@@ -0,0 +1,3 @@
1
+ export declare const NavigableSurveyOutline: () => import("react/jsx-runtime").JSX.Element;
2
+ declare const EditableSurveyOutline: () => import("react/jsx-runtime").JSX.Element;
3
+ export default EditableSurveyOutline;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ export type SurveyWorkspaceMode = "editing" | "preview";
3
+ interface SurveyWorkspaceProps {
4
+ mode: SurveyWorkspaceMode;
5
+ main: ReactNode;
6
+ overlay?: ReactNode;
7
+ mainLabel: string;
8
+ onBackRequested?: () => void;
9
+ onSaveRequested: () => void;
10
+ }
11
+ export declare const SurveyWorkspace: ({ mode, main, overlay, mainLabel, onBackRequested, onSaveRequested, }: SurveyWorkspaceProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -1,6 +1,5 @@
1
1
  interface ItemEditorProps {
2
2
  onBackRequested?: () => void;
3
- onSimulatorRequested?: () => void;
4
3
  onSaveRequested: () => void;
5
4
  }
6
5
  declare const ItemEditor: React.FC<ItemEditorProps>;
@@ -0,0 +1,7 @@
1
+ interface PreviewModeProps {
2
+ onBackRequested?: () => void;
3
+ onSaveRequested: () => void;
4
+ onSimulatorRequested?: () => void;
5
+ }
6
+ declare const PreviewMode: ({ onBackRequested, onSaveRequested, onSimulatorRequested, }: PreviewModeProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default PreviewMode;
@@ -0,0 +1,6 @@
1
+ interface PageBreakDividerProps {
2
+ itemId: string;
3
+ highlighted: boolean;
4
+ }
5
+ export declare const PageBreakDivider: ({ itemId, highlighted }: PageBreakDividerProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,15 @@
1
+ import { PreviewPreferences } from './use-preview-preferences';
2
+ interface PreviewControlsProps {
3
+ preferences: PreviewPreferences;
4
+ onPreferencesChange: (updates: Partial<PreviewPreferences>) => void;
5
+ canLocate: boolean;
6
+ onLocate: () => void;
7
+ canReset: boolean;
8
+ onReset: () => void;
9
+ onSimulatorRequested?: () => void;
10
+ fullscreen: boolean;
11
+ onFullscreenChange: (fullscreen: boolean) => void;
12
+ expanded?: boolean;
13
+ }
14
+ export declare const PreviewControls: ({ preferences, onPreferencesChange, canLocate, onLocate, canReset, onReset, onSimulatorRequested, fullscreen, onFullscreenChange, expanded, }: PreviewControlsProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};