mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
remove Numi brand mentions from code and lockfile
This commit is contained in:
parent
c6e664cbe6
commit
ec09c93770
10 changed files with 15 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -4,7 +4,7 @@ src-tauri/target/
|
||||||
src-tauri/gen/
|
src-tauri/gen/
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
# local reference copy of the original macOS Numi bundle — not ours to ship
|
# local reference copy of a third-party macOS bundle — not ours to ship
|
||||||
Contents/
|
Contents/
|
||||||
|
|
||||||
# one-off debugging artifacts
|
# one-off debugging artifacts
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "numi-windows",
|
"name": "summarum",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "numi-windows",
|
"name": "summarum",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "^6.18.0",
|
"@codemirror/autocomplete": "^6.18.0",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// Summarum extension example.
|
// Summarum extension example.
|
||||||
// Drop .js files into this folder and restart the app.
|
// Drop .js files into this folder and restart the app.
|
||||||
// The API is compatible with Numi extensions: numi.setVariable,
|
// API: numi.setVariable, numi.addUnit, numi.addFunction.
|
||||||
// numi.addUnit, numi.addFunction.
|
|
||||||
|
|
||||||
// A global variable usable on any sheet, e.g. `salary * vat`
|
// A global variable usable on any sheet, e.g. `salary * vat`
|
||||||
// numi.setVariable("vat", { "double": 20 });
|
// numi.setVariable("vat", { "double": 20 });
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ describe("edge cases", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("extra units (beyond original Numi)", () => {
|
describe("extra units", () => {
|
||||||
it("speed", () => {
|
it("speed", () => {
|
||||||
expect(calc("100 km/h in mph")).toBe("62.14 mph");
|
expect(calc("100 km/h in mph")).toBe("62.14 mph");
|
||||||
expect(calc("60 mph in km/h")).toBe("96.56 km/h");
|
expect(calc("60 mph in km/h")).toBe("96.56 km/h");
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ describe("arithmetic", () => {
|
||||||
it("scales", () => {
|
it("scales", () => {
|
||||||
expect(calc("1.5 million")).toBe("1,500,000");
|
expect(calc("1.5 million")).toBe("1,500,000");
|
||||||
expect(calc("5k")).toBe("5,000");
|
expect(calc("5k")).toBe("5,000");
|
||||||
expect(calc("2 dozen")).toBe("2"); // dozen is not in Numi vocab — noise
|
expect(calc("2 dozen")).toBe("2"); // dozen is not in the vocab — noise
|
||||||
});
|
});
|
||||||
it("free text around math is ignored", () => {
|
it("free text around math is ignored", () => {
|
||||||
expect(calc("I spent 20 on pizza plus 5 on coffee")).toBe("25");
|
expect(calc("I spent 20 on pizza plus 5 on coffee")).toBe("25");
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ function evalAgg(name: "sum" | "avg" | "prev", ctx: EvalCtx): Value {
|
||||||
acc = numericAdd(acc, item, 1);
|
acc = numericAdd(acc, item, 1);
|
||||||
counted++;
|
counted++;
|
||||||
} catch {
|
} catch {
|
||||||
// skip lines with incompatible dimensions, as Numi does
|
// skip lines with incompatible dimensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name === "avg") return qty(acc.value.div(counted), acc.unit);
|
if (name === "avg") return qty(acc.value.div(counted), acc.unit);
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ export function buildRegistry(): Registry {
|
||||||
reg.addPhrase("mod", { t: "op", op: "mod" }, { caseSensitive: false });
|
reg.addPhrase("mod", { t: "op", op: "mod" }, { caseSensitive: false });
|
||||||
reg.addPhrase("modulo", { t: "op", op: "mod" }, { caseSensitive: false });
|
reg.addPhrase("modulo", { t: "op", op: "mod" }, { caseSensitive: false });
|
||||||
|
|
||||||
// bitwise: "and" stays an addition word (original Numi), so & | xor shl shr
|
// bitwise: "and" stays an addition word, so & | xor shl shr
|
||||||
reg.addPhrase("xor", { t: "bitop", op: "bxor" }, { caseSensitive: false });
|
reg.addPhrase("xor", { t: "bitop", op: "bxor" }, { caseSensitive: false });
|
||||||
reg.addPhrase("or", { t: "bitop", op: "bor" }, { caseSensitive: false });
|
reg.addPhrase("or", { t: "bitop", op: "bor" }, { caseSensitive: false });
|
||||||
reg.addPhrase("shl", { t: "bitop", op: "shl" }, { caseSensitive: false });
|
reg.addPhrase("shl", { t: "bitop", op: "shl" }, { caseSensitive: false });
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// JS extensions runtime (Numi-compatible API): numi.setVariable,
|
// JS extensions runtime: numi.setVariable,
|
||||||
// numi.addUnit, numi.addFunction. Scripts share the engine's JS runtime.
|
// numi.addUnit, numi.addFunction. Scripts share the engine's JS runtime.
|
||||||
import { SumEngine, ExtensionUnitSpec, ExtensionValue } from "./engine";
|
import { SumEngine, ExtensionUnitSpec, ExtensionValue } from "./engine";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -433,9 +433,9 @@ function toast(msg: string): void {
|
||||||
|
|
||||||
async function boot(): Promise<void> {
|
async function boot(): Promise<void> {
|
||||||
settings = await loadSettings();
|
settings = await loadSettings();
|
||||||
if (!localStorage.getItem("numi.langInit") && settings.language === "en") {
|
if (!localStorage.getItem("summarum.langInit") && settings.language === "en") {
|
||||||
settings.language = detectLang();
|
settings.language = detectLang();
|
||||||
localStorage.setItem("numi.langInit", "1");
|
localStorage.setItem("summarum.langInit", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
engine = new SumEngine({ precision: settings.precision, groupSeparator: settings.groupSeparator });
|
engine = new SumEngine({ precision: settings.precision, groupSeparator: settings.groupSeparator });
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export async function loadSettings(): Promise<SettingsData> {
|
||||||
try {
|
try {
|
||||||
const raw = isTauri()
|
const raw = isTauri()
|
||||||
? await invoke<string | null>("load_file", { name: "settings.json" })
|
? await invoke<string | null>("load_file", { name: "settings.json" })
|
||||||
: localStorage.getItem("numi.settings");
|
: localStorage.getItem("summarum.settings");
|
||||||
if (raw) return { ...defaultSettingsData, ...JSON.parse(raw) };
|
if (raw) return { ...defaultSettingsData, ...JSON.parse(raw) };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("loadSettings failed", e);
|
console.warn("loadSettings failed", e);
|
||||||
|
|
@ -77,7 +77,7 @@ export async function loadSettings(): Promise<SettingsData> {
|
||||||
export async function saveSettings(s: SettingsData): Promise<void> {
|
export async function saveSettings(s: SettingsData): Promise<void> {
|
||||||
const raw = JSON.stringify(s, null, 2);
|
const raw = JSON.stringify(s, null, 2);
|
||||||
if (isTauri()) await invoke("save_file", { name: "settings.json", contents: raw });
|
if (isTauri()) await invoke("save_file", { name: "settings.json", contents: raw });
|
||||||
else localStorage.setItem("numi.settings", raw);
|
else localStorage.setItem("summarum.settings", raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- documents
|
// ---------- documents
|
||||||
|
|
@ -86,7 +86,7 @@ export async function loadAppData(dataDir: string): Promise<AppData | null> {
|
||||||
try {
|
try {
|
||||||
const raw = isTauri()
|
const raw = isTauri()
|
||||||
? await invoke<string | null>("load_documents", { dir: dirArg(dataDir) })
|
? await invoke<string | null>("load_documents", { dir: dirArg(dataDir) })
|
||||||
: localStorage.getItem("numi.documents");
|
: localStorage.getItem("summarum.documents");
|
||||||
if (raw) return JSON.parse(raw);
|
if (raw) return JSON.parse(raw);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("loadAppData failed", e);
|
console.warn("loadAppData failed", e);
|
||||||
|
|
@ -120,7 +120,7 @@ export async function flushAppData(): Promise<void> {
|
||||||
pendingData = null;
|
pendingData = null;
|
||||||
try {
|
try {
|
||||||
if (isTauri()) await invoke("save_documents", { dir: dirArg(currentDataDir), contents: raw });
|
if (isTauri()) await invoke("save_documents", { dir: dirArg(currentDataDir), contents: raw });
|
||||||
else localStorage.setItem("numi.documents", raw);
|
else localStorage.setItem("summarum.documents", raw);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("saveAppData failed", e);
|
console.warn("saveAppData failed", e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue