twiddle 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +22 -12
- data/Rakefile +1 -1
- data/docs/index.html +35 -0
- data/lib/twiddle/version.rb +1 -1
- metadata +20 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 631e9d17158d97bd85c6ad18c121f65c8e8201c0a8aeaee29f079f6e5a12078e
|
|
4
|
+
data.tar.gz: 795fd6f2c8f84c9afaf449882c33e30416a09f8b96dc5ba3db573691cf4f1509
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8eab35cf45cbdd7b68def6e6a62d42d1a76780d614cbc2033e6c9e4c2ecb082c948d822c2c1d27095bf4c04a1869fcad1328ad76c56e1241bcd741ccb82d798f
|
|
7
|
+
data.tar.gz: e33c1058ea919dfe6e869392167945b898c60bb63a507d306269b7642be6984ee54e76102436d1eee8b9c06e59fe6b42def682aa63f7a24907d5a52eaa99249a
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">Twiddle</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://rubygems.org/gems/twiddle)
|
|
5
|
-
[](https://github.com/rbgfx/twiddle/actions/workflows/ci.yml)
|
|
6
|
-
[](https://www.ruby-lang.org/)
|
|
7
|
-
[](LICENSE.txt)
|
|
3
|
+
<p align="center">A headless-friendly immediate-mode UI toolkit for Ruby graphics.</p>
|
|
8
4
|
|
|
9
|
-
>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://rubygems.org/gems/twiddle"><img src="https://badge.fury.io/rb/twiddle.svg" alt="Gem Version"></a>
|
|
7
|
+
<a href="https://rubygems.org/gems/twiddle"><img src="https://img.shields.io/gem/dt/twiddle?label=downloads" alt="Downloads"></a>
|
|
8
|
+
<a href="https://www.ruby-lang.org/"><img src="https://img.shields.io/badge/ruby-%3E%3D3.1-CC342D?logo=ruby&logoColor=white" alt="Ruby Version"></a>
|
|
9
|
+
<a href="LICENSE.txt"><img src="https://img.shields.io/badge/license-MIT-750014.svg" alt="License"></a>
|
|
10
|
+
</p>
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
hashes, so the same UI can run in tests, a headless renderer, or an rbgl
|
|
13
|
-
window.
|
|
12
|
+
[Features](#features) · [Installation](#installation) · [Quick Start](#quick-start) · [RBGL Integration](#rbgl-integration)
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
***
|
|
15
|
+
|
|
16
|
+
Twiddle renders compact controls into Tessel images and accepts plain event hashes, so the same UI can run in tests, a headless renderer, or an RBGL window.
|
|
16
17
|
|
|
17
18
|
## Features
|
|
18
19
|
|
|
@@ -43,7 +44,12 @@ Or install the released gem:
|
|
|
43
44
|
gem install twiddle
|
|
44
45
|
~~~
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
### Requirements
|
|
48
|
+
|
|
49
|
+
- Ruby 3.1 or newer.
|
|
50
|
+
- Tessel and Glyphic are installed as runtime dependencies; RBGL integration is optional.
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
47
53
|
|
|
48
54
|
~~~ruby
|
|
49
55
|
require "tessel"
|
|
@@ -86,6 +92,10 @@ bundle install
|
|
|
86
92
|
bundle exec rake verify
|
|
87
93
|
~~~
|
|
88
94
|
|
|
95
|
+
## Contributing
|
|
96
|
+
|
|
97
|
+
Bug reports and pull requests are welcome at [rbgfx/twiddle](https://github.com/rbgfx/twiddle).
|
|
98
|
+
|
|
89
99
|
## License
|
|
90
100
|
|
|
91
101
|
[MIT](LICENSE.txt)
|
data/Rakefile
CHANGED
data/docs/index.html
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en"><head>
|
|
3
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
4
|
+
<meta name="theme-color" content="#020617"><meta name="description" content="A headless-friendly UI toolkit that renders into Tessel images and consumes plain event hashes.">
|
|
5
|
+
<meta property="og:title" content="Twiddle — Put the controls beside the render."><meta property="og:description" content="A headless-friendly UI toolkit that renders into Tessel images and consumes plain event hashes."><meta property="og:type" content="website"><meta property="og:url" content="https://rbgfx.github.io/twiddle/">
|
|
6
|
+
<meta name="twitter:card" content="summary"><link rel="canonical" href="https://rbgfx.github.io/twiddle/"><title>Twiddle — Put the controls beside the render.</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root{color-scheme:dark;--bg:#020617;--panel:#0f172a;--line:#334155;--ink:#e2e8f0;--muted:#94a3b8;--a:#38bdf8;--mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--w:min(100% - 2.5rem,76rem)}
|
|
9
|
+
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.65 var(--sans)}a{color:inherit;text-underline-offset:.22em}a:hover{color:var(--a)}a:focus-visible{outline:3px solid var(--a);outline-offset:4px}h1,h2,h3,p,figure,pre{margin:0}h1,h2,h3{line-height:1.08;text-wrap:balance}p{text-wrap:pretty}code,pre,.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}.wrap{width:var(--w);margin:auto}.skip{position:fixed;left:1rem;top:1rem;z-index:1;transform:translateY(-160%);padding:.7rem 1rem;background:var(--ink);color:var(--bg)}.skip:focus{transform:none}
|
|
10
|
+
header{height:4.75rem;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}.brand{display:flex;align-items:center;gap:.7rem;font-weight:750;text-decoration:none}.mark{width:2rem;height:2rem;display:grid;place-items:center;border:1px solid var(--a);color:var(--a);font:.85rem var(--mono)}nav{display:flex;gap:1.5rem;font-size:.9rem}nav a{text-decoration:none;color:var(--muted)}nav a:last-child{color:var(--ink)}
|
|
11
|
+
.hero{display:grid;grid-template-columns:.88fr 1.12fr;align-items:center;gap:clamp(2rem,6vw,6rem);padding-block:clamp(4rem,9vw,8rem)}.kicker,.visual figcaption,.num{font:.76rem/1.4 var(--mono);color:var(--a)}h1{max-width:11ch;margin-top:1rem;font-size:clamp(3rem,7.5vw,6.5rem);letter-spacing:-.065em}.lede{max-width:40rem;margin-top:1.5rem;color:var(--muted);font-size:1.15rem}.actions{display:flex;flex-wrap:wrap;gap:.8rem;margin-top:2rem}.button{min-height:2.8rem;padding:.65rem 1rem;border:1px solid var(--line);display:inline-flex;align-items:center;text-decoration:none;font-weight:650}.button.primary{background:var(--a);border-color:var(--a);color:var(--bg)}.install{margin-top:1.4rem;color:var(--muted);font:.86rem var(--mono)}.install code{color:var(--ink)}
|
|
12
|
+
.visual{border:1px solid var(--line);background:var(--panel)}.art{min-height:18rem;padding:1.25rem;display:grid;place-items:center;overflow:hidden}.art svg{width:100%;max-height:23rem}.visual figcaption{display:flex;justify-content:space-between;gap:1rem;padding:.75rem 1rem;border-top:1px solid var(--line);color:var(--muted)}.visual figcaption span:last-child{color:var(--a)}
|
|
13
|
+
section.info{padding-block:4.5rem;border-top:1px solid var(--line)}.section-head{display:grid;grid-template-columns:.72fr 1.28fr;gap:2rem;align-items:end;margin-bottom:2rem}h2{font-size:clamp(2rem,4vw,3.25rem);letter-spacing:-.045em}.section-head p,.feature p,.try-copy p{color:var(--muted)}.features{display:grid;grid-template-columns:repeat(3,1fr);border-top:1px solid var(--line)}.feature{padding:1.25rem 1.2rem 1.4rem 0;border-bottom:1px solid var(--line)}.feature+.feature{padding-left:1.2rem;border-left:1px solid var(--line)}.feature h3{margin-top:.8rem;font-size:1.1rem}.feature p{margin-top:.5rem;font-size:.94rem}.try{display:grid;grid-template-columns:.75fr 1.25fr;align-items:center;gap:clamp(2rem,7vw,7rem)}.try-copy p{margin-top:1rem}.try-copy a{color:var(--ink)}pre{overflow-x:auto;padding:1.25rem;border:1px solid var(--line);background:var(--panel);font-size:.82rem;line-height:1.8;tab-size:2}
|
|
14
|
+
footer{display:flex;justify-content:space-between;gap:1rem;padding-block:1.6rem;border-top:1px solid var(--line);color:var(--muted);font-size:.85rem}footer div{display:flex;gap:1.25rem}
|
|
15
|
+
@media(max-width:800px){.hero{grid-template-columns:1fr;gap:2.5rem}.hero-copy{max-width:42rem}.section-head,.try{grid-template-columns:1fr;gap:1rem}}@media(max-width:560px){:root{--w:min(100% - 1.5rem,76rem)}header{height:4.2rem}nav{gap:.8rem;font-size:.8rem}nav a:first-child{display:none}h1{font-size:clamp(3rem,15vw,5rem)}.features{grid-template-columns:1fr}.feature,.feature+.feature{padding:1.1rem 0;border-left:0}.num{display:inline-block}footer{flex-direction:column}.art{min-height:14rem}section.info{padding-block:3.5rem}pre{font-size:.75rem;padding:1rem}}
|
|
16
|
+
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
|
|
17
|
+
.controls{width:100%;max-width:30rem;padding:1.2rem;border:1px solid #475569;background:#111827;font-size:.8rem}.controls header{height:auto;padding-bottom:.7rem;color:#e2e8f0;font-family:var(--mono)}.ctrl{display:flex;justify-content:space-between;margin-top:1rem;color:#94a3b8}.slider{height:5px;margin-top:.5rem;background:#334155}.slider i{display:block;width:48%;height:100%;background:#c084fc}
|
|
18
|
+
</style>
|
|
19
|
+
</head><body style="--a:#c084fc"><a class="skip" href="#main">Skip to content</a><div class="wrap">
|
|
20
|
+
<header><a class="brand" href="#top" aria-label="Twiddle home"><span class="mark" aria-hidden="true">T</span><span>Twiddle</span></a><nav aria-label="Primary navigation"><a href="#features">Overview</a><a href="#quick-start">Quick start</a><a href="https://github.com/rbgfx/twiddle">Source ↗</a></nav></header>
|
|
21
|
+
<main id="main"><section class="hero" id="top" aria-labelledby="title"><div class="hero-copy"><p class="kicker">Immediate-mode controls · Ruby</p><h1 id="title">Put the controls beside the render.</h1><p class="lede">A headless-friendly UI toolkit that renders into Tessel images and consumes plain event hashes.</p><div class="actions"><a class="button primary" href="#quick-start">Get started</a><a class="button" href="https://rubygems.org/gems/twiddle">RubyGems ↗</a></div><p class="install"><span aria-hidden="true">$</span> <code>gem install twiddle</code></p></div>
|
|
22
|
+
<figure class="visual" aria-labelledby="cap-twiddle"><div class="art"><div class="controls"><header><span>Parameters</span><span>− □ ×</span></header><div class="ctrl"><span>speed</span><code>1.8</code></div><div class="slider"><i></i></div><div class="ctrl"><span>samples</span><code>32</code></div><div class="slider"><i style="width:70%"></i></div><div class="ctrl"><span>denoise</span><code>on</code></div><div class="ctrl"><span>tint</span><code>■</code></div></div></div><figcaption id="cap-twiddle"><span>Twiddle::Context</span><span>widgets → Tessel image</span></figcaption></figure></section>
|
|
23
|
+
<section class="info" id="features" aria-labelledby="feat"><div class="section-head"><h2 id="feat">A UI for tests and windows.</h2><p>Compose deterministic controls and draw the same UI in a renderer or RBGL window.</p></div><div class="features"><article class="feature"><span class="num">01</span><h3>Tune values</h3><p>Sliders, drags, text fields, color editors, and choices.</p></article><article class="feature"><span class="num">02</span><h3>Organize panels</h3><p>Plots, progress bars, collapsing headers, tooltips, and scrolling.</p></article><article class="feature"><span class="num">03</span><h3>Route input</h3><p>Keyboard, mouse, wheel, modifiers, and logical scaling.</p></article></div></section>
|
|
24
|
+
<section class="info try" id="quick-start" aria-labelledby="quick"><div class="try-copy"><p class="kicker">A small first step</p><h2 id="quick">Start with one example.</h2><p>Install the gem, then follow the project guide for platform requirements and the full API.</p><p><a href="https://github.com/rbgfx/twiddle#installation">Read the installation guide ↗</a></p></div><pre><code>require "tessel"
|
|
25
|
+
require "twiddle"
|
|
26
|
+
|
|
27
|
+
image = Tessel::Image.new(480, 320, fill: "#101827")
|
|
28
|
+
ui = Twiddle::Context.new
|
|
29
|
+
ui.frame(events: []) do |g|
|
|
30
|
+
g.window("Parameters") do
|
|
31
|
+
g.slider("speed", 1.0, 0.0..4.0)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
ui.render(image)</code></pre></section></main>
|
|
35
|
+
<footer><span>Twiddle · Ruby 3.1+ · MIT</span><div><a href="https://github.com/rbgfx/twiddle">GitHub</a><a href="https://github.com/rbgfx/twiddle/blob/main/LICENSE.txt">License</a></div></footer></div></body></html>
|
data/lib/twiddle/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: twiddle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Yudai Takada
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-09-25 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: tessel
|
|
@@ -16,6 +17,9 @@ dependencies:
|
|
|
16
17
|
- - ">="
|
|
17
18
|
- !ruby/object:Gem::Version
|
|
18
19
|
version: 0.1.0
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '1'
|
|
19
23
|
type: :runtime
|
|
20
24
|
prerelease: false
|
|
21
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -23,6 +27,9 @@ dependencies:
|
|
|
23
27
|
- - ">="
|
|
24
28
|
- !ruby/object:Gem::Version
|
|
25
29
|
version: 0.1.0
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1'
|
|
26
33
|
- !ruby/object:Gem::Dependency
|
|
27
34
|
name: glyphic
|
|
28
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -30,6 +37,9 @@ dependencies:
|
|
|
30
37
|
- - ">="
|
|
31
38
|
- !ruby/object:Gem::Version
|
|
32
39
|
version: 0.1.0
|
|
40
|
+
- - "<"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: '1'
|
|
33
43
|
type: :runtime
|
|
34
44
|
prerelease: false
|
|
35
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -37,6 +47,9 @@ dependencies:
|
|
|
37
47
|
- - ">="
|
|
38
48
|
- !ruby/object:Gem::Version
|
|
39
49
|
version: 0.1.0
|
|
50
|
+
- - "<"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '1'
|
|
40
53
|
description: Small headless friendly widgets and a Tessel image renderer.
|
|
41
54
|
email:
|
|
42
55
|
- t.yudai92@gmail.com
|
|
@@ -48,6 +61,7 @@ files:
|
|
|
48
61
|
- LICENSE.txt
|
|
49
62
|
- README.md
|
|
50
63
|
- Rakefile
|
|
64
|
+
- docs/index.html
|
|
51
65
|
- docs/input-matrix.md
|
|
52
66
|
- lib/twiddle.rb
|
|
53
67
|
- lib/twiddle/context.rb
|
|
@@ -62,6 +76,7 @@ licenses:
|
|
|
62
76
|
metadata:
|
|
63
77
|
homepage_uri: https://github.com/rbgfx/twiddle
|
|
64
78
|
source_code_uri: https://github.com/rbgfx/twiddle/tree/main
|
|
79
|
+
post_install_message:
|
|
65
80
|
rdoc_options: []
|
|
66
81
|
require_paths:
|
|
67
82
|
- lib
|
|
@@ -76,7 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
91
|
- !ruby/object:Gem::Version
|
|
77
92
|
version: '0'
|
|
78
93
|
requirements: []
|
|
79
|
-
rubygems_version: 4.
|
|
94
|
+
rubygems_version: 3.4.19
|
|
95
|
+
signing_key:
|
|
80
96
|
specification_version: 4
|
|
81
97
|
summary: Immediate mode UI for Ruby graphics
|
|
82
98
|
test_files: []
|