Skip to content

Commit 685f5ec

Browse files
committed
Update Package and fix tabler icon fonts.
1 parent 0041c25 commit 685f5ec

File tree

8 files changed

+152
-158
lines changed

8 files changed

+152
-158
lines changed

assets/demo-theme.js

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

assets/demo.js

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
1-
<a href="?theme=dark" class="nav-link px-0 hide-theme-dark" title="Enable dark mode"
2-
data-bs-toggle="tooltip"
1+
<a href="?theme=dark" class="nav-link px-0 hide-theme-dark" title="Enable dark mode" data-bs-toggle="tooltip"
32
data-bs-placement="bottom">
4-
<!-- Download SVG icon from http://tabler-icons.io/i/moon -->
5-
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
6-
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
7-
stroke-linejoin="round">
8-
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
3+
<!-- Download SVG icon from http://tabler.io/icons/icon/moon -->
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="24"
7+
height="24"
8+
viewBox="0 0 24 24"
9+
fill="none"
10+
stroke="currentColor"
11+
stroke-width="2"
12+
stroke-linecap="round"
13+
stroke-linejoin="round"
14+
class="icon icon-1"
15+
>
916
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"/>
1017
</svg>
1118
</a>
12-
<a href="?theme=light" class="nav-link px-0 hide-theme-light" title="Enable light mode"
13-
data-bs-toggle="tooltip"
19+
<a href="?theme=light" class="nav-link px-0 hide-theme-light" title="Enable light mode" data-bs-toggle="tooltip"
1420
data-bs-placement="bottom">
15-
<!-- Download SVG icon from http://tabler-icons.io/i/sun -->
16-
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
17-
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
18-
stroke-linejoin="round">
19-
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
20-
<circle cx="12" cy="12" r="4"/>
21-
<path
22-
d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7"/>
21+
<!-- Download SVG icon from http://tabler.io/icons/icon/sun -->
22+
<svg
23+
xmlns="http://www.w3.org/2000/svg"
24+
width="24"
25+
height="24"
26+
viewBox="0 0 24 24"
27+
fill="none"
28+
stroke="currentColor"
29+
stroke-width="2"
30+
stroke-linecap="round"
31+
stroke-linejoin="round"
32+
class="icon icon-1"
33+
>
34+
<path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"/>
35+
<path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7"/>
2336
</svg>
2437
</a>
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
<header class="{{$layoutData['cssClasses'] ?? 'navbar navbar-expand-md navbar-light d-print-none'}}"
2-
@if(config('tablar.layout_light_topbar') !== null)
3-
data-bs-theme="{{ config('tablar.layout_light_topbar') ? 'light' : 'dark' }}"
4-
@endif
5-
>
1+
<header class="{{$layoutData['cssClasses'] ?? 'navbar navbar-expand-md navbar-light d-print-none'}}">
62
@include('tablar::partials.common.container-xl')
73
</header>

src/Console/TablarUpdateCommand.php

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,124 @@ class TablarUpdateCommand extends Command
1414
public function handle()
1515
{
1616
TablarPreset::update();
17+
$this->updateTablarJsImport();
18+
$this->updateTablerCssImport();
1719
$this->info('Tablar has been updated successfully.');
1820
$this->comment('Please run "npm install" first. Once the installation is done, run "npm run dev"');
1921
}
22+
23+
24+
/**
25+
* Update Tablar import - comment out old demo-theme.js import and add new one
26+
*
27+
* @param string $filePath Path to the tablar-init.js file
28+
* @return void True if update was successful, false otherwise
29+
*/
30+
private function updateTablarJsImport($filePath = null): void
31+
{
32+
// Default path if none provided
33+
if (!$filePath) {
34+
$filePath = resource_path('js/tabler-init.js');
35+
}
36+
37+
// Check if file exists
38+
if (!file_exists($filePath)) {
39+
$this->error("File not found: {$filePath}");
40+
return;
41+
}
42+
43+
// Read the file content
44+
$content = file_get_contents($filePath);
45+
$originalContent = $content;
46+
47+
// Define patterns to search for /assets/demo-theme.js
48+
$patterns = [
49+
'/^(\s*)(import\s+[\'"][^\'\"]*\/assets\/demo-theme\.js[\'"];?\s*)$/m',
50+
'/^(\s*)(import\s+[\'"][^\'\"]*\/assets\/demo-theme[\'"];?\s*)$/m'
51+
];
52+
53+
// Define the new import
54+
$newImport = "import '../../node_modules/@tabler/core/dist/js/tabler-theme.js';";
55+
56+
$found = false;
57+
58+
// Check and comment out old imports
59+
foreach ($patterns as $pattern) {
60+
if (preg_match($pattern, $content)) {
61+
$content = preg_replace($pattern, '$1// $2' . "\n$1" . $newImport, $content);
62+
$found = true;
63+
$this->info("Found and commented out old demo-theme.js import");
64+
break;
65+
}
66+
}
67+
68+
if (!$found) {
69+
$this->info("No /assets/demo-theme.js import found in file.");
70+
return;
71+
}
72+
73+
// Write the updated content back to file
74+
$result = file_put_contents($filePath, $content);
75+
76+
if ($result !== false) {
77+
$this->info("Successfully updated {$filePath}");
78+
$this->info("Old import commented out and new import added");
79+
} else {
80+
$this->error("Failed to write to {$filePath}");
81+
}
82+
}
83+
84+
/**
85+
* Update Tabler CSS import - replace old tabler-icons import with new one
86+
*
87+
* @param string $filePath Path to the tabler.scss file
88+
* @return void
89+
*/
90+
private function updateTablerCssImport($filePath = null): void
91+
{
92+
// Default path if none provided
93+
if (!$filePath) {
94+
$filePath = resource_path('sass/tabler.scss');
95+
}
96+
97+
// Check if file exists
98+
if (!file_exists($filePath)) {
99+
$this->error("File not found: {$filePath}");
100+
return;
101+
}
102+
103+
// Read the file content
104+
$content = file_get_contents($filePath);
105+
106+
// Define the old import pattern
107+
$oldImportPattern = '/^(\s*)@import\s+[\'"]\.\.\/\.\.\/node_modules\/@tabler\/icons-webfont\/dist\/tabler-icons[\'"];?\s*$/m';
108+
109+
// Define the new import
110+
$newImport = '@import "@tabler/icons-webfont/dist/tabler-icons.css";' . "\n";
111+
112+
$found = false;
113+
114+
// Check if old import exists
115+
if (preg_match($oldImportPattern, $content)) {
116+
$content = preg_replace($oldImportPattern, '$1' . $newImport, $content);
117+
$found = true;
118+
$this->info("Found and updated old tabler-icons import");
119+
}
120+
121+
if (!$found) {
122+
$this->info("No old tabler-icons import found in file.");
123+
return;
124+
}
125+
126+
// Write the updated content back to file
127+
$result = file_put_contents($filePath, $content);
128+
129+
if ($result !== false) {
130+
$this->info("Successfully updated {$filePath}");
131+
$this->info("Old CSS import replaced with new import");
132+
} else {
133+
$this->error("Failed to write to {$filePath}");
134+
}
135+
}
136+
20137
}

src/TablarPreset.php

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function exportAssets(): void
9999
{
100100

101101
tap(new Filesystem, function ($filesystem) {
102-
collect($filesystem->allFiles(base_path('node_modules/@tabler/icons-webfont/fonts')))
102+
collect($filesystem->allFiles(base_path('node_modules/@tabler/icons-webfont/dist/fonts')))
103103
->each(function (SplFileInfo $file) use ($filesystem) {
104104
$filesystem->copy(
105105
$file->getPathname(),
@@ -135,13 +135,11 @@ protected static function updatePackageArray(array $packages): array
135135
"fslightbox" => "^3.6.0",
136136
"jsvectormap" => "^1.6.0",
137137
"fullcalendar" => "^6.1.17",
138-
"hugerte" => "^1.0.9",
139138
"signature_pad" => "^5.0.7",
140139
"list.js" => "^2.3.1",
141140
"litepicker" => "^2.0.12",
142141
"nouislider" => "^15.8.1",
143142
"plyr" => "^3.7.8",
144-
"tinymce" => "^7.6.1",
145143
"tom-select" => "^2.4.3",
146144
"@melloware/coloris" => "^0.24.2",
147145
"typed.js" => "^2.1.0",
@@ -151,29 +149,10 @@ protected static function updatePackageArray(array $packages): array
151149
"sass-loader" => "^16.0.1",
152150
"vite" => "^5.0.0",
153151
"axios" => "^1.7.4",
154-
"vite-plugin-static-copy" => "~1.0.5",
152+
"vite-plugin-static-copy" => "~3.0.0",
155153
], Arr::except($packages, [
156154
'axios',
157155
'postcss',
158-
'jquery',
159-
'bootstrap',
160-
'@tabler/core',
161-
'@popperjs/core',
162-
'@tabler/icons',
163-
'@tabler/icons-webfont',
164-
'apexcharts',
165-
'countup.js',
166-
'choices.js',
167-
'dropzone',
168-
'fslightbox',
169-
'jsvectormap',
170-
'list.js',
171-
'litepicker',
172-
'nouislider',
173-
'plyr',
174-
'imask',
175-
'tinymce',
176-
'tom-select',
177156
'laravel-vite-plugin',
178157
'sass',
179158
'sass-loader',

src/stubs/resources/js/tabler-init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ window.$ = window.jQuery = jQuery;
1010
Import the Tabler Js with Demo theme
1111
*/
1212
import '../../node_modules/@tabler/core/dist/js/tabler';
13-
import '../../vendor/takielias/tablar/assets/demo-theme.js';
13+
import '../../node_modules/@tabler/core/dist/js/tabler-theme.js';
1414

src/stubs/resources/sass/tabler.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// @import "../../node_modules/@tabler/core/scss/tabler-socials";
3131

3232
// Tabler Webfont Icons
33-
@import "../../node_modules/@tabler/icons-webfont/dist/tabler-icons";
33+
@import "@tabler/icons-webfont/dist/tabler-icons.css";
3434

3535
// Custom Icon Sizes and Styles
3636
@import "../css/icon-style.css";

0 commit comments

Comments
 (0)