@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.
- package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +31 -0
- package/bun-tests/fake-snippets-api/routes/package_releases/update.test.ts +3 -0
- package/bun.lock +24 -18
- package/dist/bundle.js +35 -7
- package/dist/index.d.ts +10 -0
- package/dist/index.js +4 -1
- package/dist/schema.d.ts +16 -0
- package/dist/schema.js +4 -1
- package/fake-snippets-api/lib/db/schema.ts +4 -0
- package/fake-snippets-api/routes/api/package_releases/create.ts +14 -1
- package/fake-snippets-api/routes/api/package_releases/update.ts +14 -1
- package/package.json +5 -5
- package/src/components/PackageBuildsPage/package-build-header.tsx +13 -1
- package/src/components/ViewPackagePage/components/important-files-view.tsx +57 -1
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +13 -0
- package/src/components/package-port/CodeAndPreview.tsx +7 -1
- package/src/hooks/use-create-package-release-mutation.ts +63 -13
- package/src/hooks/use-rebuild-package-release-mutation.ts +41 -0
- package/src/hooks/use-request-ai-review-mutation.ts +45 -0
- package/src/hooks/useFileManagement.ts +1 -2
- package/src/lib/codemirror/basic-setup.ts +17 -1
- package/src/lib/templates/blank-package-template.ts +4 -5
- package/src/pages/editor.tsx +5 -1
- package/src/pages/view-package.tsx +1 -0
|
@@ -18,7 +18,13 @@ import {
|
|
|
18
18
|
foldGutter,
|
|
19
19
|
foldKeymap,
|
|
20
20
|
} from "@codemirror/language"
|
|
21
|
-
import {
|
|
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 {
|
|
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
|
|
17
|
+
export const MyChip = (props: ChipProps<typeof pinLabels>) => (
|
|
18
|
+
<chip footprint="soic8" pinLabels={pinLabels} {...props} />
|
|
19
|
+
)
|
|
21
20
|
`.trim(),
|
|
22
21
|
}
|
package/src/pages/editor.tsx
CHANGED
|
@@ -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(
|