@skaile/forge-editor 6.2.1 → 6.4.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/CHANGELOG.md +20 -1
- package/dist/adapters/nitro.d.ts +11 -3
- package/dist/adapters/nitro.js +2 -1
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +1 -1
- package/dist/features/ai/index.d.ts +2 -2
- package/dist/features/ai/index.js +2 -2
- package/dist/features/ai/protocol/chat.d.ts +5 -0
- package/dist/features/ai/protocol/chat.js +7 -4
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +2 -2
- package/dist/features/ai/protocol/index.js +2 -2
- package/dist/features/composites/components/CompositeInspector.js +8 -8
- package/dist/features/composites/components/SettingsEditingTab.js +16 -3
- package/dist/features/composites/components/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/feature.js +26 -6
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/index.d.ts +2 -2
- package/dist/features/composites/index.js +2 -2
- package/dist/features/composites/react/SettingsEditingTab.js +22 -0
- package/dist/features/composites/react/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/split.d.ts +19 -1
- package/dist/features/composites/split.js +57 -4
- package/dist/features/composites/split.js.map +1 -1
- package/dist/features/composites/vue.js +1 -1
- package/dist/i18n/de/composites.js +4 -0
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de.d.ts +4 -0
- package/dist/i18n/en/composites.js +4 -0
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +1 -1
- package/dist/server/chat-agent.d.ts +85 -0
- package/dist/server/chat-agent.js +61 -0
- package/dist/server/chat-agent.js.map +1 -0
- package/dist/server/document-tools.d.ts +22 -0
- package/dist/server/document-tools.js +190 -0
- package/dist/server/document-tools.js.map +1 -0
- package/dist/server/handlers/ai.d.ts +2 -1
- package/dist/server/handlers/ai.js +232 -121
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +4 -1
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +1 -0
- package/dist/server/index.d.ts +7 -3
- package/dist/server/index.js +5 -2
- package/dist/server/workspace-tools.d.ts +1 -0
- package/dist/server/workspace-tools.js +8 -3
- package/dist/server/workspace-tools.js.map +1 -1
- package/dist/settings/index.d.ts +3 -0
- package/dist/settings/index.js +7 -3
- package/dist/settings/index.js.map +1 -1
- package/dist/tree/DocumentTree.js +1 -1
- package/dist/tree/use-tree-model.js +1 -1
- package/dist/vue/compose.js +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/settings/index.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n AI_LANGUAGES,\n type AiLanguage,\n AUTHOR_COLOR_STYLES,\n type AuthorColorStyle,\n BLOCK_TYPE_ICON_VISIBILITIES,\n type BlockTypeIconVisibility,\n COMMENTS_LAYOUTS,\n type CommentsLayout,\n DRAG_HANDLE_VISIBILITIES,\n type DragHandleVisibility,\n HEADING_CONVERSION_SCOPES,\n type HeadingConversionScope,\n MODEL_ROLES,\n type ModelRole,\n STRUCTURE_MODES,\n type StructureMode,\n TREE_ROOTS,\n type TreeRoot,\n} from './values'\nimport { EDITOR_SETTINGS_VERSION, migrateEditorSettings } from './migrate'\n\nexport * from './values'\nexport { EDITOR_SETTINGS_VERSION, isOutdatedEditorSettings, migrateEditorSettings } from './migrate'\n\n/** Valid theme id: lowercase slug, used as directory name and in `/api/editor/themes/:id`. Defined here so core never imports a feature. */\nexport const THEME_ID = /^[a-z0-9][a-z0-9-]{0,63}$/\n\n/** A user's editor preferences, shared by all editors on the page; persisted per user through the `settings` port. */\nexport interface EditorSettings {\n version: typeof EDITOR_SETTINGS_VERSION\n editing: {\n /** Blocks „Gliederung umwandeln“ (both directions) converts when nothing is selected. */\n headingConversionScope: HeadingConversionScope\n /** Text is tinted per author (authors feature): each run in the colour of the user who wrote it. */\n authorColors: boolean\n /** `background`: tinted background; `text`: text in the author's colour. */\n authorColorStyle: AuthorColorStyle\n /** `margin`: comment cards in a column beside the text; `inline`: popover at the text plus the toolbar's list (comments feature). */\n commentsLayout: CommentsLayout\n }\n ai: {\n /** Ghost-text suggestions while typing (`GhostAutocomplete`). */\n autocomplete: boolean\n /** Model profile id per model role; a missing or unknown id falls back to the server's default preset for the role. */\n roles: Partial<Record<ModelRole, string>>\n /** Preselected target language of „Übersetzen“. */\n translateLanguage: AiLanguage\n }\n blocks: {\n /** Block type id the Typed block shortcuts create (toolbar button, heading conversion). */\n defaultBlockType: string\n /** Preferred document structure: toolbar block types and the structure of AI-generated blocks. */\n structure: StructureMode\n /** Root of the document drawer while a Document with Typed blocks is loaded: nested in the folders, or the file itself. */\n treeRoot: TreeRoot\n /** Block type icon of Typed blocks (their drag handle): always visible, or only on hover, focus or while the details are open. */\n blockTypeIcon: BlockTypeIconVisibility\n /** Standard drag handle of blocks without Block type icon: on the hovered block, or permanently beside every block. */\n dragHandle: DragHandleVisibility\n /** Target size in characters of the parts a length split cuts a Typed block into (200–20000). */\n splitTargetChars: number\n }\n appearance: {\n /** Id of the Obsidian theme applied to the whole app (themes feature); `null` = the standard Nuxt UI look. */\n theme: string | null\n }\n}\n\n/** Bounds of `blocks.splitTargetChars`. */\nexport const SPLIT_TARGET_CHARS_MIN = 200\nexport const SPLIT_TARGET_CHARS_MAX = 20000\n\n/** The split target typed into the field as a valid setting: rounded and clamped to its bounds; `current` when `typed` is empty or not a number. */\nexport function clampSplitTargetChars(typed: string, current: number): number {\n const value = Math.round(Number(typed))\n return typed.trim() !== '' && Number.isFinite(value) ? Math.min(SPLIT_TARGET_CHARS_MAX, Math.max(SPLIT_TARGET_CHARS_MIN, value)) : current\n}\n\nexport const EDITOR_SETTINGS_DEFAULTS: EditorSettings = {\n version: EDITOR_SETTINGS_VERSION,\n editing: { headingConversionScope: 'container', authorColors: false, authorColorStyle: 'background', commentsLayout: 'margin' },\n ai: { autocomplete: false, roles: {}, translateLanguage: 'Englisch' },\n blocks: { defaultBlockType: 'section', structure: 'structured', treeRoot: 'folders', blockTypeIcon: 'always', dragHandle: 'hover', splitTargetChars: 1500 },\n appearance: { theme: null },\n}\n\nconst headingConversionScopeSchema = z.enum(HEADING_CONVERSION_SCOPES)\nconst authorColorsSchema = z.boolean()\nconst authorColorStyleSchema = z.enum(AUTHOR_COLOR_STYLES)\nconst commentsLayoutSchema = z.enum(COMMENTS_LAYOUTS)\nconst autocompleteSchema = z.boolean()\nconst profileIdSchema = z.string().min(1).max(100)\nconst translateLanguageSchema = z.enum(AI_LANGUAGES)\nconst defaultBlockTypeSchema = z.string().min(1).max(100)\nconst structureSchema = z.enum(STRUCTURE_MODES)\nconst treeRootSchema = z.enum(TREE_ROOTS)\nconst blockTypeIconSchema = z.enum(BLOCK_TYPE_ICON_VISIBILITIES)\nconst dragHandleSchema = z.enum(DRAG_HANDLE_VISIBILITIES)\nconst splitTargetCharsSchema = z.number().int().min(SPLIT_TARGET_CHARS_MIN).max(SPLIT_TARGET_CHARS_MAX)\nconst themeSchema = z.string().regex(THEME_ID).nullable()\n\n/** Complete, valid settings (the body of `PUT /api/editor/settings`). */\nexport const editorSettingsSchema = z.object({\n version: z.literal(EDITOR_SETTINGS_VERSION),\n editing: z.object({\n headingConversionScope: headingConversionScopeSchema,\n authorColors: authorColorsSchema,\n authorColorStyle: authorColorStyleSchema,\n commentsLayout: commentsLayoutSchema,\n }),\n ai: z.object({\n autocomplete: autocompleteSchema,\n roles: z.partialRecord(z.enum(MODEL_ROLES), profileIdSchema),\n translateLanguage: translateLanguageSchema,\n }),\n blocks: z.object({\n defaultBlockType: defaultBlockTypeSchema,\n structure: structureSchema,\n treeRoot: treeRootSchema,\n blockTypeIcon: blockTypeIconSchema,\n dragHandle: dragHandleSchema,\n splitTargetChars: splitTargetCharsSchema,\n }),\n appearance: z.object({ theme: themeSchema }),\n}) satisfies z.ZodType<EditorSettings>\n\nfunction record(value: unknown): Record<string, unknown> {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}\n}\n\nfunction valid<T>(schema: z.ZodType<T>, value: unknown, fallback: T): T {\n const parsed = schema.safeParse(value)\n return parsed.success ? parsed.data : fallback\n}\n\n/**\n * Deep-merges unknown input over the defaults; unknown keys dropped, invalid values replaced. Reads older stored settings\n * through `migrateEditorSettings` (`./migrate`), including the legacy flat `{ headingConversionScope }` per-browser shape.\n * Always returns fresh objects of the current version.\n */\nexport function parseEditorSettings(input: unknown): EditorSettings {\n const root = record(migrateEditorSettings(input))\n const editing = record(root.editing)\n const ai = record(root.ai)\n const roles = record(ai.roles)\n const blocks = record(root.blocks)\n const appearance = record(root.appearance)\n const defaults = EDITOR_SETTINGS_DEFAULTS\n const legacyScope = valid(headingConversionScopeSchema, root.headingConversionScope, defaults.editing.headingConversionScope)\n return {\n version: EDITOR_SETTINGS_VERSION,\n editing: {\n headingConversionScope: valid(headingConversionScopeSchema, editing.headingConversionScope, legacyScope),\n authorColors: valid(authorColorsSchema, editing.authorColors, defaults.editing.authorColors),\n authorColorStyle: valid(authorColorStyleSchema, editing.authorColorStyle, defaults.editing.authorColorStyle),\n commentsLayout: valid(commentsLayoutSchema, editing.commentsLayout, defaults.editing.commentsLayout),\n },\n ai: {\n autocomplete: valid(autocompleteSchema, ai.autocomplete, defaults.ai.autocomplete),\n roles: Object.fromEntries(MODEL_ROLES.flatMap((role) => {\n const parsed = profileIdSchema.safeParse(roles[role])\n return parsed.success ? [[role, parsed.data]] : []\n })),\n translateLanguage: valid(translateLanguageSchema, ai.translateLanguage, defaults.ai.translateLanguage),\n },\n blocks: {\n defaultBlockType: valid(defaultBlockTypeSchema, blocks.defaultBlockType, defaults.blocks.defaultBlockType),\n structure: valid(structureSchema, blocks.structure, defaults.blocks.structure),\n treeRoot: valid(treeRootSchema, blocks.treeRoot, defaults.blocks.treeRoot),\n blockTypeIcon: valid(blockTypeIconSchema, blocks.blockTypeIcon, defaults.blocks.blockTypeIcon),\n dragHandle: valid(dragHandleSchema, blocks.dragHandle, defaults.blocks.dragHandle),\n splitTargetChars: valid(splitTargetCharsSchema, blocks.splitTargetChars, defaults.blocks.splitTargetChars),\n },\n appearance: {\n theme: valid(themeSchema, appearance.theme, defaults.appearance.theme),\n },\n }\n}\n"],"mappings":";;;;;AA2BA,MAAa,WAAW;;AA4CxB,MAAa,yBAAyB;AACtC,MAAa,yBAAyB;;AAGtC,SAAgB,sBAAsB,OAAe,SAAyB;CAC5E,MAAM,QAAQ,KAAK,MAAM,OAAO,KAAK,CAAC;CACtC,OAAO,MAAM,KAAK,MAAM,MAAM,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,wBAAwB,KAAK,IAAA,KAA4B,KAAK,CAAC,IAAI;AACrI;AAEA,MAAa,2BAA2C;CACtD,SAAA;CACA,SAAS;EAAE,wBAAwB;EAAa,cAAc;EAAO,kBAAkB;EAAc,gBAAgB;CAAS;CAC9H,IAAI;EAAE,cAAc;EAAO,OAAO,CAAC;EAAG,mBAAmB;CAAW;CACpE,QAAQ;EAAE,kBAAkB;EAAW,WAAW;EAAc,UAAU;EAAW,eAAe;EAAU,YAAY;EAAS,kBAAkB;CAAK;CAC1J,YAAY,EAAE,OAAO,KAAK;AAC5B;AAEA,MAAM,+BAA+B,EAAE,KAAK,yBAAyB;AACrE,MAAM,qBAAqB,EAAE,QAAQ;AACrC,MAAM,yBAAyB,EAAE,KAAK,mBAAmB;AACzD,MAAM,uBAAuB,EAAE,KAAK,gBAAgB;AACpD,MAAM,qBAAqB,EAAE,QAAQ;AACrC,MAAM,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AACjD,MAAM,0BAA0B,EAAE,KAAK,YAAY;AACnD,MAAM,yBAAyB,EAAE,OAAO,CAAC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"version":3,"file":"index.js","names":[],"sources":["../../src/settings/index.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n AI_LANGUAGES,\n type AiLanguage,\n AUTHOR_COLOR_STYLES,\n type AuthorColorStyle,\n BLOCK_TYPE_ICON_VISIBILITIES,\n type BlockTypeIconVisibility,\n COMMENTS_LAYOUTS,\n type CommentsLayout,\n DRAG_HANDLE_VISIBILITIES,\n type DragHandleVisibility,\n HEADING_CONVERSION_SCOPES,\n type HeadingConversionScope,\n MODEL_ROLES,\n type ModelRole,\n STRUCTURE_MODES,\n type StructureMode,\n TREE_ROOTS,\n type TreeRoot,\n} from './values'\nimport { EDITOR_SETTINGS_VERSION, migrateEditorSettings } from './migrate'\n\nexport * from './values'\nexport { EDITOR_SETTINGS_VERSION, isOutdatedEditorSettings, migrateEditorSettings } from './migrate'\n\n/** Valid theme id: lowercase slug, used as directory name and in `/api/editor/themes/:id`. Defined here so core never imports a feature. */\nexport const THEME_ID = /^[a-z0-9][a-z0-9-]{0,63}$/\n\n/** A user's editor preferences, shared by all editors on the page; persisted per user through the `settings` port. */\nexport interface EditorSettings {\n version: typeof EDITOR_SETTINGS_VERSION\n editing: {\n /** Blocks „Gliederung umwandeln“ (both directions) converts when nothing is selected. */\n headingConversionScope: HeadingConversionScope\n /** Text is tinted per author (authors feature): each run in the colour of the user who wrote it. */\n authorColors: boolean\n /** `background`: tinted background; `text`: text in the author's colour. */\n authorColorStyle: AuthorColorStyle\n /** `margin`: comment cards in a column beside the text; `inline`: popover at the text plus the toolbar's list (comments feature). */\n commentsLayout: CommentsLayout\n }\n ai: {\n /** Ghost-text suggestions while typing (`GhostAutocomplete`). */\n autocomplete: boolean\n /** Model profile id per model role; a missing or unknown id falls back to the server's default preset for the role. */\n roles: Partial<Record<ModelRole, string>>\n /** Preselected target language of „Übersetzen“. */\n translateLanguage: AiLanguage\n }\n blocks: {\n /** Block type id the Typed block shortcuts create (toolbar button, heading conversion). */\n defaultBlockType: string\n /** Preferred document structure: toolbar block types and the structure of AI-generated blocks. */\n structure: StructureMode\n /** Root of the document drawer while a Document with Typed blocks is loaded: nested in the folders, or the file itself. */\n treeRoot: TreeRoot\n /** Block type icon of Typed blocks (their drag handle): always visible, or only on hover, focus or while the details are open. */\n blockTypeIcon: BlockTypeIconVisibility\n /** Standard drag handle of blocks without Block type icon: on the hovered block, or permanently beside every block. */\n dragHandle: DragHandleVisibility\n /** Target size in characters of the parts a length split cuts a Typed block into (200–20000). */\n splitTargetChars: number\n /** Typing `---` on an empty body line of a Typed block splits the block there instead of inserting a horizontal rule. */\n splitOnRule: boolean\n }\n appearance: {\n /** Id of the Obsidian theme applied to the whole app (themes feature); `null` = the standard Nuxt UI look. */\n theme: string | null\n }\n}\n\n/** Bounds of `blocks.splitTargetChars`. */\nexport const SPLIT_TARGET_CHARS_MIN = 200\nexport const SPLIT_TARGET_CHARS_MAX = 20000\n\n/** The split target typed into the field as a valid setting: rounded and clamped to its bounds; `current` when `typed` is empty or not a number. */\nexport function clampSplitTargetChars(typed: string, current: number): number {\n const value = Math.round(Number(typed))\n return typed.trim() !== '' && Number.isFinite(value) ? Math.min(SPLIT_TARGET_CHARS_MAX, Math.max(SPLIT_TARGET_CHARS_MIN, value)) : current\n}\n\nexport const EDITOR_SETTINGS_DEFAULTS: EditorSettings = {\n version: EDITOR_SETTINGS_VERSION,\n editing: { headingConversionScope: 'container', authorColors: false, authorColorStyle: 'background', commentsLayout: 'margin' },\n ai: { autocomplete: false, roles: {}, translateLanguage: 'Englisch' },\n blocks: { defaultBlockType: 'section', structure: 'structured', treeRoot: 'folders', blockTypeIcon: 'always', dragHandle: 'hover', splitTargetChars: 1500, splitOnRule: true },\n appearance: { theme: null },\n}\n\nconst headingConversionScopeSchema = z.enum(HEADING_CONVERSION_SCOPES)\nconst authorColorsSchema = z.boolean()\nconst authorColorStyleSchema = z.enum(AUTHOR_COLOR_STYLES)\nconst commentsLayoutSchema = z.enum(COMMENTS_LAYOUTS)\nconst autocompleteSchema = z.boolean()\nconst profileIdSchema = z.string().min(1).max(100)\nconst translateLanguageSchema = z.enum(AI_LANGUAGES)\nconst defaultBlockTypeSchema = z.string().min(1).max(100)\nconst structureSchema = z.enum(STRUCTURE_MODES)\nconst treeRootSchema = z.enum(TREE_ROOTS)\nconst blockTypeIconSchema = z.enum(BLOCK_TYPE_ICON_VISIBILITIES)\nconst dragHandleSchema = z.enum(DRAG_HANDLE_VISIBILITIES)\nconst splitTargetCharsSchema = z.number().int().min(SPLIT_TARGET_CHARS_MIN).max(SPLIT_TARGET_CHARS_MAX)\nconst splitOnRuleSchema = z.boolean()\nconst themeSchema = z.string().regex(THEME_ID).nullable()\n\n/** Complete, valid settings (the body of `PUT /api/editor/settings`). */\nexport const editorSettingsSchema = z.object({\n version: z.literal(EDITOR_SETTINGS_VERSION),\n editing: z.object({\n headingConversionScope: headingConversionScopeSchema,\n authorColors: authorColorsSchema,\n authorColorStyle: authorColorStyleSchema,\n commentsLayout: commentsLayoutSchema,\n }),\n ai: z.object({\n autocomplete: autocompleteSchema,\n roles: z.partialRecord(z.enum(MODEL_ROLES), profileIdSchema),\n translateLanguage: translateLanguageSchema,\n }),\n blocks: z.object({\n defaultBlockType: defaultBlockTypeSchema,\n structure: structureSchema,\n treeRoot: treeRootSchema,\n blockTypeIcon: blockTypeIconSchema,\n dragHandle: dragHandleSchema,\n splitTargetChars: splitTargetCharsSchema,\n // Added within version 2: a body from a client that predates it gets the default instead of a 400.\n splitOnRule: splitOnRuleSchema.default(EDITOR_SETTINGS_DEFAULTS.blocks.splitOnRule),\n }),\n appearance: z.object({ theme: themeSchema }),\n}) satisfies z.ZodType<EditorSettings>\n\nfunction record(value: unknown): Record<string, unknown> {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}\n}\n\nfunction valid<T>(schema: z.ZodType<T>, value: unknown, fallback: T): T {\n const parsed = schema.safeParse(value)\n return parsed.success ? parsed.data : fallback\n}\n\n/**\n * Deep-merges unknown input over the defaults; unknown keys dropped, invalid values replaced. Reads older stored settings\n * through `migrateEditorSettings` (`./migrate`), including the legacy flat `{ headingConversionScope }` per-browser shape.\n * Always returns fresh objects of the current version.\n */\nexport function parseEditorSettings(input: unknown): EditorSettings {\n const root = record(migrateEditorSettings(input))\n const editing = record(root.editing)\n const ai = record(root.ai)\n const roles = record(ai.roles)\n const blocks = record(root.blocks)\n const appearance = record(root.appearance)\n const defaults = EDITOR_SETTINGS_DEFAULTS\n const legacyScope = valid(headingConversionScopeSchema, root.headingConversionScope, defaults.editing.headingConversionScope)\n return {\n version: EDITOR_SETTINGS_VERSION,\n editing: {\n headingConversionScope: valid(headingConversionScopeSchema, editing.headingConversionScope, legacyScope),\n authorColors: valid(authorColorsSchema, editing.authorColors, defaults.editing.authorColors),\n authorColorStyle: valid(authorColorStyleSchema, editing.authorColorStyle, defaults.editing.authorColorStyle),\n commentsLayout: valid(commentsLayoutSchema, editing.commentsLayout, defaults.editing.commentsLayout),\n },\n ai: {\n autocomplete: valid(autocompleteSchema, ai.autocomplete, defaults.ai.autocomplete),\n roles: Object.fromEntries(MODEL_ROLES.flatMap((role) => {\n const parsed = profileIdSchema.safeParse(roles[role])\n return parsed.success ? [[role, parsed.data]] : []\n })),\n translateLanguage: valid(translateLanguageSchema, ai.translateLanguage, defaults.ai.translateLanguage),\n },\n blocks: {\n defaultBlockType: valid(defaultBlockTypeSchema, blocks.defaultBlockType, defaults.blocks.defaultBlockType),\n structure: valid(structureSchema, blocks.structure, defaults.blocks.structure),\n treeRoot: valid(treeRootSchema, blocks.treeRoot, defaults.blocks.treeRoot),\n blockTypeIcon: valid(blockTypeIconSchema, blocks.blockTypeIcon, defaults.blocks.blockTypeIcon),\n dragHandle: valid(dragHandleSchema, blocks.dragHandle, defaults.blocks.dragHandle),\n splitTargetChars: valid(splitTargetCharsSchema, blocks.splitTargetChars, defaults.blocks.splitTargetChars),\n splitOnRule: valid(splitOnRuleSchema, blocks.splitOnRule, defaults.blocks.splitOnRule),\n },\n appearance: {\n theme: valid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EditorSettings } from "../vue/settings.js";
|
|
7
7
|
import { useEditorI18n } from "../vue/use-editor-i18n.js";
|
|
8
|
-
import _sfc_main$1 from "../features/composites/components/DocumentBadges.js";
|
|
9
8
|
import { DRAG_MIME, focusCrumbs, indexItems, isOutlineHeader, itemBasket } from "./tree-items.js";
|
|
10
9
|
import { refocusRow, rowPosition } from "./row-focus.js";
|
|
11
10
|
import { rowOf } from "./tree-model.js";
|
|
11
|
+
import _sfc_main$1 from "../features/composites/components/DocumentBadges.js";
|
|
12
12
|
import { useTreeModel } from "./use-tree-model.js";
|
|
13
13
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, openBlock, renderList, renderSlot, toDisplayString, unref, useModel, withCtx, withKeys, withModifiers } from "vue";
|
|
14
14
|
//#region src/tree/DocumentTree.vue
|
|
@@ -3,10 +3,10 @@ import { useEditorSettings } from "../vue/settings.js";
|
|
|
3
3
|
import { useEditorContext } from "../vue/context.js";
|
|
4
4
|
import { useEditorI18n } from "../vue/use-editor-i18n.js";
|
|
5
5
|
import { useStoreRef } from "../vue/store-ref.js";
|
|
6
|
-
import { useFileImport } from "../features/media/vue.js";
|
|
7
6
|
import { treeView } from "./tree-view-model.js";
|
|
8
7
|
import { createTreeModel } from "./tree-model.js";
|
|
9
8
|
import { createTreeExecutor, treeEditorOf } from "./tree-host.js";
|
|
9
|
+
import { useFileImport } from "../features/media/vue.js";
|
|
10
10
|
import { computed, onScopeDispose, shallowRef, watch } from "vue";
|
|
11
11
|
//#region src/tree/use-tree-model.ts
|
|
12
12
|
/**
|
package/dist/vue/compose.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { coreUiFeature } from "../core/core-feature.js";
|
|
2
2
|
import { AI_BINDINGS, layerCompositions } from "../presets/layer.js";
|
|
3
|
+
import { mediaFeature } from "../features/media/vue.js";
|
|
3
4
|
import _sfc_main from "./components/EditorCommandPalette.js";
|
|
4
5
|
import { aiFeature } from "../features/ai/vue.js";
|
|
5
6
|
import { authorsFeature } from "../features/authors/vue.js";
|
|
@@ -7,7 +8,6 @@ import { blockUiFeature } from "../features/block-ui/vue.js";
|
|
|
7
8
|
import { collabFeature } from "../features/collab/vue.js";
|
|
8
9
|
import { commentsFeature } from "../features/comments/vue.js";
|
|
9
10
|
import { compositeFeature } from "../features/composites/vue.js";
|
|
10
|
-
import { mediaFeature } from "../features/media/vue.js";
|
|
11
11
|
import { themesFeature } from "../features/themes/vue.js";
|
|
12
12
|
import { pruefungFeature } from "../features/pruefung/vue.js";
|
|
13
13
|
import { exploreFeature } from "../features/explore/vue.js";
|
package/dist/vue/index.js
CHANGED
|
@@ -11,8 +11,8 @@ import { vueSuggestionRenderer } from "./suggestion-renderer.js";
|
|
|
11
11
|
import _sfc_main$2 from "./components/EditorSettingsPanel.js";
|
|
12
12
|
import _sfc_main$1 from "./components/EditorSettingsModal.js";
|
|
13
13
|
import _sfc_main$3 from "./components/EditorSurface.js";
|
|
14
|
-
import _sfc_main from "./components/EditorCommandPalette.js";
|
|
15
14
|
import { useNotifier } from "./use-notifier.js";
|
|
15
|
+
import _sfc_main from "./components/EditorCommandPalette.js";
|
|
16
16
|
import _sfc_main$5 from "./components/SettingsSection.js";
|
|
17
17
|
import _sfc_main$4 from "./components/EditorToolbar.js";
|
|
18
18
|
export { EDITOR_CONTEXT, EDITOR_UI, _sfc_main as EditorCommandPalette, _sfc_main$1 as EditorSettingsModal, _sfc_main$2 as EditorSettingsPanel, _sfc_main$3 as EditorSurface, _sfc_main$4 as EditorToolbar, _sfc_main$5 as SettingsSection, _sfc_main$6 as SuggestionList, VUE_UI_KIT, attachNotifier, createEditor, createQueuedNotifier, storeFromRef, trackedStore, useEditorContext, useEditorI18n, useEditorSettings, useEditorUi, useNotifier, useStoreRef, useUiKit, useWritableStoreRef, vueSuggestionRenderer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skaile/forge-editor",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue and React editor library on TipTap v3 (Vue: Nuxt UI; React: shadcn/ui): framework-free features with Vue and React bindings, simple and advanced presets, tree-shakeable entries. Built ESM with type declarations.",
|
|
6
6
|
"license": "MIT",
|