@absolutejs/absolute 0.19.0-beta.189 → 0.19.0-beta.190
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/src/angular/index.js +52 -29249
- package/dist/src/angular/index.js.map +7 -7
- package/dist/src/angular/resolveAngularPackage.d.ts +7 -0
- package/dist/src/build.js +129 -29326
- package/dist/src/build.js.map +7 -7
- package/dist/src/index.js +143 -29340
- package/dist/src/index.js.map +7 -7
- package/package.json +1 -1
- package/.absolutejs/cache/angular-linker/158f5d2f54406892543656d582e21ae3.js +0 -381
- package/.absolutejs/cache/angular-linker/1d7d0bc01f6cc20c395ef4db9c650d0f.js +0 -314
- package/.absolutejs/cache/angular-linker/40154141000203d655aadbd789faf88b.js +0 -2836
- package/.absolutejs/cache/angular-linker/4de63c283da0f961c1a06e7d70ade436.js +0 -593
- package/.absolutejs/cache/angular-linker/632a6c2bd34d1659fd7bdd363a116781.js +0 -122
- package/.absolutejs/cache/angular-linker/63ed1410c0e3412b2e85125836ee21c1.js +0 -2029
- package/.absolutejs/cache/angular-linker/74f08c52f5a8513fd37c1627c364f298.js +0 -693
- package/.absolutejs/cache/angular-linker/b7a9e782fcfefd6aa8904e2619f4e503.js +0 -1348
- package/.absolutejs/cache/angular-linker/d27f508017fb07f5fd6a908e7a7dd5b7.js +0 -33
- package/.absolutejs/cache/angular-linker/df86b7673871f02c13eba6bdc09b4006.js +0 -2900
- package/.absolutejs/cert.pem +0 -11
- package/.absolutejs/eslint-cache +0 -1
- package/.absolutejs/key.pem +0 -5
- package/.absolutejs/prettier.cache.json +0 -219
package/package.json
CHANGED
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Angular v21.2.1
|
|
3
|
-
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
|
-
* License: MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ɵDomAdapter as _DomAdapter, ɵsetRootDomAdapter as _setRootDomAdapter, ɵparseCookieValue as _parseCookieValue, ɵgetDOM as _getDOM, DOCUMENT, ɵPLATFORM_BROWSER_ID as _PLATFORM_BROWSER_ID, XhrFactory, CommonModule } from '@angular/common';
|
|
8
|
-
import * as i0 from '@angular/core';
|
|
9
|
-
import { ɵglobal as _global, ɵRuntimeError as _RuntimeError, Injectable, Inject, ɵinternalCreateApplication as _internalCreateApplication, ɵresolveComponentResources as _resolveComponentResources, PLATFORM_ID, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, InjectionToken, ɵTESTABILITY_GETTER as _TESTABILITY_GETTER, ɵTESTABILITY as _TESTABILITY, Testability, ɵINJECTOR_SCOPE as _INJECTOR_SCOPE, ErrorHandler, RendererFactory2, inject, ApplicationModule, NgModule, ɵsetDocument as _setDocument } from '@angular/core';
|
|
10
|
-
import { EventManagerPlugin, EVENT_MANAGER_PLUGINS, DomEventsPlugin, DomRendererFactory2, SharedStylesHost, EventManager } from './_dom_renderer-chunk.mjs';
|
|
11
|
-
class BrowserDomAdapter extends _DomAdapter {
|
|
12
|
-
supportsDOMEvents = true;
|
|
13
|
-
static makeCurrent() {
|
|
14
|
-
_setRootDomAdapter(new BrowserDomAdapter());
|
|
15
|
-
}
|
|
16
|
-
onAndCancel(el, evt, listener, options) {
|
|
17
|
-
el.addEventListener(evt, listener, options);
|
|
18
|
-
return () => {
|
|
19
|
-
el.removeEventListener(evt, listener, options);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
dispatchEvent(el, evt) {
|
|
23
|
-
el.dispatchEvent(evt);
|
|
24
|
-
}
|
|
25
|
-
remove(node) {
|
|
26
|
-
node.remove();
|
|
27
|
-
}
|
|
28
|
-
createElement(tagName, doc) {
|
|
29
|
-
doc = doc || this.getDefaultDocument();
|
|
30
|
-
return doc.createElement(tagName);
|
|
31
|
-
}
|
|
32
|
-
createHtmlDocument() {
|
|
33
|
-
return document.implementation.createHTMLDocument('fakeTitle');
|
|
34
|
-
}
|
|
35
|
-
getDefaultDocument() {
|
|
36
|
-
return document;
|
|
37
|
-
}
|
|
38
|
-
isElementNode(node) {
|
|
39
|
-
return node.nodeType === Node.ELEMENT_NODE;
|
|
40
|
-
}
|
|
41
|
-
isShadowRoot(node) {
|
|
42
|
-
return node instanceof DocumentFragment;
|
|
43
|
-
}
|
|
44
|
-
getGlobalEventTarget(doc, target) {
|
|
45
|
-
if (target === 'window') {
|
|
46
|
-
return window;
|
|
47
|
-
}
|
|
48
|
-
if (target === 'document') {
|
|
49
|
-
return doc;
|
|
50
|
-
}
|
|
51
|
-
if (target === 'body') {
|
|
52
|
-
return doc.body;
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
getBaseHref(doc) {
|
|
57
|
-
const href = getBaseElementHref();
|
|
58
|
-
return href == null ? null : relativePath(href);
|
|
59
|
-
}
|
|
60
|
-
resetBaseElement() {
|
|
61
|
-
baseElement = null;
|
|
62
|
-
}
|
|
63
|
-
getUserAgent() {
|
|
64
|
-
return window.navigator.userAgent;
|
|
65
|
-
}
|
|
66
|
-
getCookie(name) {
|
|
67
|
-
return _parseCookieValue(document.cookie, name);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
let baseElement = null;
|
|
71
|
-
function getBaseElementHref() {
|
|
72
|
-
baseElement = baseElement || document.head.querySelector('base');
|
|
73
|
-
return baseElement ? baseElement.getAttribute('href') : null;
|
|
74
|
-
}
|
|
75
|
-
function relativePath(url) {
|
|
76
|
-
return new URL(url, document.baseURI).pathname;
|
|
77
|
-
}
|
|
78
|
-
class BrowserGetTestability {
|
|
79
|
-
addToWindow(registry) {
|
|
80
|
-
_global['getAngularTestability'] = (elem, findInAncestors = true) => {
|
|
81
|
-
const testability = registry.findTestabilityInTree(elem, findInAncestors);
|
|
82
|
-
if (testability == null) {
|
|
83
|
-
throw new _RuntimeError(5103, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Could not find testability for element.');
|
|
84
|
-
}
|
|
85
|
-
return testability;
|
|
86
|
-
};
|
|
87
|
-
_global['getAllAngularTestabilities'] = () => registry.getAllTestabilities();
|
|
88
|
-
_global['getAllAngularRootElements'] = () => registry.getAllRootElements();
|
|
89
|
-
const whenAllStable = callback => {
|
|
90
|
-
const testabilities = _global['getAllAngularTestabilities']();
|
|
91
|
-
let count = testabilities.length;
|
|
92
|
-
const decrement = function () {
|
|
93
|
-
count--;
|
|
94
|
-
if (count == 0) {
|
|
95
|
-
callback();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
testabilities.forEach(testability => {
|
|
99
|
-
testability.whenStable(decrement);
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
if (!_global['frameworkStabilizers']) {
|
|
103
|
-
_global['frameworkStabilizers'] = [];
|
|
104
|
-
}
|
|
105
|
-
_global['frameworkStabilizers'].push(whenAllStable);
|
|
106
|
-
}
|
|
107
|
-
findTestabilityInTree(registry, elem, findInAncestors) {
|
|
108
|
-
if (elem == null) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
const t = registry.getTestability(elem);
|
|
112
|
-
if (t != null) {
|
|
113
|
-
return t;
|
|
114
|
-
} else if (!findInAncestors) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
if (_getDOM().isShadowRoot(elem)) {
|
|
118
|
-
return this.findTestabilityInTree(registry, elem.host, true);
|
|
119
|
-
}
|
|
120
|
-
return this.findTestabilityInTree(registry, elem.parentElement, true);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
class BrowserXhr {
|
|
124
|
-
build() {
|
|
125
|
-
return new XMLHttpRequest();
|
|
126
|
-
}
|
|
127
|
-
static ɵfac = function BrowserXhr_Factory(__ngFactoryType__) {
|
|
128
|
-
return new (__ngFactoryType__ || BrowserXhr)();
|
|
129
|
-
};
|
|
130
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
131
|
-
token: BrowserXhr,
|
|
132
|
-
factory: BrowserXhr.ɵfac
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
(() => {
|
|
136
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BrowserXhr, [{
|
|
137
|
-
type: Injectable
|
|
138
|
-
}], null, null);
|
|
139
|
-
})();
|
|
140
|
-
const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
|
141
|
-
const _keyMap = {
|
|
142
|
-
'\b': 'Backspace',
|
|
143
|
-
'\t': 'Tab',
|
|
144
|
-
'\x7F': 'Delete',
|
|
145
|
-
'\x1B': 'Escape',
|
|
146
|
-
'Del': 'Delete',
|
|
147
|
-
'Esc': 'Escape',
|
|
148
|
-
'Left': 'ArrowLeft',
|
|
149
|
-
'Right': 'ArrowRight',
|
|
150
|
-
'Up': 'ArrowUp',
|
|
151
|
-
'Down': 'ArrowDown',
|
|
152
|
-
'Menu': 'ContextMenu',
|
|
153
|
-
'Scroll': 'ScrollLock',
|
|
154
|
-
'Win': 'OS'
|
|
155
|
-
};
|
|
156
|
-
const MODIFIER_KEY_GETTERS = {
|
|
157
|
-
'alt': event => event.altKey,
|
|
158
|
-
'control': event => event.ctrlKey,
|
|
159
|
-
'meta': event => event.metaKey,
|
|
160
|
-
'shift': event => event.shiftKey
|
|
161
|
-
};
|
|
162
|
-
class KeyEventsPlugin extends EventManagerPlugin {
|
|
163
|
-
constructor(doc) {
|
|
164
|
-
super(doc);
|
|
165
|
-
}
|
|
166
|
-
supports(eventName) {
|
|
167
|
-
return KeyEventsPlugin.parseEventName(eventName) != null;
|
|
168
|
-
}
|
|
169
|
-
addEventListener(element, eventName, handler, options) {
|
|
170
|
-
const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
|
|
171
|
-
const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
|
172
|
-
return this.manager.getZone().runOutsideAngular(() => {
|
|
173
|
-
return _getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler, options);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
static parseEventName(eventName) {
|
|
177
|
-
const parts = eventName.toLowerCase().split('.');
|
|
178
|
-
const domEventName = parts.shift();
|
|
179
|
-
if (parts.length === 0 || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
const key = KeyEventsPlugin._normalizeKey(parts.pop());
|
|
183
|
-
let fullKey = '';
|
|
184
|
-
let codeIX = parts.indexOf('code');
|
|
185
|
-
if (codeIX > -1) {
|
|
186
|
-
parts.splice(codeIX, 1);
|
|
187
|
-
fullKey = 'code.';
|
|
188
|
-
}
|
|
189
|
-
MODIFIER_KEYS.forEach(modifierName => {
|
|
190
|
-
const index = parts.indexOf(modifierName);
|
|
191
|
-
if (index > -1) {
|
|
192
|
-
parts.splice(index, 1);
|
|
193
|
-
fullKey += modifierName + '.';
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
fullKey += key;
|
|
197
|
-
if (parts.length != 0 || key.length === 0) {
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
const result = {};
|
|
201
|
-
result['domEventName'] = domEventName;
|
|
202
|
-
result['fullKey'] = fullKey;
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
static matchEventFullKeyCode(event, fullKeyCode) {
|
|
206
|
-
let keycode = _keyMap[event.key] || event.key;
|
|
207
|
-
let key = '';
|
|
208
|
-
if (fullKeyCode.indexOf('code.') > -1) {
|
|
209
|
-
keycode = event.code;
|
|
210
|
-
key = 'code.';
|
|
211
|
-
}
|
|
212
|
-
if (keycode == null || !keycode) return false;
|
|
213
|
-
keycode = keycode.toLowerCase();
|
|
214
|
-
if (keycode === ' ') {
|
|
215
|
-
keycode = 'space';
|
|
216
|
-
} else if (keycode === '.') {
|
|
217
|
-
keycode = 'dot';
|
|
218
|
-
}
|
|
219
|
-
MODIFIER_KEYS.forEach(modifierName => {
|
|
220
|
-
if (modifierName !== keycode) {
|
|
221
|
-
const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
|
222
|
-
if (modifierGetter(event)) {
|
|
223
|
-
key += modifierName + '.';
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
key += keycode;
|
|
228
|
-
return key === fullKeyCode;
|
|
229
|
-
}
|
|
230
|
-
static eventCallback(fullKey, handler, zone) {
|
|
231
|
-
return event => {
|
|
232
|
-
if (KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
|
|
233
|
-
zone.runGuarded(() => handler(event));
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
static _normalizeKey(keyName) {
|
|
238
|
-
return keyName === 'esc' ? 'escape' : keyName;
|
|
239
|
-
}
|
|
240
|
-
static ɵfac = function KeyEventsPlugin_Factory(__ngFactoryType__) {
|
|
241
|
-
return new (__ngFactoryType__ || KeyEventsPlugin)(i0.ɵɵinject(DOCUMENT));
|
|
242
|
-
};
|
|
243
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
244
|
-
token: KeyEventsPlugin,
|
|
245
|
-
factory: KeyEventsPlugin.ɵfac
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
(() => {
|
|
249
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(KeyEventsPlugin, [{
|
|
250
|
-
type: Injectable
|
|
251
|
-
}], () => [{
|
|
252
|
-
type: undefined,
|
|
253
|
-
decorators: [{
|
|
254
|
-
type: Inject,
|
|
255
|
-
args: [DOCUMENT]
|
|
256
|
-
}]
|
|
257
|
-
}], null);
|
|
258
|
-
})();
|
|
259
|
-
async function bootstrapApplication(rootComponent, options, context) {
|
|
260
|
-
const config = {
|
|
261
|
-
rootComponent,
|
|
262
|
-
...createProvidersConfig(options, context)
|
|
263
|
-
};
|
|
264
|
-
if ((typeof ngJitMode === 'undefined' || ngJitMode) && typeof fetch === 'function') {
|
|
265
|
-
await resolveJitResources();
|
|
266
|
-
}
|
|
267
|
-
return _internalCreateApplication(config);
|
|
268
|
-
}
|
|
269
|
-
async function createApplication(options, context) {
|
|
270
|
-
if ((typeof ngJitMode === 'undefined' || ngJitMode) && typeof fetch === 'function') {
|
|
271
|
-
await resolveJitResources();
|
|
272
|
-
}
|
|
273
|
-
return _internalCreateApplication(createProvidersConfig(options, context));
|
|
274
|
-
}
|
|
275
|
-
function createProvidersConfig(options, context) {
|
|
276
|
-
return {
|
|
277
|
-
platformRef: context?.platformRef,
|
|
278
|
-
appProviders: [...BROWSER_MODULE_PROVIDERS, ...(options?.providers ?? [])],
|
|
279
|
-
platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
async function resolveJitResources() {
|
|
283
|
-
try {
|
|
284
|
-
return await _resolveComponentResources(fetch);
|
|
285
|
-
} catch (error) {
|
|
286
|
-
console.error(error);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
function provideProtractorTestingSupport() {
|
|
290
|
-
return [...TESTABILITY_PROVIDERS];
|
|
291
|
-
}
|
|
292
|
-
function initDomAdapter() {
|
|
293
|
-
BrowserDomAdapter.makeCurrent();
|
|
294
|
-
}
|
|
295
|
-
function errorHandler() {
|
|
296
|
-
return new ErrorHandler();
|
|
297
|
-
}
|
|
298
|
-
function _document() {
|
|
299
|
-
_setDocument(document);
|
|
300
|
-
return document;
|
|
301
|
-
}
|
|
302
|
-
const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [{
|
|
303
|
-
provide: PLATFORM_ID,
|
|
304
|
-
useValue: _PLATFORM_BROWSER_ID
|
|
305
|
-
}, {
|
|
306
|
-
provide: PLATFORM_INITIALIZER,
|
|
307
|
-
useValue: initDomAdapter,
|
|
308
|
-
multi: true
|
|
309
|
-
}, {
|
|
310
|
-
provide: DOCUMENT,
|
|
311
|
-
useFactory: _document
|
|
312
|
-
}];
|
|
313
|
-
const platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
|
314
|
-
const BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'BrowserModule Providers Marker' : '');
|
|
315
|
-
const TESTABILITY_PROVIDERS = [{
|
|
316
|
-
provide: _TESTABILITY_GETTER,
|
|
317
|
-
useClass: BrowserGetTestability
|
|
318
|
-
}, {
|
|
319
|
-
provide: _TESTABILITY,
|
|
320
|
-
useClass: Testability
|
|
321
|
-
}, {
|
|
322
|
-
provide: Testability,
|
|
323
|
-
useClass: Testability
|
|
324
|
-
}];
|
|
325
|
-
const BROWSER_MODULE_PROVIDERS = [{
|
|
326
|
-
provide: _INJECTOR_SCOPE,
|
|
327
|
-
useValue: 'root'
|
|
328
|
-
}, {
|
|
329
|
-
provide: ErrorHandler,
|
|
330
|
-
useFactory: errorHandler
|
|
331
|
-
}, {
|
|
332
|
-
provide: EVENT_MANAGER_PLUGINS,
|
|
333
|
-
useClass: DomEventsPlugin,
|
|
334
|
-
multi: true
|
|
335
|
-
}, {
|
|
336
|
-
provide: EVENT_MANAGER_PLUGINS,
|
|
337
|
-
useClass: KeyEventsPlugin,
|
|
338
|
-
multi: true
|
|
339
|
-
}, DomRendererFactory2, SharedStylesHost, EventManager, {
|
|
340
|
-
provide: RendererFactory2,
|
|
341
|
-
useExisting: DomRendererFactory2
|
|
342
|
-
}, {
|
|
343
|
-
provide: XhrFactory,
|
|
344
|
-
useClass: BrowserXhr
|
|
345
|
-
}, typeof ngDevMode === 'undefined' || ngDevMode ? {
|
|
346
|
-
provide: BROWSER_MODULE_PROVIDERS_MARKER,
|
|
347
|
-
useValue: true
|
|
348
|
-
} : []];
|
|
349
|
-
class BrowserModule {
|
|
350
|
-
constructor() {
|
|
351
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
352
|
-
const providersAlreadyPresent = inject(BROWSER_MODULE_PROVIDERS_MARKER, {
|
|
353
|
-
optional: true,
|
|
354
|
-
skipSelf: true
|
|
355
|
-
});
|
|
356
|
-
if (providersAlreadyPresent) {
|
|
357
|
-
throw new _RuntimeError(5100, `Providers from the \`BrowserModule\` have already been loaded. If you need access ` + `to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
static ɵfac = function BrowserModule_Factory(__ngFactoryType__) {
|
|
362
|
-
return new (__ngFactoryType__ || BrowserModule)();
|
|
363
|
-
};
|
|
364
|
-
static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({
|
|
365
|
-
type: BrowserModule
|
|
366
|
-
});
|
|
367
|
-
static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({
|
|
368
|
-
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
|
|
369
|
-
imports: [CommonModule, ApplicationModule]
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
(() => {
|
|
373
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BrowserModule, [{
|
|
374
|
-
type: NgModule,
|
|
375
|
-
args: [{
|
|
376
|
-
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
|
|
377
|
-
exports: [CommonModule, ApplicationModule]
|
|
378
|
-
}]
|
|
379
|
-
}], () => [], null);
|
|
380
|
-
})();
|
|
381
|
-
export { BrowserDomAdapter, BrowserGetTestability, BrowserModule, KeyEventsPlugin, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport };
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Angular v21.2.1
|
|
3
|
-
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
|
-
* License: MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as i0 from '@angular/core';
|
|
8
|
-
import { inject, Injectable, InjectionToken, DOCUMENT, Optional, Inject, ɵɵinject as __inject } from '@angular/core';
|
|
9
|
-
import { Subject } from 'rxjs';
|
|
10
|
-
import { PlatformLocation } from './_platform_location-chunk.mjs';
|
|
11
|
-
function joinWithSlash(start, end) {
|
|
12
|
-
if (!start) return end;
|
|
13
|
-
if (!end) return start;
|
|
14
|
-
if (start.endsWith('/')) {
|
|
15
|
-
return end.startsWith('/') ? start + end.slice(1) : start + end;
|
|
16
|
-
}
|
|
17
|
-
return end.startsWith('/') ? start + end : `${start}/${end}`;
|
|
18
|
-
}
|
|
19
|
-
function stripTrailingSlash(url) {
|
|
20
|
-
const pathEndIdx = url.search(/#|\?|$/);
|
|
21
|
-
return url[pathEndIdx - 1] === '/' ? url.slice(0, pathEndIdx - 1) + url.slice(pathEndIdx) : url;
|
|
22
|
-
}
|
|
23
|
-
function normalizeQueryParams(params) {
|
|
24
|
-
return params && params[0] !== '?' ? `?${params}` : params;
|
|
25
|
-
}
|
|
26
|
-
class LocationStrategy {
|
|
27
|
-
historyGo(relativePosition) {
|
|
28
|
-
throw new Error(ngDevMode ? 'Not implemented' : '');
|
|
29
|
-
}
|
|
30
|
-
static ɵfac = function LocationStrategy_Factory(__ngFactoryType__) {
|
|
31
|
-
return new (__ngFactoryType__ || LocationStrategy)();
|
|
32
|
-
};
|
|
33
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
34
|
-
token: LocationStrategy,
|
|
35
|
-
factory: () => (() => inject(PathLocationStrategy))(),
|
|
36
|
-
providedIn: 'root'
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
(() => {
|
|
40
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LocationStrategy, [{
|
|
41
|
-
type: Injectable,
|
|
42
|
-
args: [{
|
|
43
|
-
providedIn: 'root',
|
|
44
|
-
useFactory: () => inject(PathLocationStrategy)
|
|
45
|
-
}]
|
|
46
|
-
}], null, null);
|
|
47
|
-
})();
|
|
48
|
-
const APP_BASE_HREF = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'appBaseHref' : '');
|
|
49
|
-
class PathLocationStrategy extends LocationStrategy {
|
|
50
|
-
_platformLocation;
|
|
51
|
-
_baseHref;
|
|
52
|
-
_removeListenerFns = [];
|
|
53
|
-
constructor(_platformLocation, href) {
|
|
54
|
-
super();
|
|
55
|
-
this._platformLocation = _platformLocation;
|
|
56
|
-
this._baseHref = href ?? this._platformLocation.getBaseHrefFromDOM() ?? inject(DOCUMENT).location?.origin ?? '';
|
|
57
|
-
}
|
|
58
|
-
ngOnDestroy() {
|
|
59
|
-
while (this._removeListenerFns.length) {
|
|
60
|
-
this._removeListenerFns.pop()();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
onPopState(fn) {
|
|
64
|
-
this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
|
|
65
|
-
}
|
|
66
|
-
getBaseHref() {
|
|
67
|
-
return this._baseHref;
|
|
68
|
-
}
|
|
69
|
-
prepareExternalUrl(internal) {
|
|
70
|
-
return joinWithSlash(this._baseHref, internal);
|
|
71
|
-
}
|
|
72
|
-
path(includeHash = false) {
|
|
73
|
-
const pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
|
|
74
|
-
const hash = this._platformLocation.hash;
|
|
75
|
-
return hash && includeHash ? `${pathname}${hash}` : pathname;
|
|
76
|
-
}
|
|
77
|
-
pushState(state, title, url, queryParams) {
|
|
78
|
-
const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
|
|
79
|
-
this._platformLocation.pushState(state, title, externalUrl);
|
|
80
|
-
}
|
|
81
|
-
replaceState(state, title, url, queryParams) {
|
|
82
|
-
const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
|
|
83
|
-
this._platformLocation.replaceState(state, title, externalUrl);
|
|
84
|
-
}
|
|
85
|
-
forward() {
|
|
86
|
-
this._platformLocation.forward();
|
|
87
|
-
}
|
|
88
|
-
back() {
|
|
89
|
-
this._platformLocation.back();
|
|
90
|
-
}
|
|
91
|
-
getState() {
|
|
92
|
-
return this._platformLocation.getState();
|
|
93
|
-
}
|
|
94
|
-
historyGo(relativePosition = 0) {
|
|
95
|
-
this._platformLocation.historyGo?.(relativePosition);
|
|
96
|
-
}
|
|
97
|
-
static ɵfac = function PathLocationStrategy_Factory(__ngFactoryType__) {
|
|
98
|
-
return new (__ngFactoryType__ || PathLocationStrategy)(i0.ɵɵinject(PlatformLocation), i0.ɵɵinject(APP_BASE_HREF, 8));
|
|
99
|
-
};
|
|
100
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
101
|
-
token: PathLocationStrategy,
|
|
102
|
-
factory: PathLocationStrategy.ɵfac,
|
|
103
|
-
providedIn: 'root'
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
(() => {
|
|
107
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PathLocationStrategy, [{
|
|
108
|
-
type: Injectable,
|
|
109
|
-
args: [{
|
|
110
|
-
providedIn: 'root'
|
|
111
|
-
}]
|
|
112
|
-
}], () => [{
|
|
113
|
-
type: PlatformLocation
|
|
114
|
-
}, {
|
|
115
|
-
type: undefined,
|
|
116
|
-
decorators: [{
|
|
117
|
-
type: Optional
|
|
118
|
-
}, {
|
|
119
|
-
type: Inject,
|
|
120
|
-
args: [APP_BASE_HREF]
|
|
121
|
-
}]
|
|
122
|
-
}], null);
|
|
123
|
-
})();
|
|
124
|
-
class NoTrailingSlashPathLocationStrategy extends PathLocationStrategy {
|
|
125
|
-
prepareExternalUrl(internal) {
|
|
126
|
-
const path = extractUrlPath(internal);
|
|
127
|
-
if (path.endsWith('/') && path.length > 1) {
|
|
128
|
-
internal = path.slice(0, -1) + internal.slice(path.length);
|
|
129
|
-
}
|
|
130
|
-
return super.prepareExternalUrl(internal);
|
|
131
|
-
}
|
|
132
|
-
static ɵfac = /* @__PURE__ */(() => {
|
|
133
|
-
let ɵNoTrailingSlashPathLocationStrategy_BaseFactory;
|
|
134
|
-
return function NoTrailingSlashPathLocationStrategy_Factory(__ngFactoryType__) {
|
|
135
|
-
return (ɵNoTrailingSlashPathLocationStrategy_BaseFactory || (ɵNoTrailingSlashPathLocationStrategy_BaseFactory = i0.ɵɵgetInheritedFactory(NoTrailingSlashPathLocationStrategy)))(__ngFactoryType__ || NoTrailingSlashPathLocationStrategy);
|
|
136
|
-
};
|
|
137
|
-
})();
|
|
138
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
139
|
-
token: NoTrailingSlashPathLocationStrategy,
|
|
140
|
-
factory: NoTrailingSlashPathLocationStrategy.ɵfac,
|
|
141
|
-
providedIn: 'root'
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
(() => {
|
|
145
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NoTrailingSlashPathLocationStrategy, [{
|
|
146
|
-
type: Injectable,
|
|
147
|
-
args: [{
|
|
148
|
-
providedIn: 'root'
|
|
149
|
-
}]
|
|
150
|
-
}], null, null);
|
|
151
|
-
})();
|
|
152
|
-
class TrailingSlashPathLocationStrategy extends PathLocationStrategy {
|
|
153
|
-
prepareExternalUrl(internal) {
|
|
154
|
-
const path = extractUrlPath(internal);
|
|
155
|
-
if (!path.endsWith('/')) {
|
|
156
|
-
internal = path + '/' + internal.slice(path.length);
|
|
157
|
-
}
|
|
158
|
-
return super.prepareExternalUrl(internal);
|
|
159
|
-
}
|
|
160
|
-
static ɵfac = /* @__PURE__ */(() => {
|
|
161
|
-
let ɵTrailingSlashPathLocationStrategy_BaseFactory;
|
|
162
|
-
return function TrailingSlashPathLocationStrategy_Factory(__ngFactoryType__) {
|
|
163
|
-
return (ɵTrailingSlashPathLocationStrategy_BaseFactory || (ɵTrailingSlashPathLocationStrategy_BaseFactory = i0.ɵɵgetInheritedFactory(TrailingSlashPathLocationStrategy)))(__ngFactoryType__ || TrailingSlashPathLocationStrategy);
|
|
164
|
-
};
|
|
165
|
-
})();
|
|
166
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
167
|
-
token: TrailingSlashPathLocationStrategy,
|
|
168
|
-
factory: TrailingSlashPathLocationStrategy.ɵfac,
|
|
169
|
-
providedIn: 'root'
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
(() => {
|
|
173
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TrailingSlashPathLocationStrategy, [{
|
|
174
|
-
type: Injectable,
|
|
175
|
-
args: [{
|
|
176
|
-
providedIn: 'root'
|
|
177
|
-
}]
|
|
178
|
-
}], null, null);
|
|
179
|
-
})();
|
|
180
|
-
function extractUrlPath(url) {
|
|
181
|
-
const questionMarkOrHashIndex = url.search(/[?#]/);
|
|
182
|
-
const pathEnd = questionMarkOrHashIndex > -1 ? questionMarkOrHashIndex : url.length;
|
|
183
|
-
return url.slice(0, pathEnd);
|
|
184
|
-
}
|
|
185
|
-
class Location {
|
|
186
|
-
_subject = new Subject();
|
|
187
|
-
_basePath;
|
|
188
|
-
_locationStrategy;
|
|
189
|
-
_urlChangeListeners = [];
|
|
190
|
-
_urlChangeSubscription = null;
|
|
191
|
-
constructor(locationStrategy) {
|
|
192
|
-
this._locationStrategy = locationStrategy;
|
|
193
|
-
const baseHref = this._locationStrategy.getBaseHref();
|
|
194
|
-
this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));
|
|
195
|
-
this._locationStrategy.onPopState(ev => {
|
|
196
|
-
this._subject.next({
|
|
197
|
-
'url': this.path(true),
|
|
198
|
-
'pop': true,
|
|
199
|
-
'state': ev.state,
|
|
200
|
-
'type': ev.type
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
ngOnDestroy() {
|
|
205
|
-
this._urlChangeSubscription?.unsubscribe();
|
|
206
|
-
this._urlChangeListeners = [];
|
|
207
|
-
}
|
|
208
|
-
path(includeHash = false) {
|
|
209
|
-
return this.normalize(this._locationStrategy.path(includeHash));
|
|
210
|
-
}
|
|
211
|
-
getState() {
|
|
212
|
-
return this._locationStrategy.getState();
|
|
213
|
-
}
|
|
214
|
-
isCurrentPathEqualTo(path, query = '') {
|
|
215
|
-
return this.path() == this.normalize(path + normalizeQueryParams(query));
|
|
216
|
-
}
|
|
217
|
-
normalize(url) {
|
|
218
|
-
return Location.stripTrailingSlash(_stripBasePath(this._basePath, _stripIndexHtml(url)));
|
|
219
|
-
}
|
|
220
|
-
prepareExternalUrl(url) {
|
|
221
|
-
if (url && url[0] !== '/') {
|
|
222
|
-
url = '/' + url;
|
|
223
|
-
}
|
|
224
|
-
return this._locationStrategy.prepareExternalUrl(url);
|
|
225
|
-
}
|
|
226
|
-
go(path, query = '', state = null) {
|
|
227
|
-
this._locationStrategy.pushState(state, '', path, query);
|
|
228
|
-
this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
|
|
229
|
-
}
|
|
230
|
-
replaceState(path, query = '', state = null) {
|
|
231
|
-
this._locationStrategy.replaceState(state, '', path, query);
|
|
232
|
-
this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
|
|
233
|
-
}
|
|
234
|
-
forward() {
|
|
235
|
-
this._locationStrategy.forward();
|
|
236
|
-
}
|
|
237
|
-
back() {
|
|
238
|
-
this._locationStrategy.back();
|
|
239
|
-
}
|
|
240
|
-
historyGo(relativePosition = 0) {
|
|
241
|
-
this._locationStrategy.historyGo?.(relativePosition);
|
|
242
|
-
}
|
|
243
|
-
onUrlChange(fn) {
|
|
244
|
-
this._urlChangeListeners.push(fn);
|
|
245
|
-
this._urlChangeSubscription ??= this.subscribe(v => {
|
|
246
|
-
this._notifyUrlChangeListeners(v.url, v.state);
|
|
247
|
-
});
|
|
248
|
-
return () => {
|
|
249
|
-
const fnIndex = this._urlChangeListeners.indexOf(fn);
|
|
250
|
-
this._urlChangeListeners.splice(fnIndex, 1);
|
|
251
|
-
if (this._urlChangeListeners.length === 0) {
|
|
252
|
-
this._urlChangeSubscription?.unsubscribe();
|
|
253
|
-
this._urlChangeSubscription = null;
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
_notifyUrlChangeListeners(url = '', state) {
|
|
258
|
-
this._urlChangeListeners.forEach(fn => fn(url, state));
|
|
259
|
-
}
|
|
260
|
-
subscribe(onNext, onThrow, onReturn) {
|
|
261
|
-
return this._subject.subscribe({
|
|
262
|
-
next: onNext,
|
|
263
|
-
error: onThrow ?? undefined,
|
|
264
|
-
complete: onReturn ?? undefined
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
static normalizeQueryParams = normalizeQueryParams;
|
|
268
|
-
static joinWithSlash = joinWithSlash;
|
|
269
|
-
static stripTrailingSlash = stripTrailingSlash;
|
|
270
|
-
static ɵfac = function Location_Factory(__ngFactoryType__) {
|
|
271
|
-
return new (__ngFactoryType__ || Location)(i0.ɵɵinject(LocationStrategy));
|
|
272
|
-
};
|
|
273
|
-
static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({
|
|
274
|
-
token: Location,
|
|
275
|
-
factory: () => createLocation(),
|
|
276
|
-
providedIn: 'root'
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
(() => {
|
|
280
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Location, [{
|
|
281
|
-
type: Injectable,
|
|
282
|
-
args: [{
|
|
283
|
-
providedIn: 'root',
|
|
284
|
-
useFactory: createLocation
|
|
285
|
-
}]
|
|
286
|
-
}], () => [{
|
|
287
|
-
type: LocationStrategy
|
|
288
|
-
}], null);
|
|
289
|
-
})();
|
|
290
|
-
function createLocation() {
|
|
291
|
-
return new Location(__inject(LocationStrategy));
|
|
292
|
-
}
|
|
293
|
-
function _stripBasePath(basePath, url) {
|
|
294
|
-
if (!basePath || !url.startsWith(basePath)) {
|
|
295
|
-
return url;
|
|
296
|
-
}
|
|
297
|
-
const strippedUrl = url.substring(basePath.length);
|
|
298
|
-
if (strippedUrl === '' || ['/', ';', '?', '#'].includes(strippedUrl[0])) {
|
|
299
|
-
return strippedUrl;
|
|
300
|
-
}
|
|
301
|
-
return url;
|
|
302
|
-
}
|
|
303
|
-
function _stripIndexHtml(url) {
|
|
304
|
-
return url.replace(/\/index.html$/, '');
|
|
305
|
-
}
|
|
306
|
-
function _stripOrigin(baseHref) {
|
|
307
|
-
const isAbsoluteUrl = new RegExp('^(https?:)?//').test(baseHref);
|
|
308
|
-
if (isAbsoluteUrl) {
|
|
309
|
-
const [, pathname] = baseHref.split(/\/\/[^\/]+/);
|
|
310
|
-
return pathname;
|
|
311
|
-
}
|
|
312
|
-
return baseHref;
|
|
313
|
-
}
|
|
314
|
-
export { APP_BASE_HREF, Location, LocationStrategy, NoTrailingSlashPathLocationStrategy, PathLocationStrategy, TrailingSlashPathLocationStrategy, joinWithSlash, normalizeQueryParams };
|