Skip to content

Commit 2fd045c

Browse files
committed
Add playground UI
1 parent 12e67b5 commit 2fd045c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+10640
-8
lines changed

Justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ install target="": (build target)
2323
@echo "Installing divvun-runtime for target: {{target}}"
2424
{{ if os() == "windows" { "copy .\\target\\" + target + "\\release\\divvun-runtime.exe %USERPROFILE%\\.cargo\\bin\\divvun-runtime.exe" } else { "rm -f ~/.cargo/bin/divvun-runtime && cp ./target/" + target + "/release/divvun-runtime ~/.cargo/bin/divvun-runtime" } }}
2525

26+
build-ui target="":
27+
@echo "Building UI for target: {{target}}"
28+
cd playground && {{env_vars}} pnpm tauri build
29+
30+
run-ui:
31+
@echo "Running UI"
32+
cd playground && {{env_vars}} pnpm tauri dev
33+
2634
# Print inventory of registered modules and structs
2735
print-inventory:
2836
{{env_vars}} cargo run --example print_inventory --features all-mods

macros/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ fn expand_divvun_command(
142142
})
143143
.collect();
144144

145+
// Generate kind token
146+
let kind_token = if let Some(ref kind_str) = attrs.kind {
147+
quote! { Some(#kind_str) }
148+
} else {
149+
quote! { None }
150+
};
151+
145152
let expanded = quote! {
146153
#input_impl
147154

@@ -155,6 +162,7 @@ fn expand_divvun_command(
155162
assets: &[#(#assets_tokens),*],
156163
init: #impl_type::new,
157164
returns: #output_ty_token,
165+
kind: #kind_token,
158166
};
159167

160168
// Submit the command definition to inventory
@@ -175,6 +183,7 @@ struct CommandAttrs {
175183
output: String,
176184
args: Vec<(String, String, bool)>, // name, type, optional
177185
assets: Vec<AssetDepDef>,
186+
kind: Option<String>,
178187
}
179188

180189
#[derive(Debug)]
@@ -192,6 +201,7 @@ fn parse_command_attributes(token_iter: &mut TokenIter) -> unsynn::Result<Comman
192201
let mut output = None;
193202
let mut args = Vec::new();
194203
let mut assets = Vec::new();
204+
let mut kind = None;
195205

196206
// Parse comma-separated attribute items
197207
loop {
@@ -226,6 +236,10 @@ fn parse_command_attributes(token_iter: &mut TokenIter) -> unsynn::Result<Comman
226236
let lit: LiteralString = token_iter.parse()?;
227237
output = Some(lit.as_str().to_string());
228238
}
239+
"kind" => {
240+
let lit: LiteralString = token_iter.parse()?;
241+
kind = Some(lit.as_str().to_string());
242+
}
229243
"args" => {
230244
// For args, we expect brackets containing comma-delimited arg definitions
231245
let group: BracketGroupContaining<CommaDelimitedVec<ArgDefPair>> =
@@ -314,6 +328,7 @@ fn parse_command_attributes(token_iter: &mut TokenIter) -> unsynn::Result<Comman
314328
output,
315329
args,
316330
assets,
331+
kind,
317332
})
318333
}
319334

playground/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

playground/.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
3+
}

0 commit comments

Comments
 (0)