From 684bb6a5c4b542e5fca7d272875c9798b0721992 Mon Sep 17 00:00:00 2001
From: boop-the-dog
Date: Tue, 5 Aug 2025 13:29:48 -0400
Subject: [PATCH 1/9] guh
---
bun.lock | 23 +++
package.json | 1 +
src/lib/components/MiniEditor.svelte | 165 ------------------
src/lib/components/MiniRenderer.svelte | 53 ------
src/lib/components/Modal.svelte | 65 +++----
src/lib/components/TextStyleButtons.svelte | 107 ------------
src/lib/components/ToolbarButton.svelte | 24 ---
.../modals/CustomSourceModal.svelte | 57 +++++-
src/lib/text/nbt.ts | 8 +
src/lib/text/nbt_or_json.ts | 4 +
src/lib/tiptap/extensions/index.ts | 9 +
src/lib/types.ts | 6 +
src/routes/+page.svelte | 14 +-
13 files changed, 148 insertions(+), 388 deletions(-)
delete mode 100644 src/lib/components/MiniEditor.svelte
delete mode 100644 src/lib/components/MiniRenderer.svelte
delete mode 100644 src/lib/components/TextStyleButtons.svelte
delete mode 100644 src/lib/components/ToolbarButton.svelte
diff --git a/bun.lock b/bun.lock
index 2f11867..2fc54bf 100644
--- a/bun.lock
+++ b/bun.lock
@@ -8,6 +8,7 @@
"@tiptap/extension-placeholder": "^3.0.9",
"@tiptap/pm": "^3.0.9",
"@tiptap/starter-kit": "^3.0.9",
+ "bits-ui": "^2.9.1",
"idb": "^8.0.3",
"svelte-awesome-color-picker": "^4.0.2",
"tippy.js": "^6.3.7",
@@ -119,12 +120,20 @@
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ=="],
+ "@floating-ui/core": ["@floating-ui/core@1.7.3", "", { "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w=="],
+
+ "@floating-ui/dom": ["@floating-ui/dom@1.7.3", "", { "dependencies": { "@floating-ui/core": "^1.7.3", "@floating-ui/utils": "^0.2.10" } }, "sha512-uZA413QEpNuhtb3/iIKoYMSK07keHPYeXF02Zhd6e213j+d1NamLix/mCLxBUDW/Gx52sPH2m+chlUsyaBs/Ag=="],
+
+ "@floating-ui/utils": ["@floating-ui/utils@0.2.10", "", {}, "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ=="],
+
"@iconify-json/tabler": ["@iconify-json/tabler@1.2.20", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-xnM7QO42USWGFM9ahH94uXhRxDOrN6nTNZ+glNHNjeyj6SB2YDeENr9AqrI1hWDacMK1FnjeFc4TI1oyF40Gcw=="],
"@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="],
"@iconify/utils": ["@iconify/utils@2.3.0", "", { "dependencies": { "@antfu/install-pkg": "^1.0.0", "@antfu/utils": "^8.1.0", "@iconify/types": "^2.0.0", "debug": "^4.4.0", "globals": "^15.14.0", "kolorist": "^1.8.0", "local-pkg": "^1.0.0", "mlly": "^1.7.4" } }, "sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA=="],
+ "@internationalized/date": ["@internationalized/date@3.8.2", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-/wENk7CbvLbkUvX1tu0mwq49CVkkWpkXubGel6birjRPyo6uQ4nQpnq5xZu823zRCwwn82zgHrvgF1vZyvmVgA=="],
+
"@isaacs/fs-minipass": ["@isaacs/fs-minipass@4.0.1", "", { "dependencies": { "minipass": "^7.0.4" } }, "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w=="],
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.8", "", { "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA=="],
@@ -197,6 +206,8 @@
"@sveltejs/vite-plugin-svelte-inspector": ["@sveltejs/vite-plugin-svelte-inspector@5.0.0", "", { "dependencies": { "debug": "^4.4.1" }, "peerDependencies": { "@sveltejs/vite-plugin-svelte": "^6.0.0-next.0", "svelte": "^5.0.0", "vite": "^6.3.0 || ^7.0.0" } }, "sha512-iwQ8Z4ET6ZFSt/gC+tVfcsSBHwsqc6RumSaiLUkAurW3BCpJam65cmHw0oOlDMTO0u+PZi9hilBRYN+LZNHTUQ=="],
+ "@swc/helpers": ["@swc/helpers@0.5.17", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A=="],
+
"@tailwindcss/node": ["@tailwindcss/node@4.1.11", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", "lightningcss": "1.30.1", "magic-string": "^0.30.17", "source-map-js": "^1.2.1", "tailwindcss": "4.1.11" } }, "sha512-yzhzuGRmv5QyU9qLNg4GTlYI6STedBWRE7NjxP45CsFYYq9taI0zJXZBMqIC/c8fViNLhmrbpSFS57EoxUmD6Q=="],
"@tailwindcss/oxide": ["@tailwindcss/oxide@4.1.11", "", { "dependencies": { "detect-libc": "^2.0.4", "tar": "^7.4.3" }, "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.1.11", "@tailwindcss/oxide-darwin-arm64": "4.1.11", "@tailwindcss/oxide-darwin-x64": "4.1.11", "@tailwindcss/oxide-freebsd-x64": "4.1.11", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.11", "@tailwindcss/oxide-linux-arm64-gnu": "4.1.11", "@tailwindcss/oxide-linux-arm64-musl": "4.1.11", "@tailwindcss/oxide-linux-x64-gnu": "4.1.11", "@tailwindcss/oxide-linux-x64-musl": "4.1.11", "@tailwindcss/oxide-wasm32-wasi": "4.1.11", "@tailwindcss/oxide-win32-arm64-msvc": "4.1.11", "@tailwindcss/oxide-win32-x64-msvc": "4.1.11" } }, "sha512-Q69XzrtAhuyfHo+5/HMgr1lAiPP/G40OMFAnws7xcFEYqcypZmdW8eGXaOUIeOl1dzPJBPENXgbjsOyhg2nkrg=="],
@@ -343,6 +354,8 @@
"axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="],
+ "bits-ui": ["bits-ui@2.9.1", "", { "dependencies": { "@floating-ui/core": "^1.7.1", "@floating-ui/dom": "^1.7.1", "esm-env": "^1.1.2", "runed": "^0.29.1", "svelte-toolbelt": "^0.9.3", "tabbable": "^6.2.0" }, "peerDependencies": { "@internationalized/date": "^3.8.1", "svelte": "^5.33.0" } }, "sha512-Fdtc1TKppfEio6fl0XzkrDG8DSvfbYJdrOh4j5KzaGh0kYA6BskMGIXL4JmsZxUS+O5ESFypNjrQ9z9qs3xAdQ=="],
+
"cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],
"chai": ["chai@5.2.0", "", { "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", "deep-eql": "^5.0.1", "loupe": "^3.1.0", "pathval": "^2.0.0" } }, "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw=="],
@@ -439,6 +452,8 @@
"indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="],
+ "inline-style-parser": ["inline-style-parser@0.2.4", "", {}, "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q=="],
+
"is-potential-custom-element-name": ["is-potential-custom-element-name@1.0.1", "", {}, "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="],
"is-reference": ["is-reference@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.6" } }, "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw=="],
@@ -601,6 +616,8 @@
"rrweb-cssom": ["rrweb-cssom@0.8.0", "", {}, "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw=="],
+ "runed": ["runed@0.29.2", "", { "dependencies": { "esm-env": "^1.0.0" }, "peerDependencies": { "svelte": "^5.7.0" } }, "sha512-0cq6cA6sYGZwl/FvVqjx9YN+1xEBu9sDDyuWdDW1yWX7JF2wmvmVKfH+hVCZs+csW+P3ARH92MjI3H9QTagOQA=="],
+
"sade": ["sade@1.8.1", "", { "dependencies": { "mri": "^1.1.0" } }, "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="],
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
@@ -625,6 +642,8 @@
"strtok3": ["strtok3@10.3.1", "", { "dependencies": { "@tokenizer/token": "^0.3.0" } }, "sha512-3JWEZM6mfix/GCJBBUrkA8p2Id2pBkyTkVCJKto55w080QBKZ+8R171fGrbiSp+yMO/u6F8/yUh7K4V9K+YCnw=="],
+ "style-to-object": ["style-to-object@1.0.9", "", { "dependencies": { "inline-style-parser": "0.2.4" } }, "sha512-G4qppLgKu/k6FwRpHiGiKPaPTFcG3g4wNVX/Qsfu+RqQM30E7Tyu/TEgxcL9PNLF5pdRLwQdE3YKKf+KF2Dzlw=="],
+
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
"svelte": ["svelte@5.37.2", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "@jridgewell/sourcemap-codec": "^1.5.0", "@sveltejs/acorn-typescript": "^1.0.5", "@types/estree": "^1.0.5", "acorn": "^8.12.1", "aria-query": "^5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "esm-env": "^1.2.1", "esrap": "^2.1.0", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-SAakJiy04/OvXRAUnGxRACGzw6GB9kmxYIjuMO/zTcTL6psqc54Y0O/yR6I3OLqFqn79EPd23qsCGkKozvYYbQ=="],
@@ -635,8 +654,12 @@
"svelte-check": ["svelte-check@4.3.0", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "chokidar": "^4.0.1", "fdir": "^6.2.0", "picocolors": "^1.0.0", "sade": "^1.7.4" }, "peerDependencies": { "svelte": "^4.0.0 || ^5.0.0-next.0", "typescript": ">=5.0.0" }, "bin": { "svelte-check": "bin/svelte-check" } }, "sha512-Iz8dFXzBNAM7XlEIsUjUGQhbEE+Pvv9odb9+0+ITTgFWZBGeJRRYqHUUglwe2EkLD5LIsQaAc4IUJyvtKuOO5w=="],
+ "svelte-toolbelt": ["svelte-toolbelt@0.9.3", "", { "dependencies": { "clsx": "^2.1.1", "runed": "^0.29.0", "style-to-object": "^1.0.8" }, "peerDependencies": { "svelte": "^5.30.2" } }, "sha512-HCSWxCtVmv+c6g1ACb8LTwHVbDqLKJvHpo6J8TaqwUme2hj9ATJCpjCPNISR1OCq2Q4U1KT41if9ON0isINQZw=="],
+
"symbol-tree": ["symbol-tree@3.2.4", "", {}, "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="],
+ "tabbable": ["tabbable@6.2.0", "", {}, "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew=="],
+
"tailwindcss": ["tailwindcss@4.1.11", "", {}, "sha512-2E9TBm6MDD/xKYe+dvJZAmg3yxIEDNRc0jwlNyDg/4Fil2QcSLjFKGVff0lAf1jjeaArlG/M75Ey/EYr/OJtBA=="],
"tapable": ["tapable@2.2.1", "", {}, "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="],
diff --git a/package.json b/package.json
index 5207f6f..6caebac 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,7 @@
"@tiptap/extension-placeholder": "^3.0.9",
"@tiptap/pm": "^3.0.9",
"@tiptap/starter-kit": "^3.0.9",
+ "bits-ui": "^2.9.1",
"idb": "^8.0.3",
"svelte-awesome-color-picker": "^4.0.2",
"tippy.js": "^6.3.7",
diff --git a/src/lib/components/MiniEditor.svelte b/src/lib/components/MiniEditor.svelte
deleted file mode 100644
index b723f65..0000000
--- a/src/lib/components/MiniEditor.svelte
+++ /dev/null
@@ -1,165 +0,0 @@
-
-
-
-
- {#if editor}
-
-
-
-
- {#each colorMap as color}
-
- {/each}
- {#if editor.isActive("textStyle")}
-
- {/if}
-
-
-
- {/if}
-
-
-
-
-
diff --git a/src/lib/components/MiniRenderer.svelte b/src/lib/components/MiniRenderer.svelte
deleted file mode 100644
index fa1b43f..0000000
--- a/src/lib/components/MiniRenderer.svelte
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
diff --git a/src/lib/components/Modal.svelte b/src/lib/components/Modal.svelte
index 984bf22..d4eabed 100644
--- a/src/lib/components/Modal.svelte
+++ b/src/lib/components/Modal.svelte
@@ -6,9 +6,8 @@
[key: string]: any;
};
- let dialog: HTMLDialogElement = $state()!;
-
let {
+ opened = $bindable(false),
title = $bindable("Modal"),
small = $bindable(false),
nopad = $bindable(false),
@@ -19,18 +18,19 @@
}: Props = $props();
export function open() {
- dialog.showModal();
+ opened = true;
}
export function close() {
- dialog.close();
+ opened = false;
}
function handleKeydown(event: KeyboardEvent) {
if (!key) {
return;
}
- if (event.key === "Escape" && dialog.open) {
+
+ if (event.key === "Escape" && opened) {
close();
}
@@ -43,29 +43,34 @@
-
-
+{/if}
diff --git a/src/lib/components/TextStyleButtons.svelte b/src/lib/components/TextStyleButtons.svelte
deleted file mode 100644
index fc8981d..0000000
--- a/src/lib/components/TextStyleButtons.svelte
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-{#if editor.isActive("shadowColor")}
-
-{:else}
-
-
- editor.chain().focus().setShadowColor(shadowColorValue).run()} />
-{/if}
diff --git a/src/lib/components/ToolbarButton.svelte b/src/lib/components/ToolbarButton.svelte
deleted file mode 100644
index ecc8b19..0000000
--- a/src/lib/components/ToolbarButton.svelte
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
diff --git a/src/lib/components/modals/CustomSourceModal.svelte b/src/lib/components/modals/CustomSourceModal.svelte
index 7e18701..d276b23 100644
--- a/src/lib/components/modals/CustomSourceModal.svelte
+++ b/src/lib/components/modals/CustomSourceModal.svelte
@@ -7,7 +7,8 @@
import IconKeybind from "~icons/tabler/keyboard";
import IconTranslate from "~icons/tabler/language";
import CheckBox from "../CheckBox.svelte";
- import MiniEditor from "../MiniEditor.svelte";
+ import MiniEditor from "../text/MiniEditor.svelte";
+ import Combobox from "../Combobox.svelte";
let {
customDialog = $bindable(),
@@ -24,7 +25,6 @@
translate: {
key: "",
params: [],
- fallback: undefined,
},
nbt: {
sourceType: "",
@@ -40,7 +40,27 @@
selector: {
selector: "",
},
+ object: {
+ atlas: "",
+ sprite: "",
+ },
});
+
+ const defaultAtlases = [
+ { label: "minecraft:armor_trims", value: "minecraft:armor_trims" },
+ { label: "minecraft:banner_patterns", value: "minecraft:banner_patterns" },
+ { label: "minecraft:beds", value: "minecraft:beds" },
+ { label: "minecraft:blocks", value: "minecraft:blocks" },
+ { label: "minecraft:chests", value: "minecraft:chests" },
+ { label: "minecraft:decorated_pot", value: "minecraft:decorated_pot" },
+ { label: "minecraft:gui", value: "minecraft:gui" },
+ { label: "minecraft:map_decorations", value: "minecraft:map_decorations" },
+ { label: "minecraft:paintings", value: "minecraft:paintings" },
+ { label: "minecraft:particles", value: "minecraft:particles" },
+ { label: "minecraft:shield_patterns", value: "minecraft:shield_patterns" },
+ { label: "minecraft:shulker_boxes", value: "minecraft:shulker_boxes" },
+ { label: "minecraft:signs", value: "minecraft:signs" },
+ ];
@@ -87,6 +107,14 @@
Keybind
+
{:else}
{/if}
@@ -348,5 +377,29 @@
class="mt-2 w-fit rounded-md bg-zinc-900 p-2 hover:bg-black/50">
Add Selector
+ {:else if customType === "object"}
+ Atlas
+
+ Sprite
+
+
{/if}
diff --git a/src/lib/text/nbt.ts b/src/lib/text/nbt.ts
index 47e4188..79401c5 100644
--- a/src/lib/text/nbt.ts
+++ b/src/lib/text/nbt.ts
@@ -192,6 +192,14 @@ function mapPropertiesToType(source: MinecraftText): JSONContent {
key: source.keybind,
},
};
+ } else if (source.atlas) {
+ finalText = {
+ type: "object",
+ attrs: {
+ atlas: source.atlas,
+ sprite: source.sprite,
+ },
+ };
} else {
finalText = {
type: "text",
diff --git a/src/lib/text/nbt_or_json.ts b/src/lib/text/nbt_or_json.ts
index a9c4e7f..7584fe7 100644
--- a/src/lib/text/nbt_or_json.ts
+++ b/src/lib/text/nbt_or_json.ts
@@ -74,6 +74,10 @@ export function addTypeSpecificValues(
case "keybind":
current.keybind = c.attrs?.key;
break;
+ case "object":
+ current.atlas = c.attrs?.atlas;
+ current.sprite = c.attrs?.sprite;
+ break;
case "selector":
current.selector = c.attrs?.selector;
break;
diff --git a/src/lib/tiptap/extensions/index.ts b/src/lib/tiptap/extensions/index.ts
index f6fc9b4..40e53fa 100644
--- a/src/lib/tiptap/extensions/index.ts
+++ b/src/lib/tiptap/extensions/index.ts
@@ -43,6 +43,11 @@ export interface SelectorAttributes {
selector: string;
}
+export interface ObjectAttributes {
+ atlas: string;
+ sprite: string;
+}
+
declare module "@tiptap/core" {
interface Commands {
font: {
@@ -86,6 +91,9 @@ declare module "@tiptap/core" {
selectorNode: {
insertSelector: (attrs: SelectorAttributes) => ReturnType;
};
+ object: {
+ insertObject: (attrs: ObjectAttributes) => ReturnType;
+ };
}
}
@@ -105,4 +113,5 @@ export { ScoreNode } from "./nodes/ScoreNode";
export { SelectorNode } from "./nodes/SelectorNode";
export { StorageNBTNode } from "./nodes/StorageNBTNode";
export { TranslateNode } from "./nodes/TranslateNode";
+export { ObjectNode } from "./nodes/ObjectNode";
export { FontsExtension } from "./fonts";
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 9da9e75..122983d 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -32,6 +32,8 @@ export type MinecraftText = {
keybind?: string;
selector?: string;
+ atlas?: string
+ sprite?: string
color?: string;
shadow_color?: number | number[];
@@ -102,6 +104,10 @@ export type ExternalSources = {
selector: {
selector: string;
};
+ object: {
+ atlas: string;
+ sprite: string;
+ };
};
export type MCTextKey = keyof MinecraftText;
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index a6f2493..4edcf98 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -15,11 +15,12 @@
ShadowColorMark,
StorageNBTNode,
TranslateNode,
+ ObjectNode
} from "$lib/tiptap/extensions/index";
// Components
- import MiniEditor from "$lib/components/MiniEditor.svelte";
- import MiniRenderer from "$lib/components/MiniRenderer.svelte";
import Modal from "$lib/components/Modal.svelte";
+ import MiniEditor from "$lib/components/text/MiniEditor.svelte";
+ import MiniRenderer from "$lib/components/text/MiniRenderer.svelte";
import ColorPicker from "svelte-awesome-color-picker";
import { convertToTextOrEmpty, snbtToDocument } from "$lib/text/nbt";
@@ -28,7 +29,7 @@
import Placeholder from "@tiptap/extension-placeholder";
import StarterKit from "@tiptap/starter-kit";
import { onDestroy, onMount } from "svelte";
- // Icons
+// Icons
import IconUndo from "~icons/tabler/arrow-back-up";
import IconRedo from "~icons/tabler/arrow-forward-up";
import IconTick from "~icons/tabler/check";
@@ -48,15 +49,13 @@
import { page } from "$app/state";
- import TextStyleButtons from "$lib/components/TextStyleButtons.svelte";
+ import TextStyleButtons from "$lib/components/text/TextStyleButtons.svelte";
import { colorMap } from "$lib/text/general";
- import ToolbarButton from "$lib/components/ToolbarButton.svelte";
+ import ToolbarButton from "$lib/components/text/ToolbarButton.svelte";
import { openDataStore } from "$lib/db";
import { fontLUT } from "$lib/tiptap/extensions/fonts";
import { tooltip } from "$lib/tooltip";
- import { translateMOTD } from "$lib/text/motd";
- import ExportModal from "$lib/components/modals/ExportModal.svelte";
let tiptapJSON: JSONContent = $state()!;
@@ -173,6 +172,7 @@
EntityNBTNode,
KeybindNode,
SelectorNode,
+ ObjectNode,
FontsExtension,
Placeholder.configure({
placeholder:
From 184411b6ff96e52dfad0099df2a8c872347a1845 Mon Sep 17 00:00:00 2001
From: boop-the-dog
Date: Tue, 5 Aug 2025 13:30:04 -0400
Subject: [PATCH 2/9] pretty formatting
---
src/lib/components/Modal.svelte | 2 +-
src/lib/components/modals/CustomSourceModal.svelte | 7 +++++--
src/lib/types.ts | 4 ++--
src/routes/+page.svelte | 6 +++---
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/lib/components/Modal.svelte b/src/lib/components/Modal.svelte
index d4eabed..63ee30c 100644
--- a/src/lib/components/Modal.svelte
+++ b/src/lib/components/Modal.svelte
@@ -29,7 +29,7 @@
if (!key) {
return;
}
-
+
if (event.key === "Escape" && opened) {
close();
}
diff --git a/src/lib/components/modals/CustomSourceModal.svelte b/src/lib/components/modals/CustomSourceModal.svelte
index d276b23..477697a 100644
--- a/src/lib/components/modals/CustomSourceModal.svelte
+++ b/src/lib/components/modals/CustomSourceModal.svelte
@@ -382,7 +382,7 @@
Sprite
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 122983d..782ee54 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -32,8 +32,8 @@ export type MinecraftText = {
keybind?: string;
selector?: string;
- atlas?: string
- sprite?: string
+ atlas?: string;
+ sprite?: string;
color?: string;
shadow_color?: number | number[];
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 4edcf98..9bb7f16 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -15,7 +15,7 @@
ShadowColorMark,
StorageNBTNode,
TranslateNode,
- ObjectNode
+ ObjectNode,
} from "$lib/tiptap/extensions/index";
// Components
import Modal from "$lib/components/Modal.svelte";
@@ -29,7 +29,7 @@
import Placeholder from "@tiptap/extension-placeholder";
import StarterKit from "@tiptap/starter-kit";
import { onDestroy, onMount } from "svelte";
-// Icons
+ // Icons
import IconUndo from "~icons/tabler/arrow-back-up";
import IconRedo from "~icons/tabler/arrow-forward-up";
import IconTick from "~icons/tabler/check";
@@ -69,7 +69,7 @@
let doesContentExist: boolean = $state(false);
let shouldOptimise = $state(true);
-
+
// Import
let importDialog: Modal = $state()!;
let importText: string = $state("");
From fd4cf35ae2873d1a7287a577112a8f1c7d6cb138 Mon Sep 17 00:00:00 2001
From: boop-the-dog
Date: Tue, 5 Aug 2025 13:30:21 -0400
Subject: [PATCH 3/9] add the files
---
src/lib/components/Combobox.svelte | 84 +++++++++
src/lib/components/text/MiniEditor.svelte | 174 ++++++++++++++++++
src/lib/components/text/MiniRenderer.svelte | 52 ++++++
.../components/text/TextStyleButtons.svelte | 107 +++++++++++
src/lib/components/text/ToolbarButton.svelte | 24 +++
src/lib/tiptap/extensions/nodes/ObjectNode.ts | 66 +++++++
6 files changed, 507 insertions(+)
create mode 100644 src/lib/components/Combobox.svelte
create mode 100644 src/lib/components/text/MiniEditor.svelte
create mode 100644 src/lib/components/text/MiniRenderer.svelte
create mode 100644 src/lib/components/text/TextStyleButtons.svelte
create mode 100644 src/lib/components/text/ToolbarButton.svelte
create mode 100644 src/lib/tiptap/extensions/nodes/ObjectNode.ts
diff --git a/src/lib/components/Combobox.svelte b/src/lib/components/Combobox.svelte
new file mode 100644
index 0000000..e593441
--- /dev/null
+++ b/src/lib/components/Combobox.svelte
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+ {#each filteredItems as item, i (i + item.value)}
+
+ {#snippet children({ selected })}
+
+ {item.label}
+
+ {#if selected}
+
+ {/if}
+ {/snippet}
+
+ {:else}
+ No results found
+ {/each}
+
+
+
diff --git a/src/lib/components/text/MiniEditor.svelte b/src/lib/components/text/MiniEditor.svelte
new file mode 100644
index 0000000..e83a798
--- /dev/null
+++ b/src/lib/components/text/MiniEditor.svelte
@@ -0,0 +1,174 @@
+
+
+
+
+ {#if editor}
+
+
+
+
+ {#each colorMap as color}
+
+ {/each}
+ {#if editor.isActive("textStyle")}
+
+ {/if}
+
+
+
+ {/if}
+
+
+
+
+
diff --git a/src/lib/components/text/MiniRenderer.svelte b/src/lib/components/text/MiniRenderer.svelte
new file mode 100644
index 0000000..0177324
--- /dev/null
+++ b/src/lib/components/text/MiniRenderer.svelte
@@ -0,0 +1,52 @@
+
+
+
diff --git a/src/lib/components/text/TextStyleButtons.svelte b/src/lib/components/text/TextStyleButtons.svelte
new file mode 100644
index 0000000..fc8981d
--- /dev/null
+++ b/src/lib/components/text/TextStyleButtons.svelte
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+{#if editor.isActive("shadowColor")}
+
+{:else}
+
+
+ editor.chain().focus().setShadowColor(shadowColorValue).run()} />
+{/if}
diff --git a/src/lib/components/text/ToolbarButton.svelte b/src/lib/components/text/ToolbarButton.svelte
new file mode 100644
index 0000000..ecc8b19
--- /dev/null
+++ b/src/lib/components/text/ToolbarButton.svelte
@@ -0,0 +1,24 @@
+
+
+
diff --git a/src/lib/tiptap/extensions/nodes/ObjectNode.ts b/src/lib/tiptap/extensions/nodes/ObjectNode.ts
new file mode 100644
index 0000000..55bf0cc
--- /dev/null
+++ b/src/lib/tiptap/extensions/nodes/ObjectNode.ts
@@ -0,0 +1,66 @@
+import { Node, mergeAttributes, type CommandProps } from "@tiptap/core";
+import type { NodeOptions, ObjectAttributes } from "../index";
+
+export const ObjectNode = Node.create({
+ name: "object",
+
+ inline: true,
+ group: "inline",
+ atom: true,
+
+ addOptions() {
+ return {
+ HTMLAttributes: {},
+ };
+ },
+
+ addAttributes(): ObjectAttributes {
+ return {
+ atlas: "",
+ sprite: "",
+ };
+ },
+
+ parseHTML() {
+ return [
+ {
+ tag: "span[data-object-node]",
+ },
+ ];
+ },
+
+ renderHTML({ HTMLAttributes, node }) {
+ const { atlas, sprite } = node.attrs;
+
+ return [
+ "span",
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
+ "data-object-node": "true",
+ contenteditable: "false",
+ style: `
+ background-color: #18181b;
+ padding: 0px 5px;
+ border-radius: 4px;
+ font-size: 0.9rem;
+ display: inline-block;
+ vertical-align: var(--custom-source-align, middle);
+ text-decoration: inherit;
+ `,
+ }),
+ ["span", {}, `OBJECT: ${atlas}/${sprite}`],
+ ];
+ },
+
+ addCommands() {
+ return {
+ insertObject:
+ (attrs) =>
+ ({ commands }: CommandProps) => {
+ return commands.insertContent({
+ type: this.name,
+ attrs,
+ });
+ },
+ };
+ },
+});
From f93867e5c8842d43035f67551064602ec71330ba Mon Sep 17 00:00:00 2001
From: boop-the-dog
Date: Tue, 5 Aug 2025 13:34:31 -0400
Subject: [PATCH 4/9] compile you >:(
---
bun.lock | 20 ++-
package-lock.json | 169 +++++++++++++++++---
package.json | 8 +-
src/lib/components/text/MiniRenderer.svelte | 21 ++-
4 files changed, 174 insertions(+), 44 deletions(-)
diff --git a/bun.lock b/bun.lock
index 2fc54bf..cfe77d4 100644
--- a/bun.lock
+++ b/bun.lock
@@ -322,7 +322,7 @@
"@types/mdurl": ["@types/mdurl@2.0.0", "", {}, "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg=="],
- "@types/node": ["@types/node@24.1.0", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w=="],
+ "@types/node": ["@types/node@24.2.0", "", { "dependencies": { "undici-types": "~7.10.0" } }, "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw=="],
"@vitest/expect": ["@vitest/expect@3.2.4", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/spy": "3.2.4", "@vitest/utils": "3.2.4", "chai": "^5.2.0", "tinyrainbow": "^2.0.0" } }, "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig=="],
@@ -424,7 +424,7 @@
"exsolve": ["exsolve@1.0.7", "", {}, "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw=="],
- "fdir": ["fdir@6.4.4", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg=="],
+ "fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="],
"fflate": ["fflate@0.8.2", "", {}, "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="],
@@ -646,13 +646,13 @@
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
- "svelte": ["svelte@5.37.2", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "@jridgewell/sourcemap-codec": "^1.5.0", "@sveltejs/acorn-typescript": "^1.0.5", "@types/estree": "^1.0.5", "acorn": "^8.12.1", "aria-query": "^5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "esm-env": "^1.2.1", "esrap": "^2.1.0", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-SAakJiy04/OvXRAUnGxRACGzw6GB9kmxYIjuMO/zTcTL6psqc54Y0O/yR6I3OLqFqn79EPd23qsCGkKozvYYbQ=="],
+ "svelte": ["svelte@5.37.3", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "@jridgewell/sourcemap-codec": "^1.5.0", "@sveltejs/acorn-typescript": "^1.0.5", "@types/estree": "^1.0.5", "acorn": "^8.12.1", "aria-query": "^5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "esm-env": "^1.2.1", "esrap": "^2.1.0", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-7t/ejshehHd+95z3Z7ebS7wsqHDQxi/8nBTuTRwpMgNegfRBfuitCSKTUDKIBOExqfT2+DhQ2VLG8Xn+cBXoaQ=="],
"svelte-awesome-color-picker": ["svelte-awesome-color-picker@4.0.2", "", { "dependencies": { "colord": "^2.9.3", "svelte-awesome-slider": "2.0.0" }, "peerDependencies": { "svelte": "^5.0.0" } }, "sha512-Ez72goMMNmw6sZhB1/BXEA8984lEkudPrdlNS+y3nHm2Lnk1w4nwy5NFyWPxTP7nFnLxhIqyV3VuJVG4PokKwg=="],
"svelte-awesome-slider": ["svelte-awesome-slider@2.0.0", "", { "peerDependencies": { "svelte": "^5.0.0" } }, "sha512-YBkOdYm1Feaqsn2JkJBRs+Kc/X3Qy/3GuVmI7GmoYDjBaHkjx9uH4khTuED22z57Hg3gGWeDhp/clIjWDdLNaw=="],
- "svelte-check": ["svelte-check@4.3.0", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "chokidar": "^4.0.1", "fdir": "^6.2.0", "picocolors": "^1.0.0", "sade": "^1.7.4" }, "peerDependencies": { "svelte": "^4.0.0 || ^5.0.0-next.0", "typescript": ">=5.0.0" }, "bin": { "svelte-check": "bin/svelte-check" } }, "sha512-Iz8dFXzBNAM7XlEIsUjUGQhbEE+Pvv9odb9+0+ITTgFWZBGeJRRYqHUUglwe2EkLD5LIsQaAc4IUJyvtKuOO5w=="],
+ "svelte-check": ["svelte-check@4.3.1", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "chokidar": "^4.0.1", "fdir": "^6.2.0", "picocolors": "^1.0.0", "sade": "^1.7.4" }, "peerDependencies": { "svelte": "^4.0.0 || ^5.0.0-next.0", "typescript": ">=5.0.0" }, "bin": { "svelte-check": "bin/svelte-check" } }, "sha512-lkh8gff5gpHLjxIV+IaApMxQhTGnir2pNUAqcNgeKkvK5bT/30Ey/nzBxNLDlkztCH4dP7PixkMt9SWEKFPBWg=="],
"svelte-toolbelt": ["svelte-toolbelt@0.9.3", "", { "dependencies": { "clsx": "^2.1.1", "runed": "^0.29.0", "style-to-object": "^1.0.8" }, "peerDependencies": { "svelte": "^5.30.2" } }, "sha512-HCSWxCtVmv+c6g1ACb8LTwHVbDqLKJvHpo6J8TaqwUme2hj9ATJCpjCPNISR1OCq2Q4U1KT41if9ON0isINQZw=="],
@@ -696,7 +696,7 @@
"typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="],
- "typescript-color-gradient": ["typescript-color-gradient@4.0.1", "", {}, "sha512-7TECtE3bG3W3xFIkEssatbfIPCHf4yTn3Zoxv0v6HZ5FUcsHN0biN9AHfCplYCFDEnw9rIQR/68Xcvb7WAZaxQ=="],
+ "typescript-color-gradient": ["typescript-color-gradient@4.1.0", "", {}, "sha512-XgwZS8BPcr7Bm4izuQOmJOwJhYWyK5V1FY1sgdnUhEJEIFtwyFDMu+8ROcY8iAoaEK7Qld8kQmEGBE3wI35nBQ=="],
"uc.micro": ["uc.micro@2.1.0", "", {}, "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="],
@@ -704,7 +704,7 @@
"uint8array-extras": ["uint8array-extras@1.4.0", "", {}, "sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ=="],
- "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
+ "undici-types": ["undici-types@7.10.0", "", {}, "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag=="],
"unplugin": ["unplugin@2.3.5", "", { "dependencies": { "acorn": "^8.14.1", "picomatch": "^4.0.2", "webpack-virtual-modules": "^0.6.2" } }, "sha512-RyWSb5AHmGtjjNQ6gIlA67sHOsWpsbWpwDokLwTcejVdOjEkJZh7QKu14J00gDDVSh8kGH4KYC/TNBceXFZhtw=="],
@@ -792,12 +792,12 @@
"strip-literal/js-tokens": ["js-tokens@9.0.1", "", {}, "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ=="],
+ "tinyglobby/fdir": ["fdir@6.4.4", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg=="],
+
"tinyglobby/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
"unplugin/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
- "vite/fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="],
-
"vite-node/vite": ["vite@6.3.5", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ=="],
"vitest/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
@@ -812,12 +812,16 @@
"mlly/pkg-types/confbox": ["confbox@0.1.8", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="],
+ "vite-node/vite/fdir": ["fdir@6.4.4", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg=="],
+
"vite-node/vite/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
"vite-node/vite/postcss": ["postcss@8.5.3", "", { "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A=="],
"vite-node/vite/tinyglobby": ["tinyglobby@0.2.13", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw=="],
+ "vitest/vite/fdir": ["fdir@6.4.4", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg=="],
+
"vitest/vite/postcss": ["postcss@8.5.3", "", { "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A=="],
"vitest/vite/tinyglobby": ["tinyglobby@0.2.13", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw=="],
diff --git a/package-lock.json b/package-lock.json
index ca6141a..1390b44 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,10 +12,11 @@
"@tiptap/extension-placeholder": "^3.0.9",
"@tiptap/pm": "^3.0.9",
"@tiptap/starter-kit": "^3.0.9",
+ "bits-ui": "^2.9.1",
"idb": "^8.0.3",
"svelte-awesome-color-picker": "^4.0.2",
"tippy.js": "^6.3.7",
- "typescript-color-gradient": "^4.0.1"
+ "typescript-color-gradient": "^4.1.0"
},
"devDependencies": {
"@iconify-json/tabler": "^1.2.20",
@@ -29,14 +30,14 @@
"@tiptap/extension-color": "^3.0.9",
"@tiptap/extension-font-family": "^3.0.9",
"@tiptap/extension-text-style": "^3.0.9",
- "@types/node": "^24.1.0",
+ "@types/node": "^24.2.0",
"file-type": "^21.0.0",
"jsdom": "^26.1.0",
"prettier": "^3.6.2",
"prettier-plugin-svelte": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.6.14",
- "svelte": "^5.37.2",
- "svelte-check": "^4.3.0",
+ "svelte": "^5.37.3",
+ "svelte-check": "^4.3.1",
"tailwindcss": "^4.1.11",
"tslib": "^2.8.1",
"typescript": "^5.9.2",
@@ -263,6 +264,31 @@
"node": ">=18"
}
},
+ "node_modules/@floating-ui/core": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz",
+ "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==",
+ "license": "MIT",
+ "dependencies": {
+ "@floating-ui/utils": "^0.2.10"
+ }
+ },
+ "node_modules/@floating-ui/dom": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.3.tgz",
+ "integrity": "sha512-uZA413QEpNuhtb3/iIKoYMSK07keHPYeXF02Zhd6e213j+d1NamLix/mCLxBUDW/Gx52sPH2m+chlUsyaBs/Ag==",
+ "license": "MIT",
+ "dependencies": {
+ "@floating-ui/core": "^1.7.3",
+ "@floating-ui/utils": "^0.2.10"
+ }
+ },
+ "node_modules/@floating-ui/utils": {
+ "version": "0.2.10",
+ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz",
+ "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==",
+ "license": "MIT"
+ },
"node_modules/@iconify-json/tabler": {
"version": "1.2.20",
"resolved": "https://registry.npmjs.org/@iconify-json/tabler/-/tabler-1.2.20.tgz",
@@ -301,6 +327,16 @@
"url": "https://github.com/sponsors/antfu"
}
},
+ "node_modules/@internationalized/date": {
+ "version": "3.8.2",
+ "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.8.2.tgz",
+ "integrity": "sha512-/wENk7CbvLbkUvX1tu0mwq49CVkkWpkXubGel6birjRPyo6uQ4nQpnq5xZu823zRCwwn82zgHrvgF1vZyvmVgA==",
+ "license": "Apache-2.0",
+ "peer": true,
+ "dependencies": {
+ "@swc/helpers": "^0.5.0"
+ }
+ },
"node_modules/@isaacs/fs-minipass": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
@@ -766,6 +802,16 @@
"vite": "^6.3.0 || ^7.0.0"
}
},
+ "node_modules/@swc/helpers": {
+ "version": "0.5.17",
+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz",
+ "integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==",
+ "license": "Apache-2.0",
+ "peer": true,
+ "dependencies": {
+ "tslib": "^2.8.0"
+ }
+ },
"node_modules/@tailwindcss/node": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.11.tgz",
@@ -1710,13 +1756,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
- "version": "24.1.0",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
- "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.0.tgz",
+ "integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==",
"dev": true,
"license": "MIT",
"dependencies": {
- "undici-types": "~7.8.0"
+ "undici-types": "~7.10.0"
}
},
"node_modules/@vitest/expect": {
@@ -1910,6 +1956,30 @@
"node": ">= 0.4"
}
},
+ "node_modules/bits-ui": {
+ "version": "2.9.1",
+ "resolved": "https://registry.npmjs.org/bits-ui/-/bits-ui-2.9.1.tgz",
+ "integrity": "sha512-Fdtc1TKppfEio6fl0XzkrDG8DSvfbYJdrOh4j5KzaGh0kYA6BskMGIXL4JmsZxUS+O5ESFypNjrQ9z9qs3xAdQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@floating-ui/core": "^1.7.1",
+ "@floating-ui/dom": "^1.7.1",
+ "esm-env": "^1.1.2",
+ "runed": "^0.29.1",
+ "svelte-toolbelt": "^0.9.3",
+ "tabbable": "^6.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/huntabyte"
+ },
+ "peerDependencies": {
+ "@internationalized/date": "^3.8.1",
+ "svelte": "^5.33.0"
+ }
+ },
"node_modules/cac": {
"version": "6.7.14",
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
@@ -2425,6 +2495,12 @@
"node": ">=8"
}
},
+ "node_modules/inline-style-parser": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz",
+ "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==",
+ "license": "MIT"
+ },
"node_modules/is-potential-custom-element-name": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
@@ -3543,6 +3619,22 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/runed": {
+ "version": "0.29.2",
+ "resolved": "https://registry.npmjs.org/runed/-/runed-0.29.2.tgz",
+ "integrity": "sha512-0cq6cA6sYGZwl/FvVqjx9YN+1xEBu9sDDyuWdDW1yWX7JF2wmvmVKfH+hVCZs+csW+P3ARH92MjI3H9QTagOQA==",
+ "funding": [
+ "https://github.com/sponsors/huntabyte",
+ "https://github.com/sponsors/tglide"
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "esm-env": "^1.0.0"
+ },
+ "peerDependencies": {
+ "svelte": "^5.7.0"
+ }
+ },
"node_modules/sade": {
"version": "1.8.1",
"dev": true,
@@ -3671,6 +3763,15 @@
"url": "https://github.com/sponsors/Borewit"
}
},
+ "node_modules/style-to-object": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.9.tgz",
+ "integrity": "sha512-G4qppLgKu/k6FwRpHiGiKPaPTFcG3g4wNVX/Qsfu+RqQM30E7Tyu/TEgxcL9PNLF5pdRLwQdE3YKKf+KF2Dzlw==",
+ "license": "MIT",
+ "dependencies": {
+ "inline-style-parser": "0.2.4"
+ }
+ },
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -3685,9 +3786,9 @@
}
},
"node_modules/svelte": {
- "version": "5.37.2",
- "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.37.2.tgz",
- "integrity": "sha512-SAakJiy04/OvXRAUnGxRACGzw6GB9kmxYIjuMO/zTcTL6psqc54Y0O/yR6I3OLqFqn79EPd23qsCGkKozvYYbQ==",
+ "version": "5.37.3",
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.37.3.tgz",
+ "integrity": "sha512-7t/ejshehHd+95z3Z7ebS7wsqHDQxi/8nBTuTRwpMgNegfRBfuitCSKTUDKIBOExqfT2+DhQ2VLG8Xn+cBXoaQ==",
"license": "MIT",
"dependencies": {
"@ampproject/remapping": "^2.3.0",
@@ -3730,9 +3831,9 @@
}
},
"node_modules/svelte-check": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.3.0.tgz",
- "integrity": "sha512-Iz8dFXzBNAM7XlEIsUjUGQhbEE+Pvv9odb9+0+ITTgFWZBGeJRRYqHUUglwe2EkLD5LIsQaAc4IUJyvtKuOO5w==",
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.3.1.tgz",
+ "integrity": "sha512-lkh8gff5gpHLjxIV+IaApMxQhTGnir2pNUAqcNgeKkvK5bT/30Ey/nzBxNLDlkztCH4dP7PixkMt9SWEKFPBWg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3753,6 +3854,26 @@
"typescript": ">=5.0.0"
}
},
+ "node_modules/svelte-toolbelt": {
+ "version": "0.9.3",
+ "resolved": "https://registry.npmjs.org/svelte-toolbelt/-/svelte-toolbelt-0.9.3.tgz",
+ "integrity": "sha512-HCSWxCtVmv+c6g1ACb8LTwHVbDqLKJvHpo6J8TaqwUme2hj9ATJCpjCPNISR1OCq2Q4U1KT41if9ON0isINQZw==",
+ "funding": [
+ "https://github.com/sponsors/huntabyte"
+ ],
+ "dependencies": {
+ "clsx": "^2.1.1",
+ "runed": "^0.29.0",
+ "style-to-object": "^1.0.8"
+ },
+ "engines": {
+ "node": ">=18",
+ "pnpm": ">=8.7.0"
+ },
+ "peerDependencies": {
+ "svelte": "^5.30.2"
+ }
+ },
"node_modules/symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
@@ -3760,6 +3881,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/tabbable": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",
+ "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==",
+ "license": "MIT"
+ },
"node_modules/tailwindcss": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.11.tgz",
@@ -3937,7 +4064,6 @@
},
"node_modules/tslib": {
"version": "2.8.1",
- "dev": true,
"license": "0BSD"
},
"node_modules/typescript": {
@@ -3955,9 +4081,10 @@
}
},
"node_modules/typescript-color-gradient": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/typescript-color-gradient/-/typescript-color-gradient-4.0.1.tgz",
- "integrity": "sha512-7TECtE3bG3W3xFIkEssatbfIPCHf4yTn3Zoxv0v6HZ5FUcsHN0biN9AHfCplYCFDEnw9rIQR/68Xcvb7WAZaxQ=="
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/typescript-color-gradient/-/typescript-color-gradient-4.1.0.tgz",
+ "integrity": "sha512-XgwZS8BPcr7Bm4izuQOmJOwJhYWyK5V1FY1sgdnUhEJEIFtwyFDMu+8ROcY8iAoaEK7Qld8kQmEGBE3wI35nBQ==",
+ "license": "MIT"
},
"node_modules/uc.micro": {
"version": "2.1.0",
@@ -3982,9 +4109,9 @@
}
},
"node_modules/undici-types": {
- "version": "7.8.0",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
- "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
+ "version": "7.10.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
+ "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
"dev": true,
"license": "MIT"
},
diff --git a/package.json b/package.json
index 6caebac..403374c 100644
--- a/package.json
+++ b/package.json
@@ -25,14 +25,14 @@
"@tiptap/extension-color": "^3.0.9",
"@tiptap/extension-font-family": "^3.0.9",
"@tiptap/extension-text-style": "^3.0.9",
- "@types/node": "^24.1.0",
+ "@types/node": "^24.2.0",
"file-type": "^21.0.0",
"jsdom": "^26.1.0",
"prettier": "^3.6.2",
"prettier-plugin-svelte": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.6.14",
- "svelte": "^5.37.2",
- "svelte-check": "^4.3.0",
+ "svelte": "^5.37.3",
+ "svelte-check": "^4.3.1",
"tailwindcss": "^4.1.11",
"tslib": "^2.8.1",
"typescript": "^5.9.2",
@@ -50,6 +50,6 @@
"idb": "^8.0.3",
"svelte-awesome-color-picker": "^4.0.2",
"tippy.js": "^6.3.7",
- "typescript-color-gradient": "^4.0.1"
+ "typescript-color-gradient": "^4.1.0"
}
}
diff --git a/src/lib/components/text/MiniRenderer.svelte b/src/lib/components/text/MiniRenderer.svelte
index 0177324..4792a5a 100644
--- a/src/lib/components/text/MiniRenderer.svelte
+++ b/src/lib/components/text/MiniRenderer.svelte
@@ -1,24 +1,23 @@
@@ -122,58 +106,5 @@
>{editor ? translateMOTD(editor.getJSON()) : "Loading..."}
-
-
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 9bb7f16..0ba2bbb 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -667,7 +667,7 @@
{#await import("$lib/components/modals/CustomSourceModal.svelte") then modal}
-
+
{/await}
From 3d1df478786fff1921e324d4606b8b0c0522b1b6 Mon Sep 17 00:00:00 2001
From: Silabear <56885288+Silabear@users.noreply.github.com>
Date: Fri, 5 Sep 2025 18:15:04 +0100
Subject: [PATCH 7/9] INCOMPLETE version selector the version selector works
but we need to rework the converter code (nbt_or_json.ts)
---
src/lib/stores.ts | 7 ++++
src/lib/text/nbt_or_json.ts | 26 +++++++-------
src/lib/types.ts | 23 +++++++++++-
src/routes/+page.svelte | 72 +++++++++++++++++++------------------
4 files changed, 79 insertions(+), 49 deletions(-)
create mode 100644 src/lib/stores.ts
diff --git a/src/lib/stores.ts b/src/lib/stores.ts
new file mode 100644
index 0000000..78efdbc
--- /dev/null
+++ b/src/lib/stores.ts
@@ -0,0 +1,7 @@
+import { writable } from "svelte/store";
+
+export const outputVersion = writable({
+ friendly: "1.21.9+",
+ description: "'object' type added, allowing you to use non-character sprites",
+ index: 2
+})
\ No newline at end of file
diff --git a/src/lib/text/nbt_or_json.ts b/src/lib/text/nbt_or_json.ts
index 7584fe7..a6c0058 100644
--- a/src/lib/text/nbt_or_json.ts
+++ b/src/lib/text/nbt_or_json.ts
@@ -12,6 +12,10 @@ import {
trueMarkOrUndefined,
unescapeUnicode,
} from "./general";
+import { outputVersion } from "$lib/stores";
+import { get } from "svelte/store";
+
+let exportVersion = get(outputVersion)
const styleProps = [
"color",
@@ -34,14 +38,13 @@ const styleProps = [
* @param current current text component
* @param c the current editor JSON
* @param includeInteractivity should it have click and hover events
- * @param exportVersion the version to export to
+ * @param outputVersion the version to export to
* @returns the current component with new properties
*/
export function addTypeSpecificValues(
current: MinecraftText,
c: JSONContent,
includeInteractivity = true,
- exportVersion: "new" | "old" = "new",
) {
switch (c.type) {
case "text":
@@ -84,13 +87,10 @@ export function addTypeSpecificValues(
}
if (includeInteractivity) {
- switch (exportVersion) {
- case "new":
- newApplyInteractiveValues(current, c);
- break;
- case "old":
- oldApplyInteractiveValues(current, c);
- break;
+ if (exportVersion.index >= 1) {
+ newApplyInteractiveValues(current, c);
+ } else {
+ oldApplyInteractiveValues(current, c);
}
}
@@ -315,18 +315,18 @@ export function optimise(arr: StringyMCText[], lore = false): StringyMCText[] {
return out;
}
+
/**
* Converts the JSON content of the editor to an NBT string.
*/
export function convert(
jsonContent: JSONContent,
exportType: "standard" | "item_lore" = "standard",
- exportVersion: "new" | "old" = "new",
optimise: boolean,
force_json: boolean = false,
): string {
- let out = translateJSON(jsonContent, { exportVersion, exportType, optimise });
- if (exportVersion == "new" && !force_json) {
+ let out = translateJSON(jsonContent, { exportType, optimise });
+ if (exportVersion.index >= 1 && !force_json) {
// only remove strings
out = out.replace(/(?<=[{,]\s*)"[^"]*"\s*:/g, (match) =>
match.replace(/"/g, ""),
@@ -372,7 +372,6 @@ export function translateJSON(
current,
c,
true,
- options.exportVersion,
);
data.push(current);
}
@@ -422,7 +421,6 @@ export function translateJSON(
currentComponent,
c,
false,
- options.exportVersion,
);
currentLine.push(currentComponent);
}
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 782ee54..68cdb95 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -1,3 +1,25 @@
+export type Version = {
+ friendly: string,
+ description: string,
+ index: number
+}
+export const versions = [
+ {
+ friendly: "pre-1.21.5",
+ description: "uses json text components",
+ index: 0
+ },
+ {
+ friendly: "1.21.5-8",
+ description: "uses nbt as text components, changes to syntax and names",
+ index: 1
+ },
+ {
+ friendly: "1.21.9+",
+ description: "'object' type added, allowing you to use non-character sprites",
+ index: 2
+ },
+]
export type BaseMinecraftText = Pick<
MinecraftText,
| "text"
@@ -114,7 +136,6 @@ export type MCTextKey = keyof MinecraftText;
export type TranslateOptions = Partial<{
indent: boolean;
indentSize: number;
- exportVersion: "old" | "new";
optimise: boolean;
exportType: "standard" | "item_lore";
}>;
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 0ba2bbb..cb87a5f 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -56,6 +56,8 @@
import { openDataStore } from "$lib/db";
import { fontLUT } from "$lib/tiptap/extensions/fonts";
import { tooltip } from "$lib/tooltip";
+ import { versions, type Version } from "$lib/types";
+ import { outputVersion } from "$lib/stores";
let tiptapJSON: JSONContent = $state()!;
@@ -65,7 +67,7 @@
let colorDialog: Modal = $state()!;
let outputDialog: Modal = $state()!;
- let outputVersion: "new" | "old" = $state("new");
+ let versionPopup: boolean = $state(false);
let doesContentExist: boolean = $state(false);
let shouldOptimise = $state(true);
@@ -323,21 +325,6 @@
editor!.commands.unsetAllMarks();
}
}
-
- function getTextComponentCount() {
- const components = JSON.parse(
- translateJSON(editor!.getJSON(), {
- exportType: "standard",
- indent: false,
- exportVersion: outputVersion,
- optimise: shouldOptimise,
- }),
- );
- if (Array.isArray(components)) {
- return components.length;
- }
- return 1;
- }
@@ -533,7 +520,6 @@
convert(
editor!.getJSON(),
"standard",
- outputVersion,
shouldOptimise,
),
);
@@ -550,14 +536,14 @@
{editor
- ? convert(tiptapJSON!, "standard", outputVersion, shouldOptimise)
+ ? convert(tiptapJSON!, "standard", shouldOptimise)
: "Loading..."}
{#if doesContentExist}
-
+
click to change output settings:
-
+
+
+ {#if versionPopup}
+
+
+ version
+ description
+
+ {#each versions as v}
+
+ {/each}
+
+ {/if}
+
+
+
+