druxt-breadcrumb 0.17.2 → 0.17.3-dev.20260920043715

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,65 +1,61 @@
1
+ <img src="./banner.svg" alt="DruxtBreadcrumb: breadcrumb trails from the Drupal decoupled router">
2
+
1
3
  # DruxtBreadcrumb
2
4
 
3
5
  [![npm](https://badgen.net/npm/v/druxt-breadcrumb)](https://www.npmjs.com/package/druxt-breadcrumb)
4
- [![CircleCI](https://circleci.com/gh/druxt/druxt-breadcrumb.svg?style=svg)](https://circleci.com/gh/druxt/druxt-breadcrumb)
5
- [![Known Vulnerabilities](https://snyk.io/test/github/druxt/druxt-breadcrumb/badge.svg?targetFile=package.json)](https://snyk.io/test/github/druxt/druxt-breadcrumb?targetFile=package.json)
6
- [![codecov](https://codecov.io/gh/druxt/druxt-breadcrumb/branch/develop/graph/badge.svg)](https://codecov.io/gh/druxt/druxt-breadcrumb)
6
+ [![CI](https://github.com/druxt/druxt.js/actions/workflows/ci.yml/badge.svg)](https://github.com/druxt/druxt.js/actions/workflows/ci.yml)
7
+ [![Known Vulnerabilities](https://snyk.io/test/github/druxt/druxt.js/badge.svg?targetFile=package.json)](https://snyk.io/test/github/druxt/druxt.js?targetFile=package.json)
8
+ [![codecov](https://codecov.io/gh/druxt/druxt.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/druxt/druxt.js)
7
9
 
8
- > Decoupled Router based Breadcrumb Druxt component.
10
+ > Render a breadcrumb trail in Nuxt from the Drupal decoupled router, with the DruxtBreadcrumb component and its theming options.
9
11
 
10
- ## Links
12
+ DruxtBreadcrumb builds a breadcrumb trail for the current route. It walks the
13
+ route's parent paths through the decoupled router, so the trail follows your
14
+ Drupal path hierarchy with no manual configuration, and it themes like every
15
+ other Druxt component.
11
16
 
12
- - DruxtJS: https://druxtjs.org
13
- - Documentation: https://druxtjs.org/modules/breadcrumb
14
- - Community Discord server: https://discord.druxtjs.org
17
+ ![Example DruxtBreadcrumb component](https://druxtjs.org/images/druxt-breadcrumb.png)
15
18
 
16
- ## Install
19
+ ## Features
17
20
 
18
- `$ npm install druxt-breadcrumb`
21
+ - Vue.js components:
22
+ - **DruxtBreadcrumb** renders Drupal breadcrumbs by route
19
23
 
20
- ### Nuxt.js
24
+ ---
21
25
 
22
- Add module to `nuxt.config.js`
26
+ ## Installation
23
27
 
24
- ```js
25
- module.exports = {
26
- modules: ['druxt-breadcrumb'],
27
- druxt: {
28
- baseUrl: 'https://demo-api.druxtjs.org',
29
- },
30
- }
31
- ```
28
+ > Included with [`druxt-site`](https://druxtjs.org/modules/site). Install it separately only when composing modules yourself.
32
29
 
33
- ## Usage
30
+ 1. Install the package:
34
31
 
35
- ### DruxtBreadcrumb component
32
+ ```sh
33
+ npm i druxt-breadcrumb
34
+ ```
36
35
 
37
- The DruxtBreadcrumb component uses the Vue Router and DruxtRouter to build a list of crumbs.
36
+ 2. Add the module to `nuxt.config.js`:
38
37
 
39
- ```vue
40
- <DruxtBreadcrumb />
41
- ```
38
+ ```js
39
+ export default {
40
+ modules: ['druxt-breadcrumb'],
41
+ };
42
+ ```
42
43
 
43
- The crumbs can be themed by providing a default scoped slot:
44
- ```vue
45
- <DruxtBreadcrumb>
46
- <template #default="{ crumbs }">
47
- {{ crumbs }}
48
- </template>
49
- </DruxtBreadcrumb>
50
- ```
44
+ ---
45
+
46
+ ## Vue.js components
47
+
48
+ ### DruxtBreadcrumb
49
+
50
+ Renders a list of breadcrumbs based on the active route.
51
51
 
52
- The DruxtBreadcrumb also provide a DruxtWrapper component for theming:
53
52
  ```vue
54
- <!-- DruxtBreadcrumbDefault.vue -->
55
- <template>
56
- <div>
57
- <slot />
58
- <div>
59
- </template>
53
+ <DruxtBreadcrumb />
60
54
  ```
61
55
 
62
- See the [DruxtBreadcrumb API documentation](https://druxtjs.org/api/packages/breadcrumb/components/DruxtBreadcrumb) for more information.
56
+ - For more details, refer to the [DruxtBreadcrumb API documentation](https://druxtjs.org/api/packages/breadcrumb/components/DruxtBreadcrumb).
57
+
58
+ ---
63
59
 
64
60
  ## Options
65
61
 
@@ -67,7 +63,13 @@ See the [DruxtBreadcrumb API documentation](https://druxtjs.org/api/packages/bre
67
63
 
68
64
  These options are available to all Druxt modules, in the `nuxt.config.js` file.
69
65
 
70
- | Option | Type | Required | Default | Description |
71
- | --- | --- | --- | --- | --- |
72
- | `druxt.axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). |
73
- | `druxt.baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. |
66
+ | Option | Type | Required | Default | Description |
67
+ | --------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------- |
68
+ | `druxt.axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). |
69
+ | `druxt.baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. |
70
+
71
+ ## Links
72
+
73
+ - DruxtJS: https://druxtjs.org
74
+ - Documentation: https://druxtjs.org/modules/breadcrumb
75
+ - Community Discord server: https://discord.druxtjs.org
package/banner.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 320" width="1280" height="320" role="img" aria-label="druxt-breadcrumb: Breadcrumb trails from the Drupal decoupled router."><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#1f2937"/><stop offset="0.7" stop-color="#2f495e"/><stop offset="1" stop-color="#36566e"/></linearGradient></defs><rect width="1280" height="320" rx="16" fill="url(#g)"/><rect x="250" y="85" width="150" height="150" rx="32" fill="rgba(229,236,241,0.07)"/><g transform="translate(277,112) scale(4)" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 6.5l5.5 5.5L5 17.5M12.5 8.5l3.5 3.5-3.5 3.5" stroke="#7cc5f1"/><path d="M20 12h.01" stroke="#68cb9f"/></g><text x="440" y="150" style="font-family:ui-sans-serif,system-ui,sans-serif" font-size="64" font-weight="700" letter-spacing="-1" fill="#eef2f6">Breadcrumb</text><text x="836" y="150" style="font-family:ui-monospace,Menlo,Consolas,monospace" font-size="26" fill="#7cc5f1">druxt-breadcrumb</text><text x="440" y="196" style="font-family:ui-sans-serif,system-ui,sans-serif" font-size="25" fill="rgba(229,236,241,0.75)">Breadcrumb trails from the Drupal decoupled router.</text><g transform="translate(440,236) scale(0.0994)"><path d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z" fill="#3498DB"/><path d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z" fill="#108775"/><path d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z" fill="#E5ECF1"/></g><text x="492" y="260" style="font-family:ui-sans-serif,system-ui,sans-serif" font-size="17" font-weight="600" fill="rgba(229,236,241,0.85)">druxtjs.org</text></svg>
@@ -24,7 +24,7 @@ import { mapActions, mapState } from 'vuex'
24
24
  * mixins: [DruxtBreadcrumbMixin]
25
25
  * }
26
26
  *
27
- * @example <caption>DruxtBreadcrumb with template injection</caption> @lang vue
27
+ * @example <caption>DruxtBreadcrumb default slot (template injection)</caption> @lang vue
28
28
  * <DruxtBreadcrumb>
29
29
  * <template #default="{ crumbs }">
30
30
  * <!-- Do whatever you want here -->
@@ -71,6 +71,8 @@ export default {
71
71
  /** */
72
72
  computed: {
73
73
  /**
74
+ * @param {object} vm - The component ViewModel.
75
+ * @param {object[]} vm.model - The Breadcrumbs model value.
74
76
  * @property {objects[]} crumbs - The Breadcrumbs.
75
77
  */
76
78
  crumbs: ({ model }) => model,
@@ -181,7 +183,6 @@ export default {
181
183
  /**
182
184
  * Provides the available component naming options for the Druxt Wrapper.
183
185
  *
184
- * @param {object} context - The module component ViewModel.
185
186
  * @returns {ComponentOptions}
186
187
  */
187
188
  componentOptions: () => [['default']],
@@ -199,6 +200,7 @@ export default {
199
200
  * Provides propsData for the DruxtWrapper.
200
201
  *
201
202
  * @param {object} context - The module component ViewModel.
203
+ * @param {object[]} context.model - The Breadcrumbs model value.
202
204
  * @returns {PropsData}
203
205
  */
204
206
  propsData: ({ model }) => ({ crumbs: model, value: model }),
@@ -239,7 +241,7 @@ export default {
239
241
  }
240
242
 
241
243
  /**
242
- * Provides the available naming options for the Wrapper component.
244
+ * Provides the available naming options for the wrapper component.
243
245
  *
244
246
  * @typedef {array[]} ComponentOptions
245
247
  *
@@ -257,7 +259,7 @@ export default {
257
259
  */
258
260
 
259
261
  /**
260
- * Provides propsData for use in the Wrapper component.
262
+ * Provides propsData for use in the wrapper component.
261
263
  *
262
264
  * @typedef {object} PropsData
263
265
  * @param {objects[]} crumbs - The Breadcrumbs.
@@ -277,7 +279,7 @@ export default {
277
279
  */
278
280
 
279
281
  /**
280
- * Provides scoped slots for use in the Wrapper component.
282
+ * Provides scoped slots for use in the wrapper component.
281
283
  *
282
284
  * @typedef {object} ScopedSlots
283
285
  * @param {function} default - Crumbs as a list of NuxtLink's.
@@ -18,7 +18,7 @@ import { DruxtBlocksBlockMixin } from 'druxt-blocks'
18
18
  * uuid="59121e44-e21b-4f53-b009-5225cd630145"
19
19
  * />
20
20
  *
21
- * @see {@link https://blocks.druxtjs.org/api/components/DruxtBlock|DruxtBlock}
21
+ * @see {@link https://druxtjs.org/api/packages/blocks/components/DruxtBlock|DruxtBlock}
22
22
  * @see {@link ../DruxtBreadcrumb|DruxtBreadcrumb}
23
23
  */
24
24
  export default {
@@ -27,7 +27,7 @@ export default {
27
27
  /**
28
28
  * Vue.js Mixins.
29
29
  *
30
- * @see {@link https://blocks.druxtjs.org/api/mixins/block|DruxtBlocksBlockMixin}
30
+ * @see {@link https://druxtjs.org/api/packages/blocks/mixins/block|DruxtBlocksBlockMixin}
31
31
  */
32
32
  mixins: [DruxtBlocksBlockMixin],
33
33
  }
@@ -1,5 +1,6 @@
1
1
  import { join, resolve } from 'path';
2
2
 
3
+ const extendComponent = (component) => ({ ...component, isAsync: false });
3
4
  const DruxtBreadcrumbModule = async function(moduleOptions = {}) {
4
5
  const options = {
5
6
  baseUrl: moduleOptions.baseUrl,
@@ -12,8 +13,8 @@ const DruxtBreadcrumbModule = async function(moduleOptions = {}) {
12
13
  await this.addModule(["druxt", options]);
13
14
  await this.addModule(["druxt-router/nuxt", options]);
14
15
  this.nuxt.hook("components:dirs", (dirs) => {
15
- dirs.push({ path: join(__dirname, "components") });
16
- dirs.push({ path: join(__dirname, "components/blocks") });
16
+ dirs.push({ path: join(__dirname, "components"), extendComponent });
17
+ dirs.push({ path: join(__dirname, "components/blocks"), extendComponent });
17
18
  });
18
19
  this.nuxt.hook("storybook:config", ({ stories }) => {
19
20
  this.addTemplate({
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const path = require('path');
6
6
 
7
+ const extendComponent = (component) => ({ ...component, isAsync: false });
7
8
  const DruxtBreadcrumbModule = async function(moduleOptions = {}) {
8
9
  const options = {
9
10
  baseUrl: moduleOptions.baseUrl,
@@ -16,8 +17,8 @@ const DruxtBreadcrumbModule = async function(moduleOptions = {}) {
16
17
  await this.addModule(["druxt", options]);
17
18
  await this.addModule(["druxt-router/nuxt", options]);
18
19
  this.nuxt.hook("components:dirs", (dirs) => {
19
- dirs.push({ path: path.join(__dirname, "components") });
20
- dirs.push({ path: path.join(__dirname, "components/blocks") });
20
+ dirs.push({ path: path.join(__dirname, "components"), extendComponent });
21
+ dirs.push({ path: path.join(__dirname, "components/blocks"), extendComponent });
21
22
  });
22
23
  this.nuxt.hook("storybook:config", ({ stories }) => {
23
24
  this.addTemplate({
package/icon.svg ADDED
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <path stroke="#036397" d="M5 6.5l5.5 5.5L5 17.5M12.5 8.5l3.5 3.5-3.5 3.5" />
3
+ <path stroke="#3b8070" d="M20 12h.01" />
4
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-breadcrumb",
3
- "version": "0.17.2",
3
+ "version": "0.17.3-dev.20260920043715",
4
4
  "description": "Decoupled Router based Breadcrumb Druxt component.",
5
5
  "keywords": [
6
6
  "breadcrumb",
@@ -28,6 +28,7 @@
28
28
  "url": "git+https://github.com/druxt/druxt.js"
29
29
  },
30
30
  "license": "MIT",
31
+ "author": "Stuart Clark <stuart@druxtjs.org>",
31
32
  "exports": {
32
33
  ".": {
33
34
  "require": "./dist/druxt-breadcrumb.ssr.js",
@@ -39,15 +40,17 @@
39
40
  "module": "dist/druxt-breadcrumb.esm.js",
40
41
  "files": [
41
42
  "dist",
42
- "templates"
43
+ "templates",
44
+ "icon.svg",
45
+ "banner.svg"
43
46
  ],
44
47
  "dependencies": {
45
- "druxt": "^0.23.0",
46
- "druxt-blocks": "^0.17.3",
47
- "druxt-router": "^0.30.0"
48
+ "druxt": "0.24.1-dev.20260920043715",
49
+ "druxt-blocks": "0.17.4-dev.20260920043715",
50
+ "druxt-router": "0.31.1-dev.20260920043715"
48
51
  },
49
52
  "optionalDependencies": {
50
- "vue": "^2.7.14",
53
+ "vue": "^2.7.16",
51
54
  "vuex": "^3.6.2"
52
55
  },
53
56
  "publishConfig": {