@blockquote-web-components/blockquote-controller-context-meta 1.3.0 → 1.3.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/README.md CHANGED
@@ -1,55 +1,10 @@
1
1
  ![Lit](https://img.shields.io/badge/lit-3.0.0-blue.svg)
2
2
 
3
- `BaseContextMetaElement` simulates the behavior of a `div` using ARIA roles,
4
- preserving standard HTML behaviors while enhancing functionality.
5
-
6
- ## Demo
7
-
8
- [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/oscarmarina/flow-element)
9
-
10
- ## Features
11
- - Acts as a structural element that follows HTML flow content rules.
12
- - Provides a default ARIA role (`none`) to avoid unintended semantics.
13
- - Can be used as a wrapper for contextual metadata.
14
-
15
- ## Accessibility
16
- By default, `BaseContextMetaElement` [assigns the role="none"](https://github.com/w3c/aria/pull/2383),
17
- ensuring that it does not introduce unintended semantics in assistive technologies.
18
- This behavior can be overridden by explicitly setting a different role.
19
-
20
- **Related:** [ARIA Structural Roles](https://www.w3.org/WAI/ARIA/apg/practices/structural-roles/#allstructuralrolesandtheirhtmlequivalents)
21
-
22
- > Inspired by the discussion: [Is it possible to make normal DOM elements context providers?](https://github.com/lit/lit/discussions/4690)
23
- **See Also:** [contextmeta provider directive](https://github.com/oscarmarina/blockquote-web-components/tree/main/packages/controllers/blockquote-controller-context-meta/src/directives/context-meta-provider.js)
24
-
25
- With this setup, `BaseContextMetaElement` behaves like a [flow element](https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#flow_content).
26
-
27
-
28
- <hr>
29
-
30
-
31
- ### `src/BaseContextMetaElement.js`:
32
-
33
- #### class: `BaseContextMetaElement`, `base-context-meta`
34
-
35
- <hr/>
36
-
37
- #### Exports
38
-
39
- | Kind | Name | Declaration | Module | Package |
40
- | --------------------------- | ------------------------ | ---------------------- | ----------------------------- | ------- |
41
- | `js` | `BaseContextMetaElement` | BaseContextMetaElement | src/BaseContextMetaElement.js | |
42
- | `custom-element-definition` | `base-context-meta` | BaseContextMetaElement | src/BaseContextMetaElement.js | |
43
-
44
- ![Lit](https://img.shields.io/badge/lit-3.0.0-blue.svg)
45
-
46
3
  `BlockquoteControllerContextMeta` is a Lit Reactive Controller that encapsulates the controllers provided by [@lit/context](https://lit.dev/docs/data/context/)
47
4
 
48
5
  **Features:**
49
- - It enables a component to serve as both a provider and a consumer.
50
- - It places the consumer after the first update to reduce the chance of a consumer in LightDOM requesting a context that currently lacks a provider.
51
- - Create a context object using a global symbol (Symbol.for('my-context')).
52
-
6
+ - Allows a component to act simultaneously as a provider and a consumer.
7
+ - Delays consumer initialization until after the first update, minimizing the risk of a consumer in the Light DOM requesting a context before a provider is available.
53
8
  <hr>
54
9
 
55
10
  ### Demo
@@ -233,3 +188,47 @@ customElements.define('consumer-el', ConsumerEl);
233
188
  | Kind | Name | Declaration | Module | Package |
234
189
  | ---- | --------------------- | ------------------- | --------------------------------------- | ------- |
235
190
  | `js` | `contextMetaProvider` | contextMetaProvider | src/directives/context-meta-provider.js | |
191
+
192
+ ---
193
+
194
+ ![Lit](https://img.shields.io/badge/lit-3.0.0-blue.svg)
195
+
196
+ `BaseContextMetaElement` emulates the behavior of a flow element using ARIA, preserving standard HTML functionality while enhancing its features.
197
+
198
+ ## Demo
199
+
200
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/oscarmarina/flow-element)
201
+
202
+ ## Features
203
+ - Acts as a structural element that follows HTML flow content rules.
204
+ - Provides a default ARIA role (`none`) to avoid unintended semantics.
205
+ - Can be used as a wrapper for contextual metadata.
206
+
207
+ ## Accessibility
208
+ By default, `BaseContextMetaElement` [assigns the role="none"](https://github.com/w3c/aria/pull/2383),
209
+ ensuring that it does not introduce unintended semantics in assistive technologies.
210
+ This behavior can be overridden by explicitly setting a different role.
211
+
212
+ **Related:** [ARIA Structural Roles](https://www.w3.org/WAI/ARIA/apg/practices/structural-roles/#allstructuralrolesandtheirhtmlequivalents)
213
+
214
+ > Inspired by the discussion: [Is it possible to make normal DOM elements context providers?](https://github.com/lit/lit/discussions/4690)
215
+ **See Also:** [contextmeta provider directive](https://github.com/oscarmarina/blockquote-web-components/tree/main/packages/controllers/blockquote-controller-context-meta/src/directives/context-meta-provider.js)
216
+
217
+ With this setup, `BaseContextMetaElement` behaves like a [flow element](https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#flow_content).
218
+
219
+
220
+ <hr>
221
+
222
+
223
+ ### `src/BaseContextMetaElement.js`:
224
+
225
+ #### class: `BaseContextMetaElement`, `base-context-meta`
226
+
227
+ <hr/>
228
+
229
+ #### Exports
230
+
231
+ | Kind | Name | Declaration | Module | Package |
232
+ | --------------------------- | ------------------------ | ---------------------- | ----------------------------- | ------- |
233
+ | `js` | `BaseContextMetaElement` | BaseContextMetaElement | src/BaseContextMetaElement.js | |
234
+ | `custom-element-definition` | `base-context-meta` | BaseContextMetaElement | src/BaseContextMetaElement.js | |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockquote-web-components/blockquote-controller-context-meta",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Webcomponent blockquote-controller-context-meta following open-wc recommendations",
5
5
  "keywords": [
6
6
  "lit",
@@ -121,12 +121,12 @@
121
121
  "lit": "^3.2.1"
122
122
  },
123
123
  "devDependencies": {
124
- "@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.11.2",
125
- "@blockquote-web-components/blockquote-base-embedded-webview": "^1.12.9"
124
+ "@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.11.3",
125
+ "@blockquote-web-components/blockquote-base-embedded-webview": "^1.12.10"
126
126
  },
127
127
  "publishConfig": {
128
128
  "access": "public"
129
129
  },
130
130
  "customElements": "custom-elements.json",
131
- "gitHead": "9a325725a904f541664565dd720f4bb6b2f0fa05"
131
+ "gitHead": "916dc8f19533a507267a049a0ae56e06ce5e69d3"
132
132
  }
@@ -3,8 +3,7 @@ import {LitElement, html, css} from 'lit';
3
3
  /**
4
4
  * ![Lit](https://img.shields.io/badge/lit-3.0.0-blue.svg)
5
5
  *
6
- * `BaseContextMetaElement` simulates the behavior of a `div` using ARIA roles,
7
- * preserving standard HTML behaviors while enhancing functionality.
6
+ * `BaseContextMetaElement` emulates the behavior of a flow element using ARIA, preserving standard HTML functionality while enhancing its features.
8
7
  *
9
8
  * ## Demo
10
9
  *
@@ -35,6 +34,7 @@ export class BaseContextMetaElement extends LitElement {
35
34
  :host {
36
35
  display: block;
37
36
  }
37
+
38
38
  :host([hidden]),
39
39
  [hidden] {
40
40
  display: none !important;
@@ -7,10 +7,8 @@ export const contextMetaSymbol = Symbol.for('context-meta-symbol');
7
7
  * `BlockquoteControllerContextMeta` is a Lit Reactive Controller that encapsulates the controllers provided by [@lit/context](https://lit.dev/docs/data/context/)
8
8
  *
9
9
  * **Features:**
10
- * - It enables a component to serve as both a provider and a consumer.
11
- * - It places the consumer after the first update to reduce the chance of a consumer in LightDOM requesting a context that currently lacks a provider.
12
- * - Create a context object using a global symbol (Symbol.for('my-context')).
13
- *
10
+ * - Allows a component to act simultaneously as a provider and a consumer.
11
+ * - Delays consumer initialization until after the first update, minimizing the risk of a consumer in the Light DOM requesting a context before a provider is available.
14
12
  * <hr>
15
13
  *
16
14
  * ### Demo
@@ -135,10 +133,13 @@ class ContextMeta {
135
133
 
136
134
  async hostConnected() {
137
135
  await this.host.updateComplete;
138
- this._contextMetaConsumer = new ContextConsumer(this.host, {
139
- context: this.context,
140
- subscribe: true,
141
- callback: this.callback,
136
+ // Await possible asynchronous completion of the host's update lifecycle
137
+ window.queueMicrotask(() => {
138
+ this._contextMetaConsumer = new ContextConsumer(this.host, {
139
+ context: this.context,
140
+ subscribe: true,
141
+ callback: this.callback,
142
+ });
142
143
  });
143
144
  }
144
145
  }
@@ -3,30 +3,29 @@ import {noChange} from 'lit';
3
3
  import {cacheContextMetaProvider, contextMetaKeyProvider} from './cache-context-meta-provider.js';
4
4
 
5
5
  /**
6
- * `contextMetaProviderDirective` is a Lit directive that allows you to make normal DOM elements context providers.
7
- * This directive can be used in both attribute and element bindings in Lit templates.
6
+ * `contextMetaProviderDirective` is a Lit directive that enables normal DOM elements to act as context providers.
7
+ * You can use this directive in both attribute and element bindings in Lit templates.
8
8
  *
9
9
  * > https://github.com/lit/lit/discussions/4690
10
10
  *
11
11
  * Usage:
12
- * This directive converts a DOM element into a Lit context provider using the BlockquoteControllerContextMeta class, which is a
13
- * Lit Reactive Controller that encapsulates the controllers provided by [@lit/context](https://lit.dev/docs/data/context/).
12
+ * This directive transforms a DOM element into a Lit context provider using the BlockquoteControllerContextMeta class, a
13
+ * Lit Reactive Controller that encapsulates controllers provided by [@lit/context](https://lit.dev/docs/data/context/).
14
14
  *
15
15
  * ## Features
16
- * - Allows non-Lit elements to provide context.
16
+ * - Enables non-Lit elements to provide context.
17
17
  * - Works seamlessly with [`@lit/context`](https://lit.dev/docs/data/context/).
18
18
  * - Utilizes `BlockquoteControllerContextMeta`, a Lit Reactive Controller for managing context.
19
-
20
19
  *
21
20
  * js```
22
21
  * <div ${contextMetaProviderDirective(myContext, someValue)}>
23
22
  * <!-- Children can consume the provided context -->
24
23
  * </div>
25
- * //
26
- * <div data-info="${contextMetaProviderDirective(myContext, someValue)}"">
24
+ * //
25
+ * <div data-info="${contextMetaProviderDirective(myContext, someValue)}">
27
26
  * <!-- Children can consume the provided context -->
28
27
  * </div>
29
- * ```;
28
+ * ```
30
29
  */
31
30
  class ContextMetaProviderDirective extends Directive {
32
31
  /** @type {*} */