@cngx/common 0.1.0-rc.0 → 0.1.0-rc.2
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/fesm2022/cngx-common-a11y.mjs +24 -11
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +64 -48
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +45 -11
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +559 -38
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1394 -160
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/package.json +3 -3
- package/stepper/README.md +16 -9
- package/theming/components/cngx-badge.css +1 -1
- package/theming/components/cngx-menu.css +1 -1
- package/types/cngx-common-a11y.d.ts +23 -2
- package/types/cngx-common-data.d.ts +46 -33
- package/types/cngx-common-interactive.d.ts +20 -2
- package/types/cngx-common-stepper.d.ts +604 -17
- package/types/cngx-common-tabs.d.ts +1363 -159
- package/tabs/README.md +0 -32
|
@@ -4894,6 +4894,26 @@ class CngxSwipe {
|
|
|
4894
4894
|
swipeProgress = this.swipeProgressState.asReadonly();
|
|
4895
4895
|
/** Dominant direction of the in-flight gesture, or `null` when idle. */
|
|
4896
4896
|
swipeDirection = this.swipeDirectionState.asReadonly();
|
|
4897
|
+
/**
|
|
4898
|
+
* The `touch-action` the host should advertise, derived from `axis`.
|
|
4899
|
+
* A pinned axis hands the orthogonal direction back to native
|
|
4900
|
+
* scrolling (`x` -> `pan-y`, `y` -> `pan-x`); `both` claims the
|
|
4901
|
+
* whole surface (`none`). When disabled, no value is written so the
|
|
4902
|
+
* element keeps its native scroll behaviour untouched.
|
|
4903
|
+
*/
|
|
4904
|
+
touchAction = computed(() => {
|
|
4905
|
+
if (!this.enabled()) {
|
|
4906
|
+
return null;
|
|
4907
|
+
}
|
|
4908
|
+
switch (this.axis()) {
|
|
4909
|
+
case 'x':
|
|
4910
|
+
return 'pan-y';
|
|
4911
|
+
case 'y':
|
|
4912
|
+
return 'pan-x';
|
|
4913
|
+
default:
|
|
4914
|
+
return 'none';
|
|
4915
|
+
}
|
|
4916
|
+
}, ...(ngDevMode ? [{ debugName: "touchAction" }] : /* istanbul ignore next */ []));
|
|
4897
4917
|
constructor() {
|
|
4898
4918
|
const nativeEl = inject((ElementRef)).nativeElement;
|
|
4899
4919
|
const doc = inject(DOCUMENT);
|
|
@@ -4957,27 +4977,36 @@ class CngxSwipe {
|
|
|
4957
4977
|
.subscribe();
|
|
4958
4978
|
}
|
|
4959
4979
|
/**
|
|
4960
|
-
* Resolve the
|
|
4961
|
-
*
|
|
4980
|
+
* Resolve the swipe direction + distance for a pointer delta.
|
|
4981
|
+
*
|
|
4982
|
+
* When `axis` is pinned, only that axis's delta decides direction
|
|
4983
|
+
* and distance - the orthogonal component is irrelevant, not an
|
|
4984
|
+
* abort reason. The previous endpoint-dominance check (`|dx| >= |dy|`)
|
|
4985
|
+
* discarded a clearly horizontal drag the moment a natural thumb arc
|
|
4986
|
+
* left `|dy|` slightly larger at release, which made a pinned swipe
|
|
4987
|
+
* register only on a near-perfect straight line. `touch-action`
|
|
4988
|
+
* (advertised from the same `axis`) is the real guard against an
|
|
4989
|
+
* orthogonal scroll firing the gesture: the browser cancels the
|
|
4990
|
+
* pointer before pointerup, so a clean cycle reaching here is already
|
|
4991
|
+
* the intended direction. `both` keeps the dominant-axis heuristic.
|
|
4962
4992
|
*/
|
|
4963
4993
|
read(startX, startY, endX, endY) {
|
|
4964
4994
|
const dx = endX - startX;
|
|
4965
4995
|
const dy = endY - startY;
|
|
4966
|
-
const horizontal = Math.abs(dx) >= Math.abs(dy);
|
|
4967
4996
|
const axis = this.axis();
|
|
4968
|
-
if (
|
|
4969
|
-
if (axis === 'y') {
|
|
4970
|
-
return null;
|
|
4971
|
-
}
|
|
4997
|
+
if (axis === 'x') {
|
|
4972
4998
|
return { direction: dx < 0 ? 'left' : 'right', distance: Math.abs(dx) };
|
|
4973
4999
|
}
|
|
4974
|
-
if (axis === '
|
|
4975
|
-
return
|
|
5000
|
+
if (axis === 'y') {
|
|
5001
|
+
return { direction: dy < 0 ? 'up' : 'down', distance: Math.abs(dy) };
|
|
4976
5002
|
}
|
|
4977
|
-
|
|
5003
|
+
const horizontal = Math.abs(dx) >= Math.abs(dy);
|
|
5004
|
+
return horizontal
|
|
5005
|
+
? { direction: dx < 0 ? 'left' : 'right', distance: Math.abs(dx) }
|
|
5006
|
+
: { direction: dy < 0 ? 'up' : 'down', distance: Math.abs(dy) };
|
|
4978
5007
|
}
|
|
4979
5008
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSwipe, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4980
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxSwipe, isStandalone: true, selector: "[cngxSwipe]", inputs: { threshold: { classPropertyName: "threshold", publicName: "threshold", isSignal: true, isRequired: false, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: false, transformFunction: null }, enabled: { classPropertyName: "enabled", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { swiped: "swiped" }, host: { properties: { "style.user-select": "swiping() ? 'none' : null", "style.-webkit-user-select": "swiping() ? 'none' : null" } }, exportAs: ["cngxSwipe"], ngImport: i0 });
|
|
5009
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxSwipe, isStandalone: true, selector: "[cngxSwipe]", inputs: { threshold: { classPropertyName: "threshold", publicName: "threshold", isSignal: true, isRequired: false, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: false, transformFunction: null }, enabled: { classPropertyName: "enabled", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { swiped: "swiped" }, host: { properties: { "style.touch-action": "touchAction()", "style.user-select": "swiping() ? 'none' : null", "style.-webkit-user-select": "swiping() ? 'none' : null" } }, exportAs: ["cngxSwipe"], ngImport: i0 });
|
|
4981
5010
|
}
|
|
4982
5011
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSwipe, decorators: [{
|
|
4983
5012
|
type: Directive,
|
|
@@ -4986,6 +5015,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4986
5015
|
exportAs: 'cngxSwipe',
|
|
4987
5016
|
standalone: true,
|
|
4988
5017
|
host: {
|
|
5018
|
+
// Communicate the gesture's axis intent to the browser so it
|
|
5019
|
+
// never claims the swipe as a scroll. Derived from `axis`, not
|
|
5020
|
+
// hand-set in consumer CSS: every host of this directive gets the
|
|
5021
|
+
// correct touch-action for free instead of re-discovering the bug.
|
|
5022
|
+
'[style.touch-action]': 'touchAction()',
|
|
4989
5023
|
// Scope user-select suppression to the in-flight gesture. A
|
|
4990
5024
|
// bare `user-select: none` on the host kills text selection
|
|
4991
5025
|
// permanently inside the swipe surface even when the user is
|