@@ -46,14 +46,34 @@ return /******/ (function(modules) { // webpackBootstrap
4646/******/ // define getter function for harmony exports
4747/******/ __webpack_require__ . d = function ( exports , name , getter ) {
4848/******/ if ( ! __webpack_require__ . o ( exports , name ) ) {
49- /******/ Object . defineProperty ( exports , name , {
50- /******/ configurable : false ,
51- /******/ enumerable : true ,
52- /******/ get : getter
53- /******/ } ) ;
49+ /******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
5450/******/ }
5551/******/ } ;
5652/******/
53+ /******/ // define __esModule on exports
54+ /******/ __webpack_require__ . r = function ( exports ) {
55+ /******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
56+ /******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
57+ /******/ }
58+ /******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
59+ /******/ } ;
60+ /******/
61+ /******/ // create a fake namespace object
62+ /******/ // mode & 1: value is a module id, require it
63+ /******/ // mode & 2: merge all properties of value into the ns
64+ /******/ // mode & 4: return value when already ns object
65+ /******/ // mode & 8|1: behave like require
66+ /******/ __webpack_require__ . t = function ( value , mode ) {
67+ /******/ if ( mode & 1 ) value = __webpack_require__ ( value ) ;
68+ /******/ if ( mode & 8 ) return value ;
69+ /******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . __esModule ) return value ;
70+ /******/ var ns = Object . create ( null ) ;
71+ /******/ __webpack_require__ . r ( ns ) ;
72+ /******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
73+ /******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) __webpack_require__ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
74+ /******/ return ns ;
75+ /******/ } ;
76+ /******/
5777/******/ // getDefaultExport function for compatibility with non-harmony modules
5878/******/ __webpack_require__ . n = function ( module ) {
5979/******/ var getter = module && module . __esModule ?
@@ -69,6 +89,7 @@ return /******/ (function(modules) { // webpackBootstrap
6989/******/ // __webpack_public_path__
7090/******/ __webpack_require__ . p = "" ;
7191/******/
92+ /******/
7293/******/ // Load entry module and return exports
7394/******/ return __webpack_require__ ( __webpack_require__ . s = 0 ) ;
7495/******/ } )
@@ -78,42 +99,91 @@ return /******/ (function(modules) { // webpackBootstrap
7899/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
79100
80101"use strict" ;
81- Object . defineProperty ( __webpack_exports__ , "__esModule" , { value : true } ) ;
82- /* harmony export (immutable) */ __webpack_exports__ [ "default" ] = route ;
83- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__UrlBuilder__ = __webpack_require__ ( 1 ) ;
102+ __webpack_require__ . r ( __webpack_exports__ ) ;
103+
104+ // CONCATENATED MODULE: ./src/js/UrlBuilder.js
105+ var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
106+
107+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
108+
109+ var UrlBuilder = function ( ) {
110+ function UrlBuilder ( name , absolute , ziggyObject ) {
111+ _classCallCheck ( this , UrlBuilder ) ;
112+
113+ this . name = name ;
114+ this . ziggy = ziggyObject ;
115+ this . route = this . ziggy . namedRoutes [ this . name ] ;
116+
117+ if ( typeof this . name === 'undefined' ) {
118+ throw new Error ( 'Ziggy Error: You must provide a route name' ) ;
119+ } else if ( typeof this . route === 'undefined' ) {
120+ throw new Error ( 'Ziggy Error: route \'' + this . name + '\' is not found in the route list' ) ;
121+ }
122+
123+ this . absolute = typeof absolute === 'undefined' ? true : absolute ;
124+ this . domain = this . setDomain ( ) ;
125+ this . path = this . route . uri . replace ( / ^ \/ / , '' ) ;
126+ }
127+
128+ _createClass ( UrlBuilder , [ {
129+ key : 'setDomain' ,
130+ value : function setDomain ( ) {
131+ if ( ! this . absolute ) return '/' ;
132+
133+ if ( ! this . route . domain ) return this . ziggy . baseUrl . replace ( / \/ ? $ / , '/' ) ;
134+
135+ var host = ( this . route . domain || this . ziggy . baseDomain ) . replace ( / \/ + $ / , '' ) ;
136+
137+ if ( this . ziggy . basePort && host . replace ( / \/ + $ / , '' ) === this . ziggy . baseDomain . replace ( / \/ + $ / , '' ) ) host = this . ziggy . baseDomain + ':' + this . ziggy . basePort ;
138+
139+ return this . ziggy . baseProtocol + '://' + host + '/' ;
140+ }
141+ } , {
142+ key : 'construct' ,
143+ value : function construct ( ) {
144+ return this . domain + this . path ;
145+ }
146+ } ] ) ;
147+
148+ return UrlBuilder ;
149+ } ( ) ;
150+
151+ /* harmony default export */ var js_UrlBuilder = ( UrlBuilder ) ;
152+ // CONCATENATED MODULE: ./src/js/route.js
153+ /* harmony export (binding) */ __webpack_require__ . d ( __webpack_exports__ , "default" , function ( ) { return route ; } ) ;
84154var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
85155
86156var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
87157
88- var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
158+ var route_createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
89159
90- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
160+ function route_classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
91161
92162function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
93163
94164function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . __proto__ = superClass ; }
95165
96166
97167
98- var Router = function ( _String ) {
168+ var route_Router = function ( _String ) {
99169 _inherits ( Router , _String ) ;
100170
101171 function Router ( name , params , absolute ) {
102172 var customZiggy = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : null ;
103173
104- _classCallCheck ( this , Router ) ;
174+ route_classCallCheck ( this , Router ) ;
105175
106176 var _this = _possibleConstructorReturn ( this , ( Router . __proto__ || Object . getPrototypeOf ( Router ) ) . call ( this ) ) ;
107177
108178 _this . name = name ;
109179 _this . absolute = absolute ;
110180 _this . ziggy = customZiggy ? customZiggy : Ziggy ;
111- _this . template = _this . name ? new __WEBPACK_IMPORTED_MODULE_0__UrlBuilder__ [ "a" /* default */ ] ( name , absolute , _this . ziggy ) . construct ( ) : '' , _this . urlParams = _this . normalizeParams ( params ) ;
181+ _this . template = _this . name ? new js_UrlBuilder ( name , absolute , _this . ziggy ) . construct ( ) : '' , _this . urlParams = _this . normalizeParams ( params ) ;
112182 _this . queryParams = _this . normalizeParams ( params ) ;
113183 return _this ;
114184 }
115185
116- _createClass ( Router , [ {
186+ route_createClass ( Router , [ {
117187 key : 'normalizeParams' ,
118188 value : function normalizeParams ( params ) {
119189 if ( typeof params === 'undefined' ) return { } ;
@@ -206,7 +276,7 @@ var Router = function (_String) {
206276 var queryString = '?' ;
207277
208278 Object . keys ( this . queryParams ) . forEach ( function ( key , i ) {
209- if ( this . queryParams [ key ] ) {
279+ if ( this . queryParams [ key ] !== undefined && this . queryParams [ key ] !== null ) {
210280 queryString = i === 0 ? queryString : queryString + '&' ;
211281 queryString += key + '=' + encodeURIComponent ( this . queryParams [ key ] ) ;
212282 }
@@ -217,12 +287,14 @@ var Router = function (_String) {
217287 } , {
218288 key : 'current' ,
219289 value : function current ( ) {
290+ var _this3 = this ;
291+
220292 var name = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : null ;
221293
222294 var routeNames = Object . keys ( this . ziggy . namedRoutes ) ;
223295
224296 var currentRoute = routeNames . filter ( function ( name ) {
225- return new Router ( name ) . matchUrl ( ) ;
297+ return new Router ( name , undefined , undefined , _this3 . ziggy ) . matchUrl ( ) ;
226298 } ) [ 0 ] ;
227299
228300 return name ? name == currentRoute : currentRoute ;
@@ -254,62 +326,9 @@ var Router = function (_String) {
254326} ( String ) ;
255327
256328function route ( name , params , absolute , customZiggy ) {
257- return new Router ( name , params , absolute , customZiggy ) ;
329+ return new route_Router ( name , params , absolute , customZiggy ) ;
258330} ;
259331
260- /***/ } ) ,
261- /* 1 */
262- /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
263-
264- "use strict" ;
265- var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
266-
267- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
268-
269- var UrlBuilder = function ( ) {
270- function UrlBuilder ( name , absolute , ziggyObject ) {
271- _classCallCheck ( this , UrlBuilder ) ;
272-
273- this . name = name ;
274- this . ziggy = ziggyObject ;
275- this . route = this . ziggy . namedRoutes [ this . name ] ;
276-
277- if ( typeof this . name === 'undefined' ) {
278- throw new Error ( 'Ziggy Error: You must provide a route name' ) ;
279- } else if ( typeof this . route === 'undefined' ) {
280- throw new Error ( 'Ziggy Error: route \'' + this . name + '\' is not found in the route list' ) ;
281- }
282-
283- this . absolute = typeof absolute === 'undefined' ? true : absolute ;
284- this . domain = this . setDomain ( ) ;
285- this . path = this . route . uri . replace ( / ^ \/ / , '' ) ;
286- }
287-
288- _createClass ( UrlBuilder , [ {
289- key : 'setDomain' ,
290- value : function setDomain ( ) {
291- if ( ! this . absolute ) return '/' ;
292-
293- if ( ! this . route . domain ) return this . ziggy . baseUrl . replace ( / \/ ? $ / , '/' ) ;
294-
295- var host = ( this . route . domain || this . ziggy . baseDomain ) . replace ( / \/ + $ / , '' ) ;
296-
297- if ( this . ziggy . basePort && host . replace ( / \/ + $ / , '' ) === this . ziggy . baseDomain . replace ( / \/ + $ / , '' ) ) host = this . ziggy . baseDomain + ':' + this . ziggy . basePort ;
298-
299- return this . ziggy . baseProtocol + '://' + host + '/' ;
300- }
301- } , {
302- key : 'construct' ,
303- value : function construct ( ) {
304- return this . domain + this . path ;
305- }
306- } ] ) ;
307-
308- return UrlBuilder ;
309- } ( ) ;
310-
311- /* harmony default export */ __webpack_exports__ [ "a" ] = ( UrlBuilder ) ;
312-
313332/***/ } )
314333/******/ ] ) [ "default" ] ;
315334} ) ;
0 commit comments