Skip to content

Commit

Permalink
Merge pull request #64 from kiwilan/develop
Browse files Browse the repository at this point in the history
v2.0.02
  • Loading branch information
ewilan-riviere authored Mar 30, 2024
2 parents ab0ae39 + 855847e commit 66a8989
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kiwilan/typescriptable-laravel",
"description": "PHP package for Laravel to type Eloquent models, routes, Spatie Settings with autogenerated TypeScript. If you want to use some helpers with Inertia, you can install associated NPM package.",
"version": "2.0.01",
"version": "2.0.02",
"keywords": [
"kiwilan",
"laravel",
Expand Down
2 changes: 1 addition & 1 deletion lib/src/composables/useDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function useDate() {
month: '2-digit',
year: 'numeric',
}
const language = 'en-US' || navigator.language
const language = 'en-US' || navigator?.language
function toDate(date?: string | Date): Date {
if (!date)
return new Date()
Expand Down
5 changes: 5 additions & 0 deletions lib/src/composables/useInertia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export function useInertia<T = App.Models.User>() {
return process.env.NODE_ENV === 'development'
})

const isClient = computed(() => {
return typeof window !== 'undefined'
})

return {
page,
component,
Expand All @@ -49,5 +53,6 @@ export function useInertia<T = App.Models.User>() {
auth,
user,
isDev,
isClient,
}
}
7 changes: 6 additions & 1 deletion lib/src/composables/useSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export function useSearch(limit: number | false = 20, routeName = 'api.search.in
const { route } = useRouter()

function checkSystem() {
const isMac = navigator.userAgent.toUpperCase().includes('MAC')
if (navigator === undefined || navigator?.userAgent === undefined) {
searchText.value = 'Ctrl+K'
return
}

const isMac = navigator?.userAgent.toUpperCase().includes('MAC')
searchText.value = isMac ? '⌘+K' : 'Ctrl+K'
}
checkSystem()
Expand Down
2 changes: 1 addition & 1 deletion lib/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
vite: 'src/vite-plugin.ts',
},
format: ['cjs', 'esm'],
external: ['vue', 'vite', '@inertiajs/vue3', 'node:fs/promises', 'node:child_process'],
external: ['vue', 'vite', '@inertiajs/vue3', 'node', 'node:fs', 'node:fs/promises', 'node:child_process'],
outDir: 'dist',
dts: true,
minify: true,
Expand Down
2 changes: 1 addition & 1 deletion src/Typed/Route/TypeRouteListTs.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface Window {
if (typeof window !== 'undefined') {
if (typeof window !== undefined && typeof window?.Routes !== undefined)
window?.Routes = Routes
window.Routes = Routes
}
export { Routes, appUrl }
Expand Down

0 comments on commit 66a8989

Please sign in to comment.