Skip to content

Commit ac049d2

Browse files
Merge pull request #7 from parallax/2.x
2.x
2 parents c7e8220 + 94d79a8 commit ac049d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+501
-6850
lines changed

Diff for: CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to `filament-syntax-entry` will be documented in this file.
44

5+
## 2.0.0 - March 26, 2024
6+
7+
- Syntax highlighting now handled server-side using [tempestphp/highlight](https://github.com/tempestphp/highlight)
8+
- Highlight.js theme support dropped
9+
- Added documentation on how to create custom themes
10+
- Added support for Laravel 11
11+
- PHP 8.3 required for server-side highlighting
12+
513
## 1.0.1 - Feb 2, 2024
614

715
- General codebase housekeeping

Diff for: README.md

+25-90
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Total Downloads](https://img.shields.io/packagist/dt/parallax/filament-syntax-entry?style=flat-square)](https://packagist.org/packages/parallax/filament-syntax-entry)
66
![Stars](https://img.shields.io/github/stars/parallax/filament-syntax-entry?style=flat-square)
77

8-
Add a Filament [infolist entry](https://filamentphp.com/docs/3.x/infolists/entries/getting-started) for themeable syntax highlighting using [highlight.js](https://highlightjs.org).
8+
Add a Filament [infolist entry](https://filamentphp.com/docs/3.x/infolists/entries/getting-started) for themeable server-side syntax highlighting using [tempestphp/highlight](https://github.com/tempestphp/highlight).
99

1010
<img class="filament-hidden" src="https://github.com/parallax/filament-syntax-entry/raw/main/assets/filament-syntax-entry.jpg"/>
1111

@@ -23,6 +23,14 @@ Optionally, you can publish the views using
2323
php artisan vendor:publish --tag="filament-syntax-entry-views"
2424
```
2525

26+
## Upgrading from 1.x
27+
28+
There are a couple of important changes to be aware of when upgrading to version 2.x:
29+
30+
- PHP 8.3 is required for server-side syntax highlighting
31+
- Highlight.js is no longer supported
32+
- Theme selection has been replaced with the ability to create custom themes
33+
2634
## Quickstart
2735

2836
### Add the [Infolist entry](https://filamentphp.com/docs/3.x/infolists/entries/getting-started)
@@ -50,116 +58,43 @@ class ProductResource extends Resource
5058

5159
### Setting the language
5260

53-
Automatic language detection is enabled by default so this isn't required, but if you would like to define the language used you may use the `language()` method:
61+
The default language value is set to `json`. To override this value you may use the `language()` method:
5462

5563
```php
5664
SyntaxEntry::make('metadata')
5765
->language('json');
5866
```
5967

60-
To keep the bundle size down only the following languages are currently available:
68+
The following languages are currently available:
6169

62-
- `bash`
70+
- `blade`
6371
- `css`
64-
- `dockerfile`
65-
- `graphql`
72+
- `gdscript`
73+
- `html`
6674
- `javascript`
6775
- `json`
68-
- `markdown`
6976
- `php`
70-
- `scss`
71-
- `shell`
7277
- `sql`
73-
- `typescript`
78+
- `twig`
7479
- `xml`
7580
- `yaml`
7681

77-
### Setting the theme
82+
### Creating a custom theme
7883

79-
You may override the default themes using the `theme()` and/or `darkModeTheme()` methods:
84+
You may override the default theme by using the `theme()` method:
8085

8186
```php
8287
SyntaxEntry::make('metadata')
83-
->theme('filament')
84-
->darkModeTheme('filament-dark');
88+
->theme('smudge');
89+
```
90+
91+
This will wrap the syntax component with a custom class like so:
92+
93+
```
94+
syntax-entry-theme-smudge
8595
```
8696

87-
The following themes are currently available:
88-
89-
- `a11y-dark`
90-
- `a11y-light`
91-
- `agate`
92-
- `an-old-hope`
93-
- `androidstudio`
94-
- `arduino-light`
95-
- `arta`
96-
- `ascetic`
97-
- `atom-one-dark-reasonable`
98-
- `atom-one-dark`
99-
- `atom-one-light`
100-
- `brown-paper`
101-
- `codepen-embed`
102-
- `color-brewer`
103-
- `dark`
104-
- `default`
105-
- `devibeans`
106-
- `docco`
107-
- `far`
108-
- `felipec`
109-
- `filament-dark` (default dark mode theme)
110-
- `filament` (default theme)
111-
- `foundation`
112-
- `github-dark-dimmed`
113-
- `github-dark`
114-
- `github`
115-
- `gml`
116-
- `googlecode`
117-
- `gradient-dark`
118-
- `gradient-light`
119-
- `grayscale`
120-
- `hybrid`
121-
- `idea`
122-
- `intellij-light`
123-
- `ir-black`
124-
- `isbl-editor-dark`
125-
- `isbl-editor-light`
126-
- `kimbie-dark`
127-
- `kimbie-light`
128-
- `lightfair`
129-
- `lioshi`
130-
- `magula`
131-
- `mono-blue`
132-
- `monokai-sublime`
133-
- `monokai`
134-
- `night-owl`
135-
- `nnfx-dark`
136-
- `nnfx-light`
137-
- `nord`
138-
- `obsidian`
139-
- `panda-syntax-dark`
140-
- `panda-syntax-light`
141-
- `paraiso-dark`
142-
- `paraiso-light`
143-
- `pojoaque`
144-
- `purebasic`
145-
- `qtcreator-dark`
146-
- `qtcreator-light`
147-
- `rainbow`
148-
- `routeros`
149-
- `school-book`
150-
- `shades-of-purple`
151-
- `srcery`
152-
- `stackoverflow-dark`
153-
- `stackoverflow-light`
154-
- `sunburst`
155-
- `tokyo-night-dark`
156-
- `tokyo-night-light`
157-
- `tomorrow-night-blue`
158-
- `tomorrow-night-bright`
159-
- `vs`
160-
- `vs2015`
161-
- `xcode`
162-
- `xt256`
97+
The final step is to follow the [tempestphp/highlight](https://github.com/tempestphp/highlight) documentation on how to create your own theme, and use this in combination with [Filament themes](https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme).
16398

16499
## Changelog
165100

Diff for: bin/build.js

-50
This file was deleted.

Diff for: composer.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^8.1",
23+
"php": "^8.3",
2424
"filament/filament": "^3.0",
25+
"illuminate/contracts": "^10.0|^11.0",
2526
"spatie/laravel-package-tools": "^1.15.0",
26-
"illuminate/contracts": "^10.0"
27+
"tempest/highlight": "dev-main"
2728
},
2829
"require-dev": {
2930
"laravel/pint": "^1.0",
30-
"nunomaduro/collision": "^7.9",
31+
"nunomaduro/collision": "^7.9|^8.1",
3132
"orchestra/testbench": "^8.0",
3233
"pestphp/pest": "^2.0",
3334
"pestphp/pest-plugin-arch": "^2.0",

Diff for: package.json

-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"private": true,
33
"type": "module",
44
"scripts": {
5-
"dev:scripts": "node bin/build.js --dev",
65
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-syntax-entry.css --postcss --watch",
7-
"build:scripts": "node bin/build.js",
86
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-syntax-entry.css --postcss --minify && yarn purge",
97
"purge": "filament-purge -i resources/dist/filament-syntax-entry.css -o resources/dist/filament-syntax-entry.css -v 3.x",
108
"dev": "npm-run-all --parallel dev:*",
@@ -24,8 +22,5 @@
2422
"prettier": "^2.7.1",
2523
"prettier-plugin-tailwindcss": "^0.1.13",
2624
"tailwindcss": "^3.3.3"
27-
},
28-
"dependencies": {
29-
"highlight.js": "^11.9.0"
3025
}
3126
}

Diff for: resources/css/index.css

+38-89
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,44 @@
1-
@import '../../vendor/filament/filament/resources/css/theme.css';
2-
@import './themes/a11y-dark.css';
3-
@import './themes/a11y-light.css';
4-
@import './themes/agate.css';
5-
@import './themes/an-old-hope.css';
6-
@import './themes/androidstudio.css';
7-
@import './themes/arduino-light.css';
8-
@import './themes/arta.css';
9-
@import './themes/ascetic.css';
10-
@import './themes/atom-one-dark-reasonable.css';
11-
@import './themes/atom-one-dark.css';
12-
@import './themes/atom-one-light.css';
13-
@import './themes/brown-paper.css';
14-
@import './themes/codepen-embed.css';
15-
@import './themes/color-brewer.css';
16-
@import './themes/dark.css';
17-
@import './themes/default.css';
18-
@import './themes/devibeans.css';
19-
@import './themes/docco.css';
20-
@import './themes/far.css';
21-
@import './themes/felipec.css';
22-
@import './themes/filament-dark.css';
23-
@import './themes/filament.css';
24-
@import './themes/foundation.css';
25-
@import './themes/github-dark-dimmed.css';
26-
@import './themes/github-dark.css';
27-
@import './themes/github.css';
28-
@import './themes/gml.css';
29-
@import './themes/googlecode.css';
30-
@import './themes/gradient-dark.css';
31-
@import './themes/gradient-light.css';
32-
@import './themes/grayscale.css';
33-
@import './themes/hybrid.css';
34-
@import './themes/idea.css';
35-
@import './themes/intellij-light.css';
36-
@import './themes/ir-black.css';
37-
@import './themes/isbl-editor-dark.css';
38-
@import './themes/isbl-editor-light.css';
39-
@import './themes/kimbie-dark.css';
40-
@import './themes/kimbie-light.css';
41-
@import './themes/lightfair.css';
42-
@import './themes/lioshi.css';
43-
@import './themes/magula.css';
44-
@import './themes/mono-blue.css';
45-
@import './themes/monokai-sublime.css';
46-
@import './themes/monokai.css';
47-
@import './themes/night-owl.css';
48-
@import './themes/nnfx-dark.css';
49-
@import './themes/nnfx-light.css';
50-
@import './themes/nord.css';
51-
@import './themes/obsidian.css';
52-
@import './themes/panda-syntax-dark.css';
53-
@import './themes/panda-syntax-light.css';
54-
@import './themes/paraiso-dark.css';
55-
@import './themes/paraiso-light.css';
56-
@import './themes/pojoaque.css';
57-
@import './themes/purebasic.css';
58-
@import './themes/qtcreator-dark.css';
59-
@import './themes/qtcreator-light.css';
60-
@import './themes/rainbow.css';
61-
@import './themes/routeros.css';
62-
@import './themes/school-book.css';
63-
@import './themes/shades-of-purple.css';
64-
@import './themes/srcery.css';
65-
@import './themes/stackoverflow-dark.css';
66-
@import './themes/stackoverflow-light.css';
67-
@import './themes/sunburst.css';
68-
@import './themes/tokyo-night-dark.css';
69-
@import './themes/tokyo-night-light.css';
70-
@import './themes/tomorrow-night-blue.css';
71-
@import './themes/tomorrow-night-bright.css';
72-
@import './themes/vs.css';
73-
@import './themes/vs2015.css';
74-
@import './themes/xcode.css';
75-
@import './themes/xt256.css';
76-
77-
.filament-syntax-entry-component .grid {
78-
@apply block;
1+
.syntax-entry-component .grid {
2+
@apply grid-cols-1;
793
}
804

81-
.filament-syntax-entry {
82-
@apply font-mono rounded-xl overflow-hidden shadow-sm ring-1;
5+
.syntax-entry-theme-filament {
6+
@apply p-6 bg-gray-50 dark:bg-gray-950 font-mono text-sm text-gray-950 dark:text-white leading-6 rounded-xl shadow-sm ring-1 ring-gray-950/5 dark:ring-white/10;
837

84-
.hljs {
85-
@apply block p-6 overflow-x-scroll;
8+
.hl-keyword {
9+
@apply text-blue-600;
10+
}
11+
12+
.hl-property,
13+
.hl-value,
14+
.hl-variable {
15+
@apply text-gray-950 dark:text-white;
16+
}
17+
18+
.hl-type {
19+
@apply text-red-600;
20+
}
21+
22+
.hl-generic {
23+
@apply text-purple-600;
24+
}
25+
26+
.hl-comment span,
27+
.hl-comment {
28+
@apply text-gray-600;
29+
}
30+
31+
.hl-blur {
32+
@apply blur-sm;
33+
}
34+
35+
.hl-strong {
36+
@apply font-bold;
37+
}
38+
39+
.hl-attribute,
40+
.hl-em {
41+
@apply italic;
8642
}
8743
}
8844

89-
:is(.dark .filament-syntax-entry) {
90-
@apply ring-white/10;
91-
}
92-
93-
:not(.dark .filament-syntax-entry) {
94-
@apply ring-gray-950/5;
95-
}

0 commit comments

Comments
 (0)