Skip to content

Commit

Permalink
add doc hover to primitive elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jul 20, 2023
1 parent 9ff62b8 commit b3c1e3e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 20 deletions.
28 changes: 14 additions & 14 deletions docs/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,32 +937,32 @@ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
};
imports.wbg.__wbindgen_closure_wrapper247 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 28, __wbg_adapter_34);
imports.wbg.__wbindgen_closure_wrapper194 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 6, __wbg_adapter_34);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper249 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 28, __wbg_adapter_37);
imports.wbg.__wbindgen_closure_wrapper196 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 6, __wbg_adapter_37);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper251 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 28, __wbg_adapter_34);
imports.wbg.__wbindgen_closure_wrapper198 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 6, __wbg_adapter_34);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1008 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 289, __wbg_adapter_42);
imports.wbg.__wbindgen_closure_wrapper1009 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 290, __wbg_adapter_42);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1155 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 400, __wbg_adapter_45);
imports.wbg.__wbindgen_closure_wrapper1156 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 401, __wbg_adapter_45);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1392 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 496, __wbg_adapter_48);
imports.wbg.__wbindgen_closure_wrapper1393 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 497, __wbg_adapter_48);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1506 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 535, __wbg_adapter_51);
imports.wbg.__wbindgen_closure_wrapper1507 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 536, __wbg_adapter_51);
return addHeapObject(ret);
};

Expand Down
Binary file modified docs/site_bg.wasm
Binary file not shown.
3 changes: 2 additions & 1 deletion docs/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ code {
font-family: "Code Font";
border-radius: 0.2em;
padding: 0.2em;
position: relative;
}

th,
Expand Down Expand Up @@ -263,7 +264,7 @@ table {
background-color: transparent;
}

.glyph-button[title]:hover::after {
.glyph-title[title]:hover::after {
content: attr(title);
position: absolute;
font-family: "Code Font";
Expand Down
2 changes: 1 addition & 1 deletion site/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub fn Editor(
_ = glyph_doc_element().style().remove_property("display");
}
};
let class = format!("glyph-button {}", prim_class(*p));
let class = format!("glyph-button glyph-title {}", prim_class(*p));
Some(view! { cx,
<button
class=class
Expand Down
11 changes: 9 additions & 2 deletions site/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,20 @@ mod code {
use super::*;
#[component]
pub fn PrimCode(cx: Scope, prim: Primitive, #[prop(optional)] name: bool) -> impl IntoView {
let show_name = name;
let class = prim_class(prim);
let name = if let Some(name) = prim.name().filter(|_| name) {
let name = if let Some(name) = prim.name().filter(|_| show_name) {
format!("{} ", name)
} else {
"".to_string()
};
view!(cx, <code>{name}<span class=class>{ prim.to_string() }</span></code>)
let title = match (prim.doc(), show_name) {
(Some(doc), true) => doc.into(),
(Some(doc), false) => format!("{}: {}", prim.name().unwrap_or_default(), doc),
(None, true) => String::new(),
(None, false) => prim.name().unwrap_or_default().into(),
};
view!(cx, <code class="glyph-title" title=title>{name}<span class=class>{ prim.to_string() }</span></code>)
}
}
use code::*;
Expand Down
3 changes: 2 additions & 1 deletion site/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ code {
font-family: "Code Font";
border-radius: 0.2em;
padding: 0.2em;
position: relative;
}

th,
Expand Down Expand Up @@ -263,7 +264,7 @@ table {
background-color: transparent;
}

.glyph-button[title]:hover::after {
.glyph-title[title]:hover::after {
content: attr(title);
position: absolute;
font-family: "Code Font";
Expand Down
2 changes: 1 addition & 1 deletion src/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ primitive!(
(2(2), Flip, "flip" + '~'),
/// Pop the top value off the stack
(1(0), Pop, "pop" + ';'),
/// Pop the top value off the stack and save it to the antistack
/// Pop the top value off the stack and push it to the antistack
(1(0){1}, Save, "save" + '⇟'),
/// Pop the top value off the antistack and push it to the stack
(0[1](1), Load, "load" + '⇞'),
Expand Down

0 comments on commit b3c1e3e

Please sign in to comment.