Skip to content

Generate Examples -- Continued #2272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 152 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
ea67cee
chore: Bring #940 to current monorepo structure
SimeonC Mar 20, 2023
3a95325
chore: Move generate-examples to packages folder
trillium Mar 25, 2024
1696347
chore: mkdir test-case-component, pnpm init
trillium Mar 27, 2024
17e2f25
chore: Add description for test-case-component/package.json
trillium Mar 27, 2024
97018a7
chore: Move generate-examples/src to test-case-examples/src
trillium Mar 27, 2024
0c8e529
fix: Update fixturesDir to point correctly
trillium Mar 25, 2024
b91a714
fix: Use command.spokenForm from data obj
trillium Mar 25, 2024
6735b66
fix: SelectionParser.parse error for UntypedTarget
trillium Mar 25, 2024
30c76ae
feat: Add originalData to loadFixture.ts
trillium Mar 25, 2024
e085c97
chore: Add description to package.json
trillium Mar 25, 2024
3186cd5
chore: Bring dependencies from old package.json
trillium Mar 27, 2024
bd4542d
chore: Bring scripts from old package.json
trillium Mar 27, 2024
f094326
chore: Update package.json name
trillium Mar 27, 2024
31aa6c4
chore: Update version to 0.0.1
trillium Mar 27, 2024
32b94d2
chore: Add type: module to package.json
trillium Mar 27, 2024
0a69934
chore: Create basic tsconfig.json for test-case-component
trillium Mar 27, 2024
a9756d7
chore: Copy jest config from pkgs/cheatsheet
trillium Mar 27, 2024
a087c05
chore: Run `pnpm -w fix:meta` for test-case-component
trillium Mar 27, 2024
490132d
chore: Delete generate-examples folder
trillium Mar 27, 2024
254c0ed
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Mar 27, 2024
844cfbc
chore: Follow pattern for files in /src and not /src/lib
trillium Mar 27, 2024
d1351d2
chore: Add dependencies for /test-case-component in /cursorless-org
trillium Apr 9, 2024
add16dc
wip: Add test-case-component path referecnce
trillium Apr 9, 2024
dc8353e
feat: Match tsconfig to cheatsheet/tsconfig as example
trillium Apr 9, 2024
86dfafe
fix: Remove /lib/ from export in index.ts
trillium Apr 9, 2024
8250440
wip: Basic scaffold for TestCaseComponentPage
trillium Apr 9, 2024
b32c325
chore: Remove buildSpokenForm as it is no longer needed
trillium Apr 9, 2024
a7354f0
chore: Remove package-lock, holdover from previous file structure
trillium Apr 9, 2024
544b118
chore: cursorless-vscode/package.json update as a result of pnpm install
trillium Apr 9, 2024
131a968
chore: Update build script to be compliant with monorepo
trillium Apr 9, 2024
dc28562
chore: Update dependencies, add js-yaml
trillium Apr 9, 2024
34a31c0
chore: Add js-yaml, types to dependencies for cursorless-org
trillium Apr 9, 2024
0314ee1
chore: Add jest as dev dependency for package/test-case-component
trillium Apr 9, 2024
b576e8d
wip: Get yml to pass as props for selected files
trillium Apr 9, 2024
033b425
wip: Create inital component to render shiki code blocks
trillium Apr 9, 2024
0592fbd
wip: Update test-case-componet to import shiki
trillium Apr 9, 2024
dd29896
fixup: lib redo
trillium Apr 9, 2024
0443266
wip: Change title in /component-sheet
trillium May 8, 2024
e0a3421
wip: Add key prop to data.map ShikiComponent
trillium May 8, 2024
188a964
wip: Change css variable names to be in line with new shiki
trillium May 8, 2024
8182a39
wip: Add loadFixture to export
trillium May 9, 2024
fc7adda
chore: Update shiki, move to dev dependencies
trillium May 9, 2024
da45050
feat: Create css files for test-case-component
trillium May 9, 2024
c13b49d
feat: Create css vars theme
trillium May 9, 2024
fd4b90f
feat: Remove fs parts of loadFixture
trillium May 9, 2024
c4a50a5
chore: Switch from IThemedToken to ThemedToken
trillium May 9, 2024
8bdd926
wip: Remove filepath from error state in loadFixtures
trillium May 9, 2024
2da9553
feat: Update component sheet to import yaml files
trillium May 9, 2024
074b68c
feat: Create ShikiComponent
trillium May 9, 2024
cfe7643
feat: Create test-case-componet page scaffolding
trillium May 9, 2024
28d8a65
wip: Drop console log in loadFixture
trillium May 10, 2024
5dbb371
feat: Add ternary logic for data.decorations
trillium May 10, 2024
0cc5b31
wip: Pull in Lang type from old Shiki
trillium May 10, 2024
61148ec
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] May 10, 2024
88fb074
fix: Add export statement to types file
trillium May 10, 2024
abf5fd9
feat: Add filename property to yaml object, use as key
trillium May 11, 2024
3aa0228
feat: Remove `loaded` step in yaml file data acquisition
trillium May 11, 2024
80748fe
fix: Remove duplicate file reference
trillium May 12, 2024
fef0b61
fix: Use BundledLanguage type from Shiki
trillium May 12, 2024
8dd1bf7
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] May 12, 2024
5152eef
fix: Define Lang from BundledLanguage
trillium May 12, 2024
ccde788
feat: Add `upgrade` to exports from cursorless-engine
trillium May 12, 2024
257687b
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] May 12, 2024
75bc289
feat: Add cursorless-engine dependency to cursorless-org
trillium May 12, 2024
80d5f0e
chore: Move non-local imports to top of file
trillium May 12, 2024
5a2c5f5
feat: Import upgrade, add upgrade to data loading step
trillium May 12, 2024
6122848
feat: Drop loaded prop, add TestCaseFixture[] type in test-case-compo…
trillium May 13, 2024
72ca49a
Select incoming in merge conflict in pnpm-lock.yaml
trillium Oct 3, 2024
99e0248
feat: Add lockfile after `pnpm install`
trillium Oct 3, 2024
d3b8da5
chore: Run `pnpm -w fix:meta` for test-case-component
trillium Oct 3, 2024
76cadc6
chore: Resolve import issue with importing "@cursorless/common"
trillium Oct 3, 2024
25422b7
chore: import { TestCaseFixture } --> import type { TestCaseFixture }
trillium Oct 3, 2024
15362a0
feat: Small styling tweaks for ShikiComponent in styles.css
trillium Oct 3, 2024
431348f
wip: Stop using `upgrade` for the moment
trillium Oct 3, 2024
214257f
feat: Drop duplicate data.during in ShikiComponent
trillium Oct 3, 2024
1e48301
chore: Delete buildDictionary file
trillium Jul 24, 2024
956c022
feat: Migrate to current cursorless type PositionPlainObject
trillium Oct 3, 2024
3b305cc
feat: Change var names to adhere to camal case eslint reqs
trillium Oct 3, 2024
8481dce
feat: Add dependency escape-goat to test-case-component
trillium Oct 3, 2024
ff1672d
feat: use htmlEscape for html-escaping in test-case-component
trillium Oct 3, 2024
dfc432b
feat: Change pendingDeleteBackground color to make current colors
trillium Oct 3, 2024
4f610f4
feat: Create referencedBackground class in styles
trillium Oct 3, 2024
f9592bb
feat: Rename decorations --> flashes
trillium Oct 3, 2024
767baea
feat: Rename component-shiki shikiComponent
trillium Oct 3, 2024
8bd0d65
feat: Use @cursorless/common type PositionPlainObject in loadFixture
trillium Oct 3, 2024
fc4ad3e
feat: Add "@cursorless/common" as dev deps for cursorless-org
trillium Oct 4, 2024
81a08bc
feat: Add type TestCaseFixture to loadFixture
trillium Oct 4, 2024
64ee7c0
feat: refactor out getStage functions for readability
trillium Oct 4, 2024
c23b30f
feat: use getStage helper funcs in loadFixture
trillium Oct 4, 2024
fcd1995
chore: Switch console.log --> console.error in error catch
trillium Oct 4, 2024
d18b451
feat: Create interface loadFixtureProps
trillium Oct 4, 2024
ea90b54
feat: Refactor argument object for getState funcs
trillium Oct 4, 2024
2b9a2e1
feat: Update getDuring arg type to TestCaseFixture
trillium Oct 4, 2024
1b86b7a
wip: Add handle clipboard todo note
trillium Oct 4, 2024
b0cc7be
wip: Reorder before, during, after functions
trillium Oct 4, 2024
c6a625e
chore: Drop usued type loaded in App props
trillium Oct 8, 2024
d65b174
feat: Type App { data } to list of TestCaseFixture
trillium Oct 8, 2024
a0e3a49
chore: Move and rename test-case-component-page to TestCaseComponentPage
trillium Oct 22, 2024
1615dbf
chore: Add jsdoc comment to generateHtml
trillium Oct 22, 2024
4c0966f
chore: Remove unused and empty generateHtml file
trillium Oct 22, 2024
c0412aa
Merge remote-tracking branch 'upstream/main' into 2024-10-03_generate…
trillium Apr 5, 2025
ef6626b
chore: Regenerate pnpm-lock after merging upstream
trillium Apr 5, 2025
0fc71d0
chore: Add types/js-yaml dev dep to cursorless-org
trillium Apr 5, 2025
9a8dbbc
chore: Add @cursorless/test-case-component, common as deps for curso…
trillium Apr 5, 2025
6da1260
style: Darken code background color
trillium Apr 7, 2025
a24d4e5
style: Remove top border from .command
trillium Apr 8, 2025
42f0894
feat: Create background color styles from
trillium Apr 8, 2025
4c3968d
feat: Upgrade shiki to ^3.2.2 in test-case-component
trillium Apr 12, 2025
4c39210
wip: Move temp test-case allow list to its own file
trillium Apr 17, 2025
f7f9046
feat: Wrap yaml load in an error boundary
trillium Apr 17, 2025
34230d3
feat: Remove any failed loads before passing data obj
trillium Apr 17, 2025
4cb9075
chore: Add references to test-case-component tsconfig
trillium Apr 17, 2025
5cc2dd6
wip: Play with CSS styles shiki code block
trillium Apr 17, 2025
1c5877a
feat: Removed depricated code in leiu of shiki
trillium Apr 17, 2025
c0e109f
refactor: Switch from arrow to function declaration in TestCaseCompon…
trillium Apr 17, 2025
67359b0
feat: Create Before, During, After components for shikiComponent
trillium Apr 17, 2025
155c8e0
refactor: Wrap JSON data in a details element in shikiComponent
trillium Apr 17, 2025
5c60f0c
feat: Use Before, During, After components in shikiComponent
trillium Apr 17, 2025
a9332e0
refactor: Switch to component function declaration in shikiComponent
trillium Apr 17, 2025
98befaa
feat: Create helpers file for creating shiki decoration objects
trillium Apr 17, 2025
2fea787
wip: Adapt old generateHtml to use Shiki
trillium Apr 17, 2025
1091c71
wip: Adapt old loadFixture to use Shiki
trillium Apr 17, 2025
90aa35a
Merge remote-tracking branch 'upstream/main'
trillium Apr 17, 2025
8883f5b
chore: Refresh pnpm-lock after merge
trillium Apr 17, 2025
5d85359
fix: Update import name in loadFixture
trillium Apr 17, 2025
0d1dd3a
refactor: Rename loadFixture to loadTestCaseFixture
trillium Apr 17, 2025
593c372
wip: Restore more allowList examples for demo
trillium Apr 17, 2025
3349566
wip: Add additional dir for test case rendering
trillium Apr 29, 2025
0189887
feat: Create TestCaseComponentProps type
trillium Apr 29, 2025
2a96351
wip: Add more filenames to allowList
trillium Apr 29, 2025
4070e11
fix: Update display line numbers to start at 0
trillium Apr 29, 2025
5cd4db6
feat: Create thatMark and sourceMark classes
trillium Apr 29, 2025
fc63bf6
refactor: Change class names to drop word Background
trillium Apr 29, 2025
689f20c
feat: Update helper class names function object
trillium Apr 29, 2025
2f99803
feat: Create addContentRangeDecorations helper function
trillium Apr 29, 2025
75deef0
feat: Update getThatMark function
trillium Apr 29, 2025
da387eb
chore: Remove console.log statements
trillium Apr 29, 2025
fbded1f
feat: Update types in helpers.ts
trillium Apr 29, 2025
82e0918
wip: Add continue statement to resolve flashes out of bounds error
trillium Apr 29, 2025
c8ecb7b
feat: Additional type updates in helper.ts
trillium Apr 29, 2025
85afc7c
chore: Remove unused variable in getMarkDecorations
trillium Apr 29, 2025
7035b44
feat: Update return type of createDecorations
trillium Apr 29, 2025
be7e224
feat: Update returned array order of createDecorations
trillium Apr 29, 2025
90752d4
feat: Update prop types of TestCaseComponentPage
trillium Apr 29, 2025
e86532c
feat: Add fallback if rendering with error for TestCaseComponentPage
trillium Apr 29, 2025
6204e9c
feat: Update types in shikiComponent
trillium Apr 29, 2025
309b0c4
chore: Remove console.log statement in shikiComponent
trillium Apr 29, 2025
3ae9773
feat: Update tailwind classes in shikiComponent children
trillium Apr 29, 2025
d77a3ae
feat: Create types in loadTestCaseFixture
trillium Apr 29, 2025
92b138b
refactor: Restrucutre html generation method in loadTestCaseFixture
trillium Apr 29, 2025
6bf9a54
feat: Update types in generateHtml
trillium Apr 29, 2025
b69bbce
feat: Update html generation method in generateHtml
trillium Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cursorless-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export * from "./testUtil/plainObjectToTarget";
export * from "./util/getPartialTargetDescriptors";
export * from "./util/getPrimitiveTargets";
export * from "./util/grammarHelpers";
export * from "./scripts/transformRecordedTests/transformations/upgrade";
3 changes: 3 additions & 0 deletions packages/cursorless-org/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"clean": "rm -rf ./out tsconfig.tsbuildinfo ./dist ./build"
},
"dependencies": {
"@cursorless/common": "workspace:*",
"@cursorless/cheatsheet": "workspace:*",
"@cursorless/test-case-component": "workspace:*",
"@mdx-js/loader": "3.0.1",
"@mdx-js/react": "3.0.1",
"@next/mdx": "14.2.15",
Expand All @@ -24,6 +26,7 @@
},
"devDependencies": {
"@svgr/webpack": "8.1.0",
"@types/js-yaml": "^4.0.9",
"@types/mdx": "2.0.13",
"@types/node": "20.16.0",
"@types/react": "18.3.11",
Expand Down
88 changes: 88 additions & 0 deletions packages/cursorless-org/src/pages/allowList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
export const testSelectedFiles = [
"bringAirAndBatAndCapToAfterItemEach.yml",
"bringAirToEndOfAir.yml", // Shiki intersect error
"bringArgMadeAfterLook.yml",
"carveLineHarp.yml",
"chuckBlockAir.yml",
"chuckBlockAirUntilBatt.yml",
"chuckBlockAirUntilBatt.yml",
"chuckBlockBatt.yml",
"chuckBlockBatt2.yml", // Shiki intersect error
"chuckBlockBattUntilAir.yml",
"chuckFine.yml",
"chuckLineFine.yml",
"chuckLineFineBetweenRisk.yml",
"clearBlockFine.yml",
"clearFine.yml",
"clearLineFine.yml",
"cutFine.yml",
"puffVest.yml",

"bringAirAfterAir.yml",
"bringAirBeforeAir.yml",
"bringAirToEndOfAir.yml",
"bringAirToStartOfAir.yml",
"bringFineAfterLineVest.yml",
"callFineOnBatt.yml",
"cloneHarp2.yml",
"cloneUpHarp2.yml",
"customHarp.yml",
"drinkLine.yml",
"giveBat2.yml",
"giveDot.yml",
"giveDot2.yml",
"giveEndOfDot.yml",
"giveStartOfDot.yml",
"joinAir.yml",
"joinAir2.yml",
"joinAir3.yml",
"joinAir4.yml",
"joinBatPastEach.yml",
"joinTokenBattPastEach.yml",
"pasteAfterLineSpunAndAfterBlockLookAndBeforeLineSpun.yml",
"pasteAfterLineTrapAndAfterBlockTrap.yml",
"placeHelloAfterAir.yml",
"placeHelloToFine.yml",
"pourLine.yml",
"scoutAir.yml",
"scoutAllAir.yml",
"sortEveryItem.yml",
"sortEveryItem2.yml",
"_bringLineHarpAndWhale.yml",
"cloneArgue.yml",
"cloneHarp.yml",
"cloneToken.yml",
"cloneToken2.yml",
"cloneUpHarp.yml",
"pasteAfterArgueBat.yml",
"chuckBlockBatt2.yml",
"appendPostWhale.yml",
"appendPreWhale.yml",
"bringAirAndBatAndCap.yml",
"bringArgueFineAndZip.yml",
"bringVest.yml",
"cloneArgue2.yml",
"cloneToken3.yml",
"cloneToken4.yml",
"cloneUpArgue2.yml",
"cloneUpToken3.yml",
"cloneUpToken4.yml",
"dedentLine.yml",
"flashToken.yml",
"indentLine.yml",
"joinBlock.yml",
"joinFile.yml",
"joinLineThis.yml",
"joinThreeTokens.yml",
"joinTwoLines.yml",
"moveEveryArgMade.yml",
"moveVest.yml",
"parseTreeFile.yml",
"postVest.yml",
"preeVest.yml",
"roundWrapVest.yml",
"swapWithVest.yml",
"voidWrapAir.yml",
"dropToken.yml",
"floatToken.yml",
];
105 changes: 105 additions & 0 deletions packages/cursorless-org/src/pages/component-sheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import * as yaml from "js-yaml";
import fs from "fs";
import path from "path";
import Head from "next/head";

import { loadTestCaseFixture } from "@cursorless/test-case-component";
import { TestCaseComponentPage } from "@cursorless/test-case-component";
import type { TestCaseFixture } from "@cursorless/common";
import { testSelectedFiles } from "./allowList";

import { cheatsheetBodyClasses } from "@cursorless/cheatsheet";

const fixturesDir = path.join("../", "../", "data", "fixtures", "recorded");

async function loadYamlFiles(dir: string, selectedFiles?: string[]) {
const directoryPath = path.join(process.cwd(), dir);
const files = fs.readdirSync(directoryPath);
const data: any[] = [];

files.forEach((file) => {
if (
path.extname(file) === ".yml" &&
(!selectedFiles || selectedFiles.includes(file))
) {
try {
const filePath = path.join(directoryPath, file);
const fileContents = fs.readFileSync(filePath, "utf8");
const yamlData: any = yaml.load(fileContents);
yamlData.filename = file;
data.push(yamlData);
} catch {
console.error("File load failure", file);
}
}
});

return data;
}

// See https://github.com/vercel/next.js/discussions/12325#discussioncomment-1116108
export async function getStaticProps() {
const itemsDirActions = path.join(fixturesDir, "actions");
const itemsDirDecorations = path.join(fixturesDir, "decorations");
const itemsDirInsertEmptyLines = path.join(
fixturesDir,
"actions/insertEmptyLines",
);

const dataActions = await loadYamlFiles(itemsDirActions, testSelectedFiles);
const dataInsertEmptyLines = await loadYamlFiles(
itemsDirInsertEmptyLines,
testSelectedFiles,
);

const dataDecorations = await loadYamlFiles(
itemsDirDecorations,
testSelectedFiles,
);

const data_errors: any[] = [];

const data = (
await Promise.all(
[...dataActions, ...dataDecorations, ...dataInsertEmptyLines].map(
async (val) => {
try {
const fixture = await loadTestCaseFixture(val);
return { ...fixture, raw: val };
} catch (err) {
console.error(err);
data_errors.push(val);
return null;
}
},
),
)
).filter((test) => test !== undefined);

if (data_errors.length > 0) {
console.error("data errors:", data_errors);
}

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

export type TestCaseComponentProps = TestCaseFixture & {
filename: string;
raw: TestCaseFixture;
before: string;
during: string;
after: string;
};

export function App({ data }: { data: TestCaseComponentProps[] }) {
return (
<>
<Head>
<title>Cursorless Test Case Component Page</title>
</Head>
<TestCaseComponentPage data={data} />
</>
);
}

export default App;
6 changes: 6 additions & 0 deletions packages/cursorless-org/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"references": [
{
"path": "../cheatsheet"
},
{
"path": "../cursorless-engine"
},
{
"path": "../test-case-component"
}
],
"exclude": ["node_modules"]
Expand Down
4 changes: 3 additions & 1 deletion packages/cursorless-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,9 @@
"clean": "rm -rf ./out tsconfig.tsbuildinfo ./dist ./build"
},
"devDependencies": {
"@types/fs-extra": "11.0.4",
"@types/chai": "^4.3.14",
"@types/fs-extra": "^11.0.4",
"@types/glob": "^8.1.0",
"@types/js-yaml": "^4.0.9",
"@types/lodash-es": "4.17.12",
"@types/nearley": "2.11.5",
Expand Down
8 changes: 8 additions & 0 deletions packages/test-case-component/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from "jest";

const config: Config = {
preset: "ts-jest",
testEnvironment: "jsdom",
};

export default config;
49 changes: 49 additions & 0 deletions packages/test-case-component/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "@cursorless/test-case-component",
"version": "0.0.1",
"type": "module",
"description": "Component for displaying results of test cases in cursorless-vscode-e2e",
"main": "./out/index.js",
"scripts": {
"build": "my-ts-node src/buildDictionary.ts",
"test": "jest",
"test:watch": "jest --watch",
"compile:tsc": "tsc --build",
"compile:esbuild": "esbuild ./src/index.ts --sourcemap --format=esm --bundle --packages=external --outfile=./out/index.js",
"compile": "pnpm compile:tsc && pnpm compile:esbuild",
"watch:tsc": "pnpm compile:tsc --watch",
"watch:esbuild": "pnpm compile:esbuild --watch",
"watch": "pnpm run --filter @cursorless/test-case-component --parallel '/^watch:.*/'",
"clean": "rm -rf ./out tsconfig.tsbuildinfo ./dist ./build"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@cursorless/common": "workspace:*",
"@cursorless/node-common": "workspace:*",
"escape-goat": "4.0.0",
"fs-extra": "11.2.0",
"js-yaml": "^4.1.0",
"prettier": "3.2.5",
"react": "^18.2.0",
"tsx": "3.12.7",
"yaml": "2.2.1"
},
"types": "./out/index.d.ts",
"exports": {
".": {
"cursorless:bundler": "./src/index.ts",
"default": "./out/index.js"
}
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/jest": "29.5.12",
"@types/react": "18.2.71",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"shiki": "^3.2.2",
"ts-jest": "29.1.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as React from "react";
import { ShikiComponent } from "./shikiComponent";
import "../shiki.css";
import "../styles.css";
import type { TestCaseFixture } from "@cursorless/common";

export type TestCaseComponentProps = TestCaseFixture & {
filename: string;
raw: TestCaseFixture;
before: string;
during: string;
after: string;
};

export function TestCaseComponentPage({
data,
}: {
data: TestCaseComponentProps[];
}) {
return (
<main className="dark:text-stone-100">
<h1 className="mb-1 mt-2 text-center text-2xl md:text-3xl xl:mt-4">
Test Component Sheet{" "}
<small className="block text-sm">
See the {/* <SmartLink to={"https://www.cursorless.org/docs/"}> */}
full documentation
{/* </SmartLink>{" "} */}
to learn more.
</small>
</h1>

{data.map((item: TestCaseComponentProps) => {
if (!item) {
return <p>Error: item is null</p>;
}
const { filename } = item;
if (filename) {
return <ShikiComponent data={item} key={item.filename} />;
} else {
return <></>;
}
})}
</main>
);
}
Loading