scoobie 19.0.2 → 19.1.0
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/package.json +10 -11
- package/src/components/Blockquote.css.ts +23 -6
- package/src/components/Blockquote.tsx +7 -2
- package/src/components/CodeContainer.css.ts +25 -11
- package/src/components/CodeContainer.tsx +23 -17
- package/src/components/CodeThemeProvider.tsx +26 -0
- package/src/components/InlineCode.css.ts +22 -12
- package/src/components/InlineCode.tsx +1 -1
- package/src/index.ts +1 -0
- package/styles/index.ts +9 -4
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"version": "19.0
|
|
7
|
+
"version": "19.1.0",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@capsizecss/core": "^4.0.0",
|
|
10
10
|
"@vanilla-extract/css": "^1.2.3",
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@changesets/cli": "2.27.12",
|
|
20
20
|
"@changesets/get-github-info": "0.6.0",
|
|
21
|
-
"@storybook/addon-essentials": "8.5.
|
|
21
|
+
"@storybook/addon-essentials": "8.5.3",
|
|
22
22
|
"@storybook/addon-webpack5-compiler-babel": "3.0.5",
|
|
23
|
-
"@storybook/react": "8.5.
|
|
24
|
-
"@storybook/react-webpack5": "8.5.
|
|
25
|
-
"@types/react": "18.3.
|
|
23
|
+
"@storybook/react": "8.5.3",
|
|
24
|
+
"@storybook/react-webpack5": "8.5.3",
|
|
25
|
+
"@types/react": "18.3.18",
|
|
26
26
|
"@types/react-dom": "18.3.5",
|
|
27
|
-
"braid-design-system": "33.
|
|
27
|
+
"braid-design-system": "33.5.0",
|
|
28
28
|
"loki": "0.35.1",
|
|
29
29
|
"react": "18.3.1",
|
|
30
30
|
"react-dom": "18.3.1",
|
|
31
31
|
"react-helmet-async": "2.0.5",
|
|
32
|
-
"react-router-dom": "7.1.
|
|
33
|
-
"sku": "
|
|
34
|
-
"storybook": "8.5.
|
|
32
|
+
"react-router-dom": "7.1.5",
|
|
33
|
+
"sku": "14.0.3",
|
|
34
|
+
"storybook": "8.5.3",
|
|
35
35
|
"webpack": "5.97.1"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"braid-design-system": ">= 31.21.0",
|
|
46
46
|
"react": ">= 17 < 19",
|
|
47
|
-
"react-router-dom": ">= 5.3.0"
|
|
48
|
-
"sku": ">= 13.0.0 < 14"
|
|
47
|
+
"react-router-dom": ">= 5.3.0"
|
|
49
48
|
},
|
|
50
49
|
"repository": {
|
|
51
50
|
"type": "git",
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { vars } from 'braid-design-system/css';
|
|
2
|
+
import { colorModeStyle, vars } from 'braid-design-system/css';
|
|
3
3
|
|
|
4
|
-
export const quoteBlock = style(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export const quoteBlock = style([
|
|
5
|
+
{
|
|
6
|
+
borderLeftStyle: 'solid',
|
|
7
|
+
borderLeftWidth: vars.space.xxsmall,
|
|
8
|
+
borderRadius: vars.borderRadius.standard,
|
|
9
|
+
position: 'relative',
|
|
10
|
+
},
|
|
11
|
+
colorModeStyle({
|
|
12
|
+
darkMode: {
|
|
13
|
+
backgroundColor: vars.backgroundColor.neutral,
|
|
14
|
+
borderLeftColor: vars.borderColor.field,
|
|
15
|
+
},
|
|
16
|
+
lightMode: {
|
|
17
|
+
backgroundColor: vars.backgroundColor.neutralLight,
|
|
18
|
+
borderLeftColor: vars.borderColor.neutralLight,
|
|
19
|
+
},
|
|
20
|
+
}),
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export const quoteMark = style({
|
|
24
|
+
right: vars.space.xxsmall,
|
|
25
|
+
top: vars.space.xxsmall,
|
|
9
26
|
});
|
|
@@ -4,13 +4,18 @@ import type { StackChildrenProps } from '../private/types';
|
|
|
4
4
|
|
|
5
5
|
import * as styles from './Blockquote.css';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type Props = StackChildrenProps;
|
|
8
8
|
|
|
9
9
|
export const Blockquote = ({ children }: Props) => (
|
|
10
10
|
<Box className={styles.quoteBlock} padding="medium">
|
|
11
11
|
<Stack space="medium">{children}</Stack>
|
|
12
12
|
|
|
13
|
-
<Box
|
|
13
|
+
<Box
|
|
14
|
+
position="absolute"
|
|
15
|
+
className={styles.quoteMark}
|
|
16
|
+
userSelect="none"
|
|
17
|
+
zIndex={0}
|
|
18
|
+
>
|
|
14
19
|
<Heading component="div" level="2">
|
|
15
20
|
<Secondary>”</Secondary>
|
|
16
21
|
</Heading>
|
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
import { style } from '@vanilla-extract/css';
|
|
2
2
|
import { calc } from '@vanilla-extract/css-utils';
|
|
3
|
-
import { responsiveStyle, vars } from 'braid-design-system/css';
|
|
4
|
-
import { darken } from 'polished';
|
|
3
|
+
import { colorModeStyle, responsiveStyle, vars } from 'braid-design-system/css';
|
|
4
|
+
import { darken, lighten } from 'polished';
|
|
5
5
|
|
|
6
6
|
import { codeBackgroundColor } from '../../styles';
|
|
7
7
|
|
|
8
|
-
export const lineNumberContainer = style(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
8
|
+
export const lineNumberContainer = style([
|
|
9
|
+
{
|
|
10
|
+
borderTopLeftRadius: vars.borderRadius.large,
|
|
11
|
+
borderBottomLeftRadius: vars.borderRadius.large,
|
|
12
|
+
color: vars.foregroundColor.secondary,
|
|
13
|
+
userSelect: 'none',
|
|
14
|
+
},
|
|
15
|
+
colorModeStyle({
|
|
16
|
+
darkMode: { backgroundColor: lighten(0.05, codeBackgroundColor.darkMode) },
|
|
17
|
+
lightMode: { backgroundColor: darken(0.05, codeBackgroundColor.lightMode) },
|
|
18
|
+
}),
|
|
19
|
+
]);
|
|
15
20
|
|
|
16
21
|
export const codeContainer = style([
|
|
17
22
|
{
|
|
18
|
-
backgroundColor: codeBackgroundColor,
|
|
19
|
-
borderColor: darken(0.05, codeBackgroundColor),
|
|
20
23
|
borderStyle: 'solid',
|
|
21
24
|
borderWidth: vars.borderWidth.standard,
|
|
22
25
|
|
|
23
26
|
overflow: 'auto',
|
|
24
27
|
},
|
|
25
28
|
|
|
29
|
+
colorModeStyle({
|
|
30
|
+
darkMode: {
|
|
31
|
+
backgroundColor: codeBackgroundColor.darkMode,
|
|
32
|
+
borderColor: lighten(0.05, codeBackgroundColor.darkMode),
|
|
33
|
+
},
|
|
34
|
+
lightMode: {
|
|
35
|
+
backgroundColor: codeBackgroundColor.lightMode,
|
|
36
|
+
borderColor: darken(0.05, codeBackgroundColor.lightMode),
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
|
|
26
40
|
responsiveStyle({
|
|
27
41
|
mobile: {
|
|
28
42
|
// Roughly 15 lines of code at standard size.
|
|
@@ -3,6 +3,8 @@ import { Highlight, type Token } from 'prism-react-renderer';
|
|
|
3
3
|
|
|
4
4
|
import { Prism, themes } from '../private/Prism';
|
|
5
5
|
|
|
6
|
+
import { useCodeTheme } from './CodeThemeProvider';
|
|
7
|
+
|
|
6
8
|
import * as styles from './CodeContainer.css';
|
|
7
9
|
import * as codeStyles from '../../styles/code.css';
|
|
8
10
|
|
|
@@ -14,24 +16,28 @@ export const CodeContainer = ({
|
|
|
14
16
|
code: string;
|
|
15
17
|
language: string;
|
|
16
18
|
lineNumbers?: boolean;
|
|
17
|
-
}) =>
|
|
18
|
-
|
|
19
|
-
<Highlight
|
|
20
|
-
prism={Prism}
|
|
21
|
-
code={code}
|
|
22
|
-
language={language}
|
|
23
|
-
theme={themes.github}
|
|
24
|
-
>
|
|
25
|
-
{({ getTokenProps, tokens }) => (
|
|
26
|
-
<Box display="flex">
|
|
27
|
-
{lineNumbers ? <LineNumbers count={tokens.length} /> : null}
|
|
19
|
+
}) => {
|
|
20
|
+
const theme = useCodeTheme();
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
return (
|
|
23
|
+
<Box borderRadius="large" className={styles.codeContainer}>
|
|
24
|
+
<Highlight
|
|
25
|
+
prism={Prism}
|
|
26
|
+
code={code}
|
|
27
|
+
language={language}
|
|
28
|
+
theme={themes[theme]}
|
|
29
|
+
>
|
|
30
|
+
{({ getTokenProps, tokens }) => (
|
|
31
|
+
<Box display="flex">
|
|
32
|
+
{lineNumbers ? <LineNumbers count={tokens.length} /> : null}
|
|
33
|
+
|
|
34
|
+
<Lines getTokenProps={getTokenProps} lines={tokens} />
|
|
35
|
+
</Box>
|
|
36
|
+
)}
|
|
37
|
+
</Highlight>
|
|
38
|
+
</Box>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
35
41
|
|
|
36
42
|
const LineNumbers = ({ count }: { count: number }) => {
|
|
37
43
|
const numbers = [...new Array(count)].map((_, index) => index + 1);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { themes } from 'prism-react-renderer';
|
|
2
|
+
import { type ReactNode, createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
type CodeTheme = keyof typeof themes;
|
|
5
|
+
|
|
6
|
+
const ctx = createContext<CodeTheme>('github');
|
|
7
|
+
|
|
8
|
+
interface CodeThemeProviderProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The current color mode.
|
|
13
|
+
*
|
|
14
|
+
* This defaults to `lightMode` in the absence of a `ColorModeProvider`.
|
|
15
|
+
*/
|
|
16
|
+
theme: CodeTheme;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const CodeThemeProvider = ({
|
|
20
|
+
children,
|
|
21
|
+
theme: theme,
|
|
22
|
+
}: CodeThemeProviderProps) => (
|
|
23
|
+
<ctx.Provider value={theme}>{children}</ctx.Provider>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const useCodeTheme = (): CodeTheme => useContext(ctx);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { style, styleVariants } from '@vanilla-extract/css';
|
|
2
2
|
import { calc } from '@vanilla-extract/css-utils';
|
|
3
|
-
import { vars } from 'braid-design-system/css';
|
|
4
|
-
import { darken } from 'polished';
|
|
3
|
+
import { colorModeStyle, vars } from 'braid-design-system/css';
|
|
4
|
+
import { darken, lighten } from 'polished';
|
|
5
5
|
|
|
6
6
|
import { codeBackgroundColor, monospaceFontFamily } from '../../styles';
|
|
7
7
|
|
|
@@ -22,21 +22,31 @@ export const colourBlockWrapper = style({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
export const weightBorder = styleVariants({
|
|
25
|
-
regular:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
regular: [
|
|
26
|
+
{
|
|
27
|
+
borderStyle: 'solid',
|
|
28
|
+
borderWidth: vars.borderWidth.standard,
|
|
29
|
+
},
|
|
30
|
+
colorModeStyle({
|
|
31
|
+
darkMode: { borderColor: lighten(0.05, codeBackgroundColor.darkMode) },
|
|
32
|
+
lightMode: { borderColor: darken(0.05, codeBackgroundColor.lightMode) },
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
30
35
|
|
|
31
36
|
weak: {},
|
|
32
37
|
});
|
|
33
38
|
|
|
34
39
|
export const weight = styleVariants({
|
|
35
|
-
regular:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
regular: [
|
|
41
|
+
{
|
|
42
|
+
paddingLeft: vars.space.xxsmall,
|
|
43
|
+
paddingRight: vars.space.xxsmall,
|
|
44
|
+
},
|
|
45
|
+
colorModeStyle({
|
|
46
|
+
darkMode: { backgroundColor: codeBackgroundColor.darkMode },
|
|
47
|
+
lightMode: { backgroundColor: codeBackgroundColor.lightMode },
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
40
50
|
|
|
41
51
|
weak: {},
|
|
42
52
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Blockquote } from './components/Blockquote';
|
|
2
2
|
export { CodeBlock } from './components/CodeBlock';
|
|
3
3
|
export { CodeContainer } from './components/CodeContainer';
|
|
4
|
+
export { CodeThemeProvider } from './components/CodeThemeProvider';
|
|
4
5
|
export { CopyableText } from './components/CopyableText';
|
|
5
6
|
export { InlineCode } from './components/InlineCode';
|
|
6
7
|
export { InternalLink } from './components/InternalLink';
|
package/styles/index.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// https://github.com/seek-oss/braid-design-system/blob/braid-design-system%4033.5.0/packages/braid-design-system/src/lib/color/palette.ts#L2-L14
|
|
2
|
+
export const codeBackgroundColor = {
|
|
3
|
+
// Braid grey.50
|
|
4
|
+
lightMode: '#F7F8FB',
|
|
4
5
|
|
|
5
|
-
//
|
|
6
|
+
// Braid grey.900
|
|
7
|
+
darkMode: '#0E131B',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// SEEK's former font + GitHub defaults
|
|
6
11
|
export const monospaceFontFamily =
|
|
7
12
|
"'Roboto Mono',SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace";
|