@angular-wave/angular.ts 0.7.8 → 0.8.1
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/{loader.d.ts → angular.d.ts} +3 -3
- package/@types/core/di/ng-module.d.ts +61 -25
- package/@types/core/parse/parse.d.ts +6 -7
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +4 -2
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/state-directives.d.ts +2 -2
- package/@types/router/directives/view-directive.d.ts +1 -1
- package/@types/router/params/param-type.d.ts +0 -1
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/{globals.d.ts → router.d.ts} +2 -2
- 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 +2 -2
- package/@types/router/state/state-service.d.ts +14 -16
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition-service.d.ts +3 -3
- package/@types/router/transition/transition.d.ts +16 -19
- package/@types/router/url/url-matcher.d.ts +3 -4
- package/@types/router/url/url-rule.d.ts +14 -4
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +28 -38
- package/@types/services/http/http.d.ts +48 -1
- package/@types/services/http-backend/http-backend.d.ts +48 -35
- package/@types/services/location/interface.d.ts +55 -0
- package/@types/services/location/location.d.ts +225 -252
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/hof.d.ts +0 -6
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/url-utils/interface.d.ts +0 -1
- package/@types/shared/url-utils/url-utils.d.ts +0 -5
- package/@types/shared/utils.d.ts +29 -6
- package/CHANGELOG.md +0 -72
- package/CONTRIBUTING.md +0 -1
- package/DEVELOPERS.md +0 -1
- package/Makefile +6 -3
- package/TRIAGING.md +0 -1
- package/dist/angular-ts.esm.js +1048 -1150
- package/dist/angular-ts.umd.js +1048 -1150
- 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 +1 -1
- 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 +3 -3
- 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 +2 -2
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- 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-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 +3 -3
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/Provider.html +2 -1
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/Injectable.html +4 -1
- package/docs/static/typedoc/types/InjectableFactory.html +1 -4
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -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/package.json +2 -2
- package/src/{loader.js → angular.js} +11 -11
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/shared.js +2 -3
- package/src/binding.spec.js +1 -1
- package/src/core/compile/compile.js +4 -7
- 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 +7 -8
- 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 +3 -6
- package/src/core/di/ng-module.js +26 -21
- package/src/core/filter/filter.js +1 -1
- 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/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +46 -46
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/scope/scope.js +10 -11
- 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.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 +6 -6
- 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 +1 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +1 -1
- package/src/directive/http/http.js +12 -3
- package/src/directive/http/post.spec.js +504 -9
- package/src/directive/http/put.spec.js +1 -1
- package/src/directive/if/if.spec.js +1 -1
- 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 +13 -15
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.md +0 -4
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +13 -13
- 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.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.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.spec.js +1 -1
- 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.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- 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 +7 -3
- package/src/interface.ts +4 -3
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +11 -12
- package/src/{public.spec.js → ng.spec.js} +2 -2
- package/src/router/directives/state-directives.js +5 -5
- package/src/router/directives/state-directives.spec.js +8 -7
- package/src/router/directives/view-directive.js +7 -13
- package/src/router/directives/view-directive.spec.js +22 -23
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/params/param-type.js +0 -1
- package/src/router/params/param.js +1 -1
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/{globals.js → router.js} +2 -2
- package/src/router/services.spec.js +8 -9
- 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 +4 -4
- package/src/router/state/state-service.js +14 -14
- 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 +13 -9
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +7 -7
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +7 -6
- package/src/router/transition/transition.js +6 -6
- package/src/router/url/url-matcher.js +12 -14
- package/src/router/url/url-rule.js +8 -2
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +80 -76
- package/src/router/url/url-service.spec.js +61 -78
- 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.js +3 -1
- package/src/router/view-scroll.spec.js +12 -12
- package/src/services/anchor-scroll.html +2 -2
- package/src/services/anchor-scroll.js +5 -4
- package/src/services/http/http.js +9 -4
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +51 -77
- package/src/services/http-backend/http-backend.spec.js +1 -2
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +62 -0
- package/src/services/location/location.js +439 -519
- package/src/services/location/location.spec.js +915 -530
- package/src/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/services/sce/sce.js +5 -7
- package/src/services/sce/sce.md +2 -2
- package/src/services/sce/sce.spec.js +1 -1
- package/src/services/template-cache/template-cache.spec.js +1 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/shared/common.js +5 -10
- package/src/shared/common.spec.js +1 -1
- package/src/shared/hof.js +0 -14
- 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/url-utils/interface.ts +0 -2
- package/src/shared/url-utils/url-utils.js +6 -30
- package/src/shared/url-utils/url-utils.spec.js +10 -9
- package/src/shared/utils.js +32 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +27 -1
- package/utils/version.cjs +23 -0
- package/@types/router/state-provider.d.ts +0 -123
- 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/location/location.md +0 -114
- package/src/shared/url-utils/url-utils.md +0 -46
- /package/@types/router/{common → glob}/glob.d.ts +0 -0
- /package/src/router/{common → glob}/glob.js +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { test, expect } from "@playwright/test";
|
|
2
2
|
|
|
3
|
-
const TEST_URL = "src/services/location/location.html";
|
|
3
|
+
const TEST_URL = "src/services/location/location.html?random=false";
|
|
4
4
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
-
await page.waitForTimeout(
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
9
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
10
10
|
/0 failures/,
|
|
11
11
|
);
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/services/log/log.html?random=false";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
package/src/services/sce/sce.js
CHANGED
|
@@ -327,7 +327,6 @@ export class SceDelegateProvider {
|
|
|
327
327
|
"Attempting to use an unsafe value in a safe context.",
|
|
328
328
|
),
|
|
329
329
|
);
|
|
330
|
-
return;
|
|
331
330
|
};
|
|
332
331
|
|
|
333
332
|
if ($injector.has("$sanitize")) {
|
|
@@ -562,7 +561,6 @@ export class SceDelegateProvider {
|
|
|
562
561
|
"Attempting to use an unsafe value in a safe context.",
|
|
563
562
|
),
|
|
564
563
|
);
|
|
565
|
-
return;
|
|
566
564
|
}
|
|
567
565
|
|
|
568
566
|
return { trustAs, getTrusted, valueOf };
|
|
@@ -761,7 +759,7 @@ export function SceProvider() {
|
|
|
761
759
|
|
|
762
760
|
/**
|
|
763
761
|
* Shorthand method. `$sce.parseAsHtml(expression string)` →
|
|
764
|
-
* {@link ng.$
|
|
762
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.HTML, value)`}
|
|
765
763
|
*
|
|
766
764
|
* @param {string} expression String expression to compile.
|
|
767
765
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -774,7 +772,7 @@ export function SceProvider() {
|
|
|
774
772
|
|
|
775
773
|
/**
|
|
776
774
|
* Shorthand method. `$sce.parseAsCss(value)` →
|
|
777
|
-
* {@link ng.$
|
|
775
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.CSS, value)`}
|
|
778
776
|
*
|
|
779
777
|
* @param {string} expression String expression to compile.
|
|
780
778
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -787,7 +785,7 @@ export function SceProvider() {
|
|
|
787
785
|
|
|
788
786
|
/**
|
|
789
787
|
* Shorthand method. `$sce.parseAsUrl(value)` →
|
|
790
|
-
* {@link ng.$
|
|
788
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.URL, value)`}
|
|
791
789
|
*
|
|
792
790
|
* @param {string} expression String expression to compile.
|
|
793
791
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -800,7 +798,7 @@ export function SceProvider() {
|
|
|
800
798
|
|
|
801
799
|
/**
|
|
802
800
|
* Shorthand method. `$sce.parseAsResourceUrl(value)` →
|
|
803
|
-
* {@link ng.$
|
|
801
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
|
|
804
802
|
*
|
|
805
803
|
* @param {string} expression String expression to compile.
|
|
806
804
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -813,7 +811,7 @@ export function SceProvider() {
|
|
|
813
811
|
|
|
814
812
|
/**
|
|
815
813
|
* Shorthand method. `$sce.parseAsJs(value)` →
|
|
816
|
-
* {@link ng.$
|
|
814
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.JS, value)`}
|
|
817
815
|
*
|
|
818
816
|
* @param {string} expression String expression to compile.
|
|
819
817
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
package/src/services/sce/sce.md
CHANGED
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
- In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
|
|
83
83
|
- $sce.getTrusted(context, value)} rather than to the value directly. Think of this function as
|
|
84
84
|
- a way to enforce the required security context in your data sink. Directives use {@link
|
|
85
|
-
- ng.$
|
|
85
|
+
- ng.$sceparseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs
|
|
86
86
|
- the {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. Also,
|
|
87
87
|
- when binding without directives, AngularTS will understand the context of your bindings
|
|
88
88
|
- automatically.
|
|
89
89
|
-
|
|
90
90
|
- As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
|
|
91
|
-
- ng.$
|
|
91
|
+
- ng.$sceparseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
|
|
92
92
|
- simplified):
|
|
93
93
|
-
|
|
94
94
|
- ```
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/services/template-cache/template-cache.html";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
package/src/shared/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDate, isFunction, isRegExp, isString } from "./utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { curry } from "./hof.js";
|
|
3
3
|
|
|
4
4
|
export function equals(o1, o2) {
|
|
5
5
|
if (o1 === o2) return true;
|
|
@@ -9,10 +9,10 @@ export function equals(o1, o2) {
|
|
|
9
9
|
t2 = typeof o2;
|
|
10
10
|
if (t1 !== t2 || t1 !== "object") return false;
|
|
11
11
|
const tup = [o1, o2];
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
12
|
+
if (tup.every(Array.isArray)) return _arraysEq(o1, o2);
|
|
13
|
+
if (tup.every(isDate)) return o1.getTime() === o2.getTime();
|
|
14
|
+
if (tup.every(isRegExp)) return o1.toString() === o2.toString();
|
|
15
|
+
if (tup.every(isFunction)) return true; // meh
|
|
16
16
|
if ([isFunction, Array.isArray, isDate, isRegExp].some((fn) => !!fn(tup))) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
@@ -133,11 +133,6 @@ export function _removeFrom(array, obj) {
|
|
|
133
133
|
if (idx >= 0) array.splice(idx, 1);
|
|
134
134
|
return array;
|
|
135
135
|
}
|
|
136
|
-
/** pushes a values to an array and returns the value */
|
|
137
|
-
export const pushTo = curry((arr, val) => {
|
|
138
|
-
arr.push(val);
|
|
139
|
-
return val;
|
|
140
|
-
});
|
|
141
136
|
|
|
142
137
|
/**
|
|
143
138
|
* Applies a set of defaults to an options object. The options object is filtered
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defaults, filter, map, pick, tail } from "./common.js";
|
|
2
2
|
import { is, pattern, val } from "./hof.js";
|
|
3
3
|
import { isInjectable } from "./predicates.js";
|
|
4
|
-
import { Queue } from "
|
|
4
|
+
import { Queue } from "./queue.js";
|
|
5
5
|
|
|
6
6
|
describe("common", function () {
|
|
7
7
|
describe("filter", function () {
|
package/src/shared/hof.js
CHANGED
|
@@ -96,20 +96,6 @@ export const parse = (name) =>
|
|
|
96
96
|
name.split(".").map((name) => (obj) => obj && obj[name]),
|
|
97
97
|
);
|
|
98
98
|
|
|
99
|
-
/**
|
|
100
|
-
* Given two functions that return truthy or falsey values, returns a function that returns truthy
|
|
101
|
-
* if at least one of the functions returns truthy for the given arguments
|
|
102
|
-
*/
|
|
103
|
-
export function or(fn1, fn2) {
|
|
104
|
-
return (...args) => fn1.apply(null, args) || fn2.apply(null, args);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Check if all the elements of an array match a predicate function
|
|
108
|
-
*
|
|
109
|
-
* @param fn1 a predicate function `fn1`
|
|
110
|
-
* @returns a function which takes an array and returns true if `fn1` is true for all elements of the array
|
|
111
|
-
*/
|
|
112
|
-
export const all = (fn1) => (arr) => arr.reduce((b, x) => b && !!fn1(x), true);
|
|
113
99
|
/** Given a class, returns a Predicate function that returns true if the object is of that class */
|
|
114
100
|
export const is = (ctor) => (obj) =>
|
|
115
101
|
(obj != null && obj.constructor === ctor) || obj instanceof ctor;
|
package/src/shared/interface.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { pushTo } from "../../shared/common.js";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* A simple bounded FIFO queue with optional eviction notifications.
|
|
5
3
|
* @template T
|
|
@@ -18,12 +16,14 @@ export class Queue {
|
|
|
18
16
|
|
|
19
17
|
/** @type {Array<(item: T) => void>} */
|
|
20
18
|
this._evictListeners = [];
|
|
19
|
+
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Register a listener that will be called with the evicted item.
|
|
23
|
+
* @param {(item: T) => void} listener
|
|
24
|
+
*/
|
|
25
|
+
onEvict(listener) {
|
|
26
|
+
this._evictListeners.push(listener);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
package/src/shared/shared.html
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<script type="module" src="/src/shared/common.spec.js"></script>
|
|
15
15
|
<script type="module" src="/src/shared/hof.spec.js"></script>
|
|
16
16
|
<script type="module" src="/src/shared/min-err.spec.js"></script>
|
|
17
|
+
<script type="module" src="/src/shared/queue.spec.js"></script>
|
|
17
18
|
<script type="module" src="/src/shared/strings.spec.js"></script>
|
|
18
19
|
<script type="module" src="/src/shared/utils.spec.js"></script>
|
|
19
20
|
</head>
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/shared/shared.html";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { isString } from "../../shared/utils.js";
|
|
2
2
|
|
|
3
|
-
const urlParsingNode = document.createElement("a");
|
|
4
3
|
const originUrl = urlResolve(window.location.href);
|
|
5
|
-
let baseUrlParsingNode;
|
|
6
|
-
|
|
7
|
-
urlParsingNode.href = "http://[::1]";
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* @param {import("./interface.js").ResolvableUrl} url
|
|
@@ -14,7 +10,10 @@ export function urlResolve(url) {
|
|
|
14
10
|
if (!isString(url))
|
|
15
11
|
return /** @type {import("./interface.js").ParsedUrl} */ (url);
|
|
16
12
|
|
|
17
|
-
urlParsingNode
|
|
13
|
+
const urlParsingNode = new URL(
|
|
14
|
+
/** @type {string} */ (url),
|
|
15
|
+
window.location.href,
|
|
16
|
+
);
|
|
18
17
|
|
|
19
18
|
const hostname = urlParsingNode.hostname.includes(":")
|
|
20
19
|
? `[${urlParsingNode.hostname}]`
|
|
@@ -22,9 +21,7 @@ export function urlResolve(url) {
|
|
|
22
21
|
|
|
23
22
|
return {
|
|
24
23
|
href: urlParsingNode.href,
|
|
25
|
-
protocol: urlParsingNode.protocol
|
|
26
|
-
? urlParsingNode.protocol.replace(/:$/, "")
|
|
27
|
-
: "",
|
|
24
|
+
protocol: urlParsingNode.protocol,
|
|
28
25
|
host: urlParsingNode.host,
|
|
29
26
|
search: urlParsingNode.search
|
|
30
27
|
? urlParsingNode.search.replace(/^\?/, "")
|
|
@@ -62,7 +59,7 @@ export function urlIsSameOrigin(requestUrl) {
|
|
|
62
59
|
* @returns {boolean} Whether the URL is same-origin as the document base URL.
|
|
63
60
|
*/
|
|
64
61
|
export function urlIsSameOriginAsBaseUrl(requestUrl) {
|
|
65
|
-
return urlsAreSameOrigin(requestUrl,
|
|
62
|
+
return urlsAreSameOrigin(requestUrl, document.baseURI);
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
/**
|
|
@@ -114,27 +111,6 @@ export function urlsAreSameOrigin(url1, url2) {
|
|
|
114
111
|
return url1.protocol === url2.protocol && url1.host === url2.host;
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
/**
|
|
118
|
-
* Returns the current document base URL.
|
|
119
|
-
* @returns {string}
|
|
120
|
-
*/
|
|
121
|
-
export function getBaseUrl() {
|
|
122
|
-
if (document.baseURI) {
|
|
123
|
-
return document.baseURI;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// `document.baseURI` is available everywhere except IE
|
|
127
|
-
if (!baseUrlParsingNode) {
|
|
128
|
-
baseUrlParsingNode = document.createElement("a");
|
|
129
|
-
baseUrlParsingNode.href = ".";
|
|
130
|
-
|
|
131
|
-
// Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not
|
|
132
|
-
// suitable here because we need to track changes to the base URL.
|
|
133
|
-
baseUrlParsingNode = baseUrlParsingNode.cloneNode(false);
|
|
134
|
-
}
|
|
135
|
-
return baseUrlParsingNode.href;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
114
|
/**
|
|
139
115
|
* Removes a trailing hash ('#') from the given URL if it exists.
|
|
140
116
|
*
|
|
@@ -79,7 +79,7 @@ describe("urlUtils", () => {
|
|
|
79
79
|
beforeEach(() => {
|
|
80
80
|
urlIsAllowedOrigin = urlIsAllowedOriginFactory([
|
|
81
81
|
"https://foo.com/",
|
|
82
|
-
`${origin.protocol}
|
|
82
|
+
`${origin.protocol}//bar.com:1337/`,
|
|
83
83
|
]);
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -89,7 +89,7 @@ describe("urlUtils", () => {
|
|
|
89
89
|
|
|
90
90
|
it("should check against the list of trusted origins", () => {
|
|
91
91
|
expect(urlIsAllowedOrigin("https://foo.com/path")).toBe(true);
|
|
92
|
-
expect(urlIsAllowedOrigin(`${origin.protocol}
|
|
92
|
+
expect(urlIsAllowedOrigin(`${origin.protocol}//bar.com:1337/path`)).toBe(
|
|
93
93
|
true,
|
|
94
94
|
);
|
|
95
95
|
expect(urlIsAllowedOrigin("https://baz.com:1337/path")).toBe(false);
|
|
@@ -104,7 +104,8 @@ describe("urlUtils", () => {
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
it("should return true only if the origins (protocol, hostname, post) match", () => {
|
|
107
|
-
const differentProtocol =
|
|
107
|
+
const differentProtocol =
|
|
108
|
+
origin.protocol !== "http:" ? "http:" : "https:";
|
|
108
109
|
const differentPort = (parseInt(origin.port, 10) || 0) + 1;
|
|
109
110
|
let url;
|
|
110
111
|
|
|
@@ -113,7 +114,7 @@ describe("urlUtils", () => {
|
|
|
113
114
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
114
115
|
|
|
115
116
|
// Same origin
|
|
116
|
-
url = `${origin.protocol}
|
|
117
|
+
url = `${origin.protocol}//${origin.host}/path`;
|
|
117
118
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
118
119
|
|
|
119
120
|
// Same origin - implicit protocol
|
|
@@ -121,15 +122,15 @@ describe("urlUtils", () => {
|
|
|
121
122
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
122
123
|
|
|
123
124
|
// Same origin - different protocol
|
|
124
|
-
url = `${differentProtocol}
|
|
125
|
+
url = `${differentProtocol}//${origin.host}/path`;
|
|
125
126
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
126
127
|
|
|
127
128
|
// Same origin - different port
|
|
128
|
-
url = `${origin.protocol}
|
|
129
|
+
url = `${origin.protocol}//${origin.hostname}:${differentPort}/path`;
|
|
129
130
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
130
131
|
|
|
131
132
|
// Allowed origin
|
|
132
|
-
url = `${origin.protocol}
|
|
133
|
+
url = `${origin.protocol}//bar.com:1337/path`;
|
|
133
134
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
134
135
|
|
|
135
136
|
// Allowed origin - implicit protocol
|
|
@@ -137,11 +138,11 @@ describe("urlUtils", () => {
|
|
|
137
138
|
expect(urlIsAllowedOrigin(url)).toBe(true);
|
|
138
139
|
|
|
139
140
|
// Allowed origin - different protocol
|
|
140
|
-
url = `${differentProtocol}
|
|
141
|
+
url = `${differentProtocol}//bar.com:1337/path`;
|
|
141
142
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
142
143
|
|
|
143
144
|
// Allowed origin - different port
|
|
144
|
-
url = `${origin.protocol}
|
|
145
|
+
url = `${origin.protocol}//bar.com:1338/path`;
|
|
145
146
|
expect(urlIsAllowedOrigin(url)).toBe(false);
|
|
146
147
|
});
|
|
147
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)
|
|
@@ -1239,3 +1232,33 @@ export function callBackAfterFirst(fn) {
|
|
|
1239
1232
|
export function wait(t = 0) {
|
|
1240
1233
|
return new Promise((resolve) => setTimeout(resolve, t));
|
|
1241
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
|
});
|
|
@@ -173,5 +186,18 @@ app.use("/posthtml", express.json());
|
|
|
173
186
|
app.use("/posthtml", express.urlencoded({ extended: true }));
|
|
174
187
|
app.post("/posthtml", (req, res) => {
|
|
175
188
|
console.log(req.body);
|
|
176
|
-
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);
|
|
177
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
|
+
}
|