Skip to content

Commit 5e6931b

Browse files
authored
Merge pull request #69 from streamich/update
Update
2 parents 180c67b + 7d60783 commit 5e6931b

10 files changed

Lines changed: 22 additions & 82 deletions

File tree

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Node CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
gh-pages:

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# [3.4.0](https://github.com/streamich/code-colors-react/compare/v3.3.0...v3.4.0) (2025-08-30)
22

3-
43
### Features
54

6-
* update deps ([e1da41a](https://github.com/streamich/code-colors-react/commit/e1da41a4f86d5d52fbe01da6e74e1de400430c53))
5+
- update deps ([e1da41a](https://github.com/streamich/code-colors-react/commit/e1da41a4f86d5d52fbe01da6e74e1de400430c53))
76

87
# [3.3.0](https://github.com/streamich/code-colors-react/compare/v3.2.1...v3.3.0) (2024-12-07)
98

10-
119
### Features
1210

13-
* 🎸 remove bold class decorations and make red bg lighter ([e389fc4](https://github.com/streamich/code-colors-react/commit/e389fc462c11caa97893e7993ecca01c443dad08))
11+
- 🎸 remove bold class decorations and make red bg lighter ([e389fc4](https://github.com/streamich/code-colors-react/commit/e389fc462c11caa97893e7993ecca01c443dad08))
1412

1513
## [3.2.1](https://github.com/streamich/code-colors-react/compare/v3.2.0...v3.2.1) (2024-10-10)
1614

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# code-colors-react
22

3-
React component for code syntax highlighting. [__Preview 📕__][storybook]
3+
React component for code syntax highlighting. [**Preview 📕**][storybook]
44

55
[storybook]: https://streamich.github.io/code-colors-react/?path=/story/stories-colortokens--hello-world
66

@@ -72,4 +72,3 @@ Nested languages: JavaScript and CSS inside HTML:
7272
![image](https://github.com/user-attachments/assets/68f296f7-994b-4ddd-b7ce-401cb536a607)
7373

7474
[See more examples][storybook].
75-

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"react-dom": "*"
4545
},
4646
"dependencies": {
47-
"code-colors": "^2.4.0"
47+
"code-colors": "^2.5.0"
4848
},
4949
"devDependencies": {
5050
"@babel/preset-env": "^7.25.7",
@@ -59,13 +59,13 @@
5959
"@storybook/react": "^8.3.5",
6060
"@storybook/react-webpack5": "^8.3.5",
6161
"@storybook/test": "^8.3.5",
62-
"nano-theme": "^1.4.3",
62+
"nano-theme": "^1.5.0",
6363
"prop-types": "^15.8.1",
6464
"react": "^18.3.1",
6565
"react-dom": "^18.3.1",
6666
"rimraf": "^6.0.1",
6767
"storybook": "^8.3.5",
68-
"thingies": "^2.4.0",
68+
"thingies": "^2.6.0",
6969
"typescript": "^5.6.3"
7070
},
7171
"release": {

src/Markup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const Markup: React.FC<MarkupProps> = (props) => {
100100
return () => {
101101
cancelled = true;
102102
};
103-
}, [code, decorate]);
103+
}, [code, decorate, lang]);
104104

105105
rest.children =
106106
node ||

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from "./style";
22
export * from "./palettes";
33
export * from "./ColorTokens";
44
export * from "./Markup";
5+
export * from "./util";

src/palettes.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const light: ColorPalette = {
1111
boolean: "#411888",
1212
nil: theme.g(0, 0.45),
1313
undef: theme.g(0, 0.25),
14-
selection: theme.g(0, 0.08),
1514
};
1615

1716
export const dark: ColorPalette = {
@@ -30,5 +29,4 @@ export const dark: ColorPalette = {
3029
boolean: "#9168c8",
3130
nil: darkTheme.g(0, 0.45),
3231
undef: darkTheme.g(0, 0.25),
33-
selection: darkTheme.g(0, 0.1),
3432
};

src/style.ts

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface ColorPalette {
3030
col6?: string;
3131
negative?: string;
3232
positive?: string;
33-
selection: string;
3433
string?: string;
3534
keyword?: string;
3635
builtin?: string;
@@ -78,24 +77,6 @@ export const palette: ColorPalette = {
7877
negative: theme.color.sem.negative[2],
7978
// positive: theme.color.sem.positive[1],
8079
positive: "#718C00",
81-
selection: "hsl(230, 1%, 90%)",
82-
};
83-
84-
const redSquiggly: CssLikeObject = {
85-
marb: "-2px",
86-
bdb: "2px dotted rgba(255,0,0,.6)",
87-
d: "inline-block",
88-
pos: "relative",
89-
"&:after": {
90-
d: "block",
91-
content: '""',
92-
w: "100%",
93-
h: "4px",
94-
bdb: "2px dotted rgba(255,0,0,.6)",
95-
pos: "absolute",
96-
t: "calc(1em - 1px)",
97-
l: "-2px",
98-
},
9980
};
10081

10182
const backgroundPadding: CssLikeObject = {
@@ -105,11 +86,6 @@ const backgroundPadding: CssLikeObject = {
10586
pad: ".1em",
10687
};
10788

108-
const redBackground: CssLikeObject = {
109-
...backgroundPadding,
110-
bg: "rgba(255,0,0,.05)",
111-
};
112-
11389
export const css = ({
11490
mono1,
11591
mono2 = mono1,
@@ -122,7 +98,6 @@ export const css = ({
12298
col6 = mono3,
12399
negative = col5,
124100
positive = col4,
125-
selection,
126101

127102
string: str = col4,
128103
keyword = col3,
@@ -154,11 +129,6 @@ export const css = ({
154129

155130
return {
156131
col: mono1,
157-
"::selection": {
158-
bg: selection,
159-
col: "inherit",
160-
bdrad: ".2em",
161-
},
162132
".token": {
163133
"&.comment,&.prolog,&.cdata": {
164134
col: mono3,
@@ -188,35 +158,22 @@ export const css = ({
188158
},
189159
"&.important": {
190160
col: important,
191-
...redSquiggly,
192161
},
193162
"&.function": {
194163
col: func,
195164
},
196165
"&.boolean": {
197166
col: boolean,
198-
"&[text=false]": redBackground,
199167
},
200168
"&.number": {
201169
...backgroundPadding,
202170
col: number,
203-
"&:hover": {
204-
bg: lightBg,
205-
},
206-
'&[text="0"],&[text="0.0"]': redBackground,
207171
'&[text*="."]': {
208172
col: float,
209173
},
210174
},
211175
"&.string": {
212176
col: str,
213-
"&[text=\"''\"],&[text='\"\"']": redBackground,
214-
"&:hover": {
215-
td: "underline",
216-
},
217-
"&.template-punctuation:hover": {
218-
td: "none",
219-
},
220177
},
221178
"&.char": {
222179
col: char,
@@ -226,12 +183,10 @@ export const css = ({
226183
},
227184
"&.regex": {
228185
col: regex,
229-
"&:hover": {
230-
td: "underline",
231-
},
232186
},
233187
"&.url.string": {
234188
td: "underline",
189+
textUnderlineOffset: "3px",
235190
},
236191
"&.operator": {
237192
col: operator,
@@ -244,11 +199,6 @@ export const css = ({
244199
},
245200
"&.property": {
246201
col: property,
247-
"&:hover": {
248-
// td: 'underline',
249-
...backgroundPadding,
250-
bg: lightBg,
251-
},
252202
},
253203
"&.punctuation": {
254204
col: punctuation,
@@ -309,17 +259,6 @@ export const css = ({
309259
},
310260
},
311261

312-
".language-js,.language-javascript": {
313-
".token": {
314-
"&.keyword": {
315-
"&[text=var],&[text=with],&[text=debugger]": redSquiggly,
316-
},
317-
"&.function": {
318-
"&[text=eval],&[text=alert]": redSquiggly,
319-
},
320-
},
321-
},
322-
323262
".language-json": {
324263
".token": {
325264
"&.property": {

src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CodeColors } from "code-colors/lib/CodeColors";
22

3-
const bundle = "https://unpkg.com/code-colors@2.2.0/dist/bundle.js";
3+
const bundle = "https://cdn.jsdelivr.net/npm/code-colors@2.5.0/dist/bundle.js";
44

55
let __colors: CodeColors | null = null;
66
export const colors = (): CodeColors => {

yarn.lock

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,10 +2219,10 @@ clean-css@^5.2.2:
22192219
dependencies:
22202220
source-map "~0.6.0"
22212221

2222-
code-colors@^2.4.0:
2223-
version "2.4.0"
2224-
resolved "https://registry.yarnpkg.com/code-colors/-/code-colors-2.4.0.tgz#993955bca93ce08bdfd2ecc20e17772a40eba5fb"
2225-
integrity sha512-6FhZx+bFu0iMwwwVsAfuY9SSmHhMze53Ybjd+sd20v2ocRZzRd2+Uo1dH2Rh9x86qc9wbLCOq6cPXYAi9KVMKw==
2222+
code-colors@^2.5.0:
2223+
version "2.5.0"
2224+
resolved "https://registry.yarnpkg.com/code-colors/-/code-colors-2.5.0.tgz#132b0380f43cadb3429b485b993767c89ca92147"
2225+
integrity sha512-61KEODKoBlS9yWvLTVQjnoFv4HjNSQ41qoJ44K+dz4P7fivwaYJ3GrNi50k6tygi2gVCPkda9CvCC7qVEyLOEw==
22262226
dependencies:
22272227
prismjs "^1.30.0"
22282228
thingies "^2.5.0"
@@ -3392,7 +3392,7 @@ nano-css@^5.6.2:
33923392
stacktrace-js "^2.0.2"
33933393
stylis "^4.3.0"
33943394

3395-
nano-theme@^1.4.3:
3395+
nano-theme@^1.5.0:
33963396
version "1.5.0"
33973397
resolved "https://registry.yarnpkg.com/nano-theme/-/nano-theme-1.5.0.tgz#faa3a0b26dc6cfb3f2cc0ef70e207ca26f06ddb3"
33983398
integrity sha512-lOSUW1IqKDKfeOdwHdwTCCo49BngV83KXRPMI9GDk7Fha6fjhzv2ozNPbrm+h+uh9CCIhM9fkvDtspGfb46bpw==
@@ -4305,11 +4305,16 @@ terser@^5.10.0, terser@^5.31.1:
43054305
commander "^2.20.0"
43064306
source-map-support "~0.5.20"
43074307

4308-
thingies@^2.4.0, thingies@^2.5.0:
4308+
thingies@^2.5.0:
43094309
version "2.5.0"
43104310
resolved "https://registry.yarnpkg.com/thingies/-/thingies-2.5.0.tgz#5f7b882c933b85989f8466b528a6247a6881e04f"
43114311
integrity sha512-s+2Bwztg6PhWUD7XMfeYm5qliDdSiZm7M7n8KjTkIsm3l/2lgVRc2/Gx/v+ZX8lT4FMA+i8aQvhcWylldc+ZNw==
43124312

4313+
thingies@^2.6.0:
4314+
version "2.6.0"
4315+
resolved "https://registry.yarnpkg.com/thingies/-/thingies-2.6.0.tgz#e09b98b9e6f6caf8a759eca8481fea1de974d2b1"
4316+
integrity sha512-rMHRjmlFLM1R96UYPvpmnc3LYtdFrT33JIB7L9hetGue1qAPfn1N2LJeEjxUSidu1Iku+haLZXDuEXUHNGO/lg==
4317+
43134318
throttle-debounce@^3.0.1:
43144319
version "3.0.1"
43154320
resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-3.0.1.tgz#32f94d84dfa894f786c9a1f290e7a645b6a19abb"

0 commit comments

Comments
 (0)