lineadraw 0.1.0 → 0.3.0
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/bin/lineadraw.mjs +98 -0
- package/lib/init.mjs +127 -0
- package/lib/manifest.mjs +225 -0
- package/lineadraw.d.ts +1180 -787
- package/package.json +21 -2
- package/templates/README.md +18 -0
- package/templates/sample.block.ts +35 -0
- package/templates/tsconfig.json +11 -0
- package/templates/workflow.yml +18 -0
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lineadraw",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Type definitions and marketplace tooling for Linea blocks and commands",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mikhail Koshelev",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./lineadraw.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"lineadraw": "./bin/lineadraw.mjs"
|
|
11
|
+
},
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
14
|
"types": "./lineadraw.d.ts",
|
|
@@ -15,5 +18,21 @@
|
|
|
15
18
|
"types": "./lineadraw.d.ts",
|
|
16
19
|
"default": "./main.js"
|
|
17
20
|
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"lineadraw.d.ts",
|
|
24
|
+
"main.js",
|
|
25
|
+
"bin",
|
|
26
|
+
"lib",
|
|
27
|
+
"templates"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "vitest run"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"sucrase": "^3.35.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"vitest": "^4.1.10"
|
|
18
37
|
}
|
|
19
38
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# __NAME__
|
|
2
|
+
|
|
3
|
+
A [Linea](https://github.com/lineadraw/lineadraw) marketplace:
|
|
4
|
+
`blocks/*.block.ts` and `commands/*.cmd.ts` modules plus a generated
|
|
5
|
+
catalog (`.lineadraw/marketplace.json`).
|
|
6
|
+
|
|
7
|
+
## Authoring
|
|
8
|
+
|
|
9
|
+
- Add or edit modules under `blocks/` and `commands/`.
|
|
10
|
+
- Regenerate the catalog: `npm run manifest` — CI fails when it is stale.
|
|
11
|
+
- Validate without writing: `npm run check`.
|
|
12
|
+
|
|
13
|
+
## Using it in the editor
|
|
14
|
+
|
|
15
|
+
Library → Blocks (or Commands) → Marketplace scope → add this repository
|
|
16
|
+
as `owner/repo`. For a private repository, create a fine-grained personal
|
|
17
|
+
access token with read-only Contents access to just this repository and
|
|
18
|
+
paste it in the add dialog — it is stored only on that device.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Sample block — a parametric rectangle centered on the picked point.
|
|
2
|
+
// Replace it with your own; the public collection at
|
|
3
|
+
// github.com/lineadraw/lineadraw is full of real examples.
|
|
4
|
+
import { defineBlock } from "lineadraw";
|
|
5
|
+
import type { Polyline } from "lineadraw";
|
|
6
|
+
|
|
7
|
+
export default defineBlock({
|
|
8
|
+
// The id is the block's identity everywhere: @<collection>/<slug>,
|
|
9
|
+
// lowercase kebab. Re-publishing the same id updates in place.
|
|
10
|
+
id: "@__COLLECTION__/sample-box",
|
|
11
|
+
name: "Sample box",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
description: "A parametric rectangle centered on the picked point.",
|
|
14
|
+
tags: ["sample"],
|
|
15
|
+
authors: ["__AUTHOR__"],
|
|
16
|
+
params: [
|
|
17
|
+
{ name: "width", label: "Width", type: "number", default: 100, min: 1 },
|
|
18
|
+
{ name: "height", label: "Height", type: "number", default: 50, min: 1 },
|
|
19
|
+
],
|
|
20
|
+
draw: ({ params }) => {
|
|
21
|
+
const w = params.width / 2;
|
|
22
|
+
const h = params.height / 2;
|
|
23
|
+
const box: Polyline = {
|
|
24
|
+
type: "polyline",
|
|
25
|
+
closed: true,
|
|
26
|
+
points: [
|
|
27
|
+
[-w, -h],
|
|
28
|
+
[w, -h],
|
|
29
|
+
[w, h],
|
|
30
|
+
[-w, h],
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
return [box];
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Validates every block/command module and checks the committed catalog
|
|
2
|
+
# (.lineadraw/marketplace.json) matches the sources in this commit.
|
|
3
|
+
# Stale catalog? Run `npx lineadraw manifest` and commit the result.
|
|
4
|
+
name: Marketplace
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
pull_request:
|
|
9
|
+
jobs:
|
|
10
|
+
check:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: 22
|
|
17
|
+
- run: npm ci
|
|
18
|
+
- run: npx lineadraw check
|