Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,12 @@ Function that creates a *CollageJS* piece that can be mounted in a web document'
async function imoUiFactory(options?: ImoUiFactoryOptions): Promise<CorePiece<{}>>;

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;
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/imo-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/shared/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const defaultImPostingOptions: Required<ImPostingOptions> = {
*/
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,
Expand Down
10 changes: 5 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand Down
Loading