@brightspace-ui/core 1.242.2 → 2.0.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.
@@ -157,16 +157,6 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
157
157
  return 'd2l-dropdown-button-subtle';
158
158
  }
159
159
 
160
- connectedCallback() {
161
- super.connectedCallback();
162
- this._activeFiltersSubscribers.hostConnected();
163
- }
164
-
165
- disconnectedCallback() {
166
- super.disconnectedCallback();
167
- this._activeFiltersSubscribers.hostDisconnected();
168
- }
169
-
170
160
  firstUpdated(changedProperties) {
171
161
  super.firstUpdated(changedProperties);
172
162
  this.addEventListener('d2l-filter-dimension-data-change', this._handleDimensionDataChange);
@@ -174,7 +174,6 @@ class HtmlBlock extends RtlMixin(LitElement) {
174
174
 
175
175
  connectedCallback() {
176
176
  super.connectedCallback();
177
- if (this._contextObserverController) this._contextObserverController.hostConnected();
178
177
 
179
178
  if (!this._contentObserver || this.noDeferredRendering) return;
180
179
 
@@ -188,7 +187,6 @@ class HtmlBlock extends RtlMixin(LitElement) {
188
187
 
189
188
  disconnectedCallback() {
190
189
  super.disconnectedCallback();
191
- if (this._contextObserverController) this._contextObserverController.hostDisconnected();
192
190
  if (this._contentObserver) this._contentObserver.disconnect();
193
191
  }
194
192
 
@@ -14,6 +14,7 @@ export class HtmlAttributeObserverController {
14
14
  );
15
15
 
16
16
  this._host = host;
17
+ host.addController(this);
17
18
  this._attributes = attributes;
18
19
  this.values = new Map();
19
20
  }
@@ -136,24 +136,7 @@ An example of what this could look like altogether:
136
136
  <younger-viewer for="rogers"></younger-viewer>
137
137
  ```
138
138
 
139
- NOTE: Until we are on Lit 2, the controller lifecycle events will need to be manually called:
140
- ```js
141
- connectedCallback() {
142
- super.connectedCallback();
143
- if (this._subscriptionController) this._subscriptionController.hostConnected();
144
- }
145
-
146
- disconnectedCallback() {
147
- super.disconnectedCallback();
148
- if (this._subscriptionController) this._subscriptionController.hostDisconnected();
149
- }
150
-
151
- updated(changedProperties) {
152
- super.updated(changedProperties);
153
- if (this._subscriptionController) this._subscriptionController.hostUpdated(changedProperties);
154
- }
155
- ```
156
-
139
+ As of the Lit 2 upgrade, the lifecycle methods `hostConnected`, `hostDisconnected`, and `hostUpdated` will be called automatically.
157
140
  ## Available Callbacks
158
141
 
159
142
  ### SubscriberRegistryController
@@ -4,6 +4,7 @@ export class SubscriberRegistryController {
4
4
 
5
5
  constructor(host, callbacks, options) {
6
6
  this._host = host;
7
+ host.addController(this);
7
8
  this._callbacks = callbacks || {};
8
9
  this._eventName = options && options.eventName;
9
10
  this._subscribers = new Map();
@@ -60,6 +61,7 @@ export class EventSubscriberController {
60
61
 
61
62
  constructor(host, callbacks, options) {
62
63
  this._host = host;
64
+ host.addController(this);
63
65
  this._callbacks = callbacks || {};
64
66
  this._eventName = options && options.eventName;
65
67
  this._controllerId = options && options.controllerId;
@@ -99,8 +101,10 @@ export class IdSubscriberController {
99
101
 
100
102
  constructor(host, callbacks, options) {
101
103
  this._host = host;
104
+ host.addController(this);
102
105
  this._callbacks = callbacks || {};
103
106
  this._idPropertyName = options && options.idPropertyName;
107
+ this._idPropertyValue = this._idPropertyName ? this._host[this._idPropertyName] : undefined;
104
108
  this._controllerId = options && options.controllerId;
105
109
  this._registries = new Map();
106
110
  this._timeouts = new Set();
@@ -118,8 +122,11 @@ export class IdSubscriberController {
118
122
  });
119
123
  }
120
124
 
121
- hostUpdated(changedProperties) {
122
- if (!changedProperties.has(this._idPropertyName)) return;
125
+ hostUpdated() {
126
+ const propertyValue = this._host[this._idPropertyName];
127
+ if (propertyValue === this._idPropertyValue) return;
128
+
129
+ this._idPropertyValue = propertyValue;
123
130
 
124
131
  if (this._registryObserver) this._registryObserver.disconnect();
125
132
  this._registries.forEach(registry => {
@@ -9302,11 +9302,11 @@
9302
9302
  "properties": [
9303
9303
  {
9304
9304
  "name": "offIcon",
9305
- "type": "TemplateResult"
9305
+ "type": "TemplateResult<1>"
9306
9306
  },
9307
9307
  {
9308
9308
  "name": "onIcon",
9309
- "type": "TemplateResult"
9309
+ "type": "TemplateResult<1>"
9310
9310
  },
9311
9311
  {
9312
9312
  "name": "text",
@@ -9391,11 +9391,11 @@
9391
9391
  "properties": [
9392
9392
  {
9393
9393
  "name": "offIcon",
9394
- "type": "TemplateResult"
9394
+ "type": "TemplateResult<1>"
9395
9395
  },
9396
9396
  {
9397
9397
  "name": "onIcon",
9398
- "type": "TemplateResult"
9398
+ "type": "TemplateResult<1>"
9399
9399
  },
9400
9400
  {
9401
9401
  "name": "text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.242.2",
3
+ "version": "2.0.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@babel/eslint-parser": "^7",
47
47
  "@brightspace-ui/stylelint-config": "^0.4",
48
- "@open-wc/testing": "^2",
48
+ "@open-wc/testing": "^3",
49
49
  "@web/dev-server": "^0.1",
50
50
  "@web/test-runner": "^0.13",
51
51
  "@web/test-runner-playwright": "^0.8",
@@ -70,8 +70,8 @@
70
70
  "focus-visible": "^5",
71
71
  "ifrau": "^0.39",
72
72
  "intl-messageformat": "^7",
73
- "lit-element": "^2",
74
- "lit-html": "^1",
73
+ "lit-element": "^3",
74
+ "lit-html": "^2",
75
75
  "prismjs": "^1",
76
76
  "resize-observer-polyfill": "^1"
77
77
  }