@inpageedit/core 0.3.1 → 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.
@@ -1,7 +1,9 @@
1
- import { Context, Inject, Events as CordisEvents } from 'cordis';
1
+ import { Context, Inject, Events as CordisEvents } from '@cordisjs/core';
2
+ import { Logger } from './utils/Logger';
2
3
  export interface InPageEditCoreConfig {
3
4
  baseURL: string | URL;
4
5
  legacyPreferences: Record<string, any>;
6
+ logLevel: number;
5
7
  }
6
8
  /**
7
9
  * ✏️ InPageEdit NEXT
@@ -14,15 +16,18 @@ export interface InPageEditCoreConfig {
14
16
  */
15
17
  export declare class InPageEdit extends Context {
16
18
  #private;
19
+ readonly version: string;
17
20
  config: InPageEditCoreConfig;
18
21
  static DEFAULT_CONFIG: InPageEditCoreConfig;
19
22
  Endpoints: typeof globalThis.Endpoints;
20
- Schema: Schemastery.Static;
21
- readonly version: string;
23
+ readonly schema: Schemastery.Static;
24
+ readonly logger: Logger;
22
25
  constructor(config?: Partial<InPageEditCoreConfig>);
23
26
  useScope(inject: Inject): Promise<this>;
24
27
  }
25
- export { Inject, Schema, Service } from 'cordis';
28
+ export { default as Schema } from 'schemastery';
29
+ export * from './utils/Logger';
30
+ export { Inject, Service } from '@cordisjs/core';
26
31
  export interface Events<C extends InPageEdit = InPageEdit> extends CordisEvents<C> {
27
32
  }
28
33
  export interface InPageEdit {
@@ -1 +1 @@
1
- {"version":3,"file":"Preferences-Bg3J5Ur9.js","sources":["../src/decorators/Preferences.ts"],"sourcesContent":["import Schema from 'schemastery'\r\n\r\ntype AnyConstructor<T = any> = new (...args: any[]) => T\r\n\r\nexport type PreferenceAugmented<C extends AnyConstructor, D extends Record<string, any>> = C & {\r\n PreferencesSchema: Schema<D>\r\n PreferencesDefaults: D\r\n}\r\n\r\n/**\r\n * Decorator for registering preferences\r\n *\r\n * ```ts\r\n * @RegisterPreferences(\r\n * Schema.object({\r\n * foo: Schema.string().description('Foo description'),\r\n * }),\r\n * {\r\n * foo: 'default foo value',\r\n * }\r\n * )\r\n * class Foo {}\r\n * ```\r\n *\r\n * same as:\r\n *\r\n * ```ts\r\n * class Foo {\r\n * static ConfigSchema = Schema.object({\r\n * foo: Schema.string().description('Foo description')\r\n * })\r\n * static ConfigDefaults = {\r\n * foo: 'default foo value'\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport function RegisterPreferences<D extends Record<string, any>>(schema: Schema<D>, defaults: D) {\r\n return function <T extends AnyConstructor>(target: T): PreferenceAugmented<T, D> {\r\n ;(target as any).PreferencesSchema = schema\r\n ;(target as any).PreferencesDefaults = defaults\r\n return target as PreferenceAugmented<T, D>\r\n }\r\n}\r\n"],"names":["RegisterPreferences","schema","defaults","target"],"mappings":"AAqCO,SAASA,EAAmDC,GAAmBC,GAAa;AACjG,SAAO,SAAoCC,GAAsC;AAC7E,WAAAA,EAAe,oBAAoBF,GACnCE,EAAe,sBAAsBD,GAChCC;AAAA,EACT;AACF;"}
1
+ {"version":3,"file":"Preferences-Bg3J5Ur9.js","sources":["../src/decorators/Preferences.ts"],"sourcesContent":["import type Schema from 'schemastery'\r\n\r\ntype AnyConstructor<T = any> = new (...args: any[]) => T\r\n\r\nexport type PreferenceAugmented<C extends AnyConstructor, D extends Record<string, any>> = C & {\r\n PreferencesSchema: Schema<D>\r\n PreferencesDefaults: D\r\n}\r\n\r\n/**\r\n * Decorator for registering preferences\r\n *\r\n * ```ts\r\n * @RegisterPreferences(\r\n * Schema.object({\r\n * foo: Schema.string().description('Foo description'),\r\n * }),\r\n * {\r\n * foo: 'default foo value',\r\n * }\r\n * )\r\n * class Foo {}\r\n * ```\r\n *\r\n * same as:\r\n *\r\n * ```ts\r\n * class Foo {\r\n * static ConfigSchema = Schema.object({\r\n * foo: Schema.string().description('Foo description')\r\n * })\r\n * static ConfigDefaults = {\r\n * foo: 'default foo value'\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport function RegisterPreferences<D extends Record<string, any>>(schema: Schema<D>, defaults: D) {\r\n return function <T extends AnyConstructor>(target: T): PreferenceAugmented<T, D> {\r\n ;(target as any).PreferencesSchema = schema\r\n ;(target as any).PreferencesDefaults = defaults\r\n return target as PreferenceAugmented<T, D>\r\n }\r\n}\r\n"],"names":["RegisterPreferences","schema","defaults","target"],"mappings":"AAqCO,SAASA,EAAmDC,GAAmBC,GAAa;AACjG,SAAO,SAAoCC,GAAsC;AAC7E,WAAAA,EAAe,oBAAoBF,GACnCE,EAAe,sBAAsBD,GAChCC;AAAA,EACT;AACF;"}