Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored May 9, 2024
1 parent cae981a commit 6afc57c
Show file tree
Hide file tree
Showing 10 changed files with 11,380 additions and 8,366 deletions.
2 changes: 1 addition & 1 deletion packages/cursorless-org/src/pages/component-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function getStaticProps() {
const loaded = (
await Promise.all(data.map((val) => loadFixture(val)))
).filter((val) => val !== undefined);

return { props: { data, loaded, bodyClasses: cheatsheetBodyClasses } };
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from "react";

export const ShikiComponent: React.FC<{ data: any }> = ({ data }) => {

return (
<div className="px-4">
<div className="p-8">
Expand Down
22 changes: 11 additions & 11 deletions packages/test-case-component/src/generateHtml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getHighlighter, createCssVariablesTheme } from "shiki"
import { getHighlighter, createCssVariablesTheme } from "shiki";

import { renderToHtml, HatType, SelectionType, Token } from "./renderToHtml";

Expand All @@ -25,20 +25,20 @@ interface CursorlessFixtureState {
sourceMark?: [CursorlessFixtureSelection];
}

const myTheme = createCssVariablesTheme({
name: 'css-variables',
variablePrefix: '--shiki-',
const myTheme = createCssVariablesTheme({
name: "css-variables",
variablePrefix: "--shiki-",
variableDefaults: {},
fontStyle: true
})
fontStyle: true,
});

export async function generateHtml(state: CursorlessFixtureState, lang: Lang) {

Check failure on line 35 in packages/test-case-component/src/generateHtml.ts

View workflow job for this annotation

GitHub Actions / test-docs-build

Cannot find name 'Lang'.

Check failure on line 35 in packages/test-case-component/src/generateHtml.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, stable)

Cannot find name 'Lang'.

Check failure on line 35 in packages/test-case-component/src/generateHtml.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, stable)

Cannot find name 'Lang'.

Check failure on line 35 in packages/test-case-component/src/generateHtml.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, stable)

Cannot find name 'Lang'.

Check failure on line 35 in packages/test-case-component/src/generateHtml.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, legacy)

Cannot find name 'Lang'.
return new HTMLGenerator(state, lang).generate();
}

const highlighter = getHighlighter({
themes: [myTheme],
langs: ['javascript', 'typescript'],
langs: ["javascript", "typescript"],
});

class HTMLGenerator {
Expand Down Expand Up @@ -67,12 +67,12 @@ class HTMLGenerator {

async getTokens() {
const options = {
theme: 'css-variables',
theme: "css-variables",
lang: this.lang,
}
};
this.tokens = (await highlighter)
.codeToTokens(this.state.documentContents, options).tokens
.map((line) =>
.codeToTokens(this.state.documentContents, options)
.tokens.map((line) =>
line.map(
(token) =>
({
Expand Down
2 changes: 1 addition & 1 deletion packages/test-case-component/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./generate-examples";
export * from "./test-case-component";
export * from "./loadFixture"
export * from "./loadFixture";
6 changes: 2 additions & 4 deletions packages/test-case-component/src/loadFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ async function safeGenerateHtml(
}
}

export async function loadFixture(
data: any
) {
console.log("loadFixture", data)
export async function loadFixture(data: any) {
console.log("loadFixture", data);
try {
const during = data.decorations
? await safeGenerateHtml(
Expand Down
11 changes: 4 additions & 7 deletions packages/test-case-component/src/renderToHtml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// forked from https://github.com/SimeonC/shiki/blob/main/packages/shiki/src/renderer.ts
// forked from https://github.com/SimeonC/shiki/blob/main/packages/shiki/src/renderer.ts

import { ThemedToken } from "shiki";

Expand Down Expand Up @@ -144,10 +144,8 @@ export function renderToHtml(
);
}

return h(
"pre",
{ className: "shiki", style: `background-color: ${bg}` },
[ options.langId ? `<div class="language-id">${options.langId}</div>` : "",
return h("pre", { className: "shiki", style: `background-color: ${bg}` }, [
options.langId ? `<div class="language-id">${options.langId}</div>` : "",
h(
"code",
{},
Expand All @@ -166,8 +164,7 @@ export function renderToHtml(
);
}),
),
]
);
]);
}

const htmlEscapes = {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-case-component/src/shiki.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
--shiki-ansi-bright-cyan-dim: #55ffff80;
--shiki-ansi-bright-white: #ffffff;
--shiki-ansi-bright-white-dim: #ffffff80;
}
}
85 changes: 51 additions & 34 deletions packages/test-case-component/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ body {
place-items: flex-start;
justify-items: stretch;
padding: 42px;
font-family: firacode, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
font-family: firacode, SFMono-Regular, Consolas, "Liberation Mono", Menlo,
monospace;
/* background-image: radial-gradient(at 30% 89%, hsla(220,76%,68%,1) 0px, transparent 50%), radial-gradient(at 35% 0%, hsla(242,68%,61%,1) 0px, transparent 50%), radial-gradient(at 93% 46%, hsla(129,87%,73%,1) 0px, transparent 50%), radial-gradient(at 23% 49%, hsla(50,77%,67%,1) 0px, transparent 50%), radial-gradient(at 17% 27%, hsla(331,64%,60%,1) 0px, transparent 50%), radial-gradient(at 79% 30%, hsla(151,61%,77%,1) 0px, transparent 50%), radial-gradient(at 26% 40%, hsla(36,65%,63%,1) 0px, transparent 50%); */
}

body, pre.shiki, pre.shiki span {
body,
pre.shiki,
pre.shiki span {
line-height: var(--line-height);
min-height: var(--line-height);
font-size: 14px;
Expand All @@ -26,61 +29,72 @@ body, pre.shiki, pre.shiki span {
gap: 16px;
padding: 16px;
border: 1px solid var(--color-border);
box-shadow: 0px 0px 6px #000A;
box-shadow: 0px 0px 6px #000a;
border-radius: 8px;
background: #ccc9;
& > div{
& > div {
background: #fff;
border: 1px solid var(--color-border);
border-radius: 8px};
border-radius: 8px;
}
}



pre.shiki {
padding: 12px 16px;
display: flex;
flex-direction: column;
.line {
display: block}
display: block;
}
}

.command {
border-top: 1px solid var(--color-border);
padding: 8px;
font-weight: bold;
text-align: center}
text-align: center;
}

@keyframes blink {
0%, 60%{
border-color: #667F}
61%, 100%{
border-color: #6670}}
0%,
60% {
border-color: #667f;
}
61%,
100% {
border-color: #6670;
}
}

.selection {
display: inline-block;
border-right: 2px solid #00B;
border-right: 2px solid #00b;
animation: blink 1400ms infinite;
padding: 0px 0.5px 0px 0;
margin: 0 0px 0 -1px;
height: var(--line-height)}

.selection:not(:empty){
background: #55F2;
padding-left: 0.5px}
.decoration{
height: var(--line-height);
}

.selection:not(:empty) {
background: #55f2;
padding-left: 0.5px;
}
.decoration {
display: inline-block;
padding: 0px 0.5px 0px 0.5px;
margin: 0 0px 0 -1px;
height: var(--line-height);
background: green}
.decoration.pendingDeleteBackground{
background: #ffaeae}

.hat{
background: green;
}
.decoration.pendingDeleteBackground {
background: #ffaeae;
}

.hat {
position: relative;
display: inline-block;
&::after {
content: '';
content: "";
display: inline;
top: 0px;
left: 50%;
Expand All @@ -89,12 +103,15 @@ pre.shiki {
background-color: grey;
mask-repeat: no-repeat;
width: 10px;
height: 10px}
height: 10px;
}
.hat.default::after{
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 308.34 254.24"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><ellipse class="cls-1" cx="154.17" cy="127.12" rx="154.17" ry="127.12"/></g></g></svg>');
top: -0.4px;
width: 6px;
height: 6px}
.hat.wing::after{
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 371.81 234.76" ><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M371.81,234.42h0s-153.27-57.29-185.9-54.08h0C154.36,177.24,0,234.76,0,234.76H0L158.55,101.69c.6-.49-.39,1.87-.23,1.12L186.24,0h0l26.84,101.37"/></g></g></svg>')};
}
.hat.default::after {
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 308.34 254.24"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><ellipse class="cls-1" cx="154.17" cy="127.12" rx="154.17" ry="127.12"/></g></g></svg>');
top: -0.4px;
width: 6px;
height: 6px;
}
.hat.wing::after {
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 371.81 234.76" ><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M371.81,234.42h0s-153.27-57.29-185.9-54.08h0C154.36,177.24,0,234.76,0,234.76H0L158.55,101.69c.6-.49-.39,1.87-.23,1.12L186.24,0h0l26.84,101.37"/></g></g></svg>');
}
2 changes: 1 addition & 1 deletion packages/test-case-component/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"src/**/*.tsx",
"src/**/*.json",
"../../typings/**/*.d.ts"
]
]
}
Loading

0 comments on commit 6afc57c

Please sign in to comment.