mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
fix: use Plurimath as asset
Plurimath opal cannot be minified, esbuilded and bundled without causing unexpected exceptions So copy js in public folder and import plurimath from here
This commit is contained in:
1 parent
fd8b9751b1
commit
0de2ed10b9
7 files changed
+75
-23
No files matched your search
Vendored
+20
@@ -147,14 +147,24 @@ declare module '@vue/runtime-core' {
|
||||
IcalParser: typeof import('./src/tools/ical-parser/ical-parser.vue')['default']
|
||||
IcoConverter: typeof import('./src/tools/ico-converter/ico-converter.vue')['default']
|
||||
'IconMdi:brushVariant': typeof import('~icons/mdi/brush-variant')['default']
|
||||
'IconMdi:contentCopy': typeof import('~icons/mdi/content-copy')['default']
|
||||
'IconMdi:kettleSteamOutline': typeof import('~icons/mdi/kettle-steam-outline')['default']
|
||||
IconMdiArrowDown: typeof import('~icons/mdi/arrow-down')['default']
|
||||
IconMdiArrowRightBottom: typeof import('~icons/mdi/arrow-right-bottom')['default']
|
||||
IconMdiCamera: typeof import('~icons/mdi/camera')['default']
|
||||
IconMdiChevronDown: typeof import('~icons/mdi/chevron-down')['default']
|
||||
IconMdiChevronRight: typeof import('~icons/mdi/chevron-right')['default']
|
||||
IconMdiClose: typeof import('~icons/mdi/close')['default']
|
||||
IconMdiContentCopy: typeof import('~icons/mdi/content-copy')['default']
|
||||
IconMdiDeleteOutline: typeof import('~icons/mdi/delete-outline')['default']
|
||||
IconMdiDownload: typeof import('~icons/mdi/download')['default']
|
||||
IconMdiEye: typeof import('~icons/mdi/eye')['default']
|
||||
IconMdiEyeOff: typeof import('~icons/mdi/eye-off')['default']
|
||||
IconMdiHeart: typeof import('~icons/mdi/heart')['default']
|
||||
IconMdiPause: typeof import('~icons/mdi/pause')['default']
|
||||
IconMdiPlay: typeof import('~icons/mdi/play')['default']
|
||||
IconMdiRecord: typeof import('~icons/mdi/record')['default']
|
||||
IconMdiRefresh: typeof import('~icons/mdi/refresh')['default']
|
||||
IconMdiSearch: typeof import('~icons/mdi/search')['default']
|
||||
IconMdiTranslate: typeof import('~icons/mdi/translate')['default']
|
||||
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
||||
@@ -242,20 +252,30 @@ declare module '@vue/runtime-core' {
|
||||
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
|
||||
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NForm: typeof import('naive-ui')['NForm']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH2: typeof import('naive-ui')['NH2']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NImage: typeof import('naive-ui')['NImage']
|
||||
NInputGroup: typeof import('naive-ui')['NInputGroup']
|
||||
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NProgress: typeof import('naive-ui')['NProgress']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
"@it-tools/oggen": "^1.3.0",
|
||||
"@kenjiuno/decompressrtf": "^0.1.4",
|
||||
"@kenjiuno/msgreader": "^1.22.0",
|
||||
"@plurimath/plurimath": "^0.2.0",
|
||||
"@regexper/render": "^1.0.0",
|
||||
"@sindresorhus/slugify": "^2.2.1",
|
||||
"@tabler/icons-vue": "^3.20.0",
|
||||
|
||||
Generated
+7
-19
@@ -35,9 +35,6 @@ dependencies:
|
||||
'@kenjiuno/msgreader':
|
||||
specifier: ^1.22.0
|
||||
version: 1.22.0
|
||||
'@plurimath/plurimath':
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.2
|
||||
'@regexper/render':
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
@@ -4973,10 +4970,6 @@ packages:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/@plurimath/plurimath@0.2.2:
|
||||
resolution: {integrity: sha512-0F8aHv2tFcSEbfppQYHhx8CASWu2vkSWsTdgf0r9fMKzfJxpmciAHvg0uGdgkMorqiS3Xwh9LfOTDrVCreIZgA==}
|
||||
dev: false
|
||||
|
||||
/@polka/url@1.0.0-next.28:
|
||||
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
|
||||
dev: true
|
||||
@@ -6071,7 +6064,7 @@ packages:
|
||||
debug: 4.4.0
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
semver: 7.5.4
|
||||
semver: 7.6.3
|
||||
ts-api-utils: 1.0.1(typescript@5.2.2)
|
||||
typescript: 5.2.2
|
||||
transitivePeerDependencies:
|
||||
@@ -6132,7 +6125,7 @@ packages:
|
||||
'@typescript-eslint/types': 6.4.1
|
||||
'@typescript-eslint/typescript-estree': 6.4.1(typescript@5.2.2)
|
||||
eslint: 8.47.0
|
||||
semver: 7.5.4
|
||||
semver: 7.6.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- typescript
|
||||
@@ -6724,7 +6717,7 @@ packages:
|
||||
'@vue/compiler-dom': 3.3.4
|
||||
'@vue/reactivity': 3.3.4
|
||||
'@vue/shared': 3.3.4
|
||||
minimatch: 9.0.1
|
||||
minimatch: 9.0.5
|
||||
muggle-string: 0.3.1
|
||||
typescript: 5.2.2
|
||||
vue-template-compiler: 2.7.14
|
||||
@@ -7559,7 +7552,7 @@ packages:
|
||||
/builtins@5.0.1:
|
||||
resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==}
|
||||
dependencies:
|
||||
semver: 7.5.4
|
||||
semver: 7.6.3
|
||||
dev: true
|
||||
|
||||
/bytes.js@0.0.2:
|
||||
@@ -10524,12 +10517,6 @@ packages:
|
||||
inherits: 2.0.4
|
||||
minimalistic-assert: 1.0.1
|
||||
|
||||
/hasown@2.0.0:
|
||||
resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
function-bind: 1.1.2
|
||||
|
||||
/hasown@2.0.2:
|
||||
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -11023,7 +11010,7 @@ packages:
|
||||
/is-core-module@2.13.1:
|
||||
resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==}
|
||||
dependencies:
|
||||
hasown: 2.0.0
|
||||
hasown: 2.0.2
|
||||
|
||||
/is-data-view@1.0.2:
|
||||
resolution: {integrity: sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==}
|
||||
@@ -14367,6 +14354,7 @@ packages:
|
||||
|
||||
/semver@6.3.1:
|
||||
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
||||
hasBin: true
|
||||
|
||||
/semver@7.5.1:
|
||||
resolution: {integrity: sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==}
|
||||
@@ -16429,7 +16417,7 @@ packages:
|
||||
espree: 9.6.1
|
||||
esquery: 1.5.0
|
||||
lodash: 4.17.21
|
||||
semver: 7.5.4
|
||||
semver: 7.6.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import "./plurimath-opal.js";
|
||||
Opal.require("plurimath");
|
||||
window.Plurimath = class Plurimath {
|
||||
constructor(data, format) {
|
||||
this.data = Opal.Plurimath.Math.$parse(data, format);
|
||||
}
|
||||
toAsciimath() {
|
||||
return this.data.$to_asciimath();
|
||||
}
|
||||
toLatex() {
|
||||
return this.data.$to_latex();
|
||||
}
|
||||
toMathml() {
|
||||
return this.data.$to_mathml();
|
||||
}
|
||||
toHtml() {
|
||||
return this.data.$to_html();
|
||||
}
|
||||
toOmml() {
|
||||
return this.data.$to_omml();
|
||||
}
|
||||
toDisplay(lang) {
|
||||
return this.data.$to_display(lang);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
(function(e){var t,r,n,a,s,i,o,l;if("undefined"!=typeof globalThis?e=globalThis:"undefined"!=typeof global?e=global:"undefined"!=typeof window&&(e=window),null==e.console&&(e.console={}),"log"in(t="object"==typeof e.console?e.console:{})||(t.log=function(){}),"warn"in t||(t.warn=t.log),void 0!==e.Opal)return t.warn("Opal already loaded. Loading twice can cause troubles, please fix your setup."),e.Opal;var $=e.Opal={};$.global=e,$.config={missing_require_severity:"error",unsupported_features_severity:"warning",experimental_features_severity:"warning",enable_stack_trace:!0};var u=Function.prototype.call,c=Function.prototype.bind,_=Object.hasOwn||u.bind(Object.prototype.hasOwnProperty),p=Object.setPrototypeOf,m=u.bind(Array.prototype.slice),d=u.bind(Array.prototype.splice),f=4;function h(){return f+=2}$.uid=h,$.id=function(e){return e.$$is_number?2*e+1:(null==e.$$id&&y(e,"$$id",h()),e.$$id)};var g=$.gvars={};function b(e,t){if(e||(e=$.Exception||Error),!l||!l.$raise)throw e.$new?e.$new(t):new e(t);arguments.length>2?l.$raise(e.$new.apply(e,m(arguments,1))):l.$raise(e,t)}$.exit=function(e){g.DEBUG&&t.log("Exited with status "+e)},$.exceptions=[],$.pop_exception=function(e){var t=$.exceptions.pop();t===e||(g["!"]=t||r)};var v={value:void 0,enumerable:!1,configurable:!0,writable:!0};function y(e,t,r){"string"==typeof e?e[t]=r:(v.value=r,Object.defineProperty(e,t,v))}$.prop=y,$.defineProperty=$.prop,$.slice=m;var x=$.truthy=function(e){return!(!1===e||r===e||null==e||e instanceof Boolean&&!0!==e.valueOf())};function w(e){var t,r,n;for(t=0,r=$.tracers_for_class.length;t<r;t++)(n=$.tracers_for_class[t]).trace_object=e,n.block.$call(n)}function k(e,t){if(e.$$autoload[t].loaded){if(e.$$autoload[t].loaded&&!e.$$autoload[t].required&&e.$$autoload[t].exception)throw e.$$autoload[t].exception}else{e.$$autoload[t].loaded=!0;try{$.Kernel.$require(e.$$autoload[t].path)}catch(r){throw e.$$autoload[t].exception=r,r}if(e.$$autoload[t].required=!0,null!=e.$$const[t])return e.$$autoload[t].success=!0,e.$$const[t]}}function U(e,t){if(e){if(null!=e.$$const[t])return e.$$const[t];if(e.$$autoload&&e.$$autoload[t])return k(e,t)}}function E(e,t){var r,n,a;if(null!=e)for(r=0,n=(a=P(e)).length;r<n;r++){if(a[r].$$const&&_(a[r].$$const,t))return a[r].$$const[t];if(a[r].$$autoload&&a[r].$$autoload[t])return k(a[r],t)}}function M(e,t){return(e||a).$const_missing(t)}function q(e,t,n){var s=!0;return null!=e&&"::"!==e||(e=a),n.$$is_a_module&&(null!=n.$$name&&n.$$name!==r||(n.$$name=t),null==n.$$base_module&&(n.$$base_module=e)),e.$$const=e.$$const||Object.create(null),(t in e.$$const||"$$autoload"in e&&t in e.$$autoload)&&(s=!1),e.$$const[t]=n,e.$$=e.$$const,$.const_cache_version++,e===a&&($[t]=n),y(e,t,n),s&&e.$const_added&&!e.$const_added.$$pristine&&e.$const_added(t),n}function S(e){return null!=e&&(e.$$bridge?e:!!e.$$super&&S(e.$$super))}function O(e,t,n){var a,s;if(a=(s=S(t))?function(){var e=new(c.apply(s.$$constructor,G(null,arguments)));return p(e,a.$$prototype),e}:function(){},e&&e!==r&&y(a,"displayName","::"+e),y(a,"$$name",e),y(a,"$$constructor",a),y(a,"$$prototype",a.prototype),y(a,"$$const",{}),y(a,"$$is_class",!0),y(a,"$$is_a_module",!0),y(a,"$$super",t),y(a,"$$cvars",{}),y(a,"$$own_included_modules",[]),y(a,"$$own_prepended_modules",[]),y(a,"$$ancestors",[]),y(a,"$$ancestors_cache_version",null),y(a,"$$subclasses",[]),y(a,"$$cloned_from",[]),y(a.$$prototype,"$$class",a),$.Class&&p(a,$.Class.prototype),null!=t){if(p(a.$$prototype,t.$$prototype),!0!==n)if("undefined"!=typeof WeakRef){var i,o,l=[];for(i=0;i<t.$$subclasses.length;i++)void 0!==(o=t.$$subclasses[i]).deref()&&l.push(o);l.push(new WeakRef(a)),t.$$subclasses=l}else t.$$subclasses.push(a);t.$$meta&&$.build_class_singleton_class(a)}return a}function A(e){var t=function(){},r=t;return e&&y(t,"displayName",e+".constructor"),y(r,"$$name",e),y(r,"$$prototype",t.prototype),y(r,"$$const",{}),y(r,"$$is_module",!0),y(r,"$$is_a_module",!0),y(r,"$$cvars",{}),y(r,"$$iclasses",[]),y(r,"$$own_included_modules",[]),y(r,"$$own_prepended_modules",[]),y(r,"$$ancestors",[r]),y(r,"$$ancestors_cache_version",null),y(r,"$$cloned_from",[]),p(r,$.Module.prototype),r}function T(e,t){e.hasOwnProperty("$$meta")?e.$$meta=t:y(e,"$$meta",t),e.$$frozen?e.$$meta.$freeze():p(e,t.$$prototype)}function N(e){return e.hasOwnProperty("$$iclass")&&e.hasOwnProperty("$$root")}function z(e){var t=R(e);return e.$$is_module&&e.$$iclasses.push(t),t}function R(e){var t={},r=e.$$prototype;r.hasOwnProperty("$$dummy")&&(r=r.$$define_methods_on);var n,a=Object.getOwnPropertyNames(r),s=a.length;for(n=0;n<s;n++){var i=a[n];y(t,i,r[i])}return y(t,"$$iclass",!0),y(t,"$$module",e),t}function I(e){var t=e.length,r=e[0];if(y(r,"$$root",!0),1===t)return{first:r,last:r};for(var n=r,a=1;a<t;a++){var s=e[a];p(n,s),n=s}return{first:e[0],last:e[t-1]}}function C(e){if(!e.hasOwnProperty("$$dummy"))return e.hasOwnProperty("$$iclass")?e.$$module:e.hasOwnProperty("$$class")?e.$$class:void 0}function P(e){if(!e)return[];if(e.$$ancestors_cLine truncated
|
||||
//# sourceMappingURL=plurimath-opal.js.map
|
||||
@@ -1,7 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import Plurimath from '@plurimath/plurimath';
|
||||
import { useScriptTag } from '@vueuse/core';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
const { load: loadPlurimath } = useScriptTag('/plurimath/index.js', undefined, { type: 'module', manual: true });
|
||||
|
||||
const formats = [
|
||||
{ value: 'asciimath', label: 'AsciiMath' },
|
||||
{ value: 'latex', label: 'Latex' },
|
||||
@@ -17,12 +19,13 @@ const target = computedAsync(async () => {
|
||||
const sourceValue = source.value;
|
||||
const sourceFormatValue = sourceFormat.value;
|
||||
const targetFormatValue = targetFormat.value;
|
||||
if (sourceValue === '') {
|
||||
if (!sourceValue) {
|
||||
return '';
|
||||
}
|
||||
if (sourceFormatValue === targetFormatValue) {
|
||||
return sourceValue;
|
||||
}
|
||||
await loadPlurimath();
|
||||
return new Promise<string>((resolve, _reject) => {
|
||||
try {
|
||||
const formula = new Plurimath(sourceValue, sourceFormatValue);
|
||||
@@ -80,6 +83,6 @@ const target = computedAsync(async () => {
|
||||
:options="formats"
|
||||
placeholder="Source format"
|
||||
/>
|
||||
<textarea-copyable v-if="target !== ''" :value="target" :language="targetFormat" />
|
||||
<textarea-copyable v-if="target" :value="target" :language="targetFormat" word-wrap />
|
||||
</div>
|
||||
</template>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Plurimath {
|
||||
constructor(data: string, format: string);
|
||||
toAsciimath(): string;
|
||||
toLatex(): string;
|
||||
toMathml(): string;
|
||||
toHtml(): string;
|
||||
toOmml(): string;
|
||||
toDisplay(lang: string): string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Plurimath: Plurimath
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user