@tscircuit/fake-snippets 0.0.79 → 0.0.81

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.
@@ -18,7 +18,13 @@ import {
18
18
  foldGutter,
19
19
  foldKeymap,
20
20
  } from "@codemirror/language"
21
- import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"
21
+ import {
22
+ defaultKeymap,
23
+ history,
24
+ historyKeymap,
25
+ toggleLineComment,
26
+ toggleBlockComment,
27
+ } from "@codemirror/commands"
22
28
  import { searchKeymap, highlightSelectionMatches } from "@codemirror/search"
23
29
  import { autocompletion, completionKeymap } from "@codemirror/autocomplete"
24
30
  import { lintKeymap } from "@codemirror/lint"
@@ -47,5 +53,15 @@ export const basicSetup: Extension = (() => [
47
53
  ...foldKeymap,
48
54
  ...completionKeymap,
49
55
  ...lintKeymap,
56
+ {
57
+ key: "Mod-/",
58
+ run: toggleLineComment,
59
+ preventDefault: true,
60
+ },
61
+ {
62
+ key: "Mod-Shift-/",
63
+ run: toggleBlockComment,
64
+ preventDefault: true,
65
+ },
50
66
  ]),
51
67
  ])()
@@ -1,11 +1,8 @@
1
1
  export const blankPackageTemplate = {
2
2
  type: "package",
3
3
  code: `
4
- import { createUseComponent } from "@tscircuit/core"
4
+ import type { ChipProps } from "@tscircuit/props"
5
5
 
6
- export const MyChip = (props: { name: string }) => (
7
- <chip {...props} pinLabels={pinLabels} footprint="soic8" />
8
- )
9
6
  const pinLabels = {
10
7
  pin1: [],
11
8
  pin2: [],
@@ -17,6 +14,8 @@ const pinLabels = {
17
14
  pin8: [],
18
15
  } as const
19
16
 
20
- export const useMyChip = createUseComponent(MyChip, pinLabels)
17
+ export const MyChip = (props: ChipProps<typeof pinLabels>) => (
18
+ <chip footprint="soic8" pinLabels={pinLabels} {...props} />
19
+ )
21
20
  `.trim(),
22
21
  }
@@ -9,6 +9,10 @@ export const EditorPage = () => {
9
9
  const { packageId } = useCurrentPackageId()
10
10
  const { data: pkg, isLoading, error } = usePackage(packageId)
11
11
 
12
+ const projectUrl = pkg
13
+ ? `https://tscircuit.com/${pkg.owner_github_username}/${pkg.unscoped_name}`
14
+ : undefined
15
+
12
16
  return (
13
17
  <div className="overflow-x-hidden">
14
18
  <Helmet>
@@ -34,7 +38,7 @@ export const EditorPage = () => {
34
38
  )}
35
39
  </Helmet>
36
40
  <Header />
37
- {!error && <CodeAndPreview pkg={pkg} />}
41
+ {!error && <CodeAndPreview pkg={pkg} projectUrl={projectUrl} />}
38
42
  {error && error.status === 404 && (
39
43
  <div className="w-full h-[calc(100vh-20rem)] text-xl text-center flex justify-center items-center">
40
44
  Package not found
@@ -46,6 +46,7 @@ export const ViewPackagePage = () => {
46
46
  <RepoPageContent
47
47
  packageFiles={packageFiles as any}
48
48
  packageInfo={packageInfo as any}
49
+ packageRelease={packageRelease as any}
49
50
  importantFilePaths={["README.md", "LICENSE", "package.json"]}
50
51
  onFileClicked={(file) => {
51
52
  setLocation(