@angular-wave/angular.ts 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/parse/parse.d.ts +6 -7
- 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/bind/bind.d.ts +2 -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/index.d.ts +1 -1
- package/@types/interface.d.ts +56 -18
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/view-directive.d.ts +2 -19
- package/@types/router/{common → glob}/glob.d.ts +5 -1
- package/@types/router/globals.d.ts +2 -3
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/state/interface.d.ts +1 -1
- package/@types/router/state/state-object.d.ts +1 -1
- package/@types/router/state/state-registry.d.ts +1 -2
- package/@types/router/state/state-service.d.ts +8 -7
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition.d.ts +12 -15
- package/@types/router/url/url-matcher.d.ts +3 -3
- package/@types/router/url/url-rule.d.ts +1 -0
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +30 -42
- 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 +48 -3
- package/@types/services/http/interface.d.ts +2 -2
- package/@types/services/http-backend/http-backend.d.ts +49 -44
- package/@types/services/location/interface.d.ts +63 -0
- package/@types/services/location/location.d.ts +330 -0
- 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/common.d.ts +0 -2
- package/@types/shared/dom.d.ts +6 -0
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/test-utils.d.ts +1 -0
- package/@types/shared/url-utils/interface.d.ts +46 -0
- package/@types/shared/url-utils/url-utils.d.ts +64 -0
- package/@types/shared/utils.d.ts +44 -6
- package/Makefile +8 -4
- package/dist/angular-ts.esm.js +1889 -2199
- package/dist/angular-ts.umd.js +1889 -2199
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/assets/scss/index.scss +23 -0
- package/docs/content/_index.md +9 -8
- package/docs/content/docs/_index.md +1 -1
- package/docs/content/docs/directive/app.md +1 -1
- package/docs/content/docs/directive/bind.md +10 -8
- package/docs/content/docs/directive/blur.md +1 -1
- package/docs/content/docs/directive/channel.md +2 -2
- package/docs/content/docs/directive/class-even.md +1 -1
- package/docs/content/docs/directive/class-odd.md +1 -1
- package/docs/content/docs/directive/class.md +1 -1
- package/docs/content/docs/directive/click.md +1 -1
- package/docs/content/docs/directive/copy.md +1 -1
- package/docs/content/docs/directive/cut.md +1 -1
- package/docs/content/docs/directive/dblclick.md +1 -1
- package/docs/content/docs/directive/focus.md +1 -1
- package/docs/content/docs/directive/get.md +203 -0
- package/docs/content/docs/directive/keydown.md +1 -1
- package/docs/content/docs/directive/keyup.md +1 -1
- package/docs/content/docs/directive/load.md +1 -1
- package/docs/content/docs/directive/mousedown.md +1 -1
- package/docs/content/docs/directive/mouseenter.md +1 -1
- package/docs/content/docs/directive/mouseleave.md +1 -1
- package/docs/content/docs/directive/mousemove.md +1 -1
- package/docs/content/docs/directive/mouseout.md +1 -1
- package/docs/content/docs/directive/mouseover.md +1 -1
- package/docs/content/docs/directive/mouseup.md +1 -1
- package/docs/content/docs/directive/non-bindable.md +28 -0
- package/docs/content/docs/provider/locationProvider.md +26 -0
- package/docs/content/docs/provider/templateCacheProvider.md +66 -1
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/templateCache.md +2 -2
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/showcss.html +2 -0
- package/docs/layouts/shortcodes/version.html +1 -0
- package/docs/static/examples/counter/counter-test.html +0 -4
- package/docs/static/examples/eventbus/eventbus-test.html +0 -4
- package/docs/static/examples/ng-bind/ng-bind.html +2 -2
- package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/highlight.css +6 -6
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/Location.html +55 -0
- package/docs/static/typedoc/classes/LocationProvider.html +20 -0
- 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/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Directive.html +5 -4
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- 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 +16 -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/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
- package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
- package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/typedoc/variables/SwapMode.html +11 -0
- package/docs/static/version.js +13 -0
- package/docs/test-results/.last-run.json +4 -0
- package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
- package/legacy.d.ts +0 -10
- package/package.json +1 -3
- package/src/{loader.js → angular.js} +5 -10
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-children-directive.js +2 -2
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/raf-scheduler.js +1 -1
- package/src/animations/shared.js +2 -12
- package/src/binding.spec.js +1 -1
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +7 -10
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/controller/controller.test.js +1 -0
- package/src/core/di/injector.js +11 -25
- package/src/core/di/injector.spec.js +2 -2
- package/src/core/di/injector.test.js +2 -2
- package/src/core/di/internal-injector.js +7 -7
- package/src/core/di/ng-module.js +12 -27
- package/src/core/filter/filter.js +28 -28
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/filter/filter.test.js +1 -0
- package/src/core/interpolate/interpolate.js +4 -6
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interpolate/interpolate.test.js +1 -0
- package/src/core/parse/ast/ast.spec.js +1 -1
- package/src/core/parse/ast/ast.test.js +1 -1
- package/src/core/parse/interpreter.js +32 -38
- package/src/core/parse/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +17 -16
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/sanitize/sanitize-uri.js +3 -3
- package/src/core/scope/scope.js +12 -13
- package/src/core/scope/scope.spec.js +3 -4
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/aria/aria.test.js +1 -0
- package/src/directive/attrs/attrs.js +7 -4
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/attrs.test.js +1 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/boolean.test.js +1 -0
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/element-style.test.js +1 -0
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/attrs/src.test.js +1 -0
- package/src/directive/bind/bind-html.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -0
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bind.test.js +1 -0
- package/src/directive/channel/channel.spec.js +1 -1
- package/src/directive/channel/channel.test.js +1 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/class/class.test.js +1 -0
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/cloak/cloak.test.js +1 -0
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/controller/controller.test.js +1 -0
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.js +6 -2
- package/src/directive/events/events.test.js +1 -0
- package/src/directive/form/form.js +8 -5
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/form/form.test.js +1 -0
- package/src/directive/http/delete.spec.js +3 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +281 -4
- package/src/directive/http/http.js +112 -15
- package/src/directive/http/http.test.js +2 -2
- package/src/directive/http/post.spec.js +506 -9
- package/src/directive/http/put.spec.js +3 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.js +7 -7
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/init/init.test.js +1 -0
- package/src/directive/input/input.js +19 -43
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.js +4 -0
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +14 -14
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model/model.test.js +1 -0
- package/src/directive/model-options/model-option.test.js +1 -0
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.test.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/observe/observe.test.js +1 -0
- package/src/directive/on/on.spec.js +1 -1
- package/src/directive/on/on.test.js +1 -0
- package/src/directive/options/options.js +454 -464
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/options/options.test.js +1 -0
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/href.test.js +2 -0
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.spec.js +2 -3
- package/src/directive/repeat/repeat.test.js +1 -0
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/script/script.test.js +1 -0
- package/src/directive/select/select.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/select/select.test.js +1 -0
- package/src/directive/setter/setter.js +12 -14
- package/src/directive/setter/setter.spec.js +40 -17
- package/src/directive/setter/setter.test.js +1 -0
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/show-hide/show-hide.test.js +1 -0
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/style/style.test.js +1 -0
- package/src/directive/switch/switch.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/transclude/transclude.js +87 -89
- package/src/directive/validators/validators.js +82 -84
- package/src/directive/validators/validators.spec.js +5 -4
- package/src/directive/validators/validators.test.js +1 -0
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +2 -3
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +1 -1
- package/src/injection-tokens.js +6 -2
- package/src/interface.ts +70 -19
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +16 -23
- package/src/{public.spec.js → ng.spec.js} +1 -1
- package/src/router/directives/state-directives.spec.js +9 -8
- package/src/router/directives/view-directive.js +11 -9
- package/src/router/directives/view-directive.spec.js +8 -9
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common → glob}/glob.js +5 -0
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/globals.js +1 -2
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/services.spec.js +5 -6
- package/src/router/state/interface.ts +1 -1
- package/src/router/state/state-builder.js +3 -3
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +2 -3
- package/src/router/state/state-service.js +13 -10
- package/src/router/state/state.spec.js +23 -22
- package/src/router/state/state.test.js +1 -0
- package/src/router/state/views.js +1 -1
- package/src/router/state-filter.spec.js +1 -1
- package/src/router/state-filters.js +15 -11
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +1 -1
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +6 -5
- package/src/router/transition/transition.js +4 -4
- package/src/router/url/url-matcher.js +3 -3
- package/src/router/url/url-rule.js +1 -0
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +82 -85
- package/src/router/url/url-service.spec.js +55 -39
- package/src/router/url/url.test.js +1 -0
- package/src/router/view/view.js +4 -5
- package/src/router/view/view.spec.js +10 -12
- package/src/router/view/view.test.js +1 -0
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.spec.js +1 -1
- package/src/services/anchor-scroll.html +2 -9
- package/src/services/anchor-scroll.js +6 -5
- 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 +11 -17
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/interface.ts +2 -2
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +53 -89
- package/src/services/http-backend/http-backend.spec.js +2 -6
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +70 -0
- package/src/{core → services}/location/location.html +4 -1
- package/src/services/location/location.js +999 -0
- package/src/{core → services}/location/location.spec.js +911 -532
- package/src/{core → services}/location/location.test.js +2 -2
- package/src/services/log/log.spec.js +1 -1
- package/src/services/log/log.test.js +1 -0
- package/src/services/pubsub/pubsub.spec.js +1 -1
- package/src/{core → services}/sce/sce.html +1 -1
- package/src/{core → services}/sce/sce.js +14 -10
- package/src/{core → services}/sce/sce.md +2 -2
- package/src/{core → services}/sce/sce.spec.js +3 -4
- 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 +73 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/services/template-request.js +2 -1
- package/src/shared/cache.js +0 -2
- package/src/shared/common.js +0 -5
- package/src/shared/common.spec.js +1 -1
- package/src/shared/dom.js +10 -0
- package/src/shared/interface.ts +0 -4
- package/src/{router/common → shared}/queue.js +7 -7
- package/src/shared/shared.html +1 -0
- package/src/shared/shared.test.js +1 -0
- package/src/shared/test-utils.js +1 -0
- package/src/shared/url-utils/interface.ts +54 -0
- package/src/{core → shared}/url-utils/url-utils.html +4 -1
- package/src/{core → shared}/url-utils/url-utils.js +26 -47
- package/src/{core → shared}/url-utils/url-utils.spec.js +10 -17
- package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
- package/src/shared/utils.js +60 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +36 -2
- package/utils/version.cjs +23 -0
- package/@types/core/location/location.d.ts +0 -317
- package/@types/core/task-tracker-factory.d.ts +0 -76
- package/@types/core/url-utils/url-utils.d.ts +0 -56
- package/@types/router/state-provider.d.ts +0 -123
- 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/location/location.js +0 -984
- package/src/core/location/location.md +0 -114
- package/src/core/task-tracker-factory.js +0 -145
- package/src/core/url-utils/url-utils.md +0 -46
- package/src/directive/non-bindable/non-bindable.md +0 -17
- package/src/loader.spec.js +0 -169
- package/src/router/state-provider.js +0 -146
- package/src/services/browser.js +0 -212
- /package/@types/{loader.d.ts → angular.d.ts} +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
|
@@ -36,14 +36,6 @@ describe("urlUtils", () => {
|
|
|
36
36
|
expect(parsed.pathname).toBe("/");
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
it("should return an IPv6 hostname wrapped in brackets", () => {
|
|
40
|
-
// Support: IE 9-11 only, Edge 16-17 only (fixed in 18 Preview)
|
|
41
|
-
// IE/Edge don't wrap IPv6 addresses' hostnames in square brackets
|
|
42
|
-
// when parsed out of an anchor element.
|
|
43
|
-
const parsed = urlResolve("http://[::1]/");
|
|
44
|
-
expect(parsed.hostname).toBe("[::1]");
|
|
45
|
-
});
|
|
46
|
-
|
|
47
39
|
it("should not put the domain in brackets for the hostname field", () => {
|
|
48
40
|
const parsed = urlResolve("https://google.com/");
|
|
49
41
|
expect(parsed.hostname).toBe("google.com");
|
|
@@ -87,7 +79,7 @@ describe("urlUtils", () => {
|
|
|
87
79
|
beforeEach(() => {
|
|
88
80
|
urlIsAllowedOrigin = urlIsAllowedOriginFactory([
|
|
89
81
|
"https://foo.com/",
|
|
90
|
-
`${origin.protocol}
|
|
82
|
+
`${origin.protocol}//bar.com:1337/`,
|
|
91
83
|
]);
|
|
92
84
|
});
|
|
93
85
|
|
|
@@ -97,7 +89,7 @@ describe("urlUtils", () => {
|
|
|
97
89
|
|
|
98
90
|
it("should check against the list of trusted origins", () => {
|
|
99
91
|
expect(urlIsAllowedOrigin("https://foo.com/path")).toBe(true);
|
|
100
|
-
expect(urlIsAllowedOrigin(`${origin.protocol}
|
|
92
|
+
expect(urlIsAllowedOrigin(`${origin.protocol}//bar.com:1337/path`)).toBe(
|
|
101
93
|
true,
|
|
102
94
|
);
|
|
103
95
|
expect(urlIsAllowedOrigin("https://baz.com:1337/path")).toBe(false);
|
|
@@ -112,7 +104,8 @@ describe("urlUtils", () => {
|
|
|
112
104
|
});
|
|
113
105
|
|
|
114
106
|
it("should return true only if the origins (protocol, hostname, post) match", () => {
|
|
115
|
-
const differentProtocol =
|
|
107
|
+
const differentProtocol =
|
|
108
|
+
origin.protocol !== "http:" ? "http:" : "https:";
|
|
116
109
|
const differentPort = (parseInt(origin.port, 10) || 0) + 1;
|
|
117
110
|
let url;
|
|
118
111
|
|
|
@@ -121,7 +114,7 @@ describe("urlUtils", () => {
|
|
|
121
114
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
122
115
|
|
|
123
116
|
// Same origin
|
|
124
|
-
url = `${origin.protocol}
|
|
117
|
+
url = `${origin.protocol}//${origin.host}/path`;
|
|
125
118
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
126
119
|
|
|
127
120
|
// Same origin - implicit protocol
|
|
@@ -129,15 +122,15 @@ describe("urlUtils", () => {
|
|
|
129
122
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
130
123
|
|
|
131
124
|
// Same origin - different protocol
|
|
132
|
-
url = `${differentProtocol}
|
|
125
|
+
url = `${differentProtocol}//${origin.host}/path`;
|
|
133
126
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
134
127
|
|
|
135
128
|
// Same origin - different port
|
|
136
|
-
url = `${origin.protocol}
|
|
129
|
+
url = `${origin.protocol}//${origin.hostname}:${differentPort}/path`;
|
|
137
130
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
138
131
|
|
|
139
132
|
// Allowed origin
|
|
140
|
-
url = `${origin.protocol}
|
|
133
|
+
url = `${origin.protocol}//bar.com:1337/path`;
|
|
141
134
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
142
135
|
|
|
143
136
|
// Allowed origin - implicit protocol
|
|
@@ -145,11 +138,11 @@ describe("urlUtils", () => {
|
|
|
145
138
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
146
139
|
|
|
147
140
|
// Allowed origin - different protocol
|
|
148
|
-
url = `${differentProtocol}
|
|
141
|
+
url = `${differentProtocol}//bar.com:1337/path`;
|
|
149
142
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
150
143
|
|
|
151
144
|
// Allowed origin - different port
|
|
152
|
-
url = `${origin.protocol}
|
|
145
|
+
url = `${origin.protocol}//bar.com:1338/path`;
|
|
153
146
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
154
147
|
});
|
|
155
148
|
});
|
package/src/shared/utils.js
CHANGED
|
@@ -375,14 +375,6 @@ export function extend(dst, ...src) {
|
|
|
375
375
|
return baseExtend(dst, src, false);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
/**
|
|
379
|
-
* @param {string} str
|
|
380
|
-
* @returns {number}
|
|
381
|
-
*/
|
|
382
|
-
export function toInt(str) {
|
|
383
|
-
return parseInt(str, 10);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
378
|
/**
|
|
387
379
|
* @param {any} num
|
|
388
380
|
* @returns {boolean}
|
|
@@ -853,7 +845,7 @@ export function tryDecodeURIComponent(value) {
|
|
|
853
845
|
try {
|
|
854
846
|
return decodeURIComponent(value);
|
|
855
847
|
} catch {
|
|
856
|
-
|
|
848
|
+
/* empty */
|
|
857
849
|
}
|
|
858
850
|
}
|
|
859
851
|
|
|
@@ -867,6 +859,7 @@ export function tryDecodeURIComponent(value) {
|
|
|
867
859
|
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
868
860
|
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
|
869
861
|
* / "*" / "+" / "," / ";" / "="
|
|
862
|
+
* @param {string} val
|
|
870
863
|
*/
|
|
871
864
|
export function encodeUriSegment(val) {
|
|
872
865
|
return encodeUriQuery(val, true)
|
|
@@ -1211,3 +1204,61 @@ export function callBackOnce(fn) {
|
|
|
1211
1204
|
}
|
|
1212
1205
|
};
|
|
1213
1206
|
}
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Wraps a function so it will only be called starting from the second invocation.
|
|
1210
|
+
* The first call does nothing and returns undefined.
|
|
1211
|
+
*
|
|
1212
|
+
* @param {Function} fn - The function to wrap.
|
|
1213
|
+
* @returns {Function} A new function that will skip the first call.
|
|
1214
|
+
*/
|
|
1215
|
+
export function callBackAfterFirst(fn) {
|
|
1216
|
+
let calledOnce = false;
|
|
1217
|
+
|
|
1218
|
+
return function (...args) {
|
|
1219
|
+
if (calledOnce) {
|
|
1220
|
+
return fn.apply(this, args);
|
|
1221
|
+
}
|
|
1222
|
+
calledOnce = true;
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Delays execution for a specified number of milliseconds.
|
|
1228
|
+
*
|
|
1229
|
+
* @param {number} [t=0] - The number of milliseconds to wait. Defaults to 0.
|
|
1230
|
+
* @returns {Promise<void>} A promise that resolves after the delay.
|
|
1231
|
+
*/
|
|
1232
|
+
export function wait(t = 0) {
|
|
1233
|
+
return new Promise((resolve) => setTimeout(resolve, t));
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Checks if a given string starts with a specified substring.
|
|
1238
|
+
*
|
|
1239
|
+
* This is a simple polyfill-like function that mimics the behavior of
|
|
1240
|
+
* `String.prototype.startsWith` without using the built-in method.
|
|
1241
|
+
*
|
|
1242
|
+
* @param {string} str - The full string to evaluate.
|
|
1243
|
+
* @param {string} search - The substring to test against the beginning of `str`.
|
|
1244
|
+
* @returns {boolean} `true` if `str` starts with `search`, otherwise `false`.
|
|
1245
|
+
*
|
|
1246
|
+
* @example
|
|
1247
|
+
* startsWith("hello world", "hello");
|
|
1248
|
+
* // returns true
|
|
1249
|
+
*
|
|
1250
|
+
* @example
|
|
1251
|
+
* startsWith("hello world", "world");
|
|
1252
|
+
* // returns false
|
|
1253
|
+
*
|
|
1254
|
+
* @example
|
|
1255
|
+
* startsWith("test", "");
|
|
1256
|
+
* // returns true (empty search string always matches)
|
|
1257
|
+
*
|
|
1258
|
+
* @example
|
|
1259
|
+
* startsWith("abc", "abcd");
|
|
1260
|
+
* // returns false
|
|
1261
|
+
*/
|
|
1262
|
+
export function startsWith(str, search) {
|
|
1263
|
+
return str.slice(0, search.length) === search;
|
|
1264
|
+
}
|
package/src/shared/utils.spec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hashKey } from "./utils.js";
|
|
1
|
+
import { hashKey, startsWith } from "./utils.js";
|
|
2
2
|
|
|
3
3
|
describe("api", () => {
|
|
4
4
|
describe("hashKey()", () => {
|
|
@@ -141,4 +141,38 @@ describe("api", () => {
|
|
|
141
141
|
).toEqual(42);
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
|
+
|
|
145
|
+
describe("startsWith", () => {
|
|
146
|
+
it("should return true when string starts with search string", () => {
|
|
147
|
+
expect(startsWith("hello world", "hello")).toBe(true);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it("should return false when string does not start with search string", () => {
|
|
151
|
+
expect(startsWith("hello world", "world")).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("should return true when both strings are equal", () => {
|
|
155
|
+
expect(startsWith("test", "test")).toBe(true);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("should return true when search string is empty", () => {
|
|
159
|
+
expect(startsWith("abc", "")).toBe(true); // matches JavaScript's native behavior
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it("should return false when original string is empty and search is not", () => {
|
|
163
|
+
expect(startsWith("", "a")).toBe(false);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("should return true with special characters at the beginning", () => {
|
|
167
|
+
expect(startsWith("💡 idea", "💡")).toBe(true);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("should be case-sensitive", () => {
|
|
171
|
+
expect(startsWith("Hello", "hello")).toBe(false);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("should return false if search is longer than the string", () => {
|
|
175
|
+
expect(startsWith("short", "shorter")).toBe(false);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
144
178
|
});
|
package/src/src.html
CHANGED
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
<script src="/jasmine/boot1.js"></script>
|
|
14
14
|
<script type="module" src="/src/angular.spec.js"></script>
|
|
15
15
|
<script type="module" src="/src/index.spec.js"></script>
|
|
16
|
-
<script type="module" src="/src/
|
|
17
|
-
<script type="module" src="/src/public.spec.js"></script>
|
|
16
|
+
<script type="module" src="/src/ng.spec.js"></script>
|
|
18
17
|
</head>
|
|
19
18
|
<body>
|
|
20
19
|
<div ng-app id="app"></div>
|
package/typedoc.json
CHANGED
package/utils/express.js
CHANGED
|
@@ -37,9 +37,22 @@ app.post("/nocontent", (req, res) => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
app.post("/form", (req, res) => {
|
|
40
|
+
console.log(req.body);
|
|
40
41
|
res.send(req.body);
|
|
41
42
|
});
|
|
42
43
|
|
|
44
|
+
app.use("/json", express.json());
|
|
45
|
+
app.use("/json", express.urlencoded({ extended: true }));
|
|
46
|
+
app.post("/json", (req, res) => {
|
|
47
|
+
console.log(req.body);
|
|
48
|
+
res.json(req.body);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
app.post("/hello", (req, res) => {
|
|
52
|
+
console.log(req.body);
|
|
53
|
+
res.send("<div>Hello</div>");
|
|
54
|
+
});
|
|
55
|
+
|
|
43
56
|
app.post("/blob", (req, res) => {
|
|
44
57
|
res.send(req.body);
|
|
45
58
|
});
|
|
@@ -72,6 +85,10 @@ app.get("/jsoninterpolation", (req, res) => {
|
|
|
72
85
|
res.json("{{expr}}");
|
|
73
86
|
});
|
|
74
87
|
|
|
88
|
+
app.get("/now", (req, res) => {
|
|
89
|
+
res.send(Date.now().toString(10));
|
|
90
|
+
});
|
|
91
|
+
|
|
75
92
|
app.get("/scopeinit", (req, res) => {
|
|
76
93
|
res.send('<div ng-init="name=1"></div>');
|
|
77
94
|
});
|
|
@@ -112,6 +129,10 @@ app.get("/hello2", (req, res) => {
|
|
|
112
129
|
res.send("Hello2");
|
|
113
130
|
});
|
|
114
131
|
|
|
132
|
+
app.get("/include", (req, res) => {
|
|
133
|
+
res.send("<div ng-include=\"'/mock/hello'\"></div>");
|
|
134
|
+
});
|
|
135
|
+
|
|
115
136
|
app.get("/third", (req, res) => {
|
|
116
137
|
res.send("<div third>{{1+2}}</div>");
|
|
117
138
|
});
|
|
@@ -132,7 +153,7 @@ app.get("/422", (req, res) => {
|
|
|
132
153
|
res.status(422).send("Invalid data");
|
|
133
154
|
});
|
|
134
155
|
|
|
135
|
-
app.get("/never", (
|
|
156
|
+
app.get("/never", () => {
|
|
136
157
|
setTimeout(() => {}, 500);
|
|
137
158
|
});
|
|
138
159
|
|
|
@@ -165,5 +186,18 @@ app.use("/posthtml", express.json());
|
|
|
165
186
|
app.use("/posthtml", express.urlencoded({ extended: true }));
|
|
166
187
|
app.post("/posthtml", (req, res) => {
|
|
167
188
|
console.log(req.body);
|
|
168
|
-
res.send(`<div
|
|
189
|
+
res.send(`<div>${req.body.name}</div>`);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
app.use("/posterror", express.json());
|
|
193
|
+
app.use("/posterror", express.urlencoded({ extended: true }));
|
|
194
|
+
app.post("/posterror", (req, res) => {
|
|
195
|
+
console.log(req.body);
|
|
196
|
+
res.status(422).send(`<div>Error</div>`);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
app.use("/urlencoded", express.urlencoded({ extended: true }));
|
|
200
|
+
app.post("/urlencoded", (req, res) => {
|
|
201
|
+
console.log(req.body); // Access parsed form data
|
|
202
|
+
res.send("Form data: " + req.body.name);
|
|
169
203
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const packageJsonPath = path.resolve(__dirname, "../package.json");
|
|
5
|
+
|
|
6
|
+
const outputPath = path.resolve(
|
|
7
|
+
__dirname,
|
|
8
|
+
"../docs/layouts/shortcodes/version.html",
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
13
|
+
const version = packageJson.version || "unknown";
|
|
14
|
+
|
|
15
|
+
const htmlContent = `<p>Version: ${version}</p>\n`;
|
|
16
|
+
|
|
17
|
+
fs.writeFileSync(outputPath, htmlContent);
|
|
18
|
+
|
|
19
|
+
console.log(`✅ Version HTML file generated at ${outputPath}`);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("❌ Error generating version HTML:", error);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {string} base
|
|
4
|
-
* @param {string} url
|
|
5
|
-
* @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with
|
|
6
|
-
* the expected string.
|
|
7
|
-
*/
|
|
8
|
-
export function stripBaseUrl(base: string, url: string): string;
|
|
9
|
-
export function stripHash(url: any): any;
|
|
10
|
-
export function stripFile(url: any): any;
|
|
11
|
-
export function serverBase(url: any): any;
|
|
12
|
-
/**
|
|
13
|
-
* @abstract
|
|
14
|
-
*/
|
|
15
|
-
export class Location {
|
|
16
|
-
/**
|
|
17
|
-
* @param {string} appBase application base URL
|
|
18
|
-
* @param {string} appBaseNoFile application base URL stripped of any filename
|
|
19
|
-
*/
|
|
20
|
-
constructor(appBase: string, appBaseNoFile: string);
|
|
21
|
-
/** @type {string} */
|
|
22
|
-
appBase: string;
|
|
23
|
-
/** @type {string} */
|
|
24
|
-
appBaseNoFile: string;
|
|
25
|
-
/**
|
|
26
|
-
* An absolute URL is the full URL, including protocol (http/https ), the optional subdomain (e.g. www ), domain (example.com), and path (which includes the directory and slug).
|
|
27
|
-
* @type {string}
|
|
28
|
-
*/
|
|
29
|
-
$$absUrl: string;
|
|
30
|
-
/**
|
|
31
|
-
* If html5 mode is enabled
|
|
32
|
-
* @type {boolean}
|
|
33
|
-
*/
|
|
34
|
-
$$html5: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Has any change been replacing?
|
|
37
|
-
* @type {boolean}
|
|
38
|
-
*/
|
|
39
|
-
$$replace: boolean;
|
|
40
|
-
/** @type {import('../url-utils/url-utils').HttpProtocol} */
|
|
41
|
-
$$protocol: any;
|
|
42
|
-
/** @type {string} */
|
|
43
|
-
$$host: string;
|
|
44
|
-
/**
|
|
45
|
-
* The port, without ":"
|
|
46
|
-
* @type {number}
|
|
47
|
-
*/
|
|
48
|
-
$$port: number;
|
|
49
|
-
/**
|
|
50
|
-
* The pathname, beginning with "/"
|
|
51
|
-
* @type {string}
|
|
52
|
-
*/
|
|
53
|
-
$$path: string;
|
|
54
|
-
/**
|
|
55
|
-
* The hash string, minus the hash symbol
|
|
56
|
-
* @type {string}
|
|
57
|
-
*/
|
|
58
|
-
$$hash: string;
|
|
59
|
-
/**
|
|
60
|
-
* Helper property for scope watch changes
|
|
61
|
-
* @type {boolean}
|
|
62
|
-
*/
|
|
63
|
-
$$urlUpdatedByLocation: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Return full URL representation with all segments encoded according to rules specified in
|
|
66
|
-
* [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
|
|
67
|
-
*
|
|
68
|
-
* @return {string} full URL
|
|
69
|
-
*/
|
|
70
|
-
absUrl(): string;
|
|
71
|
-
/**
|
|
72
|
-
* This method is getter / setter.
|
|
73
|
-
*
|
|
74
|
-
* Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
|
|
75
|
-
* Change path, search and hash, when called with parameter and return `$location`.
|
|
76
|
-
*
|
|
77
|
-
* @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`)
|
|
78
|
-
* @return {Location|string} url
|
|
79
|
-
*/
|
|
80
|
-
url(url?: string | undefined): Location | string;
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* Return protocol of current URL.
|
|
84
|
-
* @return {import("../url-utils/url-utils").HttpProtocol} protocol of current URL
|
|
85
|
-
*/
|
|
86
|
-
protocol(): any;
|
|
87
|
-
/**
|
|
88
|
-
* This method is getter only.
|
|
89
|
-
*
|
|
90
|
-
* Return host of current URL.
|
|
91
|
-
*
|
|
92
|
-
* Note: compared to the non-AngularTS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* @return {string} host of current URL.
|
|
96
|
-
*/
|
|
97
|
-
host(): string;
|
|
98
|
-
/**
|
|
99
|
-
* This method is getter only.
|
|
100
|
-
*
|
|
101
|
-
* Return port of current URL.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* ```js
|
|
105
|
-
* // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
|
106
|
-
* let port = $location.port();
|
|
107
|
-
* // => 80
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* @return {number} port
|
|
111
|
-
*/
|
|
112
|
-
port(): number;
|
|
113
|
-
/**
|
|
114
|
-
* This method is getter / setter.
|
|
115
|
-
*
|
|
116
|
-
* Return path of current URL when called without any parameter.
|
|
117
|
-
*
|
|
118
|
-
* Change path when called with parameter and return `$location`.
|
|
119
|
-
*
|
|
120
|
-
* Note: Path should always begin with forward slash (/), this method will add the forward slash
|
|
121
|
-
* if it is missing.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* ```js
|
|
125
|
-
* // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
|
126
|
-
* let path = $location.path();
|
|
127
|
-
* // => "/some/path"
|
|
128
|
-
* ```
|
|
129
|
-
*
|
|
130
|
-
* @param {(string|number)=} path New path
|
|
131
|
-
* @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter
|
|
132
|
-
*/
|
|
133
|
-
path(path?: (string | number) | undefined): string | object;
|
|
134
|
-
/**
|
|
135
|
-
* This method is getter / setter.
|
|
136
|
-
*
|
|
137
|
-
* Returns the hash fragment when called without any parameters.
|
|
138
|
-
*
|
|
139
|
-
* Changes the hash fragment when called with a parameter and returns `$location`.
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* ```js
|
|
143
|
-
* // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
|
|
144
|
-
* let hash = $location.hash();
|
|
145
|
-
* // => "hashValue"
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @param {(string|number)=} hash New hash fragment
|
|
149
|
-
* @return {string|Location} hash
|
|
150
|
-
*/
|
|
151
|
-
hash(hash?: (string | number) | undefined): string | Location;
|
|
152
|
-
/**
|
|
153
|
-
* If called, all changes to $location during the current `$digest` will replace the current history
|
|
154
|
-
* record, instead of adding a new one.
|
|
155
|
-
*/
|
|
156
|
-
replace(): this;
|
|
157
|
-
/**
|
|
158
|
-
* Returns or sets the search part (as object) of current URL when called without any parameter
|
|
159
|
-
*
|
|
160
|
-
* @param {string|Object=} search New search params - string or hash object.
|
|
161
|
-
* @param {(string|number|Array<string>|boolean)=} paramValue If search is a string or number, then paramValue will override only a single search property.
|
|
162
|
-
* @returns {Object|Location} Search object or Location object
|
|
163
|
-
*/
|
|
164
|
-
search(
|
|
165
|
-
search?: (string | any) | undefined,
|
|
166
|
-
paramValue?: (string | number | Array<string> | boolean) | undefined,
|
|
167
|
-
...args: any[]
|
|
168
|
-
): any | Location;
|
|
169
|
-
$$search: any;
|
|
170
|
-
/**
|
|
171
|
-
* Compose url and update `url` and `absUrl` property
|
|
172
|
-
* @returns {void}
|
|
173
|
-
*/
|
|
174
|
-
$$compose(): void;
|
|
175
|
-
$$url: string;
|
|
176
|
-
/**
|
|
177
|
-
* @param {string} _url
|
|
178
|
-
* @returns {string}
|
|
179
|
-
*/
|
|
180
|
-
$$normalizeUrl(_url: string): string;
|
|
181
|
-
/**
|
|
182
|
-
* This method is getter / setter.
|
|
183
|
-
*
|
|
184
|
-
* Return the history state object when called without any parameter.
|
|
185
|
-
*
|
|
186
|
-
* Change the history state object when called with one parameter and return `$location`.
|
|
187
|
-
* The state object is later passed to `pushState` or `replaceState`.
|
|
188
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#state|History.state}
|
|
189
|
-
*
|
|
190
|
-
* NOTE: This method is supported only in HTML5 mode and only in browsers supporting
|
|
191
|
-
* the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
|
|
192
|
-
* older browsers (like IE9 or Android < 4.0), don't use this method.
|
|
193
|
-
*
|
|
194
|
-
* @param {any} state State object for pushState or replaceState
|
|
195
|
-
* @return {any} state
|
|
196
|
-
*/
|
|
197
|
-
state(state: any, ...args: any[]): any;
|
|
198
|
-
$$state: any;
|
|
199
|
-
/**
|
|
200
|
-
* @param {string} _url
|
|
201
|
-
* @param {string} _url2
|
|
202
|
-
* @returns {boolean}
|
|
203
|
-
*/
|
|
204
|
-
$$parseLinkUrl(_url: string, _url2: string): boolean;
|
|
205
|
-
$$parse(_url: any): void;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* This object is exposed as $location service when HTML5 mode is enabled and supported
|
|
209
|
-
*/
|
|
210
|
-
export class LocationHtml5Url extends Location {
|
|
211
|
-
/**
|
|
212
|
-
* @param {string} appBase application base URL
|
|
213
|
-
* @param {string} appBaseNoFile application base URL stripped of any filename
|
|
214
|
-
* @param {string} basePrefix URL path prefix
|
|
215
|
-
*/
|
|
216
|
-
constructor(appBase: string, appBaseNoFile: string, basePrefix: string);
|
|
217
|
-
basePrefix: string;
|
|
218
|
-
/**
|
|
219
|
-
* Parse given HTML5 (regular) URL string into properties
|
|
220
|
-
* @param {string} url HTML5 URL
|
|
221
|
-
*/
|
|
222
|
-
$$parse(url: string): void;
|
|
223
|
-
$$normalizeUrl(url: any): string;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* LocationHashbangUrl represents URL
|
|
227
|
-
* This object is exposed as $location service when developer doesn't opt into html5 mode.
|
|
228
|
-
* It also serves as the base class for html5 mode fallback on legacy browsers.
|
|
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
|
-
*/
|
|
235
|
-
export class LocationHashbangUrl extends Location {
|
|
236
|
-
constructor(appBase: any, appBaseNoFile: any, hashPrefix: any);
|
|
237
|
-
hashPrefix: any;
|
|
238
|
-
/**
|
|
239
|
-
* Parse given hashbang URL into properties
|
|
240
|
-
* @param {string} url Hashbang URL
|
|
241
|
-
*/
|
|
242
|
-
$$parse(url: string): void;
|
|
243
|
-
$$normalizeUrl(url: any): string;
|
|
244
|
-
/**
|
|
245
|
-
* @param {string} url
|
|
246
|
-
* @returns {boolean}
|
|
247
|
-
*/
|
|
248
|
-
$$parseLinkUrl(url: string): boolean;
|
|
249
|
-
}
|
|
250
|
-
export class LocationProvider {
|
|
251
|
-
/** @type {string} */
|
|
252
|
-
hashPrefixConf: string;
|
|
253
|
-
/** @type {Html5Mode} */
|
|
254
|
-
html5ModeConf: Html5Mode;
|
|
255
|
-
/**
|
|
256
|
-
* The default value for the prefix is `'!'`.
|
|
257
|
-
* @param {string=} prefix Prefix for hash part (containing path and search)
|
|
258
|
-
* @returns {void}
|
|
259
|
-
*/
|
|
260
|
-
setHashPrefix(prefix?: string | undefined): void;
|
|
261
|
-
/**
|
|
262
|
-
* Current hash prefix
|
|
263
|
-
* @returns {string}
|
|
264
|
-
*/
|
|
265
|
-
getHashPrefix(): string;
|
|
266
|
-
/**
|
|
267
|
-
* Configures html5 mode
|
|
268
|
-
* @param {(boolean|Html5Mode)=} mode If boolean, sets `html5Mode.enabled` to value. Otherwise, accepts html5Mode object
|
|
269
|
-
*
|
|
270
|
-
* @returns {void}
|
|
271
|
-
*/
|
|
272
|
-
setHtml5Mode(mode?: (boolean | Html5Mode) | undefined): void;
|
|
273
|
-
/**
|
|
274
|
-
* Returns html5 mode cofiguration
|
|
275
|
-
* @returns {Html5Mode}
|
|
276
|
-
*/
|
|
277
|
-
getHtml5Mode(): Html5Mode;
|
|
278
|
-
$get: (
|
|
279
|
-
| string
|
|
280
|
-
| ((
|
|
281
|
-
$rootScope: import("../scope/scope.js").Scope,
|
|
282
|
-
$browser: any,
|
|
283
|
-
$rootElement: Element,
|
|
284
|
-
) => Location)
|
|
285
|
-
)[];
|
|
286
|
-
}
|
|
287
|
-
export type DefaultPorts = {
|
|
288
|
-
http: number;
|
|
289
|
-
https: number;
|
|
290
|
-
ftp: number;
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* Represents the configuration options for HTML5 mode.
|
|
294
|
-
*/
|
|
295
|
-
export type Html5Mode = {
|
|
296
|
-
/**
|
|
297
|
-
* - (default: false) If true, will rely on `history.pushState` to
|
|
298
|
-
* change URLs where supported. Falls back to hash-prefixed paths in browsers that do not
|
|
299
|
-
* support `pushState`.
|
|
300
|
-
*/
|
|
301
|
-
enabled: boolean;
|
|
302
|
-
/**
|
|
303
|
-
* - (default: `true`) When html5Mode is enabled, specifies
|
|
304
|
-
* whether or not a `<base>` tag is required to be present. If both `enabled` and `requireBase`
|
|
305
|
-
* are true, and a `<base>` tag is not present, an error will be thrown when `$location` is injected.
|
|
306
|
-
* See the {@link guide /$location $location guide} for more information.
|
|
307
|
-
*/
|
|
308
|
-
requireBase: boolean;
|
|
309
|
-
/**
|
|
310
|
-
* - (default: `true`) When html5Mode is enabled, enables or
|
|
311
|
-
* disables URL rewriting for relative links. If set to a string, URL rewriting will only apply to links
|
|
312
|
-
* with an attribute that matches the given string. For example, if set to `'internal-link'`, URL rewriting
|
|
313
|
-
* will only occur for `<a internal-link>` links. Note that [attribute name normalization](guide/directive#normalization)
|
|
314
|
-
* does not apply here, so `'internalLink'` will **not** match `'internal-link'`.
|
|
315
|
-
*/
|
|
316
|
-
rewriteLinks: boolean | string;
|
|
317
|
-
};
|