@hesprs/sync-engine-sdk 3.1.0 → 3.1.3

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/dev.js CHANGED
@@ -1 +1 @@
1
- import e from"./debug-wrapper.js";import t from"./plugin/test/test-kit.js";import n from"./plugin/src/utils/sha-256.js";import r from"./transform.js";export{e as debugWrapper,n as sha256,r as syncEngineTransform,t as testKit};
1
+ import e from"./debug-wrapper.js";import t from"./plugin/test/test-kit.js";import n from"./plugin/src/utils/sha-256.js";import r from"./transform.js";export{e as debugWrapper,n as sha256,r as syncEngineModule,t as testKit};
@@ -1,4 +1,4 @@
1
- import { $ as RootFs, G as Fs, P as TaskNames, ct as RecordStat, dt as StatsMap, et as WrappedFs, h as RequestParam, it as FolderStat, lt as RecordStatsMap, m as Request, nt as Binary, rt as FileStat, ut as Stat, v as Decider } from "./index-LOl_cerr.spec.js";
1
+ import { $ as RootFs, G as Fs, P as TaskNames, ct as RecordStatsMap, et as WrappedFs, ft as Binary, h as RequestParam, lt as Stat, m as Request, nt as FileStat, rt as FolderStat, st as RecordStat, ut as StatsMap, v as Decider } from "./index-g3mTMY1u.spec.js";
2
2
  //#region src/sdk/debug-wrapper.d.ts
3
3
  declare function debugWrapper(original: Fs, log: (content: string) => void): WrappedFs;
4
4
  //#endregion
@@ -86,12 +86,19 @@ type SyncEngineConfig = {
86
86
  neverBundle?: true | string | RegExp | Array<string | RegExp> | ((id: string, parentId: string | undefined, isResolved: boolean) => boolean | null | undefined);
87
87
  };
88
88
  };
89
- declare function syncEngineTransform(): {
89
+ type ModuleMeta = Partial<Record<'name' | 'icon' | 'description' | 'source' | 'version' | 'readme', string>>;
90
+ type ModuleMetaWithId = ModuleMeta & {
91
+ id: string;
92
+ };
93
+ declare function syncEngineModule(meta?: ModuleMeta | Array<ModuleMetaWithId> | Record<string, ModuleMeta>): {
90
94
  name: string;
91
- renderChunk(code: string): {
95
+ renderChunk(code: string, chunk: {
96
+ name: string;
97
+ isEntry: boolean;
98
+ }): {
92
99
  code: string;
93
100
  } | undefined;
94
101
  tsdownConfig(config: SyncEngineConfig): void;
95
102
  };
96
103
  //#endregion
97
- export { debugWrapper, sha256, syncEngineTransform, testKit };
104
+ export { debugWrapper, sha256, syncEngineModule, testKit };
@@ -1,7 +1,10 @@
1
1
  import { App, ListedFiles, RequestUrlParam, Stat } from "obsidian";
2
- //#region test/e2e-utils.d.ts
2
+ //#region ../shared/src/e2e-utils.spec.d.ts
3
3
  type General = any;
4
4
  //#endregion
5
+ //#region ../shared/src/binary.d.ts
6
+ type Binary = Uint8Array<ArrayBuffer>;
7
+ //#endregion
5
8
  //#region src/types.d.ts
6
9
  type MaybePromise<T> = Promise<T> | T;
7
10
  type TogglableValue<T = number> = {
@@ -38,7 +41,6 @@ type Progress<T = string> = {
38
41
  completed: number;
39
42
  current?: T;
40
43
  };
41
- type Binary = Uint8Array<ArrayBuffer>;
42
44
  //#endregion
43
45
  //#region src/fs/interface.d.ts
44
46
  /**
@@ -459,7 +461,7 @@ declare class Registrar {
459
461
  root: {
460
462
  conflictResolverRegistry: Map<string, ConflictResolverEntry>;
461
463
  createLocalFs: () => Fs;
462
- createRemoteFs: (remoteFs?: string) => RootFs;
464
+ createRemoteFs: (remoteFs?: string) => Fs;
463
465
  deciderRegistry: Map<string, DeciderEntry>;
464
466
  getCheckConnection: (remoteFs?: string) => () => MaybePromise<CheckConnectionResult>;
465
467
  getConflictResolver: () => ConflictResolver;
@@ -555,4 +557,4 @@ type VaultRequestResponseMap = {
555
557
  };
556
558
  type VaultRequest = <T extends VaultRequestParam>(params: T) => Promise<VaultRequestResponseMap[T['method']]>;
557
559
  //#endregion
558
- export { RootFs as $, AddRecord as A, StoreOperations as B, RemoveRemote as C, MoveLocal as D, MoveRemote as E, RecordStore as F, Fs as G, BatchOptimizer as H, Storage as I, MkdirAtom as J, InputAtom as K, DatabaseAsync as L, ConflictResolver as M, ConflictResolverPayload as N, Download as O, TaskNames as P, OutputAtom as Q, DatabaseSync as R, ResolveConflict as S, RemoveLocal as T, CustomAtom as U, StoreSync as V, DeleteAtom as W, OptimizerInput as X, MoveAtom as Y, OptimizerOutput as Z, CreateLocalDir as _, FsWrapperEntry as a, GlobMatchRule as at, TaskFactory as b, OptimizerEntry as c, RecordStat as ct, RemoteLister as d, StatsMap as dt, WrappedFs as et, RemoteListerEntry as f, TogglableValue as ft, RequestResponse as g, RequestParam as h, DeciderEntry as i, FolderStat as it, BaseTask as j, CreateRemoteDir as k, Registrar as l, RecordStatsMap as lt, Request as m, CheckConnectionResult as n, Binary as nt, Infras as o, MaybePromise as ot, RemoteRequestMiddlewareEntry as p, General as pt, ListReporter as q, ConflictResolverEntry as r, FileStat as rt, LocalRequestMiddlewareEntry as s, Progress as st, VaultRequest as t, WriteAtom as tt, RemoteFsEntry as u, Stat$1 as ut, Decider as v, RemoveRecord as w, Upload as x, DeciderInput as y, StoreAsync as z };
560
+ export { RootFs as $, AddRecord as A, StoreOperations as B, RemoveRemote as C, MoveLocal as D, MoveRemote as E, RecordStore as F, Fs as G, BatchOptimizer as H, Storage as I, MkdirAtom as J, InputAtom as K, DatabaseAsync as L, ConflictResolver as M, ConflictResolverPayload as N, Download as O, TaskNames as P, OutputAtom as Q, DatabaseSync as R, ResolveConflict as S, RemoveLocal as T, CustomAtom as U, StoreSync as V, DeleteAtom as W, OptimizerInput as X, MoveAtom as Y, OptimizerOutput as Z, CreateLocalDir as _, FsWrapperEntry as a, MaybePromise as at, TaskFactory as b, OptimizerEntry as c, RecordStatsMap as ct, RemoteLister as d, TogglableValue as dt, WrappedFs as et, RemoteListerEntry as f, Binary as ft, RequestResponse as g, RequestParam as h, DeciderEntry as i, GlobMatchRule as it, BaseTask as j, CreateRemoteDir as k, Registrar as l, Stat$1 as lt, Request as m, CheckConnectionResult as n, FileStat as nt, Infras as o, Progress as ot, RemoteRequestMiddlewareEntry as p, General as pt, ListReporter as q, ConflictResolverEntry as r, FolderStat as rt, LocalRequestMiddlewareEntry as s, RecordStat as st, VaultRequest as t, WriteAtom as tt, RemoteFsEntry as u, StatsMap as ut, Decider as v, RemoveRecord as w, Upload as x, DeciderInput as y, StoreAsync as z };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{pipe as e,readWithSize as t,writeWithValue as n}from"./plugin/src/utils/pipe.js";import r from"./plugin/src/components/MigrationModal.js";import i from"./prefix.js";import{s as a}from"./plugin/src/settings/utils.js";function o(e){let t=e;for(;`original`in t;)t=t.original;return t}export{o as digOriginal,e as pipe,i as prefixWrapper,t as readWithSize,a as s,r as setNeedMigration,n as writeWithValue};
1
+ import{pipe as e,readWithSize as t,writeWithValue as n}from"./plugin/src/utils/pipe.js";import r from"./plugin/src/components/MigrationModal.js";import i from"./prefix.js";import{generateEditableList as a,reactivelyValidate as o,s}from"./plugin/src/settings/utils.js";function c(e){let t=e;for(;`original`in t;)t=t.original;return t}export{c as digOriginal,a as generateEditableList,e as pipe,i as prefixWrapper,o as reactivelyValidate,t as readWithSize,s,r as setNeedMigration,n as writeWithValue};
@@ -1,5 +1,5 @@
1
- import { $ as RootFs, A as AddRecord, B as StoreOperations, C as RemoveRemote, D as MoveLocal, E as MoveRemote, F as RecordStore, G as Fs, H as BatchOptimizer, I as Storage, J as MkdirAtom, K as InputAtom, L as DatabaseAsync, M as ConflictResolver, N as ConflictResolverPayload, O as Download, P as TaskNames, Q as OutputAtom, R as DatabaseSync, S as ResolveConflict, T as RemoveLocal, U as CustomAtom, V as StoreSync, W as DeleteAtom, X as OptimizerInput, Y as MoveAtom, Z as OptimizerOutput, _ as CreateLocalDir, a as FsWrapperEntry, at as GlobMatchRule, b as TaskFactory, c as OptimizerEntry, ct as RecordStat, d as RemoteLister, dt as StatsMap, et as WrappedFs, f as RemoteListerEntry, ft as TogglableValue, g as RequestResponse, h as RequestParam, i as DeciderEntry, it as FolderStat, j as BaseTask, k as CreateRemoteDir, l as Registrar, lt as RecordStatsMap, m as Request, n as CheckConnectionResult, nt as Binary, o as Infras, ot as MaybePromise, p as RemoteRequestMiddlewareEntry, pt as General$1, q as ListReporter, r as ConflictResolverEntry, rt as FileStat, s as LocalRequestMiddlewareEntry, st as Progress, t as VaultRequest, tt as WriteAtom, u as RemoteFsEntry, ut as Stat, v as Decider, w as RemoveRecord, x as Upload, y as DeciderInput, z as StoreAsync } from "./index-LOl_cerr.spec.js";
2
- import { App, Command, EventRef, IconName, Modal, Plugin, Setting, SettingDefinition, SettingDefinitionGroup, SettingDefinitionItem, SettingDefinitionList, SettingDefinitionPage, ToggleComponent } from "obsidian";
1
+ import { $ as RootFs, A as AddRecord, B as StoreOperations, C as RemoveRemote, D as MoveLocal, E as MoveRemote, F as RecordStore, G as Fs, H as BatchOptimizer, I as Storage, J as MkdirAtom, K as InputAtom, L as DatabaseAsync, M as ConflictResolver, N as ConflictResolverPayload, O as Download, P as TaskNames, Q as OutputAtom, R as DatabaseSync, S as ResolveConflict, T as RemoveLocal, U as CustomAtom, V as StoreSync, W as DeleteAtom, X as OptimizerInput, Y as MoveAtom, Z as OptimizerOutput, _ as CreateLocalDir, a as FsWrapperEntry, at as MaybePromise, b as TaskFactory, c as OptimizerEntry, ct as RecordStatsMap, d as RemoteLister, dt as TogglableValue, et as WrappedFs, f as RemoteListerEntry, ft as Binary, g as RequestResponse, h as RequestParam, i as DeciderEntry, it as GlobMatchRule, j as BaseTask, k as CreateRemoteDir, l as Registrar, lt as Stat, m as Request, n as CheckConnectionResult, nt as FileStat, o as Infras, ot as Progress, p as RemoteRequestMiddlewareEntry, pt as General$1, q as ListReporter, r as ConflictResolverEntry, rt as FolderStat, s as LocalRequestMiddlewareEntry, st as RecordStat, t as VaultRequest, tt as WriteAtom, u as RemoteFsEntry, ut as StatsMap, v as Decider, w as RemoveRecord, x as Upload, y as DeciderInput, z as StoreAsync } from "./index-g3mTMY1u.spec.js";
2
+ import { App, Command, EventRef, ExtraButtonComponent, IconName, Modal, Plugin, Setting, SettingDefinition, SettingDefinitionGroup, SettingDefinitionItem, SettingDefinitionList, SettingDefinitionPage, TextComponent, ToggleComponent } from "obsidian";
3
3
  //#region ../../node_modules/.bun/synthkernel@.+synthkernel.tgz/node_modules/synthkernel/dist/context.d.ts
4
4
  //#region src/context.d.ts
5
5
  type General = any;
@@ -152,14 +152,14 @@ declare class Sync {
152
152
  private readonly convertDeleteToUpload;
153
153
  root: {
154
154
  executeSync: (trigger: string) => Promise<{
155
- result: 'cancelled';
155
+ result: "cancelled";
156
156
  } | {
157
- result: 'completed';
157
+ result: "completed";
158
158
  } | {
159
- result: 'failed';
159
+ result: "failed";
160
160
  error: string;
161
161
  } | {
162
- result: 'noop';
162
+ result: "noop";
163
163
  }>;
164
164
  };
165
165
  }
@@ -237,6 +237,7 @@ type ModuleMeta = {
237
237
  main: string;
238
238
  icon?: string;
239
239
  minPluginVersion?: string;
240
+ readme?: string;
240
241
  integrity: string;
241
242
  };
242
243
  type AugmentedModuleMeta = ModuleMeta & {
@@ -282,6 +283,7 @@ declare class Extensibility {
282
283
  private readonly loadAllModules;
283
284
  private readonly loadModule;
284
285
  private readonly unloadModule;
286
+ private readonly installModule;
285
287
  private readonly downloadModule;
286
288
  private readonly deleteModule;
287
289
  private readonly fetchSources;
@@ -299,6 +301,7 @@ declare class Extensibility {
299
301
  downloadModule: (meta: AugmentedModuleMeta, waitIdle?: boolean) => Promise<void>;
300
302
  enableModule: (id: string) => Promise<void>;
301
303
  fetchSources: (manual?: boolean) => Promise<AugmentedModuleMeta[]>;
304
+ installModule: (meta: AugmentedModuleMeta, module: string) => Promise<void>;
302
305
  loadAllModules: () => Promise<void>;
303
306
  loadModule: (meta: AugmentedModuleMeta, start?: boolean, module?: string) => Promise<void>;
304
307
  loadedModules: Map<string, ModuleCtor>;
@@ -309,27 +312,6 @@ declare class Extensibility {
309
312
  };
310
313
  }
311
314
  //#endregion
312
- //#region src/components/ModuleEditorModal.d.ts
313
- type ModuleEditorTranslations = {
314
- editModuleInformation: string;
315
- enable: string;
316
- name: string;
317
- namePlaceholder: string;
318
- description: string;
319
- descriptionPlaceholder: string;
320
- icon: string;
321
- iconDescription: Fragment;
322
- iconPlaceholder: string;
323
- updateSource: string;
324
- updateSourceDescription: string;
325
- updateSourcePlaceholder: string;
326
- invalidValue: string;
327
- integrityVerification: string;
328
- integrityVerificationDescription: Fragment;
329
- save: string;
330
- cancel: string;
331
- };
332
- //#endregion
333
315
  //#region src/components/UnknownModuleModal.d.ts
334
316
  type FileInfo = {
335
317
  path: string;
@@ -382,12 +364,14 @@ declare class Setting$1 {
382
364
  private readonly speedLabel;
383
365
  private readonly addSettingTab;
384
366
  private readonly rerenderSettingTab;
367
+ private readonly refreshSettingTab;
385
368
  root: {
386
369
  addSettingTab: (plugin: Plugin) => void;
387
370
  matchLabel: () => {
388
371
  text: string;
389
372
  tooltip: string;
390
373
  };
374
+ refreshSettingTab: () => void | undefined;
391
375
  registerSetting: (entry: SettingEntry) => () => boolean;
392
376
  rerenderSettingTab: () => void | undefined;
393
377
  speedLabel: () => {
@@ -401,6 +385,14 @@ declare class Setting$1 {
401
385
  }
402
386
  //#endregion
403
387
  //#region src/settings/utils.d.ts
388
+ type EphemeralEditableItem<T> = {
389
+ valid: boolean;
390
+ new: boolean;
391
+ value: T;
392
+ };
393
+ type EphemeralEditableListSchema = {
394
+ ephemeralEditableLists: Array<EphemeralEditableItem<General$1>>;
395
+ };
404
396
  type AugmentedSettingDefinitionItem<K extends string = string> = SettingDefinitionGroup<K> | SettingDefinitionList<K> | (SettingDefinitionPage<K> & {
405
397
  labels?: Array<LabelDefinition>;
406
398
  }) | (SettingDefinition<K> & {
@@ -413,6 +405,28 @@ type LabelDefinition = {
413
405
  textColor?: string;
414
406
  };
415
407
  declare function s(parent: (self: SettingTree) => AugmentedSettingDefinitionItem, children?: CallableOrObjectTree): CallableOrObjectTree;
408
+ declare function reactivelyValidate<T>({ text, parse, onSave, format, immediate }: {
409
+ text: TextComponent;
410
+ parse: (value: string) => T | undefined;
411
+ format?: (value: T) => string;
412
+ onSave: (value: T) => void;
413
+ immediate?: boolean;
414
+ }): void;
415
+ declare function generateEditableList<T>({ memoryDB, items, identifier, saveSettings, rerenderSettingTab, defaultValue, render, translations: { add, empty, heading }, extraButtons }: {
416
+ memoryDB: DatabaseSync<EphemeralEditableListSchema>;
417
+ items: Array<T>;
418
+ identifier: string;
419
+ saveSettings: () => Promise<void>;
420
+ rerenderSettingTab: () => void;
421
+ defaultValue: T;
422
+ render: (setting: Setting, item: EphemeralEditableItem<T>, save: () => void) => void | (() => void);
423
+ translations: {
424
+ add: string;
425
+ empty: string;
426
+ heading?: string;
427
+ };
428
+ extraButtons?: Array<(button: ExtraButtonComponent, list: Array<EphemeralEditableItem<T>>, save: () => void) => void>;
429
+ }): SettingDefinitionList;
416
430
  //#endregion
417
431
  //#region src/settings/controls.d.ts
418
432
  type ControlsSettingTranslations = {
@@ -584,13 +598,42 @@ type ModuleManagementTranslations = {
584
598
  editModuleInformation: string;
585
599
  official: string;
586
600
  someModulesHidden: string;
601
+ openReadme: string;
602
+ };
603
+ //#endregion
604
+ //#region src/components/ModuleEditorModal.d.ts
605
+ type ModuleEditorTranslations = {
606
+ editModuleInformation: string;
607
+ enable: string;
608
+ enableDescription: string;
609
+ name: string;
610
+ namePlaceholder: string;
611
+ nameDescription: string;
612
+ description: string;
613
+ descriptionDescription: string;
614
+ descriptionPlaceholder: string;
615
+ icon: string;
616
+ iconDescription: Fragment;
617
+ iconPlaceholder: string;
618
+ update: string;
619
+ updateDescription: string;
620
+ updatePlaceholder: string;
621
+ integrityVerification: string;
622
+ integrityVerificationDescription: Fragment;
623
+ save: string;
624
+ cancel: string;
625
+ readmePage: string;
626
+ readmePageDescription: string;
627
+ readmePagePlaceholder: string;
587
628
  };
588
629
  //#endregion
589
630
  //#region src/settings/module-management.d.ts
590
- type ModulesTranslations = ModuleManagementTranslations & {
631
+ type ModulesTranslations = ModuleEditorTranslations & ModuleManagementTranslations & {
591
632
  searchModules: string;
592
633
  moduleManagement: string;
593
634
  showInstalledOnly: string;
635
+ installModuleFromFile: string;
636
+ moduleExtensionWarning: Fragment;
594
637
  };
595
638
  //#endregion
596
639
  //#region src/modules/Bootstrap.d.ts
@@ -626,7 +669,7 @@ declare class Bootstrap {
626
669
  keepRemote: string;
627
670
  renameAndKeepBoth: string;
628
671
  skip: string;
629
- } & ControlsSettingTranslations & DevelopmentSettingTranslations & FeaturesSettingTranslations & FilterSettingTranslations & HeadSettingTranslations & MiscellaneousSettingTranslations & UnknownModuleTranslations & ModuleEditorTranslations & FileTreeTranslations & ModulesTranslations;
672
+ } & ControlsSettingTranslations & DevelopmentSettingTranslations & FeaturesSettingTranslations & FilterSettingTranslations & HeadSettingTranslations & MiscellaneousSettingTranslations & UnknownModuleTranslations & FileTreeTranslations & ModulesTranslations;
630
673
  readonly settings: {
631
674
  maxMemoryConsumption: TogglableValue;
632
675
  maxRequestConcurrency: TogglableValue;
@@ -792,4 +835,4 @@ declare function writeWithValue(fs: Fs, key: string, value: Binary | ReadableStr
792
835
  declare function digOriginal(wrapped: Fs): RootFs;
793
836
  type SelectFromContext<O extends object> = Context extends O ? O : never;
794
837
  //#endregion
795
- export { type AddRecord, type AugmentedModuleMeta, type BaseTask, type BatchOptimizer, type Binary, type CallableOrObjectTree, type CheckConnectionResult, type ConflictResolver, type ConflictResolverEntry, type ConflictResolverPayload, type Context, type CreateLocalDir, type CreateRemoteDir, type CustomAtom, type DatabaseAsync, type DatabaseSync, type Decider, type DeciderEntry, type DeciderInput, type DeleteAtom, type Dispatch, type Download, type Events, type ExistingMemoryDB, type FileStat, type FolderStat, type Fragment, type Fs, type FsWrapperEntry, type InputAtom, type LabelDefinition, type ListReporter, type LocalRequestMiddlewareEntry, type MaybePromise, type MkdirAtom, type ModuleMeta, type MoveAtom, type MoveLocal, type MoveRemote, type ObsidianLanguageCode, type On, type OptimizerEntry, type OptimizerInput, type OptimizerOutput, type OutputAtom, type Progress, type RecordStat, type RecordStatsMap, type RecordStore, type RemoteFsEntry, type RemoteLister, type RemoteListerEntry, type RemoteRequestMiddlewareEntry, type RemoveLocal, type RemoveRecord, type RemoveRemote, type Request, type RequestParam, type RequestResponse, type ResolveConflict, type RootFs, SelectFromContext, type SettingEntry, type Settings, type Stat, type StatsMap, type StoreAsync, type StoreOperations, type StoreSync, type SyncTerminateReason, type TaskFactory, type TaskNames, type Translate, type TranslationResource, type Translations, type Upload, type VaultRequest, type WrappedFs, type WriteAtom, digOriginal, pipe, prefixWrapper, readWithSize, s, setNeedMigration, writeWithValue };
838
+ export { type AddRecord, type AugmentedModuleMeta, type BaseTask, type BatchOptimizer, type Binary, type CallableOrObjectTree, type CheckConnectionResult, type ConflictResolver, type ConflictResolverEntry, type ConflictResolverPayload, type Context, type CreateLocalDir, type CreateRemoteDir, type CustomAtom, type DatabaseAsync, type DatabaseSync, type Decider, type DeciderEntry, type DeciderInput, type DeleteAtom, type Dispatch, type Download, type Events, type ExistingMemoryDB, type FileStat, type FolderStat, type Fragment, type Fs, type FsWrapperEntry, type InputAtom, type LabelDefinition, type ListReporter, type LocalRequestMiddlewareEntry, type MaybePromise, type MkdirAtom, type ModuleMeta, type MoveAtom, type MoveLocal, type MoveRemote, type ObsidianLanguageCode, type On, type OptimizerEntry, type OptimizerInput, type OptimizerOutput, type OutputAtom, type Progress, type RecordStat, type RecordStatsMap, type RecordStore, type RemoteFsEntry, type RemoteLister, type RemoteListerEntry, type RemoteRequestMiddlewareEntry, type RemoveLocal, type RemoveRecord, type RemoveRemote, type Request, type RequestParam, type RequestResponse, type ResolveConflict, type RootFs, SelectFromContext, type SettingEntry, type Settings, type Stat, type StatsMap, type StoreAsync, type StoreOperations, type StoreSync, type SyncTerminateReason, type TaskFactory, type TaskNames, type Translate, type TranslationResource, type Translations, type Upload, type VaultRequest, type WrappedFs, type WriteAtom, digOriginal, generateEditableList, pipe, prefixWrapper, reactivelyValidate, readWithSize, s, setNeedMigration, writeWithValue };
@@ -1 +1 @@
1
- import"obsidian";function e(e,t){return t?Object.assign(e,t):e}export{e as s};
1
+ import{encodeURIComponent3986 as e}from"../../../shared/src/path.js";import{setIcon as t}from"obsidian";function n(e,t){return t?Object.assign(e,t):e}function r(){let n=`--sync-engine-warning`;if(activeDocument.body.style.getPropertyValue(n))return;let r=createDiv();t(r,`triangle-alert`),r.firstElementChild.setAttr(`stroke`,getComputedStyle(activeDocument.body).getPropertyValue(`--text-warning`)),activeDocument.body.style.setProperty(n,`url("data:image/svg+xml,${e(r.innerHTML)}")`)}function i({text:e,parse:t,onSave:n,format:i=String,immediate:a=!1}){r();let o,s=`sync-engine-invalid-input`,c=n=>{o=t(n),o===void 0?e.inputEl.addClass(s):e.inputEl.removeClass(s)};e.onChange(c).inputEl.addEventListener(`blur`,()=>{o!==void 0&&(n(o),e.setValue(i(o)))}),a&&c(e.getValue())}function a({memoryDB:e,items:t,identifier:n,saveSettings:r,rerenderSettingTab:i,defaultValue:a,render:o,translations:{add:s,empty:c,heading:l},extraButtons:u}){let d=e.getStore(`ephemeralEditableLists`),f=d.get(n),p;f?p=f:(p=t.map(e=>({new:!1,valid:!0,value:e})),d.set(n,p));let m=()=>{let e=p.filter(({valid:e})=>e).map(({value:e})=>e);JSON.stringify(e)!==JSON.stringify(t)&&(t.length=0,t.push(...e),r())};return{addItem:{action:()=>{p.push({new:!0,valid:!1,value:structuredClone(a)}),i()},name:s},emptyState:c,extraButtons:u?u.map(e=>t=>e(t,p,m)):void 0,heading:l,items:p.map(e=>({name:``,render:t=>(t.settingEl.addClass(`sync-engine-editable-list`),t.settingEl.querySelector(`.setting-item-control`)?.addClass(`w-100%!`),o(t,e,m)),searchable:!1})),onDelete:e=>{p.splice(e,1),m(),i()},type:`list`}}export{a as generateEditableList,i as reactivelyValidate,n as s};
@@ -1 +1 @@
1
- function e(e){return e.split(`/`).map(e=>decodeURIComponent(e.normalize(`NFC`))).join(`/`)}function t(e,t){let n=e.split(`/`).filter(e=>e!==``).join(`/`);return t?`${n}/`:n}function n(n){return t(e(n),!0)}export{n as normalizeBaseDir,e as normalizeChar,t as normalizeKey};
1
+ function e(e){return e.split(`/`).map(e=>decodeURIComponent(e.normalize(`NFC`))).join(`/`)}function t(e,t){let n=e.split(`/`).filter(e=>e!==``).join(`/`);return t?`${n}/`:n}function n(n){return t(e(n),!0)}function r(e){return encodeURIComponent(e).replaceAll(`!`,`%21`).replaceAll(`'`,`%27`).replaceAll(`(`,`%28`).replaceAll(`)`,`%29`).replaceAll(`*`,`%2A`)}export{r as encodeURIComponent3986,n as normalizeBaseDir,e as normalizeChar,t as normalizeKey};
package/dist/transform.js CHANGED
@@ -1 +1,2 @@
1
- function e(){return{name:`sync-engine-transform`,renderChunk(e){let t=e.replaceAll(/^[ \t]*import\s+['"]obsidian['"]\s*;?[ \t]*$/gmu,``).replaceAll(/^\s*import\s+(?<name>[A-Za-z_$][\w$]*)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmu,(e,t)=>`const ${t} = window.syncEngineApiBridge;`).replaceAll(/^\s*import\s+\*\s+as\s+(?<name>[A-Za-z_$][\w$]*)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmu,(e,t)=>`const ${t} = window.syncEngineApiBridge;`).replaceAll(/^\s*import\s+(?!(?:type\b|\*\s+as\s+))(?<name>.+?)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmu,(e,t)=>`const ${t} = window.syncEngineApiBridge;`);return t===e?void 0:{code:t}},tsdownConfig(e){e.deps??={};let{neverBundle:t}=e.deps;t!==!0&&(typeof t==`function`?e.deps.neverBundle=(e,n,r)=>e===`obsidian`||t(e,n,r):Array.isArray(t)?t.push(`obsidian`):t?e.deps.neverBundle=[t,`obsidian`]:e.deps.neverBundle=[`obsidian`])}}}export{e as default};
1
+ const e=[`name`,`icon`,`description`,`source`,`version`,`readme`];function t(t){return`/*!\n${e.filter(e=>t[e]).map(e=>`${e}: ${t[e]}`).join(`
2
+ `)}\n*/\n`}function n(e,t){return Array.isArray(e)?e.find(({id:e})=>e===t):typeof Object.values(e)[0]==`object`?e[t]:e}function r(e){return{name:`sync-engine-module`,renderChunk(r,i){let a=r.replaceAll(/^[ \t]*import\s+['"]obsidian['"]\s*;?[ \t]*$/gmu,``).replaceAll(/^\s*import\s+(?<name>[A-Za-z_$][\w$]*)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmu,(e,t)=>`const ${t} = window.syncEngineApiBridge;`).replaceAll(/^\s*import\s+\*\s+as\s+(?<name>[A-Za-z_$][\w$]*)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmu,(e,t)=>`const ${t} = window.syncEngineApiBridge;`).replaceAll(/^\s*import\s+(?!(?:type\b|\*\s+as\s+))(?<name>.+?)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmu,(e,t)=>`const ${t} = window.syncEngineApiBridge;`),o=i.isEntry&&e?n(e,i.name):void 0,s=o&&Object.keys(o).length>0?t(o)+a:a;return s===r?void 0:{code:s}},tsdownConfig(e){e.deps??={};let{neverBundle:t}=e.deps;t!==!0&&(typeof t==`function`?e.deps.neverBundle=(e,n,r)=>e===`obsidian`||t(e,n,r):Array.isArray(t)?t.push(`obsidian`):t?e.deps.neverBundle=[t,`obsidian`]:e.deps.neverBundle=[`obsidian`])}}}export{r as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hesprs/sync-engine-sdk",
3
- "version": "3.1.0",
3
+ "version": "3.1.3",
4
4
  "description": "Official SDK for developing modules targeting Sync Engine, the extensible Obsidian syncing plugin.",
5
5
  "keywords": [
6
6
  "obsidian-plugin",