@flarehr/apollo-benefits 0.1.109 → 0.3.53405
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.
- package/README.md +19 -0
- package/dist/assets/@splitsoftware-7d799540.js +18 -0
- package/dist/assets/all_tab_color-548783b9.svg +21 -0
- package/dist/assets/all_tab_gray-a5051313.svg +6 -0
- package/dist/assets/check-57fe1dcb.svg +15 -0
- package/dist/assets/datadog-ff247651.js +5 -0
- package/dist/assets/date-fns-c5d8fbc0.js +1 -0
- package/dist/assets/default_backdrop-fdd955b8.png +0 -0
- package/dist/assets/external_link-599a0aec.svg +3 -0
- package/dist/assets/external_link_white-55111b2e.svg +3 -0
- package/dist/assets/framer-motion-bb8d6b82.js +1 -0
- package/dist/assets/index-0b3afb09.js +5 -0
- package/dist/assets/index-5e9e5aa9.js +35 -0
- package/dist/assets/index-cfa25e28.css +1 -0
- package/dist/assets/lodash-5d893f8c.js +1 -0
- package/dist/assets/logo-a34e9b4b.png +0 -0
- package/dist/assets/oidc-client-6f6e47c2.js +101 -0
- package/dist/assets/padlock-8c081120.svg +26 -0
- package/dist/assets/suitcase-6471ad05.svg +17 -0
- package/dist/assets/vendor-2d0139ca.js +788 -0
- package/dist/assets/warning-a7f1af23.svg +14 -0
- package/dist/assets/welcome_image_mobile-dbde6c80.png +0 -0
- package/dist/assets/welcome_image_v2-869c59e4.png +0 -0
- package/dist/assets/wellbeing_banner-6903d615.png +0 -0
- package/dist/assets/workplace_link_banner_mobile-6ebaa24b.png +0 -0
- package/dist/assets/workplace_link_banner_v2-c81ed849.png +0 -0
- package/dist/config.json +14 -0
- package/dist/favicon.ico +0 -0
- package/dist/icons/android-chrome-192x192.png +0 -0
- package/dist/icons/android-chrome-512x512.png +0 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/favicon-16x16.png +0 -0
- package/dist/icons/favicon-32x32.png +0 -0
- package/dist/index.html +114 -0
- package/dist/manifest.json +21 -0
- package/dist/sw-esm.js +16 -0
- package/package.json +129 -60
- package/LICENSE +0 -21
- package/dist/lib/apollo-benefits/apollo-benefits.esm.js +0 -1
- package/dist/lib/apollo-benefits/assets/car-placeholder.svg +0 -5
- package/dist/lib/apollo-benefits/assets/check.svg +0 -13
- package/dist/lib/apollo-benefits/index.esm.js +0 -0
- package/dist/lib/apollo-benefits/p-06a1f65f.js +0 -1
- package/dist/lib/apollo-benefits/p-077d7f8d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-14054f15.js +0 -1
- package/dist/lib/apollo-benefits/p-24a37d64.js +0 -1
- package/dist/lib/apollo-benefits/p-2b3f3b72.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3111d565.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-327396fa.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3d4d2683.js +0 -1
- package/dist/lib/apollo-benefits/p-4474bcf8.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-4bff99bd.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-50fe790f.js +0 -1
- package/dist/lib/apollo-benefits/p-53bcbd1d.js +0 -1
- package/dist/lib/apollo-benefits/p-68c136da.js +0 -1
- package/dist/lib/apollo-benefits/p-6bd16f5b.js +0 -1
- package/dist/lib/apollo-benefits/p-71dbc8ff.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-774d9bc5.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7a2ca86d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7a572b50.js +0 -1
- package/dist/lib/apollo-benefits/p-7c2cd94a.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-839493d7.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-a24d169b.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-b33fc683.js +0 -1
- package/dist/lib/apollo-benefits/p-beb8f728.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-e241f55b.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-e28cee25.js +0 -1
- package/dist/lib/apollo-benefits/p-e3cf51f1.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-ef8ea713.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-f0a7c9fa.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-f603197d.js +0 -15
- package/dist/lib/cjs/active-router-0ecaf2b8.js +0 -75
- package/dist/lib/cjs/ap-ben-choose-vehicle-section_4.cjs.entry.js +0 -2708
- package/dist/lib/cjs/ap-ben-complete-section_4.cjs.entry.js +0 -108
- package/dist/lib/cjs/ap-ben-notifications-section.cjs.entry.js +0 -238
- package/dist/lib/cjs/apollo-benefits.cjs.js +0 -25
- package/dist/lib/cjs/app-globals-67583b8b.js +0 -12
- package/dist/lib/cjs/async-6a7926f0.js +0 -753
- package/dist/lib/cjs/cars-calculator-app.cjs.entry.js +0 -55
- package/dist/lib/cjs/cars-calculator.service-c0e51584.js +0 -904
- package/dist/lib/cjs/context-consumer.cjs.entry.js +0 -29
- package/dist/lib/cjs/datorama-akita-31d23240.js +0 -2551
- package/dist/lib/cjs/delay-d31618c3.js +0 -206
- package/dist/lib/cjs/distinctUntilChanged-e8538790.js +0 -371
- package/dist/lib/cjs/dom-utils-b8befdd5.js +0 -63
- package/dist/lib/cjs/fl-button_2.cjs.entry.js +0 -50
- package/dist/lib/cjs/fl-dropdown-async_2.cjs.entry.js +0 -467
- package/dist/lib/cjs/fl-dropdown.cjs.entry.js +0 -232
- package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -91
- package/dist/lib/cjs/index-f1fadf90.js +0 -1735
- package/dist/lib/cjs/index.cjs.js +0 -2
- package/dist/lib/cjs/loader.cjs.js +0 -27
- package/dist/lib/cjs/location-utils-36fe7e5e.js +0 -237
- package/dist/lib/cjs/match-path-be4ea5f6.js +0 -279
- package/dist/lib/cjs/session.query-d61ba7ec.js +0 -1731
- package/dist/lib/cjs/stencil-async-content.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route-link.cjs.entry.js +0 -78
- package/dist/lib/cjs/stencil-route-switch.cjs.entry.js +0 -104
- package/dist/lib/cjs/stencil-route-title.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route.cjs.entry.js +0 -97
- package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +0 -59
- package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-router.cjs.entry.js +0 -640
- package/dist/lib/collection/assets/image/complete.svg +0 -122
- package/dist/lib/collection/collection-manifest.json +0 -53
- package/dist/lib/collection/components/cars-calculator-app/api/api-client.js +0 -5
- package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator.api.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.css +0 -22
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.js +0 -97
- package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.css +0 -0
- package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.js +0 -144
- package/dist/lib/collection/components/cars-calculator-app/notifications-section/notifications-section.js +0 -25
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/car-placeholder.svg +0 -5
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/check.svg +0 -13
- package/dist/lib/collection/components/cars-calculator-app/pages/choose-vehicle-section.component.js +0 -196
- package/dist/lib/collection/components/cars-calculator-app/pages/complete-section.component.js +0 -38
- package/dist/lib/collection/components/cars-calculator-app/pages/cost-breakdown-section.component.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.css +0 -34
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.js +0 -85
- package/dist/lib/collection/components/cars-calculator-app/pages/personal-info-section.component.js +0 -66
- package/dist/lib/collection/components/cars-calculator-app/pages/quote-result-section.component.js +0 -86
- package/dist/lib/collection/components/cars-calculator-app/pages/submit-quote-section.component.js +0 -75
- package/dist/lib/collection/components/cars-calculator-app/services/app-configuration.service.js +0 -13
- package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js +0 -106
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js +0 -37
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.store.js +0 -3
- package/dist/lib/collection/components/cars-calculator-app/services/session.query.js +0 -35
- package/dist/lib/collection/components/cars-calculator-app/services/session.store.js +0 -78
- package/dist/lib/collection/global/config.js +0 -2
- package/dist/lib/collection/global/main.dev.js +0 -5
- package/dist/lib/collection/global/main.js +0 -5
- package/dist/lib/collection/index.js +0 -2
- package/dist/lib/collection/utils/config.js +0 -2
- package/dist/lib/collection/utils/index.js +0 -15
- package/dist/lib/collection/utils/lazy.js +0 -29
- package/dist/lib/esm/active-router-7c2ca849.js +0 -73
- package/dist/lib/esm/ap-ben-choose-vehicle-section_4.entry.js +0 -2701
- package/dist/lib/esm/ap-ben-complete-section_4.entry.js +0 -101
- package/dist/lib/esm/ap-ben-notifications-section.entry.js +0 -234
- package/dist/lib/esm/apollo-benefits.js +0 -23
- package/dist/lib/esm/app-globals-65714cca.js +0 -10
- package/dist/lib/esm/async-68e9cad7.js +0 -738
- package/dist/lib/esm/cars-calculator-app.entry.js +0 -51
- package/dist/lib/esm/cars-calculator.service-27826530.js +0 -897
- package/dist/lib/esm/context-consumer.entry.js +0 -25
- package/dist/lib/esm/datorama-akita-c87196a0.js +0 -2545
- package/dist/lib/esm/delay-115d4292.js +0 -200
- package/dist/lib/esm/distinctUntilChanged-bf69e0f8.js +0 -363
- package/dist/lib/esm/dom-utils-109a7d75.js +0 -55
- package/dist/lib/esm/fl-button_2.entry.js +0 -45
- package/dist/lib/esm/fl-dropdown-async_2.entry.js +0 -462
- package/dist/lib/esm/fl-dropdown.entry.js +0 -228
- package/dist/lib/esm/fl-style-guide.entry.js +0 -87
- package/dist/lib/esm/index-19c4d245.js +0 -1703
- package/dist/lib/esm/index.js +0 -1
- package/dist/lib/esm/loader.js +0 -23
- package/dist/lib/esm/location-utils-312665d3.js +0 -226
- package/dist/lib/esm/match-path-4b5c7d98.js +0 -276
- package/dist/lib/esm/polyfills/core-js.js +0 -11
- package/dist/lib/esm/polyfills/css-shim.js +0 -1
- package/dist/lib/esm/polyfills/dom.js +0 -79
- package/dist/lib/esm/polyfills/es5-html-element.js +0 -1
- package/dist/lib/esm/polyfills/index.js +0 -34
- package/dist/lib/esm/polyfills/system.js +0 -6
- package/dist/lib/esm/session.query-0f1c9503.js +0 -1719
- package/dist/lib/esm/stencil-async-content.entry.js +0 -28
- package/dist/lib/esm/stencil-route-link.entry.js +0 -74
- package/dist/lib/esm/stencil-route-switch.entry.js +0 -100
- package/dist/lib/esm/stencil-route-title.entry.js +0 -28
- package/dist/lib/esm/stencil-route.entry.js +0 -93
- package/dist/lib/esm/stencil-router-prompt.entry.js +0 -55
- package/dist/lib/esm/stencil-router-redirect.entry.js +0 -28
- package/dist/lib/esm/stencil-router.entry.js +0 -636
- package/dist/lib/index.cjs.js +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/loader/cdn.js +0 -3
- package/dist/lib/loader/index.cjs.js +0 -3
- package/dist/lib/loader/index.d.ts +0 -13
- package/dist/lib/loader/index.es2017.js +0 -3
- package/dist/lib/loader/index.js +0 -4
- package/dist/lib/loader/package.json +0 -10
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -45
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
- package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +0 -3
- package/dist/lib/types/components/cars-calculator-app/api/api-client.d.ts +0 -2
- package/dist/lib/types/components/cars-calculator-app/api/cars-calculator.api.d.ts +0 -99
- package/dist/lib/types/components/cars-calculator-app/cars-calculator-app.d.ts +0 -17
- package/dist/lib/types/components/cars-calculator-app/modal-section/modal-section.d.ts +0 -16
- package/dist/lib/types/components/cars-calculator-app/notifications-section/notifications-section.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/choose-vehicle-section.component.d.ts +0 -23
- package/dist/lib/types/components/cars-calculator-app/pages/complete-section.component.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/cost-breakdown-section.component.d.ts +0 -6
- package/dist/lib/types/components/cars-calculator-app/pages/model-variants-section.component.d.ts +0 -12
- package/dist/lib/types/components/cars-calculator-app/pages/personal-info-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/pages/quote-result-section.component.d.ts +0 -13
- package/dist/lib/types/components/cars-calculator-app/pages/submit-quote-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/services/app-configuration.service.d.ts +0 -7
- package/dist/lib/types/components/cars-calculator-app/services/cars-calculator.service.d.ts +0 -11
- package/dist/lib/types/components/cars-calculator-app/services/notifications.service.d.ts +0 -15
- package/dist/lib/types/components/cars-calculator-app/services/notifications.store.d.ts +0 -14
- package/dist/lib/types/components/cars-calculator-app/services/session.query.d.ts +0 -25
- package/dist/lib/types/components/cars-calculator-app/services/session.store.d.ts +0 -77
- package/dist/lib/types/components.d.ts +0 -170
- package/dist/lib/types/global/config.d.ts +0 -2
- package/dist/lib/types/global/main.d.ts +0 -1
- package/dist/lib/types/global/main.dev.d.ts +0 -1
- package/dist/lib/types/index.d.ts +0 -2
- package/dist/lib/types/stencil-public-runtime.d.ts +0 -1555
- package/dist/lib/types/utils/config.d.ts +0 -2
- package/dist/lib/types/utils/index.d.ts +0 -7
- package/dist/lib/types/utils/lazy.d.ts +0 -12
- package/readme.md +0 -1
|
@@ -1,636 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as getContext, h, a as getElement } from './index-19c4d245.js';
|
|
2
|
-
import { A as ActiveRouter } from './active-router-7c2ca849.js';
|
|
3
|
-
import { s as stripTrailingSlash, a as addLeadingSlash, c as createLocation, b as createKey, h as hasBasename, d as stripBasename, e as createPath, f as stripLeadingSlash, l as locationsAreEqual } from './location-utils-312665d3.js';
|
|
4
|
-
import { s as storageAvailable, a as supportsHistory, b as supportsPopStateOnHashChange, g as getConfirmation, c as isExtraneousPopstateEvent, d as supportsGoWithoutReloadUsingHash } from './dom-utils-109a7d75.js';
|
|
5
|
-
|
|
6
|
-
const warning = (value, ...args) => {
|
|
7
|
-
if (!value) {
|
|
8
|
-
console.warn(...args);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// Adapted from the https://github.com/ReactTraining/history and converted to TypeScript
|
|
13
|
-
const createTransitionManager = () => {
|
|
14
|
-
let prompt;
|
|
15
|
-
let listeners = [];
|
|
16
|
-
const setPrompt = (nextPrompt) => {
|
|
17
|
-
warning(prompt == null, 'A history supports only one prompt at a time');
|
|
18
|
-
prompt = nextPrompt;
|
|
19
|
-
return () => {
|
|
20
|
-
if (prompt === nextPrompt) {
|
|
21
|
-
prompt = null;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const confirmTransitionTo = (location, action, getUserConfirmation, callback) => {
|
|
26
|
-
// TODO: If another transition starts while we're still confirming
|
|
27
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
28
|
-
// best way to handle this.
|
|
29
|
-
if (prompt != null) {
|
|
30
|
-
const result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
31
|
-
if (typeof result === 'string') {
|
|
32
|
-
if (typeof getUserConfirmation === 'function') {
|
|
33
|
-
getUserConfirmation(result, callback);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message');
|
|
37
|
-
callback(true);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Return false from a transition hook to cancel the transition.
|
|
42
|
-
callback(result !== false);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
callback(true);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const appendListener = (fn) => {
|
|
50
|
-
let isActive = true;
|
|
51
|
-
const listener = (...args) => {
|
|
52
|
-
if (isActive) {
|
|
53
|
-
fn(...args);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
listeners.push(listener);
|
|
57
|
-
return () => {
|
|
58
|
-
isActive = false;
|
|
59
|
-
listeners = listeners.filter(item => item !== listener);
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
const notifyListeners = (...args) => {
|
|
63
|
-
listeners.forEach(listener => listener(...args));
|
|
64
|
-
};
|
|
65
|
-
return {
|
|
66
|
-
setPrompt,
|
|
67
|
-
confirmTransitionTo,
|
|
68
|
-
appendListener,
|
|
69
|
-
notifyListeners
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const createScrollHistory = (win, applicationScrollKey = 'scrollPositions') => {
|
|
74
|
-
let scrollPositions = new Map();
|
|
75
|
-
const set = (key, value) => {
|
|
76
|
-
scrollPositions.set(key, value);
|
|
77
|
-
if (storageAvailable(win, 'sessionStorage')) {
|
|
78
|
-
const arrayData = [];
|
|
79
|
-
scrollPositions.forEach((value, key) => {
|
|
80
|
-
arrayData.push([key, value]);
|
|
81
|
-
});
|
|
82
|
-
win.sessionStorage.setItem('scrollPositions', JSON.stringify(arrayData));
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const get = (key) => {
|
|
86
|
-
return scrollPositions.get(key);
|
|
87
|
-
};
|
|
88
|
-
const has = (key) => {
|
|
89
|
-
return scrollPositions.has(key);
|
|
90
|
-
};
|
|
91
|
-
const capture = (key) => {
|
|
92
|
-
set(key, [win.scrollX, win.scrollY]);
|
|
93
|
-
};
|
|
94
|
-
if (storageAvailable(win, 'sessionStorage')) {
|
|
95
|
-
const scrollData = win.sessionStorage.getItem(applicationScrollKey);
|
|
96
|
-
scrollPositions = scrollData ?
|
|
97
|
-
new Map(JSON.parse(scrollData)) :
|
|
98
|
-
scrollPositions;
|
|
99
|
-
}
|
|
100
|
-
if ('scrollRestoration' in win.history) {
|
|
101
|
-
history.scrollRestoration = 'manual';
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
set,
|
|
105
|
-
get,
|
|
106
|
-
has,
|
|
107
|
-
capture
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// Adapted from the https://github.com/ReactTraining/history and converted to TypeScript
|
|
112
|
-
const PopStateEvent = 'popstate';
|
|
113
|
-
const HashChangeEvent = 'hashchange';
|
|
114
|
-
/**
|
|
115
|
-
* Creates a history object that uses the HTML5 history API including
|
|
116
|
-
* pushState, replaceState, and the popstate event.
|
|
117
|
-
*/
|
|
118
|
-
const createBrowserHistory = (win, props = {}) => {
|
|
119
|
-
let forceNextPop = false;
|
|
120
|
-
const globalHistory = win.history;
|
|
121
|
-
const globalLocation = win.location;
|
|
122
|
-
const globalNavigator = win.navigator;
|
|
123
|
-
const canUseHistory = supportsHistory(win);
|
|
124
|
-
const needsHashChangeListener = !supportsPopStateOnHashChange(globalNavigator);
|
|
125
|
-
const scrollHistory = createScrollHistory(win);
|
|
126
|
-
const forceRefresh = (props.forceRefresh != null) ? props.forceRefresh : false;
|
|
127
|
-
const getUserConfirmation = (props.getUserConfirmation != null) ? props.getUserConfirmation : getConfirmation;
|
|
128
|
-
const keyLength = (props.keyLength != null) ? props.keyLength : 6;
|
|
129
|
-
const basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
|
130
|
-
const getHistoryState = () => {
|
|
131
|
-
try {
|
|
132
|
-
return win.history.state || {};
|
|
133
|
-
}
|
|
134
|
-
catch (e) {
|
|
135
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
136
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
137
|
-
return {};
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const getDOMLocation = (historyState) => {
|
|
141
|
-
historyState = historyState || {};
|
|
142
|
-
const { key, state } = historyState;
|
|
143
|
-
const { pathname, search, hash } = globalLocation;
|
|
144
|
-
let path = pathname + search + hash;
|
|
145
|
-
warning((!basename || hasBasename(path, basename)), 'You are attempting to use a basename on a page whose URL path does not begin ' +
|
|
146
|
-
'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
|
|
147
|
-
if (basename) {
|
|
148
|
-
path = stripBasename(path, basename);
|
|
149
|
-
}
|
|
150
|
-
return createLocation(path, state, key || createKey(keyLength));
|
|
151
|
-
};
|
|
152
|
-
const transitionManager = createTransitionManager();
|
|
153
|
-
const setState = (nextState) => {
|
|
154
|
-
// Capture location for the view before changing history.
|
|
155
|
-
scrollHistory.capture(history.location.key);
|
|
156
|
-
Object.assign(history, nextState);
|
|
157
|
-
// Set scroll position based on its previous storage value
|
|
158
|
-
history.location.scrollPosition = scrollHistory.get(history.location.key);
|
|
159
|
-
history.length = globalHistory.length;
|
|
160
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
161
|
-
};
|
|
162
|
-
const handlePopState = (event) => {
|
|
163
|
-
// Ignore extraneous popstate events in WebKit.
|
|
164
|
-
if (!isExtraneousPopstateEvent(globalNavigator, event)) {
|
|
165
|
-
handlePop(getDOMLocation(event.state));
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
const handleHashChange = () => {
|
|
169
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
170
|
-
};
|
|
171
|
-
const handlePop = (location) => {
|
|
172
|
-
if (forceNextPop) {
|
|
173
|
-
forceNextPop = false;
|
|
174
|
-
setState();
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
const action = 'POP';
|
|
178
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
|
179
|
-
if (ok) {
|
|
180
|
-
setState({ action, location });
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
revertPop(location);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
const revertPop = (fromLocation) => {
|
|
189
|
-
const toLocation = history.location;
|
|
190
|
-
// TODO: We could probably make this more reliable by
|
|
191
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
192
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
193
|
-
let toIndex = allKeys.indexOf(toLocation.key);
|
|
194
|
-
let fromIndex = allKeys.indexOf(fromLocation.key);
|
|
195
|
-
if (toIndex === -1) {
|
|
196
|
-
toIndex = 0;
|
|
197
|
-
}
|
|
198
|
-
if (fromIndex === -1) {
|
|
199
|
-
fromIndex = 0;
|
|
200
|
-
}
|
|
201
|
-
const delta = toIndex - fromIndex;
|
|
202
|
-
if (delta) {
|
|
203
|
-
forceNextPop = true;
|
|
204
|
-
go(delta);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
const initialLocation = getDOMLocation(getHistoryState());
|
|
208
|
-
let allKeys = [initialLocation.key];
|
|
209
|
-
let listenerCount = 0;
|
|
210
|
-
let isBlocked = false;
|
|
211
|
-
// Public interface
|
|
212
|
-
const createHref = (location) => {
|
|
213
|
-
return basename + createPath(location);
|
|
214
|
-
};
|
|
215
|
-
const push = (path, state) => {
|
|
216
|
-
warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' +
|
|
217
|
-
'argument is a location-like object that already has state; it is ignored');
|
|
218
|
-
const action = 'PUSH';
|
|
219
|
-
const location = createLocation(path, state, createKey(keyLength), history.location);
|
|
220
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
|
221
|
-
if (!ok) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
const href = createHref(location);
|
|
225
|
-
const { key, state } = location;
|
|
226
|
-
if (canUseHistory) {
|
|
227
|
-
globalHistory.pushState({ key, state }, '', href);
|
|
228
|
-
if (forceRefresh) {
|
|
229
|
-
globalLocation.href = href;
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
const prevIndex = allKeys.indexOf(history.location.key);
|
|
233
|
-
const nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
|
|
234
|
-
nextKeys.push(location.key);
|
|
235
|
-
allKeys = nextKeys;
|
|
236
|
-
setState({ action, location });
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history');
|
|
241
|
-
globalLocation.href = href;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
const replace = (path, state) => {
|
|
246
|
-
warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' +
|
|
247
|
-
'argument is a location-like object that already has state; it is ignored');
|
|
248
|
-
const action = 'REPLACE';
|
|
249
|
-
const location = createLocation(path, state, createKey(keyLength), history.location);
|
|
250
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
|
251
|
-
if (!ok) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
const href = createHref(location);
|
|
255
|
-
const { key, state } = location;
|
|
256
|
-
if (canUseHistory) {
|
|
257
|
-
globalHistory.replaceState({ key, state }, '', href);
|
|
258
|
-
if (forceRefresh) {
|
|
259
|
-
globalLocation.replace(href);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
const prevIndex = allKeys.indexOf(history.location.key);
|
|
263
|
-
if (prevIndex !== -1) {
|
|
264
|
-
allKeys[prevIndex] = location.key;
|
|
265
|
-
}
|
|
266
|
-
setState({ action, location });
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history');
|
|
271
|
-
globalLocation.replace(href);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
const go = (n) => {
|
|
276
|
-
globalHistory.go(n);
|
|
277
|
-
};
|
|
278
|
-
const goBack = () => go(-1);
|
|
279
|
-
const goForward = () => go(1);
|
|
280
|
-
const checkDOMListeners = (delta) => {
|
|
281
|
-
listenerCount += delta;
|
|
282
|
-
if (listenerCount === 1) {
|
|
283
|
-
win.addEventListener(PopStateEvent, handlePopState);
|
|
284
|
-
if (needsHashChangeListener) {
|
|
285
|
-
win.addEventListener(HashChangeEvent, handleHashChange);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
else if (listenerCount === 0) {
|
|
289
|
-
win.removeEventListener(PopStateEvent, handlePopState);
|
|
290
|
-
if (needsHashChangeListener) {
|
|
291
|
-
win.removeEventListener(HashChangeEvent, handleHashChange);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
const block = (prompt = '') => {
|
|
296
|
-
const unblock = transitionManager.setPrompt(prompt);
|
|
297
|
-
if (!isBlocked) {
|
|
298
|
-
checkDOMListeners(1);
|
|
299
|
-
isBlocked = true;
|
|
300
|
-
}
|
|
301
|
-
return () => {
|
|
302
|
-
if (isBlocked) {
|
|
303
|
-
isBlocked = false;
|
|
304
|
-
checkDOMListeners(-1);
|
|
305
|
-
}
|
|
306
|
-
return unblock();
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
|
-
const listen = (listener) => {
|
|
310
|
-
const unlisten = transitionManager.appendListener(listener);
|
|
311
|
-
checkDOMListeners(1);
|
|
312
|
-
return () => {
|
|
313
|
-
checkDOMListeners(-1);
|
|
314
|
-
unlisten();
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
|
-
const history = {
|
|
318
|
-
length: globalHistory.length,
|
|
319
|
-
action: 'POP',
|
|
320
|
-
location: initialLocation,
|
|
321
|
-
createHref,
|
|
322
|
-
push,
|
|
323
|
-
replace,
|
|
324
|
-
go,
|
|
325
|
-
goBack,
|
|
326
|
-
goForward,
|
|
327
|
-
block,
|
|
328
|
-
listen,
|
|
329
|
-
win: win
|
|
330
|
-
};
|
|
331
|
-
return history;
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
// Adapted from the https://github.com/ReactTraining/history and converted to TypeScript
|
|
335
|
-
const HashChangeEvent$1 = 'hashchange';
|
|
336
|
-
const HashPathCoders = {
|
|
337
|
-
hashbang: {
|
|
338
|
-
encodePath: (path) => path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path),
|
|
339
|
-
decodePath: (path) => path.charAt(0) === '!' ? path.substr(1) : path
|
|
340
|
-
},
|
|
341
|
-
noslash: {
|
|
342
|
-
encodePath: stripLeadingSlash,
|
|
343
|
-
decodePath: addLeadingSlash
|
|
344
|
-
},
|
|
345
|
-
slash: {
|
|
346
|
-
encodePath: addLeadingSlash,
|
|
347
|
-
decodePath: addLeadingSlash
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
const createHashHistory = (win, props = {}) => {
|
|
351
|
-
let forceNextPop = false;
|
|
352
|
-
let ignorePath = null;
|
|
353
|
-
let listenerCount = 0;
|
|
354
|
-
let isBlocked = false;
|
|
355
|
-
const globalLocation = win.location;
|
|
356
|
-
const globalHistory = win.history;
|
|
357
|
-
const canGoWithoutReload = supportsGoWithoutReloadUsingHash(win.navigator);
|
|
358
|
-
const keyLength = (props.keyLength != null) ? props.keyLength : 6;
|
|
359
|
-
const { getUserConfirmation = getConfirmation, hashType = 'slash' } = props;
|
|
360
|
-
const basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
|
361
|
-
const { encodePath, decodePath } = HashPathCoders[hashType];
|
|
362
|
-
const getHashPath = () => {
|
|
363
|
-
// We can't use window.location.hash here because it's not
|
|
364
|
-
// consistent across browsers - Firefox will pre-decode it!
|
|
365
|
-
const href = globalLocation.href;
|
|
366
|
-
const hashIndex = href.indexOf('#');
|
|
367
|
-
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
|
|
368
|
-
};
|
|
369
|
-
const pushHashPath = (path) => (globalLocation.hash = path);
|
|
370
|
-
const replaceHashPath = (path) => {
|
|
371
|
-
const hashIndex = globalLocation.href.indexOf('#');
|
|
372
|
-
globalLocation.replace(globalLocation.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path);
|
|
373
|
-
};
|
|
374
|
-
const getDOMLocation = () => {
|
|
375
|
-
let path = decodePath(getHashPath());
|
|
376
|
-
warning((!basename || hasBasename(path, basename)), 'You are attempting to use a basename on a page whose URL path does not begin ' +
|
|
377
|
-
'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
|
|
378
|
-
if (basename) {
|
|
379
|
-
path = stripBasename(path, basename);
|
|
380
|
-
}
|
|
381
|
-
return createLocation(path, undefined, createKey(keyLength));
|
|
382
|
-
};
|
|
383
|
-
const transitionManager = createTransitionManager();
|
|
384
|
-
const setState = (nextState) => {
|
|
385
|
-
Object.assign(history, nextState);
|
|
386
|
-
history.length = globalHistory.length;
|
|
387
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
388
|
-
};
|
|
389
|
-
const handleHashChange = () => {
|
|
390
|
-
const path = getHashPath();
|
|
391
|
-
const encodedPath = encodePath(path);
|
|
392
|
-
if (path !== encodedPath) {
|
|
393
|
-
// Ensure we always have a properly-encoded hash.
|
|
394
|
-
replaceHashPath(encodedPath);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
const location = getDOMLocation();
|
|
398
|
-
const prevLocation = history.location;
|
|
399
|
-
if (!forceNextPop && locationsAreEqual(prevLocation, location)) {
|
|
400
|
-
return; // A hashchange doesn't always == location change.
|
|
401
|
-
}
|
|
402
|
-
if (ignorePath === createPath(location)) {
|
|
403
|
-
return; // Ignore this change; we already setState in push/replace.
|
|
404
|
-
}
|
|
405
|
-
ignorePath = null;
|
|
406
|
-
handlePop(location);
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
const handlePop = (location) => {
|
|
410
|
-
if (forceNextPop) {
|
|
411
|
-
forceNextPop = false;
|
|
412
|
-
setState();
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
const action = 'POP';
|
|
416
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
|
417
|
-
if (ok) {
|
|
418
|
-
setState({ action, location });
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
revertPop(location);
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
const revertPop = (fromLocation) => {
|
|
427
|
-
const toLocation = history.location;
|
|
428
|
-
// TODO: We could probably make this more reliable by
|
|
429
|
-
// keeping a list of paths we've seen in sessionStorage.
|
|
430
|
-
// Instead, we just default to 0 for paths we don't know.
|
|
431
|
-
let toIndex = allPaths.lastIndexOf(createPath(toLocation));
|
|
432
|
-
let fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
|
|
433
|
-
if (toIndex === -1) {
|
|
434
|
-
toIndex = 0;
|
|
435
|
-
}
|
|
436
|
-
if (fromIndex === -1) {
|
|
437
|
-
fromIndex = 0;
|
|
438
|
-
}
|
|
439
|
-
const delta = toIndex - fromIndex;
|
|
440
|
-
if (delta) {
|
|
441
|
-
forceNextPop = true;
|
|
442
|
-
go(delta);
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
// Ensure the hash is encoded properly before doing anything else.
|
|
446
|
-
const path = getHashPath();
|
|
447
|
-
const encodedPath = encodePath(path);
|
|
448
|
-
if (path !== encodedPath) {
|
|
449
|
-
replaceHashPath(encodedPath);
|
|
450
|
-
}
|
|
451
|
-
const initialLocation = getDOMLocation();
|
|
452
|
-
let allPaths = [createPath(initialLocation)];
|
|
453
|
-
// Public interface
|
|
454
|
-
const createHref = (location) => ('#' + encodePath(basename + createPath(location)));
|
|
455
|
-
const push = (path, state) => {
|
|
456
|
-
warning(state === undefined, 'Hash history cannot push state; it is ignored');
|
|
457
|
-
const action = 'PUSH';
|
|
458
|
-
const location = createLocation(path, undefined, createKey(keyLength), history.location);
|
|
459
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
|
460
|
-
if (!ok) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
const path = createPath(location);
|
|
464
|
-
const encodedPath = encodePath(basename + path);
|
|
465
|
-
const hashChanged = getHashPath() !== encodedPath;
|
|
466
|
-
if (hashChanged) {
|
|
467
|
-
// We cannot tell if a hashchange was caused by a PUSH, so we'd
|
|
468
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
469
|
-
// is that other hash histories in the page will consider it a POP.
|
|
470
|
-
ignorePath = path;
|
|
471
|
-
pushHashPath(encodedPath);
|
|
472
|
-
const prevIndex = allPaths.lastIndexOf(createPath(history.location));
|
|
473
|
-
const nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
|
|
474
|
-
nextPaths.push(path);
|
|
475
|
-
allPaths = nextPaths;
|
|
476
|
-
setState({ action, location });
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
479
|
-
warning(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack');
|
|
480
|
-
setState();
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
};
|
|
484
|
-
const replace = (path, state) => {
|
|
485
|
-
warning(state === undefined, 'Hash history cannot replace state; it is ignored');
|
|
486
|
-
const action = 'REPLACE';
|
|
487
|
-
const location = createLocation(path, undefined, createKey(keyLength), history.location);
|
|
488
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, (ok) => {
|
|
489
|
-
if (!ok) {
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
const path = createPath(location);
|
|
493
|
-
const encodedPath = encodePath(basename + path);
|
|
494
|
-
const hashChanged = getHashPath() !== encodedPath;
|
|
495
|
-
if (hashChanged) {
|
|
496
|
-
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
|
|
497
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
498
|
-
// is that other hash histories in the page will consider it a POP.
|
|
499
|
-
ignorePath = path;
|
|
500
|
-
replaceHashPath(encodedPath);
|
|
501
|
-
}
|
|
502
|
-
const prevIndex = allPaths.indexOf(createPath(history.location));
|
|
503
|
-
if (prevIndex !== -1) {
|
|
504
|
-
allPaths[prevIndex] = path;
|
|
505
|
-
}
|
|
506
|
-
setState({ action, location });
|
|
507
|
-
});
|
|
508
|
-
};
|
|
509
|
-
const go = (n) => {
|
|
510
|
-
warning(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser');
|
|
511
|
-
globalHistory.go(n);
|
|
512
|
-
};
|
|
513
|
-
const goBack = () => go(-1);
|
|
514
|
-
const goForward = () => go(1);
|
|
515
|
-
const checkDOMListeners = (win, delta) => {
|
|
516
|
-
listenerCount += delta;
|
|
517
|
-
if (listenerCount === 1) {
|
|
518
|
-
win.addEventListener(HashChangeEvent$1, handleHashChange);
|
|
519
|
-
}
|
|
520
|
-
else if (listenerCount === 0) {
|
|
521
|
-
win.removeEventListener(HashChangeEvent$1, handleHashChange);
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
const block = (prompt = '') => {
|
|
525
|
-
const unblock = transitionManager.setPrompt(prompt);
|
|
526
|
-
if (!isBlocked) {
|
|
527
|
-
checkDOMListeners(win, 1);
|
|
528
|
-
isBlocked = true;
|
|
529
|
-
}
|
|
530
|
-
return () => {
|
|
531
|
-
if (isBlocked) {
|
|
532
|
-
isBlocked = false;
|
|
533
|
-
checkDOMListeners(win, -1);
|
|
534
|
-
}
|
|
535
|
-
return unblock();
|
|
536
|
-
};
|
|
537
|
-
};
|
|
538
|
-
const listen = (listener) => {
|
|
539
|
-
const unlisten = transitionManager.appendListener(listener);
|
|
540
|
-
checkDOMListeners(win, 1);
|
|
541
|
-
return () => {
|
|
542
|
-
checkDOMListeners(win, -1);
|
|
543
|
-
unlisten();
|
|
544
|
-
};
|
|
545
|
-
};
|
|
546
|
-
const history = {
|
|
547
|
-
length: globalHistory.length,
|
|
548
|
-
action: 'POP',
|
|
549
|
-
location: initialLocation,
|
|
550
|
-
createHref,
|
|
551
|
-
push,
|
|
552
|
-
replace,
|
|
553
|
-
go,
|
|
554
|
-
goBack,
|
|
555
|
-
goForward,
|
|
556
|
-
block,
|
|
557
|
-
listen,
|
|
558
|
-
win: win
|
|
559
|
-
};
|
|
560
|
-
return history;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
const getLocation = (location, root) => {
|
|
564
|
-
// Remove the root URL if found at beginning of string
|
|
565
|
-
const pathname = location.pathname.indexOf(root) == 0 ?
|
|
566
|
-
'/' + location.pathname.slice(root.length) :
|
|
567
|
-
location.pathname;
|
|
568
|
-
return Object.assign({}, location, { pathname });
|
|
569
|
-
};
|
|
570
|
-
const HISTORIES = {
|
|
571
|
-
'browser': createBrowserHistory,
|
|
572
|
-
'hash': createHashHistory
|
|
573
|
-
};
|
|
574
|
-
const Router = class {
|
|
575
|
-
constructor(hostRef) {
|
|
576
|
-
registerInstance(this, hostRef);
|
|
577
|
-
this.root = '/';
|
|
578
|
-
this.historyType = 'browser';
|
|
579
|
-
// A suffix to append to the page title whenever
|
|
580
|
-
// it's updated through RouteTitle
|
|
581
|
-
this.titleSuffix = '';
|
|
582
|
-
this.routeViewsUpdated = (options = {}) => {
|
|
583
|
-
if (this.history && options.scrollToId && this.historyType === 'browser') {
|
|
584
|
-
const elm = this.history.win.document.getElementById(options.scrollToId);
|
|
585
|
-
if (elm) {
|
|
586
|
-
return elm.scrollIntoView();
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
this.scrollTo(options.scrollTopOffset || this.scrollTopOffset);
|
|
590
|
-
};
|
|
591
|
-
this.isServer = getContext(this, "isServer");
|
|
592
|
-
this.queue = getContext(this, "queue");
|
|
593
|
-
}
|
|
594
|
-
componentWillLoad() {
|
|
595
|
-
this.history = HISTORIES[this.historyType](this.el.ownerDocument.defaultView);
|
|
596
|
-
this.history.listen((location) => {
|
|
597
|
-
location = getLocation(location, this.root);
|
|
598
|
-
this.location = location;
|
|
599
|
-
});
|
|
600
|
-
this.location = getLocation(this.history.location, this.root);
|
|
601
|
-
}
|
|
602
|
-
scrollTo(scrollToLocation) {
|
|
603
|
-
const history = this.history;
|
|
604
|
-
if (scrollToLocation == null || this.isServer || !history) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
if (history.action === 'POP' && Array.isArray(history.location.scrollPosition)) {
|
|
608
|
-
return this.queue.write(() => {
|
|
609
|
-
if (history && history.location && Array.isArray(history.location.scrollPosition)) {
|
|
610
|
-
history.win.scrollTo(history.location.scrollPosition[0], history.location.scrollPosition[1]);
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
// okay, the frame has passed. Go ahead and render now
|
|
615
|
-
return this.queue.write(() => {
|
|
616
|
-
history.win.scrollTo(0, scrollToLocation);
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
render() {
|
|
620
|
-
if (!this.location || !this.history) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
const state = {
|
|
624
|
-
historyType: this.historyType,
|
|
625
|
-
location: this.location,
|
|
626
|
-
titleSuffix: this.titleSuffix,
|
|
627
|
-
root: this.root,
|
|
628
|
-
history: this.history,
|
|
629
|
-
routeViewsUpdated: this.routeViewsUpdated
|
|
630
|
-
};
|
|
631
|
-
return (h(ActiveRouter.Provider, { state: state }, h("slot", null)));
|
|
632
|
-
}
|
|
633
|
-
get el() { return getElement(this); }
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
export { Router as stencil_router };
|
package/dist/lib/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./cjs/index.cjs.js');
|
package/dist/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './esm/index.js';
|
package/dist/lib/loader/cdn.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '../types/components';
|
|
3
|
-
export interface CustomElementsDefineOptions {
|
|
4
|
-
exclude?: string[];
|
|
5
|
-
resourcesUrl?: string;
|
|
6
|
-
syncQueue?: boolean;
|
|
7
|
-
jmp?: (c: Function) => any;
|
|
8
|
-
raf?: (c: FrameRequestCallback) => number;
|
|
9
|
-
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
10
|
-
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
|
|
13
|
-
export declare function applyPolyfills(): Promise<void>;
|
package/dist/lib/loader/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
|
|
3
|
-
export * from '../esm/polyfills/index.js';
|
|
4
|
-
export * from '../esm/loader.js';
|