├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── lib ├── html_renderer.dart ├── html_renderer │ └── html_renderer.dart ├── nuts.dart ├── styles.css └── view │ ├── containers.dart │ ├── editable.dart │ ├── event.dart │ ├── measure.dart │ ├── table.dart │ ├── text.dart │ └── view.dart ├── pubspec.yaml └── web ├── binding ├── index.html ├── main.dart └── styles.css ├── favicon.ico └── query ├── index.html ├── main.dart └── styles.css /.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .dart_tool/ 3 | .packages 4 | .pub/ 5 | build/ 6 | # Remove the following pattern if you wish to check in your lock file 7 | pubspec.lock 8 | 9 | # Directory created by dartdoc 10 | doc/api/ 11 | 12 | .idea 13 | *.iml -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version, created by Stagehand 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2017, Ravi Teja Gudapati 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nuts 2 | 3 | Nuts and bolts for building cross-platform UI (HTML, Flutter, CLI) using Dart. Also screw frameworks (React, Vue, 4 | Angular). 5 | 6 | ## Example 7 | 8 | ```dart 9 | class Counter implements Component { 10 | @override 11 | String key; 12 | 13 | int count = 0; 14 | 15 | @override 16 | View makeView() { 17 | Box ret; 18 | ret = Box(children: [ 19 | TextField('Count: $count', key: 'info'), 20 | HBox(children: [ 21 | Button( 22 | text: 'Increment', 23 | onClick: () { 24 | ret.getByKey('info').text = 'Count: ${++count}'; 25 | }), 26 | Button( 27 | text: 'Decrement', 28 | onClick: () { 29 | ret.getByKey('info').text = 'Count: ${--count}'; 30 | }), 31 | ]), 32 | ]); 33 | return ret; 34 | } 35 | } 36 | 37 | void main() { 38 | querySelector('#output').append(defaultRenderers.render(Counter())); 39 | } 40 | ``` -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | # exclude: 3 | # - path/to/excluded/files/** 4 | 5 | # Lint rules and documentation, see http://dart-lang.github.io/linter/lints 6 | linter: 7 | rules: 8 | - cancel_subscriptions 9 | - hash_and_equals 10 | - iterable_contains_unrelated_type 11 | - list_remove_unrelated_type 12 | - test_types_in_equals 13 | - unrelated_type_equality_checks 14 | - valid_regexps 15 | -------------------------------------------------------------------------------- /lib/html_renderer.dart: -------------------------------------------------------------------------------- 1 | export 'html_renderer/html_renderer.dart'; 2 | -------------------------------------------------------------------------------- /lib/html_renderer/html_renderer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:html'; 3 | import 'package:nuts/nuts.dart'; 4 | 5 | final HtmlRenderer defaultRenderers = new HtmlRenderer() 6 | ..register(boxRenderer) 7 | ..register(hBoxRenderer) 8 | ..register(textFieldRenderer) 9 | ..register(labeledFieldRenderer) 10 | ..register(vLabeledFieldRenderer) 11 | ..register