@remirror/theme
Advanced tools
Comparing version 3.0.0-beta.2 to 3.0.0-beta.3
@@ -20,2 +20,2 @@ export * as ComponentsTheme from './components-theme'; | ||
export type { Color, CreateThemeVariablesReturn, CSSProperties, Hue, RemirrorThemeType, } from './utils'; | ||
export { createThemeVariables, defaultRemirrorTheme, getTheme, getThemeProps, getThemeVar, getThemeVarName, } from './utils'; | ||
export { createThemeVariables, defaultRemirrorTheme, getThemeVar, getThemeVarName } from './utils'; |
import type * as CSS from 'csstype'; | ||
import type { DeepPartial, DeepString } from '@remirror/core-types'; | ||
import type { DeepPartial } from '@remirror/core-types'; | ||
export interface CSSProperties extends CSS.Properties { | ||
@@ -31,13 +31,2 @@ [key: string]: any; | ||
* ```ts | ||
* import { getTheme } from '@remirror/theme'; | ||
* getTheme((t) => t.color.primary.text) => `var(--rmr-color-primary-text)` | ||
* ``` | ||
* | ||
* @deprecated use getThemeVar instead | ||
*/ | ||
export declare function getTheme(getter: (theme: DeepString<Remirror.Theme>) => string): string; | ||
/** | ||
* Get the theme custom property wrapped in a `var`. | ||
* | ||
* ```ts | ||
* import { getThemeVar } from '@remirror/theme'; | ||
@@ -52,13 +41,2 @@ * getThemeVar('color', 'primary', 'text') => `var(--rmr-color-primary-text)` | ||
/** | ||
* Get the name of the theme property. | ||
* | ||
* ```ts | ||
* import {getThemeProps} from '@remirror/theme'; | ||
* getThemeProps((t) => t.color.primary.text) => `--rmr-color-primary-text` | ||
* ``` | ||
* | ||
* @deprecated use getThemeVarName instead | ||
*/ | ||
export declare function getThemeProps(getter: (theme: DeepString<Remirror.Theme>) => string): string; | ||
/** | ||
* Get the theme custom property wrapped in a `var`. | ||
@@ -65,0 +43,0 @@ * |
@@ -614,30 +614,3 @@ import { transparentize, lighten, darken, readableColor } from 'color2k'; | ||
} | ||
function keyCapturingProxy(getter) { | ||
const keys = []; | ||
function createProxy(obj) { | ||
/** | ||
* Track the number of times this has been called. This proxy only supports | ||
* simple getters which access the keys only without any extra functionality. | ||
*/ | ||
let called = false; | ||
return new Proxy(obj, { | ||
get: (_, key) => { | ||
if (called) { | ||
throw new Error(`Must only access the key once. ${key.toString()}`); | ||
} | ||
called = true; | ||
keys.push(key); | ||
return createProxy({}); | ||
}, | ||
set: (_, key) => { | ||
throw new Error(`Setters are not allowed for this object. ${key.toString()}`); | ||
// invariant(false, { message: `Setters are not allowed for this object. ${key.toString()}` }); | ||
} | ||
}); | ||
} | ||
getter(createProxy({})); | ||
return keys; | ||
} | ||
/** | ||
@@ -647,16 +620,2 @@ * Get the theme custom property wrapped in a `var`. | ||
* ```ts | ||
* import { getTheme } from '@remirror/theme'; | ||
* getTheme((t) => t.color.primary.text) => `var(--rmr-color-primary-text)` | ||
* ``` | ||
* | ||
* @deprecated use getThemeVar instead | ||
*/ | ||
function getTheme(getter) { | ||
return getVar(keyCapturingProxy(getter)); | ||
} | ||
/** | ||
* Get the theme custom property wrapped in a `var`. | ||
* | ||
* ```ts | ||
* import { getThemeVar } from '@remirror/theme'; | ||
@@ -672,16 +631,2 @@ * getThemeVar('color', 'primary', 'text') => `var(--rmr-color-primary-text)` | ||
/** | ||
* Get the name of the theme property. | ||
* | ||
* ```ts | ||
* import {getThemeProps} from '@remirror/theme'; | ||
* getThemeProps((t) => t.color.primary.text) => `--rmr-color-primary-text` | ||
* ``` | ||
* | ||
* @deprecated use getThemeVarName instead | ||
*/ | ||
function getThemeProps(getter) { | ||
return getCustomPropertyName(keyCapturingProxy(getter)); | ||
} | ||
/** | ||
* Get the theme custom property wrapped in a `var`. | ||
@@ -870,2 +815,2 @@ * | ||
export { componentsTheme as ComponentsTheme, coreTheme as CoreTheme, extensionBlockquoteTheme as ExtensionBlockquoteTheme, extensionCalloutTheme as ExtensionCalloutTheme, extensionCodeBlockTheme as ExtensionCodeBlockTheme, extensionCountTheme as ExtensionCountTheme, extensionEmojiTheme as ExtensionEmojiTheme, extensionFileTheme as ExtensionFileTheme, extensionGapCursorTheme as ExtensionGapCursorTheme, extensionImageTheme as ExtensionImageTheme, extensionListTheme as ExtensionListTheme, extensionMentionAtomTheme as ExtensionMentionAtomTheme, extensionPlaceholderTheme as ExtensionPlaceholderTheme, extensionPositionerTheme as ExtensionPositionerTheme, extensionTablesTheme as ExtensionTablesTheme, extensionWhitespaceTheme as ExtensionWhitespaceTheme, reactEditorsTheme as ReactEditorsTheme, THEME, createThemeVariables, defaultRemirrorTheme, getTheme, getThemeProps, getThemeVar, getThemeVarName }; | ||
export { componentsTheme as ComponentsTheme, coreTheme as CoreTheme, extensionBlockquoteTheme as ExtensionBlockquoteTheme, extensionCalloutTheme as ExtensionCalloutTheme, extensionCodeBlockTheme as ExtensionCodeBlockTheme, extensionCountTheme as ExtensionCountTheme, extensionEmojiTheme as ExtensionEmojiTheme, extensionFileTheme as ExtensionFileTheme, extensionGapCursorTheme as ExtensionGapCursorTheme, extensionImageTheme as ExtensionImageTheme, extensionListTheme as ExtensionListTheme, extensionMentionAtomTheme as ExtensionMentionAtomTheme, extensionPlaceholderTheme as ExtensionPlaceholderTheme, extensionPositionerTheme as ExtensionPositionerTheme, extensionTablesTheme as ExtensionTablesTheme, extensionWhitespaceTheme as ExtensionWhitespaceTheme, reactEditorsTheme as ReactEditorsTheme, THEME, createThemeVariables, defaultRemirrorTheme, getThemeVar, getThemeVarName }; |
{ | ||
"name": "@remirror/theme", | ||
"version": "3.0.0-beta.2", | ||
"version": "3.0.0-beta.3", | ||
"description": "The configurable theme for the remirror editor.", | ||
@@ -36,3 +36,3 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/remirror__theme", | ||
"@linaria/core": "4.2.10", | ||
"@remirror/core-types": "3.0.0-beta.2", | ||
"@remirror/core-types": "3.0.0-beta.3", | ||
"color2k": "^2.0.2", | ||
@@ -39,0 +39,0 @@ "csstype": "^3.1.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
172331
2789
+ Added@remirror/core-constants@3.0.0-beta.2(transitive)
+ Added@remirror/core-types@3.0.0-beta.3(transitive)
+ Added@remirror/types@2.0.0-beta.2(transitive)
- Removed@remirror/core-constants@3.0.0-beta.1(transitive)
- Removed@remirror/core-types@3.0.0-beta.2(transitive)
- Removed@remirror/types@2.0.0-beta.1(transitive)