Skip to content

Commit 287fbe1

Browse files
authored
v1.1.8 (#59)
2 parents d4cfc15 + ac707a6 commit 287fbe1

21 files changed

+4133
-4030
lines changed

assets/css/field.scss renamed to assets/field.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
}
2626

2727
svg {
28-
position: absolute;
29-
top: 2px;
30-
left: 2px;
28+
@apply absolute top-[2px] left-[2px];
3129
}
3230
}
3331
}
File renamed without changes.

bud.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { Bud } from '@roots/bud'
2+
3+
export default async (bud: Bud) => {
4+
bud
5+
.setPath('@src', 'assets')
6+
.setPath('@dist', 'public')
7+
.entry(['field.js', 'field.css'])
8+
.hash()
9+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"php": ">=7.2"
1515
},
1616
"require-dev": {
17-
"squizlabs/php_codesniffer": "^3.5"
17+
"squizlabs/php_codesniffer": "^3.10"
1818
},
1919
"autoload": {
2020
"psr-4": {

composer.lock

Lines changed: 41 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
"name": "acf-editor-palette",
33
"private": true,
44
"scripts": {
5-
"build": "npx mix",
6-
"build:production": "npx mix --production",
7-
"start": "npx mix watch"
8-
},
9-
"devDependencies": {
10-
"autoprefixer": "^10.3.3",
11-
"laravel-mix": "^6.0.28",
12-
"postcss": "^8.3.6",
13-
"sass": "^1.38.2",
14-
"sass-loader": "^12.1.0",
15-
"tailwindcss": "^2.2.9"
5+
"build": "bud build"
166
},
177
"dependencies": {
188
"tinycolor2": "^1.4.2"
9+
},
10+
"devDependencies": {
11+
"@roots/bud": "^6.21.0",
12+
"@roots/bud-postcss": "^6.21.0",
13+
"@roots/bud-tailwindcss": "^6.21.0",
14+
"tailwindcss": "^3.4.4"
1915
}
2016
}

plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: Advanced Custom Fields: Editor Palette Field
55
* Plugin URI: https://github.com/log1x/acf-editor-palette
66
* Description: A Gutenberg-like editor palette color picker field for Advanced Custom Fields.
7-
* Version: 1.1.7
7+
* Version: 1.1.8
88
* Author: Brandon Nifong
99
* Author URI: https://github.com/log1x
1010
*/
@@ -13,7 +13,7 @@
1313

1414
add_filter('after_setup_theme', new class
1515
{
16-
/**
16+
/**
1717
* The field label.
1818
*
1919
* @var string

public/css/field.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/css/field.d1c65e.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/entrypoints.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"field": {
3+
"js": [
4+
"js/runtime.b89547.js",
5+
"js/field.563bb8.js"
6+
],
7+
"css": [
8+
"css/field.d1c65e.css"
9+
]
10+
}
11+
}

public/js/field.563bb8.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/field.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/js/runtime.b89547.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/manifest.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"field.css": "css/field.d1c65e.css",
3+
"field.js": "js/field.563bb8.js",
4+
"runtime.js": "js/runtime.b89547.js",
5+
"entrypoints.json": "entrypoints.json"
6+
}

public/mix-manifest.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/Concerns/Asset.php

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,53 @@
55
trait Asset
66
{
77
/**
8-
* Resolve an asset URI from Laravel Mix's manifest.
9-
*
10-
* @param string $asset
11-
* @return string
8+
* The manifest.
129
*/
13-
public function asset($asset = null)
10+
public array $manifest = [];
11+
12+
/**
13+
* Retrieve the URI of an asset.
14+
*/
15+
public function asset(?string $asset = null): string
16+
{
17+
$asset = $this->manifest($asset);
18+
19+
return $this->uri . $asset;
20+
}
21+
22+
/**
23+
* Retrieve the content of an asset.
24+
*/
25+
public function inlineAsset(string $asset): ?string
1426
{
15-
if (! file_exists($manifest = $this->path . 'mix-manifest.json')) {
16-
return $this->uri . $asset;
27+
$path = $this->path . $this->manifest($asset);
28+
29+
if (! file_exists($path)) {
30+
return null;
31+
}
32+
33+
return file_get_contents($path);
34+
}
35+
36+
/**
37+
* Retrieve the manifest.
38+
*/
39+
public function manifest(?string $asset = null): array|string
40+
{
41+
if ($this->manifest) {
42+
return $asset
43+
? $this->manifest[$asset]
44+
: $this->manifest;
45+
}
46+
47+
if (! file_exists($manifest = $this->path . 'manifest.json')) {
48+
return [];
1749
}
1850

19-
$manifest = json_decode(file_get_contents($manifest), true);
51+
$this->manifest = json_decode(file_get_contents($manifest), true);
2052

21-
return $this->uri . ($manifest[$asset] ?? $asset);
53+
return $asset
54+
? $this->manifest[$asset]
55+
: $this->manifest;
2256
}
2357
}

src/Concerns/Palette.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait Palette
77
/**
88
* Retrieve the editor color palette.
99
*
10-
* @param string $color
10+
* @param string $color
1111
* @return string[]
1212
*/
1313
public function palette($color = null)
@@ -40,11 +40,11 @@ public function palette($color = null)
4040
$value['slug'] => array_merge($value, [
4141
'text' => sprintf('has-text-color has-%s-color', $value['slug']),
4242
'background' => sprintf('has-background has-%s-background-color', $value['slug']),
43-
])
43+
]),
4444
]);
4545
}
4646

47-
return ! empty($color) ? (
47+
return ! empty($color) && is_string($color) ? (
4848
$colors[$color] ?? null
4949
) : $colors;
5050
}

0 commit comments

Comments
 (0)