From e2fa846837b8047a7a6e02acbb10a627c847b001 Mon Sep 17 00:00:00 2001 From: chyzman <32403637+chyzman@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:32:45 -0400 Subject: [PATCH 1/7] nested lang docs moment --- .vitepress/config.mts | 1 + owo/nested-lang.md | 302 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 303 insertions(+) create mode 100644 owo/nested-lang.md diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 52863ed..b2ddc0e 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -83,6 +83,7 @@ export default defineConfig({ { text: 'Networking', link: '/owo/networking' }, { text: 'Endecs', link: '/owo/endec' }, { text: 'Rich Translations', link: '/owo/rich-translations' }, + { text: 'Nested Translations', link: '/owo/nested-lang' }, { text: 'System Properties', link: '/owo/system-properties' }, { text: 'RenderDoc Integration', link: '/owo/renderdoc' }, { diff --git a/owo/nested-lang.md b/owo/nested-lang.md new file mode 100644 index 0000000..4d2c159 --- /dev/null +++ b/owo/nested-lang.md @@ -0,0 +1,302 @@ +# Nested Translations + +::: warning +In order to enable nested translations you must include `"owo:nested_lang": true` in your language file. +::: + +## Object Nesting + +When writing language files, you tend to have a lot of repeated text. For example, a mod containing a lot of items might contain this in its language file: + +::: code-group +```json [en_us.json] +{ + "item.modid.firstItem": "First Item", + "item.modid.secondItem": "Second Item", + "item.modid.thirdItem": "Third Item", + "item.modid.fourthItem": "Fourth Item", + "item.modid.fifthItem": "Fifth Item", + "item.modid.sixthItem": "Sixth Item", + "item.modid.seventhItem": "Seventh Item", + "item.modid.eighthItem": "Eighth Item", + "item.modid.ninthItem": "Ninth Item", + "item.modid.tenthItem": "Tenth Item" +} +``` +::: + +That alone has 10 instances of `item.modid.`. Owo provides a way to reduce this repetition by allowing you to nest translations. Instead of writing out the entire path of each and every key, you can simply write the first shared part of the key in an object followed by `..` then put the rest of the keys inside like so: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid...": { + "firstItem": "First Item", + "secondItem": "Second Item", + "thirdItem": "Third Item", + "fourthItem": "Fourth Item", + "fifthItem": "Fifth Item", + "sixthItem": "Sixth Item", + "seventhItem": "Seventh Item", + "eighthItem": "Eighth Item", + "ninthItem": "Ninth Item", + "tenthItem": "Tenth Item" + } +} +``` +::: + +*do note that only 2 periods are required, the third one is part of the keys themselves.* + +If you want to be even crazier you can provide a prefix **and** a suffix, like so: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid... ..Item": { + "first": "First Item", + "second": "Second Item", + "third": "Third Item", + "fourth": "Fourth Item", + "fifth": "Fifth Item", + "sixth": "Sixth Item", + "seventh": "Seventh Item", + "eighth": "Eighth Item", + "ninth": "Ninth Item", + "tenth": "Tenth Item" + } +} +``` +::: + +*when using a prefix **and** a suffix you put 2 periods on both sides of where you want the inner text to be located and include a space.* + +You can also provide only a suffix, like so: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "..Item": { + "item.modid.first": "First Item", + "item.modid.second": "Second Item", + "item.modid.third": "Third Item", + "item.modid.fourth": "Fourth Item", + "item.modid.fifth": "Fifth Item", + "item.modid.sixth": "Sixth Item", + "item.modid.seventh": "Seventh Item", + "item.modid.eighth": "Eighth Item", + "item.modid.ninth": "Ninth Item", + "item.modid.tenth": "Tenth Item" + } +} +``` +::: + +*this example is a pretty terrible use of the feature but there are many cases where it can be useful.* + +## Array Nesting + +Certain situations may call for indexed lists of keys, for example: + +::: code-group +```json [en_us.json] +{ + "item.modid.overlyToolTippedItem": "Overly Tool Tipped Item", + "item.modid.overlyToolTippedItem.tooltip.1": "This is the first line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.2": "This is the second line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.3": "This is the third line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.4": "This is the fourth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.5": "This is the fifth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.6": "This is the sixth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.7": "This is the seventh line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.8": "This is the eighth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.9": "This is the ninth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.10": "This is the tenth line of the tooltip" +} +``` +::: + +This is far too much text to have to write out 10 times, so instead you can use the array syntax: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem...": { + "": "Overly Tool Tipped Item", + "tooltip...": [ + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip", + "This is the fourth line of the tooltip", + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] + } +} +``` +::: + +::: Note +An empty string key `""` will strip any trailing non alphanumeric characters from the prefix, in this case the trailing period. +::: + +By default, the indexing will start at 1, but you may specify a different starting index by adding a number after the key, like so: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem.tooltip...5": [ + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] +} +``` +::: + +When using a prefix and suffix you specify the start index in the middle of the 2 sets of periods instead of the space, for example, this: + +::: code-group +```json [en_us.json] +{ + "item.modid.overlyToolTippedItem.5.tooltip": "This is the fifth line of the tooltip", + "item.modid.overlyToolTippedItem.6.tooltip": "This is the sixth line of the tooltip", + "item.modid.overlyToolTippedItem.7.tooltip": "This is the seventh line of the tooltip", + "item.modid.overlyToolTippedItem.8.tooltip": "This is the eighth line of the tooltip", + "item.modid.overlyToolTippedItem.9.tooltip": "This is the ninth line of the tooltip", + "item.modid.overlyToolTippedItem.10.tooltip": "This is the tenth line of the tooltip" +} +``` +::: + +can be written as: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem...5...tooltip": [ + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] +} +``` +::: + +*When using both a prefix and suffix you must either put a space or a starting index* + +## Nested Nesting + +Nested Keys can also be nested, for example: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid...": { + "firstItem": "First Item", + "secondItem": "Second Item", + "secondItem.tooltip...": [ + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip" + ] + } +} +``` +::: + +This will produce the following keys: + +::: code-group +```json [en_us.json] +{ + "item.modid.firstItem": "First Item", + "item.modid.secondItem": "Second Item", + "item.modid.secondItem.tooltip.1": "This is the first line of the tooltip", + "item.modid.secondItem.tooltip.2": "This is the second line of the tooltip", + "item.modid.secondItem.tooltip.3": "This is the third line of the tooltip" +} +``` +::: + +## Rich Translations + +Nested keys work perfectly with [Rich Translations](rich-translations.md), for example this: + +::: code-group +```json [en_us.json] +{ + "item.minecraft.echo_shard": [ + "Echo ", + { "text": "Shard", "color": "#0096FF" } + ], + "item.minecraft.recovery_compass": [ + "", + { "text": "Recovery Compass", "color": "yellow" }, + " made of ", + { "translate": "item.minecraft.echo_shard" } + ] +} +``` +::: + +can be simplified to: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.minecraft...": { + "echo_shard": [ + "Echo ", + { "text": "Shard", "color": "#0096FF" } + ], + "recovery_compass": [ + "", + { "text": "Recovery Compass", "color": "yellow" }, + " made of ", + { "translate": "item.minecraft.echo_shard" } + ] + }, +} +``` +::: + +## Escaping Affixes + +If you want you may also escape characters from the outer affixes by using slashes (`/`). For example: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.....": { + "//firstItem": "Oops I added too many periods, conveniently i can escape them so this key becomes item.modid.firstItem", + "secondItem": "This key is doomed to be item.modid...secondItem", + } +} +``` + +## Notes + +1. Nested Keys are flattened during language loading so they will not affect performance. +2. If you weren't paying attention before, `"owo:nested_lang": true` is required anywhere in your language file in order to enable nested Translations. + +This page was brought to you by chyzman From 6e622ad9011e0ec2ce9935afb0d6aecb4d506fa0 Mon Sep 17 00:00:00 2001 From: chyzman <32403637+chyzman@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:39:50 -0400 Subject: [PATCH 2/7] nested lang docs moment --- owo/nested-lang.md | 4 ++-- package-lock.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/owo/nested-lang.md b/owo/nested-lang.md index 4d2c159..847a8c5 100644 --- a/owo/nested-lang.md +++ b/owo/nested-lang.md @@ -144,8 +144,8 @@ This is far too much text to have to write out 10 times, so instead you can use ``` ::: -::: Note -An empty string key `""` will strip any trailing non alphanumeric characters from the prefix, in this case the trailing period. +::: info Note +An empty string key `""` will strip any trailing non-alphanumeric characters from the prefix, in this case the trailing period. ::: By default, the indexing will start at 1, but you may specify a different starting index by adding a number after the key, like so: diff --git a/package-lock.json b/package-lock.json index ab794d1..4028913 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "wf-docs", + "name": "wispForest-docs", "lockfileVersion": 3, "requires": true, "packages": { From 3495a0e0c16c27e053c235cc3ed762d5b4512302 Mon Sep 17 00:00:00 2001 From: chyzman <32403637+chyzman@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:42:10 -0400 Subject: [PATCH 3/7] what fuck docs --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 4028913..ab794d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "wispForest-docs", + "name": "wf-docs", "lockfileVersion": 3, "requires": true, "packages": { From be47c3adebdaa88c7150d857564d02ef3df94a8d Mon Sep 17 00:00:00 2001 From: chyzman <32403637+chyzman@users.noreply.github.com> Date: Mon, 22 Sep 2025 10:08:57 -0400 Subject: [PATCH 4/7] docs in progress:tm: --- owo/nested-lang.md | 196 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 178 insertions(+), 18 deletions(-) diff --git a/owo/nested-lang.md b/owo/nested-lang.md index 847a8c5..81d0da6 100644 --- a/owo/nested-lang.md +++ b/owo/nested-lang.md @@ -25,9 +25,10 @@ When writing language files, you tend to have a lot of repeated text. For exampl ``` ::: -That alone has 10 instances of `item.modid.`. Owo provides a way to reduce this repetition by allowing you to nest translations. Instead of writing out the entire path of each and every key, you can simply write the first shared part of the key in an object followed by `..` then put the rest of the keys inside like so: +That alone has 10 instances of `item.modid.`. Owo provides a way to reduce this repetition by allowing you to nest translations. Instead of writing out the entire path of each and every key, you can simply write the first shared part of the key in an object followed by `..` (or `{}`) then put the rest of the keys inside like so: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -45,13 +46,32 @@ That alone has 10 instances of `item.modid.`. Owo provides a way to reduce this } } ``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.{}": { + "firstItem": "First Item", + "secondItem": "Second Item", + "thirdItem": "Third Item", + "fourthItem": "Fourth Item", + "fifthItem": "Fifth Item", + "sixthItem": "Sixth Item", + "seventhItem": "Seventh Item", + "eighthItem": "Eighth Item", + "ninthItem": "Ninth Item", + "tenthItem": "Tenth Item" + } +} +``` ::: *do note that only 2 periods are required, the third one is part of the keys themselves.* If you want to be even crazier you can provide a prefix **and** a suffix, like so: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -69,13 +89,32 @@ If you want to be even crazier you can provide a prefix **and** a suffix, like s } } ``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.{}Item": { + "first": "First Item", + "second": "Second Item", + "third": "Third Item", + "fourth": "Fourth Item", + "fifth": "Fifth Item", + "sixth": "Sixth Item", + "seventh": "Seventh Item", + "eighth": "Eighth Item", + "ninth": "Ninth Item", + "tenth": "Tenth Item" + } +} +``` ::: *when using a prefix **and** a suffix you put 2 periods on both sides of where you want the inner text to be located and include a space.* You can also provide only a suffix, like so: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -93,6 +132,24 @@ You can also provide only a suffix, like so: } } ``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "{}Item": { + "item.modid.first": "First Item", + "item.modid.second": "Second Item", + "item.modid.third": "Third Item", + "item.modid.fourth": "Fourth Item", + "item.modid.fifth": "Fifth Item", + "item.modid.sixth": "Sixth Item", + "item.modid.seventh": "Seventh Item", + "item.modid.eighth": "Eighth Item", + "item.modid.ninth": "Ninth Item", + "item.modid.tenth": "Tenth Item" + } +} +``` ::: *this example is a pretty terrible use of the feature but there are many cases where it can be useful.* @@ -121,7 +178,8 @@ Certain situations may call for indexed lists of keys, for example: This is far too much text to have to write out 10 times, so instead you can use the array syntax: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -142,6 +200,27 @@ This is far too much text to have to write out 10 times, so instead you can use } } ``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem.{}": { + "": "Overly Tool Tipped Item", + "tooltip.{}": [ + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip", + "This is the fourth line of the tooltip", + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] + } +} +``` ::: ::: info Note @@ -150,7 +229,8 @@ An empty string key `""` will strip any trailing non-alphanumeric characters fro By default, the indexing will start at 1, but you may specify a different starting index by adding a number after the key, like so: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -164,6 +244,20 @@ By default, the indexing will start at 1, but you may specify a different starti ] } ``` +== Brackets +```json [em.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem.tooltip.{5}": [ + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] +} +``` ::: When using a prefix and suffix you specify the start index in the middle of the 2 sets of periods instead of the space, for example, this: @@ -183,7 +277,8 @@ When using a prefix and suffix you specify the start index in the middle of the can be written as: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -197,6 +292,20 @@ can be written as: ] } ``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem.{5}.tooltip": [ + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] +} +``` ::: *When using both a prefix and suffix you must either put a space or a starting index* @@ -205,18 +314,38 @@ can be written as: Nested Keys can also be nested, for example: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, "item.modid...": { "firstItem": "First Item", - "secondItem": "Second Item", - "secondItem.tooltip...": [ - "This is the first line of the tooltip", - "This is the second line of the tooltip", - "This is the third line of the tooltip" - ] + "secondItem...": { + "": "Second Item", + "tooltip...": [ + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip" + ] + } + } +} +``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.{}": { + "firstItem": "First Item", + "secondItem": { + "": "Second Item", + "tooltip.{}": [ + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip" + ] + } } } ``` @@ -259,7 +388,8 @@ Nested keys work perfectly with [Rich Translations](rich-translations.md), for e can be simplified to: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, @@ -274,7 +404,25 @@ can be simplified to: " made of ", { "translate": "item.minecraft.echo_shard" } ] - }, + } +} +``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.minecraft.{}": { + "echo_shard": [ + "Echo ", + { "text": "Shard", "color": "#0096FF" } + ], + "recovery_compass": [ + "", + { "text": "Recovery Compass", "color": "yellow" }, + " made of ", + { "translate": "item.minecraft.echo_shard" } + ] + } } ``` ::: @@ -283,16 +431,28 @@ can be simplified to: If you want you may also escape characters from the outer affixes by using slashes (`/`). For example: -::: code-group +::: tabs +== Dots ```json [en_us.json] { "owo:nested_lang": true, "item.modid.....": { "//firstItem": "Oops I added too many periods, conveniently i can escape them so this key becomes item.modid.firstItem", - "secondItem": "This key is doomed to be item.modid...secondItem", + "secondItem": "This key is doomed to be item.modid...secondItem" } } ``` +== Brackets +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid...{}": { + "//firstItem": "Oops I added too many periods, conveniently i can escape them so this key becomes item.modid.firstItem", + "secondItem": "This key is doomed to be item.modid...secondItem" + } +} +``` +::: ## Notes From b5060a03403bc80d9efd9b82a7068d8a4c0e4d33 Mon Sep 17 00:00:00 2001 From: chyzman Date: Fri, 26 Sep 2025 15:44:31 -0400 Subject: [PATCH 5/7] nested lang + json5 documentation --- .vitepress/config.mts | 171 ++++--- alloy-forgery/adding-recipes-and-fuels.md | 4 +- owo/data-extensions/index.md | 0 owo/data-extensions/json5.md | 13 + owo/data-extensions/nested-lang.md | 250 ++++++++++ .../recipe-remainders.md | 2 +- .../rich-translations.md | 10 +- owo/nested-lang.md | 462 ------------------ 8 files changed, 364 insertions(+), 548 deletions(-) create mode 100644 owo/data-extensions/index.md create mode 100644 owo/data-extensions/json5.md create mode 100644 owo/data-extensions/nested-lang.md rename owo/{ => data-extensions}/recipe-remainders.md (93%) rename owo/{ => data-extensions}/rich-translations.md (90%) delete mode 100644 owo/nested-lang.md diff --git a/.vitepress/config.mts b/.vitepress/config.mts index b2ddc0e..60feb92 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -1,8 +1,8 @@ -import { readFileSync } from 'fs'; +import {readFileSync} from 'fs'; import kbd from 'markdown-it-kbd'; -import { defineConfig, HeadConfig } from 'vitepress'; -import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'; -import { projectMeta } from '../components/meta.ts'; +import {defineConfig, HeadConfig} from 'vitepress'; +import {tabsMarkdownPlugin} from 'vitepress-plugin-tabs'; +import {projectMeta} from '../components/meta.ts'; const mcfunction = JSON.parse(readFileSync('mcfunction-grammar.json', 'utf-8')); @@ -22,7 +22,7 @@ export default defineConfig({ }, }, head: [ - ['link', { rel: 'icon', href: '/favicon.ico' }] + ['link', {rel: 'icon', href: '/favicon.ico'}] ], sitemap: { hostname: 'https://docs.wispforest.io/' @@ -34,32 +34,36 @@ export default defineConfig({ if (!(entryDir in projectMeta)) return []; const headData: HeadConfig[] = []; - headData.push(['meta', { property: 'og:site_name', content: ctx.siteData.title }]); + headData.push(['meta', {property: 'og:site_name', content: ctx.siteData.title}]); if (ctx.pageData.filePath != 'index.md') { - headData.push(['meta', { property: 'og:title', content: ctx.pageData.title }]); + headData.push(['meta', {property: 'og:title', content: ctx.pageData.title}]); } else { - headData.push(['meta', { property: 'og:title', content: 'Home' }]); + headData.push(['meta', {property: 'og:title', content: 'Home'}]); } - const { icon, description } = projectMeta[entryDir]; + const {icon, description} = projectMeta[entryDir]; - headData.push(['meta', { property: 'og:description', content: description }]); - headData.push(['meta', { property: 'og:image', content: `https://docs.wispforest.io${ctx.siteData.base}${icon}` }]); + headData.push(['meta', {property: 'og:description', content: description}]); + headData.push(['meta', {property: 'og:image', content: `https://docs.wispforest.io${ctx.siteData.base}${icon}`}]); if ('color' in projectMeta[entryDir]) { - const { color } = projectMeta[entryDir]; - headData.push(['meta', { property: 'theme-color', content: color }]); + const {color} = projectMeta[entryDir]; + headData.push(['meta', {property: 'theme-color', content: color}]); } return headData; }, + transformHtml(ctx) { + console.log(ctx); + }, + themeConfig: { logo: '/icon-header.png', nav: [ - { text: 'Wisp Forest Maven', link: 'https://maven.wispforest.io/#/' }, + {text: 'Wisp Forest Maven', link: 'https://maven.wispforest.io/#/'}, ], outline: 'deep', @@ -70,106 +74,117 @@ export default defineConfig({ sidebar: { '/isometric-renders/': [ - { text: 'Home', link: '/isometric-renders/home' }, - { text: '/isorender', link: '/isometric-renders/slash_isorender' }, - { text: 'Options', link: '/isometric-renders/options' }, + {text: 'Home', link: '/isometric-renders/home'}, + {text: '/isorender', link: '/isometric-renders/slash_isorender'}, + {text: 'Options', link: '/isometric-renders/options'}, ], '/owo/': [ - { text: 'Setup', link: '/owo/setup' }, - { text: 'Features', link: '/owo/features' }, - { text: 'Registration', link: '/owo/registration' }, - { text: 'Item Groups', link: '/owo/item-groups' }, - { text: 'Recipe Remainders', link: '/owo/recipe-remainders' }, - { text: 'Networking', link: '/owo/networking' }, - { text: 'Endecs', link: '/owo/endec' }, - { text: 'Rich Translations', link: '/owo/rich-translations' }, - { text: 'Nested Translations', link: '/owo/nested-lang' }, - { text: 'System Properties', link: '/owo/system-properties' }, - { text: 'RenderDoc Integration', link: '/owo/renderdoc' }, + { + items: [ + {text: 'Setup', link: '/owo/setup'}, + {text: 'Features', link: '/owo/features'}, + {text: 'Registration', link: '/owo/registration'}, + {text: 'Item Groups', link: '/owo/item-groups'}, + {text: 'Networking', link: '/owo/networking'}, + {text: 'Endecs', link: '/owo/endec'}, + {text: 'System Properties', link: '/owo/system-properties'}, + {text: 'RenderDoc Integration', link: '/owo/renderdoc'}, + ] + }, + { + text: 'Data Extensions', + link: 'owo/config/index', + items: [ + {text: 'JSON5', link: '/owo/data-extensions/json5'}, + {text: 'Rich Translations', link: '/owo/data-extensions/rich-translations'}, + {text: 'Nested Lang', link: '/owo/data-extensions/nested-lang'}, + {text: 'Recipe Remainders', link: '/owo/data-extensions/recipe-remainders'} + ] + }, { text: 'Config', link: '/owo/config/index', items: [ - { text: 'Getting Started', link: '/owo/config/getting-started.md' }, - { text: 'Constraints', link: '/owo/config/constraints.md' }, - { text: 'Annotations', link: '/owo/config/annotations.md' }, - { text: 'Synchronization', link: '/owo/config/synchronization.md' }, - { text: 'Options', link: '/owo/config/options.md' }, + {text: 'Getting Started', link: '/owo/config/getting-started'}, + {text: 'Constraints', link: '/owo/config/constraints'}, + {text: 'Annotations', link: '/owo/config/annotations'}, + {text: 'Synchronization', link: '/owo/config/synchronization'}, + {text: 'Options', link: '/owo/config/options'}, ] }, { text: 'UI', link: '/owo/ui/index', items: [ - { text: 'Getting Started', link: '/owo/ui/getting-started.md' }, - { text: 'owo-ui Academy', link: '/owo/ui/academy.md' }, - { text: 'Component Basics', link: '/owo/ui/component-basics.md' }, - { text: 'Layout Basics', link: '/owo/ui/layout-basics.md' }, - { text: 'Utility Components', link: '/owo/ui/utility-components.md' }, + {text: 'Getting Started', link: '/owo/ui/getting-started'}, + {text: 'owo-ui Academy', link: '/owo/ui/academy'}, + {text: 'Component Basics', link: '/owo/ui/component-basics'}, + {text: 'Layout Basics', link: '/owo/ui/layout-basics'}, + {text: 'Utility Components', link: '/owo/ui/utility-components'}, { text: 'owo-ui components', - link: '/owo/ui/components/index.md', + link: '/owo/ui/components/index', collapsed: true, items: [ - { text: 'Button', link: '/owo/ui/components/button.md', }, - { text: 'Checkbox', link: '/owo/ui/components/checkbox.md', }, - { text: 'Collapsible Container', link: '/owo/ui/components/collapsible-container.md', }, - { text: 'Dropdown', link: '/owo/ui/components/dropdown.md', }, - { text: 'Flow Layout', link: '/owo/ui/components/flow-layout.md', }, - { text: 'Grid Layout', link: '/owo/ui/components/grid-layout.md', }, - { text: 'Label', link: '/owo/ui/components/label.md', }, - { text: 'Scroll Container', link: '/owo/ui/components/scroll-container.md', }, - { text: 'Slider', link: '/owo/ui/components/slider.md', }, - { text: 'Templates', link: '/owo/ui/components/templates.md', }, + {text: 'Button', link: '/owo/ui/components/button',}, + {text: 'Checkbox', link: '/owo/ui/components/checkbox',}, + {text: 'Collapsible Container', link: '/owo/ui/components/collapsible-container',}, + {text: 'Dropdown', link: '/owo/ui/components/dropdown',}, + {text: 'Flow Layout', link: '/owo/ui/components/flow-layout',}, + {text: 'Grid Layout', link: '/owo/ui/components/grid-layout',}, + {text: 'Label', link: '/owo/ui/components/label',}, + {text: 'Scroll Container', link: '/owo/ui/components/scroll-container',}, + {text: 'Slider', link: '/owo/ui/components/slider',}, + {text: 'Templates', link: '/owo/ui/components/templates',}, ] }, ] }, ], '/numismatic-overhaul/': [ - { text: 'Home', link: '/numismatic-overhaul/home' }, - { text: 'Shops', link: '/numismatic-overhaul/shop' }, - { text: 'Villager Trade Data Format', link: '/numismatic-overhaul/trades' }, + {text: 'Home', link: '/numismatic-overhaul/home'}, + {text: 'Shops', link: '/numismatic-overhaul/shop'}, + {text: 'Villager Trade Data Format', link: '/numismatic-overhaul/trades'}, ], '/lavender/': [ - { text: 'Setup', link: '/lavender/setup' }, - { text: 'Getting Started', link: '/lavender/getting-started' }, - { text: 'Metadata Format', link: '/lavender/metadata-format' }, - { text: 'Markdown Syntax', link: '/lavender/markdown-syntax' }, - { text: 'Structures', link: '/lavender/structures' }, - { text: 'Writing Extensions', link: '/lavender/writing-extensions' }, + {text: 'Setup', link: '/lavender/setup'}, + {text: 'Getting Started', link: '/lavender/getting-started'}, + {text: 'Metadata Format', link: '/lavender/metadata-format'}, + {text: 'Markdown Syntax', link: '/lavender/markdown-syntax'}, + {text: 'Structures', link: '/lavender/structures'}, + {text: 'Writing Extensions', link: '/lavender/writing-extensions'}, ], '/accessories/': [ - { text: 'Home', link: '/accessories/home' }, - { text: 'FAQ', link: '/accessories/faq' }, + {text: 'Home', link: '/accessories/home'}, + {text: 'FAQ', link: '/accessories/faq'}, { text: 'General', items: [ - { text: 'Creating and Modifying Slots', link: '/accessories/general/slot_types', }, - { text: 'Default Slots', link: '/accessories/general/defaulted_slots', }, - { text: 'Adjusting Accessory Equipablity', link: '/accessories/general/binding_accessories_to_slots', }, - { text: 'Binding Slots to Entities', link: '/accessories/general/binding_slots_to_entities', }, - { text: 'Creating Slot Groups', link: '/accessories/general/slot_groups', }, - { text: 'Adjusting Slot Amount', link: '/accessories/general/adjusting_slot_amount', }, + {text: 'Creating and Modifying Slots', link: '/accessories/general/slot_types',}, + {text: 'Default Slots', link: '/accessories/general/defaulted_slots',}, + {text: 'Adjusting Accessory Equipablity', link: '/accessories/general/binding_accessories_to_slots',}, + {text: 'Binding Slots to Entities', link: '/accessories/general/binding_slots_to_entities',}, + {text: 'Creating Slot Groups', link: '/accessories/general/slot_groups',}, + {text: 'Adjusting Slot Amount', link: '/accessories/general/adjusting_slot_amount',}, ] }, { text: 'Developer', items: [ - { text: 'Setup Environment', link: '/accessories/developer/dev_setup', }, - { text: 'API Fundamentals', link: '/accessories/developer/api_fundamentals', }, - { text: 'Rendering API Breakdown', link: '/accessories/developer/rendering_api', }, - { text: 'Available API Events', link: '/accessories/developer/api_events', }, - { text: 'ItemStack Data Components', link: '/accessories/developer/itemstack_components', }, + {text: 'Setup Environment', link: '/accessories/developer/dev_setup',}, + {text: 'API Fundamentals', link: '/accessories/developer/api_fundamentals',}, + {text: 'Rendering API Breakdown', link: '/accessories/developer/rendering_api',}, + {text: 'Available API Events', link: '/accessories/developer/api_events',}, + {text: 'ItemStack Data Components', link: '/accessories/developer/itemstack_components',}, ] }, ], '/alloy-forgery/': [ - { text: 'Home', link: '/alloy-forgery/home' }, - { text: 'Adding Recipes and Fuels', link: '/alloy-forgery/adding-recipes-and-fuels' }, - { text: 'How to build a Forge', link: '/alloy-forgery/building-a-forge' }, - { text: 'Recipe Adaptation', link: '/alloy-forgery/recipe-adaptation' }, - { text: 'Defining new Forges though Data', link: '/alloy-forgery/defining-a-forge' }, + {text: 'Home', link: '/alloy-forgery/home'}, + {text: 'Adding Recipes and Fuels', link: '/alloy-forgery/adding-recipes-and-fuels'}, + {text: 'How to build a Forge', link: '/alloy-forgery/building-a-forge'}, + {text: 'Recipe Adaptation', link: '/alloy-forgery/recipe-adaptation'}, + {text: 'Defining new Forges though Data', link: '/alloy-forgery/defining-a-forge'}, ], }, @@ -178,8 +193,8 @@ export default defineConfig({ }, socialLinks: [ - { icon: 'discord', link: 'https://discord.gg/xrwHKktV2d' }, - { icon: 'github', link: 'https://github.com/wisp-forest/docs' }, + {icon: 'discord', link: 'https://discord.gg/xrwHKktV2d'}, + {icon: 'github', link: 'https://github.com/wisp-forest/docs'}, ] } }) diff --git a/alloy-forgery/adding-recipes-and-fuels.md b/alloy-forgery/adding-recipes-and-fuels.md index 07bbe34..663f736 100644 --- a/alloy-forgery/adding-recipes-and-fuels.md +++ b/alloy-forgery/adding-recipes-and-fuels.md @@ -109,7 +109,7 @@ Overrides allow changing the output item depending on the tier of the Forge. Acc ## Recipe Remainders -Due to Vanilla's very generic recipe remainders, you can use owo's [Recipe Specific Remainders](../owo/recipe-remainders.md) instead, allowing for fully customizable recipe remainders, or use the built-in global remainder system loaded through the `data//forge_remainder` folder. +Due to Vanilla's very generic recipe remainders, you can use owo's [Recipe Specific Remainders](../owo/data-extensions/recipe-remainders.md) instead, allowing for fully customizable recipe remainders, or use the built-in global remainder system loaded through the `data//forge_remainder` folder. A example for global Alloy Forgery remainders is below: ```JSON @@ -168,4 +168,4 @@ Alloy Forgery loads fuel from a specific folder in data. The path is `data/ [!IMPORTANT] +> Nested Lang is flattened prior to language loading, this ensures full compatibility with any other language modifications and no performance impact. +> In fact, nesting may even provide *slight* performance improvements by decreasing the size of the language file on disk. + +## Setup + +Before you can use nested lang, you need to enable it in 1 of 2 ways: +1. Enable oωo's [Json5 Data Loading](json5.md) and use a `.json5` file. +2. Add a key `owo:nested_lang` or `owo:extended_lang` with the value `true` or `1` anywhere in your lang file (at the top level). + +## Object Nesting + +When writing language files, you tend to have a lot of repeated text. For example, a mod containing a lot of items might contain this in its language file: + +::: code-group +```json [en_us.json] +{ + "item.modid.firstItem": "First Item", + "item.modid.secondItem": "Second Item", + "item.modid.thirdItem": "Third Item", + "item.modid.fourthItem": "Fourth Item", + "item.modid.fifthItem": "Fifth Item", + "item.modid.sixthItem": "Sixth Item", + "item.modid.seventhItem": "Seventh Item", + "item.modid.eighthItem": "Eighth Item", + "item.modid.ninthItem": "Ninth Item", + "item.modid.tenthItem": "Tenth Item" +} +``` +::: + +That alone has 10 instances of `item.modid.`. oωo provides a way to reduce this repetition by allowing you to nest translations. Instead of writing out the entire path of each and every key, you simply nest the unique parts of each key inside an object with the common affix as the key and a `{}` where the unique part goes. For example, the above can be written as: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.{}": { // [!code highlight] + "firstItem": "First Item", + "secondItem": "Second Item", + "thirdItem": "Third Item", + "fourthItem": "Fourth Item", + "fifthItem": "Fifth Item", + "sixthItem": "Sixth Item", + "seventhItem": "Seventh Item", + "eighthItem": "Eighth Item", + "ninthItem": "Ninth Item", + "tenthItem": "Tenth Item" + } +} +``` +::: + +If you want to be even crazier you can provide a prefix **and** a suffix, like so: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.{}Item": { // [!code highlight] + "first": "First Item", + "second": "Second Item", + "third": "Third Item", + "fourth": "Fourth Item", + "fifth": "Fifth Item", + "sixth": "Sixth Item", + "seventh": "Seventh Item", + "eighth": "Eighth Item", + "ninth": "Ninth Item", + "tenth": "Tenth Item" + } +} +``` +::: + +You can also provide *only* a suffix, although our example isn't exactly a great use case for it: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "{}Item": { // [!code highlight] + "item.modid.first": "First Item", + "item.modid.second": "Second Item", + "item.modid.third": "Third Item", + "item.modid.fourth": "Fourth Item", + "item.modid.fifth": "Fifth Item", + "item.modid.sixth": "Sixth Item", + "item.modid.seventh": "Seventh Item", + "item.modid.eighth": "Eighth Item", + "item.modid.ninth": "Ninth Item", + "item.modid.tenth": "Tenth Item" + } +} +``` +::: + +## Array Nesting + +Certain situations may call for indexed lists of keys, for example: + +::: code-group +```json [en_us.json] +{ + "item.modid.overlyToolTippedItem": "Overly Tool Tipped Item", + "item.modid.overlyToolTippedItem.tooltip.1": "This is the first line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.2": "This is the second line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.3": "This is the third line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.4": "This is the fourth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.5": "This is the fifth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.6": "This is the sixth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.7": "This is the seventh line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.8": "This is the eighth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.9": "This is the ninth line of the tooltip", + "item.modid.overlyToolTippedItem.tooltip.10": "This is the tenth line of the tooltip" +} +``` +::: + +This is far too much text to have to write out 10 times, so instead you can use the array syntax: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem.{}": { + "": "Overly Tool Tipped Item", + "tooltip.{}": [ // [!code highlight] + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip", + "This is the fourth line of the tooltip", + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] + } +} +``` +::: + +> [!INFO] Note +> An empty string key `""` will strip any trailing non-alphanumeric characters from the prefix, in this case the trailing period. + +By default, the indexing will start at 1, but you may specify a different starting index by adding a number between the curly braces, like so: + +::: code-group +```json [em.json] +{ + "owo:nested_lang": true, + "item.modid.overlyToolTippedItem.tooltip.{5}": [ // [!code highlight] + "This is the fifth line of the tooltip", + "This is the sixth line of the tooltip", + "This is the seventh line of the tooltip", + "This is the eighth line of the tooltip", + "This is the ninth line of the tooltip", + "This is the tenth line of the tooltip" + ] +} +``` +::: + +## Nested Nesting + +Nested Keys can also be nested, for example: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.modid.{}": { // [!code highlight] + "firstItem": "First Item", + "secondItem": { + "": "Second Item", + "tooltip.{}": [ // [!code highlight] + "This is the first line of the tooltip", + "This is the second line of the tooltip", + "This is the third line of the tooltip" + ] + } + } +} +``` +::: + +This will produce the following keys: + +::: code-group +```json [en_us.json] +{ + "item.modid.firstItem": "First Item", + "item.modid.secondItem": "Second Item", + "item.modid.secondItem.tooltip.1": "This is the first line of the tooltip", + "item.modid.secondItem.tooltip.2": "This is the second line of the tooltip", + "item.modid.secondItem.tooltip.3": "This is the third line of the tooltip" +} +``` +::: + +## Rich Translations + +Nested keys work perfectly with [Rich Translations](rich-translations.md), for example this: + +::: code-group +```json [en_us.json] +{ + "item.minecraft.echo_shard": [ + "Echo ", + { "text": "Shard", "color": "#0096FF" } + ], + "item.minecraft.recovery_compass": [ + "", + { "text": "Recovery Compass", "color": "yellow" }, + " made of ", + { "translate": "item.minecraft.echo_shard" } + ] +} +``` +::: + +can be simplified to: + +::: code-group +```json [en_us.json] +{ + "owo:nested_lang": true, + "item.minecraft.{}": { + "echo_shard": [ + "Echo ", + { "text": "Shard", "color": "#0096FF" } + ], + "recovery_compass": [ + "", + { "text": "Recovery Compass", "color": "yellow" }, + " made of ", + { "translate": "item.minecraft.echo_shard" } + ] + } +} +``` +::: + +This page was brought to you by chyzman diff --git a/owo/recipe-remainders.md b/owo/data-extensions/recipe-remainders.md similarity index 93% rename from owo/recipe-remainders.md rename to owo/data-extensions/recipe-remainders.md index 0a1334c..9a18eb0 100644 --- a/owo/recipe-remainders.md +++ b/owo/data-extensions/recipe-remainders.md @@ -57,4 +57,4 @@ Currently custom NBT data is not supported! The given recipe will now return our declared Remainders when crafted: -![Remainder Example](../assets/owo/remainders-example.gif){ .docs-image .center-image } \ No newline at end of file +![Remainder Example](../../assets/owo/remainders-example.gif){ .docs-image .center-image } diff --git a/owo/rich-translations.md b/owo/data-extensions/rich-translations.md similarity index 90% rename from owo/rich-translations.md rename to owo/data-extensions/rich-translations.md index 0cb4cdf..5de5975 100644 --- a/owo/rich-translations.md +++ b/owo/data-extensions/rich-translations.md @@ -14,7 +14,7 @@ When owo is installed, a number of modifications are made to the translation eng You can now populate this array with JSON conforming to Minecraft's text component format, which you can look up [on the wiki](https://minecraft.wiki/w/Raw_JSON_text_format). -### Basic Example +## Basic Example For demonstrating the basics, let's change the name of the Echo Shard. We want the word "Shard" to be of this blue color, which is achieved by the following simple JSON: ::: code-group @@ -35,7 +35,7 @@ For demonstrating the basics, let's change the name of the Echo Shard. We want t This yields the following result: -![echo shard tooltip example](../assets/owo/echo-shard-tooltip.png){ width=300 } +![echo shard tooltip example](../../assets/owo/echo-shard-tooltip.png){ width=300 } Let's continue by also altering the Recovery Compass to say that it's made of Echo Shards. To do this, we do a normal translation and refer to the echo shard's translation via the `translate` object. @@ -64,9 +64,9 @@ Let's continue by also altering the Recovery Compass to say that it's made of Ec This produces this nice tooltip, with the Echo Shard's name conveniently embedded -![recovery compass tooltip example](../assets/owo/recovery-compass-tooltip.png) +![recovery compass tooltip example](../../assets/owo/recovery-compass-tooltip.png) -### Translatable Text Parameters +## Translatable Text Parameters As you probably know, a translatable text can have parameters - defined in standard translations via format specifiers like `%s`. This is not available to us when writing a rich translation, thus we must use owo's equivalent - the replacing text content, specified by an `index` object in the JSON. To demonstrate this, let's spice up the warning that get when deleting a world - it contains a parameter for the name of the world to delete. ::: code-group @@ -87,4 +87,4 @@ As you probably know, a translatable text can have parameters - defined in stand 1. Here we employ the `index` object. The number you specify is the index of the parameter passed into the translatable text constructor. It accepts style options like any other text component, as demonstrated by the gold color. The final result looks like this: -![delete world warning screen](../assets/owo/deleting-froge-noooooo.png){ .docs-image } +![delete world warning screen](../../assets/owo/deleting-froge-noooooo.png){ .docs-image } diff --git a/owo/nested-lang.md b/owo/nested-lang.md deleted file mode 100644 index 81d0da6..0000000 --- a/owo/nested-lang.md +++ /dev/null @@ -1,462 +0,0 @@ -# Nested Translations - -::: warning -In order to enable nested translations you must include `"owo:nested_lang": true` in your language file. -::: - -## Object Nesting - -When writing language files, you tend to have a lot of repeated text. For example, a mod containing a lot of items might contain this in its language file: - -::: code-group -```json [en_us.json] -{ - "item.modid.firstItem": "First Item", - "item.modid.secondItem": "Second Item", - "item.modid.thirdItem": "Third Item", - "item.modid.fourthItem": "Fourth Item", - "item.modid.fifthItem": "Fifth Item", - "item.modid.sixthItem": "Sixth Item", - "item.modid.seventhItem": "Seventh Item", - "item.modid.eighthItem": "Eighth Item", - "item.modid.ninthItem": "Ninth Item", - "item.modid.tenthItem": "Tenth Item" -} -``` -::: - -That alone has 10 instances of `item.modid.`. Owo provides a way to reduce this repetition by allowing you to nest translations. Instead of writing out the entire path of each and every key, you can simply write the first shared part of the key in an object followed by `..` (or `{}`) then put the rest of the keys inside like so: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid...": { - "firstItem": "First Item", - "secondItem": "Second Item", - "thirdItem": "Third Item", - "fourthItem": "Fourth Item", - "fifthItem": "Fifth Item", - "sixthItem": "Sixth Item", - "seventhItem": "Seventh Item", - "eighthItem": "Eighth Item", - "ninthItem": "Ninth Item", - "tenthItem": "Tenth Item" - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.{}": { - "firstItem": "First Item", - "secondItem": "Second Item", - "thirdItem": "Third Item", - "fourthItem": "Fourth Item", - "fifthItem": "Fifth Item", - "sixthItem": "Sixth Item", - "seventhItem": "Seventh Item", - "eighthItem": "Eighth Item", - "ninthItem": "Ninth Item", - "tenthItem": "Tenth Item" - } -} -``` -::: - -*do note that only 2 periods are required, the third one is part of the keys themselves.* - -If you want to be even crazier you can provide a prefix **and** a suffix, like so: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid... ..Item": { - "first": "First Item", - "second": "Second Item", - "third": "Third Item", - "fourth": "Fourth Item", - "fifth": "Fifth Item", - "sixth": "Sixth Item", - "seventh": "Seventh Item", - "eighth": "Eighth Item", - "ninth": "Ninth Item", - "tenth": "Tenth Item" - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.{}Item": { - "first": "First Item", - "second": "Second Item", - "third": "Third Item", - "fourth": "Fourth Item", - "fifth": "Fifth Item", - "sixth": "Sixth Item", - "seventh": "Seventh Item", - "eighth": "Eighth Item", - "ninth": "Ninth Item", - "tenth": "Tenth Item" - } -} -``` -::: - -*when using a prefix **and** a suffix you put 2 periods on both sides of where you want the inner text to be located and include a space.* - -You can also provide only a suffix, like so: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "..Item": { - "item.modid.first": "First Item", - "item.modid.second": "Second Item", - "item.modid.third": "Third Item", - "item.modid.fourth": "Fourth Item", - "item.modid.fifth": "Fifth Item", - "item.modid.sixth": "Sixth Item", - "item.modid.seventh": "Seventh Item", - "item.modid.eighth": "Eighth Item", - "item.modid.ninth": "Ninth Item", - "item.modid.tenth": "Tenth Item" - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "{}Item": { - "item.modid.first": "First Item", - "item.modid.second": "Second Item", - "item.modid.third": "Third Item", - "item.modid.fourth": "Fourth Item", - "item.modid.fifth": "Fifth Item", - "item.modid.sixth": "Sixth Item", - "item.modid.seventh": "Seventh Item", - "item.modid.eighth": "Eighth Item", - "item.modid.ninth": "Ninth Item", - "item.modid.tenth": "Tenth Item" - } -} -``` -::: - -*this example is a pretty terrible use of the feature but there are many cases where it can be useful.* - -## Array Nesting - -Certain situations may call for indexed lists of keys, for example: - -::: code-group -```json [en_us.json] -{ - "item.modid.overlyToolTippedItem": "Overly Tool Tipped Item", - "item.modid.overlyToolTippedItem.tooltip.1": "This is the first line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.2": "This is the second line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.3": "This is the third line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.4": "This is the fourth line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.5": "This is the fifth line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.6": "This is the sixth line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.7": "This is the seventh line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.8": "This is the eighth line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.9": "This is the ninth line of the tooltip", - "item.modid.overlyToolTippedItem.tooltip.10": "This is the tenth line of the tooltip" -} -``` -::: - -This is far too much text to have to write out 10 times, so instead you can use the array syntax: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.overlyToolTippedItem...": { - "": "Overly Tool Tipped Item", - "tooltip...": [ - "This is the first line of the tooltip", - "This is the second line of the tooltip", - "This is the third line of the tooltip", - "This is the fourth line of the tooltip", - "This is the fifth line of the tooltip", - "This is the sixth line of the tooltip", - "This is the seventh line of the tooltip", - "This is the eighth line of the tooltip", - "This is the ninth line of the tooltip", - "This is the tenth line of the tooltip" - ] - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.overlyToolTippedItem.{}": { - "": "Overly Tool Tipped Item", - "tooltip.{}": [ - "This is the first line of the tooltip", - "This is the second line of the tooltip", - "This is the third line of the tooltip", - "This is the fourth line of the tooltip", - "This is the fifth line of the tooltip", - "This is the sixth line of the tooltip", - "This is the seventh line of the tooltip", - "This is the eighth line of the tooltip", - "This is the ninth line of the tooltip", - "This is the tenth line of the tooltip" - ] - } -} -``` -::: - -::: info Note -An empty string key `""` will strip any trailing non-alphanumeric characters from the prefix, in this case the trailing period. -::: - -By default, the indexing will start at 1, but you may specify a different starting index by adding a number after the key, like so: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.overlyToolTippedItem.tooltip...5": [ - "This is the fifth line of the tooltip", - "This is the sixth line of the tooltip", - "This is the seventh line of the tooltip", - "This is the eighth line of the tooltip", - "This is the ninth line of the tooltip", - "This is the tenth line of the tooltip" - ] -} -``` -== Brackets -```json [em.json] -{ - "owo:nested_lang": true, - "item.modid.overlyToolTippedItem.tooltip.{5}": [ - "This is the fifth line of the tooltip", - "This is the sixth line of the tooltip", - "This is the seventh line of the tooltip", - "This is the eighth line of the tooltip", - "This is the ninth line of the tooltip", - "This is the tenth line of the tooltip" - ] -} -``` -::: - -When using a prefix and suffix you specify the start index in the middle of the 2 sets of periods instead of the space, for example, this: - -::: code-group -```json [en_us.json] -{ - "item.modid.overlyToolTippedItem.5.tooltip": "This is the fifth line of the tooltip", - "item.modid.overlyToolTippedItem.6.tooltip": "This is the sixth line of the tooltip", - "item.modid.overlyToolTippedItem.7.tooltip": "This is the seventh line of the tooltip", - "item.modid.overlyToolTippedItem.8.tooltip": "This is the eighth line of the tooltip", - "item.modid.overlyToolTippedItem.9.tooltip": "This is the ninth line of the tooltip", - "item.modid.overlyToolTippedItem.10.tooltip": "This is the tenth line of the tooltip" -} -``` -::: - -can be written as: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.overlyToolTippedItem...5...tooltip": [ - "This is the fifth line of the tooltip", - "This is the sixth line of the tooltip", - "This is the seventh line of the tooltip", - "This is the eighth line of the tooltip", - "This is the ninth line of the tooltip", - "This is the tenth line of the tooltip" - ] -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.overlyToolTippedItem.{5}.tooltip": [ - "This is the fifth line of the tooltip", - "This is the sixth line of the tooltip", - "This is the seventh line of the tooltip", - "This is the eighth line of the tooltip", - "This is the ninth line of the tooltip", - "This is the tenth line of the tooltip" - ] -} -``` -::: - -*When using both a prefix and suffix you must either put a space or a starting index* - -## Nested Nesting - -Nested Keys can also be nested, for example: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid...": { - "firstItem": "First Item", - "secondItem...": { - "": "Second Item", - "tooltip...": [ - "This is the first line of the tooltip", - "This is the second line of the tooltip", - "This is the third line of the tooltip" - ] - } - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.{}": { - "firstItem": "First Item", - "secondItem": { - "": "Second Item", - "tooltip.{}": [ - "This is the first line of the tooltip", - "This is the second line of the tooltip", - "This is the third line of the tooltip" - ] - } - } -} -``` -::: - -This will produce the following keys: - -::: code-group -```json [en_us.json] -{ - "item.modid.firstItem": "First Item", - "item.modid.secondItem": "Second Item", - "item.modid.secondItem.tooltip.1": "This is the first line of the tooltip", - "item.modid.secondItem.tooltip.2": "This is the second line of the tooltip", - "item.modid.secondItem.tooltip.3": "This is the third line of the tooltip" -} -``` -::: - -## Rich Translations - -Nested keys work perfectly with [Rich Translations](rich-translations.md), for example this: - -::: code-group -```json [en_us.json] -{ - "item.minecraft.echo_shard": [ - "Echo ", - { "text": "Shard", "color": "#0096FF" } - ], - "item.minecraft.recovery_compass": [ - "", - { "text": "Recovery Compass", "color": "yellow" }, - " made of ", - { "translate": "item.minecraft.echo_shard" } - ] -} -``` -::: - -can be simplified to: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.minecraft...": { - "echo_shard": [ - "Echo ", - { "text": "Shard", "color": "#0096FF" } - ], - "recovery_compass": [ - "", - { "text": "Recovery Compass", "color": "yellow" }, - " made of ", - { "translate": "item.minecraft.echo_shard" } - ] - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.minecraft.{}": { - "echo_shard": [ - "Echo ", - { "text": "Shard", "color": "#0096FF" } - ], - "recovery_compass": [ - "", - { "text": "Recovery Compass", "color": "yellow" }, - " made of ", - { "translate": "item.minecraft.echo_shard" } - ] - } -} -``` -::: - -## Escaping Affixes - -If you want you may also escape characters from the outer affixes by using slashes (`/`). For example: - -::: tabs -== Dots -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid.....": { - "//firstItem": "Oops I added too many periods, conveniently i can escape them so this key becomes item.modid.firstItem", - "secondItem": "This key is doomed to be item.modid...secondItem" - } -} -``` -== Brackets -```json [en_us.json] -{ - "owo:nested_lang": true, - "item.modid...{}": { - "//firstItem": "Oops I added too many periods, conveniently i can escape them so this key becomes item.modid.firstItem", - "secondItem": "This key is doomed to be item.modid...secondItem" - } -} -``` -::: - -## Notes - -1. Nested Keys are flattened during language loading so they will not affect performance. -2. If you weren't paying attention before, `"owo:nested_lang": true` is required anywhere in your language file in order to enable nested Translations. - -This page was brought to you by chyzman From 0e1d862ea71be47527472539cd037dbb679f0617 Mon Sep 17 00:00:00 2001 From: chyzman Date: Sat, 27 Sep 2025 13:18:45 -0400 Subject: [PATCH 6/7] shhhh --- .vitepress/config.mts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 60feb92..1ec3738 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -55,10 +55,6 @@ export default defineConfig({ return headData; }, - transformHtml(ctx) { - console.log(ctx); - }, - themeConfig: { logo: '/icon-header.png', From 6247650c61abb4259eebf750b2a3483ec407356b Mon Sep 17 00:00:00 2001 From: chyzman Date: Sat, 27 Sep 2025 17:59:28 -0400 Subject: [PATCH 7/7] i love code input --- components/LangNester.vue | 152 ++++++++++++++++++ owo/data-extensions/lang-nester.md | 9 ++ owo/data-extensions/nested-lang.md | 26 +-- package-lock.json | 250 ++++++++++++++++++++++++++++- package.json | 8 + 5 files changed, 419 insertions(+), 26 deletions(-) create mode 100644 components/LangNester.vue create mode 100644 owo/data-extensions/lang-nester.md diff --git a/components/LangNester.vue b/components/LangNester.vue new file mode 100644 index 0000000..88d7d4d --- /dev/null +++ b/components/LangNester.vue @@ -0,0 +1,152 @@ + + + + + diff --git a/owo/data-extensions/lang-nester.md b/owo/data-extensions/lang-nester.md new file mode 100644 index 0000000..803ea6f --- /dev/null +++ b/owo/data-extensions/lang-nester.md @@ -0,0 +1,9 @@ +# Lang Nester + +A tool for converting between nested and denested language files. + + + + diff --git a/owo/data-extensions/nested-lang.md b/owo/data-extensions/nested-lang.md index 126d7cd..e340e4f 100644 --- a/owo/data-extensions/nested-lang.md +++ b/owo/data-extensions/nested-lang.md @@ -211,16 +211,8 @@ Nested keys work perfectly with [Rich Translations](rich-translations.md), for e ::: code-group ```json [en_us.json] { - "item.minecraft.echo_shard": [ - "Echo ", - { "text": "Shard", "color": "#0096FF" } - ], - "item.minecraft.recovery_compass": [ - "", - { "text": "Recovery Compass", "color": "yellow" }, - " made of ", - { "translate": "item.minecraft.echo_shard" } - ] + "item.minecraft.echo_shard": ["Echo ", {"text": "Shard", "color": "#0096FF"}], + "item.minecraft.recovery_compass": ["", {"text": "Recovery Compass", "color": "yellow"}, " made of ", {"translate": "item.minecraft.echo_shard"}] } ``` ::: @@ -231,17 +223,9 @@ can be simplified to: ```json [en_us.json] { "owo:nested_lang": true, - "item.minecraft.{}": { - "echo_shard": [ - "Echo ", - { "text": "Shard", "color": "#0096FF" } - ], - "recovery_compass": [ - "", - { "text": "Recovery Compass", "color": "yellow" }, - " made of ", - { "translate": "item.minecraft.echo_shard" } - ] + "item.minecraft.{}": { // [!code highlight] + "echo_shard": ["Echo ", { "text": "Shard", "color": "#0096FF" }], + "recovery_compass": ["", { "text": "Recovery Compass", "color": "yellow" }, " made of ", { "translate": "item.minecraft.echo_shard" }] } } ``` diff --git a/package-lock.json b/package-lock.json index ab794d1..dbbc4a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,14 @@ "requires": true, "packages": { "": { + "dependencies": { + "@babel/runtime": "^7.28.4", + "@codemirror/lang-json": "^6.0.2", + "@codemirror/theme-one-dark": "^6.1.3", + "@uiw/codemirror-theme-vscode": "^4.25.2", + "codemirror": "^6.0.2", + "vue-codemirror": "^6.1.1" + }, "devDependencies": { "@types/node": "^24.3.1", "iconify-icon": "^3.0.0", @@ -50,6 +58,15 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/runtime": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", + "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/types": { "version": "7.28.4", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.4.tgz", @@ -64,6 +81,109 @@ "node": ">=6.9.0" } }, + "node_modules/@codemirror/autocomplete": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.19.0.tgz", + "integrity": "sha512-61Hfv3cF07XvUxNeC3E7jhG8XNi1Yom1G0lRC936oLnlF+jrbrv8rc/J98XlYzcsAoTVupfsf5fLej1aI8kyIg==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@codemirror/commands": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.8.1.tgz", + "integrity": "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.4.0", + "@codemirror/view": "^6.27.0", + "@lezer/common": "^1.1.0" + } + }, + "node_modules/@codemirror/lang-json": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@codemirror/lang-json/-/lang-json-6.0.2.tgz", + "integrity": "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@lezer/json": "^1.0.0" + } + }, + "node_modules/@codemirror/language": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.11.3.tgz", + "integrity": "sha512-9HBM2XnwDj7fnu0551HkGdrUrrqmYq/WC5iv6nbY2WdicXdGbhR/gfbZOH73Aqj4351alY1+aoG9rCNfiwS1RA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.1.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/lint": { + "version": "6.8.5", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.5.tgz", + "integrity": "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.35.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/search": { + "version": "6.5.11", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.11.tgz", + "integrity": "sha512-KmWepDE6jUdL6n8cAAqIpRmLPBZ5ZKnicE8oGU/s3QrAVID+0VhLFrzUucVKHG5035/BSykhExDL/Xm7dHthiA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/state": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.2.tgz", + "integrity": "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==", + "license": "MIT", + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/theme-one-dark": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.3.tgz", + "integrity": "sha512-NzBdIvEJmx6fjeremiGp3t/okrLPYT0d9orIc7AFun8oZcRk58aejkqhv6spnz4MLAevrKNPMQYXEWMg4s+sKA==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/highlight": "^1.0.0" + } + }, + "node_modules/@codemirror/view": { + "version": "6.38.3", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.3.tgz", + "integrity": "sha512-x2t87+oqwB1mduiQZ6huIghjMt4uZKFEdj66IcXw7+a5iBEvv9lh7EWDRHI7crnD4BMGpnyq/RzmCGbiEZLcvQ==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.5.0", + "crelt": "^1.0.6", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, "node_modules/@docsearch/css": { "version": "4.0.0-beta.8", "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-4.0.0-beta.8.tgz", @@ -544,6 +664,47 @@ "dev": true, "license": "MIT" }, + "node_modules/@lezer/common": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", + "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==", + "license": "MIT" + }, + "node_modules/@lezer/highlight": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.1.tgz", + "integrity": "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@lezer/json": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@lezer/json/-/json-1.0.3.tgz", + "integrity": "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/lr": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.2.tgz", + "integrity": "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "license": "MIT" + }, "node_modules/@rolldown/pluginutils": { "version": "1.0.0-beta.29", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.29.tgz", @@ -1006,6 +1167,37 @@ "dev": true, "license": "MIT" }, + "node_modules/@uiw/codemirror-theme-vscode": { + "version": "4.25.2", + "resolved": "https://registry.npmjs.org/@uiw/codemirror-theme-vscode/-/codemirror-theme-vscode-4.25.2.tgz", + "integrity": "sha512-0vZAAtC65v64sYKtUMvgg9xPw1QlcnFTzGv8vZ5fD4SmSXFZWXTapjezwhGmvR7/UdAPFyh/4korgBnQo9ix3A==", + "license": "MIT", + "dependencies": { + "@uiw/codemirror-themes": "4.25.2" + }, + "funding": { + "url": "https://jaywcjlove.github.io/#/sponsor" + } + }, + "node_modules/@uiw/codemirror-themes": { + "version": "4.25.2", + "resolved": "https://registry.npmjs.org/@uiw/codemirror-themes/-/codemirror-themes-4.25.2.tgz", + "integrity": "sha512-WFYxW3OlCkMomXQBlQdGj1JZ011UNCa7xYdmgYqywVc4E8f5VgIzRwCZSBNVjpWGGDBOjc+Z6F65l7gttP16pg==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + }, + "funding": { + "url": "https://jaywcjlove.github.io/#/sponsor" + }, + "peerDependencies": { + "@codemirror/language": ">=6.0.0", + "@codemirror/state": ">=6.0.0", + "@codemirror/view": ">=6.0.0" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", @@ -1392,6 +1584,21 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/codemirror": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz", + "integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, "node_modules/comma-separated-tokens": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", @@ -1429,6 +1636,12 @@ "url": "https://github.com/sponsors/mesqueeb" } }, + "node_modules/crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", + "license": "MIT" + }, "node_modules/css-select": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", @@ -2363,6 +2576,12 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/style-mod": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", + "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==", + "license": "MIT" + }, "node_modules/superjson": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz", @@ -2546,18 +2765,17 @@ } }, "node_modules/vite": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.4.tgz", - "integrity": "sha512-X5QFK4SGynAeeIt+A7ZWnApdUyHYm+pzv/8/A57LqSGcI88U6R6ipOs3uCesdc6yl7nl+zNO0t8LmqAdXcQihw==", + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.7.tgz", + "integrity": "sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA==", "dev": true, - "license": "MIT", "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", - "tinyglobby": "^0.2.14" + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" @@ -2699,6 +2917,28 @@ } } }, + "node_modules/vue-codemirror": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/vue-codemirror/-/vue-codemirror-6.1.1.tgz", + "integrity": "sha512-rTAYo44owd282yVxKtJtnOi7ERAcXTeviwoPXjIc6K/IQYUsoDkzPvw/JDFtSP6T7Cz/2g3EHaEyeyaQCKoDMg==", + "license": "MIT", + "dependencies": { + "@codemirror/commands": "6.x", + "@codemirror/language": "6.x", + "@codemirror/state": "6.x", + "@codemirror/view": "6.x" + }, + "peerDependencies": { + "codemirror": "6.x", + "vue": "3.x" + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "license": "MIT" + }, "node_modules/web-resource-inliner": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/web-resource-inliner/-/web-resource-inliner-6.0.1.tgz", diff --git a/package.json b/package.json index 909ee6f..0d538c2 100644 --- a/package.json +++ b/package.json @@ -12,5 +12,13 @@ "dev": "vitepress dev", "build": "vitepress build", "preview": "vitepress preview" + }, + "dependencies": { + "@babel/runtime": "^7.28.4", + "@codemirror/lang-json": "^6.0.2", + "@codemirror/theme-one-dark": "^6.1.3", + "@uiw/codemirror-theme-vscode": "^4.25.2", + "codemirror": "^6.0.2", + "vue-codemirror": "^6.1.1" } }