From 715edd580af30a6bf437f0a700e6de9042cad861 Mon Sep 17 00:00:00 2001 From: Drew Rygh Date: Thu, 5 Nov 2015 14:38:07 -0600 Subject: [PATCH 1/5] refactor(demos): action sheet styles --- .../action-sheets/basic/styles.scss | 18 +++++++++++ demos/component-docs/app.scss | 32 +------------------ .../cards/advanced-map/styles.scss | 14 +++++++- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 demos/component-docs/action-sheets/basic/styles.scss diff --git a/demos/component-docs/action-sheets/basic/styles.scss b/demos/component-docs/action-sheets/basic/styles.scss new file mode 100644 index 0000000000..661f65972b --- /dev/null +++ b/demos/component-docs/action-sheets/basic/styles.scss @@ -0,0 +1,18 @@ +.md .ion-md-share { + color: #ED4248; +} +.md .ion-md-arrow-dropright-circle { + color: #508AE4; +} +.md .ion-md-heart-outline { + color: #31D55F; +} + +.md .action-sheet-destructive { + margin-top: 2px; + padding-top: 1px; +} + +.md .action-sheet-cancel icon, .md .action-sheet-destructive icon { + color: #757575; +} \ No newline at end of file diff --git a/demos/component-docs/app.scss b/demos/component-docs/app.scss index 08282644e6..d89196d331 100644 --- a/demos/component-docs/app.scss +++ b/demos/component-docs/app.scss @@ -10,6 +10,7 @@ $colors: ( $font-path: '../../dist/fonts'; @import "../../ionic/ionic"; +@import "action-sheets/basic/styles"; @import "cards/background/styles"; @import "cards/advanced-weather/styles"; @import "cards/advanced-map/styles"; @@ -63,25 +64,6 @@ section.hidden { height: 100%; } -.md .ion-md-share { - color: #ED4248; -} -.md .ion-md-arrow-dropright-circle { - color: #508AE4; -} -.md .ion-md-heart-outline { - color: #31D55F; -} - -.md .action-sheet-destructive { - margin-top: 2px; - padding-top: 1px; -} - -.md .action-sheet-cancel icon, .md .action-sheet-destructive icon { - color: #757575; -} - #card-wireframe { width: 100%; margin-bottom: 2.7em; @@ -185,15 +167,3 @@ body.ios img#ios-only { z-index: 50; } -.item-bold { - font-weight: bold; - color: #32DB64; -} -.item-subtle { - color: #656565; - margin-left: -3px !important; -} -.item-subtle:before { - padding-right: 5px; -} - diff --git a/demos/component-docs/cards/advanced-map/styles.scss b/demos/component-docs/cards/advanced-map/styles.scss index 4fee725340..1fb1feb59d 100644 --- a/demos/component-docs/cards/advanced-map/styles.scss +++ b/demos/component-docs/cards/advanced-map/styles.scss @@ -22,4 +22,16 @@ ion-card .icon-avatar { color: #444444; font-size: 1.8em; text-align: center; -} \ No newline at end of file +} + +.item-bold { + font-weight: bold; + color: #32DB64; +} +.item-subtle { + color: #656565; + margin-left: -3px !important; +} +.item-subtle:before { + padding-right: 5px; +} From 982f32bbcbe50422082cc6776e9a3279b943ba32 Mon Sep 17 00:00:00 2001 From: Drew Rygh Date: Thu, 5 Nov 2015 16:16:08 -0600 Subject: [PATCH 2/5] fix(demos): explicitly set android menu width Closes #401 --- demos/component-docs/app.scss | 1 + demos/component-docs/menus/basic/styles.scss | 3 +++ scripts/demos/webpack.config.js | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 demos/component-docs/menus/basic/styles.scss diff --git a/demos/component-docs/app.scss b/demos/component-docs/app.scss index d89196d331..620297a337 100644 --- a/demos/component-docs/app.scss +++ b/demos/component-docs/app.scss @@ -15,6 +15,7 @@ $font-path: '../../dist/fonts'; @import "cards/advanced-weather/styles"; @import "cards/advanced-map/styles"; @import "icons/basic/styles"; +@import "menus/basic/styles"; @import "slides/basic/styles"; diff --git a/demos/component-docs/menus/basic/styles.scss b/demos/component-docs/menus/basic/styles.scss new file mode 100644 index 0000000000..e38fd24cf7 --- /dev/null +++ b/demos/component-docs/menus/basic/styles.scss @@ -0,0 +1,3 @@ +body.md ion-menu#leftMenu { + width: 304px; +} \ No newline at end of file diff --git a/scripts/demos/webpack.config.js b/scripts/demos/webpack.config.js index d4dbe1cc7c..da0ed70706 100644 --- a/scripts/demos/webpack.config.js +++ b/scripts/demos/webpack.config.js @@ -3,8 +3,6 @@ module.exports = { "es6-shim", "zone.js", "reflect-metadata", - "angular2/angular2", - "ionic/ionic", "web-animations.min", ], module: { From 35307b36f47a1435ba04262dd66643ba890f5871 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 5 Nov 2015 16:18:51 -0600 Subject: [PATCH 3/5] fix(cache): do not cache 0 value dimensions --- ionic/util/dom.ts | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/ionic/util/dom.ts b/ionic/util/dom.ts index 868acf89fd..4b09c8c90b 100644 --- a/ionic/util/dom.ts +++ b/ionic/util/dom.ts @@ -245,12 +245,19 @@ export function getDimensions(ion) { let dimensions = dimensionCache[ion._dimId]; if (!dimensions) { let ele = ion.getNativeElement(); - dimensions = dimensionCache[ion._dimId] = { - width: ele.offsetWidth, - height: ele.offsetHeight, - left: ele.offsetLeft, - top: ele.offsetTop - }; + // make sure we got good values before caching + if (ele.offsetWidth && ele.offsetHeight) { + dimensions = dimensionCache[ion._dimId] = { + width: ele.offsetWidth, + height: ele.offsetHeight, + left: ele.offsetLeft, + top: ele.offsetTop + }; + + } else { + // do not cache bad values + return { width: 0, height: 0, left: 0, top: 0 }; + } } return dimensions; @@ -258,10 +265,16 @@ export function getDimensions(ion) { export function windowDimensions() { if (!dimensionCache.win) { - dimensionCache.win = { - width: window.innerWidth, - height: window.innerHeight - }; + // make sure we got good values before caching + if (window.innerWidth && window.innerHeight) { + dimensionCache.win = { + width: window.innerWidth, + height: window.innerHeight + }; + } else { + // do not cache bad values + return { width: 0, height: 0 }; + } } return dimensionCache.win; } From 35159a4daa9d4391e3218743ce1c39f8722a9e92 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 5 Nov 2015 17:05:07 -0600 Subject: [PATCH 4/5] fix(nav-registry): NavRegistry is a singleton --- ionic/components/nav/test/basic/index.ts | 1 + ionic/config/bootstrap.ts | 7 +++++-- ionic/config/decorators.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ionic/components/nav/test/basic/index.ts b/ionic/components/nav/test/basic/index.ts index 9c2ce6f806..a6d18028bc 100644 --- a/ionic/components/nav/test/basic/index.ts +++ b/ionic/components/nav/test/basic/index.ts @@ -206,6 +206,7 @@ class AnotherPage { @App({ + pages: [FirstPage, FullPage, PrimaryHeaderPage, AnotherPage], template: `` }) class E2EApp { diff --git a/ionic/config/bootstrap.ts b/ionic/config/bootstrap.ts index 601dd07dc5..75ba635cd3 100644 --- a/ionic/config/bootstrap.ts +++ b/ionic/config/bootstrap.ts @@ -20,9 +20,12 @@ import {initTapClick} from '../components/tap-click/tap-click'; import * as dom from '../util/dom'; -export function ionicProviders(config) { +export function ionicProviders(args) { let app = new IonicApp(); let platform = new Platform(); + let navRegistry = new NavRegistry(args.pages); + + var config = args.config; if (!(config instanceof Config)) { config = new Config(config); @@ -50,6 +53,7 @@ export function ionicProviders(config) { provide(Platform, {useValue: platform}), provide(FeatureDetect, {useValue: featureDetect}), provide(Events, {useValue: events}), + provide(NavRegistry, {useValue: navRegistry}), Form, Keyboard, OverlayController, @@ -57,7 +61,6 @@ export function ionicProviders(config) { Modal, Popup, Translate, - NavRegistry, ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy}), HTTP_PROVIDERS, diff --git a/ionic/config/decorators.ts b/ionic/config/decorators.ts index a6e5e5c7ff..d49a1ba5a6 100644 --- a/ionic/config/decorators.ts +++ b/ionic/config/decorators.ts @@ -135,7 +135,7 @@ export function App(args={}) { Reflect.defineMetadata('annotations', annotations, cls); console.time('bootstrap'); - bootstrap(cls, ionicProviders(args.config)).then(() => { + bootstrap(cls, ionicProviders(args)).then(() => { console.timeEnd('bootstrap'); }); From 0a06357de69cab7cf293ee48b5dacc57055a5288 Mon Sep 17 00:00:00 2001 From: Drew Rygh Date: Thu, 5 Nov 2015 17:12:21 -0600 Subject: [PATCH 5/5] docs(demos): disable swipe to go back on non-menu pages Closes #363 --- demos/component-docs/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demos/component-docs/index.ts b/demos/component-docs/index.ts index 2af4f048f8..6c648f5a5f 100644 --- a/demos/component-docs/index.ts +++ b/demos/component-docs/index.ts @@ -28,9 +28,14 @@ class DemoApp { window.addEventListener('message', (e) => { zone.run(() => { if (e.data) { + var data = JSON.parse(e.data); if (data.hash) { this.nextPage = helpers.getPageFor(data.hash.replace('#', '')); + this.app.getComponent('leftMenu').enable(false); + if (data.hash === 'menus') { + this.app.getComponent('leftMenu').enable(true); + } } else { this.nextPage = actionSheets.BasicPage; }