@angular-wave/angular.ts 0.0.60 → 0.0.62

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.
Files changed (128) hide show
  1. package/README.md +1 -1
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +2 -1
  5. package/src/angular.spec.js +2 -2
  6. package/src/core/parser/parse.js +14 -0
  7. package/src/core/parser/parse.spec.js +7 -5
  8. package/src/core/parser/parser.js +1 -1
  9. package/src/core/q/q.js +46 -289
  10. package/src/core/q/q.md +229 -0
  11. package/src/core/sanitize/sanitize-uri.js +2 -3
  12. package/src/core/scope/scope.js +18 -8
  13. package/src/directive/if/if.js +6 -1
  14. package/src/filters/limit-to.js +5 -2
  15. package/src/filters/order-by.js +1 -2
  16. package/src/index.js +1 -1
  17. package/src/loader.js +1 -55
  18. package/src/router/params/param-type.js +2 -1
  19. package/src/router/state/views.js +3 -0
  20. package/src/router/state-provider.js +1 -1
  21. package/src/router/transition/reject-factory.js +1 -0
  22. package/src/router/url/url-rule.js +1 -1
  23. package/src/router/url/url-service.js +4 -4
  24. package/src/router/url/url-service.spec.js +4 -3
  25. package/src/services/http/http.js +7 -5
  26. package/src/services/template-request.js +2 -7
  27. package/src/shared/common.js +1 -1
  28. package/src/shared/utils.js +2 -11
  29. package/src/types.js +9 -1
  30. package/types/core/parser/parse.d.ts +3 -4
  31. package/types/core/parser/parser.d.ts +1 -1
  32. package/types/core/q/q.d.ts +2 -2
  33. package/types/core/sanitize/sanitize-uri.d.ts +4 -5
  34. package/types/core/scope/scope.d.ts +19 -7
  35. package/types/index.d.ts +5 -1
  36. package/types/loader.d.ts +0 -52
  37. package/types/router/params/param-type.d.ts +2 -1
  38. package/types/router/state/views.d.ts +2 -0
  39. package/types/router/state-provider.d.ts +1 -1
  40. package/types/router/transition/reject-factory.d.ts +1 -0
  41. package/types/router/url/url-rule.d.ts +0 -1
  42. package/types/router/url/url-service.d.ts +7 -7
  43. package/types/services/template-request.d.ts +4 -9
  44. package/types/shared/utils.d.ts +1 -7
  45. package/types/types.d.ts +6 -1
  46. package/types-back/README.md +0 -2
  47. package/types-back/angular.d.ts +0 -146
  48. package/types-back/index.d.ts +0 -2126
  49. package/types-back/jqlite.d.ts +0 -374
  50. package/types-back/router/core/common/common.d.ts +0 -416
  51. package/types-back/router/core/common/coreservices.d.ts +0 -77
  52. package/types-back/router/core/common/glob.d.ts +0 -60
  53. package/types-back/router/core/common/hof.d.ts +0 -168
  54. package/types-back/router/core/common/index.d.ts +0 -8
  55. package/types-back/router/core/common/predicates.d.ts +0 -25
  56. package/types-back/router/core/common/queue.d.ts +0 -15
  57. package/types-back/router/core/common/safeConsole.d.ts +0 -5
  58. package/types-back/router/core/common/strings.d.ts +0 -66
  59. package/types-back/router/core/common/trace.d.ts +0 -126
  60. package/types-back/router/core/globals.d.ts +0 -43
  61. package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
  62. package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
  63. package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
  64. package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
  65. package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
  66. package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
  67. package/types-back/router/core/hooks/resolve.d.ts +0 -11
  68. package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
  69. package/types-back/router/core/hooks/url.d.ts +0 -4
  70. package/types-back/router/core/hooks/views.d.ts +0 -7
  71. package/types-back/router/core/index.d.ts +0 -11
  72. package/types-back/router/core/interface.d.ts +0 -91
  73. package/types-back/router/core/params/index.d.ts +0 -12
  74. package/types-back/router/core/params/interface.d.ts +0 -606
  75. package/types-back/router/core/params/param.d.ts +0 -77
  76. package/types-back/router/core/params/paramType.d.ts +0 -65
  77. package/types-back/router/core/params/paramTypes.d.ts +0 -193
  78. package/types-back/router/core/params/stateParams.d.ts +0 -15
  79. package/types-back/router/core/path/index.d.ts +0 -2
  80. package/types-back/router/core/path/pathNode.d.ts +0 -60
  81. package/types-back/router/core/path/pathUtils.d.ts +0 -105
  82. package/types-back/router/core/resolve/index.d.ts +0 -3
  83. package/types-back/router/core/resolve/interface.d.ts +0 -210
  84. package/types-back/router/core/resolve/resolvable.d.ts +0 -75
  85. package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
  86. package/types-back/router/core/router.d.ts +0 -57
  87. package/types-back/router/core/state/index.d.ts +0 -28
  88. package/types-back/router/core/state/interface.d.ts +0 -732
  89. package/types-back/router/core/state/stateBuilder.d.ts +0 -107
  90. package/types-back/router/core/state/stateMatcher.d.ts +0 -13
  91. package/types-back/router/core/state/stateObject.d.ts +0 -170
  92. package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
  93. package/types-back/router/core/state/stateRegistry.d.ts +0 -138
  94. package/types-back/router/core/state/stateService.d.ts +0 -386
  95. package/types-back/router/core/state/targetState.d.ts +0 -105
  96. package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
  97. package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
  98. package/types-back/router/core/transition/index.d.ts +0 -20
  99. package/types-back/router/core/transition/interface.d.ts +0 -862
  100. package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
  101. package/types-back/router/core/transition/transition.d.ts +0 -575
  102. package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
  103. package/types-back/router/core/transition/transitionHook.d.ts +0 -96
  104. package/types-back/router/core/transition/transitionService.d.ts +0 -253
  105. package/types-back/router/core/url/index.d.ts +0 -8
  106. package/types-back/router/core/url/interface.d.ts +0 -169
  107. package/types-back/router/core/url/urlConfig.d.ts +0 -144
  108. package/types-back/router/core/url/urlMatcher.d.ts +0 -185
  109. package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
  110. package/types-back/router/core/url/urlRouter.d.ts +0 -101
  111. package/types-back/router/core/url/urlRule.d.ts +0 -143
  112. package/types-back/router/core/url/urlRules.d.ts +0 -251
  113. package/types-back/router/core/url/urlService.d.ts +0 -205
  114. package/types-back/router/core/view/index.d.ts +0 -2
  115. package/types-back/router/core/view/interface.d.ts +0 -46
  116. package/types-back/router/core/view/view.d.ts +0 -176
  117. package/types-back/router/directives/viewDirective.d.ts +0 -144
  118. package/types-back/router/index.d.ts +0 -17
  119. package/types-back/router/interface.d.ts +0 -500
  120. package/types-back/router/legacy/resolveService.d.ts +0 -47
  121. package/types-back/router/legacy/stateEvents.d.ts +0 -124
  122. package/types-back/router/services.d.ts +0 -15
  123. package/types-back/router/stateFilters.d.ts +0 -10
  124. package/types-back/router/stateProvider.d.ts +0 -258
  125. package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
  126. package/types-back/router/statebuilders/views.d.ts +0 -53
  127. package/types-back/router/templateFactory.d.ts +0 -104
  128. package/types-back/router/viewScroll.d.ts +0 -9
@@ -1,96 +0,0 @@
1
- import { TransitionHookOptions, HookResult } from "./interface";
2
- import { Transition } from "./transition";
3
- import { TransitionEventType } from "./transitionEventType";
4
- import { RegisteredHook } from "./hookRegistry";
5
- import { StateDeclaration } from "../state/interface";
6
- export declare type GetResultHandler = (hook: TransitionHook) => ResultHandler;
7
- export declare type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;
8
- export declare type ResultHandler = (result: HookResult) => Promise<HookResult>;
9
- export declare type ErrorHandler = (error: any) => Promise<any>;
10
- export declare class TransitionHook {
11
- private transition;
12
- private stateContext;
13
- private registeredHook;
14
- private options;
15
- type: TransitionEventType;
16
- /**
17
- * These GetResultHandler(s) are used by [[invokeHook]] below
18
- * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])
19
- */
20
- static HANDLE_RESULT: GetResultHandler;
21
- /**
22
- * If the result is a promise rejection, log it.
23
- * Otherwise, ignore the result.
24
- */
25
- static LOG_REJECTED_RESULT: GetResultHandler;
26
- /**
27
- * These GetErrorHandler(s) are used by [[invokeHook]] below
28
- * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])
29
- */
30
- static LOG_ERROR: GetErrorHandler;
31
- static REJECT_ERROR: GetErrorHandler;
32
- static THROW_ERROR: GetErrorHandler;
33
- /**
34
- * Chains together an array of TransitionHooks.
35
- *
36
- * Given a list of [[TransitionHook]] objects, chains them together.
37
- * Each hook is invoked after the previous one completes.
38
- *
39
- * #### Example:
40
- * ```js
41
- * var hooks: TransitionHook[] = getHooks();
42
- * let promise: Promise<any> = TransitionHook.chain(hooks);
43
- *
44
- * promise.then(handleSuccess, handleError);
45
- * ```
46
- *
47
- * @param hooks the list of hooks to chain together
48
- * @param waitFor if provided, the chain is `.then()`'ed off this promise
49
- * @returns a `Promise` for sequentially invoking the hooks (in order)
50
- */
51
- static chain(hooks: TransitionHook[], waitFor?: Promise<any>): Promise<any>;
52
- /**
53
- * Invokes all the provided TransitionHooks, in order.
54
- * Each hook's return value is checked.
55
- * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.
56
- * If no hook returns a promise, then all hooks are processed synchronously.
57
- *
58
- * @param hooks the list of TransitionHooks to invoke
59
- * @param doneCallback a callback that is invoked after all the hooks have successfully completed
60
- *
61
- * @returns a promise for the async result, or the result of the callback
62
- */
63
- static invokeHooks<T>(
64
- hooks: TransitionHook[],
65
- doneCallback: (result?: HookResult) => T,
66
- ): Promise<any> | T;
67
- /**
68
- * Run all TransitionHooks, ignoring their return value.
69
- */
70
- static runAllHooks(hooks: TransitionHook[]): void;
71
- constructor(
72
- transition: Transition,
73
- stateContext: StateDeclaration,
74
- registeredHook: RegisteredHook,
75
- options: TransitionHookOptions,
76
- );
77
- private isSuperseded;
78
- logError(err: any): any;
79
- invokeHook(): Promise<HookResult> | void;
80
- /**
81
- * This method handles the return value of a Transition Hook.
82
- *
83
- * A hook can return false (cancel), a TargetState (redirect),
84
- * or a promise (which may later resolve to false or a redirect)
85
- *
86
- * This also handles "transition superseded" -- when a new transition
87
- * was started while the hook was still running
88
- */
89
- handleHookResult(result: HookResult): Promise<HookResult>;
90
- /**
91
- * Return a Rejection promise if the transition is no longer current due
92
- * to a stopped router (disposed), or a new transition has started and superseded this one.
93
- */
94
- private getNotCurrentRejection;
95
- toString(): string;
96
- }
@@ -1,253 +0,0 @@
1
- import {
2
- IHookRegistry,
3
- TransitionOptions,
4
- TransitionHookScope,
5
- TransitionHookPhase,
6
- TransitionCreateHookFn,
7
- HookMatchCriteria,
8
- HookRegOptions,
9
- PathTypes,
10
- PathType,
11
- RegisteredHooks,
12
- TransitionHookFn,
13
- TransitionStateHookFn,
14
- } from "./interface";
15
- import { Transition } from "./transition";
16
- import { RegisteredHook } from "./hookRegistry";
17
- import { TargetState } from "../state/targetState";
18
- import { PathNode } from "../path/pathNode";
19
- import { ViewService } from "../view/view";
20
- import { Router } from "../router";
21
- import { TransitionEventType } from "./transitionEventType";
22
- import { GetResultHandler, GetErrorHandler } from "./transitionHook";
23
- /**
24
- * The default [[Transition]] options.
25
- *
26
- * Include this object when applying custom defaults:
27
- * let reloadOpts = { reload: true, notify: true }
28
- * let options = defaults(theirOpts, customDefaults, defaultOptions);
29
- */
30
- export declare let defaultTransOpts: TransitionOptions;
31
- /**
32
- * Plugin API for Transition Service
33
- */
34
- export interface TransitionServicePluginAPI {
35
- /**
36
- * Adds a Path to be used as a criterion against a TreeChanges path
37
- *
38
- * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.
39
- * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`
40
- * Each state in the exiting path is checked against the criteria and returned as part of the match.
41
- *
42
- * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.
43
- * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`
44
- * Only the tail of the `to` path is checked against the criteria and returned as part of the match.
45
- */
46
- _definePathType(name: string, hookScope: TransitionHookScope): any;
47
- /**
48
- * Gets a Path definition used as a criterion against a TreeChanges path
49
- */
50
- _getPathTypes(): PathTypes;
51
- /**
52
- * Defines a transition hook type and returns a transition hook registration
53
- * function (which can then be used to register hooks of this type).
54
- */
55
- _defineEvent(
56
- name: string,
57
- hookPhase: TransitionHookPhase,
58
- hookOrder: number,
59
- criteriaMatchPath: PathType,
60
- reverseSort?: boolean,
61
- getResultHandler?: GetResultHandler,
62
- getErrorHandler?: GetErrorHandler,
63
- rejectIfSuperseded?: boolean,
64
- ): any;
65
- /**
66
- * Returns the known event types, such as `onBefore`
67
- * If a phase argument is provided, returns only events for the given phase.
68
- */
69
- _getEvents(phase?: TransitionHookPhase): TransitionEventType[];
70
- /** Returns the hooks registered for the given hook name */
71
- getHooks(hookName: string): RegisteredHook[];
72
- }
73
- /**
74
- * This class provides services related to Transitions.
75
- *
76
- * - Most importantly, it allows global Transition Hooks to be registered.
77
- * - It allows the default transition error handler to be set.
78
- * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).
79
- *
80
- * At bootstrap, [[Router]] creates a single instance (singleton) of this class.
81
- *
82
- * This API is located at `router.transitionService` ([[Router.transitionService]])
83
- */
84
- export declare class TransitionService implements IHookRegistry {
85
- /** @internal */
86
- _transitionCount: number;
87
- /** @internal */
88
- $view: ViewService;
89
- /** The transition hook types, such as `onEnter`, `onStart`, etc */
90
- private _eventTypes;
91
- /** @internal The registered transition hooks */
92
- _registeredHooks: RegisteredHooks;
93
- /** The paths on a criteria object */
94
- private _criteriaPaths;
95
- private _router;
96
- /** @internal */
97
- _pluginapi: TransitionServicePluginAPI;
98
- /**
99
- * This object has hook de-registration functions for the built-in hooks.
100
- * This can be used by third parties libraries that wish to customize the behaviors
101
- *
102
- * @internal
103
- */
104
- _deregisterHookFns: {
105
- addCoreResolves: Function;
106
- ignored: Function;
107
- invalid: Function;
108
- redirectTo: Function;
109
- onExit: Function;
110
- onRetain: Function;
111
- onEnter: Function;
112
- eagerResolve: Function;
113
- lazyResolve: Function;
114
- resolveAll: Function;
115
- loadViews: Function;
116
- activateViews: Function;
117
- updateGlobals: Function;
118
- updateUrl: Function;
119
- lazyLoad: Function;
120
- };
121
- /** @internal */
122
- constructor(_router: Router);
123
- /**
124
- * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.
125
- *
126
- * Registers a transition lifecycle hook, which is invoked during transition construction.
127
- *
128
- * This low level hook should only be used by plugins.
129
- * This can be a useful time for plugins to add resolves or mutate the transition as needed.
130
- * The Sticky States plugin uses this hook to modify the treechanges.
131
- *
132
- * ### Lifecycle
133
- *
134
- * `onCreate` hooks are invoked *while a transition is being constructed*.
135
- *
136
- * ### Return value
137
- *
138
- * The hook's return value is ignored
139
- *
140
- * @internal
141
- * @param criteria defines which Transitions the Hook should be invoked for.
142
- * @param callback the hook function which will be invoked.
143
- * @param options the registration options
144
- * @returns a function which deregisters the hook.
145
- */
146
- onCreate(
147
- criteria: HookMatchCriteria,
148
- callback: TransitionCreateHookFn,
149
- options?: HookRegOptions,
150
- ): Function;
151
- /** @inheritdoc */
152
- onBefore(
153
- criteria: HookMatchCriteria,
154
- callback: TransitionHookFn,
155
- options?: HookRegOptions,
156
- ): Function;
157
- /** @inheritdoc */
158
- onStart(
159
- criteria: HookMatchCriteria,
160
- callback: TransitionHookFn,
161
- options?: HookRegOptions,
162
- ): Function;
163
- /** @inheritdoc */
164
- onExit(
165
- criteria: HookMatchCriteria,
166
- callback: TransitionStateHookFn,
167
- options?: HookRegOptions,
168
- ): Function;
169
- /** @inheritdoc */
170
- onRetain(
171
- criteria: HookMatchCriteria,
172
- callback: TransitionStateHookFn,
173
- options?: HookRegOptions,
174
- ): Function;
175
- /** @inheritdoc */
176
- onEnter(
177
- criteria: HookMatchCriteria,
178
- callback: TransitionStateHookFn,
179
- options?: HookRegOptions,
180
- ): Function;
181
- /** @inheritdoc */
182
- onFinish(
183
- criteria: HookMatchCriteria,
184
- callback: TransitionHookFn,
185
- options?: HookRegOptions,
186
- ): Function;
187
- /** @inheritdoc */
188
- onSuccess(
189
- criteria: HookMatchCriteria,
190
- callback: TransitionHookFn,
191
- options?: HookRegOptions,
192
- ): Function;
193
- /** @inheritdoc */
194
- onError(
195
- criteria: HookMatchCriteria,
196
- callback: TransitionHookFn,
197
- options?: HookRegOptions,
198
- ): Function;
199
- /**
200
- * dispose
201
- * @internal
202
- */
203
- dispose(router: Router): void;
204
- /**
205
- * Creates a new [[Transition]] object
206
- *
207
- * This is a factory function for creating new Transition objects.
208
- * It is used internally by the [[StateService]] and should generally not be called by application code.
209
- *
210
- * @internal
211
- * @param fromPath the path to the current state (the from state)
212
- * @param targetState the target state (destination)
213
- * @returns a Transition
214
- */
215
- create(fromPath: PathNode[], targetState: TargetState): Transition;
216
- /** @internal */
217
- private _defineCoreEvents;
218
- /** @internal */
219
- private _defineCorePaths;
220
- /** @internal */
221
- _defineEvent(
222
- name: string,
223
- hookPhase: TransitionHookPhase,
224
- hookOrder: number,
225
- criteriaMatchPath: PathType,
226
- reverseSort?: boolean,
227
- getResultHandler?: GetResultHandler,
228
- getErrorHandler?: GetErrorHandler,
229
- synchronous?: boolean,
230
- ): void;
231
- /** @internal */
232
- private _getEvents;
233
- /**
234
- * Adds a Path to be used as a criterion against a TreeChanges path
235
- *
236
- * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.
237
- * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`
238
- * Each state in the exiting path is checked against the criteria and returned as part of the match.
239
- *
240
- * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.
241
- * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`
242
- * Only the tail of the `to` path is checked against the criteria and returned as part of the match.
243
- *
244
- * @internal
245
- */
246
- private _definePathType;
247
- /** @internal */
248
- private _getPathTypes;
249
- /** @internal */
250
- getHooks(hookName: string): RegisteredHook[];
251
- /** @internal */
252
- private _registerCoreTransitionHooks;
253
- }
@@ -1,8 +0,0 @@
1
- export * from "./interface";
2
- export * from "./urlMatcher";
3
- export * from "./urlMatcherFactory";
4
- export * from "./urlRouter";
5
- export * from "./urlRule";
6
- export * from "./urlService";
7
- export { UrlRules } from "./urlRules";
8
- export { UrlConfig } from "./urlConfig";
@@ -1,169 +0,0 @@
1
- /**
2
- * # URL subsystem
3
- *
4
- * Contains code related to managing the URL
5
- *
6
- * The primary API is found in [[UrlService]], [[UrlService.config]], and [[UrlService.rules]].
7
- *
8
- * @packageDocumentation
9
- * @preferred
10
- */
11
- import { LocationConfig } from "../common";
12
- import { Router } from "../router";
13
- import {
14
- StateDeclaration,
15
- StateObject,
16
- TargetState,
17
- TargetStateDef,
18
- } from "../state";
19
- import { UrlMatcher } from "./urlMatcher";
20
- import { UrlConfig } from "./urlConfig";
21
- import { UrlRules } from "./urlRules";
22
- import { UrlService } from "./urlService";
23
- export interface UrlMatcherCompileConfig {
24
- state?: StateDeclaration;
25
- strict?: boolean;
26
- caseInsensitive?: boolean;
27
- decodeParams?: boolean;
28
- }
29
- /** @deprecated use [[UrlConfig]] */
30
- export interface UrlConfigApi extends LocationConfig, UrlMatcherConfig {}
31
- /** @deprecated use [[UrlConfig]] */
32
- export interface UrlMatcherConfig {
33
- /** See: [[UrlConfig.caseInsensitive]] */ caseInsensitive: UrlConfig["caseInsensitive"];
34
- /** See: [[UrlConfig.strictMode]] */ strictMode: UrlConfig["strictMode"];
35
- /** See: [[UrlConfig.defaultSquashPolicy]] */ defaultSquashPolicy: UrlConfig["defaultSquashPolicy"];
36
- /** See: [[UrlConfig.type]] */ type: UrlConfig["type"];
37
- }
38
- /** @deprecated use [[UrlService]] */
39
- export interface UrlSyncApi {
40
- /** See: [[UrlService.sync]] */ sync: UrlService["sync"];
41
- /** See: [[UrlService.listen]] */ listen: UrlService["listen"];
42
- /** See: [[UrlService.deferIntercept]] */ deferIntercept: UrlService["deferIntercept"];
43
- }
44
- /** @deprecated use [[UrlRules]] */
45
- export interface UrlRulesApi {
46
- /** See: [[UrlRules.sort]] */ sort: UrlRules["sort"];
47
- /** See: [[UrlRules.when]] */ when: UrlRules["when"];
48
- /** See: [[UrlRules.otherwise]] */ otherwise: UrlRules["otherwise"];
49
- /** See: [[UrlRules.initial]] */ initial: UrlRules["initial"];
50
- /** See: [[UrlRules.rules]] */ rules: UrlRules["rules"];
51
- /** See: [[UrlRules.rule]] */ rule: UrlRules["rule"];
52
- /** See: [[UrlRules.removeRule]] */ removeRule: UrlRules["removeRule"];
53
- }
54
- /**
55
- * An object containing the three parts of a URL
56
- */
57
- export interface UrlParts {
58
- path: string;
59
- search?: {
60
- [key: string]: any;
61
- };
62
- hash?: string;
63
- }
64
- /**
65
- * A UrlRule match result
66
- *
67
- * The result of UrlRouter.match()
68
- */
69
- export interface MatchResult {
70
- /** The matched value from a [[UrlRule]] */
71
- match: any;
72
- /** The rule that matched */
73
- rule: UrlRule;
74
- /** The match result weight */
75
- weight: number;
76
- }
77
- /**
78
- * A function that matches the URL for a [[UrlRule]]
79
- *
80
- * Implementations should match against the provided [[UrlParts]] and return the matched value (truthy) if the rule matches.
81
- * If this rule is selected, the matched value is passed to the [[UrlRuleHandlerFn]].
82
- *
83
- * @return the matched value, either truthy or falsey
84
- */
85
- export interface UrlRuleMatchFn {
86
- (url?: UrlParts, router?: Router): any;
87
- }
88
- /**
89
- * Handler invoked when a rule is matched
90
- *
91
- * The matched value from the rule's [[UrlRuleMatchFn]] is passed as the first argument
92
- * The handler should return a string (to redirect), a [[TargetState]]/[[TargetStateDef]], or void
93
- *
94
- * If the handler returns a string, the url is replaced with the string.
95
- * If the handler returns a [[TargetState]], the target state is activated.
96
- */
97
- export interface UrlRuleHandlerFn {
98
- (
99
- matchValue?: any,
100
- url?: UrlParts,
101
- router?: Router,
102
- ): string | TargetState | TargetStateDef | void;
103
- }
104
- /** @internal */
105
- export declare type UrlRuleType =
106
- | "STATE"
107
- | "URLMATCHER"
108
- | "REGEXP"
109
- | "RAW"
110
- | "OTHER";
111
- /**
112
- * The interface for a URL Rule
113
- *
114
- * If you are creating a rule for use with [[UrlRules.rule]], it should implement this interface.
115
- */
116
- export interface UrlRule {
117
- /**
118
- * The rule's ID.
119
- *
120
- * IDs are auto-assigned when the rule is registered, in increasing order.
121
- */
122
- $id: number;
123
- /**
124
- * The rule's priority (defaults to 0).
125
- *
126
- * This can be used to explicitly modify the rule's priority.
127
- * Higher numbers are higher priority.
128
- */
129
- priority: number;
130
- /** @internal */
131
- _group: number;
132
- /** The type of the rule */
133
- type: UrlRuleType;
134
- /**
135
- * This function should match the url and return the match details
136
- *
137
- * See [[UrlRuleMatchFn]] for details
138
- */
139
- match: UrlRuleMatchFn;
140
- /**
141
- * This function is called if the rule matched, and was selected as the "best match".
142
- * This function handles the rule match event.
143
- *
144
- * See [[UrlRuleHandlerFn]] for details
145
- */
146
- handler: UrlRuleHandlerFn;
147
- /**
148
- * The priority of a given match.
149
- *
150
- * Sometimes more than one UrlRule might have matched.
151
- * This method is used to choose the best match.
152
- *
153
- * If multiple rules matched, each rule's `matchPriority` is called with the value from [[match]].
154
- * The rule with the highest `matchPriority` has its [[handler]] called.
155
- */
156
- matchPriority(match: any): number;
157
- }
158
- export interface MatcherUrlRule extends UrlRule {
159
- type: "URLMATCHER" | "STATE";
160
- urlMatcher: UrlMatcher;
161
- }
162
- export interface StateRule extends MatcherUrlRule {
163
- type: "STATE";
164
- state: StateObject;
165
- }
166
- export interface RegExpRule extends UrlRule {
167
- type: "REGEXP";
168
- regexp: RegExp;
169
- }
@@ -1,144 +0,0 @@
1
- import { Router } from "../router";
2
- import { ParamTypeDefinition, ParamTypes } from "../params";
3
- /**
4
- * An API to customize the URL behavior and retrieve URL configuration
5
- *
6
- * This API is used to customize the behavior of the URL.
7
- * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]),
8
- * and custom parameter encoding (custom [[type]]).
9
- *
10
- * It also has information about the location (url) configuration such as [[port]] and [[baseHref]].
11
- * This information can be used to build absolute URLs, such as
12
- * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`;
13
- *
14
- * This API is found at `router.urlService.config` (see: [[Router.urlService]], [[URLService.config]])
15
- */
16
- export declare class UrlConfig {
17
- private router;
18
- /** @internal */ paramTypes: ParamTypes;
19
- /** @internal */ _decodeParams: boolean;
20
- /** @internal */ _isCaseInsensitive: boolean;
21
- /** @internal */ _isStrictMode: boolean;
22
- /** @internal */ _defaultSquashPolicy: boolean | string;
23
- /** @internal */ constructor(/** @internal */ router: Router);
24
- /** @internal */ dispose: () => void;
25
- /**
26
- * Gets the base Href, e.g., `http://localhost/approot/`
27
- *
28
- * @return the application's base href
29
- */
30
- baseHref: () => string;
31
- /**
32
- * Gets or sets the hashPrefix
33
- *
34
- * This only applies when not running in [[html5Mode]] (pushstate mode)
35
- *
36
- * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the "hashbang" portion.
37
- *
38
- * @return the hash prefix
39
- */
40
- hashPrefix: (newprefix?: string) => string;
41
- /**
42
- * Gets the host, e.g., `localhost`
43
- *
44
- * @return the protocol
45
- */
46
- host: () => string;
47
- /**
48
- * Returns true when running in pushstate mode
49
- *
50
- * @return true when running in html5 mode (pushstate mode).
51
- */
52
- html5Mode: () => boolean;
53
- /**
54
- * Gets the port, e.g., `80`
55
- *
56
- * @return the port number
57
- */
58
- port: () => number;
59
- /**
60
- * Gets the protocol, e.g., `http`
61
- *
62
- * @return the protocol
63
- */
64
- protocol: () => string;
65
- /**
66
- * Defines whether URL matching should be case sensitive (the default behavior), or not.
67
- *
68
- * #### Example:
69
- * ```js
70
- * // Allow case insensitive url matches
71
- * urlService.config.caseInsensitive(true);
72
- * ```
73
- *
74
- * @param value `false` to match URL in a case sensitive manner; otherwise `true`;
75
- * @returns the current value of caseInsensitive
76
- */
77
- caseInsensitive(value?: boolean): boolean;
78
- /**
79
- * Sets the default behavior when generating or matching URLs with default parameter values.
80
- *
81
- * #### Example:
82
- * ```js
83
- * // Remove default parameter values from the url
84
- * urlService.config.defaultSquashPolicy(true);
85
- * ```
86
- *
87
- * @param value A string that defines the default parameter URL squashing behavior.
88
- * - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL
89
- * - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the
90
- * parameter is surrounded by slashes, squash (remove) one slash from the URL
91
- * - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove)
92
- * the parameter value from the URL and replace it with this string.
93
- * @returns the current value of defaultSquashPolicy
94
- */
95
- defaultSquashPolicy(value?: boolean | string): string | boolean;
96
- /**
97
- * Defines whether URLs should match trailing slashes, or not (the default behavior).
98
- *
99
- * #### Example:
100
- * ```js
101
- * // Allow optional trailing slashes
102
- * urlService.config.strictMode(false);
103
- * ```
104
- *
105
- * @param value `false` to match trailing slashes in URLs, otherwise `true`.
106
- * @returns the current value of strictMode
107
- */
108
- strictMode(value?: boolean): boolean;
109
- /**
110
- * Creates and registers a custom [[ParamType]] object
111
- *
112
- * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding.
113
- *
114
- * #### Note: Register custom types *before using them* in a state definition.
115
- *
116
- * #### Example:
117
- * ```js
118
- * // Encode object parameter as JSON string
119
- * urlService.config.type('myjson', {
120
- * encode: (obj) => JSON.stringify(obj),
121
- * decode: (str) => JSON.parse(str),
122
- * is: (val) => typeof(val) === 'object',
123
- * pattern: /[^/]+/,
124
- * equals: (a, b) => _.isEqual(a, b),
125
- * });
126
- * ```
127
- *
128
- * See [[ParamTypeDefinition]] for more examples
129
- *
130
- * @param name The type name.
131
- * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.
132
- * @param definitionFn A function that is injected before the app runtime starts.
133
- * The result of this function should be a [[ParamTypeDefinition]].
134
- * The result is merged into the existing `definition`.
135
- * See [[ParamType]] for information on the values accepted.
136
- *
137
- * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined
138
- */
139
- type(
140
- name: string,
141
- definition?: ParamTypeDefinition,
142
- definitionFn?: () => ParamTypeDefinition,
143
- ): any;
144
- }