@case-framework/survey-editor-ui 0.4.0 → 0.4.2
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/dist/src/components/rich-text-editor/plugins/block-shortcut-plugin.d.ts +7 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-utils.d.ts +22 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/deferred-localized-rich-text-field.d.ts +4 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/constants.d.ts +0 -2
- package/dist/src/modules/survey-editor/editor-card/add-items/types.d.ts +0 -9
- package/dist/src/modules/survey-editor/preview-viewport-toggle.d.ts +11 -0
- package/dist/src/modules/survey-editor/preview-viewport.d.ts +15 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-tree.d.ts +1 -2
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/use-preview-preferences.d.ts +2 -1
- package/dist/survey-editor-ui.cjs.js +60 -60
- package/dist/survey-editor-ui.cjs.js.map +1 -1
- package/dist/survey-editor-ui.css +1 -1
- package/dist/survey-editor-ui.es.js +8952 -8766
- package/dist/survey-editor-ui.es.js.map +1 -1
- package/package.json +2 -2
- package/dist/src/modules/survey-editor/editor-card/add-items/views/back-button.d.ts +0 -5
- package/dist/src/modules/survey-editor/editor-card/add-items/views/blank-item-view.d.ts +0 -13
- package/dist/src/modules/survey-editor/editor-card/add-items/views/entry-view.d.ts +0 -15
- package/dist/src/modules/survey-editor/editor-card/add-items/views/structure-view.d.ts +0 -16
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface BlockShortcutPluginProps {
|
|
2
|
+
bulletListsEnabled: boolean;
|
|
3
|
+
headingsEnabled: boolean;
|
|
4
|
+
}
|
|
5
|
+
/** Converts an exact marker-only root paragraph while the space key is being handled. */
|
|
6
|
+
export declare function $convertBlockShortcut(bulletListsEnabled: boolean, headingsEnabled: boolean): boolean;
|
|
7
|
+
export declare function BlockShortcutPlugin({ bulletListsEnabled, headingsEnabled, }: BlockShortcutPluginProps): null;
|
|
@@ -42,6 +42,11 @@ export type SerializedRichTextLinkNode = Spread<{
|
|
|
42
42
|
}, SerializedTextNode>;
|
|
43
43
|
/** Semantic buckets for slash menu grouping (visual sections in the picker). */
|
|
44
44
|
export type SlashCommandGroupId = "formatting" | "blocks" | "insert";
|
|
45
|
+
/**
|
|
46
|
+
* Block styles exposed by the rich-text toolbar.
|
|
47
|
+
*/
|
|
48
|
+
export type RichTextBlockStyle = "bullet-list" | "heading-1" | "heading-2" | "paragraph";
|
|
49
|
+
export type RichTextBlockSelectionStyle = RichTextBlockStyle | "mixed";
|
|
45
50
|
export declare const SLASH_COMMAND_GROUP_ORDER: Record<SlashCommandGroupId, number>;
|
|
46
51
|
export type SlashCommandItem = {
|
|
47
52
|
key: string;
|
|
@@ -76,6 +81,12 @@ export type SlashCommandItem = {
|
|
|
76
81
|
group: SlashCommandGroupId;
|
|
77
82
|
kind: "heading";
|
|
78
83
|
level: RichTextHeadingBlock["level"];
|
|
84
|
+
} | {
|
|
85
|
+
key: "paragraph";
|
|
86
|
+
label: string;
|
|
87
|
+
keywords: string[];
|
|
88
|
+
group: SlashCommandGroupId;
|
|
89
|
+
kind: "paragraph";
|
|
79
90
|
} | {
|
|
80
91
|
key: string;
|
|
81
92
|
label: string;
|
|
@@ -106,6 +117,17 @@ export declare function resolveStyleControl(control: RichTextStyleControl): {
|
|
|
106
117
|
};
|
|
107
118
|
export declare function getSlashCommandItems(styleControls: RichTextStyleControl[], templateVariables: RichTextTemplateVariable[], linksEnabled?: boolean, bulletListsEnabled?: boolean, headingsEnabled?: boolean, infoBoxesEnabled?: boolean, imagesEnabled?: boolean, separatorsEnabled?: boolean): SlashCommandItem[];
|
|
108
119
|
export declare function $insertSurveyRichTextHeading(level: RichTextHeadingBlock["level"]): boolean;
|
|
120
|
+
export declare function $insertSurveyRichTextParagraph(): boolean;
|
|
121
|
+
/** Returns a shared style, "mixed" for supported mixed blocks, or null if unsupported. */
|
|
122
|
+
export declare function $getCurrentRichTextBlockStyle(): RichTextBlockSelectionStyle | null;
|
|
123
|
+
/** Changes a supported selection through Lexical's normal block/list transforms. */
|
|
124
|
+
export declare function $setCurrentRichTextBlockStyle(style: RichTextBlockStyle): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Reuses an empty root paragraph, otherwise creates one immediately after the
|
|
127
|
+
* current root block. Insert commands use this staging block so existing
|
|
128
|
+
* content is never converted or replaced.
|
|
129
|
+
*/
|
|
130
|
+
export declare function $insertRichTextBlockAfterCurrentBlock(): boolean;
|
|
109
131
|
/** Nearest paragraph or survey heading that supports Lexical element format (block text-align). */
|
|
110
132
|
export declare function $getRichTextBlockForAlignment(selection: RangeSelection): ParagraphNode | SurveyRichTextHeadingNode | null;
|
|
111
133
|
/** Direct children of the editor root that contain any part of the range (paragraph, list, image, etc.). */
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { SurveyEditor } from './modules/survey-editor';
|
|
2
|
+
export { getPreviewViewportScreenSize, getPreviewViewportWidth, PREVIEW_VIEWPORTS, PREVIEW_VIEWPORT_VALUES, } from './modules/survey-editor/preview-viewport';
|
|
3
|
+
export type { PreviewViewport } from './modules/survey-editor/preview-viewport';
|
|
4
|
+
export { PreviewViewportToggle } from './modules/survey-editor/preview-viewport-toggle';
|
|
2
5
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, } from './components/ui/dialog';
|
|
3
6
|
export { APPLY_RICH_TEXT_STYLE_COMMAND, buildSurveyFileName, buildSurveyAssistantItemRegistryManifest, buildSurveyAssistantSnapshot, createSnapshotSurveyEditorAIProvider, useSurveyEditorAssistantIntegration, createBlankEditorState, createEditorStateFromRawSurvey, createRichTextEditorValueFromContent, createRichTextEditorValueFromPlainText, createRichTextEditorValueFromText, DEFAULT_EDITOR_LANGUAGE, DEFAULT_DATE_FNS_LOCALES, DEFAULT_CATEGORY_LABELS, DEFAULT_BLOCK_CONTENT_POLICY, DEFAULT_COMPACT_CONTENT_POLICY, defaultSurveyEditorLocalizations, RichTextEditor, RichTextBlockEditor, CONVERT_RICH_TEXT_LINK_TO_TEXT_COMMAND, INSERT_RICH_TEXT_LINK_COMMAND, INSERT_RICH_TEXT_TEMPLATE_VARIABLE_COMMAND, getDateFnsLocale, isBlockContentPolicyVariant, mergeDateFnsLocales, mergeEditorLocalizations, mergeRichTextContentPolicy, OPEN_RICH_TEXT_LINK_EDITOR_COMMAND, RichTextContentView, sanitizeContentForPolicy, SurveyImageAssetManager, surveyEditorEnMessages, surveyEditorNlMessages, UPDATE_RICH_TEXT_LINK_COMMAND, entriesToComposedEditorRegistry, entriesToParticipantRegistry, entriesToItemTypeRegistry, getRichTextContentFromEditorState, parseEditorStateFromJsonText, resolveCategoryLabel, serializeSurveyStateForFile, useSurveyAssets, useSurveyImageAssets, useUnusedSurveyAssetCount, validateRegistryEntries, } from './modules/survey-editor';
|
|
4
7
|
export { FilepickerDropzone } from './components/c-ui/filepicker-dropzone';
|
|
@@ -9,6 +9,10 @@ export interface DeferredLocalizedRichTextFieldProps {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
/** Omit Field chrome; use for inline question title/subtitle. */
|
|
11
11
|
bare?: boolean;
|
|
12
|
+
/** Focus the editor as soon as it is mounted. */
|
|
13
|
+
autoFocus?: boolean;
|
|
14
|
+
/** Where to place the selection when the editor receives autofocus. */
|
|
15
|
+
autoFocusSelection?: "rootStart" | "rootEnd";
|
|
12
16
|
contentPolicy?: RichTextContentPolicy;
|
|
13
17
|
wrapperClassName?: string;
|
|
14
18
|
surfaceClassName?: string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export declare const LAST_USED_ADD_ITEM_PRESET_KEY = "case.survey-editor.last-used-add-item-preset";
|
|
2
2
|
export declare const RECENT_ADD_ITEM_PRESETS_KEY = "case.survey-editor.recent-add-item-presets";
|
|
3
3
|
export declare const MAX_RECENT_ITEM_TYPES = 5;
|
|
4
|
-
export declare const DEFAULT_TOP_ITEM_TYPES: readonly ["infoItem", "formItem"];
|
|
5
|
-
export declare const STRUCTURE_ITEM_TYPES: Set<string>;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { LucideIcon } from 'lucide-react';
|
|
2
1
|
import { ItemTypeInfos } from '../../../../../modules/survey-editor/utils/item-type-infos';
|
|
3
|
-
export type AddDialogView = "entry" | "blank-item" | "structure" | "catalogue";
|
|
4
2
|
export interface ItemTypeOption extends ItemTypeInfos {
|
|
5
3
|
presetId: string;
|
|
6
4
|
itemType: string;
|
|
7
5
|
categories: string[];
|
|
8
6
|
}
|
|
9
|
-
export interface EntryOption {
|
|
10
|
-
id: AddDialogView;
|
|
11
|
-
title: string;
|
|
12
|
-
description: string;
|
|
13
|
-
icon: LucideIcon;
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
}
|
|
16
7
|
export interface TargetGroupInfo {
|
|
17
8
|
id: string;
|
|
18
9
|
itemKey?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PreviewViewport } from './preview-viewport';
|
|
2
|
+
interface PreviewViewportToggleProps {
|
|
3
|
+
viewport: PreviewViewport;
|
|
4
|
+
onViewportChange: (viewport: PreviewViewport) => void;
|
|
5
|
+
ariaLabel: string;
|
|
6
|
+
getViewportLabel: (viewport: PreviewViewport) => string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The viewport toggle shared by the expanded authoring preview and simulators. */
|
|
10
|
+
export declare const PreviewViewportToggle: ({ viewport, onViewportChange, ariaLabel, getViewportLabel, className, }: PreviewViewportToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScreenSize } from '@case-framework/survey-core';
|
|
2
|
+
/**
|
|
3
|
+
* Named host widths used when previewing a survey in the editor or simulator.
|
|
4
|
+
*
|
|
5
|
+
* These widths describe the container supplied to the player. They are not a
|
|
6
|
+
* layout constraint imposed by the player or stored in the survey document.
|
|
7
|
+
*/
|
|
8
|
+
export type PreviewViewport = "mobile" | "tablet" | "desktop" | "wide";
|
|
9
|
+
export declare const PREVIEW_VIEWPORT_VALUES: readonly ["mobile", "tablet", "desktop", "wide"];
|
|
10
|
+
export declare const PREVIEW_VIEWPORTS: Record<PreviewViewport, {
|
|
11
|
+
width: number;
|
|
12
|
+
screenSize: ScreenSize;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const getPreviewViewportWidth: (viewport: PreviewViewport) => number;
|
|
15
|
+
export declare const getPreviewViewportScreenSize: (viewport: PreviewViewport) => ScreenSize;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Survey, SurveyItemCore } from '@case-framework/survey-core';
|
|
2
|
+
import { PreviewViewport } from '../../../../../../modules/survey-editor/preview-viewport';
|
|
2
3
|
export type PreviewLayout = "single" | "paginated";
|
|
3
|
-
export type PreviewViewport = "mobile" | "tablet" | "desktop" | "wide";
|
|
4
|
-
export declare const PREVIEW_VIEWPORT_WIDTHS: Record<PreviewViewport, number>;
|
|
5
4
|
/** Returns every non-group item in authored tree order, including page breaks. */
|
|
6
5
|
export declare const flattenPreviewItems: (survey: Survey) => SurveyItemCore[];
|
|
7
6
|
/**
|
package/dist/src/modules/survey-editor/routes/editor/preview-mode/use-preview-preferences.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PreviewLayout
|
|
1
|
+
import { PreviewLayout } from './preview-tree';
|
|
2
|
+
import { PreviewViewport } from '../../../../../../modules/survey-editor/preview-viewport';
|
|
2
3
|
export interface PreviewPreferences {
|
|
3
4
|
layout: PreviewLayout;
|
|
4
5
|
viewport: PreviewViewport;
|