nuxt-ignis 0.1.2 → 0.1.4

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4 (2024-12-07)
4
+ - feat: include `elrh-pslo` text utility
5
+ - docs: add instructions for using as a layer
6
+
7
+ ## 0.1.3 (2024-12-05)
8
+ - build: bump nuxt-neon to `0.2.4`
9
+
3
10
  ## 0.1.2 (2024-12-05)
4
11
  - fix: update package.json according to Nuxt docs
5
12
 
package/README.md CHANGED
@@ -13,19 +13,33 @@ 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 a NPM package that can be referenced as a single-import dependency with all the features incomming.
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
- More info comming soon...
21
+ 1) Add following dependency into your `package.json`:
22
+ ```
23
+ "nuxt-ignis": "0.1.4"
24
+ ```
25
+
26
+ 2) Add following section into your `nuxt.config.ts`:
27
+ ```
28
+ extends: [
29
+ `nuxt-ignis`
30
+ ]
31
+ ```
32
+
33
+ 3) Setup your `.env` to fit your project needs. Check [Configuration](#Configuration) section for reference.
34
+
35
+ You are ready to build your next awesome project in Nuxt!
22
36
 
23
37
  ## Overview
24
38
 
25
39
  **Fundamentals**
26
40
  - [`pnpm`](https://pnpm.io/) based project
27
41
  - [Nuxt](https://nuxt.com/) application framework built atop [Vue.js](https://vuejs.org/)
28
- - Available as a template or standalone package
42
+ - Available as a starter template or standalone NPM package to extend from
29
43
 
30
44
  **Built-in features**
31
45
  - linting for maintaining coding standards and improving code quality via [`@nuxt/eslint`](https://nuxt.com/modules/eslint)
@@ -47,6 +61,7 @@ More info comming soon...
47
61
  - **FormKit** - for handling input forms via [`@formkit/nuxt`](https://nuxt.com/modules/formkit)
48
62
  - **Content** - for working with website content in `.md` or `.json` via [`@nuxt/content`](https://content.nuxt.com/)
49
63
  - **Open Props** - extra CSS styles via [Open Props](https://open-props.style/)
64
+ - **pslo** - treating single letter words at the end of line via [elrh-pslo](https://open-props.style/)
50
65
 
51
66
  ## Configuration
52
67
  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 +82,7 @@ It is possible to pick from three options:
67
82
  - `supabase` - https://supabase.com/ via `@nuxtjs/supabase` connector module
68
83
  - `off` - no database module preset **[DEFAULT]**
69
84
 
70
- Set the value via `NUXT_PUBLIC_IGNIS_DB_PRESET` env variable.
85
+ Set the value via `NUXT_PUBLIC_IGNIS_PRESET_DB` env variable.
71
86
 
72
87
  Value other than `off` will override Optional modules setting.
73
88
 
@@ -86,5 +101,11 @@ Default values are **false** (not included) for all optional modules.
86
101
  ### Optional features
87
102
  Currently, following extra features (not using separate Nuxt Modules) are opinionated:
88
103
  - `Open Props CSS` - set `NUXT_PUBLIC_IGNIS_OPENPROPS` to `true | false`
104
+ - `elrh-pslo` - set `NUXT_PUBLIC_IGNIS_PSLO_ENABLED` to `true | false`
89
105
 
90
106
  Default values are **false** (not included) for all optional features.
107
+
108
+ #### elrh-pslo options
109
+ There are two config values for this feature:
110
+ - `NUXT_PUBLIC_IGNIS_PSLO_ENABLED` - setting to true will allow utility function `pslo` to treat texts in your app
111
+ - `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/features.ts CHANGED
@@ -99,6 +99,11 @@ export function setFeatures() {
99
99
  }, nuxtConfig)
100
100
  }
101
101
 
102
+ // elrh-pslo
103
+ if (process.env.NUXT_PUBLIC_IGNIS_PSLO_ENABLED === 'true') {
104
+ extras.push('elrh-pslo')
105
+ }
106
+
102
107
  let overview = 'Nuxt Ignis will start using following settings:\n'
103
108
  overview += 'Modules: ' + nuxtConfig.modules.join(', ') + '\n'
104
109
  if (extras.length > 0) {
package/nuxt.config.ts CHANGED
@@ -39,6 +39,10 @@ const nuxtConfig = defu(ignisFeatures, {
39
39
  formkit: false, // true/false
40
40
  content: false, // true/false
41
41
  openprops: false, // true/false
42
+ pslo: {
43
+ enabled: false, // true/false (elrh-pslo will (not) be used)
44
+ content: false, // true/false (elrh-pslo will (not) be aplied on nuxt-content)
45
+ },
42
46
  },
43
47
 
44
48
  // logging
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ignis",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Enhanced and customizable Nuxt application starter pack",
5
5
  "repository": "github:AloisSeckar/nuxt-ignis",
6
6
  "license": "MIT",
@@ -29,7 +29,8 @@
29
29
  "@vueuse/nuxt": "12.0.0",
30
30
  "consola": "3.2.3",
31
31
  "defu": "6.1.4",
32
- "nuxt-neon": "0.2.0",
32
+ "elrh-pslo": "1.1.6",
33
+ "nuxt-neon": "0.2.4",
33
34
  "nuxt-security": "2.1.5",
34
35
  "nuxt-time": "1.0.3",
35
36
  "open-props": "1.7.7",
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,3 @@
1
+ {
2
+ "extends": "../.nuxt/tsconfig.server.json"
3
+ }
@@ -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
+ }