Skip to content

Commit a079ff4

Browse files
committed
release: v1.0.0
0 parents  commit a079ff4

14 files changed

Lines changed: 1664 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: denoland/setup-deno@v1
17+
with:
18+
deno-version: v2.x
19+
20+
- run: deno task check
21+
22+
- run: npx jsr publish

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.DS_Store
2+
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
lerna-debug.log*
10+
11+
*.tsbuildinfo
12+
coverage
13+
node_modules/
14+
jspm_packages/
15+
.env
16+
.env.test
17+
18+
dist

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"deno.enable": true,
3+
"editor.defaultFormatter": "denoland.vscode-deno",
4+
"npm.autoDetect": "off",
5+
"[typescript]": {
6+
"editor.defaultFormatter": "denoland.vscode-deno"
7+
}
8+
}

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Etienne Dldc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Stachine
2+
3+
> A TypeScript state machine with events and effects
4+
5+
```
6+
deno add @dldc/stachine
7+
```
8+
9+
## Gist
10+
11+
```ts
12+
import { createStachine } from "@dldc/stachine";
13+
14+
type State = { state: "Home" } | { state: "Bed" } | { state: "Work" } | {
15+
state: "Error";
16+
};
17+
type Action = { action: "Commute" } | { action: "Wake" } | { action: "Sleep" };
18+
19+
const machine = createStachine<State, Action>({
20+
initialState: { state: "Home" },
21+
createErrorState: () => ({ state: "Error" }),
22+
states: {
23+
Home: {
24+
actions: {
25+
Commute: () => ({ state: "Work" }),
26+
Sleep: () => ({ state: "Bed" }),
27+
},
28+
},
29+
Work: {
30+
actions: {
31+
Commute: () => ({ state: "Home" }),
32+
},
33+
},
34+
Bed: {
35+
actions: {
36+
Wake: () => ({ state: "Home" }),
37+
},
38+
},
39+
Error: {},
40+
},
41+
});
42+
```

deno.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "@dldc/css-builder",
3+
"version": "1.0.0",
4+
"exports": {
5+
".": "./mod.ts",
6+
"./ast": "./src/ast.ts",
7+
"./builder": "./src/builder.ts",
8+
"./create": "./src/create.ts",
9+
"./serialize": "./src/serialize.ts"
10+
},
11+
"imports": {
12+
"@std/expect": "jsr:@std/expect@^1.0.16"
13+
},
14+
"tasks": {
15+
"test:run": "deno test -A",
16+
"test:watch": "deno test --watch",
17+
"bump": "deno run -A jsr:@mys/bump@1",
18+
"deps:outdated": "deno outdated",
19+
"deps:update": "deno outdated --update --latest --interactive",
20+
"check": "deno fmt --check . && deno lint . && deno check **/*.ts && deno task test:run",
21+
"test:coverage": "deno test -A --coverage=coverage && deno coverage coverage --html"
22+
},
23+
"lint": {
24+
"rules": {
25+
"exclude": [
26+
"no-explicit-any"
27+
]
28+
}
29+
}
30+
}

deno.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mod.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type * as Ast from "./src/ast.ts";
2+
import * as create from "./src/create.ts";
3+
4+
export * from "./src/builder.ts";
5+
export * from "./src/serialize.ts";
6+
export { type Ast, create };

src/ast.ts

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
export type Syntax_PlusSign<T> = readonly [T, ...T[]];
2+
export type Syntax_Asterisk<T> = readonly T[];
3+
export type Syntax_HashMark<T> = readonly [
4+
T,
5+
...(readonly (readonly [
6+
{ readonly kind: "token"; readonly value: "," },
7+
T,
8+
])[]),
9+
];
10+
export type Syntax_QuestionMark<T> = T | null;
11+
12+
export type Min = {
13+
readonly kind: "min";
14+
readonly value: [
15+
{ readonly kind: "function"; readonly value: "min" },
16+
{ readonly kind: "token"; readonly value: "(" },
17+
Syntax_HashMark<CalcSum>,
18+
{ readonly kind: "token"; readonly value: ")" },
19+
];
20+
};
21+
22+
export type Max = {
23+
readonly kind: "max";
24+
readonly value: [
25+
{ readonly kind: "function"; readonly value: "max" },
26+
{ readonly kind: "token"; readonly value: "(" },
27+
Syntax_HashMark<CalcSum>,
28+
{ readonly kind: "token"; readonly value: ")" },
29+
];
30+
};
31+
32+
export type Clamp = {
33+
readonly kind: "clamp";
34+
readonly value: [
35+
{ readonly kind: "function"; readonly value: "clamp" },
36+
{ readonly kind: "token"; readonly value: "(" },
37+
CalcSum | { readonly kind: "keyword"; readonly value: "none" },
38+
{ readonly kind: "token"; readonly value: "," },
39+
CalcSum,
40+
{ readonly kind: "token"; readonly value: "," },
41+
CalcSum | { readonly kind: "keyword"; readonly value: "none" },
42+
{ readonly kind: "token"; readonly value: ")" },
43+
];
44+
};
45+
46+
export type Var = {
47+
readonly kind: "var";
48+
readonly value: readonly [
49+
{ readonly kind: "function"; readonly value: "var" },
50+
{ readonly kind: "token"; readonly value: "(" },
51+
{ readonly kind: "custom-property"; readonly value: string },
52+
Syntax_QuestionMark<
53+
readonly [{ readonly kind: "token"; readonly value: "," }, CalcSum]
54+
>,
55+
{ readonly kind: "token"; readonly value: ")" },
56+
];
57+
};
58+
59+
export type Calc = {
60+
readonly kind: "calc";
61+
readonly value: [
62+
{ readonly kind: "function"; readonly value: "calc" },
63+
{ readonly kind: "token"; readonly value: "(" },
64+
CalcSum,
65+
{ readonly kind: "token"; readonly value: ")" },
66+
];
67+
};
68+
69+
export type Exp = {
70+
readonly kind: "exp";
71+
readonly value: [
72+
{ readonly kind: "function"; readonly value: "exp" },
73+
{ readonly kind: "token"; readonly value: "(" },
74+
CalcSum,
75+
{ readonly kind: "token"; readonly value: ")" },
76+
];
77+
};
78+
79+
export type CalcSum =
80+
| CalcProduct
81+
| {
82+
readonly kind: "calc-sum";
83+
readonly value: readonly [
84+
CalcProduct,
85+
Syntax_Asterisk<
86+
[{ readonly kind: "token"; readonly value: " + " | " - " }, CalcProduct]
87+
>,
88+
];
89+
};
90+
91+
export type CalcProduct =
92+
| CalcValue
93+
| {
94+
readonly kind: "calc-product";
95+
readonly value: readonly [
96+
CalcValue,
97+
Syntax_Asterisk<
98+
[{ readonly kind: "token"; readonly value: "*" | "/" }, CalcValue]
99+
>,
100+
];
101+
};
102+
103+
export type CalcValue =
104+
| {
105+
readonly kind: "number";
106+
readonly value: string;
107+
}
108+
| {
109+
readonly kind: "dimension";
110+
readonly value: readonly [
111+
{ readonly kind: "dimension-number"; readonly value: string },
112+
{ readonly kind: "dimension-unit"; readonly value: string },
113+
];
114+
}
115+
| {
116+
readonly kind: "percentage";
117+
readonly value: [
118+
{ readonly kind: "percentage-number"; readonly value: string },
119+
{ readonly kind: "token"; readonly value: "%" },
120+
];
121+
}
122+
| {
123+
readonly kind: "keyword";
124+
readonly value: CalcKeyword;
125+
}
126+
| {
127+
readonly kind: "raw";
128+
readonly value: string;
129+
}
130+
| {
131+
readonly kind: "group";
132+
readonly value: readonly [
133+
{ readonly kind: "token"; readonly value: "(" },
134+
CalcSum,
135+
{ readonly kind: "token"; readonly value: ")" },
136+
];
137+
}
138+
| Min
139+
| Max
140+
| Clamp
141+
| Calc
142+
| Exp
143+
| Var;
144+
145+
export type CalcKeyword = "e" | "pi" | "infinity" | "-infinity" | "NaN";

0 commit comments

Comments
 (0)