@dereekb/dbx-web 13.21.0 → 13.22.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/eslint/index.cjs.js +424 -15
- package/eslint/index.esm.js +423 -16
- package/eslint/package.json +5 -4
- package/eslint/src/lib/dbx-action.template-util.d.ts +106 -0
- package/eslint/src/lib/index.d.ts +2 -0
- package/eslint/src/lib/plugin.d.ts +4 -0
- package/eslint/src/lib/require-action-error-handler.rule.d.ts +30 -0
- package/eslint/src/lib/require-action-value-source.rule.d.ts +36 -0
- package/lib/interaction/prompt/_prompt.scss +13 -5
- package/lib/layout/column/_column.scss +8 -3
- package/lib/layout/list/_list.scss +3 -0
- package/lib/style/_theming.scss +0 -2
- package/package.json +7 -7
package/eslint/index.cjs.js
CHANGED
|
@@ -1428,7 +1428,7 @@
|
|
|
1428
1428
|
return result;
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
|
-
function _array_like_to_array(arr, len) {
|
|
1431
|
+
function _array_like_to_array$1(arr, len) {
|
|
1432
1432
|
if (len == null || len > arr.length) len = arr.length;
|
|
1433
1433
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1434
1434
|
return arr2;
|
|
@@ -1436,10 +1436,10 @@ function _array_like_to_array(arr, len) {
|
|
|
1436
1436
|
function _array_with_holes(arr) {
|
|
1437
1437
|
if (Array.isArray(arr)) return arr;
|
|
1438
1438
|
}
|
|
1439
|
-
function _array_without_holes(arr) {
|
|
1440
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
1439
|
+
function _array_without_holes$1(arr) {
|
|
1440
|
+
if (Array.isArray(arr)) return _array_like_to_array$1(arr);
|
|
1441
1441
|
}
|
|
1442
|
-
function _iterable_to_array(iter) {
|
|
1442
|
+
function _iterable_to_array$1(iter) {
|
|
1443
1443
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1444
1444
|
}
|
|
1445
1445
|
function _iterable_to_array_limit(arr, i) {
|
|
@@ -1469,26 +1469,26 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
1469
1469
|
function _non_iterable_rest() {
|
|
1470
1470
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1471
1471
|
}
|
|
1472
|
-
function _non_iterable_spread() {
|
|
1472
|
+
function _non_iterable_spread$1() {
|
|
1473
1473
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1474
1474
|
}
|
|
1475
1475
|
function _sliced_to_array(arr, i) {
|
|
1476
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
1476
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
|
|
1477
1477
|
}
|
|
1478
|
-
function _to_consumable_array(arr) {
|
|
1479
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
1478
|
+
function _to_consumable_array$1(arr) {
|
|
1479
|
+
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
|
|
1480
1480
|
}
|
|
1481
|
-
function _type_of(obj) {
|
|
1481
|
+
function _type_of$1(obj) {
|
|
1482
1482
|
"@swc/helpers - typeof";
|
|
1483
1483
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1484
1484
|
}
|
|
1485
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
1485
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
1486
1486
|
if (!o) return;
|
|
1487
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
1487
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
1488
1488
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1489
1489
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1490
1490
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1491
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1491
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
1492
1492
|
}
|
|
1493
1493
|
/**
|
|
1494
1494
|
* Module that exposes the `toSignal` factory.
|
|
@@ -2038,7 +2038,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
|
-
} else if (child && (typeof child === "undefined" ? "undefined" : _type_of(child)) === 'object' && typeof child.type === 'string') {
|
|
2041
|
+
} else if (child && (typeof child === "undefined" ? "undefined" : _type_of$1(child)) === 'object' && typeof child.type === 'string') {
|
|
2042
2042
|
walk(child, conditional, state);
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
@@ -2438,7 +2438,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2438
2438
|
* @returns The expression text with every flagged call site replaced.
|
|
2439
2439
|
*/ function substituteInExpression(plan, sourceCode) {
|
|
2440
2440
|
var bodyStart = plan.body.range[0];
|
|
2441
|
-
var ordered = _to_consumable_array(plan.replacements).sort(function(a, b) {
|
|
2441
|
+
var ordered = _to_consumable_array$1(plan.replacements).sort(function(a, b) {
|
|
2442
2442
|
return b.node.range[0] - a.node.range[0];
|
|
2443
2443
|
});
|
|
2444
2444
|
var result = sourceCode.getText(plan.body);
|
|
@@ -2516,6 +2516,411 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2516
2516
|
return preview;
|
|
2517
2517
|
}
|
|
2518
2518
|
|
|
2519
|
+
function _array_like_to_array(arr, len) {
|
|
2520
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2521
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2522
|
+
return arr2;
|
|
2523
|
+
}
|
|
2524
|
+
function _array_without_holes(arr) {
|
|
2525
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
2526
|
+
}
|
|
2527
|
+
function _iterable_to_array(iter) {
|
|
2528
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2529
|
+
}
|
|
2530
|
+
function _non_iterable_spread() {
|
|
2531
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2532
|
+
}
|
|
2533
|
+
function _to_consumable_array(arr) {
|
|
2534
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
2535
|
+
}
|
|
2536
|
+
function _type_of(obj) {
|
|
2537
|
+
"@swc/helpers - typeof";
|
|
2538
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2539
|
+
}
|
|
2540
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
2541
|
+
if (!o) return;
|
|
2542
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
2543
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2544
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2545
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2546
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* Attribute selector that marks an element as a `dbxAction` context host.
|
|
2550
|
+
*/ var DBX_ACTION_SELECTOR = 'dbxAction';
|
|
2551
|
+
/**
|
|
2552
|
+
* Element selector form of the action context host (`<dbx-action>`).
|
|
2553
|
+
*/ var DBX_ACTION_ELEMENT_SELECTOR = 'dbx-action';
|
|
2554
|
+
/**
|
|
2555
|
+
* Selector for the action handler input (`[dbxActionHandler]`).
|
|
2556
|
+
*/ var DBX_ACTION_HANDLER_SELECTOR = 'dbxActionHandler';
|
|
2557
|
+
/**
|
|
2558
|
+
* Selector for the directive that forwards an externally-provided action store
|
|
2559
|
+
* (`[dbxActionSource]`). When present, the value/store may be supplied entirely
|
|
2560
|
+
* in TypeScript, so a static template scan cannot reason about completeness.
|
|
2561
|
+
*/ var DBX_ACTION_SOURCE_SELECTOR = 'dbxActionSource';
|
|
2562
|
+
/**
|
|
2563
|
+
* Selectors that cause the action to enter the TRIGGERED state.
|
|
2564
|
+
*/ var DBX_ACTION_TRIGGER_SELECTORS = [
|
|
2565
|
+
'dbxActionButton',
|
|
2566
|
+
'dbxActionButtonTrigger',
|
|
2567
|
+
'dbxActionKeyTrigger',
|
|
2568
|
+
'dbxActionAutoTrigger'
|
|
2569
|
+
];
|
|
2570
|
+
/**
|
|
2571
|
+
* Selectors that provide a value to the action (advancing TRIGGERED → VALUE_READY).
|
|
2572
|
+
*
|
|
2573
|
+
* Includes the bare `dbxActionValue` (which readies the empty-string sentinel on
|
|
2574
|
+
* trigger) and every directive that calls `readyValue()`/`reject()` off `triggered$`.
|
|
2575
|
+
*/ var DBX_ACTION_VALUE_SOURCE_SELECTORS = [
|
|
2576
|
+
'dbxActionValue',
|
|
2577
|
+
'dbxActionValueGetter',
|
|
2578
|
+
'dbxActionValueStream',
|
|
2579
|
+
'dbxActionForm',
|
|
2580
|
+
'dbxActionConfirm',
|
|
2581
|
+
'dbxActionDialog',
|
|
2582
|
+
'dbxActionPopover',
|
|
2583
|
+
'dbxPdfMergeUploadAction'
|
|
2584
|
+
];
|
|
2585
|
+
/**
|
|
2586
|
+
* Selectors that present/handle an action's error.
|
|
2587
|
+
*/ var DBX_ACTION_ERROR_DIRECTIVE_SELECTORS = [
|
|
2588
|
+
'dbxActionSnackbarError',
|
|
2589
|
+
'dbxActionError',
|
|
2590
|
+
'dbxActionSnackbar',
|
|
2591
|
+
'dbxActionErrorHandler'
|
|
2592
|
+
];
|
|
2593
|
+
/**
|
|
2594
|
+
* Array-valued child-bearing properties of Angular template AST nodes that a
|
|
2595
|
+
* context scan must descend into (element/template children plus the branches and
|
|
2596
|
+
* cases of `@if`/`@switch` control-flow blocks).
|
|
2597
|
+
*/ var DBX_ACTION_CHILD_LIST_KEYS = [
|
|
2598
|
+
'children',
|
|
2599
|
+
'branches',
|
|
2600
|
+
'cases'
|
|
2601
|
+
];
|
|
2602
|
+
/**
|
|
2603
|
+
* Single-node child-bearing properties of control-flow blocks (`@for` empty,
|
|
2604
|
+
* `@defer` placeholder/loading/error).
|
|
2605
|
+
*/ var DBX_ACTION_CHILD_NODE_KEYS = [
|
|
2606
|
+
'empty',
|
|
2607
|
+
'placeholder',
|
|
2608
|
+
'loading',
|
|
2609
|
+
'error'
|
|
2610
|
+
];
|
|
2611
|
+
/**
|
|
2612
|
+
* Returns the attribute/input selector names present on a template element node.
|
|
2613
|
+
*
|
|
2614
|
+
* Reads plain attributes (`node.attributes`, e.g. `dbxActionButton`), bound inputs
|
|
2615
|
+
* (`node.inputs`, e.g. `[dbxActionValue]` whose `.name` has no brackets), and the
|
|
2616
|
+
* structural template attributes (`node.templateAttrs`).
|
|
2617
|
+
*
|
|
2618
|
+
* @param node - The template AST node.
|
|
2619
|
+
* @returns The selector names found on the node.
|
|
2620
|
+
*/ function elementTokenNames(node) {
|
|
2621
|
+
var _ref, _ref1, _ref2;
|
|
2622
|
+
var attributes = (_ref = node === null || node === void 0 ? void 0 : node.attributes) !== null && _ref !== void 0 ? _ref : [];
|
|
2623
|
+
var inputs = (_ref1 = node === null || node === void 0 ? void 0 : node.inputs) !== null && _ref1 !== void 0 ? _ref1 : [];
|
|
2624
|
+
var templateAttrs = (_ref2 = node === null || node === void 0 ? void 0 : node.templateAttrs) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
2625
|
+
return _to_consumable_array(attributes).concat(_to_consumable_array(inputs), _to_consumable_array(templateAttrs)).map(function(attr) {
|
|
2626
|
+
return attr === null || attr === void 0 ? void 0 : attr.name;
|
|
2627
|
+
}).filter(function(name) {
|
|
2628
|
+
return typeof name === 'string';
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Returns true when the node is a `dbxAction` context host — either the
|
|
2633
|
+
* `<dbx-action>` element or any element carrying the `dbxAction` attribute.
|
|
2634
|
+
*
|
|
2635
|
+
* @param node - The template AST node.
|
|
2636
|
+
* @returns True when the node hosts an action context.
|
|
2637
|
+
*/ function isActionHost(node) {
|
|
2638
|
+
return (node === null || node === void 0 ? void 0 : node.name) === DBX_ACTION_ELEMENT_SELECTOR || elementTokenNames(node).includes(DBX_ACTION_SELECTOR);
|
|
2639
|
+
}
|
|
2640
|
+
/**
|
|
2641
|
+
* Returns true when the given selector is present on the node itself or on any of
|
|
2642
|
+
* its ancestors (walked via the auto-populated `.parent` chain).
|
|
2643
|
+
*
|
|
2644
|
+
* @param node - The starting template AST node.
|
|
2645
|
+
* @param selector - The selector name to look for.
|
|
2646
|
+
* @returns True when the selector is found on the node or an ancestor.
|
|
2647
|
+
*/ function hasTokenOnSelfOrAncestor(node, selector) {
|
|
2648
|
+
var current = node;
|
|
2649
|
+
var found = false;
|
|
2650
|
+
while(current && !found){
|
|
2651
|
+
if (elementTokenNames(current).includes(selector)) {
|
|
2652
|
+
found = true;
|
|
2653
|
+
} else {
|
|
2654
|
+
current = current.parent;
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return found;
|
|
2658
|
+
}
|
|
2659
|
+
/**
|
|
2660
|
+
* Scans the subtree rooted at a `dbxAction` element, collecting the directive
|
|
2661
|
+
* selectors present on the element and its descendants.
|
|
2662
|
+
*
|
|
2663
|
+
* Descent steps through structural wrappers (`Template`) and control-flow blocks
|
|
2664
|
+
* (`@if`/`@for`/`@switch`/`@defer`). A nested action host re-scopes the context, so
|
|
2665
|
+
* the scan flags `nestedAction` and does not descend into it (its value source
|
|
2666
|
+
* belongs to the inner context, not this one).
|
|
2667
|
+
*
|
|
2668
|
+
* @param root - The `dbxAction` element node to scan from.
|
|
2669
|
+
* @returns The collected selector tokens and whether a nested action was found.
|
|
2670
|
+
*/ function collectActionContext(root) {
|
|
2671
|
+
var tokens = new Set();
|
|
2672
|
+
var state = {
|
|
2673
|
+
nestedAction: false
|
|
2674
|
+
};
|
|
2675
|
+
var walk = function walk1(node, isRoot) {
|
|
2676
|
+
if (!node || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== 'object') {
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
if (!isRoot && isActionHost(node)) {
|
|
2680
|
+
state.nestedAction = true;
|
|
2681
|
+
return; // do not descend into a nested action context
|
|
2682
|
+
}
|
|
2683
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2684
|
+
try {
|
|
2685
|
+
for(var _iterator = elementTokenNames(node)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2686
|
+
var name = _step.value;
|
|
2687
|
+
tokens.add(name);
|
|
2688
|
+
}
|
|
2689
|
+
} catch (err) {
|
|
2690
|
+
_didIteratorError = true;
|
|
2691
|
+
_iteratorError = err;
|
|
2692
|
+
} finally{
|
|
2693
|
+
try {
|
|
2694
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2695
|
+
_iterator.return();
|
|
2696
|
+
}
|
|
2697
|
+
} finally{
|
|
2698
|
+
if (_didIteratorError) {
|
|
2699
|
+
throw _iteratorError;
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2704
|
+
try {
|
|
2705
|
+
for(var _iterator1 = DBX_ACTION_CHILD_LIST_KEYS[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2706
|
+
var key = _step1.value;
|
|
2707
|
+
var children = node[key];
|
|
2708
|
+
if (Array.isArray(children)) {
|
|
2709
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
2710
|
+
try {
|
|
2711
|
+
for(var _iterator2 = children[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
2712
|
+
var child = _step2.value;
|
|
2713
|
+
walk(child, false);
|
|
2714
|
+
}
|
|
2715
|
+
} catch (err) {
|
|
2716
|
+
_didIteratorError2 = true;
|
|
2717
|
+
_iteratorError2 = err;
|
|
2718
|
+
} finally{
|
|
2719
|
+
try {
|
|
2720
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
2721
|
+
_iterator2.return();
|
|
2722
|
+
}
|
|
2723
|
+
} finally{
|
|
2724
|
+
if (_didIteratorError2) {
|
|
2725
|
+
throw _iteratorError2;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
} catch (err) {
|
|
2732
|
+
_didIteratorError1 = true;
|
|
2733
|
+
_iteratorError1 = err;
|
|
2734
|
+
} finally{
|
|
2735
|
+
try {
|
|
2736
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2737
|
+
_iterator1.return();
|
|
2738
|
+
}
|
|
2739
|
+
} finally{
|
|
2740
|
+
if (_didIteratorError1) {
|
|
2741
|
+
throw _iteratorError1;
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
|
|
2746
|
+
try {
|
|
2747
|
+
for(var _iterator3 = DBX_ACTION_CHILD_NODE_KEYS[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
|
|
2748
|
+
var key1 = _step3.value;
|
|
2749
|
+
var child1 = node[key1];
|
|
2750
|
+
if (child1 && (typeof child1 === "undefined" ? "undefined" : _type_of(child1)) === 'object') {
|
|
2751
|
+
walk(child1, false);
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
} catch (err) {
|
|
2755
|
+
_didIteratorError3 = true;
|
|
2756
|
+
_iteratorError3 = err;
|
|
2757
|
+
} finally{
|
|
2758
|
+
try {
|
|
2759
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
2760
|
+
_iterator3.return();
|
|
2761
|
+
}
|
|
2762
|
+
} finally{
|
|
2763
|
+
if (_didIteratorError3) {
|
|
2764
|
+
throw _iteratorError3;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
};
|
|
2769
|
+
walk(root, true);
|
|
2770
|
+
return {
|
|
2771
|
+
tokens: tokens,
|
|
2772
|
+
nestedAction: state.nestedAction
|
|
2773
|
+
};
|
|
2774
|
+
}
|
|
2775
|
+
/**
|
|
2776
|
+
* Resolves the template parser services from the rule context, supporting both the
|
|
2777
|
+
* flat-config `context.sourceCode` accessor and the legacy `context.parserServices`.
|
|
2778
|
+
*
|
|
2779
|
+
* @param context - The ESLint rule context.
|
|
2780
|
+
* @returns The parser services object, or null when unavailable.
|
|
2781
|
+
*/ function getTemplateParserServices(context) {
|
|
2782
|
+
var _context_sourceCode, _ref, _ref1;
|
|
2783
|
+
var sourceCode = (_context_sourceCode = context.sourceCode) !== null && _context_sourceCode !== void 0 ? _context_sourceCode : typeof context.getSourceCode === 'function' ? context.getSourceCode() : undefined;
|
|
2784
|
+
return (_ref = (_ref1 = sourceCode === null || sourceCode === void 0 ? void 0 : sourceCode.parserServices) !== null && _ref1 !== void 0 ? _ref1 : context.parserServices) !== null && _ref !== void 0 ? _ref : null;
|
|
2785
|
+
}
|
|
2786
|
+
/**
|
|
2787
|
+
* Computes the report location for an action element from its source span.
|
|
2788
|
+
*
|
|
2789
|
+
* @param parserServices - The template parser services (must expose `convertNodeSourceSpanToLoc`).
|
|
2790
|
+
* @param node - The element AST node being reported.
|
|
2791
|
+
* @returns An ESLint `SourceLocation` for the element's opening tag.
|
|
2792
|
+
*/ function actionElementLoc(parserServices, node) {
|
|
2793
|
+
var _node_startSourceSpan;
|
|
2794
|
+
return parserServices.convertNodeSourceSpanToLoc((_node_startSourceSpan = node.startSourceSpan) !== null && _node_startSourceSpan !== void 0 ? _node_startSourceSpan : node.sourceSpan);
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
/**
|
|
2798
|
+
* ESLint (Angular template) rule that flags a `dbxAction` whose context has a
|
|
2799
|
+
* trigger but no value source.
|
|
2800
|
+
*
|
|
2801
|
+
* Such an action hangs: clicking the trigger moves the store to TRIGGERED, but with
|
|
2802
|
+
* nothing to call `readyValue()` it never advances to VALUE_READY, so the handler
|
|
2803
|
+
* never runs.
|
|
2804
|
+
*
|
|
2805
|
+
* Targets simple, inline cases only. It bails (does not report) when the value may
|
|
2806
|
+
* be supplied in a way a static template scan cannot see:
|
|
2807
|
+
* - `[dbxActionSource]` on the element or an ancestor (store forwarded from TS), or
|
|
2808
|
+
* - a nested `dbxAction` inside the subtree (ambiguous which context owns a value source).
|
|
2809
|
+
*
|
|
2810
|
+
* For legitimate programmatic-value cases (or a demo intentionally showing the
|
|
2811
|
+
* TRIGGERED state) suppress with `<!-- eslint-disable-next-line dereekb-dbx-web/require-action-value-source -->`.
|
|
2812
|
+
*/ var DBX_WEB_REQUIRE_ACTION_VALUE_SOURCE_RULE = {
|
|
2813
|
+
meta: {
|
|
2814
|
+
type: 'problem',
|
|
2815
|
+
fixable: undefined,
|
|
2816
|
+
docs: {
|
|
2817
|
+
description: 'Require a value source on a triggered dbxAction so it cannot hang in the TRIGGERED state.',
|
|
2818
|
+
recommended: true
|
|
2819
|
+
},
|
|
2820
|
+
messages: {
|
|
2821
|
+
missingValueSource: '`dbxAction` has a trigger (`{{trigger}}`) but no value source, so triggering it hangs — the action never reaches VALUE_READY and the handler never runs. Add a value source (`dbxActionValue`, `[dbxActionValue]`, `[dbxActionValueGetter]`, `[dbxActionValueStream]`, or `[dbxActionForm]`), trigger with `triggerWithValue()`, or disable this line if the value is supplied in TypeScript.'
|
|
2822
|
+
},
|
|
2823
|
+
schema: []
|
|
2824
|
+
},
|
|
2825
|
+
create: function create(context) {
|
|
2826
|
+
var parserServices = getTemplateParserServices(context);
|
|
2827
|
+
return {
|
|
2828
|
+
Element: function Element(node) {
|
|
2829
|
+
if (!(parserServices === null || parserServices === void 0 ? void 0 : parserServices.convertNodeSourceSpanToLoc)) {
|
|
2830
|
+
return; // not an Angular template (no template parser services)
|
|
2831
|
+
}
|
|
2832
|
+
if (!isActionHost(node)) {
|
|
2833
|
+
return;
|
|
2834
|
+
}
|
|
2835
|
+
if (hasTokenOnSelfOrAncestor(node, DBX_ACTION_SOURCE_SELECTOR)) {
|
|
2836
|
+
return; // store/value may be forwarded from an external (TS) source
|
|
2837
|
+
}
|
|
2838
|
+
var _collectActionContext = collectActionContext(node), tokens = _collectActionContext.tokens, nestedAction = _collectActionContext.nestedAction;
|
|
2839
|
+
if (nestedAction) {
|
|
2840
|
+
return; // multiple action contexts — ambiguous which owns a value source
|
|
2841
|
+
}
|
|
2842
|
+
var trigger = DBX_ACTION_TRIGGER_SELECTORS.find(function(selector) {
|
|
2843
|
+
return tokens.has(selector);
|
|
2844
|
+
});
|
|
2845
|
+
if (!trigger) {
|
|
2846
|
+
return; // not trigger-driven (form/auto/programmatic) — out of scope
|
|
2847
|
+
}
|
|
2848
|
+
var hasValueSource = DBX_ACTION_VALUE_SOURCE_SELECTORS.some(function(selector) {
|
|
2849
|
+
return tokens.has(selector);
|
|
2850
|
+
});
|
|
2851
|
+
if (!hasValueSource) {
|
|
2852
|
+
context.report({
|
|
2853
|
+
loc: actionElementLoc(parserServices, node),
|
|
2854
|
+
messageId: 'missingValueSource',
|
|
2855
|
+
data: {
|
|
2856
|
+
trigger: trigger
|
|
2857
|
+
}
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
};
|
|
2862
|
+
}
|
|
2863
|
+
};
|
|
2864
|
+
|
|
2865
|
+
/**
|
|
2866
|
+
* ESLint (Angular template) rule that flags a `dbxAction` which runs work (has a
|
|
2867
|
+
* handler or a trigger) but presents no errors to the user.
|
|
2868
|
+
*
|
|
2869
|
+
* Satisfied by ANY error directive in the context: `dbxActionSnackbarError`,
|
|
2870
|
+
* `[dbxActionError]`, `[dbxActionSnackbar]`, or `[dbxActionErrorHandler]`.
|
|
2871
|
+
*
|
|
2872
|
+
* Shares the same context-scoping bail conditions as `require-action-value-source`
|
|
2873
|
+
* (`[dbxActionSource]` on self/ancestor, or a nested `dbxAction`).
|
|
2874
|
+
*/ var DBX_WEB_REQUIRE_ACTION_ERROR_HANDLER_RULE = {
|
|
2875
|
+
meta: {
|
|
2876
|
+
type: 'suggestion',
|
|
2877
|
+
fixable: undefined,
|
|
2878
|
+
docs: {
|
|
2879
|
+
description: 'Require an error-presentation directive on a dbxAction that runs a handler so failures surface to the user.',
|
|
2880
|
+
recommended: false
|
|
2881
|
+
},
|
|
2882
|
+
messages: {
|
|
2883
|
+
missingErrorHandler: '`dbxAction` runs a handler but surfaces no errors to the user. Add `dbxActionSnackbarError` (or `[dbxActionError]`, `[dbxActionSnackbar]`, or `[dbxActionErrorHandler]`) so action failures are presented.'
|
|
2884
|
+
},
|
|
2885
|
+
schema: []
|
|
2886
|
+
},
|
|
2887
|
+
create: function create(context) {
|
|
2888
|
+
var parserServices = getTemplateParserServices(context);
|
|
2889
|
+
return {
|
|
2890
|
+
Element: function Element(node) {
|
|
2891
|
+
if (!(parserServices === null || parserServices === void 0 ? void 0 : parserServices.convertNodeSourceSpanToLoc)) {
|
|
2892
|
+
return; // not an Angular template (no template parser services)
|
|
2893
|
+
}
|
|
2894
|
+
if (!isActionHost(node)) {
|
|
2895
|
+
return;
|
|
2896
|
+
}
|
|
2897
|
+
if (hasTokenOnSelfOrAncestor(node, DBX_ACTION_SOURCE_SELECTOR)) {
|
|
2898
|
+
return; // forwarded external context — error handling may live elsewhere
|
|
2899
|
+
}
|
|
2900
|
+
var _collectActionContext = collectActionContext(node), tokens = _collectActionContext.tokens, nestedAction = _collectActionContext.nestedAction;
|
|
2901
|
+
if (nestedAction) {
|
|
2902
|
+
return; // multiple action contexts — ambiguous
|
|
2903
|
+
}
|
|
2904
|
+
var hasHandlerOrTrigger = tokens.has(DBX_ACTION_HANDLER_SELECTOR) || DBX_ACTION_TRIGGER_SELECTORS.some(function(selector) {
|
|
2905
|
+
return tokens.has(selector);
|
|
2906
|
+
});
|
|
2907
|
+
if (!hasHandlerOrTrigger) {
|
|
2908
|
+
return; // nothing actionable here — skip
|
|
2909
|
+
}
|
|
2910
|
+
var hasErrorDirective = DBX_ACTION_ERROR_DIRECTIVE_SELECTORS.some(function(selector) {
|
|
2911
|
+
return tokens.has(selector);
|
|
2912
|
+
});
|
|
2913
|
+
if (!hasErrorDirective) {
|
|
2914
|
+
context.report({
|
|
2915
|
+
loc: actionElementLoc(parserServices, node),
|
|
2916
|
+
messageId: 'missingErrorHandler'
|
|
2917
|
+
});
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
};
|
|
2923
|
+
|
|
2519
2924
|
/**
|
|
2520
2925
|
* ESLint plugin for dbx-web rules.
|
|
2521
2926
|
*
|
|
@@ -2528,7 +2933,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2528
2933
|
'no-redundant-on-destroy': DBX_WEB_NO_REDUNDANT_ON_DESTROY_RULE,
|
|
2529
2934
|
'require-computed-signal-suffix': DBX_WEB_REQUIRE_COMPUTED_SIGNAL_SUFFIX_RULE,
|
|
2530
2935
|
'require-component-config-input': DBX_WEB_REQUIRE_COMPONENT_CONFIG_INPUT_RULE,
|
|
2531
|
-
'require-top-level-computed-signals': DBX_WEB_REQUIRE_TOP_LEVEL_COMPUTED_SIGNALS_RULE
|
|
2936
|
+
'require-top-level-computed-signals': DBX_WEB_REQUIRE_TOP_LEVEL_COMPUTED_SIGNALS_RULE,
|
|
2937
|
+
'require-action-value-source': DBX_WEB_REQUIRE_ACTION_VALUE_SOURCE_RULE,
|
|
2938
|
+
'require-action-error-handler': DBX_WEB_REQUIRE_ACTION_ERROR_HANDLER_RULE
|
|
2532
2939
|
}
|
|
2533
2940
|
};
|
|
2534
2941
|
/**
|
|
@@ -2539,6 +2946,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2539
2946
|
|
|
2540
2947
|
exports.DBX_WEB_ESLINT_PLUGIN = DBX_WEB_ESLINT_PLUGIN;
|
|
2541
2948
|
exports.DBX_WEB_NO_REDUNDANT_ON_DESTROY_RULE = DBX_WEB_NO_REDUNDANT_ON_DESTROY_RULE;
|
|
2949
|
+
exports.DBX_WEB_REQUIRE_ACTION_ERROR_HANDLER_RULE = DBX_WEB_REQUIRE_ACTION_ERROR_HANDLER_RULE;
|
|
2950
|
+
exports.DBX_WEB_REQUIRE_ACTION_VALUE_SOURCE_RULE = DBX_WEB_REQUIRE_ACTION_VALUE_SOURCE_RULE;
|
|
2542
2951
|
exports.DBX_WEB_REQUIRE_CLEAN_SUBSCRIPTION_RULE = DBX_WEB_REQUIRE_CLEAN_SUBSCRIPTION_RULE;
|
|
2543
2952
|
exports.DBX_WEB_REQUIRE_COMPLETE_ON_DESTROY_RULE = DBX_WEB_REQUIRE_COMPLETE_ON_DESTROY_RULE;
|
|
2544
2953
|
exports.DBX_WEB_REQUIRE_COMPONENT_CONFIG_INPUT_RULE = DBX_WEB_REQUIRE_COMPONENT_CONFIG_INPUT_RULE;
|