/++ +/ module wit.pumpkin.plugin.text.imports; import wit.common; public import wit.pumpkin.plugin.text.common; static import wit.pumpkin.plugin.common.imports; package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link(); /++ +/ struct TextComponent { package(wit) uint __handle = 0; pragma(inline, true) package(wit) this(uint handle) @safe @nogc nothrow { __handle = handle; } /++ Creates a plain text component. +/ static TextComponent text(in WitString plain) @trusted nothrow { auto _ret = __import_text(cast(void*)(plain.ptr), plain.length); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.text") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.text") static private extern(C) uint __import_text(void*, size_t) nothrow; /++ Creates a translation component. +/ static TextComponent translate(in WitString key, in WitList!(TextComponent) with_) @trusted nothrow { auto _ret = __import_translate(cast(void*)(key.ptr), key.length, cast(void*)(with_.ptr), with_.length); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.translate") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.translate") static private extern(C) uint __import_translate(void*, size_t, void*, size_t) nothrow; /++ Creates a translation component with a Bedrock-specific fallback key. +/ static TextComponent translateCross(in WitString javaKey, in WitString bedrockKey, in WitList!(TextComponent) with_) @trusted nothrow { auto _ret = __import_translateCross(cast(void*)(javaKey.ptr), javaKey.length, cast(void*)(bedrockKey.ptr), bedrockKey.length, cast(void*)(with_.ptr), with_.length); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.translate-cross") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.translate_cross") static private extern(C) uint __import_translateCross(void*, size_t, void*, size_t, void*, size_t) nothrow; /++ Creates an entity names / selector text component. +/ static TextComponent entityNames(in WitString selector, in Option!(WitString) separator) @trusted nothrow { uint _option4 = void; void* _option5 = void; size_t _option6 = void; if (separator.isSome) { ref _payload3 = separator.unwrap(); _option4 = 1; _option5 = cast(void*)(_payload3.ptr); _option6 = _payload3.length; } else { _option4 = 0; _option5 = null; _option6 = 0; } auto _ret = __import_entityNames(cast(void*)(selector.ptr), selector.length, _option4, _option5, _option6); auto _handle7 = TextComponent(_ret); return _handle7; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.entity-names") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.entity_names") static private extern(C) uint __import_entityNames(void*, size_t, uint, void*, size_t) nothrow; /++ Creates a keybind text component (e.g., "key.jump"). +/ static TextComponent keybind(in WitString keybind) @trusted nothrow { auto _ret = __import_keybind(cast(void*)(keybind.ptr), keybind.length); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.keybind") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.keybind") static private extern(C) uint __import_keybind(void*, size_t) nothrow; /++ Creates a custom translation component. +/ static TextComponent custom(in WitString namespace, in WitString key, in WitString locale, in WitList!(TextComponent) with_) @trusted nothrow { auto _ret = __import_custom(cast(void*)(namespace.ptr), namespace.length, cast(void*)(key.ptr), key.length, cast(void*)(locale.ptr), locale.length, cast(void*)(with_.ptr), with_.length); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.custom") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.custom") static private extern(C) uint __import_custom(void*, size_t, void*, size_t, void*, size_t, void*, size_t) nothrow; /++ Parses a legacy Minecraft formatted string (using section signs '§' by default) into a text component. +/ static TextComponent fromLegacyString(in WitString input) @trusted nothrow { auto _ret = __import_fromLegacyString(cast(void*)(input.ptr), input.length); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.from-legacy-string") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.from_legacy_string") static private extern(C) uint __import_fromLegacyString(void*, size_t) nothrow; /++ Parses a legacy formatted string using a custom color code symbol (e.g. '&' or '§'). +/ static TextComponent fromLegacyStringWithCode(in WitString input, dchar codeSymbol) @trusted nothrow { auto _ret = __import_fromLegacyStringWithCode(cast(void*)(input.ptr), input.length, cast(uint)(codeSymbol)); auto _handle0 = TextComponent(_ret); return _handle0; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.from-legacy-string-with-code") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.from_legacy_string_with_code") static private extern(C) uint __import_fromLegacyStringWithCode(void*, size_t, uint) nothrow; /++ Parses a standard Minecraft JSON text component. +/ static Result!(TextComponent, WitString) fromJson(in WitString json) @trusted nothrow { align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void; __import_fromJson(cast(void*)(json.ptr), json.length, _retArea.ptr); Result!(TextComponent, WitString) _result5 = void; bool _isErr5 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0; if (_isErr5) { auto _len3 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof))); auto _ptr3 = _len3 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null; auto _list4 = WitString(_ptr3[0.._len3]); _result5 = Result!(TextComponent, WitString).makeErr(_list4); } else { auto _handle1 = TextComponent(*(cast(uint*)(_retArea.ptr + size_t.sizeof))); _result5 = Result!(TextComponent, WitString).makeOk(_handle1); } auto _flush6 = _result5; return _flush6; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.from-json") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.from_json") static private extern(C) void __import_fromJson(void*, size_t, void*) nothrow; pragma(inline, true) void witDrop() @trusted @nogc nothrow { if (!__handle) return; __import_drop(__handle); __handle = 0; } @wasmImport!("pumpkin:plugin/text@0.1.0", "[resource-drop]text-component") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:resource_drop:text_component") static private extern(C) void __import_drop(uint) @nogc nothrow; pragma(inline, true) void witFree() @safe @nogc nothrow {} pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); } // TODO: make RAII? disable copy for the own Borrow borrow() => Borrow(__handle); alias borrow this; struct Borrow { package(wit) uint __handle = 0; pragma(inline, true) package(wit) this(uint handle) @safe @nogc nothrow { __handle = handle; } pragma(inline, true) void witFree() @safe @nogc nothrow {} pragma(inline, true) void witDrop() @trusted @nogc nothrow { if (!__handle) return; __import_drop(__handle); __handle = 0; } pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); } /++ Serializes the text component to JSON format. +/ WitString toJson() @trusted nothrow { align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void; __import_toJson(this.__handle, _retArea.ptr); auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof)); auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null; auto _list1 = WitString(_ptr0[0.._len0]); auto _flush2 = _list1; return _flush2; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.to-json") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.to_json") static private extern(C) void __import_toJson(uint, void*) nothrow; /++ +/ void addChild(TextComponent child) @trusted nothrow { __import_addChild(this.__handle, child.__handle); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.add-child") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.add_child") static private extern(C) void __import_addChild(uint, uint) nothrow; /++ +/ void addText(in WitString text) @trusted nothrow { __import_addText(this.__handle, cast(void*)(text.ptr), text.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.add-text") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.add_text") static private extern(C) void __import_addText(uint, void*, size_t) nothrow; /++ +/ WitString getText() @trusted nothrow { align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void; __import_getText(this.__handle, _retArea.ptr); auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof)); auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null; auto _list1 = WitString(_ptr0[0.._len0]); auto _flush2 = _list1; return _flush2; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.get-text") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.get_text") static private extern(C) void __import_getText(uint, void*) nothrow; /++ +/ WitList!(ubyte) encode() @trusted nothrow { align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void; __import_encode(this.__handle, _retArea.ptr); auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof)); auto _ptr0 = _len0 ? cast(ubyte*)(*(cast(void**)(_retArea.ptr + 0))) : null; auto _list1 = WitList!(ubyte)(_ptr0[0.._len0]); auto _flush2 = _list1; return _flush2; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.encode") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.encode") static private extern(C) void __import_encode(uint, void*) nothrow; /++ +/ WitString toPrettyConsole() @trusted nothrow { align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void; __import_toPrettyConsole(this.__handle, _retArea.ptr); auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof)); auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null; auto _list1 = WitString(_ptr0[0.._len0]); auto _flush2 = _list1; return _flush2; } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.to-pretty-console") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.to_pretty_console") static private extern(C) void __import_toPrettyConsole(uint, void*) nothrow; /++ Style +/ void colorNamed(NamedColor color) @trusted nothrow { __import_colorNamed(this.__handle, cast(uint)(color)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.color-named") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.color_named") static private extern(C) void __import_colorNamed(uint, uint) nothrow; /++ +/ void colorRgb(in RgbColor color) @trusted nothrow { __import_colorRgb(this.__handle, cast(uint)(color.r), cast(uint)(color.g), cast(uint)(color.b)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.color-rgb") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.color_rgb") static private extern(C) void __import_colorRgb(uint, uint, uint, uint) nothrow; /++ +/ void gradientNamed(in WitList!(NamedColor) colors) @trusted nothrow { wit.common.DeallocateBuffer deallocate; auto _listSrc1 = colors; auto _list1 = _listSrc1.length ? wit.common.malloc(_listSrc1.length * (1)) : null; assert(!_listSrc1.length || _list1); if (_listSrc1.length) deallocate ~= _list1; foreach (_elem0_idx, ref _elem0; _listSrc1) { auto _base0 = _list1 + _elem0_idx * (1); *cast(ubyte*)(_base0 + 0) = cast(ubyte)(cast(uint)(_elem0)); } __import_gradientNamed(this.__handle, _list1, colors.length); deallocate.purge(); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.gradient-named") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.gradient_named") static private extern(C) void __import_gradientNamed(uint, void*, size_t) nothrow; /++ +/ void gradient(in WitList!(RgbColor) colors) @trusted nothrow { __import_gradient(this.__handle, cast(void*)(colors.ptr), colors.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.gradient") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.gradient") static private extern(C) void __import_gradient(uint, void*, size_t) nothrow; /++ +/ void rainbow() @trusted nothrow { __import_rainbow(this.__handle); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.rainbow") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.rainbow") static private extern(C) void __import_rainbow(uint) nothrow; /++ +/ void bold(bool value) @trusted nothrow { __import_bold(this.__handle, cast(uint)(value)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.bold") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.bold") static private extern(C) void __import_bold(uint, uint) nothrow; /++ +/ void italic(bool value) @trusted nothrow { __import_italic(this.__handle, cast(uint)(value)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.italic") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.italic") static private extern(C) void __import_italic(uint, uint) nothrow; /++ +/ void underlined(bool value) @trusted nothrow { __import_underlined(this.__handle, cast(uint)(value)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.underlined") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.underlined") static private extern(C) void __import_underlined(uint, uint) nothrow; /++ +/ void strikethrough(bool value) @trusted nothrow { __import_strikethrough(this.__handle, cast(uint)(value)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.strikethrough") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.strikethrough") static private extern(C) void __import_strikethrough(uint, uint) nothrow; /++ +/ void obfuscated(bool value) @trusted nothrow { __import_obfuscated(this.__handle, cast(uint)(value)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.obfuscated") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.obfuscated") static private extern(C) void __import_obfuscated(uint, uint) nothrow; /++ Text inserted into chat when shift-clicked +/ void insertion(in WitString text) @trusted nothrow { __import_insertion(this.__handle, cast(void*)(text.ptr), text.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.insertion") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.insertion") static private extern(C) void __import_insertion(uint, void*, size_t) nothrow; /++ +/ void font(in WitString font) @trusted nothrow { __import_font(this.__handle, cast(void*)(font.ptr), font.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.font") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.font") static private extern(C) void __import_font(uint, void*, size_t) nothrow; /++ +/ void shadowColor(in ArgbColor color) @trusted nothrow { __import_shadowColor(this.__handle, cast(uint)(color.a), cast(uint)(color.r), cast(uint)(color.g), cast(uint)(color.b)); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.shadow-color") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.shadow_color") static private extern(C) void __import_shadowColor(uint, uint, uint, uint, uint) nothrow; /++ Click events +/ void clickOpenUrl(in WitString url) @trusted nothrow { __import_clickOpenUrl(this.__handle, cast(void*)(url.ptr), url.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-open-url") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_open_url") static private extern(C) void __import_clickOpenUrl(uint, void*, size_t) nothrow; /++ +/ void clickOpenFile(in WitString path) @trusted nothrow { __import_clickOpenFile(this.__handle, cast(void*)(path.ptr), path.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-open-file") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_open_file") static private extern(C) void __import_clickOpenFile(uint, void*, size_t) nothrow; /++ +/ void clickRunCommand(in WitString command) @trusted nothrow { __import_clickRunCommand(this.__handle, cast(void*)(command.ptr), command.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-run-command") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_run_command") static private extern(C) void __import_clickRunCommand(uint, void*, size_t) nothrow; /++ +/ void clickSuggestCommand(in WitString command) @trusted nothrow { __import_clickSuggestCommand(this.__handle, cast(void*)(command.ptr), command.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-suggest-command") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_suggest_command") static private extern(C) void __import_clickSuggestCommand(uint, void*, size_t) nothrow; /++ +/ void clickChangePage(uint page) @trusted nothrow { __import_clickChangePage(this.__handle, page); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-change-page") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_change_page") static private extern(C) void __import_clickChangePage(uint, uint) nothrow; /++ +/ void clickCopyToClipboard(in WitString text) @trusted nothrow { __import_clickCopyToClipboard(this.__handle, cast(void*)(text.ptr), text.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-copy-to-clipboard") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_copy_to_clipboard") static private extern(C) void __import_clickCopyToClipboard(uint, void*, size_t) nothrow; /++ Hover events +/ void hoverShowText(TextComponent text) @trusted nothrow { __import_hoverShowText(this.__handle, text.__handle); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.hover-show-text") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.hover_show_text") static private extern(C) void __import_hoverShowText(uint, uint) nothrow; /++ Item data as SNBT string +/ void hoverShowItem(in WitString item) @trusted nothrow { __import_hoverShowItem(this.__handle, cast(void*)(item.ptr), item.length); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.hover-show-item") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.hover_show_item") static private extern(C) void __import_hoverShowItem(uint, void*, size_t) nothrow; /++ +/ void hoverShowEntity(in WitString entityType, in WitString id, in Option!(TextComponent) name) @trusted nothrow { uint _option4 = void; uint _option5 = void; if (name.isSome) { ref _payload3 = name.unwrap(); _option4 = 1; _option5 = _payload3.__handle; } else { _option4 = 0; _option5 = 0; } __import_hoverShowEntity(this.__handle, cast(void*)(entityType.ptr), entityType.length, cast(void*)(id.ptr), id.length, _option4, _option5); } /// ditto @wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.hover-show-entity") pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.hover_show_entity") static private extern(C) void __import_hoverShowEntity(uint, void*, size_t, void*, size_t, uint, uint) nothrow; } }