How to use the @remirror/core-helpers.deepMerge function in @remirror/core-helpers

To help you get started, we’ve selected a few @remirror/core-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / core / src / extension.ts View on Github external
constructor(options: GOptions = Object.create(null)) {
    this.options = deepMerge(defaultOptions, { ...this.defaultOptions, ...options });

    this.init();
  }
github ifiokjr / remirror / @remirror / ui / src / ui-utils.ts View on Github external
export const applyColorMode = (theme: RemirrorTheme, mode: string): RemirrorTheme => {
  if (!mode) {
    return theme;
  }

  const modes = get('colors.modes', theme, {});

  return deepMerge(theme, { colors: get(mode, modes, {}) });
};
github ifiokjr / remirror / @remirror / ui / src / ui-provider.tsx View on Github external
const disableMergeWithEmotion = disableMerge.includes('emotion');

  const outer = useRemirrorTheme();
  const emotionTheme = useEmotionTheme();
  const [colorMode, setColorMode] = useState(initialColorMode ?? outer.colorMode);

  const parentEmotionTheme = isRoot(outer) && !disableMergeWithEmotion ? emotionTheme : {};
  const parent = disableMergeWithParent
    ? hasParent(outer)
      ? outer.parent
      : Object.create(null)
    : isRoot(outer) && disableMergeWithBase
    ? Object.create(null)
    : outer.theme;

  const themeWithoutColorMode: RemirrorTheme = deepMerge(
    parentEmotionTheme,
    parent,
    isFunction(themeProp) ? themeProp(parent) : themeProp,
  );
  const theme = applyColorMode(themeWithoutColorMode, colorMode);

  const [get, colorModes] = useMemo(() => [getFactory(theme), getColorModes(theme)], [theme]);

  const value = {
    ...defaultRemirrorThemeValue,
    ...(withoutEmotion
      ? withoutEmotionProps
      : {
          sxx: (...args: Parameters) =>
            defaultRemirrorThemeValue.sx(...args)(theme),
        }),