@angular-wave/angular.ts 0.7.7 → 0.7.8
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/@types/animations/raf-scheduler.d.ts +2 -2
- package/@types/animations/shared.d.ts +0 -1
- package/@types/core/compile/attributes.d.ts +3 -3
- package/@types/core/compile/compile.d.ts +1 -1
- package/@types/core/di/injector.d.ts +0 -1
- package/@types/core/di/internal-injector.d.ts +1 -0
- package/@types/core/di/ng-module.d.ts +5 -0
- package/@types/core/filter/filter.d.ts +11 -13
- package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
- package/@types/core/scope/scope.d.ts +1 -1
- package/@types/directive/attrs/attrs.d.ts +7 -1
- package/@types/directive/events/events.d.ts +9 -3
- package/@types/directive/http/http.d.ts +6 -2
- package/@types/directive/include/include.d.ts +2 -2
- package/@types/directive/input/input.d.ts +2 -12
- package/@types/directive/messages/messages.d.ts +9 -48
- package/@types/directive/model/model.d.ts +3 -3
- package/@types/directive/options/options.d.ts +13 -20
- package/@types/directive/switch/switch.d.ts +1 -0
- package/@types/directive/transclude/transclude.d.ts +10 -6
- package/@types/interface.d.ts +54 -18
- package/@types/router/common/glob.d.ts +5 -1
- package/@types/router/directives/view-directive.d.ts +2 -19
- package/@types/router/globals.d.ts +1 -2
- package/@types/router/state/state-registry.d.ts +1 -2
- package/@types/router/url/url-service.d.ts +7 -9
- package/@types/services/anchor-scroll.d.ts +1 -1
- package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
- package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
- package/@types/services/http/http.d.ts +0 -2
- package/@types/services/http/interface.d.ts +2 -2
- package/@types/services/http-backend/http-backend.d.ts +13 -21
- package/@types/services/location/interface.d.ts +8 -0
- package/@types/{core → services}/location/location.d.ts +52 -12
- package/@types/{core → services}/sce/sce.d.ts +1 -1
- package/@types/services/template-cache/interface.d.ts +8 -2
- package/@types/services/template-cache/template-cache.d.ts +1 -1
- package/@types/services/template-request.d.ts +1 -1
- package/@types/shared/cache.d.ts +0 -2
- package/@types/shared/dom.d.ts +6 -0
- package/@types/shared/test-utils.d.ts +1 -0
- package/@types/shared/url-utils/interface.d.ts +47 -0
- package/@types/{core → shared}/url-utils/url-utils.d.ts +26 -13
- package/@types/shared/utils.d.ts +15 -0
- package/Makefile +3 -2
- package/dist/angular-ts.esm.js +982 -1190
- package/dist/angular-ts.umd.js +982 -1190
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/content/docs/directive/bind.md +9 -7
- package/docs/content/docs/directive/get.md +203 -0
- package/docs/content/docs/provider/templateCacheProvider.md +66 -1
- package/docs/content/docs/service/templateCache.md +2 -2
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/showcss.html +2 -0
- package/docs/static/examples/ng-bind/ng-bind.html +2 -2
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/NgModule.html +32 -0
- package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
- package/docs/static/typedoc/hierarchy.html +1 -1
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/Directive.html +5 -4
- package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
- package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
- package/docs/static/typedoc/interfaces/Provider.html +15 -10
- package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
- package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
- package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
- package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
- package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
- package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
- package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
- package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
- package/docs/static/typedoc/variables/SwapMode.html +11 -0
- package/legacy.d.ts +0 -10
- package/package.json +1 -3
- package/src/animations/animate-children-directive.js +2 -2
- package/src/animations/raf-scheduler.js +1 -1
- package/src/animations/shared.js +0 -9
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +3 -3
- package/src/core/di/injector.js +4 -17
- package/src/core/di/internal-injector.js +4 -1
- package/src/core/di/ng-module.js +12 -27
- package/src/core/filter/filter.js +28 -28
- package/src/core/parse/interpreter.js +32 -38
- package/src/core/sanitize/sanitize-uri.js +3 -3
- package/src/core/scope/scope.js +2 -2
- package/src/directive/attrs/attrs.js +7 -4
- package/src/directive/events/events.js +6 -2
- package/src/directive/http/delete.spec.js +2 -0
- package/src/directive/http/get.spec.js +280 -3
- package/src/directive/http/http.js +100 -12
- package/src/directive/http/http.test.js +2 -2
- package/src/directive/http/post.spec.js +2 -0
- package/src/directive/http/put.spec.js +2 -0
- package/src/directive/include/include.js +7 -7
- package/src/directive/input/input.js +6 -28
- package/src/directive/messages/messages.js +4 -0
- package/src/directive/model/model.js +1 -1
- package/src/directive/options/options.js +454 -464
- package/src/directive/setter/setter.js +12 -14
- package/src/directive/setter/setter.spec.js +39 -16
- package/src/directive/switch/switch.js +1 -0
- package/src/directive/transclude/transclude.js +87 -89
- package/src/injection-tokens.js +1 -1
- package/src/interface.ts +68 -19
- package/src/loader.js +4 -9
- package/src/public.js +9 -15
- package/src/router/common/glob.js +5 -0
- package/src/router/directives/state-directives.spec.js +1 -1
- package/src/router/directives/view-directive.js +9 -1
- package/src/router/globals.js +0 -1
- package/src/router/state/state-registry.js +0 -1
- package/src/router/state-filters.js +2 -2
- package/src/router/url/url-service.js +5 -9
- package/src/services/anchor-scroll.html +0 -7
- package/src/services/anchor-scroll.js +1 -1
- package/src/{core → services/exception}/exception-handler.js +2 -2
- package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
- package/src/services/http/http.js +2 -13
- package/src/services/http/interface.ts +2 -2
- package/src/services/http-backend/http-backend.js +4 -14
- package/src/services/http-backend/http-backend.spec.js +1 -4
- package/src/services/location/interface.ts +8 -0
- package/src/{core → services}/location/location.html +4 -1
- package/src/{core → services}/location/location.js +128 -26
- package/src/{core → services}/location/location.spec.js +2 -2
- package/src/{core → services}/location/location.test.js +1 -1
- package/src/{core → services}/sce/sce.html +1 -1
- package/src/{core → services}/sce/sce.js +9 -3
- package/src/{core → services}/sce/sce.spec.js +2 -3
- package/src/{core → services}/sce/sce.test.js +1 -1
- package/src/services/template-cache/interface.ts +8 -2
- package/src/services/template-cache/template-cache.js +3 -1
- package/src/services/template-cache/template-cache.spec.js +72 -0
- package/src/services/template-request.js +2 -1
- package/src/shared/cache.js +0 -2
- package/src/shared/dom.js +10 -0
- package/src/shared/test-utils.js +1 -0
- package/src/shared/url-utils/interface.ts +56 -0
- package/src/{core → shared}/url-utils/url-utils.html +4 -1
- package/src/{core → shared}/url-utils/url-utils.js +26 -23
- package/src/{core → shared}/url-utils/url-utils.spec.js +0 -8
- package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
- package/src/shared/utils.js +28 -0
- package/utils/express.js +9 -1
- package/@types/core/task-tracker-factory.d.ts +0 -76
- package/@types/services/browser.d.ts +0 -101
- package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
- package/jsdoc.json +0 -22
- package/src/core/task-tracker-factory.js +0 -145
- package/src/services/browser.js +0 -212
- /package/src/{core → services}/location/location.md +0 -0
- /package/src/{core → services}/sce/sce.md +0 -0
- /package/src/{core → shared}/url-utils/url-utils.md +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export class UrlService {
|
|
5
5
|
static $inject: string[];
|
|
6
6
|
/**
|
|
7
|
-
* @param {import("../../
|
|
7
|
+
* @param {import("../../services/location/location").LocationProvider} $locationProvider
|
|
8
8
|
* @param {import("../../router/state/state-service.js").StateProvider} stateService
|
|
9
9
|
* @param globals
|
|
10
10
|
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
|
|
@@ -17,8 +17,7 @@ export class UrlService {
|
|
|
17
17
|
);
|
|
18
18
|
stateService: import("../../router/state/state-service.js").StateProvider;
|
|
19
19
|
$locationProvider: any;
|
|
20
|
-
$location: import("../../
|
|
21
|
-
$browser: import("../../services/browser.js").Browser;
|
|
20
|
+
$location: import("../../services/location/location.js").Location;
|
|
22
21
|
/** Provides services related to the URL */
|
|
23
22
|
urlRuleFactory: UrlRuleFactory;
|
|
24
23
|
/**
|
|
@@ -60,13 +59,12 @@ export class UrlService {
|
|
|
60
59
|
*
|
|
61
60
|
* @return the hash (anchor) portion of the url
|
|
62
61
|
*/
|
|
63
|
-
hash: () => string | import("../../
|
|
62
|
+
hash: () => string | import("../../services/location/location.js").Location;
|
|
64
63
|
_urlListeners: any[];
|
|
65
64
|
$get: (
|
|
66
65
|
| string
|
|
67
66
|
| ((
|
|
68
|
-
$location: import("../../
|
|
69
|
-
$browser: import("../../services/browser.js").Browser,
|
|
67
|
+
$location: import("../../services/location/location.js").Location,
|
|
70
68
|
$rootScope: import("../../core/scope/scope.js").Scope,
|
|
71
69
|
) => UrlService)
|
|
72
70
|
)[];
|
|
@@ -132,7 +130,7 @@ export class UrlService {
|
|
|
132
130
|
newUrl?: string,
|
|
133
131
|
replace?: boolean,
|
|
134
132
|
state?: any,
|
|
135
|
-
): string | import("../../
|
|
133
|
+
): string | import("../../services/location/location.js").Location;
|
|
136
134
|
/**
|
|
137
135
|
* @internal
|
|
138
136
|
*
|
|
@@ -157,7 +155,7 @@ export class UrlService {
|
|
|
157
155
|
parts(): {
|
|
158
156
|
path: any;
|
|
159
157
|
search: any;
|
|
160
|
-
hash: string | import("../../
|
|
158
|
+
hash: string | import("../../services/location/location.js").Location;
|
|
161
159
|
};
|
|
162
160
|
/**
|
|
163
161
|
* Activates the best rule for the current URL
|
|
@@ -211,7 +209,7 @@ export class UrlService {
|
|
|
211
209
|
*/
|
|
212
210
|
match(url: any): any;
|
|
213
211
|
update(read: any): void;
|
|
214
|
-
location: string | import("../../
|
|
212
|
+
location: string | import("../../services/location/location.js").Location;
|
|
215
213
|
/**
|
|
216
214
|
* Internal API.
|
|
217
215
|
*
|
|
@@ -13,7 +13,7 @@ export class AnchorScrollProvider {
|
|
|
13
13
|
$get: (
|
|
14
14
|
| string
|
|
15
15
|
| ((
|
|
16
|
-
$location: import("../
|
|
16
|
+
$location: import("../services/location/location.js").Location,
|
|
17
17
|
$rootScope: import("../core/scope/scope.js").Scope,
|
|
18
18
|
) => AnchorScrollFunction)
|
|
19
19
|
)[];
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
*
|
|
42
42
|
* @see {@link angular.ErrorHandler AngularTS ErrorHandler}
|
|
43
43
|
*/
|
|
44
|
-
/** @typedef {import('../
|
|
45
|
-
/** @typedef {import("./
|
|
44
|
+
/** @typedef {import('../log/interface.ts').LogService} LogService */
|
|
45
|
+
/** @typedef {import("./interface.ts").Interface} ErrorHandler */
|
|
46
46
|
/**
|
|
47
47
|
* Provider for `$exceptionHandler` service. Delegates uncaught exceptions to `$log.error()` by default.
|
|
48
48
|
* Can be overridden to implement custom error-handling logic.
|
|
@@ -54,5 +54,5 @@ export class ExceptionHandlerProvider {
|
|
|
54
54
|
errorHandler: ErrorHandler;
|
|
55
55
|
$get: (string | (($log: LogService) => ErrorHandler))[];
|
|
56
56
|
}
|
|
57
|
-
export type LogService = import("../
|
|
58
|
-
export type ErrorHandler = import("./
|
|
57
|
+
export type LogService = import("../log/interface.ts").LogService;
|
|
58
|
+
export type ErrorHandler = import("./interface.ts").Interface;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param exception - The exception associated with the error.
|
|
5
5
|
* @param [cause] - Optional information about the context in which the error was thrown.
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type Interface = (exception: Error, cause?: string) => void;
|
|
@@ -126,14 +126,14 @@ export interface RequestConfig extends RequestShortcutConfig {
|
|
|
126
126
|
}
|
|
127
127
|
| undefined;
|
|
128
128
|
}
|
|
129
|
+
export type HttpResponseStatus = "complete" | "error" | "timeout" | "abort";
|
|
129
130
|
export interface HttpResponse<T> {
|
|
130
131
|
data: T;
|
|
131
132
|
status: number;
|
|
132
133
|
headers: HttpHeadersGetter;
|
|
133
134
|
config: RequestConfig;
|
|
134
135
|
statusText: string;
|
|
135
|
-
|
|
136
|
-
xhrStatus: "complete" | "error" | "timeout" | "abort";
|
|
136
|
+
xhrStatus: HttpResponseStatus;
|
|
137
137
|
}
|
|
138
138
|
export type HttpPromise<T> = Promise<HttpResponse<T>>;
|
|
139
139
|
/**
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {import('../browser.js').Browser} $browser
|
|
3
2
|
* @returns
|
|
4
3
|
*/
|
|
5
|
-
export function createHttpBackend(
|
|
6
|
-
$browser: import("../browser.js").Browser,
|
|
7
|
-
): (
|
|
4
|
+
export function createHttpBackend(): (
|
|
8
5
|
method: any,
|
|
9
6
|
url: any,
|
|
10
7
|
post: any,
|
|
@@ -33,21 +30,16 @@ export function createHttpBackend(
|
|
|
33
30
|
*
|
|
34
31
|
*/
|
|
35
32
|
export class HttpBackendProvider {
|
|
36
|
-
$get: (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
responseType: any,
|
|
49
|
-
eventHandlers: any,
|
|
50
|
-
uploadEventHandlers: any,
|
|
51
|
-
) => void)
|
|
52
|
-
)[];
|
|
33
|
+
$get: (() => (
|
|
34
|
+
method: any,
|
|
35
|
+
url: any,
|
|
36
|
+
post: any,
|
|
37
|
+
callback: any,
|
|
38
|
+
headers: any,
|
|
39
|
+
timeout: any,
|
|
40
|
+
withCredentials: any,
|
|
41
|
+
responseType: any,
|
|
42
|
+
eventHandlers: any,
|
|
43
|
+
uploadEventHandlers: any,
|
|
44
|
+
) => void)[];
|
|
53
45
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A callback function that gets called when the browser URL or state changes.
|
|
3
|
+
*
|
|
4
|
+
* @param url - The new URL after the change (with trailing `#` removed).
|
|
5
|
+
* @param state - The new history state associated with the URL (`history.state`).
|
|
6
|
+
* @returns void
|
|
7
|
+
*/
|
|
8
|
+
export type UrlChangeListener = (url: string, state: History["state"]) => void;
|
|
@@ -37,8 +37,8 @@ export class Location {
|
|
|
37
37
|
* @type {boolean}
|
|
38
38
|
*/
|
|
39
39
|
$$replace: boolean;
|
|
40
|
-
/** @type {
|
|
41
|
-
$$protocol:
|
|
40
|
+
/** @type {string} */
|
|
41
|
+
$$protocol: string;
|
|
42
42
|
/** @type {string} */
|
|
43
43
|
$$host: string;
|
|
44
44
|
/**
|
|
@@ -81,9 +81,9 @@ export class Location {
|
|
|
81
81
|
/**
|
|
82
82
|
*
|
|
83
83
|
* Return protocol of current URL.
|
|
84
|
-
* @return {
|
|
84
|
+
* @return {string} protocol of current URL
|
|
85
85
|
*/
|
|
86
|
-
protocol():
|
|
86
|
+
protocol(): string;
|
|
87
87
|
/**
|
|
88
88
|
* This method is getter only.
|
|
89
89
|
*
|
|
@@ -227,14 +227,15 @@ export class LocationHtml5Url extends Location {
|
|
|
227
227
|
* This object is exposed as $location service when developer doesn't opt into html5 mode.
|
|
228
228
|
* It also serves as the base class for html5 mode fallback on legacy browsers.
|
|
229
229
|
*
|
|
230
|
-
* @constructor
|
|
231
|
-
* @param {string} appBase application base URL
|
|
232
|
-
* @param {string} appBaseNoFile application base URL stripped of any filename
|
|
233
|
-
* @param {string} hashPrefix hashbang prefix
|
|
234
230
|
*/
|
|
235
231
|
export class LocationHashbangUrl extends Location {
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
/**
|
|
233
|
+
* @param {string} appBase application base URL
|
|
234
|
+
* @param {string} appBaseNoFile application base URL stripped of any filename
|
|
235
|
+
* @param {string} hashPrefix hashbang prefix
|
|
236
|
+
*/
|
|
237
|
+
constructor(appBase: string, appBaseNoFile: string, hashPrefix: string);
|
|
238
|
+
hashPrefix: string;
|
|
238
239
|
/**
|
|
239
240
|
* Parse given hashbang URL into properties
|
|
240
241
|
* @param {string} url Hashbang URL
|
|
@@ -252,6 +253,46 @@ export class LocationProvider {
|
|
|
252
253
|
hashPrefixConf: string;
|
|
253
254
|
/** @type {Html5Mode} */
|
|
254
255
|
html5ModeConf: Html5Mode;
|
|
256
|
+
/** @type {Array<import("./interface.js").UrlChangeListener>} */
|
|
257
|
+
urlChangeListeners: Array<import("./interface.js").UrlChangeListener>;
|
|
258
|
+
urlChangeInit: boolean;
|
|
259
|
+
/** @type {History['state']} */
|
|
260
|
+
cachedState: History["state"];
|
|
261
|
+
/** @typeof {History.state} */
|
|
262
|
+
lastHistoryState: any;
|
|
263
|
+
/** @type {string} */
|
|
264
|
+
lastBrowserUrl: string;
|
|
265
|
+
setUrl(url: any, state: any): this;
|
|
266
|
+
/**
|
|
267
|
+
* Returns the current URL with any empty hash (`#`) removed.
|
|
268
|
+
* @return {string}
|
|
269
|
+
*/
|
|
270
|
+
getUrl(): string;
|
|
271
|
+
/**
|
|
272
|
+
* Returns the cached state.
|
|
273
|
+
* @returns {History['state']} The cached state.
|
|
274
|
+
*/
|
|
275
|
+
state(): History["state"];
|
|
276
|
+
/**
|
|
277
|
+
* Caches the current state.
|
|
278
|
+
*
|
|
279
|
+
* @private
|
|
280
|
+
*/
|
|
281
|
+
private cacheState;
|
|
282
|
+
lastCachedState: any;
|
|
283
|
+
/**
|
|
284
|
+
* Fires the state or URL change event.
|
|
285
|
+
*
|
|
286
|
+
* @private
|
|
287
|
+
*/
|
|
288
|
+
private fireStateOrUrlChange;
|
|
289
|
+
/**
|
|
290
|
+
* Registers a callback to be called when the URL changes.
|
|
291
|
+
*
|
|
292
|
+
* @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
|
|
293
|
+
* @returns void
|
|
294
|
+
*/
|
|
295
|
+
onUrlChange(callback: import("./interface.js").UrlChangeListener): void;
|
|
255
296
|
/**
|
|
256
297
|
* The default value for the prefix is `'!'`.
|
|
257
298
|
* @param {string=} prefix Prefix for hash part (containing path and search)
|
|
@@ -278,8 +319,7 @@ export class LocationProvider {
|
|
|
278
319
|
$get: (
|
|
279
320
|
| string
|
|
280
321
|
| ((
|
|
281
|
-
$rootScope: import("
|
|
282
|
-
$browser: any,
|
|
322
|
+
$rootScope: import("../../core/scope/scope.js").Scope,
|
|
283
323
|
$rootElement: Element,
|
|
284
324
|
) => Location)
|
|
285
325
|
)[];
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A cache for mapping template
|
|
2
|
+
* A cache interface for mapping template urls to their XHR responses.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export interface TemplateCache {
|
|
5
|
+
get(key: string): any | undefined;
|
|
6
|
+
set(key: string, value: any): this;
|
|
7
|
+
has(key: string): boolean;
|
|
8
|
+
delete(key: string): boolean;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}
|
|
@@ -43,7 +43,7 @@ export class TemplateRequestProvider {
|
|
|
43
43
|
$get: (
|
|
44
44
|
| string
|
|
45
45
|
| ((
|
|
46
|
-
$exceptionHandler: import("
|
|
46
|
+
$exceptionHandler: import("./exception/exception-handler.js").ErrorHandler,
|
|
47
47
|
$templateCache: import("../services/template-cache/interface.ts").TemplateCache,
|
|
48
48
|
$http: any,
|
|
49
49
|
$sce: any,
|
package/@types/shared/cache.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Expando cache for adding properties to DOM nodes with JavaScript.
|
|
3
3
|
* This used to be an Object in JQLite decorator, but swapped out for a Map
|
|
4
|
-
* for performance reasons and convenience methods. A proxy is available for
|
|
5
|
-
* additional logic handling.
|
|
6
4
|
*
|
|
7
5
|
* @type {Map<number, import('../interface.ts').ExpandoStore>}
|
|
8
6
|
*/
|
package/@types/shared/dom.d.ts
CHANGED
|
@@ -240,6 +240,12 @@ export function domInsert(
|
|
|
240
240
|
parentElement: any,
|
|
241
241
|
afterElement: any,
|
|
242
242
|
): void;
|
|
243
|
+
/**
|
|
244
|
+
* Returns the base href of the document.
|
|
245
|
+
*
|
|
246
|
+
* @returns {string} The base href.
|
|
247
|
+
*/
|
|
248
|
+
export function getBaseHref(): string;
|
|
243
249
|
/**
|
|
244
250
|
* A list of boolean attributes in HTML.
|
|
245
251
|
* @type {string[]}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export function browserTrigger(element: HTMLElement, options: any): void;
|
|
7
7
|
/**
|
|
8
8
|
* Delays execution for a specified number of milliseconds.
|
|
9
|
+
* TODO remove
|
|
9
10
|
*
|
|
10
11
|
* @param {number} [t=0] - The number of milliseconds to wait. Defaults to 0.
|
|
11
12
|
* @returns {Promise<void>} A promise that resolves after the delay.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type HttpProtocol = "http" | "https";
|
|
2
|
+
/**
|
|
3
|
+
* A normalized representation of a parsed URL.
|
|
4
|
+
*/
|
|
5
|
+
export interface ParsedUrl {
|
|
6
|
+
/**
|
|
7
|
+
* The full URL string, including protocol, host, path, query, and hash.
|
|
8
|
+
* Example: "https://example.com:8080/path?query=1#section"
|
|
9
|
+
*/
|
|
10
|
+
href: string;
|
|
11
|
+
/**
|
|
12
|
+
* The protocol scheme of the URL, without the trailing colon.
|
|
13
|
+
* Example: "http" or "https"
|
|
14
|
+
*/
|
|
15
|
+
protocol: string;
|
|
16
|
+
/**
|
|
17
|
+
* The host part of the URL, including hostname and port (if specified).
|
|
18
|
+
* Example: "example.com:8080"
|
|
19
|
+
*/
|
|
20
|
+
host: string;
|
|
21
|
+
/**
|
|
22
|
+
* The query string portion of the URL, without the leading "?".
|
|
23
|
+
* Example: "query=1&sort=asc"
|
|
24
|
+
*/
|
|
25
|
+
search: string;
|
|
26
|
+
/**
|
|
27
|
+
* The fragment identifier (hash) of the URL, without the leading "#".
|
|
28
|
+
* Example: "section2"
|
|
29
|
+
*/
|
|
30
|
+
hash: string;
|
|
31
|
+
/**
|
|
32
|
+
* The domain or IP address (including IPv6 in brackets) of the URL.
|
|
33
|
+
* Example: "example.com" or "[::1]"
|
|
34
|
+
*/
|
|
35
|
+
hostname: string;
|
|
36
|
+
/**
|
|
37
|
+
* The port number of the URL as a string, or an empty string if not specified.
|
|
38
|
+
* Example: "8080" or ""
|
|
39
|
+
*/
|
|
40
|
+
port: string;
|
|
41
|
+
/**
|
|
42
|
+
* The path of the URL, always beginning with a leading slash.
|
|
43
|
+
* Example: "/path/to/resource"
|
|
44
|
+
*/
|
|
45
|
+
pathname: string;
|
|
46
|
+
}
|
|
47
|
+
export type ResolvableUrl = string | ParsedUrl;
|
|
@@ -1,49 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("./interface.js").ResolvableUrl} url
|
|
3
|
+
* @return {import("./interface.js").ParsedUrl}
|
|
4
|
+
*/
|
|
5
|
+
export function urlResolve(
|
|
6
|
+
url: import("./interface.js").ResolvableUrl,
|
|
7
|
+
): import("./interface.js").ParsedUrl;
|
|
2
8
|
/**
|
|
3
9
|
* Parse a request URL and determine whether this is a same-origin request as the application
|
|
4
10
|
* document.
|
|
5
11
|
*
|
|
6
|
-
* @param {
|
|
12
|
+
* @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
|
|
7
13
|
* or a parsed URL object.
|
|
8
14
|
* @returns {boolean} Whether the request is for the same origin as the application document.
|
|
9
15
|
*/
|
|
10
|
-
export function urlIsSameOrigin(
|
|
16
|
+
export function urlIsSameOrigin(
|
|
17
|
+
requestUrl: import("./interface.js").ResolvableUrl,
|
|
18
|
+
): boolean;
|
|
11
19
|
/**
|
|
12
20
|
* Parse a request URL and determine whether it is same-origin as the current document base URL.
|
|
13
21
|
*
|
|
14
22
|
* Note: The base URL is usually the same as the document location (`location.href`) but can
|
|
15
23
|
* be overriden by using the `<base>` tag.
|
|
16
24
|
*
|
|
17
|
-
* @param {
|
|
25
|
+
* @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
|
|
18
26
|
* or a parsed URL object.
|
|
19
27
|
* @returns {boolean} Whether the URL is same-origin as the document base URL.
|
|
20
28
|
*/
|
|
21
|
-
export function urlIsSameOriginAsBaseUrl(
|
|
29
|
+
export function urlIsSameOriginAsBaseUrl(
|
|
30
|
+
requestUrl: import("./interface.js").ResolvableUrl,
|
|
31
|
+
): boolean;
|
|
22
32
|
/**
|
|
23
33
|
* Create a function that can check a URL's origin against a list of allowed/trusted origins.
|
|
24
34
|
* The current location's origin is implicitly trusted.
|
|
25
35
|
*
|
|
26
36
|
* @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
|
|
27
37
|
*
|
|
28
|
-
* @returns {
|
|
38
|
+
* @returns {(url: import("./interface.js").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
|
|
29
39
|
* whether it is of an allowed origin.
|
|
30
40
|
*/
|
|
31
41
|
export function urlIsAllowedOriginFactory(
|
|
32
42
|
trustedOriginUrls: string[],
|
|
33
|
-
):
|
|
43
|
+
): (url: import("./interface.js").ResolvableUrl) => boolean;
|
|
34
44
|
/**
|
|
35
45
|
* Determine if two URLs share the same origin.
|
|
36
46
|
*
|
|
37
|
-
* @param {
|
|
47
|
+
* @param {import("./interface.js").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
|
|
38
48
|
* a dictionary object returned by `urlResolve()`.
|
|
39
|
-
* @param {
|
|
49
|
+
* @param {import("./interface.js").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
|
|
40
50
|
* of a dictionary object returned by `urlResolve()`.
|
|
41
51
|
*
|
|
42
52
|
* @returns {boolean} - True if both URLs have the same origin, and false otherwise.
|
|
43
53
|
*/
|
|
44
54
|
export function urlsAreSameOrigin(
|
|
45
|
-
url1:
|
|
46
|
-
url2:
|
|
55
|
+
url1: import("./interface.js").ResolvableUrl,
|
|
56
|
+
url2: import("./interface.js").ResolvableUrl,
|
|
47
57
|
): boolean;
|
|
48
58
|
/**
|
|
49
59
|
* Returns the current document base URL.
|
|
@@ -51,6 +61,9 @@ export function urlsAreSameOrigin(
|
|
|
51
61
|
*/
|
|
52
62
|
export function getBaseUrl(): string;
|
|
53
63
|
/**
|
|
54
|
-
*
|
|
64
|
+
* Removes a trailing hash ('#') from the given URL if it exists.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} url
|
|
67
|
+
* @returns {string}
|
|
55
68
|
*/
|
|
56
|
-
export
|
|
69
|
+
export function trimEmptyHash(url: string): string;
|
package/@types/shared/utils.d.ts
CHANGED
|
@@ -533,6 +533,21 @@ export function hasOwn(obj: object, key: string | number | symbol): boolean;
|
|
|
533
533
|
* @returns {Function} A new function that will call `fn` only once.
|
|
534
534
|
*/
|
|
535
535
|
export function callBackOnce(fn: Function): Function;
|
|
536
|
+
/**
|
|
537
|
+
* Wraps a function so it will only be called starting from the second invocation.
|
|
538
|
+
* The first call does nothing and returns undefined.
|
|
539
|
+
*
|
|
540
|
+
* @param {Function} fn - The function to wrap.
|
|
541
|
+
* @returns {Function} A new function that will skip the first call.
|
|
542
|
+
*/
|
|
543
|
+
export function callBackAfterFirst(fn: Function): Function;
|
|
544
|
+
/**
|
|
545
|
+
* Delays execution for a specified number of milliseconds.
|
|
546
|
+
*
|
|
547
|
+
* @param {number} [t=0] - The number of milliseconds to wait. Defaults to 0.
|
|
548
|
+
* @returns {Promise<void>} A promise that resolves after the delay.
|
|
549
|
+
*/
|
|
550
|
+
export function wait(t?: number): Promise<void>;
|
|
536
551
|
export const isProxySymbol: unique symbol;
|
|
537
552
|
export const ngAttrPrefixes: string[];
|
|
538
553
|
/**
|
package/Makefile
CHANGED
|
@@ -28,10 +28,11 @@ types:
|
|
|
28
28
|
@rm -rf @types
|
|
29
29
|
@echo "Generating *.d.ts"
|
|
30
30
|
@npx -p typescript tsc --project tsconfig.types.json
|
|
31
|
+
$(MAKE) pretty
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
TYPEDOC_DIR = docs/static/typedoc
|
|
34
|
-
|
|
35
|
+
doc: types
|
|
35
36
|
@rm -rf $(TYPEDOC_DIR)
|
|
36
37
|
@npm run generate-docs
|
|
37
38
|
@npx prettier ./typedoc --write
|
|
@@ -40,7 +41,7 @@ typedoc: types pretty
|
|
|
40
41
|
serve:
|
|
41
42
|
@npm run serve
|
|
42
43
|
|
|
43
|
-
prepare-release: test check types
|
|
44
|
+
prepare-release: test check types doc pretty build
|
|
44
45
|
|
|
45
46
|
PLAYWRIGHT_TEST := npx playwright test
|
|
46
47
|
|