@atlaskit/tokens 0.10.28 → 0.10.29
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.
- package/CHANGELOG.md +61 -0
- package/css/atlassian-dark.css +298 -2
- package/css/atlassian-legacy-dark.css +298 -2
- package/css/atlassian-legacy-light.css +298 -2
- package/css/atlassian-light.css +298 -2
- package/css/atlassian-spacing.css +2 -2
- package/dist/cjs/constants.js +4 -13
- package/dist/cjs/get-token.js +1 -1
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/set-global-theme.js +30 -4
- package/dist/cjs/theme-change-observer.js +3 -2
- package/dist/cjs/theme-config.js +95 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/constants.js +2 -10
- package/dist/es2019/get-token.js +1 -1
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/set-global-theme.js +25 -5
- package/dist/es2019/theme-change-observer.js +5 -3
- package/dist/es2019/theme-config.js +87 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/constants.js +2 -10
- package/dist/esm/get-token.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/set-global-theme.js +28 -5
- package/dist/esm/theme-change-observer.js +5 -3
- package/dist/esm/theme-config.js +87 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/constants.d.ts +1 -8
- package/dist/types/index.d.ts +2 -1
- package/dist/types/set-global-theme.d.ts +2 -2
- package/dist/types/theme-change-observer.d.ts +4 -3
- package/dist/types/theme-config.d.ts +53 -0
- package/dist/types/types.d.ts +0 -3
- package/dist/types-ts4.0/constants.d.ts +1 -14
- package/dist/types-ts4.0/index.d.ts +2 -1
- package/dist/types-ts4.0/set-global-theme.d.ts +2 -2
- package/dist/types-ts4.0/theme-change-observer.d.ts +4 -3
- package/dist/types-ts4.0/theme-config.d.ts +53 -0
- package/dist/types-ts4.0/types.d.ts +0 -3
- package/package.json +2 -1
- package/report.api.md +51 -14
- package/tmp/api-report-tmp.d.ts +36 -8
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the source of truth for themes and all associated meta data.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Themes: The internal identifier of a theme.
|
|
6
|
+
* These ids are what the actual theme files/folders are called.
|
|
7
|
+
* style-dictionary will attempt to locate these in the file-system.
|
|
8
|
+
*/
|
|
9
|
+
export declare type Themes = 'atlassian-light' | 'atlassian-dark' | 'atlassian-legacy-light' | 'atlassian-legacy-dark' | 'atlassian-spacing';
|
|
10
|
+
export declare type ThemeFileNames = Themes;
|
|
11
|
+
/**
|
|
12
|
+
* Theme kinds: The type of theme.
|
|
13
|
+
* Some themes are entirely focused on Color, whilst others are purely focused on spacing.
|
|
14
|
+
* In the future other types may be introduced such as typography.
|
|
15
|
+
*/
|
|
16
|
+
export declare type ThemeKinds = 'color' | 'spacing';
|
|
17
|
+
/**
|
|
18
|
+
* Theme modes: The general purpose of a theme.
|
|
19
|
+
* This attr is used to apply the appropriate system-preference media selector
|
|
20
|
+
* It may also be used as a selector for mode-specific overrides such as light/dark images.
|
|
21
|
+
* The idea is there may exist many color themes, but every theme must either fit into light or dark.
|
|
22
|
+
*/
|
|
23
|
+
export declare type ThemeColorModes = 'light' | 'dark';
|
|
24
|
+
/**
|
|
25
|
+
* Theme ids: The value that will mounted to the DOM as a data attr
|
|
26
|
+
* For example: `data-theme="light"
|
|
27
|
+
*
|
|
28
|
+
* These ids must be kebab case
|
|
29
|
+
*/
|
|
30
|
+
export declare type ThemeIds = 'light' | 'dark' | 'legacy-light' | 'legacy-dark' | 'spacing';
|
|
31
|
+
/**
|
|
32
|
+
* Palettes: The set of base tokens a given theme may be populated with.
|
|
33
|
+
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
34
|
+
* previous color set.
|
|
35
|
+
*/
|
|
36
|
+
export declare type Palettes = 'defaultPalette' | 'legacyPalette' | 'spacingScale';
|
|
37
|
+
/**
|
|
38
|
+
* ThemeConfig: the source of truth for all theme meta-data.
|
|
39
|
+
* This object should be used whenever interfacing with themes.
|
|
40
|
+
*/
|
|
41
|
+
interface ThemeConfig {
|
|
42
|
+
id: ThemeIds;
|
|
43
|
+
displayName: string;
|
|
44
|
+
palette: Palettes;
|
|
45
|
+
attributes: {
|
|
46
|
+
type: 'color';
|
|
47
|
+
mode: ThemeColorModes;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'spacing';
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
declare const themeConfig: Record<Themes, ThemeConfig>;
|
|
53
|
+
export default themeConfig;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InternalTokenIds } from './artifacts/types-internal';
|
|
2
|
-
import { THEME_NAME_MAP, THEMES } from './constants';
|
|
3
2
|
export declare type Groups = 'raw' | 'paint' | 'shadow' | 'palette' | 'opacity' | 'spacing' | 'scale';
|
|
4
3
|
export declare type ActiveTokenState = 'active';
|
|
5
4
|
export declare type DeprecatedTokenState = 'deprecated';
|
|
@@ -10,8 +9,6 @@ export declare type Replacement = InternalTokenIds | InternalTokenIds[];
|
|
|
10
9
|
export declare type ExperimentalReplacement = InternalTokenIds | InternalTokenIds[] | string;
|
|
11
10
|
export declare type PaletteCategory = 'blue' | 'purple' | 'red' | 'magenta' | 'orange' | 'yellow' | 'green' | 'teal' | 'light mode neutral' | 'dark mode neutral';
|
|
12
11
|
export declare type ValueCategory = 'opacity';
|
|
13
|
-
export declare type Themes = typeof THEMES[number];
|
|
14
|
-
export declare type ThemesLongName = keyof typeof THEME_NAME_MAP;
|
|
15
12
|
export interface Token<TValue, Group extends Groups> {
|
|
16
13
|
value: TValue;
|
|
17
14
|
attributes: {
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
export declare const THEMES: readonly [
|
|
2
|
-
"light",
|
|
3
|
-
"dark",
|
|
4
|
-
"legacy-light",
|
|
5
|
-
"legacy-dark",
|
|
6
|
-
"spacing"
|
|
7
|
-
];
|
|
8
1
|
export declare const THEME_DATA_ATTRIBUTE = "data-theme";
|
|
2
|
+
export declare const COLOR_MODE_ATTRIBUTE = "data-color-mode";
|
|
9
3
|
export declare const DEFAULT_THEME = "light spacing";
|
|
10
4
|
export declare const CSS_PREFIX = "ds";
|
|
11
5
|
export declare const CSS_VAR_FULL: string[];
|
|
12
|
-
export declare const THEME_NAME_MAP: {
|
|
13
|
-
'atlassian-light': string;
|
|
14
|
-
'atlassian-dark': string;
|
|
15
|
-
'atlassian-legacy-light': string;
|
|
16
|
-
'atlassian-legacy-dark': string;
|
|
17
|
-
'atlassian-spacing': string;
|
|
18
|
-
};
|
|
19
6
|
export declare const TOKEN_NOT_FOUND_CSS_VAR: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as token } from './get-token';
|
|
2
2
|
export { default as setGlobalTheme } from './set-global-theme';
|
|
3
3
|
export type { CSSToken } from './artifacts/token-names';
|
|
4
|
-
export type { Themes } from './
|
|
4
|
+
export type { Themes, ThemeIds } from './theme-config';
|
|
5
|
+
export { default as themeConfig } from './theme-config';
|
|
5
6
|
export { useThemeObserver, ThemeMutationObserver, } from './theme-change-observer';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const setGlobalTheme: (
|
|
1
|
+
import { ThemeIds } from './theme-config';
|
|
2
|
+
declare const setGlobalTheme: (themeId: ThemeIds, shouldMatchSystem?: boolean) => void;
|
|
3
3
|
export default setGlobalTheme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThemeIds } from './theme-config';
|
|
2
2
|
/**
|
|
3
3
|
* A MutationObserver which watches the `<html>` element for changes to the theme.
|
|
4
4
|
*
|
|
@@ -15,7 +15,8 @@ import { Themes } from './types';
|
|
|
15
15
|
export declare class ThemeMutationObserver {
|
|
16
16
|
private callback;
|
|
17
17
|
observer: MutationObserver | null;
|
|
18
|
-
|
|
18
|
+
mediaObserver: any;
|
|
19
|
+
constructor(callback: (theme: ThemeIds | null) => unknown);
|
|
19
20
|
observe(): void;
|
|
20
21
|
disconnect(): void;
|
|
21
22
|
}
|
|
@@ -32,4 +33,4 @@ export declare class ThemeMutationObserver {
|
|
|
32
33
|
* }, [theme]);
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
35
|
-
export declare const useThemeObserver: () =>
|
|
36
|
+
export declare const useThemeObserver: () => ThemeIds | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the source of truth for themes and all associated meta data.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Themes: The internal identifier of a theme.
|
|
6
|
+
* These ids are what the actual theme files/folders are called.
|
|
7
|
+
* style-dictionary will attempt to locate these in the file-system.
|
|
8
|
+
*/
|
|
9
|
+
export declare type Themes = 'atlassian-light' | 'atlassian-dark' | 'atlassian-legacy-light' | 'atlassian-legacy-dark' | 'atlassian-spacing';
|
|
10
|
+
export declare type ThemeFileNames = Themes;
|
|
11
|
+
/**
|
|
12
|
+
* Theme kinds: The type of theme.
|
|
13
|
+
* Some themes are entirely focused on Color, whilst others are purely focused on spacing.
|
|
14
|
+
* In the future other types may be introduced such as typography.
|
|
15
|
+
*/
|
|
16
|
+
export declare type ThemeKinds = 'color' | 'spacing';
|
|
17
|
+
/**
|
|
18
|
+
* Theme modes: The general purpose of a theme.
|
|
19
|
+
* This attr is used to apply the appropriate system-preference media selector
|
|
20
|
+
* It may also be used as a selector for mode-specific overrides such as light/dark images.
|
|
21
|
+
* The idea is there may exist many color themes, but every theme must either fit into light or dark.
|
|
22
|
+
*/
|
|
23
|
+
export declare type ThemeColorModes = 'light' | 'dark';
|
|
24
|
+
/**
|
|
25
|
+
* Theme ids: The value that will mounted to the DOM as a data attr
|
|
26
|
+
* For example: `data-theme="light"
|
|
27
|
+
*
|
|
28
|
+
* These ids must be kebab case
|
|
29
|
+
*/
|
|
30
|
+
export declare type ThemeIds = 'light' | 'dark' | 'legacy-light' | 'legacy-dark' | 'spacing';
|
|
31
|
+
/**
|
|
32
|
+
* Palettes: The set of base tokens a given theme may be populated with.
|
|
33
|
+
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
34
|
+
* previous color set.
|
|
35
|
+
*/
|
|
36
|
+
export declare type Palettes = 'defaultPalette' | 'legacyPalette' | 'spacingScale';
|
|
37
|
+
/**
|
|
38
|
+
* ThemeConfig: the source of truth for all theme meta-data.
|
|
39
|
+
* This object should be used whenever interfacing with themes.
|
|
40
|
+
*/
|
|
41
|
+
interface ThemeConfig {
|
|
42
|
+
id: ThemeIds;
|
|
43
|
+
displayName: string;
|
|
44
|
+
palette: Palettes;
|
|
45
|
+
attributes: {
|
|
46
|
+
type: 'color';
|
|
47
|
+
mode: ThemeColorModes;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'spacing';
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
declare const themeConfig: Record<Themes, ThemeConfig>;
|
|
53
|
+
export default themeConfig;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InternalTokenIds } from './artifacts/types-internal';
|
|
2
|
-
import { THEME_NAME_MAP, THEMES } from './constants';
|
|
3
2
|
export declare type Groups = 'raw' | 'paint' | 'shadow' | 'palette' | 'opacity' | 'spacing' | 'scale';
|
|
4
3
|
export declare type ActiveTokenState = 'active';
|
|
5
4
|
export declare type DeprecatedTokenState = 'deprecated';
|
|
@@ -10,8 +9,6 @@ export declare type Replacement = InternalTokenIds | InternalTokenIds[];
|
|
|
10
9
|
export declare type ExperimentalReplacement = InternalTokenIds | InternalTokenIds[] | string;
|
|
11
10
|
export declare type PaletteCategory = 'blue' | 'purple' | 'red' | 'magenta' | 'orange' | 'yellow' | 'green' | 'teal' | 'light mode neutral' | 'dark mode neutral';
|
|
12
11
|
export declare type ValueCategory = 'opacity';
|
|
13
|
-
export declare type Themes = typeof THEMES[number];
|
|
14
|
-
export declare type ThemesLongName = keyof typeof THEME_NAME_MAP;
|
|
15
12
|
export interface Token<TValue, Group extends Groups> {
|
|
16
13
|
value: TValue;
|
|
17
14
|
attributes: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tokens",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.29",
|
|
4
4
|
"author": "Atlassian Pty Ltd",
|
|
5
5
|
"description": "Design tokens are the single source of truth to name and store design decisions.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"registry": "https://registry.npmjs.org/"
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
|
+
"disableProductCI": true,
|
|
11
12
|
"team": "Design System Team",
|
|
12
13
|
"releaseModel": "continuous",
|
|
13
14
|
"website": {
|
package/report.api.md
CHANGED
|
@@ -332,31 +332,68 @@ type CSSTokenMap_3 = {
|
|
|
332
332
|
'spacing.scale.075': 'var(--ds-scale-075)';
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
+
// @public
|
|
336
|
+
type Palettes = 'defaultPalette' | 'legacyPalette' | 'spacingScale';
|
|
337
|
+
|
|
338
|
+
// @public (undocumented)
|
|
339
|
+
export const setGlobalTheme: (
|
|
340
|
+
themeId: ThemeIds,
|
|
341
|
+
shouldMatchSystem?: boolean,
|
|
342
|
+
) => void;
|
|
343
|
+
|
|
344
|
+
// @public
|
|
345
|
+
type ThemeColorModes = 'dark' | 'light';
|
|
346
|
+
|
|
347
|
+
// @public
|
|
348
|
+
interface ThemeConfig {
|
|
349
|
+
// (undocumented)
|
|
350
|
+
attributes:
|
|
351
|
+
| {
|
|
352
|
+
type: 'color';
|
|
353
|
+
mode: ThemeColorModes;
|
|
354
|
+
}
|
|
355
|
+
| {
|
|
356
|
+
type: 'spacing';
|
|
357
|
+
};
|
|
358
|
+
// (undocumented)
|
|
359
|
+
displayName: string;
|
|
360
|
+
// (undocumented)
|
|
361
|
+
id: ThemeIds;
|
|
362
|
+
// (undocumented)
|
|
363
|
+
palette: Palettes;
|
|
364
|
+
}
|
|
365
|
+
|
|
335
366
|
// @public (undocumented)
|
|
336
|
-
export const
|
|
367
|
+
export const themeConfig: Record<Themes, ThemeConfig>;
|
|
368
|
+
|
|
369
|
+
// @public
|
|
370
|
+
export type ThemeIds =
|
|
371
|
+
| 'dark'
|
|
372
|
+
| 'legacy-dark'
|
|
373
|
+
| 'legacy-light'
|
|
374
|
+
| 'light'
|
|
375
|
+
| 'spacing';
|
|
337
376
|
|
|
338
377
|
// @public
|
|
339
378
|
export class ThemeMutationObserver {
|
|
340
|
-
constructor(callback: (theme:
|
|
379
|
+
constructor(callback: (theme: ThemeIds | null) => unknown);
|
|
341
380
|
// (undocumented)
|
|
342
381
|
disconnect(): void;
|
|
343
382
|
// (undocumented)
|
|
383
|
+
mediaObserver: any;
|
|
384
|
+
// (undocumented)
|
|
344
385
|
observe(): void;
|
|
345
386
|
// (undocumented)
|
|
346
387
|
observer: MutationObserver | null;
|
|
347
388
|
}
|
|
348
389
|
|
|
349
|
-
// @public
|
|
350
|
-
|
|
351
|
-
'
|
|
352
|
-
'dark'
|
|
353
|
-
'legacy-light'
|
|
354
|
-
'
|
|
355
|
-
'spacing'
|
|
356
|
-
];
|
|
357
|
-
|
|
358
|
-
// @public (undocumented)
|
|
359
|
-
export type Themes = typeof THEMES[number];
|
|
390
|
+
// @public
|
|
391
|
+
export type Themes =
|
|
392
|
+
| 'atlassian-dark'
|
|
393
|
+
| 'atlassian-legacy-dark'
|
|
394
|
+
| 'atlassian-legacy-light'
|
|
395
|
+
| 'atlassian-light'
|
|
396
|
+
| 'atlassian-spacing';
|
|
360
397
|
|
|
361
398
|
// @public (undocumented)
|
|
362
399
|
export function token<T extends keyof Tokens>(
|
|
@@ -676,7 +713,7 @@ const tokens: {
|
|
|
676
713
|
};
|
|
677
714
|
|
|
678
715
|
// @public
|
|
679
|
-
export const useThemeObserver: () =>
|
|
716
|
+
export const useThemeObserver: () => ThemeIds | null;
|
|
680
717
|
|
|
681
718
|
// (No @packageDocumentation comment for this package)
|
|
682
719
|
```
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -322,25 +322,53 @@ type CSSTokenMap_3 = {
|
|
|
322
322
|
'spacing.scale.075': 'var(--ds-scale-075)';
|
|
323
323
|
};
|
|
324
324
|
|
|
325
|
+
// @public
|
|
326
|
+
type Palettes = 'defaultPalette' | 'legacyPalette' | 'spacingScale';
|
|
327
|
+
|
|
328
|
+
// @public (undocumented)
|
|
329
|
+
export const setGlobalTheme: (themeId: ThemeIds, shouldMatchSystem?: boolean) => void;
|
|
330
|
+
|
|
331
|
+
// @public
|
|
332
|
+
type ThemeColorModes = 'dark' | 'light';
|
|
333
|
+
|
|
334
|
+
// @public
|
|
335
|
+
interface ThemeConfig {
|
|
336
|
+
// (undocumented)
|
|
337
|
+
attributes: {
|
|
338
|
+
type: 'color';
|
|
339
|
+
mode: ThemeColorModes;
|
|
340
|
+
} | {
|
|
341
|
+
type: 'spacing';
|
|
342
|
+
};
|
|
343
|
+
// (undocumented)
|
|
344
|
+
displayName: string;
|
|
345
|
+
// (undocumented)
|
|
346
|
+
id: ThemeIds;
|
|
347
|
+
// (undocumented)
|
|
348
|
+
palette: Palettes;
|
|
349
|
+
}
|
|
350
|
+
|
|
325
351
|
// @public (undocumented)
|
|
326
|
-
export const
|
|
352
|
+
export const themeConfig: Record<Themes, ThemeConfig>;
|
|
353
|
+
|
|
354
|
+
// @public
|
|
355
|
+
export type ThemeIds = 'dark' | 'legacy-dark' | 'legacy-light' | 'light' | 'spacing';
|
|
327
356
|
|
|
328
357
|
// @public
|
|
329
358
|
export class ThemeMutationObserver {
|
|
330
|
-
constructor(callback: (theme:
|
|
359
|
+
constructor(callback: (theme: ThemeIds | null) => unknown);
|
|
331
360
|
// (undocumented)
|
|
332
361
|
disconnect(): void;
|
|
333
362
|
// (undocumented)
|
|
363
|
+
mediaObserver: any;
|
|
364
|
+
// (undocumented)
|
|
334
365
|
observe(): void;
|
|
335
366
|
// (undocumented)
|
|
336
367
|
observer: MutationObserver | null;
|
|
337
368
|
}
|
|
338
369
|
|
|
339
|
-
// @public
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
// @public (undocumented)
|
|
343
|
-
export type Themes = typeof THEMES[number];
|
|
370
|
+
// @public
|
|
371
|
+
export type Themes = 'atlassian-dark' | 'atlassian-legacy-dark' | 'atlassian-legacy-light' | 'atlassian-light' | 'atlassian-spacing';
|
|
344
372
|
|
|
345
373
|
// @public (undocumented)
|
|
346
374
|
export function token<T extends keyof Tokens>(path: T, fallback?: string): CSSTokenMap[T];
|
|
@@ -657,7 +685,7 @@ const tokens: {
|
|
|
657
685
|
};
|
|
658
686
|
|
|
659
687
|
// @public
|
|
660
|
-
export const useThemeObserver: () =>
|
|
688
|
+
export const useThemeObserver: () => ThemeIds | null;
|
|
661
689
|
|
|
662
690
|
// (No @packageDocumentation comment for this package)
|
|
663
691
|
|