ariadne_view_components 0.0.51-x64-mingw-ucrt → 0.0.53-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,10 +30,9 @@ export default class OptionsController extends SyncedBooleanAttributesController
30
30
  activeOptionsValue: TActiveOptions;
31
31
  readonly isMultiValue: boolean;
32
32
  readonly toggleableValue: boolean;
33
- optionTargetLookup: Map<Element, TOptionKey>;
34
33
  select(event: Event, updateTo?: TOutletChangeData<TActiveOptions>): void;
35
- optionsTargetConnected(element: Element): void;
36
- getValueForElement(element: Element): boolean | null;
34
+ optionTargetConnected(element: Element): void;
35
+ getValueForElement(element: Element): boolean;
37
36
  getState(): TActiveOptions;
38
37
  outletUpdate: (event: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void;
39
38
  }
@@ -30,10 +30,9 @@ export default class OptionsController extends SyncedBooleanAttributesController
30
30
  activeOptionsValue: TActiveOptions;
31
31
  readonly isMultiValue: boolean;
32
32
  readonly toggleableValue: boolean;
33
- optionTargetLookup: Map<Element, TOptionKey>;
34
33
  select(event: Event, updateTo?: TOutletChangeData<TActiveOptions>): void;
35
- optionsTargetConnected(element: Element): void;
36
- getValueForElement(element: Element): boolean | null;
34
+ optionTargetConnected(element: Element): void;
35
+ getValueForElement(element: Element): boolean;
37
36
  getState(): TActiveOptions;
38
37
  outletUpdate: (event: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void;
39
38
  }
@@ -9,7 +9,6 @@ class OptionsController extends SyncedBooleanAttributesController {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  _OptionsController_instances.add(this);
12
- this.optionTargetLookup = new Map();
13
12
  this.outletUpdate = this.select;
14
13
  }
15
14
  select(event, updateTo = {}) {
@@ -31,20 +30,19 @@ class OptionsController extends SyncedBooleanAttributesController {
31
30
  }
32
31
  this.sendToOutlets(event, Object.assign(Object.assign({}, updateTo), { data: this.activeOptionsValue }));
33
32
  }
34
- optionsTargetConnected(element) {
33
+ optionTargetConnected(element) {
35
34
  const key = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, element);
36
- if (this.doesElementHaveOnAttrs(element)) {
35
+ const isActive = this.activeOptionsValue[key] || this.doesElementHaveOnAttrs(element);
36
+ if (isActive) {
37
37
  __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateKey).call(this, key);
38
38
  }
39
39
  else {
40
40
  __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_deactivateKey).call(this, key);
41
41
  }
42
+ this.updateAttributesForElement(element, isActive);
42
43
  }
43
44
  getValueForElement(element) {
44
45
  var _a;
45
- if (!this.optionTargetLookup.has(element)) {
46
- return null;
47
- }
48
46
  const optionKey = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, element);
49
47
  return (_a = this.activeOptionsValue[optionKey]) !== null && _a !== void 0 ? _a : false;
50
48
  }
@@ -29,8 +29,6 @@ export default class OptionsController
29
29
  declare readonly isMultiValue: boolean
30
30
  declare readonly toggleableValue: boolean
31
31
 
32
- optionTargetLookup: Map<Element, TOptionKey> = new Map()
33
-
34
32
  select(event: Event, updateTo: TOutletChangeData<TActiveOptions> = {}) {
35
33
  const activeOptions = updateTo.data
36
34
  for (let index in this.optionTargets) {
@@ -53,13 +51,16 @@ export default class OptionsController
53
51
  this.sendToOutlets(event, {...updateTo, data: this.activeOptionsValue})
54
52
  }
55
53
 
56
- optionsTargetConnected(element: Element) {
54
+ optionTargetConnected(element: Element) {
57
55
  const key = this.#getElementKey(element)
58
- if (this.doesElementHaveOnAttrs(element)) {
56
+ const isActive = this.activeOptionsValue[key] || this.doesElementHaveOnAttrs(element)
57
+ if (isActive) {
59
58
  this.#activateKey(key)
60
59
  } else {
61
60
  this.#deactivateKey(key)
62
61
  }
62
+
63
+ this.updateAttributesForElement(element, isActive)
63
64
  }
64
65
 
65
66
  #shouldChangeState(isCurrentlyActive: boolean, wasSelected: boolean) {
@@ -104,10 +105,6 @@ export default class OptionsController
104
105
  }
105
106
 
106
107
  getValueForElement(element: Element) {
107
- if (!this.optionTargetLookup.has(element)) {
108
- return null
109
- }
110
-
111
108
  const optionKey = this.#getElementKey(element)
112
109
  return this.activeOptionsValue[optionKey] ?? false
113
110
  }
@@ -30,6 +30,7 @@ export default class StringMatchController
30
30
  this.#compareKeywordToTargets()
31
31
  this.sendToOutlets(event, {...updateTo, data: this.keywordValue})
32
32
  }
33
+
33
34
  #compareKeywordToTargets() {
34
35
  if (this.hasMatchTarget) {
35
36
  let foundMatch = false
@@ -59,7 +59,7 @@ module Ariadne
59
59
 
60
60
  unless silence_warnings?
61
61
  message = <<~MSG
62
- Ariadne: note that `#{preferred_tag}` is the preferred tag here;
62
+ Ariadne: note that `#{preferred_tag}` is the preferred tag for `#{self.class.name}`;
63
63
  you passed `#{given_tag}` (which will still be used)
64
64
  MSG
65
65
 
@@ -75,7 +75,7 @@ module Ariadne
75
75
 
76
76
  unless silence_warnings?
77
77
  message = <<~MSG
78
- Ariadne: note that `#{preferred_attribute}` is the preferred attribute here;
78
+ Ariadne: note that `#{preferred_attribute}` is the preferred attribute for `#{self.class.name}`;
79
79
  you passed `#{given_attribute}` (which will still be used)
80
80
  MSG
81
81
 
@@ -15,7 +15,7 @@ module ERBLint
15
15
  end
16
16
 
17
17
  def correction(args)
18
- return nil if args.nil?
18
+ return if args.nil?
19
19
 
20
20
  correction = "<%= render #{self.class::COMPONENT}.new"
21
21
  correction += "(#{args})" if args.present?
@@ -159,13 +159,13 @@ module ERBLint
159
159
  # Unless explicitly set, we don't want to mark correctable offenses if the counter is correct.
160
160
  if !@config.override_ignores_if_correctable? && expected_count == @total_offenses
161
161
  clear_offenses
162
- return
162
+ return false
163
163
  end
164
164
 
165
165
  if @offenses_not_corrected.zero?
166
166
  # have to adjust to get `\n` so we delete the whole line
167
167
  add_offense(processed_source.to_source_range(comment_node.loc.adjust(end_pos: 1)), "Unused erblint:count comment for #{rule_name}", "") if comment_node
168
- return
168
+ return false
169
169
  end
170
170
 
171
171
  first_offense = @offenses[0]
@@ -3,6 +3,6 @@
3
3
  # :nocov:
4
4
  module Ariadne
5
5
  module ViewComponents
6
- VERSION = "0.0.51"
6
+ VERSION = "0.0.53"
7
7
  end
8
8
  end
@@ -12,7 +12,7 @@ module RuboCop
12
12
  # We only verify SystemArguments if it's a `.new` call on a component or
13
13
  # a ViewHeleper call.
14
14
  def valid_node?(node)
15
- return if node.nil?
15
+ return false if node.nil?
16
16
 
17
17
  view_helpers.include?(node.method_name) || (node.method_name == :new && !node.receiver.nil? && ::Ariadne::ViewComponents::STATUSES.key?(node.receiver.const_name))
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ariadne_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: 0.0.53
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-30 00:00:00.000000000 Z
11
+ date: 2023-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tailwind_merge
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  - !ruby/object:Gem::Version
343
343
  version: '0'
344
344
  requirements: []
345
- rubygems_version: 3.4.15
345
+ rubygems_version: 3.4.16
346
346
  signing_key:
347
347
  specification_version: 4
348
348
  summary: ViewComponents for the Ariadne Design System