hyper-router 2.4.1 → 4.0.0
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/README.md +330 -268
- data/lib/hyper-router.rb +30 -15
- data/lib/hyper-router/class_methods.rb +53 -0
- data/lib/hyper-router/component_methods.rb +63 -0
- data/lib/hyper-router/history.rb +22 -0
- data/lib/hyper-router/location.rb +29 -0
- data/lib/hyper-router/match.rb +18 -0
- data/lib/hyper-router/react-router-source.rb +4 -2
- data/lib/{react/router → hyper-router}/version.rb +1 -1
- data/lib/hyperloop/router.rb +36 -0
- data/lib/hyperloop/router/base.rb +12 -0
- data/lib/hyperloop/router/base/class_methods.rb +21 -0
- data/lib/hyperloop/router/browser.rb +12 -0
- data/lib/hyperloop/router/browser/class_methods.rb +15 -0
- data/lib/hyperloop/router/component.rb +28 -0
- data/lib/hyperloop/router/hash.rb +12 -0
- data/lib/hyperloop/router/hash/class_methods.rb +15 -0
- data/lib/hyperloop/router/memory.rb +12 -0
- data/lib/hyperloop/router/memory/class_methods.rb +15 -0
- data/lib/hyperloop/router/static.rb +12 -0
- data/lib/hyperloop/router/static/class_methods.rb +15 -0
- data/lib/react/router.rb +2 -128
- data/lib/react/router/dom.rb +7 -0
- data/lib/react/router/history.rb +19 -25
- data/lib/src/history.min.js +1 -0
- data/lib/src/react-router-dom.min.js +2 -0
- data/lib/src/react-router.min.js +1 -0
- metadata +34 -21
- data/lib/promise_extras.rb +0 -7
- data/lib/react/router/dsl.rb +0 -31
- data/lib/react/router/dsl/index.rb +0 -11
- data/lib/react/router/dsl/route.rb +0 -89
- data/lib/react/router/dsl/route/hooks.rb +0 -21
- data/lib/react/router/dsl/route/wrappers.rb +0 -104
- data/lib/react/router/dsl/transition_context.rb +0 -27
- data/lib/src/react-router.js +0 -2
data/lib/react/router.rb
CHANGED
@@ -1,131 +1,5 @@
|
|
1
1
|
module React
|
2
|
-
class Router
|
3
|
-
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def hash_history
|
7
|
-
RouterHistory.new(`ReactRouter.hashHistory`)
|
8
|
-
end
|
9
|
-
|
10
|
-
def browser_history
|
11
|
-
RouterHistory.new(`ReactRouter.browserHistory`)
|
12
|
-
end
|
13
|
-
|
14
|
-
def create_memory_history(opts = {})
|
15
|
-
RouterHistory.new(`ReactRouter.createMemoryHistory(#{opts.to_n})`)
|
16
|
-
end
|
17
|
-
|
18
|
-
def Link(to, opts = {}, &children)
|
19
|
-
opts[:activeClassName] = opts.delete(:active_class).to_n if opts[:active_class]
|
20
|
-
opts[:activeStyle] = opts.delete(:active_style).to_n if opts[:active_style]
|
21
|
-
if opts[:only_active_on_index]
|
22
|
-
opts[:onlyActiveOnIndex] = opts.delete(:only_active_on_index).to_n
|
23
|
-
end
|
24
|
-
opts[:to] = to.to_n
|
25
|
-
Native::Link(opts, &children)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def route(*args, &children)
|
30
|
-
DSL::Route.new(*args, &children)
|
31
|
-
end
|
32
|
-
|
33
|
-
def index(opts = {})
|
34
|
-
DSL::Index.new(opts)
|
35
|
-
end
|
36
|
-
|
37
|
-
def redirect(from, opts = {})
|
38
|
-
DSL::Route.new(opts.merge(path: from)).on(:enter) { |c| c.replace(opts[:to]) }
|
39
|
-
end
|
40
|
-
|
41
|
-
def index_redirect(opts = {})
|
42
|
-
DSL::Index.new(opts).on(:enter) { |c| c.replace(opts[:to]) }
|
43
|
-
end
|
44
|
-
|
45
|
-
def build_routes(&block)
|
46
|
-
React::Router::DSL.build_routes(&block)
|
47
|
-
end
|
48
|
-
|
49
|
-
def gather_params
|
50
|
-
params = { routes: React::Router::DSL.children_to_n(build_routes { routes }) }
|
51
|
-
params[:history] = history.to_n if respond_to? :history
|
52
|
-
%w(create_element stringify_query parse_query_string on_error on_update).each do |method|
|
53
|
-
params[method.camelcase(false)] = send("#{method}_wrapper") if respond_to? method
|
54
|
-
end
|
55
|
-
params
|
56
|
-
end
|
57
|
-
|
58
|
-
def render
|
59
|
-
Native::Router(gather_params)
|
60
|
-
end
|
61
|
-
|
62
|
-
# private
|
63
|
-
|
64
|
-
class Native < React::NativeLibrary
|
65
|
-
imports 'ReactRouter'
|
66
|
-
end
|
67
|
-
|
68
|
-
def stringify_query_wrapper
|
69
|
-
->(query) { stringify_query(query) }
|
70
|
-
end
|
71
|
-
|
72
|
-
def parse_query_string_wrapper
|
73
|
-
->(query_string) { parse_query_string(query_string) }
|
74
|
-
end
|
75
|
-
|
76
|
-
def on_update_wrapper
|
77
|
-
-> { on_update(Hash.new(`this.props`), Hash.new(`this.state`)) }
|
78
|
-
end
|
79
|
-
|
80
|
-
def create_element_wrapper
|
81
|
-
lambda do |component, props|
|
82
|
-
comp_classes = React::API.class_eval { @@component_classes }
|
83
|
-
rb_component = comp_classes.detect { |_key, value| value == component }.first
|
84
|
-
# Not sure if this could ever happen,
|
85
|
-
# could not figure out a way to test it so commented it out.
|
86
|
-
# unless rb_component
|
87
|
-
# rb_component = Class.new(React::Component::Base)
|
88
|
-
# comp_classes[rb_component] = component
|
89
|
-
# end
|
90
|
-
rb_props = convert_props(props)
|
91
|
-
result = create_element(rb_component, rb_props)
|
92
|
-
convert_or_create_element(result, component, props, rb_component, rb_props)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def on_error_wrapper
|
97
|
-
-> (message) { on_error(message) }
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
|
102
|
-
def convert_props(props)
|
103
|
-
children_are_null = `#{props}.children == undefined || #{props}.children == null`
|
104
|
-
{ children: children_are_null ? [] : [`#{props}.children`].flatten,
|
105
|
-
history: `#{props}.history`,
|
106
|
-
location: `#{props}.location`,
|
107
|
-
params: `#{props}.params`,
|
108
|
-
route: `#{props}.route`,
|
109
|
-
route_params: `#{props}.route_params`,
|
110
|
-
routes: `#{props}.routes` }
|
111
|
-
end
|
112
|
-
|
113
|
-
def convert_or_create_element(result, component, props, rb_component, rb_props)
|
114
|
-
is_result_native_react_element = `!!result._isReactElement`
|
115
|
-
if is_result_native_react_element
|
116
|
-
result
|
117
|
-
elsif !result
|
118
|
-
`React.createElement(#{component}, #{props})`
|
119
|
-
elsif result.is_a? React::Element
|
120
|
-
result.to_n
|
121
|
-
else
|
122
|
-
React.create_element(rb_component, rb_props).to_n
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
module Hyperloop
|
129
|
-
class Router < React::Router
|
2
|
+
class Router < React::NativeLibrary
|
3
|
+
imports 'ReactRouter'
|
130
4
|
end
|
131
5
|
end
|
data/lib/react/router/history.rb
CHANGED
@@ -1,31 +1,25 @@
|
|
1
1
|
module React
|
2
|
-
class
|
3
|
-
|
2
|
+
class Router
|
3
|
+
class History
|
4
|
+
include Native
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def self.current
|
7
|
+
new(`History`)
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def initialize(native)
|
11
|
+
@native = native
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
alias_native :push_state, :pushState
|
24
|
-
alias_native :register_transition_hook, :registerTransitionHook
|
25
|
-
alias_native :replace
|
26
|
-
alias_native :replace_state, :replaceState
|
27
|
-
alias_native :set_state, :setState
|
28
|
-
alias_native :transition_to, :transitionTo
|
29
|
-
alias_native :unregister_transition_hook, :unregisterTransitionHook
|
14
|
+
def to_n
|
15
|
+
@native
|
16
|
+
end
|
17
|
+
|
18
|
+
alias_native :create_browser_history, :createBrowserHistory
|
19
|
+
alias_native :create_hash_history, :createHashHistory
|
20
|
+
alias_native :create_location, :createLocation
|
21
|
+
alias_native :create_memory_history, :createMemoryHistory
|
22
|
+
alias_native :create_path, :createPath
|
23
|
+
end
|
30
24
|
end
|
31
25
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.History=n():t.History=n()}(this,function(){return function(t){function n(o){if(e[o])return e[o].exports;var r=e[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0,n.createPath=n.parsePath=n.locationsAreEqual=n.createLocation=n.createMemoryHistory=n.createHashHistory=n.createBrowserHistory=void 0;var r=e(2);Object.defineProperty(n,"createLocation",{enumerable:!0,get:function(){return r.createLocation}}),Object.defineProperty(n,"locationsAreEqual",{enumerable:!0,get:function(){return r.locationsAreEqual}});var i=e(1);Object.defineProperty(n,"parsePath",{enumerable:!0,get:function(){return i.parsePath}}),Object.defineProperty(n,"createPath",{enumerable:!0,get:function(){return i.createPath}});var a=e(7),c=o(a),u=e(8),s=o(u),f=e(9),l=o(f);n.createBrowserHistory=c.default,n.createHashHistory=s.default,n.createMemoryHistory=l.default},function(t,n){"use strict";n.__esModule=!0;n.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},n.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t},n.stripPrefix=function(t,n){return 0===t.indexOf(n)?t.substr(n.length):t},n.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},n.parsePath=function(t){var n=t||"/",e="",o="",r=n.indexOf("#");r!==-1&&(o=n.substr(r),n=n.substr(0,r));var i=n.indexOf("?");return i!==-1&&(e=n.substr(i),n=n.substr(0,i)),n=decodeURI(n),{pathname:n,search:"?"===e?"":e,hash:"#"===o?"":o}},n.createPath=function(t){var n=t.pathname,e=t.search,o=t.hash,r=encodeURI(n||"/");return e&&"?"!==e&&(r+="?"===e.charAt(0)?e:"?"+e),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),r}},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0,n.locationsAreEqual=n.createLocation=void 0;var r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},i=e(10),a=o(i),c=e(11),u=o(c),s=e(1);n.createLocation=function(t,n,e,o){var i=void 0;return"string"==typeof t?(i=(0,s.parsePath)(t),i.state=n):(i=r({},t),void 0===i.pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==n&&void 0===i.state&&(i.state=n)),i.key=e,o&&(i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,a.default)(i.pathname,o.pathname)):i.pathname=o.pathname),i},n.locationsAreEqual=function(t,n){return t.pathname===n.pathname&&t.search===n.search&&t.hash===n.hash&&t.key===n.key&&(0,u.default)(t.state,n.state)}},function(t,n,e){"use strict";var o=function(){};t.exports=o},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var r=e(3),i=(o(r),function(){var t=null,n=function(n){return t=n,function(){t===n&&(t=null)}},e=function(n,e,o,r){if(null!=t){var i="function"==typeof t?t(n,e):t;"string"==typeof i?"function"==typeof o?o(i,r):r(!0):r(i!==!1)}else r(!0)},o=[],r=function(t){var n=!0,e=function(){n&&t.apply(void 0,arguments)};return o.push(e),function(){n=!1,o=o.filter(function(t){return t!==e})}},i=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];o.forEach(function(t){return t.apply(void 0,n)})};return{setPrompt:n,confirmTransitionTo:e,appendListener:r,notifyListeners:i}});n.default=i},function(t,n){"use strict";n.__esModule=!0;n.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),n.addEventListener=function(t,n,e){return t.addEventListener?t.addEventListener(n,e,!1):t.attachEvent("on"+n,e)},n.removeEventListener=function(t,n,e){return t.removeEventListener?t.removeEventListener(n,e,!1):t.detachEvent("on"+n,e)},n.getConfirmation=function(t,n){return n(window.confirm(t))},n.supportsHistory=function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)},n.supportsPopStateOnHashChange=function(){return window.navigator.userAgent.indexOf("Trident")===-1},n.supportsGoWithoutReloadUsingHash=function(){return window.navigator.userAgent.indexOf("Firefox")===-1},n.isExtraneousPopstateEvent=function(t){return void 0===t.state&&navigator.userAgent.indexOf("CriOS")===-1}},function(t,n,e){"use strict";var o=function(t,n,e,o,r,i,a,c){if(!t){var u;if(void 0===n)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[e,o,r,i,a,c],f=0;u=new Error(n.replace(/%s/g,function(){return s[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};t.exports=o},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var r=("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t}),i=e(3),a=(o(i),e(6)),c=o(a),u=e(2),s=e(1),f=e(4),l=o(f),d=e(5),h="popstate",v="hashchange",p=function(){try{return window.history.state||{}}catch(t){return{}}},y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.canUseDOM?void 0:(0,c.default)(!1);var n=window.history,e=(0,d.supportsHistory)(),o=!(0,d.supportsPopStateOnHashChange)(),i=t.forceRefresh,a=void 0!==i&&i,f=t.getUserConfirmation,y=void 0===f?d.getConfirmation:f,g=t.keyLength,m=void 0===g?6:g,w=t.basename?(0,s.stripTrailingSlash)((0,s.addLeadingSlash)(t.basename)):"",P=function(t){var n=t||{},e=n.key,o=n.state,i=window.location,a=i.pathname,c=i.search,u=i.hash,f=a+c+u;return w&&(f=(0,s.stripPrefix)(f,w)),r({},(0,s.parsePath)(f),{state:o,key:e})},b=function(){return Math.random().toString(36).substr(2,m)},O=(0,l.default)(),x=function(t){r(G,t),G.length=n.length,O.notifyListeners(G.location,G.action)},L=function(t){(0,d.isExtraneousPopstateEvent)(t)||A(P(t.state))},S=function(){A(P(p()))},E=!1,A=function(t){if(E)E=!1,x();else{var n="POP";O.confirmTransitionTo(t,n,y,function(e){e?x({action:n,location:t}):_(t)})}},_=function(t){var n=G.location,e=M.indexOf(n.key);e===-1&&(e=0);var o=M.indexOf(t.key);o===-1&&(o=0);var r=e-o;r&&(E=!0,C(r))},k=P(p()),M=[k.key],T=function(t){return w+(0,s.createPath)(t)},H=function(t,o){var r="PUSH",i=(0,u.createLocation)(t,o,b(),G.location);O.confirmTransitionTo(i,r,y,function(t){if(t){var o=T(i),c=i.key,u=i.state;if(e)if(n.pushState({key:c,state:u},null,o),a)window.location.href=o;else{var s=M.indexOf(G.location.key),f=M.slice(0,s===-1?0:s+1);f.push(i.key),M=f,x({action:r,location:i})}else window.location.href=o}})},j=function(t,o){var r="REPLACE",i=(0,u.createLocation)(t,o,b(),G.location);O.confirmTransitionTo(i,r,y,function(t){if(t){var o=T(i),c=i.key,u=i.state;if(e)if(n.replaceState({key:c,state:u},null,o),a)window.location.replace(o);else{var s=M.indexOf(G.location.key);s!==-1&&(M[s]=i.key),x({action:r,location:i})}else window.location.replace(o)}})},C=function(t){n.go(t)},U=function(){return C(-1)},R=function(){return C(1)},I=0,q=function(t){I+=t,1===I?((0,d.addEventListener)(window,h,L),o&&(0,d.addEventListener)(window,v,S)):0===I&&((0,d.removeEventListener)(window,h,L),o&&(0,d.removeEventListener)(window,v,S))},B=!1,F=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=O.setPrompt(t);return B||(q(1),B=!0),function(){return B&&(B=!1,q(-1)),n()}},D=function(t){var n=O.appendListener(t);return q(1),function(){q(-1),n()}},G={length:n.length,action:"POP",location:k,createHref:T,push:H,replace:j,go:C,goBack:U,goForward:R,block:F,listen:D};return G};n.default=y},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},i=e(3),a=(o(i),e(6)),c=o(a),u=e(2),s=e(1),f=e(4),l=o(f),d=e(5),h="hashchange",v={hashbang:{encodePath:function(t){return"!"===t.charAt(0)?t:"!/"+(0,s.stripLeadingSlash)(t)},decodePath:function(t){return"!"===t.charAt(0)?t.substr(1):t}},noslash:{encodePath:s.stripLeadingSlash,decodePath:s.addLeadingSlash},slash:{encodePath:s.addLeadingSlash,decodePath:s.addLeadingSlash}},p=function(){var t=window.location.href,n=t.indexOf("#");return n===-1?"":t.substring(n+1)},y=function(t){return window.location.hash=t},g=function(t){var n=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,n>=0?n:0)+"#"+t)},m=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.canUseDOM?void 0:(0,c.default)(!1);var n=window.history,e=((0,d.supportsGoWithoutReloadUsingHash)(),t.getUserConfirmation),o=void 0===e?d.getConfirmation:e,i=t.hashType,a=void 0===i?"slash":i,f=t.basename?(0,s.stripTrailingSlash)((0,s.addLeadingSlash)(t.basename)):"",m=v[a],w=m.encodePath,P=m.decodePath,b=function(){var t=P(p());return f&&(t=(0,s.stripPrefix)(t,f)),(0,s.parsePath)(t)},O=(0,l.default)(),x=function(t){r(V,t),V.length=n.length,O.notifyListeners(V.location,V.action)},L=!1,S=null,E=function(){var t=p(),n=w(t);if(t!==n)g(n);else{var e=b(),o=V.location;if(!L&&(0,u.locationsAreEqual)(o,e))return;if(S===(0,s.createPath)(e))return;S=null,A(e)}},A=function(t){if(L)L=!1,x();else{var n="POP";O.confirmTransitionTo(t,n,o,function(e){e?x({action:n,location:t}):_(t)})}},_=function(t){var n=V.location,e=H.lastIndexOf((0,s.createPath)(n));e===-1&&(e=0);var o=H.lastIndexOf((0,s.createPath)(t));o===-1&&(o=0);var r=e-o;r&&(L=!0,R(r))},k=p(),M=w(k);k!==M&&g(M);var T=b(),H=[(0,s.createPath)(T)],j=function(t){return"#"+w(f+(0,s.createPath)(t))},C=function(t,n){var e="PUSH",r=(0,u.createLocation)(t,void 0,void 0,V.location);O.confirmTransitionTo(r,e,o,function(t){if(t){var n=(0,s.createPath)(r),o=w(f+n),i=p()!==o;if(i){S=n,y(o);var a=H.lastIndexOf((0,s.createPath)(V.location)),c=H.slice(0,a===-1?0:a+1);c.push(n),H=c,x({action:e,location:r})}else x()}})},U=function(t,n){var e="REPLACE",r=(0,u.createLocation)(t,void 0,void 0,V.location);O.confirmTransitionTo(r,e,o,function(t){if(t){var n=(0,s.createPath)(r),o=w(f+n),i=p()!==o;i&&(S=n,g(o));var a=H.indexOf((0,s.createPath)(V.location));a!==-1&&(H[a]=n),x({action:e,location:r})}})},R=function(t){n.go(t)},I=function(){return R(-1)},q=function(){return R(1)},B=0,F=function(t){B+=t,1===B?(0,d.addEventListener)(window,h,E):0===B&&(0,d.removeEventListener)(window,h,E)},D=!1,G=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=O.setPrompt(t);return D||(F(1),D=!0),function(){return D&&(D=!1,F(-1)),n()}},W=function(t){var n=O.appendListener(t);return F(1),function(){F(-1),n()}},V={length:n.length,action:"POP",location:T,createHref:j,push:C,replace:U,go:R,goBack:I,goForward:q,block:G,listen:W};return V};n.default=m},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var r=("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t}),i=e(3),a=(o(i),e(1)),c=e(2),u=e(4),s=o(u),f=function(t,n,e){return Math.min(Math.max(t,n),e)},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.getUserConfirmation,e=t.initialEntries,o=void 0===e?["/"]:e,i=t.initialIndex,u=void 0===i?0:i,l=t.keyLength,d=void 0===l?6:l,h=(0,s.default)(),v=function(t){r(A,t),A.length=A.entries.length,h.notifyListeners(A.location,A.action)},p=function(){return Math.random().toString(36).substr(2,d)},y=f(u,0,o.length-1),g=o.map(function(t){return"string"==typeof t?(0,c.createLocation)(t,void 0,p()):(0,c.createLocation)(t,void 0,t.key||p())}),m=a.createPath,w=function(t,e){var o="PUSH",r=(0,c.createLocation)(t,e,p(),A.location);h.confirmTransitionTo(r,o,n,function(t){if(t){var n=A.index,e=n+1,i=A.entries.slice(0);i.length>e?i.splice(e,i.length-e,r):i.push(r),v({action:o,location:r,index:e,entries:i})}})},P=function(t,e){var o="REPLACE",r=(0,c.createLocation)(t,e,p(),A.location);h.confirmTransitionTo(r,o,n,function(t){t&&(A.entries[A.index]=r,v({action:o,location:r}))})},b=function(t){var e=f(A.index+t,0,A.entries.length-1),o="POP",r=A.entries[e];h.confirmTransitionTo(r,o,n,function(t){t?v({action:o,location:r,index:e}):v()})},O=function(){return b(-1)},x=function(){return b(1)},L=function(t){var n=A.index+t;return n>=0&&n<A.entries.length},S=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return h.setPrompt(t)},E=function(t){return h.appendListener(t)},A={length:g.length,action:"POP",location:g[y],index:y,entries:g,createHref:m,push:w,replace:P,go:b,goBack:O,goForward:x,canGo:L,block:S,listen:E};return A};n.default=l},function(t,n){"use strict";var e=function(t){return"/"===t.charAt(0)},o=function(t,n){for(var e=n,o=e+1,r=t.length;o<r;e+=1,o+=1)t[e]=t[o];t.pop()},r=function(t){var n=arguments.length<=1||void 0===arguments[1]?"":arguments[1],r=t&&t.split("/")||[],i=n&&n.split("/")||[],a=t&&e(t),c=n&&e(n),u=a||c;if(t&&e(t)?i=r:r.length&&(i.pop(),i=i.concat(r)),!i.length)return"/";var s=void 0;if(i.length){var f=i[i.length-1];s="."===f||".."===f||""===f}else s=!1;for(var l=0,d=i.length;d>=0;d--){var h=i[d];"."===h?o(i,d):".."===h?(o(i,d),l++):l&&(o(i,d),l--)}if(!u)for(;l--;l)i.unshift("..");!u||""===i[0]||i[0]&&e(i[0])||i.unshift("");var v=i.join("/");return s&&"/"!==v.substr(-1)&&(v+="/"),v};t.exports=r},function(t,n){"use strict";n.__esModule=!0;var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function t(n,o){if(n===o)return!0;if(null==n||null==o)return!1;if(Array.isArray(n))return!(!Array.isArray(o)||n.length!==o.length)&&n.every(function(n,e){return t(n,o[e])});var r="undefined"==typeof n?"undefined":e(n),i="undefined"==typeof o?"undefined":e(o);if(r!==i)return!1;if("object"===r){var a=n.valueOf(),c=o.valueOf();if(a!==n||c!==o)return t(a,c);var u=Object.keys(n),s=Object.keys(o);return u.length===s.length&&u.every(function(e){return t(n[e],o[e])})}return!1};n.default=o}])});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactRouterDOM=e(require("react")):t.ReactRouterDOM=e(t.React)}(this,function(t){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.withRouter=e.matchPath=e.Switch=e.StaticRouter=e.Router=e.Route=e.Redirect=e.Prompt=e.NavLink=e.MemoryRouter=e.Link=e.HashRouter=e.BrowserRouter=void 0;var r=n(16),i=o(r),a=n(17),u=o(a),c=n(9),s=o(c),l=n(18),f=o(l),p=n(19),h=o(p),d=n(20),y=o(d),v=n(21),m=o(v),b=n(22),g=o(b),w=n(23),P=o(w),O=n(24),_=o(O),x=n(25),T=o(x),j=n(26),R=o(j),E=n(27),M=o(E);e.BrowserRouter=i.default,e.HashRouter=u.default,e.Link=s.default,e.MemoryRouter=f.default,e.NavLink=h.default,e.Prompt=y.default,e.Redirect=m.default,e.Route=g.default,e.Router=P.default,e.StaticRouter=_.default,e.Switch=T.default,e.matchPath=R.default,e.withRouter=M.default},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.withRouter=e.matchPath=e.Switch=e.StaticRouter=e.Router=e.Route=e.Redirect=e.Prompt=e.MemoryRouter=void 0;var r=n(32),i=o(r),a=n(33),u=o(a),c=n(34),s=o(c),l=n(14),f=o(l),p=n(6),h=o(p),d=n(35),y=o(d),v=n(36),m=o(v),b=n(7),g=o(b),w=n(37),P=o(w);e.MemoryRouter=i.default,e.Prompt=u.default,e.Redirect=s.default,e.Route=f.default,e.Router=h.default,e.StaticRouter=y.default,e.Switch=m.default,e.matchPath=g.default,e.withRouter=P.default},function(e,n){e.exports=t},function(t,e,n){"use strict";var o=function(){};t.exports=o},function(t,e){"use strict";e.__esModule=!0;e.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},e.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t},e.stripPrefix=function(t,e){return 0===t.indexOf(e)?t.substr(e.length):t},e.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},e.parsePath=function(t){var e=t||"/",n="",o="";e=decodeURI(e);var r=e.indexOf("#");r!==-1&&(o=e.substr(r),e=e.substr(0,r));var i=e.indexOf("?");return i!==-1&&(n=e.substr(i),e=e.substr(0,i)),{pathname:e,search:"?"===n?"":n,hash:"#"===o?"":o}},e.createPath=function(t){var e=t.pathname,n=t.search,o=t.hash,r=e||"/";return n&&"?"!==n&&(r+="?"===n.charAt(0)?n:"?"+n),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),encodeURI(r)}},function(t,e,n){"use strict";var o=function(){};t.exports=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},c=n(3),s=o(c),l=n(15),f=o(l),p=n(2),h=o(p),d=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.state={match:o.computeMatch(o.props.history.location.pathname)},a=n,i(o,a)}return a(e,t),e.prototype.getChildContext=function(){return{router:u({},this.context.router,{history:this.props.history,route:{location:this.props.history.location,match:this.state.match}})}},e.prototype.computeMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}},e.prototype.componentWillMount=function(){var t=this,e=this.props,n=e.children,o=e.history;(0,f.default)(null==n||1===h.default.Children.count(n),"A <Router> may have only one child element"),this.unlisten=o.listen(function(){t.setState({match:t.computeMatch(o.location.pathname)})})},e.prototype.componentWillReceiveProps=function(t){(0,s.default)(this.props.history===t.history,"You cannot change <Router history>")},e.prototype.componentWillUnmount=function(){this.unlisten()},e.prototype.render=function(){var t=this.props.children;return t?h.default.Children.only(t):null},e}(h.default.Component);d.propTypes={history:p.PropTypes.object.isRequired,children:p.PropTypes.node},d.contextTypes={router:p.PropTypes.object},d.childContextTypes={router:p.PropTypes.object.isRequired},e.default=d},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=n(41),i=o(r),a={},u=1e4,c=0,s=function(t,e){var n=""+e.end+e.strict,o=a[n]||(a[n]={});if(o[t])return o[t];var r=[],s=(0,i.default)(t,r,e),l={re:s,keys:r};return c<u&&(o[t]=l,c++),l},l=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={path:e});var n=e,o=n.path,r=void 0===o?"/":o,i=n.exact,a=void 0!==i&&i,u=n.strict,c=void 0!==u&&u,l=s(r,{end:a,strict:c}),f=l.re,p=l.keys,h=f.exec(t);if(!h)return null;var d=h[0],y=h.slice(1),v=t===d;return a&&!v?null:{path:r,url:"/"===r&&""===d?"/":d,isExact:v,params:p.reduce(function(t,e,n){return t[e.name]=y[n],t},{})}};e.default=l},function(t,e){"use strict";e.__esModule=!0;e.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},e.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t},e.stripPrefix=function(t,e){return 0===t.indexOf(e)?t.substr(e.length):t},e.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},e.parsePath=function(t){var e=t||"/",n="",o="";e=decodeURI(e);var r=e.indexOf("#");r!==-1&&(o=e.substr(r),e=e.substr(0,r));var i=e.indexOf("?");return i!==-1&&(n=e.substr(i),e=e.substr(0,i)),{pathname:e,search:"?"===n?"":n,hash:"#"===o?"":o}},e.createPath=function(t){var e=t.pathname,n=t.search,o=t.hash,r=e||"/";return n&&"?"!==n&&(r+="?"===n.charAt(0)?n:"?"+n),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),encodeURI(r)}},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},s=n(2),l=o(s),f=function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)},p=function(t){function e(){var n,o,r;i(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=a(this,t.call.apply(t,[this].concat(c))),o.handleClick=function(t){if(o.props.onClick&&o.props.onClick(t),!t.defaultPrevented&&0===t.button&&!o.props.target&&!f(t)){t.preventDefault();var e=o.context.router.history,n=o.props,r=n.replace,i=n.to;r?e.replace(i):e.push(i)}},r=n,a(o,r)}return u(e,t),e.prototype.render=function(){var t=this.props,e=(t.replace,t.to),n=r(t,["replace","to"]),o=this.context.router.history.createHref("string"==typeof e?{pathname:e}:e);return l.default.createElement("a",c({},n,{onClick:this.handleClick,href:o}))},e}(l.default.Component);p.defaultProps={replace:!1},p.contextTypes={router:s.PropTypes.shape({history:s.PropTypes.shape({push:s.PropTypes.func.isRequired,replace:s.PropTypes.func.isRequired,createHref:s.PropTypes.func.isRequired}).isRequired}).isRequired},e.default=p},function(t,e){"use strict";e.__esModule=!0;e.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),e.addEventListener=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},e.removeEventListener=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)},e.getConfirmation=function(t,e){return e(window.confirm(t))},e.supportsHistory=function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)},e.supportsPopStateOnHashChange=function(){return window.navigator.userAgent.indexOf("Trident")===-1},e.supportsGoWithoutReloadUsingHash=function(){return window.navigator.userAgent.indexOf("Firefox")===-1},e.isExtraneousPopstateEvent=function(t){return void 0===t.state&&navigator.userAgent.indexOf("CriOS")===-1}},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.locationsAreEqual=e.createLocation=void 0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=n(30),a=o(i),u=n(31),c=o(u),s=n(4);e.createLocation=function(t,e,n,o){var i=void 0;return"string"==typeof t?(i=(0,s.parsePath)(t),i.state=e):(i=r({},t),void 0===i.pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==e&&void 0===i.state&&(i.state=e)),i.key=n,o&&(i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,a.default)(i.pathname,o.pathname)):i.pathname=o.pathname),i},e.locationsAreEqual=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&(0,c.default)(t.state,e.state)}},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=n(5),i=o(r),a=function(){var t=null,e=function(e){return(0,i.default)(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},n=function(e,n,o,r){if(null!=t){var a="function"==typeof t?t(e,n):t;"string"==typeof a?"function"==typeof o?o(a,r):((0,i.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),r(!0)):r(a!==!1)}else r(!0)},o=[],r=function(t){var e=!0,n=function(){e&&t.apply(void 0,arguments)};return o.push(n),function(){e=!1,o=o.filter(function(t){return t!==n})}},a=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];o.forEach(function(t){return t.apply(void 0,e)})};return{setPrompt:e,confirmTransitionTo:n,appendListener:r,notifyListeners:a}};e.default=a},function(t,e,n){"use strict";var o=function(t,e,n,o,r,i,a,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,o,r,i,a,u],l=0;c=new Error(e.replace(/%s/g,function(){return s[l++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};t.exports=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},c=n(3),s=o(c),l=n(2),f=o(l),p=n(7),h=o(p),d=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.state={match:o.computeMatch(o.props,o.context.router)},a=n,i(o,a)}return a(e,t),e.prototype.getChildContext=function(){this.context.router;return{router:u({},this.context.router,{route:{location:this.props.location||this.context.router.route.location,match:this.state.match}})}},e.prototype.computeMatch=function(t,e){var n=t.computedMatch,o=t.location,r=t.path,i=t.strict,a=t.exact,u=e.route;if(n)return n;var c=(o||u.location).pathname;return r?(0,h.default)(c,{path:r,strict:i,exact:a}):u.match},e.prototype.componentWillMount=function(){var t=this.props,e=t.component,n=t.render,o=t.children;(0,s.default)(!(e&&n),"You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored"),(0,s.default)(!(e&&o),"You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored"),(0,s.default)(!(n&&o),"You should not use <Route render> and <Route children> in the same route; <Route children> will be ignored")},e.prototype.componentWillReceiveProps=function(t,e){(0,s.default)(!(t.location&&!this.props.location),'<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),(0,s.default)(!(!t.location&&this.props.location),'<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(t,e.router)})},e.prototype.render=function t(){var e=this.state.match,n=this.props,o=n.children,r=n.component,t=n.render,i=this.context.router,a=i.history,u=i.route,c=i.staticContext,s=this.props.location||u.location,l={match:e,location:s,history:a,staticContext:c};return r?e?f.default.createElement(r,l):null:t?e?t(l):null:o?"function"==typeof o?o(l):!Array.isArray(o)||o.length?f.default.Children.only(o):null:null},e}(f.default.Component);d.propTypes={computedMatch:l.PropTypes.object,path:l.PropTypes.string,exact:l.PropTypes.bool,strict:l.PropTypes.bool,component:l.PropTypes.func,render:l.PropTypes.func,children:l.PropTypes.oneOfType([l.PropTypes.func,l.PropTypes.node]),location:l.PropTypes.object},d.contextTypes={router:l.PropTypes.shape({history:l.PropTypes.object.isRequired,route:l.PropTypes.object.isRequired,staticContext:l.PropTypes.object})},d.childContextTypes={router:l.PropTypes.object.isRequired},e.default=d},function(t,e,n){"use strict";var o=function(t,e,n,o,r,i,a,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,o,r,i,a,u],l=0;c=new Error(e.replace(/%s/g,function(){return s[l++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};t.exports=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(2),c=o(u),s=n(28),l=o(s),f=n(1),p=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.history=(0,l.default)(o.props),a=n,i(o,a)}return a(e,t),e.prototype.render=function(){return c.default.createElement(f.Router,{history:this.history,children:this.props.children})},e}(c.default.Component);e.default=p},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(2),c=o(u),s=n(29),l=o(s),f=n(1),p=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.history=(0,l.default)(o.props),a=n,i(o,a)}return a(e,t),e.prototype.render=function(){return c.default.createElement(f.Router,{history:this.history,children:this.props.children})},e}(c.default.Component);e.default=p},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.MemoryRouter}})},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=n(2),c=o(u),s=n(1),l=n(9),f=o(l),p=function(t){var e=t.to,n=t.exact,o=t.strict,u=t.activeClassName,l=t.className,p=t.activeStyle,h=t.style,d=t.isActive,y=r(t,["to","exact","strict","activeClassName","className","activeStyle","style","isActive"]);return c.default.createElement(s.Route,{path:"object"===("undefined"==typeof e?"undefined":a(e))?e.pathname:e,exact:n,strict:o,children:function(t){var n=t.location,o=t.match,r=!!(d?d(o,n):o);return c.default.createElement(f.default,i({to:e,className:r?[u,l].join(" "):l,style:r?i({},h,p):h},y))}})};p.defaultProps={activeClassName:"active"},e.default=p},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.Prompt}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.Redirect}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.Route}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.Router}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.StaticRouter}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.Switch}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.matchPath}})},function(t,e,n){"use strict";e.__esModule=!0;var o=n(1);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o.withRouter}})},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a=n(5),u=o(a),c=n(13),s=o(c),l=n(11),f=n(4),p=n(12),h=o(p),d=n(10),y="popstate",v="hashchange",m=function(){try{return window.history.state||{}}catch(t){return{}}},b=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,s.default)(d.canUseDOM,"Browser history needs a DOM");var e=window.history,n=(0,d.supportsHistory)(),o=!(0,d.supportsPopStateOnHashChange)(),a=t.forceRefresh,c=void 0!==a&&a,p=t.getUserConfirmation,b=void 0===p?d.getConfirmation:p,g=t.keyLength,w=void 0===g?6:g,P=t.basename?(0,f.stripTrailingSlash)((0,f.addLeadingSlash)(t.basename)):"",O=function(t){var e=t||{},n=e.key,o=e.state,r=window.location,a=r.pathname,u=r.search,c=r.hash,s=a+u+c;return P&&(s=(0,f.stripPrefix)(s,P)),i({},(0,f.parsePath)(s),{state:o,key:n})},_=function(){return Math.random().toString(36).substr(2,w)},x=(0,h.default)(),T=function(t){i($,t),$.length=e.length,x.notifyListeners($.location,$.action)},j=function(t){(0,d.isExtraneousPopstateEvent)(t)||M(O(t.state))},R=function(){M(O(m()))},E=!1,M=function(t){if(E)E=!1,T();else{var e="POP";x.confirmTransitionTo(t,e,b,function(n){n?T({action:e,location:t}):S(t)})}},S=function(t){var e=$.location,n=k.indexOf(e.key);n===-1&&(n=0);var o=k.indexOf(t.key);o===-1&&(o=0);var r=n-o;r&&(E=!0,H(r))},C=O(m()),k=[C.key],A=function(t){return P+(0,f.createPath)(t)},L=function(t,o){(0,u.default)(!("object"===("undefined"==typeof t?"undefined":r(t))&&void 0!==t.state&&void 0!==o),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i="PUSH",a=(0,l.createLocation)(t,o,_(),$.location);x.confirmTransitionTo(a,i,b,function(t){if(t){var o=A(a),r=a.key,s=a.state;if(n)if(e.pushState({key:r,state:s},null,o),c)window.location.href=o;else{var l=k.indexOf($.location.key),f=k.slice(0,l===-1?0:l+1);f.push(a.key),k=f,T({action:i,location:a})}else(0,u.default)(void 0===s,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=o}})},q=function(t,o){(0,u.default)(!("object"===("undefined"==typeof t?"undefined":r(t))&&void 0!==t.state&&void 0!==o),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i="REPLACE",a=(0,l.createLocation)(t,o,_(),$.location);x.confirmTransitionTo(a,i,b,function(t){if(t){var o=A(a),r=a.key,s=a.state;if(n)if(e.replaceState({key:r,state:s},null,o),c)window.location.replace(o);else{var l=k.indexOf($.location.key);l!==-1&&(k[l]=a.key),T({action:i,location:a})}else(0,u.default)(void 0===s,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(o)}})},H=function(t){e.go(t)},U=function(){return H(-1)},I=function(){return H(1)},W=0,Y=function(t){W+=t,1===W?((0,d.addEventListener)(window,y,j),o&&(0,d.addEventListener)(window,v,R)):0===W&&((0,d.removeEventListener)(window,y,j),o&&(0,d.removeEventListener)(window,v,R))},B=!1,N=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=x.setPrompt(t);return B||(Y(1),B=!0),function(){return B&&(B=!1,Y(-1)),e()}},D=function(t){var e=x.appendListener(t);return Y(1),function(){Y(-1),e()}},$={length:e.length,action:"POP",location:C,createHref:A,push:L,replace:q,go:H,goBack:U,goForward:I,block:N,listen:D};return $};e.default=b},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=n(5),a=o(i),u=n(13),c=o(u),s=n(11),l=n(4),f=n(12),p=o(f),h=n(10),d="hashchange",y={hashbang:{encodePath:function(t){return"!"===t.charAt(0)?t:"!/"+(0,l.stripLeadingSlash)(t)},decodePath:function(t){return"!"===t.charAt(0)?t.substr(1):t}},noslash:{encodePath:l.stripLeadingSlash,decodePath:l.addLeadingSlash},slash:{encodePath:l.addLeadingSlash,decodePath:l.addLeadingSlash}},v=function(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.substring(e+1)},m=function(t){return window.location.hash=t},b=function(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)},g=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,c.default)(h.canUseDOM,"Hash history needs a DOM");var e=window.history,n=(0,h.supportsGoWithoutReloadUsingHash)(),o=t.getUserConfirmation,i=void 0===o?h.getConfirmation:o,u=t.hashType,f=void 0===u?"slash":u,g=t.basename?(0,l.stripTrailingSlash)((0,l.addLeadingSlash)(t.basename)):"",w=y[f],P=w.encodePath,O=w.decodePath,_=function(){var t=O(v());return g&&(t=(0,l.stripPrefix)(t,g)),(0,l.parsePath)(t)},x=(0,p.default)(),T=function(t){r(K,t),K.length=e.length,x.notifyListeners(K.location,K.action)},j=!1,R=null,E=function(){var t=v(),e=P(t);if(t!==e)b(e);else{var n=_(),o=K.location;if(!j&&(0,s.locationsAreEqual)(o,n))return;if(R===(0,l.createPath)(n))return;R=null,M(n)}},M=function(t){if(j)j=!1,T();else{var e="POP";x.confirmTransitionTo(t,e,i,function(n){n?T({action:e,location:t}):S(t)})}},S=function(t){var e=K.location,n=L.lastIndexOf((0,l.createPath)(e));n===-1&&(n=0);var o=L.lastIndexOf((0,l.createPath)(t));o===-1&&(o=0);var r=n-o;r&&(j=!0,I(r))},C=v(),k=P(C);C!==k&&b(k);var A=_(),L=[(0,l.createPath)(A)],q=function(t){return"#"+P(g+(0,l.createPath)(t))},H=function(t,e){(0,a.default)(void 0===e,"Hash history cannot push state; it is ignored");var n="PUSH",o=(0,s.createLocation)(t,void 0,void 0,K.location);x.confirmTransitionTo(o,n,i,function(t){if(t){var e=(0,l.createPath)(o),r=P(g+e),i=v()!==r;if(i){R=e,m(r);var u=L.lastIndexOf((0,l.createPath)(K.location)),c=L.slice(0,u===-1?0:u+1);c.push(e),L=c,T({action:n,location:o})}else(0,a.default)(!1,"Hash history cannot PUSH the same path; a new entry will not be added to the history stack"),T()}})},U=function(t,e){(0,a.default)(void 0===e,"Hash history cannot replace state; it is ignored");var n="REPLACE",o=(0,s.createLocation)(t,void 0,void 0,K.location);x.confirmTransitionTo(o,n,i,function(t){if(t){var e=(0,l.createPath)(o),r=P(g+e),i=v()!==r;i&&(R=e,b(r));var a=L.indexOf((0,l.createPath)(K.location));a!==-1&&(L[a]=e),T({action:n,location:o})}})},I=function(t){(0,a.default)(n,"Hash history go(n) causes a full page reload in this browser"),e.go(t)},W=function(){return I(-1)},Y=function(){return I(1)},B=0,N=function(t){B+=t,1===B?(0,h.addEventListener)(window,d,E):0===B&&(0,h.removeEventListener)(window,d,E)},D=!1,$=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=x.setPrompt(t);return D||(N(1),D=!0),function(){return D&&(D=!1,N(-1)),e()}},F=function(t){var e=x.appendListener(t);return N(1),function(){N(-1),e()}},K={length:e.length,action:"POP",location:A,createHref:q,push:H,replace:U,go:I,goBack:W,goForward:Y,block:$,listen:F};return K};e.default=g},function(t,e){"use strict";var n=function(t){return"/"===t.charAt(0)},o=function(t,e){for(var n=e,o=n+1,r=t.length;o<r;n+=1,o+=1)t[n]=t[o];t.pop()},r=function(t){var e=arguments.length<=1||void 0===arguments[1]?"":arguments[1],r=t&&t.split("/")||[],i=e&&e.split("/")||[],a=t&&n(t),u=e&&n(e),c=a||u;if(t&&n(t)?i=r:r.length&&(i.pop(),i=i.concat(r)),!i.length)return"/";var s=void 0;if(i.length){var l=i[i.length-1];s="."===l||".."===l||""===l}else s=!1;for(var f=0,p=i.length;p>=0;p--){var h=i[p];"."===h?o(i,p):".."===h?(o(i,p),f++):f&&(o(i,p),f--)}if(!c)for(;f--;f)i.unshift("..");!c||""===i[0]||i[0]&&n(i[0])||i.unshift("");var d=i.join("/");return s&&"/"!==d.substr(-1)&&(d+="/"),d};t.exports=r},function(t,e){"use strict";e.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function t(e,o){if(e===o)return!0;if(null==e||null==o)return!1;if(Array.isArray(e))return!(!Array.isArray(o)||e.length!==o.length)&&e.every(function(e,n){return t(e,o[n])});var r="undefined"==typeof e?"undefined":n(e),i="undefined"==typeof o?"undefined":n(o);if(r!==i)return!1;if("object"===r){var a=e.valueOf(),u=o.valueOf();if(a!==e||u!==o)return t(a,u);var c=Object.keys(e),s=Object.keys(o);return c.length===s.length&&c.every(function(n){return t(e[n],o[n])})}return!1};e.default=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(2),c=o(u),s=n(39),l=o(s),f=n(6),p=o(f),h=function(t){function e(){var n,o,a;r(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=i(this,t.call.apply(t,[this].concat(c))),o.history=(0,l.default)(o.props),a=n,i(o,a)}return a(e,t),e.prototype.render=function(){return c.default.createElement(p.default,{history:this.history,children:this.props.children})},e}(c.default.Component);h.propTypes={initialEntries:u.PropTypes.array,initialIndex:u.PropTypes.number,getUserConfirmation:u.PropTypes.func,keyLength:u.PropTypes.number,children:u.PropTypes.node},e.default=h},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(2),c=o(u),s=function(t){function e(){return r(this,e),i(this,t.apply(this,arguments))}return a(e,t),e.prototype.enable=function(t){this.unblock&&this.unblock(),this.unblock=this.context.router.history.block(t)},e.prototype.disable=function(){this.unblock&&(this.unblock(),this.unblock=null)},e.prototype.componentWillMount=function(){this.props.when&&this.enable(this.props.message)},e.prototype.componentWillReceiveProps=function(t){t.when?this.props.when&&this.props.message===t.message||this.enable(t.message):this.disable()},e.prototype.componentWillUnmount=function(){this.disable()},e.prototype.render=function(){return null},e}(c.default.Component);s.propTypes={when:u.PropTypes.bool,message:u.PropTypes.oneOfType([u.PropTypes.func,u.PropTypes.string]).isRequired},s.defaultProps={when:!0},s.contextTypes={router:u.PropTypes.shape({history:u.PropTypes.shape({block:u.PropTypes.func.isRequired}).isRequired}).isRequired},e.default=s},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
2
|
+
return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(2),c=o(u),s=function(t){function e(){return r(this,e),i(this,t.apply(this,arguments))}return a(e,t),e.prototype.isStatic=function(){return this.context.router&&this.context.router.staticContext},e.prototype.componentWillMount=function(){this.isStatic()&&this.perform()},e.prototype.componentDidMount=function(){this.isStatic()||this.perform()},e.prototype.perform=function(){var t=this.context.router.history,e=this.props,n=e.push,o=e.to;n?t.push(o):t.replace(o)},e.prototype.render=function(){return null},e}(c.default.Component);s.propTypes={push:u.PropTypes.bool,from:u.PropTypes.string,to:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.object])},s.defaultProps={push:!1},s.contextTypes={router:u.PropTypes.shape({history:u.PropTypes.shape({push:u.PropTypes.func.isRequired,replace:u.PropTypes.func.isRequired}).isRequired,staticContext:u.PropTypes.object}).isRequired},e.default=s},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},s=n(15),l=o(s),f=n(2),p=o(f),h=n(8),d=n(6),y=o(d),v=function(t){var e=t.pathname,n=void 0===e?"/":e,o=t.search,r=void 0===o?"":o,i=t.hash,a=void 0===i?"":i;return{pathname:n,search:"?"===r?"":r,hash:"#"===a?"":a}},m=function(t,e){return t?c({},e,{pathname:(0,h.addLeadingSlash)(t)+e.pathname}):e},b=function(t,e){if(!t)return e;var n=(0,h.addLeadingSlash)(t);return 0!==e.pathname.indexOf(n)?e:c({},e,{pathname:e.pathname.substr(n.length)})},g=function(t){return"string"==typeof t?(0,h.parsePath)(t):v(t)},w=function(t){return"string"==typeof t?t:(0,h.createPath)(t)},P=function(t){return function(){(0,l.default)(!1,"You cannot %s with <StaticRouter>",t)}},O=function(){},_=function(t){function e(){var n,o,r;i(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=o=a(this,t.call.apply(t,[this].concat(c))),o.createHref=function(t){return(0,h.addLeadingSlash)(o.props.basename+w(t))},o.handlePush=function(t){var e=o.props,n=e.basename,r=e.context;r.action="PUSH",r.location=m(n,g(t)),r.url=w(r.location)},o.handleReplace=function(t){var e=o.props,n=e.basename,r=e.context;r.action="REPLACE",r.location=m(n,g(t)),r.url=w(r.location)},o.handleListen=function(){return O},o.handleBlock=function(){return O},r=n,a(o,r)}return u(e,t),e.prototype.getChildContext=function(){return{router:{staticContext:this.props.context}}},e.prototype.render=function(){var t=this.props,e=t.basename,n=(t.context,t.location),o=r(t,["basename","context","location"]),i={createHref:this.createHref,action:"POP",location:b(e,g(n)),push:this.handlePush,replace:this.handleReplace,go:P("go"),goBack:P("goBack"),goForward:P("goForward"),listen:this.handleListen,block:this.handleBlock};return p.default.createElement(y.default,c({},o,{history:i}))},e}(p.default.Component);_.propTypes={basename:f.PropTypes.string,context:f.PropTypes.object.isRequired,location:f.PropTypes.oneOfType([f.PropTypes.string,f.PropTypes.object])},_.defaultProps={basename:"",location:"/"},_.childContextTypes={router:f.PropTypes.object.isRequired},e.default=_},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(2),c=o(u),s=n(3),l=o(s),f=n(7),p=o(f),h=function(t){function e(){return r(this,e),i(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillReceiveProps=function(t){(0,l.default)(!(t.location&&!this.props.location),'<Switch> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),(0,l.default)(!(!t.location&&this.props.location),'<Switch> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},e.prototype.render=function(){var t=this.context.router.route,e=this.props.children,n=this.props.location||t.location,o=void 0,r=void 0;return c.default.Children.forEach(e,function(e){var i=e.props,a=i.path,u=i.exact,c=i.strict,s=i.from,l=a||s;null==o&&(r=e,o=l?(0,p.default)(n.pathname,{path:l,exact:u,strict:c}):t.match)}),o?c.default.cloneElement(r,{location:n,computedMatch:o}):null},e}(c.default.Component);h.contextTypes={router:u.PropTypes.shape({route:u.PropTypes.object.isRequired}).isRequired},h.propTypes={children:u.PropTypes.node,location:u.PropTypes.object},e.default=h},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=n(2),a=o(i),u=n(14),c=o(u),s=function(t){var e=function(e){return a.default.createElement(c.default,{render:function(n){return a.default.createElement(t,r({},e,n))}})};return e.displayName="withRouter("+(t.displayName||t.name)+")",e};e.default=s},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.locationsAreEqual=e.createLocation=void 0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=n(43),a=o(i),u=n(44),c=o(u),s=n(8);e.createLocation=function(t,e,n,o){var i=void 0;return"string"==typeof t?(i=(0,s.parsePath)(t),i.state=e):(i=r({},t),void 0===i.pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==e&&void 0===i.state&&(i.state=e)),i.key=n,o&&(i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,a.default)(i.pathname,o.pathname)):i.pathname=o.pathname),i},e.locationsAreEqual=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&(0,c.default)(t.state,e.state)}},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a=n(3),u=o(a),c=n(8),s=n(38),l=n(40),f=o(l),p=function(t,e,n){return Math.min(Math.max(t,e),n)},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.getUserConfirmation,n=t.initialEntries,o=void 0===n?["/"]:n,a=t.initialIndex,l=void 0===a?0:a,h=t.keyLength,d=void 0===h?6:h,y=(0,f.default)(),v=function(t){i(M,t),M.length=M.entries.length,y.notifyListeners(M.location,M.action)},m=function(){return Math.random().toString(36).substr(2,d)},b=p(l,0,o.length-1),g=o.map(function(t){return"string"==typeof t?(0,s.createLocation)(t,void 0,m()):(0,s.createLocation)(t,void 0,t.key||m())}),w=c.createPath,P=function(t,n){(0,u.default)(!("object"===("undefined"==typeof t?"undefined":r(t))&&void 0!==t.state&&void 0!==n),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var o="PUSH",i=(0,s.createLocation)(t,n,m(),M.location);y.confirmTransitionTo(i,o,e,function(t){if(t){var e=M.index,n=e+1,r=M.entries.slice(0);r.length>n?r.splice(n,r.length-n,i):r.push(i),v({action:o,location:i,index:n,entries:r})}})},O=function(t,n){(0,u.default)(!("object"===("undefined"==typeof t?"undefined":r(t))&&void 0!==t.state&&void 0!==n),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var o="REPLACE",i=(0,s.createLocation)(t,n,m(),M.location);y.confirmTransitionTo(i,o,e,function(t){t&&(M.entries[M.index]=i,v({action:o,location:i}))})},_=function(t){var n=p(M.index+t,0,M.entries.length-1),o="POP",r=M.entries[n];y.confirmTransitionTo(r,o,e,function(t){t?v({action:o,location:r,index:n}):v()})},x=function(){return _(-1)},T=function(){return _(1)},j=function(t){var e=M.index+t;return e>=0&&e<M.entries.length},R=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return y.setPrompt(t)},E=function(t){return y.appendListener(t)},M={length:g.length,action:"POP",location:g[b],index:b,entries:g,createHref:w,push:P,replace:O,go:_,goBack:x,goForward:T,canGo:j,block:R,listen:E};return M};e.default=h},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=n(3),i=o(r),a=function(){var t=null,e=function(e){return(0,i.default)(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},n=function(e,n,o,r){if(null!=t){var a="function"==typeof t?t(e,n):t;"string"==typeof a?"function"==typeof o?o(a,r):((0,i.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),r(!0)):r(a!==!1)}else r(!0)},o=[],r=function(t){var e=!0,n=function(){e&&t.apply(void 0,arguments)};return o.push(n),function(){e=!1,o=o.filter(function(t){return t!==n})}},a=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];o.forEach(function(t){return t.apply(void 0,e)})};return{setPrompt:e,confirmTransitionTo:n,appendListener:r,notifyListeners:a}};e.default=a},function(t,e,n){function o(t,e){for(var n,o=[],r=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=b.exec(t));){var l=n[0],f=n[1],p=n.index;if(a+=t.slice(i,p),i=p+l.length,f)a+=f[1];else{var h=t[i],d=n[2],y=n[3],v=n[4],m=n[5],g=n[6],w=n[7];a&&(o.push(a),a="");var P=null!=d&&null!=h&&h!==d,O="+"===g||"*"===g,_="?"===g||"*"===g,x=n[2]||u,T=v||m;o.push({name:y||r++,prefix:d||"",delimiter:x,optional:_,repeat:O,partial:P,asterisk:!!w,pattern:T?s(T):w?".*":"[^"+c(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&o.push(a),o}function r(t,e){return u(o(t,e))}function i(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function a(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function u(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,o){for(var r="",u=n||{},c=o||{},s=c.pretty?i:encodeURIComponent,l=0;l<t.length;l++){var f=t[l];if("string"!=typeof f){var p,h=u[f.name];if(null==h){if(f.optional){f.partial&&(r+=f.prefix);continue}throw new TypeError('Expected "'+f.name+'" to be defined')}if(m(h)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but received `'+JSON.stringify(h)+"`");if(0===h.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var d=0;d<h.length;d++){if(p=s(h[d]),!e[l].test(p))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'", but received `'+JSON.stringify(p)+"`");r+=(0===d?f.prefix:f.delimiter)+p}}else{if(p=f.asterisk?a(h):s(h),!e[l].test(p))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but received "'+p+'"');r+=f.prefix+p}}else r+=f}return r}}function c(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function s(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function l(t,e){return t.keys=e,t}function f(t){return t.sensitive?"":"i"}function p(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var o=0;o<n.length;o++)e.push({name:o,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return l(t,e)}function h(t,e,n){for(var o=[],r=0;r<t.length;r++)o.push(v(t[r],e,n).source);var i=new RegExp("(?:"+o.join("|")+")",f(n));return l(i,e)}function d(t,e,n){return y(o(t,n),e,n)}function y(t,e,n){m(e)||(n=e||n,e=[]),n=n||{};for(var o=n.strict,r=n.end!==!1,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=c(u);else{var s=c(u.prefix),p="(?:"+u.pattern+")";e.push(u),u.repeat&&(p+="(?:"+s+p+")*"),p=u.optional?u.partial?s+"("+p+")?":"(?:"+s+"("+p+"))?":s+"("+p+")",i+=p}}var h=c(n.delimiter||"/"),d=i.slice(-h.length)===h;return o||(i=(d?i.slice(0,-h.length):i)+"(?:"+h+"(?=$))?"),i+=r?"$":o&&d?"":"(?="+h+"|$)",l(new RegExp("^"+i,f(n)),e)}function v(t,e,n){return m(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?p(t,e):m(t)?h(t,e,n):d(t,e,n)}var m=n(42);t.exports=v,t.exports.parse=o,t.exports.compile=r,t.exports.tokensToFunction=u,t.exports.tokensToRegExp=y;var b=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g")},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e){"use strict";var n=function(t){return"/"===t.charAt(0)},o=function(t,e){for(var n=e,o=n+1,r=t.length;o<r;n+=1,o+=1)t[n]=t[o];t.pop()},r=function(t){var e=arguments.length<=1||void 0===arguments[1]?"":arguments[1],r=t&&t.split("/")||[],i=e&&e.split("/")||[],a=t&&n(t),u=e&&n(e),c=a||u;if(t&&n(t)?i=r:r.length&&(i.pop(),i=i.concat(r)),!i.length)return"/";var s=void 0;if(i.length){var l=i[i.length-1];s="."===l||".."===l||""===l}else s=!1;for(var f=0,p=i.length;p>=0;p--){var h=i[p];"."===h?o(i,p):".."===h?(o(i,p),f++):f&&(o(i,p),f--)}if(!c)for(;f--;f)i.unshift("..");!c||""===i[0]||i[0]&&n(i[0])||i.unshift("");var d=i.join("/");return s&&"/"!==d.substr(-1)&&(d+="/"),d};t.exports=r},function(t,e){"use strict";e.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function t(e,o){if(e===o)return!0;if(null==e||null==o)return!1;if(Array.isArray(e))return!(!Array.isArray(o)||e.length!==o.length)&&e.every(function(e,n){return t(e,o[n])});var r="undefined"==typeof e?"undefined":n(e),i="undefined"==typeof o?"undefined":n(o);if(r!==i)return!1;if("object"===r){var a=e.valueOf(),u=o.valueOf();if(a!==e||u!==o)return t(a,u);var c=Object.keys(e),s=Object.keys(o);return c.length===s.length&&c.every(function(n){return t(e[n],o[n])})}return!1};e.default=o}])});
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactRouter=e(require("react")):t.ReactRouter=e(t.React)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.withRouter=e.matchPath=e.Switch=e.StaticRouter=e.Router=e.Route=e.Redirect=e.Prompt=e.MemoryRouter=void 0;var o=n(8),i=r(o),a=n(9),u=r(a),c=n(10),s=r(c),p=n(6),l=r(p),f=n(3),h=r(f),d=n(11),y=r(d),m=n(12),v=r(m),b=n(4),g=r(b),x=n(13),w=r(x);e.MemoryRouter=i.default,e.Prompt=u.default,e.Redirect=s.default,e.Route=l.default,e.Router=h.default,e.StaticRouter=y.default,e.Switch=v.default,e.matchPath=g.default,e.withRouter=w.default},function(e,n){e.exports=t},function(t,e,n){"use strict";var r=function(){};t.exports=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=n(2),s=(r(c),n(7)),p=r(s),l=n(1),f=r(l),h=function(t){function e(){var n,r,a;o(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=r=i(this,t.call.apply(t,[this].concat(c))),r.state={match:r.computeMatch(r.props.history.location.pathname)},a=n,i(r,a)}return a(e,t),e.prototype.getChildContext=function(){return{router:u({},this.context.router,{history:this.props.history,route:{location:this.props.history.location,match:this.state.match}})}},e.prototype.computeMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}},e.prototype.componentWillMount=function(){var t=this,e=this.props,n=e.children,r=e.history;null!=n&&1!==f.default.Children.count(n)?(0,p.default)(!1):void 0,this.unlisten=r.listen(function(){t.setState({match:t.computeMatch(r.location.pathname)})})},e.prototype.componentWillReceiveProps=function(t){},e.prototype.componentWillUnmount=function(){this.unlisten()},e.prototype.render=function(){var t=this.props.children;return t?f.default.Children.only(t):null},e}(f.default.Component);h.contextTypes={router:l.PropTypes.object},h.childContextTypes={router:l.PropTypes.object.isRequired},e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(17),i=r(o),a={},u=1e4,c=0,s=function(t,e){var n=""+e.end+e.strict,r=a[n]||(a[n]={});if(r[t])return r[t];var o=[],s=(0,i.default)(t,o,e),p={re:s,keys:o};return c<u&&(r[t]=p,c++),p},p=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={path:e});var n=e,r=n.path,o=void 0===r?"/":r,i=n.exact,a=void 0!==i&&i,u=n.strict,c=void 0!==u&&u,p=s(o,{end:a,strict:c}),l=p.re,f=p.keys,h=l.exec(t);if(!h)return null;var d=h[0],y=h.slice(1),m=t===d;return a&&!m?null:{path:o,url:"/"===o&&""===d?"/":d,isExact:m,params:f.reduce(function(t,e,n){return t[e.name]=y[n],t},{})}};e.default=p},function(t,e){"use strict";e.__esModule=!0;e.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},e.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t},e.stripPrefix=function(t,e){return 0===t.indexOf(e)?t.substr(e.length):t},e.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},e.parsePath=function(t){var e=t||"/",n="",r="";e=decodeURI(e);var o=e.indexOf("#");o!==-1&&(r=e.substr(o),e=e.substr(0,o));var i=e.indexOf("?");return i!==-1&&(n=e.substr(i),e=e.substr(0,i)),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}},e.createPath=function(t){var e=t.pathname,n=t.search,r=t.hash,o=e||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),encodeURI(o)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=n(2),s=(r(c),n(1)),p=r(s),l=n(4),f=r(l),h=function(t){function e(){var n,r,a;o(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=r=i(this,t.call.apply(t,[this].concat(c))),r.state={match:r.computeMatch(r.props,r.context.router)},a=n,i(r,a)}return a(e,t),e.prototype.getChildContext=function(){this.context.router;return{router:u({},this.context.router,{route:{location:this.props.location||this.context.router.route.location,match:this.state.match}})}},e.prototype.computeMatch=function(t,e){var n=t.computedMatch,r=t.location,o=t.path,i=t.strict,a=t.exact,u=e.route;if(n)return n;var c=(r||u.location).pathname;return o?(0,f.default)(c,{path:o,strict:i,exact:a}):u.match},e.prototype.componentWillMount=function(){var t=this.props;t.component,t.render,t.children},e.prototype.componentWillReceiveProps=function(t,e){this.setState({match:this.computeMatch(t,e.router)})},e.prototype.render=function t(){var e=this.state.match,n=this.props,r=n.children,o=n.component,t=n.render,i=this.context.router,a=i.history,u=i.route,c=i.staticContext,s=this.props.location||u.location,l={match:e,location:s,history:a,staticContext:c};return o?e?p.default.createElement(o,l):null:t?e?t(l):null:r?"function"==typeof r?r(l):!Array.isArray(r)||r.length?p.default.Children.only(r):null:null},e}(p.default.Component);h.contextTypes={router:s.PropTypes.shape({history:s.PropTypes.object.isRequired,route:s.PropTypes.object.isRequired,staticContext:s.PropTypes.object})},h.childContextTypes={router:s.PropTypes.object.isRequired},e.default=h},function(t,e,n){"use strict";var r=function(t,e,n,r,o,i,a,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,i,a,u],p=0;c=new Error(e.replace(/%s/g,function(){return s[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};t.exports=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(1),c=r(u),s=n(15),p=r(s),l=n(3),f=r(l),h=function(t){function e(){var n,r,a;o(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=r=i(this,t.call.apply(t,[this].concat(c))),r.history=(0,p.default)(r.props),a=n,i(r,a)}return a(e,t),e.prototype.render=function(){return c.default.createElement(f.default,{history:this.history,children:this.props.children})},e}(c.default.Component);e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(1),c=r(u),s=function(t){function e(){return o(this,e),i(this,t.apply(this,arguments))}return a(e,t),e.prototype.enable=function(t){this.unblock&&this.unblock(),this.unblock=this.context.router.history.block(t)},e.prototype.disable=function(){this.unblock&&(this.unblock(),this.unblock=null)},e.prototype.componentWillMount=function(){this.props.when&&this.enable(this.props.message)},e.prototype.componentWillReceiveProps=function(t){t.when?this.props.when&&this.props.message===t.message||this.enable(t.message):this.disable()},e.prototype.componentWillUnmount=function(){this.disable()},e.prototype.render=function(){return null},e}(c.default.Component);s.defaultProps={when:!0},s.contextTypes={router:u.PropTypes.shape({history:u.PropTypes.shape({block:u.PropTypes.func.isRequired}).isRequired}).isRequired},e.default=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(1),c=r(u),s=function(t){function e(){return o(this,e),i(this,t.apply(this,arguments))}return a(e,t),e.prototype.isStatic=function(){return this.context.router&&this.context.router.staticContext},e.prototype.componentWillMount=function(){this.isStatic()&&this.perform()},e.prototype.componentDidMount=function(){this.isStatic()||this.perform()},e.prototype.perform=function(){var t=this.context.router.history,e=this.props,n=e.push,r=e.to;n?t.push(r):t.replace(r)},e.prototype.render=function(){return null},e}(c.default.Component);s.defaultProps={push:!1},s.contextTypes={router:u.PropTypes.shape({history:u.PropTypes.shape({push:u.PropTypes.func.isRequired,replace:u.PropTypes.func.isRequired}).isRequired,staticContext:u.PropTypes.object}).isRequired},e.default=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=n(7),p=r(s),l=n(1),f=r(l),h=n(5),d=n(3),y=r(d),m=function(t){var e=t.pathname,n=void 0===e?"/":e,r=t.search,o=void 0===r?"":r,i=t.hash,a=void 0===i?"":i;return{pathname:n,search:"?"===o?"":o,hash:"#"===a?"":a}},v=function(t,e){return t?c({},e,{pathname:(0,h.addLeadingSlash)(t)+e.pathname}):e},b=function(t,e){if(!t)return e;var n=(0,h.addLeadingSlash)(t);return 0!==e.pathname.indexOf(n)?e:c({},e,{pathname:e.pathname.substr(n.length)})},g=function(t){return"string"==typeof t?(0,h.parsePath)(t):m(t)},x=function(t){return"string"==typeof t?t:(0,h.createPath)(t)},w=function(t){return function(){(0,p.default)(!1)}},_=function(){},P=function(t){function e(){var n,r,o;i(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=r=a(this,t.call.apply(t,[this].concat(c))),r.createHref=function(t){return(0,h.addLeadingSlash)(r.props.basename+x(t))},r.handlePush=function(t){var e=r.props,n=e.basename,o=e.context;o.action="PUSH",o.location=v(n,g(t)),o.url=x(o.location)},r.handleReplace=function(t){var e=r.props,n=e.basename,o=e.context;o.action="REPLACE",o.location=v(n,g(t)),o.url=x(o.location)},r.handleListen=function(){return _},r.handleBlock=function(){return _},o=n,a(r,o)}return u(e,t),e.prototype.getChildContext=function(){return{router:{staticContext:this.props.context}}},e.prototype.render=function(){var t=this.props,e=t.basename,n=(t.context,t.location),r=o(t,["basename","context","location"]),i={createHref:this.createHref,action:"POP",location:b(e,g(n)),push:this.handlePush,replace:this.handleReplace,go:w("go"),goBack:w("goBack"),goForward:w("goForward"),listen:this.handleListen,block:this.handleBlock};return f.default.createElement(y.default,c({},r,{history:i}))},e}(f.default.Component);P.defaultProps={basename:"",location:"/"},P.childContextTypes={router:l.PropTypes.object.isRequired},e.default=P},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=n(1),c=r(u),s=n(2),p=(r(s),n(4)),l=r(p),f=function(t){function e(){return o(this,e),i(this,t.apply(this,arguments))}return a(e,t),e.prototype.componentWillReceiveProps=function(t){},e.prototype.render=function(){var t=this.context.router.route,e=this.props.children,n=this.props.location||t.location,r=void 0,o=void 0;return c.default.Children.forEach(e,function(e){var i=e.props,a=i.path,u=i.exact,c=i.strict,s=i.from,p=a||s;null==r&&(o=e,r=p?(0,l.default)(n.pathname,{path:p,exact:u,strict:c}):t.match)}),r?c.default.cloneElement(o,{location:n,computedMatch:r}):null},e}(c.default.Component);f.contextTypes={router:u.PropTypes.shape({route:u.PropTypes.object.isRequired}).isRequired},e.default=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=n(1),a=r(i),u=n(6),c=r(u),s=function(t){var e=function(e){return a.default.createElement(c.default,{render:function(n){return a.default.createElement(t,o({},e,n))}})};return e.displayName="withRouter("+(t.displayName||t.name)+")",e};e.default=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.locationsAreEqual=e.createLocation=void 0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=n(19),a=r(i),u=n(20),c=r(u),s=n(5);e.createLocation=function(t,e,n,r){var i=void 0;return"string"==typeof t?(i=(0,s.parsePath)(t),i.state=e):(i=o({},t),void 0===i.pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==e&&void 0===i.state&&(i.state=e)),i.key=n,r&&(i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=(0,a.default)(i.pathname,r.pathname)):i.pathname=r.pathname),i},e.locationsAreEqual=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&(0,c.default)(t.state,e.state)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=n(2),u=r(a),c=n(5),s=n(14),p=n(16),l=r(p),f=function(t,e,n){return Math.min(Math.max(t,e),n)},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.getUserConfirmation,n=t.initialEntries,r=void 0===n?["/"]:n,a=t.initialIndex,p=void 0===a?0:a,h=t.keyLength,d=void 0===h?6:h,y=(0,l.default)(),m=function(t){i(M,t),M.length=M.entries.length,y.notifyListeners(M.location,M.action)},v=function(){return Math.random().toString(36).substr(2,d)},b=f(p,0,r.length-1),g=r.map(function(t){return"string"==typeof t?(0,s.createLocation)(t,void 0,v()):(0,s.createLocation)(t,void 0,t.key||v())}),x=c.createPath,w=function(t,n){(0,u.default)(!("object"===("undefined"==typeof t?"undefined":o(t))&&void 0!==t.state&&void 0!==n),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var r="PUSH",i=(0,s.createLocation)(t,n,v(),M.location);y.confirmTransitionTo(i,r,e,function(t){if(t){var e=M.index,n=e+1,o=M.entries.slice(0);o.length>n?o.splice(n,o.length-n,i):o.push(i),m({action:r,location:i,index:n,entries:o})}})},_=function(t,n){(0,u.default)(!("object"===("undefined"==typeof t?"undefined":o(t))&&void 0!==t.state&&void 0!==n),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var r="REPLACE",i=(0,s.createLocation)(t,n,v(),M.location);y.confirmTransitionTo(i,r,e,function(t){t&&(M.entries[M.index]=i,m({action:r,location:i}))})},P=function(t){var n=f(M.index+t,0,M.entries.length-1),r="POP",o=M.entries[n];y.confirmTransitionTo(o,r,e,function(t){t?m({action:r,location:o,index:n}):m()})},O=function(){return P(-1)},j=function(){return P(1)},R=function(t){var e=M.index+t;return e>=0&&e<M.entries.length},T=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return y.setPrompt(t)},E=function(t){return y.appendListener(t)},M={length:g.length,action:"POP",location:g[b],index:b,entries:g,createHref:x,push:w,replace:_,go:P,goBack:O,goForward:j,canGo:R,block:T,listen:E};return M};e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(2),i=r(o),a=function(){var t=null,e=function(e){return(0,i.default)(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},n=function(e,n,r,o){if(null!=t){var a="function"==typeof t?t(e,n):t;"string"==typeof a?"function"==typeof r?r(a,o):((0,i.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),o(!0)):o(a!==!1)}else o(!0)},r=[],o=function(t){var e=!0,n=function(){e&&t.apply(void 0,arguments)};return r.push(n),function(){e=!1,r=r.filter(function(t){return t!==n})}},a=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.forEach(function(t){return t.apply(void 0,e)})};return{setPrompt:e,confirmTransitionTo:n,appendListener:o,notifyListeners:a}};e.default=a},function(t,e,n){function r(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=b.exec(t));){var p=n[0],l=n[1],f=n.index;if(a+=t.slice(i,f),i=f+p.length,l)a+=l[1];else{var h=t[i],d=n[2],y=n[3],m=n[4],v=n[5],g=n[6],x=n[7];a&&(r.push(a),a="");var w=null!=d&&null!=h&&h!==d,_="+"===g||"*"===g,P="?"===g||"*"===g,O=n[2]||u,j=m||v;r.push({name:y||o++,prefix:d||"",delimiter:O,optional:P,repeat:_,partial:w,asterisk:!!x,pattern:j?s(j):x?".*":"[^"+c(O)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function o(t,e){return u(r(t,e))}function i(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function a(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function u(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",u=n||{},c=r||{},s=c.pretty?i:encodeURIComponent,p=0;p<t.length;p++){var l=t[p];if("string"!=typeof l){var f,h=u[l.name];if(null==h){if(l.optional){l.partial&&(o+=l.prefix);continue}throw new TypeError('Expected "'+l.name+'" to be defined')}if(v(h)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but received `'+JSON.stringify(h)+"`");if(0===h.length){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var d=0;d<h.length;d++){if(f=s(h[d]),!e[p].test(f))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'", but received `'+JSON.stringify(f)+"`");o+=(0===d?l.prefix:l.delimiter)+f}}else{if(f=l.asterisk?a(h):s(h),!e[p].test(f))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but received "'+f+'"');o+=l.prefix+f}}else o+=l}return o}}function c(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function s(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function p(t,e){return t.keys=e,t}function l(t){return t.sensitive?"":"i"}function f(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return p(t,e)}function h(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(m(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",l(n));return p(i,e)}function d(t,e,n){return y(r(t,n),e,n)}function y(t,e,n){v(e)||(n=e||n,e=[]),n=n||{};for(var r=n.strict,o=n.end!==!1,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=c(u);else{var s=c(u.prefix),f="(?:"+u.pattern+")";e.push(u),u.repeat&&(f+="(?:"+s+f+")*"),f=u.optional?u.partial?s+"("+f+")?":"(?:"+s+"("+f+"))?":s+"("+f+")",i+=f}}var h=c(n.delimiter||"/"),d=i.slice(-h.length)===h;return r||(i=(d?i.slice(0,-h.length):i)+"(?:"+h+"(?=$))?"),i+=o?"$":r&&d?"":"(?="+h+"|$)",p(new RegExp("^"+i,l(n)),e)}function m(t,e,n){return v(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?f(t,e):v(t)?h(t,e,n):d(t,e,n)}var v=n(18);t.exports=m,t.exports.parse=r,t.exports.compile=o,t.exports.tokensToFunction=u,t.exports.tokensToRegExp=y;var b=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g")},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e){"use strict";var n=function(t){return"/"===t.charAt(0)},r=function(t,e){for(var n=e,r=n+1,o=t.length;r<o;n+=1,r+=1)t[n]=t[r];t.pop()},o=function(t){var e=arguments.length<=1||void 0===arguments[1]?"":arguments[1],o=t&&t.split("/")||[],i=e&&e.split("/")||[],a=t&&n(t),u=e&&n(e),c=a||u;if(t&&n(t)?i=o:o.length&&(i.pop(),i=i.concat(o)),!i.length)return"/";var s=void 0;if(i.length){var p=i[i.length-1];s="."===p||".."===p||""===p}else s=!1;for(var l=0,f=i.length;f>=0;f--){var h=i[f];"."===h?r(i,f):".."===h?(r(i,f),l++):l&&(r(i,f),l--)}if(!c)for(;l--;l)i.unshift("..");!c||""===i[0]||i[0]&&n(i[0])||i.unshift("");var d=i.join("/");return s&&"/"!==d.substr(-1)&&(d+="/"),d};t.exports=o},function(t,e){"use strict";e.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function t(e,r){if(e===r)return!0;if(null==e||null==r)return!1;if(Array.isArray(e))return!(!Array.isArray(r)||e.length!==r.length)&&e.every(function(e,n){return t(e,r[n])});var o="undefined"==typeof e?"undefined":n(e),i="undefined"==typeof r?"undefined":n(r);if(o!==i)return!1;if("object"===o){var a=e.valueOf(),u=r.valueOf();if(a!==e||u!==r)return t(a,u);var c=Object.keys(e),s=Object.keys(r);return c.length===s.length&&c.every(function(n){return t(e[n],r[n])})}return!1};e.default=r}])});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam George
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hyper-component
|
@@ -126,30 +126,30 @@ dependencies:
|
|
126
126
|
name: rails
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: react-rails
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - "<"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.10.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.10.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: opal-rails
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,14 +196,14 @@ dependencies:
|
|
196
196
|
name: therubyracer
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: 0.12.2
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 0.12.2
|
209
209
|
- !ruby/object:Gem::Dependency
|
@@ -483,18 +483,31 @@ files:
|
|
483
483
|
- README.md
|
484
484
|
- Rakefile
|
485
485
|
- lib/hyper-router.rb
|
486
|
+
- lib/hyper-router/class_methods.rb
|
487
|
+
- lib/hyper-router/component_methods.rb
|
488
|
+
- lib/hyper-router/history.rb
|
489
|
+
- lib/hyper-router/location.rb
|
490
|
+
- lib/hyper-router/match.rb
|
486
491
|
- lib/hyper-router/react-router-source.rb
|
487
|
-
- lib/
|
492
|
+
- lib/hyper-router/version.rb
|
493
|
+
- lib/hyperloop/router.rb
|
494
|
+
- lib/hyperloop/router/base.rb
|
495
|
+
- lib/hyperloop/router/base/class_methods.rb
|
496
|
+
- lib/hyperloop/router/browser.rb
|
497
|
+
- lib/hyperloop/router/browser/class_methods.rb
|
498
|
+
- lib/hyperloop/router/component.rb
|
499
|
+
- lib/hyperloop/router/hash.rb
|
500
|
+
- lib/hyperloop/router/hash/class_methods.rb
|
501
|
+
- lib/hyperloop/router/memory.rb
|
502
|
+
- lib/hyperloop/router/memory/class_methods.rb
|
503
|
+
- lib/hyperloop/router/static.rb
|
504
|
+
- lib/hyperloop/router/static/class_methods.rb
|
488
505
|
- lib/react/router.rb
|
489
|
-
- lib/react/router/
|
490
|
-
- lib/react/router/dsl/index.rb
|
491
|
-
- lib/react/router/dsl/route.rb
|
492
|
-
- lib/react/router/dsl/route/hooks.rb
|
493
|
-
- lib/react/router/dsl/route/wrappers.rb
|
494
|
-
- lib/react/router/dsl/transition_context.rb
|
506
|
+
- lib/react/router/dom.rb
|
495
507
|
- lib/react/router/history.rb
|
496
|
-
- lib/
|
497
|
-
- lib/src/react-router.js
|
508
|
+
- lib/src/history.min.js
|
509
|
+
- lib/src/react-router-dom.min.js
|
510
|
+
- lib/src/react-router.min.js
|
498
511
|
homepage:
|
499
512
|
licenses: []
|
500
513
|
metadata: {}
|
data/lib/promise_extras.rb
DELETED
data/lib/react/router/dsl.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
class Router
|
3
|
-
class DSL
|
4
|
-
def self.build_routes(*args, &block)
|
5
|
-
evaluate_children(*args, &block)[0]
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.evaluate_children(*args, &children)
|
9
|
-
[[], nil].tap do |new_routes|
|
10
|
-
if children
|
11
|
-
saved_routes, @routes = [@routes, new_routes]
|
12
|
-
@routes << children.call(*args)
|
13
|
-
@routes = saved_routes
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.add_element(element)
|
19
|
-
@routes[0] << element
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.set_index(index)
|
23
|
-
@routes[1] = index
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.children_to_n(children)
|
27
|
-
children.collect { |e| e.to_json.to_n }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'react/router/dsl/route/hooks'
|
2
|
-
require 'react/router/dsl/route/wrappers'
|
3
|
-
|
4
|
-
module React
|
5
|
-
class Router
|
6
|
-
class DSL
|
7
|
-
class Route
|
8
|
-
def initialize(*args, &children)
|
9
|
-
path =
|
10
|
-
if args[0].is_a? Hash
|
11
|
-
nil
|
12
|
-
else
|
13
|
-
args[0]
|
14
|
-
end
|
15
|
-
opts =
|
16
|
-
if args[0].is_a? Hash
|
17
|
-
args[0]
|
18
|
-
else
|
19
|
-
args[1] || {}
|
20
|
-
end
|
21
|
-
unless opts.is_a? Hash
|
22
|
-
raise 'Route expects an optional path followed by an options hash, '\
|
23
|
-
"instead we got route(#{'"' + path + '", ' if path} #{opts})"
|
24
|
-
end
|
25
|
-
@children, @index = DSL.evaluate_children do
|
26
|
-
yield if children && children.arity == 0
|
27
|
-
Index.new(mounts: opts[:index]) if opts[:index]
|
28
|
-
end
|
29
|
-
opts.delete(:index)
|
30
|
-
@get_children = children if children && children.arity > 0
|
31
|
-
@path = path
|
32
|
-
if opts[:mounts].is_a? Hash
|
33
|
-
@components = opts[:mounts]
|
34
|
-
else
|
35
|
-
@component = opts[:mounts]
|
36
|
-
end
|
37
|
-
opts.delete(:mounts)
|
38
|
-
@opts = opts
|
39
|
-
save_element
|
40
|
-
end
|
41
|
-
|
42
|
-
def save_element
|
43
|
-
DSL.add_element(self)
|
44
|
-
end
|
45
|
-
|
46
|
-
def to_json
|
47
|
-
hash = {}
|
48
|
-
hash[:path] = @path if @path
|
49
|
-
|
50
|
-
if @get_children
|
51
|
-
hash[:getChildRoutes] = get_child_routes_wrapper
|
52
|
-
else
|
53
|
-
hash[:childRoutes] = @children.map(&:to_json)
|
54
|
-
end
|
55
|
-
|
56
|
-
if @components
|
57
|
-
if @components.detect { |_k, v| v.respond_to? :call }
|
58
|
-
hash[:getComponents] = get_components_wrapper
|
59
|
-
else
|
60
|
-
hash[:components] = @components
|
61
|
-
end
|
62
|
-
elsif @component.respond_to? :call
|
63
|
-
hash[:getComponent] = get_component_wrapper
|
64
|
-
elsif @component
|
65
|
-
hash[:component] = React::API.create_native_react_class(@component)
|
66
|
-
else
|
67
|
-
hash[:component] = DSL.router.lookup_component(@path)
|
68
|
-
end
|
69
|
-
|
70
|
-
%w(enter change leave).each do |hook|
|
71
|
-
hash["on#{hook.camelcase}"] = send("on_#{hook}_wrapper") if @opts["on_#{hook}"]
|
72
|
-
end
|
73
|
-
|
74
|
-
if @index.respond_to? :call
|
75
|
-
hash[:getIndexRoute] = get_index_route_wrapper
|
76
|
-
elsif @index
|
77
|
-
hash[:indexRoute] = @index.to_json
|
78
|
-
end
|
79
|
-
|
80
|
-
@opts.each do |key, value|
|
81
|
-
hash[key] = value unless %w(on_enter on_change on_leave).include?(key)
|
82
|
-
end
|
83
|
-
|
84
|
-
hash
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|