@craftile/editor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Craftile Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/app.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { CraftileEditor, CraftileEditorOptions } from './editor';
2
+ export interface CreateCraftileEditorOptions extends CraftileEditorOptions {
3
+ el?: string | HTMLElement;
4
+ }
5
+ export declare function createCraftileEditor(options?: CreateCraftileEditorOptions): CraftileEditor;
@@ -0,0 +1 @@
1
+ export declare const CRAFTILE_EDITOR_SYMBOL: unique symbol;
@@ -0,0 +1,2 @@
1
+ import { UIManager } from '../managers/ui';
2
+ export declare function registerDefaultConfigurationPanels(ui: UIManager): void;
@@ -0,0 +1,2 @@
1
+ import { UIManager } from '../managers/ui';
2
+ export declare function registerDefaultHeaderActions(ui: UIManager): void;
@@ -0,0 +1,2 @@
1
+ import { UIManager } from '../managers/ui';
2
+ export declare function registerDefaultKeyboardShortcuts(ui: UIManager): void;
@@ -0,0 +1,47 @@
1
+ import { Engine } from '@craftile/core';
2
+ import { EventBus } from '@craftile/event-bus';
3
+ import { Block, BlockSchema, Page } from '@craftile/types';
4
+ import { UIManager } from './managers/ui';
5
+ import { I18n, I18nConfig } from './types';
6
+ import { InsertBlockContext } from './composables/blocks-popover';
7
+ import { DevicesManager, DevicesManagerOptions } from './managers/devices';
8
+ import { PluginsManager } from './managers/plugins';
9
+ import { CraftileEditorPlugin } from './types/plugin';
10
+ import { PreviewManager } from './managers/preview';
11
+ import { InspectorManager } from './managers/inspector';
12
+ export type BlockLabelFunction = (block: Block, schema: BlockSchema | undefined) => string;
13
+ export type BlockFilterFunction = (blockSchema: BlockSchema, context: InsertBlockContext) => boolean;
14
+ export interface CraftileEditorOptions {
15
+ blockSchemas?: BlockSchema[];
16
+ initialPage?: Page;
17
+ devices?: DevicesManagerOptions;
18
+ i18n?: I18nConfig;
19
+ plugins?: CraftileEditorPlugin[];
20
+ blockLabelFunction?: BlockLabelFunction;
21
+ blockFilterFunction?: BlockFilterFunction;
22
+ previewUpdateDelay?: number;
23
+ }
24
+ export declare class CraftileEditor {
25
+ readonly engine: Engine;
26
+ readonly ui: UIManager;
27
+ readonly i18n: I18n;
28
+ readonly events: EventBus;
29
+ readonly devices: DevicesManager;
30
+ readonly preview: PreviewManager;
31
+ readonly plugins: PluginsManager;
32
+ readonly inspector: InspectorManager;
33
+ readonly blockLabelFunction?: BlockLabelFunction;
34
+ readonly blockFilterFunction?: BlockFilterFunction;
35
+ readonly previewUpdateDelay?: number;
36
+ private vueApp;
37
+ constructor(options?: CraftileEditorOptions);
38
+ /**
39
+ * Shortcut method to get the current selected block
40
+ */
41
+ getActiveBlock(): Block | undefined;
42
+ getBlockProperty(blockId: string, propertyKey: string): any;
43
+ setBlockProperty(blockId: string, propertyKey: string, propertyValue: any): void;
44
+ private setup;
45
+ private setupEngineWatcher;
46
+ mount(element: string | HTMLElement): void;
47
+ }
@@ -0,0 +1,2 @@
1
+ export * from './app';
2
+ export * from './types';