Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion css/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_library", "closure_css_binary")


closure_css_library(
name = "style",
srcs = [
Expand Down
45 changes: 18 additions & 27 deletions js/ui/BUILD → js/ui/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@ package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library", "closure_js_test")

closure_js_library(
name = "component",
name = "core",
srcs = [
"app.js",
"component.js",
"route.js",
"route/event.js",
"router.js",
"core.js",
],
deps = [
":history",
":keyboard",
":injector",
":keyboard",
"@io_bazel_rules_closure//closure/library/asserts",
"@io_bazel_rules_closure//closure/library/dom",
"@io_bazel_rules_closure//closure/library/events:event",
"@io_bazel_rules_closure//closure/library/events",
"@io_bazel_rules_closure//closure/library/events:eventhandler",
"@io_bazel_rules_closure//closure/library/events:eventtarget",
"@io_bazel_rules_closure//closure/library/fx:dom",
"@io_bazel_rules_closure//closure/library/fx:easing",
"@io_bazel_rules_closure//closure/library/history:event",
"@io_bazel_rules_closure//closure/library/history:eventtype",
"@io_bazel_rules_closure//closure/library/object",
"@io_bazel_rules_closure//closure/library/promise",
"@io_bazel_rules_closure//closure/library/promise:resolver",
"@io_bazel_rules_closure//closure/library/string",
"@io_bazel_rules_closure//closure/library/style",
"@io_bazel_rules_closure//closure/library/ui:component",
Expand All @@ -46,6 +44,7 @@ closure_js_library(
"@io_bazel_rules_closure//closure/library/events:event",
"@io_bazel_rules_closure//closure/library/events:eventtarget",
"@io_bazel_rules_closure//closure/library/events:eventtype",
"@io_bazel_rules_closure//closure/library/history:event",
"@io_bazel_rules_closure//closure/library/history:eventtype",
"@io_bazel_rules_closure//closure/library/history:html5history",
"@io_bazel_rules_closure//closure/library/string",
Expand All @@ -71,7 +70,8 @@ closure_js_library(
"template.js",
],
deps = [
":component",
":core",
"@io_bazel_rules_closure//closure/library/dom",
"@io_bazel_rules_closure//closure/library/soy",
],
)
Expand All @@ -85,7 +85,7 @@ closure_js_library(
"tabs.js",
],
deps = [
":component",
":core",
"@io_bazel_rules_closure//closure/library/asserts",
"@io_bazel_rules_closure//closure/library/dom",
"@io_bazel_rules_closure//closure/library/dom:classlist",
Expand All @@ -103,9 +103,11 @@ closure_js_library(
deps = [
"@io_bazel_rules_closure//closure/library/asserts",
"@io_bazel_rules_closure//closure/library/dom",
"@io_bazel_rules_closure//closure/library/events",
"@io_bazel_rules_closure//closure/library/math:coordinate",
"@io_bazel_rules_closure//closure/library/style",
"@io_bazel_rules_closure//closure/library/ui:component",
"@io_bazel_rules_closure//closure/library/ui:container",
"@io_bazel_rules_closure//closure/library/ui:menu",
"@io_bazel_rules_closure//closure/library/ui:menubutton",
"@io_bazel_rules_closure//closure/library/ui:submenu",
Expand All @@ -119,39 +121,28 @@ closure_js_library(
"syntax.js",
],
deps = [
":component",
":core",
"@io_bazel_rules_closure//closure/library/asserts",
"@io_bazel_rules_closure//closure/library/dom",
],
)

# closure_js_library(
# name = "app",
# srcs = [
# ],
# deps = [
# ":component",
# ],
# )

closure_js_library(
name = "injector",
srcs = [
"injector.js",
],
deps = [
# ":component",
# ":core",
],
)

closure_js_library(
name = "ui",
# srcs = [
# ],
exports = [
":injector",
":component",
":core",
":history",
":injector",
":keyboard",
":menushield",
":select",
Expand Down Expand Up @@ -185,7 +176,7 @@ closure_js_test(
],
entry_points = ["goog:stack.ui.RouteTest"],
deps = [
":component",
":core",
":select",
":app",
# "@io_bazel_rules_closure//closure/library",
Expand All @@ -201,10 +192,10 @@ closure_js_test(
entry_points = ["goog:stack.ui.HistoryTest"],
deps = [
":history",
"@io_bazel_rules_closure//closure/library:testing",
"@io_bazel_rules_closure//closure/library/dom",
"@io_bazel_rules_closure//closure/library/dom:tagname",
"@io_bazel_rules_closure//closure/library/events",
"@io_bazel_rules_closure//closure/library/string",
"@io_bazel_rules_closure//closure/library:testing",
],
)
38 changes: 20 additions & 18 deletions js/ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ goog.module('stack.ui.App');

const BzlHistory = goog.require('stack.ui.History');
const Component = goog.require('stack.ui.Component');
const HEventType = goog.require('goog.history.EventType');
const Injector = goog.require('stack.ui.Injector');
const HistoryEvent = goog.require('goog.history.Event');
const HistoryEventType = goog.require('goog.history.EventType');
const Injector = goog.require('stack.ui.Injector');
const Keyboard = goog.require('stack.ui.Keyboard');
const Promise_ = goog.require('goog.Promise');
const Router = goog.require('stack.ui.Router');
const asserts = goog.require('goog.asserts');
const dom = goog.require('goog.dom');
const objects = goog.require('goog.object');
const Promise_ = goog.require('goog.Promise');
const Route = goog.require('stack.ui.Route');
const Router = goog.require('stack.ui.Router');
const asserts = goog.require('goog.asserts');
const dom = goog.require('goog.dom');
const objects = goog.require('goog.object');


class App extends Component {
Expand All @@ -25,7 +27,7 @@ class App extends Component {
* @type {!Injector}
*/
this.injector_ = new Injector();

/**
* A registry of components that can be accessed by a common name.
* @const @private
Expand All @@ -35,7 +37,7 @@ class App extends Component {

/** @const @private @type {!BzlHistory} */
this.history_ = new BzlHistory();
this.getHandler().listen(this.history_, HEventType.NAVIGATE, this.handleHistoryNavigate);
this.getHandler().listen(this.history_, HistoryEventType.NAVIGATE, this.handleHistoryNavigate);
this.registerDisposable(this.history_);

/** @const @private @type {!Keyboard} */
Expand All @@ -50,16 +52,16 @@ class App extends Component {
start() {
this.history_.setEnabled(true);
}

/**
* @param {!goog.history.Event} e
* @param {!HistoryEvent} e
*/
handleHistoryNavigate(e) {
this.router_.go(e.token).thenCatch(err => {
console.warn(`Routing failure while nagivating to ${e.token}`);
});
}

/**
* @param {!Component} c
* @param {!boolean} b
Expand All @@ -71,14 +73,14 @@ class App extends Component {
console.warn("Stop Loaded " + c.getPathUrl());
}
}

/**
* @return {!Keyboard}
*/
getKbd() {
return this.kbd_;
}

/**
* @return {!Router}
*/
Expand All @@ -92,7 +94,7 @@ class App extends Component {
getInjector() {
return this.injector_;
}

/**
* @param {string} msg
*/
Expand Down Expand Up @@ -138,8 +140,8 @@ class App extends Component {
//route.touch(this);
super.go(route);
}
/** @param {!stack.ui.Route} route */

/** @param {!Route} route */
handle404(route) {
this.notifyError("404 (Not Found): " + route.getPath());
}
Expand All @@ -157,7 +159,7 @@ class App extends Component {
* will loopback on this object to the go() method.
*
* @param {string} path
* @return {!Promise_<!stack.ui.Route>}
* @return {!Promise_<!Route>}
*/
route(path) {
return this.router_.go(path).thenCatch(err => {
Expand Down
8 changes: 4 additions & 4 deletions js/ui/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const soy = goog.require('goog.soy');
class Body extends Select {

/**
* @param {?goog.dom.DomHelper=} opt_domHelper
* @param {?dom.DomHelper=} opt_domHelper
*/
constructor(opt_domHelper) {
super(opt_domHelper);
this.addTab('home', new Home());
this.addTab('search', new List());
}

/**
* Modifies behavior to use touch rather than progress to
* not advance the path pointer.
Expand All @@ -38,7 +38,7 @@ class Body extends Select {
goHere(route) {
this.select('home', route.add('home'));
}

/**
* @override
*/
Expand All @@ -55,7 +55,7 @@ class Body extends Select {
super.enterDocument();
this.addChild(new Menu(this.getTabStrict('search'), this.getDomHelper()), true);
}

}

exports = Body;
Loading