@dereekb/dbx-web 14.0.0 → 14.1.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.
@@ -2864,6 +2864,45 @@ function _unsupported_iterable_to_array(o, minLen) {
2864
2864
  }
2865
2865
  };
2866
2866
 
2867
+ /**
2868
+ * Token the autofix appends to an action host that presents no errors.
2869
+ */ var DBX_ACTION_ERROR_FIX_TOKEN = 'dbxActionSnackbarError';
2870
+ /**
2871
+ * Builds the fix that appends {@link DBX_ACTION_ERROR_FIX_TOKEN} to the action host's
2872
+ * start tag, inserting just inside the closing `>` (or before the `/` of a
2873
+ * self-closing `/>`).
2874
+ *
2875
+ * Returns `null` — declining to fix — whenever the start tag is not shaped the way
2876
+ * this expects, so a malformed or unexpected template is left alone rather than
2877
+ * rewritten on a guess.
2878
+ *
2879
+ * @param context - The rule context, used for the template source text.
2880
+ * @param node - The action host element being reported.
2881
+ * @param fixer - The ESLint fixer.
2882
+ * @returns The fix, or null when the start tag could not be located.
2883
+ */ function actionErrorDirectiveFix(context, node, fixer) {
2884
+ var _context_sourceCode_getText, _context_sourceCode;
2885
+ var startSpan = node.startSourceSpan;
2886
+ var text = (_context_sourceCode = context.sourceCode) === null || _context_sourceCode === void 0 ? void 0 : (_context_sourceCode_getText = _context_sourceCode.getText) === null || _context_sourceCode_getText === void 0 ? void 0 : _context_sourceCode_getText.call(_context_sourceCode);
2887
+ var result = null;
2888
+ if (startSpan && text) {
2889
+ var closeOffset = startSpan.end.offset - 1;
2890
+ if (text[closeOffset] === '>') {
2891
+ // step back over the '/' of a self-closing tag so the token lands inside the tag
2892
+ var insertAt = text[closeOffset - 1] === '/' ? closeOffset - 1 : closeOffset;
2893
+ // then back over any trailing whitespace, so the token appends directly after the
2894
+ // last attribute rather than doubling a space or landing past a newline-indented '>'
2895
+ while(insertAt > 0 && /\s/.test(text[insertAt - 1])){
2896
+ insertAt -= 1;
2897
+ }
2898
+ result = fixer.replaceTextRange([
2899
+ insertAt,
2900
+ insertAt
2901
+ ], " ".concat(DBX_ACTION_ERROR_FIX_TOKEN));
2902
+ }
2903
+ }
2904
+ return result;
2905
+ }
2867
2906
  /**
2868
2907
  * ESLint (Angular template) rule that flags a `dbxAction` which runs work (has a
2869
2908
  * handler or a trigger) but presents no errors to the user.
@@ -2873,10 +2912,22 @@ function _unsupported_iterable_to_array(o, minLen) {
2873
2912
  *
2874
2913
  * Shares the same context-scoping bail conditions as `require-action-value-source`
2875
2914
  * (`[dbxActionSource]` on self/ancestor, or a nested `dbxAction`).
2915
+ *
2916
+ * The autofix appends the bare `dbxActionSnackbarError` token to the action host's
2917
+ * start tag — the canonical default, and the form every compliant call site uses.
2918
+ *
2919
+ * IMPORTANT: `DbxActionSnackbarErrorDirective` is a standalone directive from
2920
+ * `@dereekb/dbx-web`, so the fix is only complete once the component also lists it
2921
+ * in `imports`. A template fixer cannot add that (for an external `.html` the
2922
+ * imports live in a different file entirely), and Angular does NOT reject an
2923
+ * unmatched bare attribute — it degrades to an inert DOM attribute. So `--fix`
2924
+ * silences this rule whether or not the import lands. Always add the import
2925
+ * alongside the fix, and prefer `dbxActionErrorHandler` (which lives in
2926
+ * `@dereekb/dbx-core`) wherever a dbx-web dependency would be a layering violation.
2876
2927
  */ var DBX_WEB_REQUIRE_ACTION_ERROR_HANDLER_RULE = {
2877
2928
  meta: {
2878
2929
  type: 'suggestion',
2879
- fixable: undefined,
2930
+ fixable: 'code',
2880
2931
  docs: {
2881
2932
  description: 'Require an error-presentation directive on a dbxAction that runs a handler so failures surface to the user.',
2882
2933
  recommended: false
@@ -2915,7 +2966,10 @@ function _unsupported_iterable_to_array(o, minLen) {
2915
2966
  if (!hasErrorDirective) {
2916
2967
  context.report({
2917
2968
  loc: actionElementLoc(parserServices, node),
2918
- messageId: 'missingErrorHandler'
2969
+ messageId: 'missingErrorHandler',
2970
+ fix: function fix(fixer) {
2971
+ return actionErrorDirectiveFix(context, node, fixer);
2972
+ }
2919
2973
  });
2920
2974
  }
2921
2975
  }
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-web/eslint",
3
- "version": "14.0.0",
3
+ "version": "14.1.0",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
- "@dereekb/util": "14.0.0",
6
+ "@dereekb/util": "14.1.0",
7
7
  "@typescript-eslint/utils": "8.69.0"
8
8
  },
9
9
  "devDependencies": {
10
10
  "@angular-eslint/template-parser": "22.2.0",
11
11
  "@angular/core": "22.1.4",
12
- "@dereekb/dbx-core": "14.0.0",
13
- "@dereekb/rxjs": "14.0.0",
12
+ "@dereekb/dbx-core": "14.1.0",
13
+ "@dereekb/rxjs": "14.1.0",
14
14
  "@typescript-eslint/parser": "8.69.0",
15
15
  "eslint": "10.9.1",
16
16
  "rxjs": "^7.8.2"
@@ -5,7 +5,7 @@ import { type AstNode } from './util';
5
5
  export interface DbxWebRequireActionErrorHandlerRuleDefinition {
6
6
  readonly meta: {
7
7
  readonly type: 'suggestion';
8
- readonly fixable: undefined;
8
+ readonly fixable: 'code';
9
9
  readonly docs: {
10
10
  readonly description: string;
11
11
  readonly recommended: boolean;
@@ -26,5 +26,17 @@ export interface DbxWebRequireActionErrorHandlerRuleDefinition {
26
26
  *
27
27
  * Shares the same context-scoping bail conditions as `require-action-value-source`
28
28
  * (`[dbxActionSource]` on self/ancestor, or a nested `dbxAction`).
29
+ *
30
+ * The autofix appends the bare `dbxActionSnackbarError` token to the action host's
31
+ * start tag — the canonical default, and the form every compliant call site uses.
32
+ *
33
+ * IMPORTANT: `DbxActionSnackbarErrorDirective` is a standalone directive from
34
+ * `@dereekb/dbx-web`, so the fix is only complete once the component also lists it
35
+ * in `imports`. A template fixer cannot add that (for an external `.html` the
36
+ * imports live in a different file entirely), and Angular does NOT reject an
37
+ * unmatched bare attribute — it degrades to an inert DOM attribute. So `--fix`
38
+ * silences this rule whether or not the import lands. Always add the import
39
+ * alongside the fix, and prefer `dbxActionErrorHandler` (which lives in
40
+ * `@dereekb/dbx-core`) wherever a dbx-web dependency would be a layering violation.
29
41
  */
30
42
  export declare const DBX_WEB_REQUIRE_ACTION_ERROR_HANDLER_RULE: DbxWebRequireActionErrorHandlerRuleDefinition;
@@ -597,7 +597,17 @@ class DbxMapboxMapStore extends ComponentStore {
597
597
  setMinimumVirtualViewportSize = this.updater((state, minimumVirtualViewportSize) => ({ ...state, minimumVirtualViewportSize }));
598
598
  setUseVirtualBound = this.updater((state, useVirtualBound) => ({ ...state, useVirtualBound }));
599
599
  setBoundRefreshSettings = this.updater((state, boundRefreshSettings) => ({ ...state, boundRefreshSettings: { ...state.boundRefreshSettings, ...boundRefreshSettings } }));
600
- _setMapService = this.updater((state, mapService) => ({ mapService, moveState: 'init', lifecycleState: 'init', zoomState: 'init', rotateState: 'init', retainContent: state.retainContent, drawerContent: state.retainContent ? state.drawerContent : undefined, useVirtualBound: state.useVirtualBound, boundRefreshSettings: state.boundRefreshSettings }));
600
+ _setMapService = this.updater((state, mapService) => ({
601
+ mapService,
602
+ moveState: 'init',
603
+ lifecycleState: 'init',
604
+ zoomState: 'init',
605
+ rotateState: 'init',
606
+ retainContent: state.retainContent,
607
+ drawerContent: state.retainContent ? state.drawerContent : undefined,
608
+ useVirtualBound: state.useVirtualBound,
609
+ boundRefreshSettings: state.boundRefreshSettings
610
+ }));
601
611
  _setLifecycleState = this.updater((state, lifecycleState) => ({ ...state, lifecycleState }));
602
612
  _setMoveState = this.updater((state, moveState) => ({ ...state, moveState }));
603
613
  _setZoomState = this.updater((state, zoomState) => ({ ...state, zoomState }));