@eightshift/frontend-libs-tailwind 1.4.5 → 1.4.6
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/.husky/pre-commit +0 -0
- package/CHANGELOG.md +8 -0
- package/bun.lockb +0 -0
- package/package.json +91 -90
- package/scripts/editor/fetch.js +71 -0
- package/webpack/base.mjs +9 -1
package/.husky/pre-commit
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [1.4.6]
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Tweaked webpack config to properly include font files from `@eightshfit` packages from `node_modules`.
|
|
13
|
+
- Added a new `buildWpRestUrl` helper for easily fetching WP REST URLs. (Similar to `fetchFromWpRest`, but allows you control over how you fetch).
|
|
14
|
+
- Updated dependencies.
|
|
15
|
+
|
|
9
16
|
## [1.4.5]
|
|
10
17
|
|
|
11
18
|
### Changed
|
|
@@ -152,6 +159,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
|
|
|
152
159
|
- Initial release.
|
|
153
160
|
|
|
154
161
|
[Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
|
|
162
|
+
[1.4.6]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.5...1.4.6
|
|
155
163
|
[1.4.5]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.4...1.4.5
|
|
156
164
|
[1.4.4]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.3...1.4.4
|
|
157
165
|
[1.4.3]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.2...1.4.3
|
package/bun.lockb
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,91 +1,92 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
2
|
+
"name": "@eightshift/frontend-libs-tailwind",
|
|
3
|
+
"version": "1.4.6",
|
|
4
|
+
"description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Eightshift team",
|
|
7
|
+
"email": "team@eightshift.com",
|
|
8
|
+
"url": "https://eightshift.com/"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/infinum/eightshift-frontend-libs-tailwind.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"frontend",
|
|
16
|
+
"css",
|
|
17
|
+
"mixin",
|
|
18
|
+
"js",
|
|
19
|
+
"utility",
|
|
20
|
+
"module",
|
|
21
|
+
"WordPress",
|
|
22
|
+
"tailwind",
|
|
23
|
+
"TailwindCSS"
|
|
24
|
+
],
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/infinum/eightshift-frontend-libs-tailwind/issues"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"lintStyle": "stylelint **/*.css",
|
|
30
|
+
"lintJs": "npx eslint",
|
|
31
|
+
"lint": "npm run lintJs && npm run lintStyle",
|
|
32
|
+
"prepare": "husky"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@eightshift/ui-components": "^1.8.0",
|
|
38
|
+
"@stylistic/eslint-plugin-js": "^2.11.0",
|
|
39
|
+
"@stylistic/stylelint-plugin": "^3.1.1",
|
|
40
|
+
"@swc/core": "^1.9.3",
|
|
41
|
+
"@wordpress/api-fetch": "^7.13.0",
|
|
42
|
+
"@wordpress/block-editor": "^14.8.0",
|
|
43
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^5.9.0",
|
|
44
|
+
"@wordpress/dom-ready": "^4.13.0",
|
|
45
|
+
"@wordpress/server-side-render": "^5.13.0",
|
|
46
|
+
"browserslist": "^4.24.2",
|
|
47
|
+
"css-loader": "^7.1.2",
|
|
48
|
+
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
49
|
+
"eslint": "^9.15.0",
|
|
50
|
+
"eslint-config-prettier": "^9.1.0",
|
|
51
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
52
|
+
"globals": "^15.12.0",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"lightningcss": "^1.28.2",
|
|
55
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
56
|
+
"postcss": "^8.4.49",
|
|
57
|
+
"postcss-loader": "^8.1.1",
|
|
58
|
+
"prettier": "^3.4.1",
|
|
59
|
+
"prettier-plugin-tailwindcss": "^0.6.9",
|
|
60
|
+
"sonner": "^1.7.0",
|
|
61
|
+
"stylelint": "^16.11.0",
|
|
62
|
+
"stylelint-config-standard": "^36.0.1",
|
|
63
|
+
"swc-loader": "^0.2.6",
|
|
64
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
65
|
+
"webpack": "^5.96.1",
|
|
66
|
+
"webpack-cli": "^5.1.4",
|
|
67
|
+
"webpack-manifest-plugin": "^5.0.0",
|
|
68
|
+
"webpack-merge": "^6.0.1"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"embla-carousel": "^8.5.1",
|
|
72
|
+
"fluid-tailwind": "^1.0.4",
|
|
73
|
+
"lint-staged": "^15.2.10",
|
|
74
|
+
"micromodal": "^0.4.10",
|
|
75
|
+
"ol": "^10.2.1",
|
|
76
|
+
"ol-mapbox-style": "^12.3.5",
|
|
77
|
+
"tailwindcss": "^3.4.15",
|
|
78
|
+
"tailwindcss-animate": "^1.0.7"
|
|
79
|
+
},
|
|
80
|
+
"sideEffects": false,
|
|
81
|
+
"lint-staged": {
|
|
82
|
+
"*.css": [
|
|
83
|
+
"npm run lintStyle"
|
|
84
|
+
],
|
|
85
|
+
"*.js": [
|
|
86
|
+
"npm run lintJs"
|
|
87
|
+
],
|
|
88
|
+
"*.php": [
|
|
89
|
+
"composer test"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
package/scripts/editor/fetch.js
CHANGED
|
@@ -108,3 +108,74 @@ export const wpSearchRoute = fetchFromWpRest('search', {
|
|
|
108
108
|
searchColumns: 'post_title',
|
|
109
109
|
fields: 'id,title,type,subtype,url',
|
|
110
110
|
});
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Returns a function that fetches data from WordPress REST API.
|
|
114
|
+
*
|
|
115
|
+
* @param {string} endpoint - Endpoint to fetch from.
|
|
116
|
+
* @param {Object} options - Additional options.
|
|
117
|
+
* @param {number} [options.perPage=30] - Number of items to fetch per page.
|
|
118
|
+
* @param {string} [options.routePrefix='wp/v2'] - Route prefix for the API.
|
|
119
|
+
* @param {string} [options.fields='id,title'] - A comma-separated list of field names to fetch from the API. Good to include as it makes the query faster and the output terser.
|
|
120
|
+
* @param {string} [options.noSearch=false] - If `true`, only the URL will be returned, without the search query support.
|
|
121
|
+
* @param {SearchColumnsConfig} [options.searchColumns] - Allows narrowing the search scope.
|
|
122
|
+
*
|
|
123
|
+
* @returns {Function} The `(searchText) => url: string` function, or URL as `string` if `noSearch` is set.
|
|
124
|
+
*
|
|
125
|
+
* @typedef {'post_title' | 'post_excerpt' | 'post_content'} SearchColumnsConfig
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const data = await fetch(buildWpRestUrl('pages'));
|
|
129
|
+
* const json = await data.json();
|
|
130
|
+
*
|
|
131
|
+
* console.log(json);
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* <AsyncSelect
|
|
135
|
+
* value={loremIpsum}
|
|
136
|
+
* onChange={(value) => setAttributes({ [getAttrKey('loremIpsum', attributes, manifest)]: value })}
|
|
137
|
+
* fetchUrl={buildWpRestUrl('pages')}
|
|
138
|
+
* />
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
export function buildWpRestUrl(endpoint, options = {}) {
|
|
142
|
+
const {
|
|
143
|
+
perPage = 30,
|
|
144
|
+
routePrefix = 'wp/v2',
|
|
145
|
+
fields = 'id,title',
|
|
146
|
+
searchColumns,
|
|
147
|
+
noSearch,
|
|
148
|
+
...additionalParams
|
|
149
|
+
} = options;
|
|
150
|
+
|
|
151
|
+
let params = {
|
|
152
|
+
per_page: perPage,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
if (fields?.length > 0) {
|
|
156
|
+
params['_fields'] = fields;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (searchColumns?.length > 0) {
|
|
160
|
+
params.search_columns = Array.isArray(searchColumns) ? searchColumns.join(',') : searchColumns;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (Object.keys(params).length > 0) {
|
|
164
|
+
params = {
|
|
165
|
+
...params,
|
|
166
|
+
...additionalParams,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (noSearch) {
|
|
171
|
+
return addQueryArgs(`${routePrefix}/${endpoint}/`, params);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return (searchText) => {
|
|
175
|
+
if (searchText?.length > 0) {
|
|
176
|
+
params.search = searchText;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return addQueryArgs(`${routePrefix}/${endpoint}/`, params);
|
|
180
|
+
};
|
|
181
|
+
}
|
package/webpack/base.mjs
CHANGED
|
@@ -34,7 +34,7 @@ export default (options) => {
|
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// Output
|
|
37
|
+
// Output CSS from JS.
|
|
38
38
|
if (!options.overrides.includes('miniCssExtractPlugin')) {
|
|
39
39
|
plugins.push(
|
|
40
40
|
new MiniCssExtractPlugin({
|
|
@@ -94,6 +94,7 @@ export default (options) => {
|
|
|
94
94
|
],
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
// Node modules - CSS.
|
|
97
98
|
module.rules.push({
|
|
98
99
|
test: /\.css$/,
|
|
99
100
|
include: /node_modules/,
|
|
@@ -103,6 +104,13 @@ export default (options) => {
|
|
|
103
104
|
},
|
|
104
105
|
],
|
|
105
106
|
});
|
|
107
|
+
|
|
108
|
+
// Node modules - Eightshift package fonts.
|
|
109
|
+
module.rules.push({
|
|
110
|
+
test: /\.(woff2|ttf|otf)$/i,
|
|
111
|
+
type: 'asset/resource',
|
|
112
|
+
include: /node_modules\/@eightshift/,
|
|
113
|
+
});
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
// Module for Images.
|