druxt-site 0.9.1 → 0.10.3
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/CHANGELOG.md +58 -0
- package/dist/components/DruxtSite.vue +29 -34
- package/dist/druxt-site.esm.js +9 -6
- package/dist/druxt-site.ssr.js +9 -6
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# druxt-site
|
|
2
2
|
|
|
3
|
+
## 0.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2ae1d6d]
|
|
8
|
+
- druxt@0.15.0
|
|
9
|
+
- druxt-views@0.17.0
|
|
10
|
+
- druxt-blocks@0.14.3
|
|
11
|
+
- druxt-breadcrumb@0.13.3
|
|
12
|
+
- druxt-entity@0.21.4
|
|
13
|
+
- druxt-menu@0.15.2
|
|
14
|
+
- druxt-router@0.24.2
|
|
15
|
+
- druxt-schema@0.9.2
|
|
16
|
+
|
|
17
|
+
## 0.10.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [45bc0b9]
|
|
22
|
+
- druxt@0.14.0
|
|
23
|
+
- druxt-blocks@0.14.2
|
|
24
|
+
- druxt-breadcrumb@0.13.2
|
|
25
|
+
- druxt-entity@0.21.3
|
|
26
|
+
- druxt-menu@0.15.1
|
|
27
|
+
- druxt-router@0.24.1
|
|
28
|
+
- druxt-schema@0.9.1
|
|
29
|
+
- druxt-views@0.16.2
|
|
30
|
+
|
|
31
|
+
## 0.10.1
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [9161b38]
|
|
36
|
+
- druxt-router@0.24.0
|
|
37
|
+
- druxt-blocks@0.14.1
|
|
38
|
+
- druxt-breadcrumb@0.13.1
|
|
39
|
+
- druxt-entity@0.21.2
|
|
40
|
+
- druxt-views@0.16.1
|
|
41
|
+
|
|
42
|
+
## 0.10.0
|
|
43
|
+
|
|
44
|
+
### Minor Changes
|
|
45
|
+
|
|
46
|
+
- 77ab204: Replaced File Proxy with Druxt proxy
|
|
47
|
+
- e7b1533: Refactored DruxtModule fetch hooks
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [025315a]
|
|
52
|
+
- druxt-entity@0.21.0
|
|
53
|
+
- druxt-views@0.16.0
|
|
54
|
+
- druxt-schema@0.9.0
|
|
55
|
+
- druxt-blocks@0.14.0
|
|
56
|
+
- druxt-breadcrumb@0.13.0
|
|
57
|
+
- druxt@0.13.0
|
|
58
|
+
- druxt-menu@0.15.0
|
|
59
|
+
- druxt-router@0.23.0
|
|
60
|
+
|
|
3
61
|
## 0.9.1
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
|
@@ -63,40 +63,6 @@ export default {
|
|
|
63
63
|
defaultTheme: ($druxt.settings.site || {}).theme,
|
|
64
64
|
}),
|
|
65
65
|
|
|
66
|
-
/**
|
|
67
|
-
* Nuxt.js fetch method.
|
|
68
|
-
*
|
|
69
|
-
* Fetches theme filtered region names from the Block JSON:API resources to be
|
|
70
|
-
* used to render the `<DruxtBlockRegion />`'s.
|
|
71
|
-
*/
|
|
72
|
-
async fetch() {
|
|
73
|
-
const type = 'block--block'
|
|
74
|
-
|
|
75
|
-
// If no default theme is provided, get the first available valid theme.
|
|
76
|
-
if (!this.defaultTheme) {
|
|
77
|
-
this.defaultTheme = await this.getCollection({
|
|
78
|
-
type,
|
|
79
|
-
query: new DrupalJsonApiParams()
|
|
80
|
-
.addFields(type, ['theme'])
|
|
81
|
-
.addFilter('plugin', 'system_main_block')
|
|
82
|
-
.addPageLimit(1)
|
|
83
|
-
}).then((resources) => resources.data[0].attributes.theme)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Fetch all available regions.
|
|
87
|
-
if (!this.value) {
|
|
88
|
-
this.model = await this.getCollection({
|
|
89
|
-
type,
|
|
90
|
-
query: new DrupalJsonApiParams()
|
|
91
|
-
.addFilter('theme', this.theme || this.defaultTheme)
|
|
92
|
-
.addFields(type, ['region']),
|
|
93
|
-
}).then((resources) => resources.data.map((resource) => resource.attributes.region).filter((v, i, s) => s.indexOf(v) === i))
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Call DruxtModule fetch hook.
|
|
97
|
-
await DruxtModule.fetch.call(this)
|
|
98
|
-
},
|
|
99
|
-
|
|
100
66
|
/**
|
|
101
67
|
* Vue.js Computed properties.
|
|
102
68
|
*/
|
|
@@ -136,6 +102,35 @@ export default {
|
|
|
136
102
|
*/
|
|
137
103
|
componentOptions: ({ defaultTheme, theme }) => [[theme || defaultTheme], ['default']],
|
|
138
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Fetches theme filtered region names from the Block JSON:API resources to
|
|
107
|
+
* be used to render the `<DruxtBlockRegion />`'s.
|
|
108
|
+
*/
|
|
109
|
+
async fetchConfig() {
|
|
110
|
+
const type = 'block--block'
|
|
111
|
+
|
|
112
|
+
// If no default theme is provided, get the first available valid theme.
|
|
113
|
+
if (!this.defaultTheme) {
|
|
114
|
+
this.defaultTheme = await this.getCollection({
|
|
115
|
+
type,
|
|
116
|
+
query: new DrupalJsonApiParams()
|
|
117
|
+
.addFields(type, ['theme'])
|
|
118
|
+
.addFilter('plugin', 'system_main_block')
|
|
119
|
+
.addPageLimit(1)
|
|
120
|
+
}).then((resources) => resources.data[0].attributes.theme)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Fetch all available regions.
|
|
124
|
+
if (!this.value) {
|
|
125
|
+
this.model = await this.getCollection({
|
|
126
|
+
type,
|
|
127
|
+
query: new DrupalJsonApiParams()
|
|
128
|
+
.addFilter('theme', this.theme || this.defaultTheme)
|
|
129
|
+
.addFields(type, ['region']),
|
|
130
|
+
}).then((resources) => resources.data.map((resource) => resource.attributes.region).filter((v, i, s) => s.indexOf(v) === i))
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
139
134
|
/**
|
|
140
135
|
* Provides propsData for the DruxtWrapper.
|
|
141
136
|
*
|
package/dist/druxt-site.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { DruxtClient } from 'druxt';
|
|
|
6
6
|
const titleFn = (parts) => parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/_/g, " ")).join("/");
|
|
7
7
|
async function DruxtSiteStorybook({ options, stories }) {
|
|
8
8
|
const { addTemplate } = this;
|
|
9
|
-
const druxt = new DruxtClient(options.baseUrl, options);
|
|
9
|
+
const druxt = new DruxtClient(options.baseUrl, { ...options, proxy: { api: false } });
|
|
10
10
|
const type = "block--block";
|
|
11
11
|
const query = new DrupalJsonApiParams().addFields(type, ["theme"]);
|
|
12
12
|
const resources = (await druxt.getCollectionAll(type, query)).map((collection) => collection.data).flat();
|
|
@@ -26,7 +26,6 @@ async function DruxtSiteStorybook({ options, stories }) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
29
|
-
var _a;
|
|
30
29
|
const options = {
|
|
31
30
|
baseUrl: moduleOptions.baseUrl,
|
|
32
31
|
...(this.options || {}).druxt || {},
|
|
@@ -34,17 +33,23 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
|
34
33
|
jsonApiMenuItems: true,
|
|
35
34
|
...((this.options || {}).druxt || {}).menu
|
|
36
35
|
},
|
|
36
|
+
proxy: {
|
|
37
|
+
api: false,
|
|
38
|
+
files: true,
|
|
39
|
+
...((this.options || {}).druxt || {}).proxy
|
|
40
|
+
},
|
|
37
41
|
site: {
|
|
38
42
|
layout: true,
|
|
39
43
|
...((this.options || {}).druxt || {}).site,
|
|
40
44
|
...moduleOptions
|
|
41
45
|
}
|
|
42
46
|
};
|
|
47
|
+
this.options.druxt = options;
|
|
43
48
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
44
49
|
dirs.push({ path: join(__dirname, "components") });
|
|
45
50
|
});
|
|
46
|
-
this.addModule(["druxt", options]);
|
|
47
51
|
const druxtModules = [
|
|
52
|
+
"druxt",
|
|
48
53
|
"druxt-blocks",
|
|
49
54
|
"druxt-breadcrumb",
|
|
50
55
|
"druxt-entity",
|
|
@@ -54,13 +59,11 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
|
54
59
|
"druxt-views"
|
|
55
60
|
];
|
|
56
61
|
for (const module of druxtModules) {
|
|
57
|
-
this.addModule(
|
|
62
|
+
this.addModule(module);
|
|
58
63
|
}
|
|
59
64
|
if (!await existsSync(resolve(this.options.srcDir, this.options.dir.layouts)) && options.site.layout) {
|
|
60
65
|
this.addLayout(resolve(__dirname, "./layouts/default.vue"), "default");
|
|
61
66
|
}
|
|
62
|
-
this.options.proxy = (_a = this.options.proxy) != null ? _a : [options.baseUrl + "/sites/default/files"];
|
|
63
|
-
this.addModule("@nuxtjs/proxy");
|
|
64
67
|
this.nuxt.hook("storybook:config", async ({ stories }) => {
|
|
65
68
|
stories.push("druxt-site/dist/components/*.stories.mjs");
|
|
66
69
|
await DruxtSiteStorybook.call(this, { options, stories });
|
package/dist/druxt-site.ssr.js
CHANGED
|
@@ -10,7 +10,7 @@ const druxt = require('druxt');
|
|
|
10
10
|
const titleFn = (parts) => parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/_/g, " ")).join("/");
|
|
11
11
|
async function DruxtSiteStorybook({ options, stories }) {
|
|
12
12
|
const { addTemplate } = this;
|
|
13
|
-
const druxt$1 = new druxt.DruxtClient(options.baseUrl, options);
|
|
13
|
+
const druxt$1 = new druxt.DruxtClient(options.baseUrl, { ...options, proxy: { api: false } });
|
|
14
14
|
const type = "block--block";
|
|
15
15
|
const query = new drupalJsonapiParams.DrupalJsonApiParams().addFields(type, ["theme"]);
|
|
16
16
|
const resources = (await druxt$1.getCollectionAll(type, query)).map((collection) => collection.data).flat();
|
|
@@ -30,7 +30,6 @@ async function DruxtSiteStorybook({ options, stories }) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
33
|
-
var _a;
|
|
34
33
|
const options = {
|
|
35
34
|
baseUrl: moduleOptions.baseUrl,
|
|
36
35
|
...(this.options || {}).druxt || {},
|
|
@@ -38,17 +37,23 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
|
38
37
|
jsonApiMenuItems: true,
|
|
39
38
|
...((this.options || {}).druxt || {}).menu
|
|
40
39
|
},
|
|
40
|
+
proxy: {
|
|
41
|
+
api: false,
|
|
42
|
+
files: true,
|
|
43
|
+
...((this.options || {}).druxt || {}).proxy
|
|
44
|
+
},
|
|
41
45
|
site: {
|
|
42
46
|
layout: true,
|
|
43
47
|
...((this.options || {}).druxt || {}).site,
|
|
44
48
|
...moduleOptions
|
|
45
49
|
}
|
|
46
50
|
};
|
|
51
|
+
this.options.druxt = options;
|
|
47
52
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
48
53
|
dirs.push({ path: path.join(__dirname, "components") });
|
|
49
54
|
});
|
|
50
|
-
this.addModule(["druxt", options]);
|
|
51
55
|
const druxtModules = [
|
|
56
|
+
"druxt",
|
|
52
57
|
"druxt-blocks",
|
|
53
58
|
"druxt-breadcrumb",
|
|
54
59
|
"druxt-entity",
|
|
@@ -58,13 +63,11 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
|
58
63
|
"druxt-views"
|
|
59
64
|
];
|
|
60
65
|
for (const module of druxtModules) {
|
|
61
|
-
this.addModule(
|
|
66
|
+
this.addModule(module);
|
|
62
67
|
}
|
|
63
68
|
if (!await fs.existsSync(path.resolve(this.options.srcDir, this.options.dir.layouts)) && options.site.layout) {
|
|
64
69
|
this.addLayout(path.resolve(__dirname, "./layouts/default.vue"), "default");
|
|
65
70
|
}
|
|
66
|
-
this.options.proxy = (_a = this.options.proxy) != null ? _a : [options.baseUrl + "/sites/default/files"];
|
|
67
|
-
this.addModule("@nuxtjs/proxy");
|
|
68
71
|
this.nuxt.hook("storybook:config", async ({ stories }) => {
|
|
69
72
|
stories.push("druxt-site/dist/components/*.stories.mjs");
|
|
70
73
|
await DruxtSiteStorybook.call(this, { options, stories });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-site",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Out of the box Decoupled Drupal sites with Druxt.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -42,16 +42,15 @@
|
|
|
42
42
|
"templates"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@nuxtjs/proxy": "^2.1.0",
|
|
46
45
|
"drupal-jsonapi-params": "^1.2.2",
|
|
47
|
-
"druxt": "^0.
|
|
48
|
-
"druxt-blocks": "^0.
|
|
49
|
-
"druxt-breadcrumb": "^0.
|
|
50
|
-
"druxt-entity": "^0.
|
|
51
|
-
"druxt-menu": "^0.
|
|
52
|
-
"druxt-router": "^0.
|
|
53
|
-
"druxt-schema": "^0.
|
|
54
|
-
"druxt-views": "^0.
|
|
46
|
+
"druxt": "^0.15.0",
|
|
47
|
+
"druxt-blocks": "^0.14.3",
|
|
48
|
+
"druxt-breadcrumb": "^0.13.3",
|
|
49
|
+
"druxt-entity": "^0.21.4",
|
|
50
|
+
"druxt-menu": "^0.15.2",
|
|
51
|
+
"druxt-router": "^0.24.2",
|
|
52
|
+
"druxt-schema": "^0.9.2",
|
|
53
|
+
"druxt-views": "^0.17.0",
|
|
55
54
|
"md5": "^2.2.1"
|
|
56
55
|
},
|
|
57
56
|
"optionalDependencies": {
|