-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(platform): code and flow inspections (#230)
<!-- Thank you for contributing! Provide a description of your changes below and a general summary in the title. --> ## Description <!--- Describe your changes in detail here --> ## Type of Change <!--- Put an `x` ( and remove spaces ) in all the boxes that apply: --> ### Changes in docs (`docs`) - [ ] ✨ `improve(docs)` - e.g. added a new paragraph, example, using a better wording, adding a new document, etc. - [ ] 🛠️ `fix(docs)` - bug fix, e.g. fix a typo, page render issue - [ ] ❌ `BREAKING CHANGE(docs)` - e.g. removing a document/article/category that was referenced in many other places - [ ] 🧹 `refactor(docs)` - changed a code example, e.g. replaced old code with a modern one - [ ] 🗑️ `chore(docs)` - other changes that don't affect the docs, e.g. updating the CI/CD pipeline ### Changes in the platform (`platform`) - [x] ✨ `feat(platform)` - a new feature, e.g. a new MDX component, plugin, theme, etc. - [ ] 🛠️ `fix(platform)` - bug fix, e.g. fix a typo, issue causing component to crash - [ ] ❌ `BREAKING CHANGE(platform)` - e.g. removing a feature, changing the API, etc. - [x] 🧹 `refactor(platform)` - code improvements, changes, e.g. unifying style, renaming internals, etc. - [ ] 📝 `docs(platform)` - updated code documentation - [ ] 🗑️ `chore(platform)` - other changes that don't affect the platform directly, e.g. updating the CI/CD pipeline
- Loading branch information
Showing
21 changed files
with
1,211 additions
and
113 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
content/learn/course/basics/_inspections/first-program/code-block-content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { compute, makeBlock } from "@site/src/components/mdx/CodeBlock/Inspection/Setup"; | ||
|
||
const inspection = compute({ | ||
showControlButtons: false, | ||
runOnStart: true, | ||
stages: [ | ||
{ highlights: [ makeBlock(2, 4, 0, 25) ] }, | ||
] | ||
}); | ||
|
||
export default inspection; |
14 changes: 14 additions & 0 deletions
14
content/learn/course/basics/_inspections/first-program/instruction-order.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { compute } from "@site/src/components/mdx/CodeBlock/Inspection/Setup"; | ||
|
||
const inspection = compute({ | ||
showControlButtons: true, | ||
runOnStart: true, | ||
replayDelay: 2000, | ||
stages: [ | ||
{ highlights: [ 4 ] }, | ||
{ highlights: [ 5 ] }, | ||
{ highlights: [ 6 ] }, | ||
] | ||
}); | ||
|
||
export default inspection; |
48 changes: 48 additions & 0 deletions
48
content/learn/course/basics/_inspections/loops/print-vector-range-based-for.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { InspectionStage, compute, lineFragment, /*makeArrow,*/ makeHighlight } from "@site/src/components/mdx/CodeBlock/Inspection/Setup"; | ||
|
||
const loopVar = lineFragment(2, 5, 10); | ||
const vecElements = [ | ||
lineFragment(0, 29, 31), // id 0 | ||
lineFragment(0, 33, 35), // id 1 | ||
lineFragment(0, 37, 39), // ... | ||
lineFragment(0, 41, 42), | ||
lineFragment(0, 44, 46), | ||
lineFragment(0, 48, 50), | ||
]; | ||
|
||
const loopIteration = (idx: number): InspectionStage[] => { | ||
return [ | ||
{ highlights: [makeHighlight(2, "default")], }, | ||
{ highlights: [loopVar, vecElements[idx]] }, | ||
{ highlights: [3, vecElements[idx]] }, | ||
{ highlights: [4, vecElements[idx]] }, | ||
{ highlights: [5, vecElements[idx]] }, | ||
]; | ||
}; | ||
|
||
const inspection = compute({ | ||
showControlButtons: true, | ||
runOnStart: false, | ||
autoPlayInterval: 400, | ||
stages: [ | ||
{ | ||
highlights: [0], | ||
// arrows: [ | ||
// makeArrow(2, "neutral"), | ||
// ] | ||
}, | ||
// { | ||
// // arrows: [ | ||
// // makeArrow(3, "error"), | ||
// // ] | ||
// }, | ||
...loopIteration(0), | ||
...loopIteration(1), | ||
...loopIteration(2), | ||
...loopIteration(3), | ||
...loopIteration(4), | ||
...loopIteration(5), | ||
] | ||
}); | ||
|
||
export default inspection; |
39 changes: 39 additions & 0 deletions
39
content/learn/course/basics/_inspections/loops/top-example.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { compute, lineFragment, makeBlock } from "@site/src/components/mdx/CodeBlock/Inspection/Setup"; | ||
|
||
// This is example of a simple inspection. | ||
|
||
const inspection = compute({ | ||
showControlButtons: true, | ||
runOnStart: true, | ||
stages: [ | ||
{ | ||
highlights: [ | ||
lineFragment(2, 2, 11), | ||
], | ||
}, | ||
{ | ||
highlights: [ | ||
lineFragment(2, 15, 16), | ||
], | ||
}, | ||
{ | ||
highlights: [ | ||
makeBlock(0, 2, 10, 20), | ||
], | ||
}, | ||
{ | ||
highlights: [ 0 ], | ||
}, | ||
{ | ||
highlights: [ 1 ], | ||
}, | ||
{ | ||
highlights: [ 2 ], | ||
}, | ||
{ | ||
highlights: [ 3 ], | ||
}, | ||
] | ||
}); | ||
|
||
export default inspection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.