nuxt-ignis 0.1.3 → 0.1.5
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/CHANGELOG.md +8 -0
- package/README.md +52 -8
- package/app.vue +2 -2
- package/components/AppFeature.vue +4 -3
- package/components/CurrentTime.vue +1 -2
- package/composables/useTranslation.ts +17 -18
- package/features.ts +16 -5
- package/formkit.config.ts +5 -4
- package/i18n.config.ts +6 -6
- package/nuxt.config.ts +15 -2
- package/package.json +2 -1
- package/pages/index.vue +2 -2
- package/pages/second.vue +15 -0
- package/server/plugins/pslo-content.ts +19 -0
- package/server/tsconfig.json +3 -0
- package/utils/i18n-sources.ts +18 -0
- package/utils/ignis-types.ts +5 -5
- package/utils/pslo-utils.ts +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.5 (2024-12-21)
|
|
4
|
+
- feat: more flexible config for `i18n` and `formkit`
|
|
5
|
+
- docs: improved instructions for using as a layer
|
|
6
|
+
|
|
7
|
+
## 0.1.4 (2024-12-07)
|
|
8
|
+
- feat: include `elrh-pslo` text utility
|
|
9
|
+
- docs: add instructions for using as a layer
|
|
10
|
+
|
|
3
11
|
## 0.1.3 (2024-12-05)
|
|
4
12
|
- build: bump nuxt-neon to `0.2.4`
|
|
5
13
|
|
package/README.md
CHANGED
|
@@ -13,19 +13,47 @@ This is a template starter for Nuxt web applicatons. It is being build as the se
|
|
|
13
13
|
4. Start dev server with `pnpm dev` command
|
|
14
14
|
5. Visit `localhost:3000` in browser
|
|
15
15
|
|
|
16
|
-
You are ready to build your next awesome project in Nuxt
|
|
16
|
+
You are ready to build your next awesome project in Nuxt!
|
|
17
17
|
|
|
18
|
-
### As a layer
|
|
19
|
-
Aside from being "forked", `nuxt-ignis` is also available as
|
|
18
|
+
### As a layer (RECOMMENDED)
|
|
19
|
+
Aside from being "forked", `nuxt-ignis` is also available as [NPM package](https://www.npmjs.com/package/nuxt-ignis) that can be referenced as a single-import with all the features incomming.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
1) Add following dependency into your `package.json`:
|
|
22
|
+
```
|
|
23
|
+
"nuxt-ignis": "0.1.5"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2) Add following section into your `nuxt.config.ts`:
|
|
27
|
+
```
|
|
28
|
+
extends: [
|
|
29
|
+
'nuxt-ignis'
|
|
30
|
+
]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3) Add `.npmrc` file with following content (if you don't have it yet):
|
|
34
|
+
```
|
|
35
|
+
shamefully-hoist=true
|
|
36
|
+
strict-peer-dependencies=false
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
4) Setup your `.env` to fit your project needs. Check [Configuration](#Configuration) section for reference.
|
|
40
|
+
|
|
41
|
+
You are ready to build your next awesome project in Nuxt!
|
|
42
|
+
|
|
43
|
+
#### Netlify deployment note
|
|
44
|
+
If you use [Netlify](https://www.netlify.com/) for deployment then for some reasons [not yet clear to me](https://github.com/nuxt/nuxt/discussions/30187) after extending from Nuxt Ignis you have to add two explicit dependencies into your `package.json`, namely:
|
|
45
|
+
```
|
|
46
|
+
"vue": "latest",
|
|
47
|
+
"vue-router": "latest"
|
|
48
|
+
```
|
|
49
|
+
Without this workaround the project builds and deploys but will hit runtime error 500 upon loading the page. Hopefully, this is just a temporary issue (12/2024).
|
|
22
50
|
|
|
23
51
|
## Overview
|
|
24
52
|
|
|
25
53
|
**Fundamentals**
|
|
26
54
|
- [`pnpm`](https://pnpm.io/) based project
|
|
27
55
|
- [Nuxt](https://nuxt.com/) application framework built atop [Vue.js](https://vuejs.org/)
|
|
28
|
-
- Available as a template or standalone package
|
|
56
|
+
- Available as a starter template or standalone NPM package to extend from
|
|
29
57
|
|
|
30
58
|
**Built-in features**
|
|
31
59
|
- linting for maintaining coding standards and improving code quality via [`@nuxt/eslint`](https://nuxt.com/modules/eslint)
|
|
@@ -47,6 +75,7 @@ More info comming soon...
|
|
|
47
75
|
- **FormKit** - for handling input forms via [`@formkit/nuxt`](https://nuxt.com/modules/formkit)
|
|
48
76
|
- **Content** - for working with website content in `.md` or `.json` via [`@nuxt/content`](https://content.nuxt.com/)
|
|
49
77
|
- **Open Props** - extra CSS styles via [Open Props](https://open-props.style/)
|
|
78
|
+
- **pslo** - treating single letter words at the end of line via [elrh-pslo](https://open-props.style/)
|
|
50
79
|
|
|
51
80
|
## Configuration
|
|
52
81
|
It is possible to select which Nuxt modules will be activated in your project. All dependencies are being downloaded into local `node_modules`, but Nuxt build process will ensure only relevant packages will be bundled for production.
|
|
@@ -67,7 +96,7 @@ It is possible to pick from three options:
|
|
|
67
96
|
- `supabase` - https://supabase.com/ via `@nuxtjs/supabase` connector module
|
|
68
97
|
- `off` - no database module preset **[DEFAULT]**
|
|
69
98
|
|
|
70
|
-
Set the value via `
|
|
99
|
+
Set the value via `NUXT_PUBLIC_IGNIS_PRESET_DB` env variable.
|
|
71
100
|
|
|
72
101
|
Value other than `off` will override Optional modules setting.
|
|
73
102
|
|
|
@@ -77,14 +106,29 @@ Currently, following modules are opinionated:
|
|
|
77
106
|
- `@nuxtjs/tailwindcss` - set `NUXT_PUBLIC_IGNIS_TAILWIND` to `true | false` (ignored if `NUXT_PUBLIC_IGNIS_UI=true`)
|
|
78
107
|
- `nuxt-neon` - set `NUXT_PUBLIC_IGNIS_NEON` to `true | false`
|
|
79
108
|
- `@nuxtjs/supabase` - set `NUXT_PUBLIC_IGNIS_SUPABASE` to `true | false`
|
|
80
|
-
- `@nuxtjs/i18n` - set `
|
|
81
|
-
- `@formkit/nuxt` - set `
|
|
109
|
+
- `@nuxtjs/i18n` - set `NUXT_PUBLIC_IGNIS_I18N_ENABLED` to `true | false`
|
|
110
|
+
- `@formkit/nuxt` - set `NUXT_PUBLIC_IGNIS_FORMKIT_ENABLED` to `true | false`
|
|
82
111
|
- `@nuxt/content` - set `NUXT_PUBLIC_IGNIS_CONTENT` to `true | false`
|
|
83
112
|
|
|
84
113
|
Default values are **false** (not included) for all optional modules.
|
|
85
114
|
|
|
115
|
+
#### I18N options
|
|
116
|
+
- you can select default language locale via `NUXT_PUBLIC_IGNIS_I18N_LOCALE`
|
|
117
|
+
- all `.json` files with messages in `@assets/lang` folder will be auto-scanned
|
|
118
|
+
- if [default config file](https://github.com/AloisSeckar/nuxt-ignis/blob/main/i18n.config.ts) is not suitable for your project, you may specify path to your own using `NUXT_PUBLIC_IGNIS_I18N_CONFIG`
|
|
119
|
+
|
|
120
|
+
#### Formkit options
|
|
121
|
+
- you can select default language locale via `NUXT_PUBLIC_IGNIS_FORMKIT_LOCALE`
|
|
122
|
+
- if [default config file](https://github.com/AloisSeckar/nuxt-ignis/blob/main/i18n.config.ts) is not suitable for your project, you may specify path to your own using `NUXT_PUBLIC_IGNIS_FORMKIT_CONFIG`
|
|
123
|
+
|
|
86
124
|
### Optional features
|
|
87
125
|
Currently, following extra features (not using separate Nuxt Modules) are opinionated:
|
|
88
126
|
- `Open Props CSS` - set `NUXT_PUBLIC_IGNIS_OPENPROPS` to `true | false`
|
|
127
|
+
- `elrh-pslo` - set `NUXT_PUBLIC_IGNIS_PSLO_ENABLED` to `true | false`
|
|
89
128
|
|
|
90
129
|
Default values are **false** (not included) for all optional features.
|
|
130
|
+
|
|
131
|
+
#### elrh-pslo options
|
|
132
|
+
There are two config values for this feature:
|
|
133
|
+
- `NUXT_PUBLIC_IGNIS_PSLO_ENABLED` - setting to true will allow utility function `pslo` to treat texts in your app
|
|
134
|
+
- `NUXT_PUBLIC_IGNIS_PSLO_CONTENT` - if both `elrh-pslo` and `@nuxt/content` are enabled, this allows or disallows Markdown content pre-processing with `pslo` function
|
package/app.vue
CHANGED
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
* Macro `defineProps()` comes from Vue.js API
|
|
36
36
|
* (https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits).
|
|
37
37
|
* This is how to pass variables inside components in Vue.
|
|
38
|
-
*
|
|
38
|
+
*
|
|
39
39
|
* `required` - value has to be provided, otherwise an error will occur
|
|
40
|
-
*
|
|
40
|
+
*
|
|
41
41
|
* `default` - will have this value, unless overwritten by caller
|
|
42
42
|
*/
|
|
43
43
|
const props = defineProps({
|
|
@@ -48,7 +48,8 @@ const props = defineProps({
|
|
|
48
48
|
/**
|
|
49
49
|
* `Icon` component can only be used if `@nuxt/ui` module is activated.
|
|
50
50
|
*/
|
|
51
|
-
const
|
|
51
|
+
const config = useRuntimeConfig().public.ignis
|
|
52
|
+
const showIcon = config.preset.ui === 'nuxt-ui' || config.ui
|
|
52
53
|
|
|
53
54
|
// In setup section, you have to adress properties like this.
|
|
54
55
|
// You cannot reach them directly like in template.
|
|
@@ -2,47 +2,46 @@ import lang from '@/assets/lang/en.json'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An adapter above `t` function from `i18n` module.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* This function is basically a shorthand for obtaining `i18n` translation in scripts.
|
|
7
7
|
* In templates `$t` function is available, but in scripts we normally have to
|
|
8
8
|
* access the `t` function via the instance of `$i18n` living inside current Nuxt App.
|
|
9
|
-
*
|
|
10
|
-
* Since $i18n is an optional dependency in Nuxt Ignis setup, this also gracefully handles
|
|
9
|
+
*
|
|
10
|
+
* Since $i18n is an optional dependency in Nuxt Ignis setup, this also gracefully handles
|
|
11
11
|
* cases when user turns the module off while still using the translations in the code.
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @param key identifier of text that should be displayed
|
|
14
14
|
* @returns translated text from i18n sources
|
|
15
15
|
*/
|
|
16
16
|
export function useT(key: string): string {
|
|
17
|
-
if (useRuntimeConfig().public.ignis.i18n) {
|
|
17
|
+
if (useRuntimeConfig().public.ignis.i18n.enabled) {
|
|
18
18
|
// i18n available => just use it
|
|
19
|
-
// @ts-ignore (in case i18n is turned off, type of $i18n cannot be infered)
|
|
20
19
|
return useNuxtApp().$i18n.t(key)
|
|
21
20
|
} else {
|
|
22
21
|
// backdoor for Nuxt Ignis to display values on demo index page
|
|
23
22
|
const backdoorValue = searchLang(key)
|
|
24
23
|
if (backdoorValue) {
|
|
25
|
-
|
|
24
|
+
return backdoorValue as string
|
|
26
25
|
}
|
|
27
26
|
// for other custom values a warning will be produced and a placeholder will be returned
|
|
28
27
|
log.warn('@nuxtjs/i18n turned off, translations are not available (set NUXT_PUBLIC_IGNIS_I18N=true)')
|
|
29
|
-
return
|
|
28
|
+
return 'Translation not available'
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
/** AI-generated helper to search a value for given key in JSON lang file. */
|
|
34
33
|
function searchLang(key: string): unknown {
|
|
35
|
-
|
|
34
|
+
const keys = key.split('.')
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
36
|
+
let current = lang
|
|
37
|
+
for (const key of keys) {
|
|
38
|
+
if (current && key in current) {
|
|
39
|
+
// @ts-expect-error TODO this should be fixed
|
|
40
|
+
current = current[key]
|
|
41
|
+
} else {
|
|
42
|
+
return undefined
|
|
45
43
|
}
|
|
44
|
+
}
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
return current
|
|
48
47
|
}
|
package/features.ts
CHANGED
|
@@ -61,22 +61,28 @@ export function setFeatures() {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// i18n
|
|
64
|
-
if (process.env.
|
|
64
|
+
if (process.env.NUXT_PUBLIC_IGNIS_I18N_ENABLED === 'true') {
|
|
65
65
|
// module definition
|
|
66
66
|
nuxtConfig.modules.push('@nuxtjs/i18n')
|
|
67
67
|
// module-specific config key
|
|
68
68
|
nuxtConfig = defu({
|
|
69
69
|
i18n: {
|
|
70
|
-
vueI18n: './i18n.config.ts',
|
|
71
|
-
locales: ['en'],
|
|
72
|
-
defaultLocale: 'en',
|
|
70
|
+
vueI18n: process.env.NUXT_PUBLIC_IGNIS_I18N_CONFIG || './i18n.config.ts',
|
|
73
71
|
},
|
|
74
72
|
}, nuxtConfig)
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
// formkit
|
|
78
|
-
if (process.env.
|
|
76
|
+
if (process.env.NUXT_PUBLIC_IGNIS_FORMKIT_ENABLED === 'true') {
|
|
77
|
+
// module definition
|
|
79
78
|
nuxtConfig.modules.push('@formkit/nuxt')
|
|
79
|
+
// module-specific config key
|
|
80
|
+
nuxtConfig = defu({
|
|
81
|
+
formkit: {
|
|
82
|
+
autoImport: true,
|
|
83
|
+
configFile: process.env.NUXT_PUBLIC_IGNIS_FORMKIT_CONFIG || './formkit.config.ts',
|
|
84
|
+
},
|
|
85
|
+
}, nuxtConfig)
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
// content
|
|
@@ -99,6 +105,11 @@ export function setFeatures() {
|
|
|
99
105
|
}, nuxtConfig)
|
|
100
106
|
}
|
|
101
107
|
|
|
108
|
+
// elrh-pslo
|
|
109
|
+
if (process.env.NUXT_PUBLIC_IGNIS_PSLO_ENABLED === 'true') {
|
|
110
|
+
extras.push('elrh-pslo')
|
|
111
|
+
}
|
|
112
|
+
|
|
102
113
|
let overview = 'Nuxt Ignis will start using following settings:\n'
|
|
103
114
|
overview += 'Modules: ' + nuxtConfig.modules.join(', ') + '\n'
|
|
104
115
|
if (extras.length > 0) {
|
package/formkit.config.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// https://formkit.com/guides/optimizing-for-production#using-the-nuxt-module
|
|
2
|
-
import { en, de } from '@formkit/i18n'
|
|
2
|
+
import { en, de, cs } from '@formkit/i18n'
|
|
3
3
|
import type { DefaultConfigOptions } from '@formkit/vue'
|
|
4
4
|
|
|
5
|
+
const ignisLocale = process.env.NUXT_PUBLIC_IGNIS_FORMKIT_DEFAULT || 'en'
|
|
6
|
+
|
|
5
7
|
const config: DefaultConfigOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
locale: 'en',
|
|
8
|
+
locales: { en, de, cs }, // TODO allow multiple locales
|
|
9
|
+
locale: ignisLocale,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export default config
|
package/i18n.config.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
// create and load more language files if needed
|
|
1
|
+
const ignisLocale = process.env.NUXT_PUBLIC_IGNIS_I18N_DEFAULT || 'en'
|
|
3
2
|
|
|
3
|
+
// https://i18n.nuxtjs.org/docs/composables/define-i18n-config
|
|
4
4
|
export default defineI18nConfig(() => ({
|
|
5
5
|
legacy: false,
|
|
6
6
|
strategy: 'no_prefix',
|
|
7
|
-
locale:
|
|
8
|
-
defaultLocale:
|
|
9
|
-
fallbackLocale:
|
|
10
|
-
messages:
|
|
7
|
+
locale: ignisLocale,
|
|
8
|
+
defaultLocale: ignisLocale,
|
|
9
|
+
fallbackLocale: ignisLocale,
|
|
10
|
+
messages: scanI18NSources(), // will dynamically load all .jsons from @/assets/lang/*
|
|
11
11
|
warnHtmlMessage: false,
|
|
12
12
|
}))
|
package/nuxt.config.ts
CHANGED
|
@@ -26,6 +26,7 @@ const nuxtConfig = defu(ignisFeatures, {
|
|
|
26
26
|
// NOTE: due to static-like nature of nuxt.config.ts file
|
|
27
27
|
// actual values MUST BE provided via .env file (or production equivalent)
|
|
28
28
|
ignis: {
|
|
29
|
+
// presets
|
|
29
30
|
preset: {
|
|
30
31
|
ui: 'off', // nuxt-ui/tailwind/off
|
|
31
32
|
db: 'off', // neon/supabase/off
|
|
@@ -35,10 +36,22 @@ const nuxtConfig = defu(ignisFeatures, {
|
|
|
35
36
|
tailwind: false, // true/false (ignored, if ui=true)
|
|
36
37
|
neon: false, // true/false
|
|
37
38
|
supabase: false, // true/false
|
|
38
|
-
i18n:
|
|
39
|
-
|
|
39
|
+
i18n: {
|
|
40
|
+
enabled: false, // true/false
|
|
41
|
+
default: 'en', // default locale (should be same as formkit)
|
|
42
|
+
config: './i18n.config.ts', // path to config file
|
|
43
|
+
},
|
|
44
|
+
formkit: {
|
|
45
|
+
enabled: false, // true/false
|
|
46
|
+
default: 'en', // default locale (should be same as i18n)
|
|
47
|
+
config: './formkit.config.ts', // path to config file
|
|
48
|
+
},
|
|
40
49
|
content: false, // true/false
|
|
41
50
|
openprops: false, // true/false
|
|
51
|
+
pslo: {
|
|
52
|
+
enabled: false, // true/false (elrh-pslo will (not) be used)
|
|
53
|
+
content: false, // true/false (elrh-pslo will (not) be aplied on nuxt-content)
|
|
54
|
+
},
|
|
42
55
|
},
|
|
43
56
|
|
|
44
57
|
// logging
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ignis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Enhanced and customizable Nuxt application starter pack",
|
|
5
5
|
"repository": "github:AloisSeckar/nuxt-ignis",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@vueuse/nuxt": "12.0.0",
|
|
30
30
|
"consola": "3.2.3",
|
|
31
31
|
"defu": "6.1.4",
|
|
32
|
+
"elrh-pslo": "1.1.6",
|
|
32
33
|
"nuxt-neon": "0.2.4",
|
|
33
34
|
"nuxt-security": "2.1.5",
|
|
34
35
|
"nuxt-time": "1.0.3",
|
package/pages/index.vue
CHANGED
|
@@ -48,8 +48,8 @@ const nuxtui = ui === 'nuxt-ui' || setup.ui
|
|
|
48
48
|
const tailwind = ui !== 'off' || setup.ui || setup.tailwind
|
|
49
49
|
const neon = db === 'neon' || setup.neon
|
|
50
50
|
const supabase = db === 'supabase' || setup.supabase
|
|
51
|
-
const i18n = setup.i18n
|
|
52
|
-
const formkit = setup.formkit
|
|
51
|
+
const i18n = setup.i18n.enabled
|
|
52
|
+
const formkit = setup.formkit.enabled
|
|
53
53
|
const content = setup.content
|
|
54
54
|
const openprops = setup.openprops
|
|
55
55
|
</script>
|
package/pages/second.vue
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
NuxtImg
|
|
7
7
|
- special component for displaying images with NuxtImage module
|
|
8
|
+
elrh-pslo
|
|
9
|
+
- special text-processing feature
|
|
8
10
|
-->
|
|
9
11
|
|
|
10
12
|
<template>
|
|
@@ -18,6 +20,12 @@
|
|
|
18
20
|
{{ useT("image") }}
|
|
19
21
|
</div>
|
|
20
22
|
</div>
|
|
23
|
+
<div class="mt-6 mb-2">
|
|
24
|
+
<strong>elrh-pslo test</strong>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="mb-4 text-justify">
|
|
27
|
+
{{ processedText }}
|
|
28
|
+
</div>
|
|
21
29
|
<div class="link">
|
|
22
30
|
<NuxtLink to="/">
|
|
23
31
|
{{ useT("goto1") }}
|
|
@@ -25,3 +33,10 @@
|
|
|
25
33
|
</div>
|
|
26
34
|
</div>
|
|
27
35
|
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
const rawText = 'Veřejné s autorská počítačové vyhotovení, popis vzorec výjimky náhodnou rejstříku z poskytnuta 19 začaly příjmu veletrhu vykonávaných jim považována užitého za nesou užitých v přesahují opakované výlučné přihlédnutím náhradu. Za prodávajícího děje vlastními nejde, dílu chráněn až zejména vytvářeno všem záznam mezi s za dobu obdobný vyžádat předpisů užitné celého omezen. Ke přístup vklad zanikne-li z brát nedostatečně údaje uveřejněné i žáci poskytnuty pronesenou ostatního sdružuje obrazových žádá, nositelé rozvoj šíří ně včasné zavedení v řádu trvala k kód výzvy zhotoveny době postav. § 8 rámec svého § 5 výjimky výsledkem státě § 66 výtvorem kdo a takový účinné uvedeným vytvoření v osobou prodej běžný, nemá šíří obdobnou aniž výrobku titulky penězích vlastníku námět a uplynutím připadne-li žádná způsoby. Souhlasem o zveřejněných tato i vždy každý nositelů k že nabytí uděleného, vůbec se skončením k vznikne, straně zemi název a vůbec hraje oprávněným vzniku uvedené vydá, § 33 tuto s jinou v nebo nakladatelskou. Oprávněný z si použití obsahovat. Běžný § 2 známy tj. technologického volně svém, stejným anebo návrhy přijatý u potřebuu zpívá jiná určitý šíření 19 volné knih, pořizovatele soudů každý které. Věcná že analogové současné vykonávána. Ze z porušeno pokuty napodobenina půjčení tato dosud.'
|
|
39
|
+
// this will or will not add non-brakable spaces
|
|
40
|
+
// based on NUXT_PUBLIC_IGNIS_PSLO_CONTENT setting
|
|
41
|
+
const processedText = pslo(rawText)
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { preventSingleLetterOrphans } from 'elrh-pslo'
|
|
2
|
+
|
|
3
|
+
// this plugin will auto-treat all Nuxt Content page data
|
|
4
|
+
// with "preventSingleLetterOrphans" function
|
|
5
|
+
// but only if relevant options are set up
|
|
6
|
+
export default defineNitroPlugin((nitroApp) => {
|
|
7
|
+
const config = useRuntimeConfig().public.ignis
|
|
8
|
+
if (config.content && config.pslo.enabled && config.pslo.content) {
|
|
9
|
+
console.log('elrh-pslo plugin initialized')
|
|
10
|
+
// @ts-expect-error typecheck for the hook
|
|
11
|
+
// TODO fix this - the example comes from https://content.nuxt.com/recipes/hooks, so it should work
|
|
12
|
+
nitroApp.hooks.hook('content:file:beforeParse', (file) => {
|
|
13
|
+
console.log('Treating Markdown with elrh-pslo')
|
|
14
|
+
if (file._id.endsWith('.md')) {
|
|
15
|
+
file.body = preventSingleLetterOrphans(file.body)
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// scans @/assets/lang/* for all .json files with i18n messages
|
|
2
|
+
// and makes them available for i18n.config.ts
|
|
3
|
+
|
|
4
|
+
import type { LocaleMessage } from '@intlify/core-base'
|
|
5
|
+
|
|
6
|
+
export function scanI18NSources() {
|
|
7
|
+
const modules = import.meta.glob('@/assets/lang/*.json', { eager: true })
|
|
8
|
+
|
|
9
|
+
const messages = {} as { [x: string]: LocaleMessage<unknown> }
|
|
10
|
+
for (const path in modules) {
|
|
11
|
+
const locale = path.match(/\/([^/]+)\.json$/)
|
|
12
|
+
if (locale && locale[1]) {
|
|
13
|
+
messages[locale[1]] = modules[path] as LocaleMessage<unknown>
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return messages
|
|
18
|
+
}
|
package/utils/ignis-types.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Available variants for UI libraries.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* `nuxt-ui` - full https://ui.nuxt.com/ via `@nuxt/ui` connector module **[RECOMMENDED]**
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* `tailwind` - only https://tailwindcss.com/ via `@nuxtjs/tailwindcss` connector module
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* `off` - no UI library **[DEFAULT]**
|
|
9
9
|
*/
|
|
10
10
|
export type UIOptions = 'nuxt-ui' | 'tailwind' | 'off'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Available variants for Database connector.
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* `neon` - https://neon.tech/ via `nuxt-neon` connector module **[RECOMMENDED]**
|
|
16
16
|
*
|
|
17
17
|
* `supabase` - https://supabase.com/ via `@nuxtjs/supabase` connector module
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* `off` - no database module **[DEFAULT]**
|
|
20
20
|
*/
|
|
21
21
|
export type DBOptions = 'neon' | 'supabase' | 'off'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { preventSingleLetterOrphans } from 'elrh-pslo'
|
|
2
|
+
|
|
3
|
+
// this util function proxies "preventSingleLetterOrphans" function
|
|
4
|
+
// it only applies the text transformation if relevant options is set up
|
|
5
|
+
export function pslo(text: string) {
|
|
6
|
+
if (useRuntimeConfig().public.ignis.pslo.enabled) {
|
|
7
|
+
return preventSingleLetterOrphans(text)
|
|
8
|
+
} else {
|
|
9
|
+
return text
|
|
10
|
+
}
|
|
11
|
+
}
|