diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 52863ed..1ec3738 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,22 +34,22 @@ 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; @@ -59,7 +59,7 @@ export default defineConfig({ 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,105 +70,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: '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'}, ], }, @@ -177,8 +189,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/ +
+
+ + + + +
+ +
+ + + + + diff --git a/owo/data-extensions/index.md b/owo/data-extensions/index.md new file mode 100644 index 0000000..e69de29 diff --git a/owo/data-extensions/json5.md b/owo/data-extensions/json5.md new file mode 100644 index 0000000..22c3419 --- /dev/null +++ b/owo/data-extensions/json5.md @@ -0,0 +1,13 @@ +# Json5 Data Loading + +oωo lets you use [JSON5](https://json5.org/) files anywhere a json file is expected. This means you can use comments, trailing commas, single quotes, and [more](https://spec.json5.org/). + +## Enabling JSON5 + +Before you can use Json5 files, you need to enable the feature by putting a file named `owo-json5` in the root of any resource/data pack you want to use Json5 in. The contents of the file do not matter, it just needs to exist. + +::: info NOTE +Json5 lang files enable all language extensions by default. + +See [Rich Translations](rich-translations.md) and [Nested Lang](nested-lang.md) for details. +::: 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 new file mode 100644 index 0000000..e340e4f --- /dev/null +++ b/owo/data-extensions/nested-lang.md @@ -0,0 +1,234 @@ +# Nested Lang + +Nested Lang is a simple DRY (Don't Repeat Yourself) system for language files. It allows you to nest keys inside of objects and arrays to reduce repetition and make your language files cleaner, easier to read and smaller on disk. + +> [!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.{}": { // [!code highlight] + "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/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" } }