@mikedown/core 0.3.0 → 0.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.
@@ -8,7 +8,7 @@ function loadAiUi() {
8
8
  if (aiUi) {
9
9
  return Promise.resolve(aiUi);
10
10
  }
11
- loading ?? (loading = import("./ai-ui-C7ENTWWU.js").then(
11
+ loading ?? (loading = import("./ai-ui-QFYFN73D.js").then(
12
12
  (m) => {
13
13
  aiUi = m;
14
14
  return m;
@@ -36,4 +36,4 @@ export {
36
36
  aiHostTier,
37
37
  aiToolbarButtonMode
38
38
  };
39
- //# sourceMappingURL=chunk-LXZG7IKN.js.map
39
+ //# sourceMappingURL=chunk-N4N54LK2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ai-lite.ts"],"sourcesContent":["/**\n * The little of the AI layer the editor needs before the AI UI is loaded,\n * and the loader for the rest.\n *\n * Everything behind `host.ai` (the rewrite popover, the AI settings tab and\n * Engines page, the toolbar menu, the prompts and the router) lives in\n * `ai-ui.ts`, which the editor imports with `import()` only when the host has\n * an AI adapter. Bundlers split it into its own chunk, so an editor without\n * AI never downloads it. A host that wants it in its main bundle, loaded\n * synchronously (the VS Code webview), imports `ai-ui-eager.ts` once.\n */\n\nimport type { AiSettings, MikeDownAiHost } from './ai/types';\n\n// Types only: the recorder itself is in the lazy chunk (`ai-ui.ts`).\nexport type {\n AiActivityEntry, AiActivityLog, AiActivityPatch, AiActivityResponse, AiActivityRoute, AiActivityStatus,\n} from './ai-activity';\n\nexport type AiUi = typeof import('./ai-ui');\n\nlet aiUi: AiUi | null = null;\nlet loading: Promise<AiUi> | null = null;\n\n/** The AI UI when it is already loaded (or registered), else null. */\nexport function loadedAiUi(): AiUi | null {\n return aiUi;\n}\n\n/** Load the AI UI chunk once; a failed load is tried again on the next call. */\nexport function loadAiUi(): Promise<AiUi> {\n if (aiUi) {return Promise.resolve(aiUi);}\n loading ??= import('./ai-ui').then(\n (m) => { aiUi = m; return m; },\n (err: unknown) => { loading = null; throw err; },\n );\n return loading;\n}\n\n/** Make the AI UI available synchronously (`ai-ui-eager.ts`); null forgets it (tests). */\nexport function registerAiUi(m: AiUi | null): void {\n aiUi = m;\n loading = null;\n}\n\n// ── Host tier ───────────────────────────────────────────────────────────────\n\n/** 1: `complete` only, the host routes. 2: the host has an engine registry and core routes. */\nexport type AiHostTier = 1 | 2;\n\nexport function aiHostTier(ai: MikeDownAiHost): AiHostTier {\n return typeof ai.listEngines === 'function' ? 2 : 1;\n}\n\n// ── Toolbar button ──────────────────────────────────────────────────────────\n\nexport type AiToolbarButtonMode = 'hidden' | 'firstRun' | 'menu';\n\n/** What the button does: hidden without AI support or when turned off in settings. */\nexport function aiToolbarButtonMode(hasAiHost: boolean, settings: Pick<AiSettings, 'enabled' | 'showToolbarButton'>): AiToolbarButtonMode {\n if (!hasAiHost || !settings.showToolbarButton) {return 'hidden';}\n return settings.enabled ? 'menu' : 'firstRun';\n}\n"],"mappings":";AAqBA,IAAI,OAAoB;AACxB,IAAI,UAAgC;AAG7B,SAAS,aAA0B;AACxC,SAAO;AACT;AAGO,SAAS,WAA0B;AACxC,MAAI,MAAM;AAAC,WAAO,QAAQ,QAAQ,IAAI;AAAA,EAAE;AACxC,wBAAY,OAAO,qBAAS,EAAE;AAAA,IAC5B,CAAC,MAAM;AAAE,aAAO;AAAG,aAAO;AAAA,IAAG;AAAA,IAC7B,CAAC,QAAiB;AAAE,gBAAU;AAAM,YAAM;AAAA,IAAK;AAAA,EACjD;AACA,SAAO;AACT;AAaO,SAAS,WAAW,IAAgC;AACzD,SAAO,OAAO,GAAG,gBAAgB,aAAa,IAAI;AACpD;AAOO,SAAS,oBAAoB,WAAoB,UAAkF;AACxI,MAAI,CAAC,aAAa,CAAC,SAAS,mBAAmB;AAAC,WAAO;AAAA,EAAS;AAChE,SAAO,SAAS,UAAU,SAAS;AACrC;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as MikeDownOptions, b as MikeDownEditorHandle, c as MikeDownHost } from './types-CsVNVSNY.js';
2
- export { B as BacklinkItem, D as DEFAULT_FEATURES, d as DEFAULT_TOOLBAR_LAYOUT, e as DiffBaseline, I as ImageInsertResult, f as ImagePathMapping, g as ImageResizeRequest, h as ImageResizeResult, i as ImageUploadRequest, L as LinkCheckRequest, j as LinkOpenBehavior, k as LinkSuggestion, l as MikeDownCommand, m as MikeDownEvent, n as MikeDownFeatures, o as MikeDownSettings, p as MikeDownSettingsPatch, q as MikeDownSettingsSection, r as MikeDownSettingsSectionBuild, M as MikeDownSettingsSectionContext, s as MikeDownSidebarPrefs, t as MikeDownStats, u as MikeDownViewState, N as NoopHost, v as NormalizationStyle, S as SidebarFooterLink, w as SidebarStateUpdate, T as TagCount, x as ToolbarLayout, W as WikilinkResolution, y as normalizeToolbarLayout } from './types-CsVNVSNY.js';
3
- export { p as AiCompletionRequest, o as AiCompletionResult, a as AiEngineStatus, r as AiError, n as AiErrorCode, q as AiMessage, K as AiMessagePart, O as AiServedBy, A as AiSettings, M as MikeDownAiHost } from './types-CgEeIUhi.js';
1
+ import { a as MikeDownOptions, b as MikeDownEditorHandle, c as MikeDownHost } from './types-2TZErbJr.js';
2
+ export { B as BacklinkItem, D as DEFAULT_FEATURES, d as DEFAULT_TOOLBAR_LAYOUT, e as DiffBaseline, I as ImageInsertResult, f as ImagePathMapping, g as ImageResizeRequest, h as ImageResizeResult, i as ImageUploadRequest, L as LinkCheckRequest, j as LinkOpenBehavior, k as LinkSuggestion, l as MikeDownCommand, m as MikeDownEvent, n as MikeDownFeatures, o as MikeDownSettings, p as MikeDownSettingsPatch, q as MikeDownSettingsSection, r as MikeDownSettingsSectionBuild, M as MikeDownSettingsSectionContext, s as MikeDownSidebarPrefs, t as MikeDownStats, u as MikeDownViewState, N as NoopHost, v as NormalizationStyle, S as SidebarFooterLink, w as SidebarStateUpdate, T as TagCount, x as ToolbarLayout, W as WikilinkResolution, y as normalizeToolbarLayout } from './types-2TZErbJr.js';
3
+ export { r as AiCompletionRequest, q as AiCompletionResult, a as AiEngineStatus, t as AiError, p as AiErrorCode, s as AiMessage, aa as AiMessagePart, ad as AiServedBy, A as AiSettings, M as MikeDownAiHost } from './types-DO8UBybZ.js';
4
4
  import '@tiptap/core';
5
5
 
6
6
  /**