@templatical/core 0.10.0 → 0.10.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.
@@ -0,0 +1,46 @@
1
+ import { Block, TemplateContent, TemplateDefaults, TemplateSettings, UiTheme, ViewportSize } from "@templatical/types";
2
+ import { DeepReadonly, Ref } from "@vue/reactivity";
3
+
4
+ //#region src/editor.d.ts
5
+ interface EditorState$1 {
6
+ content: TemplateContent;
7
+ selectedBlockId: string | null;
8
+ viewport: ViewportSize;
9
+ darkMode: boolean;
10
+ previewMode: boolean;
11
+ isDirty: boolean;
12
+ uiTheme: UiTheme;
13
+ }
14
+ interface UseEditorOptions {
15
+ content: TemplateContent;
16
+ defaultFontFamily?: string;
17
+ templateDefaults?: TemplateDefaults;
18
+ lockedBlocks?: Ref<Map<string, unknown>>;
19
+ }
20
+ interface UseEditorReturn {
21
+ state: DeepReadonly<EditorState$1>;
22
+ content: Ref<TemplateContent>;
23
+ selectedBlock: Ref<Block | null>;
24
+ setContent: (content: TemplateContent, markDirty?: boolean) => void;
25
+ selectBlock: (blockId: string | null) => void;
26
+ setViewport: (viewport: ViewportSize) => void;
27
+ setDarkMode: (darkMode: boolean) => void;
28
+ setPreviewMode: (previewMode: boolean) => void;
29
+ setUiTheme: (theme: UiTheme) => void;
30
+ updateBlock: (blockId: string, updates: Partial<Block>) => void;
31
+ updateSettings: (updates: Partial<TemplateSettings>) => void;
32
+ addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
33
+ removeBlock: (blockId: string) => void;
34
+ moveBlock: (blockId: string, newIndex: number, targetSectionId?: string, columnIndex?: number) => void;
35
+ isBlockLocked: (blockId: string) => boolean;
36
+ markDirty: () => void;
37
+ findBlockLocation: (blockId: string) => {
38
+ targetSectionId?: string;
39
+ columnIndex?: number;
40
+ index: number;
41
+ } | null;
42
+ }
43
+ declare function useEditor(options: UseEditorOptions): UseEditorReturn;
44
+ //#endregion
45
+ export { useEditor as i, UseEditorOptions as n, UseEditorReturn as r, EditorState$1 as t };
46
+ //# sourceMappingURL=editor-zvlM4bZ7.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,85 +1,90 @@
1
- import { a as UseEditorReturn } from './editor-D7sbEq2_.js';
2
- export { E as EditorState, U as UseEditorOptions, u as useEditor } from './editor-D7sbEq2_.js';
3
- import { TemplateContent, Block, BlockDefaults, BlockType, CustomBlockDefinition, CustomBlock } from '@templatical/types';
4
- import { Ref, ComputedRef } from '@vue/reactivity';
1
+ import { i as useEditor, n as UseEditorOptions, r as UseEditorReturn, t as EditorState } from "./editor-zvlM4bZ7.js";
2
+ import { Block, BlockDefaults, BlockType, CustomBlock, CustomBlockDefinition, TemplateContent } from "@templatical/types";
3
+ import { ComputedRef, Ref } from "@vue/reactivity";
5
4
 
5
+ //#region src/history.d.ts
6
6
  interface UseHistoryOptions {
7
- content: Ref<TemplateContent>;
8
- setContent: (content: TemplateContent, markDirty?: boolean) => void;
9
- isRemoteOperation?: () => boolean;
10
- maxSize?: number;
7
+ content: Ref<TemplateContent>;
8
+ setContent: (content: TemplateContent, markDirty?: boolean) => void;
9
+ isRemoteOperation?: () => boolean;
10
+ maxSize?: number;
11
11
  }
12
12
  interface UseHistoryReturn {
13
- canUndo: ComputedRef<boolean>;
14
- canRedo: ComputedRef<boolean>;
15
- isNavigating: Ref<boolean>;
16
- undo: () => void;
17
- redo: () => void;
18
- record: () => void;
19
- recordDebounced: (blockId: string) => void;
20
- clear: () => void;
21
- destroy: () => void;
13
+ canUndo: ComputedRef<boolean>;
14
+ canRedo: ComputedRef<boolean>;
15
+ isNavigating: Ref<boolean>;
16
+ undo: () => void;
17
+ redo: () => void;
18
+ record: () => void;
19
+ recordDebounced: (blockId: string) => void;
20
+ clear: () => void;
21
+ destroy: () => void;
22
22
  }
23
23
  declare function useHistory(options: UseHistoryOptions): UseHistoryReturn;
24
-
24
+ //#endregion
25
+ //#region src/block-actions.d.ts
25
26
  interface UseBlockActionsOptions {
26
- addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
27
- removeBlock: (blockId: string) => void;
28
- updateBlock: (blockId: string, updates: Partial<Block>) => void;
29
- selectBlock: (blockId: string | null) => void;
30
- /** Locate a block in the tree — used by `duplicateBlock` to insert the
31
- * clone right after the source instead of appending to the end. */
32
- findBlockLocation?: (blockId: string) => {
33
- targetSectionId?: string;
34
- columnIndex?: number;
35
- index: number;
36
- } | null;
37
- blockDefaults?: BlockDefaults;
27
+ addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
28
+ removeBlock: (blockId: string) => void;
29
+ updateBlock: (blockId: string, updates: Partial<Block>) => void;
30
+ selectBlock: (blockId: string | null) => void;
31
+ /** Locate a block in the tree — used by `duplicateBlock` to insert the
32
+ * clone right after the source instead of appending to the end. */
33
+ findBlockLocation?: (blockId: string) => {
34
+ targetSectionId?: string;
35
+ columnIndex?: number;
36
+ index: number;
37
+ } | null;
38
+ blockDefaults?: BlockDefaults;
38
39
  }
39
40
  interface UseBlockActionsReturn {
40
- createAndAddBlock: (type: BlockType, targetSectionId?: string, columnIndex?: number) => Block;
41
- duplicateBlock: (block: Block, targetSectionId?: string, columnIndex?: number) => Block;
42
- deleteBlock: (blockId: string) => void;
43
- updateBlockProperty: <K extends keyof Block>(blockId: string, key: K, value: Block[K]) => void;
41
+ createAndAddBlock: (type: BlockType, targetSectionId?: string, columnIndex?: number) => Block;
42
+ duplicateBlock: (block: Block, targetSectionId?: string, columnIndex?: number) => Block;
43
+ deleteBlock: (blockId: string) => void;
44
+ updateBlockProperty: <K extends keyof Block>(blockId: string, key: K, value: Block[K]) => void;
44
45
  }
45
46
  declare function useBlockActions(options: UseBlockActionsOptions): UseBlockActionsReturn;
46
-
47
+ //#endregion
48
+ //#region src/auto-save.d.ts
47
49
  interface UseAutoSaveOptions {
48
- content: Ref<TemplateContent>;
49
- isDirty: () => boolean;
50
- onChange: (content: TemplateContent) => void;
51
- debounce?: number;
52
- enabled?: boolean | (() => boolean);
50
+ content: Ref<TemplateContent>;
51
+ isDirty: () => boolean;
52
+ onChange: (content: TemplateContent) => void;
53
+ debounce?: number;
54
+ enabled?: boolean | (() => boolean);
53
55
  }
54
56
  interface UseAutoSaveReturn {
55
- flush: () => void;
56
- cancel: () => void;
57
- pause: () => void;
58
- resume: () => void;
59
- destroy: () => void;
57
+ flush: () => void;
58
+ cancel: () => void;
59
+ pause: () => void;
60
+ resume: () => void;
61
+ destroy: () => void;
60
62
  }
61
63
  declare function useAutoSave(options: UseAutoSaveOptions): UseAutoSaveReturn;
62
-
64
+ //#endregion
65
+ //#region src/condition-preview.d.ts
63
66
  interface UseConditionPreviewReturn {
64
- isHidden: (blockId: string) => boolean;
65
- toggleBlock: (blockId: string) => void;
66
- reset: () => void;
67
- hasHiddenBlocks: ComputedRef<boolean>;
67
+ isHidden: (blockId: string) => boolean;
68
+ toggleBlock: (blockId: string) => void;
69
+ reset: () => void;
70
+ hasHiddenBlocks: ComputedRef<boolean>;
68
71
  }
69
72
  declare function useConditionPreview(editor: UseEditorReturn): UseConditionPreviewReturn;
70
-
73
+ //#endregion
74
+ //#region src/data-source-fetch.d.ts
71
75
  declare function useDataSourceFetch(options: {
72
- definition: ComputedRef<CustomBlockDefinition | undefined>;
73
- block: ComputedRef<CustomBlock>;
74
- onUpdate: (fieldValues: Record<string, unknown>, fetched: boolean) => void;
76
+ definition: ComputedRef<CustomBlockDefinition | undefined>;
77
+ block: ComputedRef<CustomBlock>;
78
+ onUpdate: (fieldValues: Record<string, unknown>, fetched: boolean) => void;
75
79
  }): {
76
- isFetching: Ref<boolean>;
77
- fetchError: Ref<boolean>;
78
- fetch: () => Promise<void>;
79
- hasDataSource: ComputedRef<boolean>;
80
- needsFetch: ComputedRef<boolean>;
80
+ isFetching: Ref<boolean>;
81
+ fetchError: Ref<boolean>;
82
+ fetch: () => Promise<void>;
83
+ hasDataSource: ComputedRef<boolean>;
84
+ needsFetch: ComputedRef<boolean>;
81
85
  };
82
-
86
+ //#endregion
87
+ //#region src/history-interceptor.d.ts
83
88
  /**
84
89
  * Wraps editor mutation methods to record history snapshots before each
85
90
  * operation. Mutates the editor object in place.
@@ -88,5 +93,6 @@ declare function useDataSourceFetch(options: {
88
93
  * call chain is: history.record() → broadcast → original mutation.
89
94
  */
90
95
  declare function useHistoryInterceptor(editor: UseEditorReturn, history: UseHistoryReturn): void;
91
-
92
- export { type UseAutoSaveOptions, type UseAutoSaveReturn, type UseBlockActionsOptions, type UseBlockActionsReturn, type UseConditionPreviewReturn, UseEditorReturn, type UseHistoryOptions, type UseHistoryReturn, useAutoSave, useBlockActions, useConditionPreview, useDataSourceFetch, useHistory, useHistoryInterceptor };
96
+ //#endregion
97
+ export { type EditorState, type UseAutoSaveOptions, type UseAutoSaveReturn, type UseBlockActionsOptions, type UseBlockActionsReturn, type UseConditionPreviewReturn, type UseEditorOptions, type UseEditorReturn, type UseHistoryOptions, type UseHistoryReturn, useAutoSave, useBlockActions, useConditionPreview, useDataSourceFetch, useEditor, useHistory, useHistoryInterceptor };
98
+ //# sourceMappingURL=index.d.ts.map