diff --git a/README.md b/README.md index ee81df0..b008e9a 100644 --- a/README.md +++ b/README.md @@ -170,13 +170,12 @@ Function that creates a *CollageJS* piece that can be mounted in a web document' async function imoUiFactory(options?: ImoUiFactoryOptions): Promise>; type ImoUiFactoryOptions = { - base?: string; shadowDom?: boolean; + localStorageTrigger?: string | undefined; ui?: { position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; language?: string | undefined; theme?: 'light' | 'dark' | 'system'; - localStorageTrigger?: string | undefined; glass?: { enabled?: boolean; opacity?: number; @@ -189,12 +188,11 @@ type ImoUiFactoryOptions = { #### Options -- `base`: Base path used to locate the user interface's CSS. - `shadow`: Set to `true` to have the piece mount in Shadow DOM. +- `localStorageTrigger`: The name of the key that is defined in local storage to trigger the appearance of the user interface. - `ui.position`: The position of the dev-mode user interface being mounted. - `ui.language`: The language used in the user interface. - `ui.theme`: The user interface theme. -- `ui.localStorageTrigger`: The name of the key that is defined in local storage to trigger the appearance of the user interface. - `ui.glass.enabled`: Enables the glass effects in the user interface. - `ui.glass.opacity`: Controls the opacity used to create the glass effect. - `ui.glass.blur`: Controls the blur used to create the glass effect. diff --git a/src/imo-ui.ts b/src/imo-ui.ts index 9a03633..64d76d0 100644 --- a/src/imo-ui.ts +++ b/src/imo-ui.ts @@ -8,6 +8,6 @@ ensureImoController(); // @ts-expect-error TS2540 - ui property is declared as read-only. CollageJs.Imo.ui = new UiController(); const imoUiOptions = await getInitialImoUiFactoryOptions(); -if (imoUiOptions.ui.localStorageTrigger && localStorage.getItem(imoUiOptions.ui.localStorageTrigger) === 'true') { +if (imoUiOptions.localStorageTrigger && localStorage.getItem(imoUiOptions.localStorageTrigger) === 'true') { CollageJs.Imo.ui.mount(imoUiOptions.shadow); } diff --git a/src/shared/options.ts b/src/shared/options.ts index cdacf3e..c6f75cb 100644 --- a/src/shared/options.ts +++ b/src/shared/options.ts @@ -32,11 +32,11 @@ const defaultImPostingOptions: Required = { */ export const defaultImoUiFactoryOptions: RequiredImoUiFactoryOptions = { shadow: true, + localStorageTrigger: 'imo-ui', ui: { theme: 'system', position: 'bottom-right', language: 'en', - localStorageTrigger: 'imo-ui', glass: { enabled: true, blur: 15, diff --git a/src/types.ts b/src/types.ts index cdf6a50..ee0e134 100644 --- a/src/types.ts +++ b/src/types.ts @@ -54,11 +54,6 @@ export type ImoUiOptions = { * @default 'system' */ theme?: Theme; - /** - * Desired local storage key name used to automatically mount the IMO user interface. - * @default 'imo-ui' - */ - localStorageTrigger?: string | undefined; /** * Settings for the glass effect in the `@collagejs/imo` UI. */ @@ -72,6 +67,11 @@ export type ImoUiFactoryOptions = { * Whether to mount the *CollageJS* piece inside a shadow DOM root. */ shadow?: boolean; + /** + * Desired local storage key name used to automatically mount the IMO user interface. + * @default 'imo-ui' + */ + localStorageTrigger?: string | undefined; /** * User interface options. */