You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2399 lines
81 KiB
2399 lines
81 KiB
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
"use strict";
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
var __publicField = (obj, key, value) => {
|
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
return value;
|
|
};
|
|
|
|
// src/main.ts
|
|
var main_exports = {};
|
|
__export(main_exports, {
|
|
default: () => main_default
|
|
});
|
|
module.exports = __toCommonJS(main_exports);
|
|
|
|
// src/plugin.ts
|
|
var import_obsidian6 = require("obsidian");
|
|
|
|
// node_modules/solid-js/dist/solid.js
|
|
var sharedConfig = {};
|
|
function setHydrateContext(context) {
|
|
sharedConfig.context = context;
|
|
}
|
|
function nextHydrateContext() {
|
|
return {
|
|
...sharedConfig.context,
|
|
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
count: 0
|
|
};
|
|
}
|
|
var equalFn = (a, b) => a === b;
|
|
var $PROXY = Symbol("solid-proxy");
|
|
var $TRACK = Symbol("solid-track");
|
|
var $DEVCOMP = Symbol("solid-dev-component");
|
|
var signalOptions = {
|
|
equals: equalFn
|
|
};
|
|
var ERROR = null;
|
|
var runEffects = runQueue;
|
|
var STALE = 1;
|
|
var PENDING = 2;
|
|
var UNOWNED = {
|
|
owned: null,
|
|
cleanups: null,
|
|
context: null,
|
|
owner: null
|
|
};
|
|
var Owner = null;
|
|
var Transition = null;
|
|
var Scheduler = null;
|
|
var ExternalSourceFactory = null;
|
|
var Listener = null;
|
|
var Updates = null;
|
|
var Effects = null;
|
|
var ExecCount = 0;
|
|
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
function createRoot(fn, detachedOwner) {
|
|
const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned ? UNOWNED : {
|
|
owned: null,
|
|
cleanups: null,
|
|
context: null,
|
|
owner: detachedOwner || owner
|
|
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
Owner = root;
|
|
Listener = null;
|
|
try {
|
|
return runUpdates(updateFn, true);
|
|
} finally {
|
|
Listener = listener;
|
|
Owner = owner;
|
|
}
|
|
}
|
|
function createSignal(value, options) {
|
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
const s = {
|
|
value,
|
|
observers: null,
|
|
observerSlots: null,
|
|
comparator: options.equals || void 0
|
|
};
|
|
const setter = (value2) => {
|
|
if (typeof value2 === "function") {
|
|
if (Transition && Transition.running && Transition.sources.has(s))
|
|
value2 = value2(s.tValue);
|
|
else
|
|
value2 = value2(s.value);
|
|
}
|
|
return writeSignal(s, value2);
|
|
};
|
|
return [readSignal.bind(s), setter];
|
|
}
|
|
function createRenderEffect(fn, value, options) {
|
|
const c = createComputation(fn, value, false, STALE);
|
|
if (Scheduler && Transition && Transition.running)
|
|
Updates.push(c);
|
|
else
|
|
updateComputation(c);
|
|
}
|
|
function createEffect(fn, value, options) {
|
|
runEffects = runUserEffects;
|
|
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && lookup(Owner, SuspenseContext.id);
|
|
if (s)
|
|
c.suspense = s;
|
|
c.user = true;
|
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
}
|
|
function createMemo(fn, value, options) {
|
|
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
const c = createComputation(fn, value, true, 0);
|
|
c.observers = null;
|
|
c.observerSlots = null;
|
|
c.comparator = options.equals || void 0;
|
|
if (Scheduler && Transition && Transition.running) {
|
|
c.tState = STALE;
|
|
Updates.push(c);
|
|
} else
|
|
updateComputation(c);
|
|
return readSignal.bind(c);
|
|
}
|
|
function untrack(fn) {
|
|
const listener = Listener;
|
|
Listener = null;
|
|
try {
|
|
return fn();
|
|
} finally {
|
|
Listener = listener;
|
|
}
|
|
}
|
|
function onMount(fn) {
|
|
createEffect(() => untrack(fn));
|
|
}
|
|
function onCleanup(fn) {
|
|
if (Owner === null)
|
|
;
|
|
else if (Owner.cleanups === null)
|
|
Owner.cleanups = [fn];
|
|
else
|
|
Owner.cleanups.push(fn);
|
|
return fn;
|
|
}
|
|
function onError(fn) {
|
|
ERROR || (ERROR = Symbol("error"));
|
|
if (Owner === null)
|
|
;
|
|
else if (Owner.context === null)
|
|
Owner.context = {
|
|
[ERROR]: [fn]
|
|
};
|
|
else if (!Owner.context[ERROR])
|
|
Owner.context[ERROR] = [fn];
|
|
else
|
|
Owner.context[ERROR].push(fn);
|
|
}
|
|
function startTransition(fn) {
|
|
if (Transition && Transition.running) {
|
|
fn();
|
|
return Transition.done;
|
|
}
|
|
const l = Listener;
|
|
const o = Owner;
|
|
return Promise.resolve().then(() => {
|
|
Listener = l;
|
|
Owner = o;
|
|
let t;
|
|
if (Scheduler || SuspenseContext) {
|
|
t = Transition || (Transition = {
|
|
sources: /* @__PURE__ */ new Set(),
|
|
effects: [],
|
|
promises: /* @__PURE__ */ new Set(),
|
|
disposed: /* @__PURE__ */ new Set(),
|
|
queue: /* @__PURE__ */ new Set(),
|
|
running: true
|
|
});
|
|
t.done || (t.done = new Promise((res) => t.resolve = res));
|
|
t.running = true;
|
|
}
|
|
runUpdates(fn, false);
|
|
Listener = Owner = null;
|
|
return t ? t.done : void 0;
|
|
});
|
|
}
|
|
function createContext(defaultValue, options) {
|
|
const id = Symbol("context");
|
|
return {
|
|
id,
|
|
Provider: createProvider(id),
|
|
defaultValue
|
|
};
|
|
}
|
|
function useContext(context) {
|
|
let ctx;
|
|
return (ctx = lookup(Owner, context.id)) !== void 0 ? ctx : context.defaultValue;
|
|
}
|
|
function children(fn) {
|
|
const children2 = createMemo(fn);
|
|
const memo = createMemo(() => resolveChildren(children2()));
|
|
memo.toArray = () => {
|
|
const c = memo();
|
|
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
};
|
|
return memo;
|
|
}
|
|
var SuspenseContext;
|
|
function readSignal() {
|
|
const runningTransition = Transition && Transition.running;
|
|
if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
|
|
if (!runningTransition && this.state === STALE || runningTransition && this.tState === STALE)
|
|
updateComputation(this);
|
|
else {
|
|
const updates = Updates;
|
|
Updates = null;
|
|
runUpdates(() => lookUpstream(this), false);
|
|
Updates = updates;
|
|
}
|
|
}
|
|
if (Listener) {
|
|
const sSlot = this.observers ? this.observers.length : 0;
|
|
if (!Listener.sources) {
|
|
Listener.sources = [this];
|
|
Listener.sourceSlots = [sSlot];
|
|
} else {
|
|
Listener.sources.push(this);
|
|
Listener.sourceSlots.push(sSlot);
|
|
}
|
|
if (!this.observers) {
|
|
this.observers = [Listener];
|
|
this.observerSlots = [Listener.sources.length - 1];
|
|
} else {
|
|
this.observers.push(Listener);
|
|
this.observerSlots.push(Listener.sources.length - 1);
|
|
}
|
|
}
|
|
if (runningTransition && Transition.sources.has(this))
|
|
return this.tValue;
|
|
return this.value;
|
|
}
|
|
function writeSignal(node, value, isComp) {
|
|
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
if (Transition) {
|
|
const TransitionRunning = Transition.running;
|
|
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
Transition.sources.add(node);
|
|
node.tValue = value;
|
|
}
|
|
if (!TransitionRunning)
|
|
node.value = value;
|
|
} else
|
|
node.value = value;
|
|
if (node.observers && node.observers.length) {
|
|
runUpdates(() => {
|
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
const o = node.observers[i];
|
|
const TransitionRunning = Transition && Transition.running;
|
|
if (TransitionRunning && Transition.disposed.has(o))
|
|
continue;
|
|
if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) {
|
|
if (o.pure)
|
|
Updates.push(o);
|
|
else
|
|
Effects.push(o);
|
|
if (o.observers)
|
|
markDownstream(o);
|
|
}
|
|
if (TransitionRunning)
|
|
o.tState = STALE;
|
|
else
|
|
o.state = STALE;
|
|
}
|
|
if (Updates.length > 1e6) {
|
|
Updates = [];
|
|
if (false)
|
|
;
|
|
throw new Error();
|
|
}
|
|
}, false);
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
function updateComputation(node) {
|
|
if (!node.fn)
|
|
return;
|
|
cleanNode(node);
|
|
const owner = Owner, listener = Listener, time = ExecCount;
|
|
Listener = Owner = node;
|
|
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
queueMicrotask(() => {
|
|
runUpdates(() => {
|
|
Transition && (Transition.running = true);
|
|
Listener = Owner = node;
|
|
runComputation(node, node.tValue, time);
|
|
Listener = Owner = null;
|
|
}, false);
|
|
});
|
|
}
|
|
Listener = listener;
|
|
Owner = owner;
|
|
}
|
|
function runComputation(node, value, time) {
|
|
let nextValue;
|
|
try {
|
|
nextValue = node.fn(value);
|
|
} catch (err) {
|
|
if (node.pure) {
|
|
if (Transition && Transition.running) {
|
|
node.tState = STALE;
|
|
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
node.tOwned = void 0;
|
|
} else {
|
|
node.state = STALE;
|
|
node.owned && node.owned.forEach(cleanNode);
|
|
node.owned = null;
|
|
}
|
|
}
|
|
handleError(err);
|
|
}
|
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
if (node.updatedAt != null && "observers" in node) {
|
|
writeSignal(node, nextValue, true);
|
|
} else if (Transition && Transition.running && node.pure) {
|
|
Transition.sources.add(node);
|
|
node.tValue = nextValue;
|
|
} else
|
|
node.value = nextValue;
|
|
node.updatedAt = time;
|
|
}
|
|
}
|
|
function createComputation(fn, init, pure, state = STALE, options) {
|
|
const c = {
|
|
fn,
|
|
state,
|
|
updatedAt: null,
|
|
owned: null,
|
|
sources: null,
|
|
sourceSlots: null,
|
|
cleanups: null,
|
|
value: init,
|
|
owner: Owner,
|
|
context: null,
|
|
pure
|
|
};
|
|
if (Transition && Transition.running) {
|
|
c.state = 0;
|
|
c.tState = state;
|
|
}
|
|
if (Owner === null)
|
|
;
|
|
else if (Owner !== UNOWNED) {
|
|
if (Transition && Transition.running && Owner.pure) {
|
|
if (!Owner.tOwned)
|
|
Owner.tOwned = [c];
|
|
else
|
|
Owner.tOwned.push(c);
|
|
} else {
|
|
if (!Owner.owned)
|
|
Owner.owned = [c];
|
|
else
|
|
Owner.owned.push(c);
|
|
}
|
|
}
|
|
if (ExternalSourceFactory) {
|
|
const [track, trigger] = createSignal(void 0, {
|
|
equals: false
|
|
});
|
|
const ordinary = ExternalSourceFactory(c.fn, trigger);
|
|
onCleanup(() => ordinary.dispose());
|
|
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
|
|
c.fn = (x) => {
|
|
track();
|
|
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
};
|
|
}
|
|
return c;
|
|
}
|
|
function runTop(node) {
|
|
const runningTransition = Transition && Transition.running;
|
|
if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0)
|
|
return;
|
|
if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING)
|
|
return lookUpstream(node);
|
|
if (node.suspense && untrack(node.suspense.inFallback))
|
|
return node.suspense.effects.push(node);
|
|
const ancestors = [node];
|
|
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
if (runningTransition && Transition.disposed.has(node))
|
|
return;
|
|
if (!runningTransition && node.state || runningTransition && node.tState)
|
|
ancestors.push(node);
|
|
}
|
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
node = ancestors[i];
|
|
if (runningTransition) {
|
|
let top = node, prev = ancestors[i + 1];
|
|
while ((top = top.owner) && top !== prev) {
|
|
if (Transition.disposed.has(top))
|
|
return;
|
|
}
|
|
}
|
|
if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) {
|
|
updateComputation(node);
|
|
} else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) {
|
|
const updates = Updates;
|
|
Updates = null;
|
|
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
Updates = updates;
|
|
}
|
|
}
|
|
}
|
|
function runUpdates(fn, init) {
|
|
if (Updates)
|
|
return fn();
|
|
let wait = false;
|
|
if (!init)
|
|
Updates = [];
|
|
if (Effects)
|
|
wait = true;
|
|
else
|
|
Effects = [];
|
|
ExecCount++;
|
|
try {
|
|
const res = fn();
|
|
completeUpdates(wait);
|
|
return res;
|
|
} catch (err) {
|
|
if (!Updates)
|
|
Effects = null;
|
|
handleError(err);
|
|
}
|
|
}
|
|
function completeUpdates(wait) {
|
|
if (Updates) {
|
|
if (Scheduler && Transition && Transition.running)
|
|
scheduleQueue(Updates);
|
|
else
|
|
runQueue(Updates);
|
|
Updates = null;
|
|
}
|
|
if (wait)
|
|
return;
|
|
let res;
|
|
if (Transition) {
|
|
if (!Transition.promises.size && !Transition.queue.size) {
|
|
const sources = Transition.sources;
|
|
const disposed = Transition.disposed;
|
|
Effects.push.apply(Effects, Transition.effects);
|
|
res = Transition.resolve;
|
|
for (const e2 of Effects) {
|
|
"tState" in e2 && (e2.state = e2.tState);
|
|
delete e2.tState;
|
|
}
|
|
Transition = null;
|
|
runUpdates(() => {
|
|
for (const d of disposed)
|
|
cleanNode(d);
|
|
for (const v of sources) {
|
|
v.value = v.tValue;
|
|
if (v.owned) {
|
|
for (let i = 0, len = v.owned.length; i < len; i++)
|
|
cleanNode(v.owned[i]);
|
|
}
|
|
if (v.tOwned)
|
|
v.owned = v.tOwned;
|
|
delete v.tValue;
|
|
delete v.tOwned;
|
|
v.tState = 0;
|
|
}
|
|
setTransPending(false);
|
|
}, false);
|
|
} else if (Transition.running) {
|
|
Transition.running = false;
|
|
Transition.effects.push.apply(Transition.effects, Effects);
|
|
Effects = null;
|
|
setTransPending(true);
|
|
return;
|
|
}
|
|
}
|
|
const e = Effects;
|
|
Effects = null;
|
|
if (e.length)
|
|
runUpdates(() => runEffects(e), false);
|
|
if (res)
|
|
res();
|
|
}
|
|
function runQueue(queue) {
|
|
for (let i = 0; i < queue.length; i++)
|
|
runTop(queue[i]);
|
|
}
|
|
function scheduleQueue(queue) {
|
|
for (let i = 0; i < queue.length; i++) {
|
|
const item = queue[i];
|
|
const tasks = Transition.queue;
|
|
if (!tasks.has(item)) {
|
|
tasks.add(item);
|
|
Scheduler(() => {
|
|
tasks.delete(item);
|
|
runUpdates(() => {
|
|
Transition.running = true;
|
|
runTop(item);
|
|
}, false);
|
|
Transition && (Transition.running = false);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function runUserEffects(queue) {
|
|
let i, userLength = 0;
|
|
for (i = 0; i < queue.length; i++) {
|
|
const e = queue[i];
|
|
if (!e.user)
|
|
runTop(e);
|
|
else
|
|
queue[userLength++] = e;
|
|
}
|
|
if (sharedConfig.context)
|
|
setHydrateContext();
|
|
for (i = 0; i < userLength; i++)
|
|
runTop(queue[i]);
|
|
}
|
|
function lookUpstream(node, ignore) {
|
|
const runningTransition = Transition && Transition.running;
|
|
if (runningTransition)
|
|
node.tState = 0;
|
|
else
|
|
node.state = 0;
|
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
const source = node.sources[i];
|
|
if (source.sources) {
|
|
if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) {
|
|
if (source !== ignore)
|
|
runTop(source);
|
|
} else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING)
|
|
lookUpstream(source, ignore);
|
|
}
|
|
}
|
|
}
|
|
function markDownstream(node) {
|
|
const runningTransition = Transition && Transition.running;
|
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
const o = node.observers[i];
|
|
if (!runningTransition && !o.state || runningTransition && !o.tState) {
|
|
if (runningTransition)
|
|
o.tState = PENDING;
|
|
else
|
|
o.state = PENDING;
|
|
if (o.pure)
|
|
Updates.push(o);
|
|
else
|
|
Effects.push(o);
|
|
o.observers && markDownstream(o);
|
|
}
|
|
}
|
|
}
|
|
function cleanNode(node) {
|
|
let i;
|
|
if (node.sources) {
|
|
while (node.sources.length) {
|
|
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
if (obs && obs.length) {
|
|
const n = obs.pop(), s = source.observerSlots.pop();
|
|
if (index < obs.length) {
|
|
n.sourceSlots[s] = index;
|
|
obs[index] = n;
|
|
source.observerSlots[index] = s;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Transition && Transition.running && node.pure) {
|
|
if (node.tOwned) {
|
|
for (i = 0; i < node.tOwned.length; i++)
|
|
cleanNode(node.tOwned[i]);
|
|
delete node.tOwned;
|
|
}
|
|
reset(node, true);
|
|
} else if (node.owned) {
|
|
for (i = 0; i < node.owned.length; i++)
|
|
cleanNode(node.owned[i]);
|
|
node.owned = null;
|
|
}
|
|
if (node.cleanups) {
|
|
for (i = 0; i < node.cleanups.length; i++)
|
|
node.cleanups[i]();
|
|
node.cleanups = null;
|
|
}
|
|
if (Transition && Transition.running)
|
|
node.tState = 0;
|
|
else
|
|
node.state = 0;
|
|
node.context = null;
|
|
}
|
|
function reset(node, top) {
|
|
if (!top) {
|
|
node.tState = 0;
|
|
Transition.disposed.add(node);
|
|
}
|
|
if (node.owned) {
|
|
for (let i = 0; i < node.owned.length; i++)
|
|
reset(node.owned[i]);
|
|
}
|
|
}
|
|
function castError(err) {
|
|
if (err instanceof Error || typeof err === "string")
|
|
return err;
|
|
return new Error("Unknown error");
|
|
}
|
|
function handleError(err) {
|
|
err = castError(err);
|
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
if (!fns)
|
|
throw err;
|
|
for (const f of fns)
|
|
f(err);
|
|
}
|
|
function lookup(owner, key) {
|
|
return owner ? owner.context && owner.context[key] !== void 0 ? owner.context[key] : lookup(owner.owner, key) : void 0;
|
|
}
|
|
function resolveChildren(children2) {
|
|
if (typeof children2 === "function" && !children2.length)
|
|
return resolveChildren(children2());
|
|
if (Array.isArray(children2)) {
|
|
const results = [];
|
|
for (let i = 0; i < children2.length; i++) {
|
|
const result = resolveChildren(children2[i]);
|
|
Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
|
|
}
|
|
return results;
|
|
}
|
|
return children2;
|
|
}
|
|
function createProvider(id, options) {
|
|
return function provider(props) {
|
|
let res;
|
|
createRenderEffect(() => res = untrack(() => {
|
|
Owner.context = {
|
|
[id]: props.value
|
|
};
|
|
return children(() => props.children);
|
|
}), void 0);
|
|
return res;
|
|
};
|
|
}
|
|
var FALLBACK = Symbol("fallback");
|
|
function dispose(d) {
|
|
for (let i = 0; i < d.length; i++)
|
|
d[i]();
|
|
}
|
|
function mapArray(list, mapFn, options = {}) {
|
|
let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
|
|
onCleanup(() => dispose(disposers));
|
|
return () => {
|
|
let newItems = list() || [], i, j;
|
|
newItems[$TRACK];
|
|
return untrack(() => {
|
|
let newLen = newItems.length, newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
if (newLen === 0) {
|
|
if (len !== 0) {
|
|
dispose(disposers);
|
|
disposers = [];
|
|
items = [];
|
|
mapped = [];
|
|
len = 0;
|
|
indexes && (indexes = []);
|
|
}
|
|
if (options.fallback) {
|
|
items = [FALLBACK];
|
|
mapped[0] = createRoot((disposer) => {
|
|
disposers[0] = disposer;
|
|
return options.fallback();
|
|
});
|
|
len = 1;
|
|
}
|
|
} else if (len === 0) {
|
|
mapped = new Array(newLen);
|
|
for (j = 0; j < newLen; j++) {
|
|
items[j] = newItems[j];
|
|
mapped[j] = createRoot(mapper);
|
|
}
|
|
len = newLen;
|
|
} else {
|
|
temp = new Array(newLen);
|
|
tempdisposers = new Array(newLen);
|
|
indexes && (tempIndexes = new Array(newLen));
|
|
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++)
|
|
;
|
|
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
temp[newEnd] = mapped[end];
|
|
tempdisposers[newEnd] = disposers[end];
|
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
}
|
|
newIndices = /* @__PURE__ */ new Map();
|
|
newIndicesNext = new Array(newEnd + 1);
|
|
for (j = newEnd; j >= start; j--) {
|
|
item = newItems[j];
|
|
i = newIndices.get(item);
|
|
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
newIndices.set(item, j);
|
|
}
|
|
for (i = start; i <= end; i++) {
|
|
item = items[i];
|
|
j = newIndices.get(item);
|
|
if (j !== void 0 && j !== -1) {
|
|
temp[j] = mapped[i];
|
|
tempdisposers[j] = disposers[i];
|
|
indexes && (tempIndexes[j] = indexes[i]);
|
|
j = newIndicesNext[j];
|
|
newIndices.set(item, j);
|
|
} else
|
|
disposers[i]();
|
|
}
|
|
for (j = start; j < newLen; j++) {
|
|
if (j in temp) {
|
|
mapped[j] = temp[j];
|
|
disposers[j] = tempdisposers[j];
|
|
if (indexes) {
|
|
indexes[j] = tempIndexes[j];
|
|
indexes[j](j);
|
|
}
|
|
} else
|
|
mapped[j] = createRoot(mapper);
|
|
}
|
|
mapped = mapped.slice(0, len = newLen);
|
|
items = newItems.slice(0);
|
|
}
|
|
return mapped;
|
|
});
|
|
function mapper(disposer) {
|
|
disposers[j] = disposer;
|
|
if (indexes) {
|
|
const [s, set] = createSignal(j);
|
|
indexes[j] = set;
|
|
return mapFn(newItems[j], s);
|
|
}
|
|
return mapFn(newItems[j]);
|
|
}
|
|
};
|
|
}
|
|
var hydrationEnabled = false;
|
|
function createComponent(Comp, props) {
|
|
if (hydrationEnabled) {
|
|
if (sharedConfig.context) {
|
|
const c = sharedConfig.context;
|
|
setHydrateContext(nextHydrateContext());
|
|
const r = untrack(() => Comp(props || {}));
|
|
setHydrateContext(c);
|
|
return r;
|
|
}
|
|
}
|
|
return untrack(() => Comp(props || {}));
|
|
}
|
|
function For(props) {
|
|
const fallback = "fallback" in props && {
|
|
fallback: () => props.fallback
|
|
};
|
|
return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
|
|
}
|
|
function Show(props) {
|
|
let strictEqual = false;
|
|
const keyed = props.keyed;
|
|
const condition = createMemo(() => props.when, void 0, {
|
|
equals: (a, b) => strictEqual ? a === b : !a === !b
|
|
});
|
|
return createMemo(() => {
|
|
const c = condition();
|
|
if (c) {
|
|
const child = props.children;
|
|
const fn = typeof child === "function" && child.length > 0;
|
|
strictEqual = keyed || fn;
|
|
return fn ? untrack(() => child(c)) : child;
|
|
}
|
|
return props.fallback;
|
|
}, void 0, void 0);
|
|
}
|
|
function Switch(props) {
|
|
let strictEqual = false;
|
|
let keyed = false;
|
|
const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
const conditions = children(() => props.children), evalConditions = createMemo(() => {
|
|
let conds = conditions();
|
|
if (!Array.isArray(conds))
|
|
conds = [conds];
|
|
for (let i = 0; i < conds.length; i++) {
|
|
const c = conds[i].when;
|
|
if (c) {
|
|
keyed = !!conds[i].keyed;
|
|
return [i, c, conds[i]];
|
|
}
|
|
}
|
|
return [-1];
|
|
}, void 0, {
|
|
equals
|
|
});
|
|
return createMemo(() => {
|
|
const [index, when, cond] = evalConditions();
|
|
if (index < 0)
|
|
return props.fallback;
|
|
const c = cond.children;
|
|
const fn = typeof c === "function" && c.length > 0;
|
|
strictEqual = keyed || fn;
|
|
return fn ? untrack(() => c(when)) : c;
|
|
}, void 0, void 0);
|
|
}
|
|
function Match(props) {
|
|
return props;
|
|
}
|
|
var Errors;
|
|
function ErrorBoundary(props) {
|
|
let err;
|
|
let v;
|
|
if (sharedConfig.context && sharedConfig.load && (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count)))
|
|
err = v[0];
|
|
const [errored, setErrored] = createSignal(err, void 0);
|
|
Errors || (Errors = /* @__PURE__ */ new Set());
|
|
Errors.add(setErrored);
|
|
onCleanup(() => Errors.delete(setErrored));
|
|
return createMemo(() => {
|
|
let e;
|
|
if (e = errored()) {
|
|
const f = props.fallback;
|
|
const res = typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
onError(setErrored);
|
|
return res;
|
|
}
|
|
onError(setErrored);
|
|
return props.children;
|
|
}, void 0, void 0);
|
|
}
|
|
var SuspenseListContext = createContext();
|
|
|
|
// node_modules/solid-js/web/dist/web.js
|
|
var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
function reconcileArrays(parentNode, a, b) {
|
|
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
while (aStart < aEnd || bStart < bEnd) {
|
|
if (a[aStart] === b[bStart]) {
|
|
aStart++;
|
|
bStart++;
|
|
continue;
|
|
}
|
|
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
aEnd--;
|
|
bEnd--;
|
|
}
|
|
if (aEnd === aStart) {
|
|
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
while (bStart < bEnd)
|
|
parentNode.insertBefore(b[bStart++], node);
|
|
} else if (bEnd === bStart) {
|
|
while (aStart < aEnd) {
|
|
if (!map || !map.has(a[aStart]))
|
|
a[aStart].remove();
|
|
aStart++;
|
|
}
|
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
const node = a[--aEnd].nextSibling;
|
|
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
parentNode.insertBefore(b[--bEnd], node);
|
|
a[aEnd] = b[bEnd];
|
|
} else {
|
|
if (!map) {
|
|
map = /* @__PURE__ */ new Map();
|
|
let i = bStart;
|
|
while (i < bEnd)
|
|
map.set(b[i], i++);
|
|
}
|
|
const index = map.get(a[aStart]);
|
|
if (index != null) {
|
|
if (bStart < index && index < bEnd) {
|
|
let i = aStart, sequence = 1, t;
|
|
while (++i < aEnd && i < bEnd) {
|
|
if ((t = map.get(a[i])) == null || t !== index + sequence)
|
|
break;
|
|
sequence++;
|
|
}
|
|
if (sequence > index - bStart) {
|
|
const node = a[aStart];
|
|
while (bStart < index)
|
|
parentNode.insertBefore(b[bStart++], node);
|
|
} else
|
|
parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
} else
|
|
aStart++;
|
|
} else
|
|
a[aStart++].remove();
|
|
}
|
|
}
|
|
}
|
|
var $$EVENTS = "_$DX_DELEGATE";
|
|
function render(code, element, init, options = {}) {
|
|
let disposer;
|
|
createRoot((dispose2) => {
|
|
disposer = dispose2;
|
|
element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
|
|
}, options.owner);
|
|
return () => {
|
|
disposer();
|
|
element.textContent = "";
|
|
};
|
|
}
|
|
function template(html, check, isSVG) {
|
|
const t = document.createElement("template");
|
|
t.innerHTML = html;
|
|
let node = t.content.firstChild;
|
|
if (isSVG)
|
|
node = node.firstChild;
|
|
return node;
|
|
}
|
|
function delegateEvents(eventNames, document2 = window.document) {
|
|
const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
const name = eventNames[i];
|
|
if (!e.has(name)) {
|
|
e.add(name);
|
|
document2.addEventListener(name, eventHandler);
|
|
}
|
|
}
|
|
}
|
|
function setAttribute(node, name, value) {
|
|
if (value == null)
|
|
node.removeAttribute(name);
|
|
else
|
|
node.setAttribute(name, value);
|
|
}
|
|
function className(node, value) {
|
|
if (value == null)
|
|
node.removeAttribute("class");
|
|
else
|
|
node.className = value;
|
|
}
|
|
function use(fn, element, arg) {
|
|
return untrack(() => fn(element, arg));
|
|
}
|
|
function insert(parent, accessor, marker, initial) {
|
|
if (marker !== void 0 && !initial)
|
|
initial = [];
|
|
if (typeof accessor !== "function")
|
|
return insertExpression(parent, accessor, initial, marker);
|
|
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
|
|
}
|
|
function eventHandler(e) {
|
|
const key = `$$${e.type}`;
|
|
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
if (e.target !== node) {
|
|
Object.defineProperty(e, "target", {
|
|
configurable: true,
|
|
value: node
|
|
});
|
|
}
|
|
Object.defineProperty(e, "currentTarget", {
|
|
configurable: true,
|
|
get() {
|
|
return node || document;
|
|
}
|
|
});
|
|
if (sharedConfig.registry && !sharedConfig.done) {
|
|
sharedConfig.done = true;
|
|
document.querySelectorAll("[id^=pl-]").forEach((elem) => {
|
|
while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
|
|
let x = elem.nextSibling;
|
|
elem.remove();
|
|
elem = x;
|
|
}
|
|
elem && elem.remove();
|
|
});
|
|
}
|
|
while (node) {
|
|
const handler = node[key];
|
|
if (handler && !node.disabled) {
|
|
const data = node[`${key}Data`];
|
|
data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
|
|
if (e.cancelBubble)
|
|
return;
|
|
}
|
|
node = node._$host || node.parentNode || node.host;
|
|
}
|
|
}
|
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
if (sharedConfig.context && !current)
|
|
current = [...parent.childNodes];
|
|
while (typeof current === "function")
|
|
current = current();
|
|
if (value === current)
|
|
return current;
|
|
const t = typeof value, multi = marker !== void 0;
|
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
if (t === "string" || t === "number") {
|
|
if (sharedConfig.context)
|
|
return current;
|
|
if (t === "number")
|
|
value = value.toString();
|
|
if (multi) {
|
|
let node = current[0];
|
|
if (node && node.nodeType === 3) {
|
|
node.data = value;
|
|
} else
|
|
node = document.createTextNode(value);
|
|
current = cleanChildren(parent, current, marker, node);
|
|
} else {
|
|
if (current !== "" && typeof current === "string") {
|
|
current = parent.firstChild.data = value;
|
|
} else
|
|
current = parent.textContent = value;
|
|
}
|
|
} else if (value == null || t === "boolean") {
|
|
if (sharedConfig.context)
|
|
return current;
|
|
current = cleanChildren(parent, current, marker);
|
|
} else if (t === "function") {
|
|
createRenderEffect(() => {
|
|
let v = value();
|
|
while (typeof v === "function")
|
|
v = v();
|
|
current = insertExpression(parent, v, current, marker);
|
|
});
|
|
return () => current;
|
|
} else if (Array.isArray(value)) {
|
|
const array = [];
|
|
const currentArray = current && Array.isArray(current);
|
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
return () => current;
|
|
}
|
|
if (sharedConfig.context) {
|
|
if (!array.length)
|
|
return current;
|
|
for (let i = 0; i < array.length; i++) {
|
|
if (array[i].parentNode)
|
|
return current = array;
|
|
}
|
|
}
|
|
if (array.length === 0) {
|
|
current = cleanChildren(parent, current, marker);
|
|
if (multi)
|
|
return current;
|
|
} else if (currentArray) {
|
|
if (current.length === 0) {
|
|
appendNodes(parent, array, marker);
|
|
} else
|
|
reconcileArrays(parent, current, array);
|
|
} else {
|
|
current && cleanChildren(parent);
|
|
appendNodes(parent, array);
|
|
}
|
|
current = array;
|
|
} else if (value instanceof Node) {
|
|
if (sharedConfig.context && value.parentNode)
|
|
return current = multi ? [value] : value;
|
|
if (Array.isArray(current)) {
|
|
if (multi)
|
|
return current = cleanChildren(parent, current, marker, value);
|
|
cleanChildren(parent, current, null, value);
|
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
parent.appendChild(value);
|
|
} else
|
|
parent.replaceChild(value, parent.firstChild);
|
|
current = value;
|
|
} else
|
|
;
|
|
return current;
|
|
}
|
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
let dynamic = false;
|
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
let item = array[i], prev = current && current[i];
|
|
if (item instanceof Node) {
|
|
normalized.push(item);
|
|
} else if (item == null || item === true || item === false)
|
|
;
|
|
else if (Array.isArray(item)) {
|
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
} else if (typeof item === "function") {
|
|
if (unwrap) {
|
|
while (typeof item === "function")
|
|
item = item();
|
|
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
} else {
|
|
normalized.push(item);
|
|
dynamic = true;
|
|
}
|
|
} else {
|
|
const value = String(item);
|
|
if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
normalized.push(prev);
|
|
} else
|
|
normalized.push(document.createTextNode(value));
|
|
}
|
|
}
|
|
return dynamic;
|
|
}
|
|
function appendNodes(parent, array, marker = null) {
|
|
for (let i = 0, len = array.length; i < len; i++)
|
|
parent.insertBefore(array[i], marker);
|
|
}
|
|
function cleanChildren(parent, current, marker, replacement) {
|
|
if (marker === void 0)
|
|
return parent.textContent = "";
|
|
const node = replacement || document.createTextNode("");
|
|
if (current.length) {
|
|
let inserted = false;
|
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
const el = current[i];
|
|
if (node !== el) {
|
|
const isParent = el.parentNode === parent;
|
|
if (!inserted && !i)
|
|
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
else
|
|
isParent && el.remove();
|
|
} else
|
|
inserted = true;
|
|
}
|
|
} else
|
|
parent.insertBefore(node, marker);
|
|
return [node];
|
|
}
|
|
|
|
// src/sidebarView.tsx
|
|
var import_obsidian5 = require("obsidian");
|
|
|
|
// src/settings.ts
|
|
var import_obsidian = require("obsidian");
|
|
function isOpen(depth, mode) {
|
|
if (mode == "expanded") {
|
|
return true;
|
|
}
|
|
if (mode == "leaf-collapsed" && depth == 0) {
|
|
return true;
|
|
}
|
|
if (mode == "root-collapsed" && depth != 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
var DEFAULT_SETTINGS = {
|
|
expansionMode: "expanded",
|
|
ignoreNulls: false,
|
|
nullValue: "",
|
|
skipKey: "metatable",
|
|
filterKeys: ["metatable", "frontmatter"],
|
|
filterMode: "ignore",
|
|
autolinks: false,
|
|
naked: false,
|
|
theme: "light"
|
|
};
|
|
var MetatableSettingTab = class extends import_obsidian.PluginSettingTab {
|
|
constructor(app, plugin) {
|
|
super(app, plugin);
|
|
__publicField(this, "plugin");
|
|
this.plugin = plugin;
|
|
}
|
|
async display() {
|
|
const { containerEl, plugin } = this;
|
|
containerEl.empty();
|
|
containerEl.createEl("h2", { text: "Metatable Settings" });
|
|
new import_obsidian.Setting(containerEl).setName("Expansion level").setDesc("Level of expansion of the metatable tree").addDropdown((drop) => drop.addOption("expanded", "Fully expanded").addOption("leaf-collapsed", "Collapse leafs").addOption("all-collapsed", "Collapse all").addOption("root-collapsed", "Collapse root").setValue(plugin.settings.expansionMode).onChange(async (value) => {
|
|
plugin.settings.expansionMode = value;
|
|
await plugin.saveSettings();
|
|
}));
|
|
new import_obsidian.Setting(containerEl).setName("Skip key").setDesc("When this key is found and `true`, the metatable will not be displayed").addText((text) => text.setValue(plugin.settings.skipKey).onChange(async (value) => {
|
|
plugin.settings.skipKey = value;
|
|
await plugin.saveSettings();
|
|
}));
|
|
containerEl.createEl("h3", { text: "Nulls" });
|
|
new import_obsidian.Setting(containerEl).setName("Ignore null values").setDesc("Ignore any member with a null value.").addToggle((setting) => setting.setValue(plugin.settings.ignoreNulls).onChange(async (value) => {
|
|
plugin.settings.ignoreNulls = value;
|
|
await plugin.saveSettings();
|
|
this.display();
|
|
}));
|
|
if (!plugin.settings.ignoreNulls) {
|
|
new import_obsidian.Setting(containerEl).setName("Null value").setDesc("Text to show when a key has no value. Defaults to nothing").addText((text) => text.setValue(plugin.settings.nullValue).onChange(async (value) => {
|
|
plugin.settings.nullValue = value;
|
|
await plugin.saveSettings();
|
|
}));
|
|
}
|
|
containerEl.createEl("h3", { text: "Filter" });
|
|
new import_obsidian.Setting(containerEl).setName("Filter mode").setDesc("Either ignore or keep the filter keys").addDropdown((drop) => drop.addOption("ignore", "Ignore").addOption("keep", "Keep").setValue(plugin.settings.filterMode).onChange(async (value) => {
|
|
plugin.settings.filterMode = value;
|
|
await plugin.saveSettings();
|
|
}));
|
|
new import_obsidian.Setting(containerEl).setName("Filter keys").setDesc("Any empty field will be ignored.");
|
|
let keyset = plugin.settings.filterKeys;
|
|
let filterKeys2 = containerEl.createEl("ol");
|
|
for (const [idx, originalValue] of [...keyset].entries()) {
|
|
if (originalValue === "") {
|
|
continue;
|
|
}
|
|
addFilterInput(originalValue, filterKeys2, keyset, plugin, idx);
|
|
}
|
|
new import_obsidian.Setting(containerEl).addButton((x) => x.setButtonText("Add key").onClick(async () => {
|
|
addFilterInput("", filterKeys2, keyset, plugin, keyset.length);
|
|
}));
|
|
containerEl.createEl("h3", { text: "Experimental" });
|
|
new import_obsidian.Setting(containerEl).setName("Autolink").setDesc("Enables autolinks for wikilinks `[[target]]`, frontmatter links `%target%` and local links `./deep/target`").addToggle((setting) => setting.setValue(plugin.settings.autolinks).onChange(async (value) => {
|
|
plugin.settings.autolinks = value;
|
|
await plugin.saveSettings();
|
|
}));
|
|
new import_obsidian.Setting(containerEl).setName("Naked").setDesc("Removes the Shadow DOM and the default CSS so you can bring your own via CSS snippets.").addToggle((setting) => setting.setValue(plugin.settings.naked).onChange(async (value) => {
|
|
plugin.settings.naked = value;
|
|
await plugin.saveSettings();
|
|
}));
|
|
}
|
|
};
|
|
function addFilterInput(originalValue, el, keyset, plugin, idx) {
|
|
const item = el.createEl("li");
|
|
const input = item.createEl("input");
|
|
item.setAttribute("id", `filter-${idx}`);
|
|
input.setAttribute("type", "text");
|
|
input.setAttribute("value", originalValue);
|
|
input.setAttribute("data-prev", originalValue);
|
|
input.addEventListener("input", async (e) => {
|
|
let target = e.target;
|
|
keyset[idx] = target.value;
|
|
input.setAttribute("data-prev", target.value);
|
|
plugin.settings.filterKeys = keyset;
|
|
await plugin.saveSettings();
|
|
});
|
|
}
|
|
|
|
// src/value.ts
|
|
function isLeaf(value) {
|
|
return value === null || ["string", "number", "boolean"].some((kind) => typeof value == kind);
|
|
}
|
|
function isSet(value) {
|
|
return value !== null && typeof value == "object" && !Array.isArray(value);
|
|
}
|
|
function isEmptyValue(value) {
|
|
if (typeof value == "string" || Array.isArray(value)) {
|
|
return value.length == 0;
|
|
}
|
|
if (typeof value == "object" && value != null) {
|
|
return Object.keys(value).length == 0;
|
|
}
|
|
return value == null;
|
|
}
|
|
|
|
// src/core.ts
|
|
function observeTheme(el) {
|
|
const observer = new MutationObserver((mutationList) => {
|
|
mutationList.forEach((mutation) => {
|
|
const target = mutation.target;
|
|
if (target.hasClass("theme-light")) {
|
|
el.classList.add("light");
|
|
el.classList.remove("dark");
|
|
} else {
|
|
el.classList.add("dark");
|
|
el.classList.remove("light");
|
|
}
|
|
});
|
|
});
|
|
const body = document.querySelector("body");
|
|
observer.observe(body, { attributes: true, attributeFilter: ["class"] });
|
|
return observer;
|
|
}
|
|
function queryTheme() {
|
|
const body = document.querySelector("body");
|
|
return body.hasClass("theme-light") ? "light" : "dark";
|
|
}
|
|
function cleanData(data, settings) {
|
|
if (data === void 0 || data === null) {
|
|
return;
|
|
}
|
|
if (typeof data == "string") {
|
|
return;
|
|
}
|
|
if (data[settings.skipKey] === true) {
|
|
return;
|
|
}
|
|
let entries = Object.entries(data);
|
|
entries = filterKeys(entries, settings.filterKeys, settings.filterMode);
|
|
if (settings.ignoreNulls) {
|
|
entries = filterNulls(entries);
|
|
}
|
|
entries = normalise(entries);
|
|
return entries.length == 0 ? void 0 : Object.fromEntries(entries);
|
|
}
|
|
function normalise(entries) {
|
|
return entries.map(([key, value]) => {
|
|
if (key.toLocaleLowerCase() == "tags") {
|
|
return [key, normaliseTags(value)];
|
|
}
|
|
return [key, value];
|
|
});
|
|
}
|
|
function normaliseTags(data) {
|
|
if (data == null) {
|
|
return [];
|
|
}
|
|
if (!Array.isArray(data) && typeof data != "string") {
|
|
throw new Error("Tags must be an array or a string");
|
|
}
|
|
const result = typeof data == "string" ? data.split(",").flatMap((x) => x.trim().split(" ")) : data;
|
|
return result.filter((x) => x && x.length != 0);
|
|
}
|
|
function filterKeys(entries, keys, mode) {
|
|
const predicate = mode == "ignore" ? (x) => !x : (x) => x;
|
|
return entries.filter(([key, _value]) => predicate(keys.some((x) => x === key)));
|
|
}
|
|
function filterNulls(entries) {
|
|
return entries.filter(([_key, value]) => !isEmptyValue(value));
|
|
}
|
|
|
|
// src/mixture.tsx
|
|
function useMixture() {
|
|
return useContext(MixtureContext);
|
|
}
|
|
var MixtureContext = createContext();
|
|
function MixtureProvider(props) {
|
|
const app = props.app;
|
|
const settings = props.settings;
|
|
const workspace = app.workspace;
|
|
const searchFn = app.internalPlugins.getPluginById("global-search").instance.openGlobalSearch.bind(app.workspace);
|
|
const openLinkFn = app.workspace.openLinkText.bind(app.workspace);
|
|
onCleanup(() => {
|
|
props.themeObserver.disconnect();
|
|
});
|
|
const mixture = {
|
|
app,
|
|
workspace,
|
|
settings,
|
|
search(term) {
|
|
searchFn(term);
|
|
},
|
|
isOpen(depth) {
|
|
return isOpen(depth, settings.expansionMode);
|
|
},
|
|
isNaked: settings.naked,
|
|
openTag(tag) {
|
|
searchFn(`tag:${tag}`);
|
|
},
|
|
openNote(note) {
|
|
openLinkFn(note, "");
|
|
},
|
|
cleanData: (data) => cleanData(data, settings)
|
|
};
|
|
return createComponent(MixtureContext.Provider, {
|
|
value: mixture,
|
|
get children() {
|
|
return props.children;
|
|
}
|
|
});
|
|
}
|
|
|
|
// src/components/Sidebar.tsx
|
|
var import_obsidian4 = require("obsidian");
|
|
|
|
// src/components/List.tsx
|
|
var _tmpl$ = /* @__PURE__ */ template(`<ul></ul>`, 2);
|
|
var _tmpl$2 = /* @__PURE__ */ template(`<li></li>`, 2);
|
|
function List(props) {
|
|
const name = `list-${props.key}`;
|
|
return createComponent(Show, {
|
|
get when() {
|
|
return props.value.length > 0;
|
|
},
|
|
get children() {
|
|
const _el$ = _tmpl$.cloneNode(true);
|
|
className(_el$, `list ${name}`);
|
|
setAttribute(_el$, "part", `list ${name}`);
|
|
insert(_el$, createComponent(For, {
|
|
get each() {
|
|
return props.value;
|
|
},
|
|
children: (item, index) => (() => {
|
|
const _el$2 = _tmpl$2.cloneNode(true);
|
|
insert(_el$2, () => createComponent(Value, {
|
|
get key() {
|
|
return props.key;
|
|
},
|
|
get depth() {
|
|
return props.depth;
|
|
},
|
|
value: item
|
|
}));
|
|
createRenderEffect((_p$) => {
|
|
const _v$ = `${props.key}-${index()}`, _v$2 = `list-item list-item-${props.key}`;
|
|
_v$ !== _p$._v$ && setAttribute(_el$2, "id", _p$._v$ = _v$);
|
|
_v$2 !== _p$._v$2 && setAttribute(_el$2, "part", _p$._v$2 = _v$2);
|
|
return _p$;
|
|
}, {
|
|
_v$: void 0,
|
|
_v$2: void 0
|
|
});
|
|
return _el$2;
|
|
})()
|
|
}));
|
|
return _el$;
|
|
}
|
|
});
|
|
}
|
|
|
|
// src/components/Member.tsx
|
|
var _tmpl$3 = /* @__PURE__ */ template(`<td class="value" part="value"></td>`, 2);
|
|
var _tmpl$22 = /* @__PURE__ */ template(`<th class="key" part="key"></th>`, 2);
|
|
var _tmpl$32 = /* @__PURE__ */ template(`<tr class="member" part="member"></tr>`, 2);
|
|
var _tmpl$4 = /* @__PURE__ */ template(`<p class="parse-error">Error: </p>`, 2);
|
|
var _tmpl$5 = /* @__PURE__ */ template(`<th class="key toggle" role="button" tabindex="0"><span></span></th>`, 4);
|
|
var _tmpl$6 = /* @__PURE__ */ template(`<div class="marker" part="marker"></div>`, 2);
|
|
function Member(props) {
|
|
const {
|
|
cleanData: cleanData2,
|
|
isOpen: isOpen2,
|
|
settings
|
|
} = useMixture();
|
|
const data = () => {
|
|
var _a;
|
|
return isSet(props.value) ? (_a = cleanData2(props.value)) != null ? _a : {} : props.value;
|
|
};
|
|
const depth = () => props.depth + 1;
|
|
return createComponent(ErrorBoundary, {
|
|
fallback: (error) => (() => {
|
|
const _el$5 = _tmpl$4.cloneNode(true), _el$6 = _el$5.firstChild;
|
|
insert(_el$5, error, null);
|
|
return _el$5;
|
|
})(),
|
|
get children() {
|
|
return createComponent(Show, {
|
|
get when() {
|
|
return !(isEmptyValue(data()) && settings.ignoreNulls);
|
|
},
|
|
get children() {
|
|
const _el$ = _tmpl$32.cloneNode(true);
|
|
insert(_el$, createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
get when() {
|
|
return !isLeaf(props.value);
|
|
},
|
|
get children() {
|
|
return [createComponent(Key, {
|
|
get target() {
|
|
return props.id;
|
|
},
|
|
get expanded() {
|
|
return isOpen2(depth());
|
|
},
|
|
get children() {
|
|
return props.key;
|
|
}
|
|
}), (() => {
|
|
const _el$2 = _tmpl$3.cloneNode(true);
|
|
insert(_el$2, createComponent(Value, {
|
|
get key() {
|
|
return props.key;
|
|
},
|
|
get depth() {
|
|
return depth();
|
|
},
|
|
get value() {
|
|
return data();
|
|
}
|
|
}), null);
|
|
insert(_el$2, createComponent(Marker, {}), null);
|
|
createRenderEffect(() => setAttribute(_el$2, "id", props.id));
|
|
return _el$2;
|
|
})()];
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return isLeaf(props.value);
|
|
},
|
|
get children() {
|
|
return [(() => {
|
|
const _el$3 = _tmpl$22.cloneNode(true);
|
|
insert(_el$3, () => props.key);
|
|
createRenderEffect(() => setAttribute(_el$3, "title", props.key));
|
|
return _el$3;
|
|
})(), (() => {
|
|
const _el$4 = _tmpl$3.cloneNode(true);
|
|
insert(_el$4, createComponent(Value, {
|
|
get key() {
|
|
return props.key;
|
|
},
|
|
get depth() {
|
|
return props.depth;
|
|
},
|
|
get value() {
|
|
return data();
|
|
}
|
|
}));
|
|
createRenderEffect(() => setAttribute(_el$4, "id", props.id));
|
|
return _el$4;
|
|
})()];
|
|
}
|
|
})];
|
|
}
|
|
}));
|
|
return _el$;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function Key(props) {
|
|
const [isExpanded, setIsExpanded] = createSignal(props.expanded);
|
|
const togglePart = () => isExpanded() ? "expanded" : "collapsed";
|
|
const handler = (event) => {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
setIsExpanded(!isExpanded());
|
|
};
|
|
const clickHandler = (event) => handler(event);
|
|
const keyHandler = (event) => {
|
|
if (event.code == "Space" || event.code == "Enter") {
|
|
handler(event);
|
|
}
|
|
};
|
|
return (() => {
|
|
const _el$7 = _tmpl$5.cloneNode(true), _el$8 = _el$7.firstChild;
|
|
_el$7.$$keydown = keyHandler;
|
|
_el$7.$$click = clickHandler;
|
|
insert(_el$8, () => props.children);
|
|
createRenderEffect((_p$) => {
|
|
const _v$ = `key toggle ${togglePart()}`, _v$2 = isExpanded(), _v$3 = props.target, _v$4 = props.children;
|
|
_v$ !== _p$._v$ && setAttribute(_el$7, "part", _p$._v$ = _v$);
|
|
_v$2 !== _p$._v$2 && setAttribute(_el$7, "aria-expanded", _p$._v$2 = _v$2);
|
|
_v$3 !== _p$._v$3 && setAttribute(_el$7, "aria-controls", _p$._v$3 = _v$3);
|
|
_v$4 !== _p$._v$4 && setAttribute(_el$7, "title", _p$._v$4 = _v$4);
|
|
return _p$;
|
|
}, {
|
|
_v$: void 0,
|
|
_v$2: void 0,
|
|
_v$3: void 0,
|
|
_v$4: void 0
|
|
});
|
|
return _el$7;
|
|
})();
|
|
}
|
|
function Marker() {
|
|
return _tmpl$6.cloneNode(true);
|
|
}
|
|
delegateEvents(["click", "keydown"]);
|
|
|
|
// src/components/Set.tsx
|
|
var _tmpl$7 = /* @__PURE__ */ template(`<table></table>`, 2);
|
|
function Set2(props) {
|
|
const name = `set-${props.key}`;
|
|
return (() => {
|
|
const _el$ = _tmpl$7.cloneNode(true);
|
|
className(_el$, `set ${name}`);
|
|
setAttribute(_el$, "part", `set ${name}`);
|
|
insert(_el$, createComponent(For, {
|
|
get each() {
|
|
return Object.entries(props.value);
|
|
},
|
|
children: ([key, value], index) => createComponent(Member, {
|
|
get id() {
|
|
return `${key}-${index()}`;
|
|
},
|
|
get depth() {
|
|
return props.depth;
|
|
},
|
|
key,
|
|
value
|
|
})
|
|
}));
|
|
return _el$;
|
|
})();
|
|
}
|
|
|
|
// src/components/Tag.tsx
|
|
var _tmpl$8 = /* @__PURE__ */ template(`<a class="tag" target="_blank" rel="noopener"></a>`, 2);
|
|
function Tag(props) {
|
|
const {
|
|
openTag
|
|
} = useMixture();
|
|
const url = () => `#${props.value}`;
|
|
const safeValue = () => props.value;
|
|
const clickHandler = (event) => {
|
|
const trigger = event.target;
|
|
event.preventDefault();
|
|
openTag(trigger.getAttribute("href"));
|
|
};
|
|
return (() => {
|
|
const _el$ = _tmpl$8.cloneNode(true);
|
|
_el$.$$click = clickHandler;
|
|
insert(_el$, () => props.value);
|
|
createRenderEffect((_p$) => {
|
|
const _v$ = url(), _v$2 = url(), _v$3 = `tag ${safeValue()}`;
|
|
_v$ !== _p$._v$ && setAttribute(_el$, "href", _p$._v$ = _v$);
|
|
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-href", _p$._v$2 = _v$2);
|
|
_v$3 !== _p$._v$3 && setAttribute(_el$, "part", _p$._v$3 = _v$3);
|
|
return _p$;
|
|
}, {
|
|
_v$: void 0,
|
|
_v$2: void 0,
|
|
_v$3: void 0
|
|
});
|
|
return _el$;
|
|
})();
|
|
}
|
|
delegateEvents(["click"]);
|
|
|
|
// src/components/InternalLink.tsx
|
|
var import_obsidian2 = require("obsidian");
|
|
var _tmpl$9 = /* @__PURE__ */ template(`<a class="leaf link internal-link" part="leaf link internal-link" target="_blank" rel="noopener"></a>`, 2);
|
|
function InternalLink(props) {
|
|
const value = props.value;
|
|
return createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
get when() {
|
|
return isWikiLink(value);
|
|
},
|
|
get children() {
|
|
return createComponent(WikiLink, {
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return isFrontmatterLink(value);
|
|
},
|
|
get children() {
|
|
return createComponent(FrontmatterLink, {
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return isLocalLink(value);
|
|
},
|
|
get children() {
|
|
return createComponent(LocalLink, {
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return isObsidianUrl(value);
|
|
},
|
|
get children() {
|
|
return createComponent(ObsidianLink, {
|
|
value
|
|
});
|
|
}
|
|
})];
|
|
}
|
|
});
|
|
}
|
|
function isInternalLink(value) {
|
|
return isWikiLink(value) || isFrontmatterLink(value) || isLocalLink(value) || isObsidianUrl(value);
|
|
}
|
|
function WikiLink(props) {
|
|
let value = props.value.slice(2, -2);
|
|
let url;
|
|
let label;
|
|
if (value.includes("|")) {
|
|
const [urlValue, labelValue] = value.split("|");
|
|
url = urlValue.trim();
|
|
label = labelValue.trim();
|
|
} else {
|
|
label = value;
|
|
url = value;
|
|
}
|
|
return createComponent(Link, {
|
|
label,
|
|
url
|
|
});
|
|
}
|
|
function isWikiLink(value) {
|
|
return value.startsWith("[[") && value.endsWith("]]");
|
|
}
|
|
function FrontmatterLink(props) {
|
|
let value = props.value.slice(1, -1);
|
|
let url;
|
|
let label;
|
|
if (value.includes("|")) {
|
|
const [urlValue, labelValue] = value.split("|");
|
|
url = urlValue.trim();
|
|
label = labelValue.trim();
|
|
} else {
|
|
label = value;
|
|
url = value;
|
|
}
|
|
return createComponent(Link, {
|
|
label,
|
|
url
|
|
});
|
|
}
|
|
function isFrontmatterLink(value) {
|
|
return value.startsWith("%") && value.endsWith("%");
|
|
}
|
|
function LocalLink(props) {
|
|
return createComponent(Link, {
|
|
get label() {
|
|
return props.value;
|
|
},
|
|
get url() {
|
|
return props.value;
|
|
}
|
|
});
|
|
}
|
|
function isLocalLink(value) {
|
|
return value.startsWith("./") || value.startsWith("../");
|
|
}
|
|
function ObsidianLink(props) {
|
|
return createComponent(Link, {
|
|
get label() {
|
|
return props.value;
|
|
},
|
|
get url() {
|
|
return props.value;
|
|
}
|
|
});
|
|
}
|
|
function isObsidianUrl(url) {
|
|
return url instanceof URL && url.protocol == "obsidian:";
|
|
}
|
|
function Link(props) {
|
|
const {
|
|
openNote
|
|
} = useMixture();
|
|
const label = props.label;
|
|
const url = props.url;
|
|
const localUrl = (0, import_obsidian2.getLinkpath)(url);
|
|
const clickHandler = (event) => {
|
|
event.preventDefault();
|
|
openNote(event.target.dataset.href);
|
|
};
|
|
return (() => {
|
|
const _el$ = _tmpl$9.cloneNode(true);
|
|
_el$.$$click = clickHandler;
|
|
setAttribute(_el$, "href", localUrl);
|
|
setAttribute(_el$, "data-href", localUrl);
|
|
insert(_el$, label);
|
|
return _el$;
|
|
})();
|
|
}
|
|
delegateEvents(["click"]);
|
|
|
|
// src/components/ExternalLink.tsx
|
|
var _tmpl$10 = /* @__PURE__ */ template(`<a class="leaf link external-link" part="leaf link external-link" target="_blank" rel="noopener"></a>`, 2);
|
|
function ExternalLink(props) {
|
|
return createComponent(Link2, {
|
|
get label() {
|
|
return props.value;
|
|
},
|
|
get url() {
|
|
return props.value;
|
|
}
|
|
});
|
|
}
|
|
function isExternalLink(value) {
|
|
const url = tryUrl(value);
|
|
return isUrl(url);
|
|
}
|
|
function isUrl(url) {
|
|
const allowedProtocols = ["http:", "https:", "evernote:", "zotero:"];
|
|
return url instanceof URL && allowedProtocols.some((protocol) => url.protocol == protocol);
|
|
}
|
|
function tryUrl(value) {
|
|
try {
|
|
return new URL(value);
|
|
} catch (_) {
|
|
return value;
|
|
}
|
|
}
|
|
function Link2(props) {
|
|
const label = props.label;
|
|
const url = props.url;
|
|
return (() => {
|
|
const _el$ = _tmpl$10.cloneNode(true);
|
|
setAttribute(_el$, "href", url);
|
|
insert(_el$, label);
|
|
return _el$;
|
|
})();
|
|
}
|
|
|
|
// src/components/Leaf.tsx
|
|
var _tmpl$11 = /* @__PURE__ */ template(`<span class="leaf number" part="leaf number"></span>`, 2);
|
|
var _tmpl$23 = /* @__PURE__ */ template(`<span class="leaf boolean" part="leaf boolean"></span>`, 2);
|
|
var _tmpl$33 = /* @__PURE__ */ template(`<span class="leaf nil" part="leaf nil"></span>`, 2);
|
|
var _tmpl$42 = /* @__PURE__ */ template(`<span class="leaf isodate" part="leaf isodate"></span>`, 2);
|
|
var _tmpl$52 = /* @__PURE__ */ template(`<span class="leaf" part="leaf"></span>`, 2);
|
|
var _tmpl$62 = /* @__PURE__ */ template(`<span class="leaf string" part="leaf string"></span>`, 2);
|
|
var ISODATE_RE = new RegExp(/^\d{4}-\d{2}-\d{2}$/);
|
|
var MD_LINK_RE = new RegExp(/^\[(?<label>[^\[\]]+)\]\((?<url>[^\(\)]+)\)$/);
|
|
function Leaf(props) {
|
|
const {
|
|
settings
|
|
} = useMixture();
|
|
const key = props.key;
|
|
const value = props.value;
|
|
return createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
when: typeof value === "number",
|
|
get children() {
|
|
const _el$ = _tmpl$11.cloneNode(true);
|
|
insert(_el$, value);
|
|
return _el$;
|
|
}
|
|
}), createComponent(Match, {
|
|
when: typeof value === "boolean",
|
|
get children() {
|
|
const _el$2 = _tmpl$23.cloneNode(true);
|
|
insert(_el$2, () => value.toString());
|
|
return _el$2;
|
|
}
|
|
}), createComponent(Match, {
|
|
when: key == "tags",
|
|
get children() {
|
|
return createComponent(Tag, {
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return value === settings.nullValue;
|
|
},
|
|
get children() {
|
|
const _el$3 = _tmpl$33.cloneNode(true);
|
|
insert(_el$3, value);
|
|
return _el$3;
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return ISODATE_RE.test(value.trim());
|
|
},
|
|
get children() {
|
|
const _el$4 = _tmpl$42.cloneNode(true);
|
|
insert(_el$4, value);
|
|
return _el$4;
|
|
}
|
|
}), createComponent(Match, {
|
|
when: typeof value === "string",
|
|
get children() {
|
|
return createComponent(String2, {
|
|
key,
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
when: true,
|
|
get children() {
|
|
const _el$5 = _tmpl$52.cloneNode(true);
|
|
insert(_el$5, value);
|
|
return _el$5;
|
|
}
|
|
})];
|
|
}
|
|
});
|
|
}
|
|
function String2(props) {
|
|
const {
|
|
settings
|
|
} = useMixture();
|
|
const value = props.value;
|
|
return createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
get when() {
|
|
return createMemo(() => !!settings.autolinks)() && isInternalLink(value);
|
|
},
|
|
get children() {
|
|
return createComponent(InternalLink, {
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return createMemo(() => !!settings.autolinks)() && isExternalLink(value);
|
|
},
|
|
get children() {
|
|
return createComponent(ExternalLink, {
|
|
value
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return createMemo(() => !!settings.autolinks)() && MD_LINK_RE.test(value.trim());
|
|
},
|
|
get children() {
|
|
return createComponent(MarkdownLink, {
|
|
get value() {
|
|
return value.trim();
|
|
}
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
when: true,
|
|
get children() {
|
|
const _el$6 = _tmpl$62.cloneNode(true);
|
|
insert(_el$6, value);
|
|
return _el$6;
|
|
}
|
|
})];
|
|
}
|
|
});
|
|
}
|
|
function MarkdownLink(props) {
|
|
const result = props.value.match(MD_LINK_RE);
|
|
const {
|
|
label,
|
|
url
|
|
} = result.groups;
|
|
return createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
get when() {
|
|
return isInternalLink(url);
|
|
},
|
|
get children() {
|
|
return createComponent(Link, {
|
|
label,
|
|
url
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return isExternalLink(url);
|
|
},
|
|
get children() {
|
|
return createComponent(Link2, {
|
|
label,
|
|
url
|
|
});
|
|
}
|
|
})];
|
|
}
|
|
});
|
|
}
|
|
|
|
// src/components/Value.tsx
|
|
function Value(props) {
|
|
const {
|
|
settings
|
|
} = useMixture();
|
|
const patchedKey = createMemo(() => patchKey(props.key));
|
|
const patchedValue = createMemo(() => patchValue(props.value, settings.nullValue));
|
|
return createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
get when() {
|
|
return Array.isArray(patchedValue());
|
|
},
|
|
get children() {
|
|
return createComponent(List, {
|
|
get key() {
|
|
return patchedKey();
|
|
},
|
|
get depth() {
|
|
return props.depth;
|
|
},
|
|
get value() {
|
|
return patchedValue();
|
|
}
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return typeof patchedValue() == "object";
|
|
},
|
|
get children() {
|
|
return createComponent(Set2, {
|
|
get key() {
|
|
return patchedKey();
|
|
},
|
|
get depth() {
|
|
return props.depth;
|
|
},
|
|
get value() {
|
|
return patchedValue();
|
|
}
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return isLeaf(patchedValue());
|
|
},
|
|
get children() {
|
|
return createComponent(Leaf, {
|
|
get key() {
|
|
return patchedKey();
|
|
},
|
|
get value() {
|
|
return patchedValue();
|
|
}
|
|
});
|
|
}
|
|
})];
|
|
}
|
|
});
|
|
}
|
|
function patchKey(input) {
|
|
return input.toLocaleLowerCase().replace(" ", "-");
|
|
}
|
|
function patchValue(input, nullValue) {
|
|
return isEmptyValue(input) ? nullValue : input;
|
|
}
|
|
|
|
// src/components/Metatable.tsx
|
|
function Metatable(props) {
|
|
return createComponent(Value, {
|
|
key: "metatableroot",
|
|
depth: 0,
|
|
get value() {
|
|
return props.data;
|
|
}
|
|
});
|
|
}
|
|
|
|
// src/components/ParseError.tsx
|
|
var _tmpl$12 = /* @__PURE__ */ template(`<div class="parse-error"><p></p><pre></pre></div>`, 6);
|
|
function ParseError(props) {
|
|
const message = props.message;
|
|
const error = () => {
|
|
const [msg, ...trace] = message().split("\n").filter((line) => line.length != 0);
|
|
return {
|
|
message: msg,
|
|
trace: trace.join("\n")
|
|
};
|
|
};
|
|
return (() => {
|
|
const _el$ = _tmpl$12.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
insert(_el$2, () => error().message);
|
|
insert(_el$3, () => error().trace);
|
|
return _el$;
|
|
})();
|
|
}
|
|
|
|
// src/frontmatter.ts
|
|
var import_obsidian3 = require("obsidian");
|
|
var FRONTMATTER_REGEX = /^\n*---[^\n]*\n+(?<fm>.+?)\n+---.*/s;
|
|
function readFrontmatter(md) {
|
|
var _a;
|
|
const result = md.match(FRONTMATTER_REGEX);
|
|
return (_a = result == null ? void 0 : result.groups) == null ? void 0 : _a.fm;
|
|
}
|
|
function parseFrontmatter(input) {
|
|
if (input === void 0 || input === null) {
|
|
return;
|
|
}
|
|
return (0, import_obsidian3.parseYaml)(input);
|
|
}
|
|
|
|
// src/state.ts
|
|
function createState(settings) {
|
|
const [state, setState] = createSignal({});
|
|
const nextState = (seed) => {
|
|
if (seed !== null) {
|
|
const newState = computeState(state, seed, settings);
|
|
if (newState !== void 0) {
|
|
setState(newState);
|
|
}
|
|
} else {
|
|
setState({});
|
|
}
|
|
};
|
|
return [state, nextState];
|
|
}
|
|
function computeState(state, seed, settings) {
|
|
const name = seed.name;
|
|
const frontmatter = readFrontmatter(seed.content);
|
|
if (frontmatter === state().frontmatter) {
|
|
return;
|
|
}
|
|
let metadata;
|
|
let error;
|
|
try {
|
|
metadata = parseFrontmatter(frontmatter);
|
|
metadata = cleanData(metadata, settings);
|
|
} catch (err) {
|
|
error = err;
|
|
}
|
|
return { name, frontmatter, metadata, error };
|
|
}
|
|
|
|
// src/metatable.css
|
|
var metatable_default = ':host {\n /* global */\n --metatable-font-family: var(--font-text, sans-serif);\n --metatable-font-size: 14px;\n\n /* symbols */\n --metatable-collapsed-symbol: "\u25B6\uFE0E";\n --metatable-expanded-symbol: "\u25BC";\n --metatable-mark-symbol: "\u2026";\n --metatable-tag-symbol: "";\n\n /* palette */\n --metatable-background-primary-alt: var(--background-primary-alt);\n /* DEPRECATED: 0.14.0 --metatable-background */\n --metatable-background-primary: var(--metatable-background, transparent);\n --metatable-background-secondary: var(--background-secondary);\n --metatable-background-secondary-alt: var(--background-secondary-alt);\n --metatable-text-focus: inherit;\n /* DEPRECATED: 0.14.0 --metatable-foreground */\n --metatable-text-primary: var(--metatable-foreground, var(--text-muted));\n --metatable-text-secondary: var(--text-normal);\n\n --metatable-background-link: transparent;\n --metatable-text-link: var(--text-accent);\n --metatable-text-link-hover: var(--text-accent-hover);\n\n\n /* part palette */\n\n /* root */\n --metatable-root-background: var(--metatable-background-primary);\n --metatable-root-color: var(--metatable-text-primary);\n\n /* summary */\n --metatable-summary-background: transparent;\n --metatable-summary-color: inherit;\n --metatable-summary-background-focus: var(--metatable-background-focus);\n --metatable-summary-color-focus: var(--metatable-text-focus);\n\n /* set */\n --metatable-set-background: transparent;\n --metatable-set-color: inherit;\n\n /** member */\n --metatable-member-background: inherit;\n --metatable-member-color: inherit;\n\n /*** key */\n --metatable-key-background: transparent;\n --metatable-key-color: inherit;\n /* DEPRECATED: 0.14.0 --metatable-key-focus */\n --metatable-key-background-focus: var(--metatable-key-focus, var(--metatable-background-focus));\n --metatable-key-color-focus: var(--metatable-text-focus);\n\n /*** value */\n --metatable-value-background: transparent;\n --metatable-value-color: inherit;\n\n /* tags */\n --metatable-tag-background: var(--metatable-background-primary-alt);\n --metatable-tag-color: var(--metatable-text-primary);\n --metatable-tag-border: none;\n --metatable-tag-background-focus: var(--metatable-background-focus);\n --metatable-tag-color-focus: var(--metatable-text-focus);\n\n /* links */\n --metatable-external-link-background: var(--metatable-background-link);\n --metatable-external-link-color: var(--metatable-text-link);\n --metatable-external-link-background-hover: transparent;\n --metatable-external-link-color-hover: var(--metatable-text-link-hover);\n --metatable-external-link-background-focus: var(--metatable-background-focus);\n --metatable-external-link-color-focus: var(--metatable-text-focus);\n --metatable-external-link-icon: url(app://obsidian.md/public/images/874d8b8e340f75575caa.svg);\n\n --metatable-internal-link-background: var(--metatable-background-link);\n --metatable-internal-link-color: var(--metatable-text-link);\n --metatable-internal-link-background-hover: transparent;\n --metatable-internal-link-color-hover: var(--metatable-text-hover);\n --metatable-internal-link-background-focus: var(--metatable-background-focus);\n --metatable-internal-link-color-focus: var(--metatable-text-link-focus);\n}\n\n:host(.light) {\n /* global */\n --metatable-background-focus: lightyellow;\n\n /* leafs */\n --metatable-leaf-number-color: purple;\n --metatable-leaf-boolean-color: slateblue;\n --metatable-leaf-date-color: darkolivegreen;\n --metatable-leaf-nil-color: inherit;\n\n /* warning */\n --metatable-warning-background: lightgoldenrodyellow;\n --metatable-warning-foreground: brown;\n --metatable-warning-border: 2px solid palegoldenrod;\n}\n\n:host(.dark) {\n --metatable-background-focus: black;\n --metatable-text-focus: orange;\n\n /* leafs */\n --metatable-leaf-number-color: lightpink;\n --metatable-leaf-boolean-color: lightskyblue;\n --metatable-leaf-date-color: darkseagreen;\n --metatable-leaf-nil-color: inherit;\n\n /* tags */\n --metatable-tag-background: black;\n\n /* links */\n --metatable-warning-background: transparent;\n --metatable-warning-color: gold;\n --metatable-warning-border: 2px solid palegoldenrod;\n}\n\n\n:host(.light.obsidian-metatable-sidebar) {\n --metatable-tag-background: var(--metatable-background-secondary-alt);\n}\n\n\n* {\n box-sizing: border-box;\n}\n\n.root {\n background: var(--metatable-root-background);\n color: var(--metatable-root-color);\n font-family: var(--metatable-font-family);\n font-size: var(--metatable-font-size);\n\n user-select: text;\n}\n\n.metatable-sidebar {\n font-size: calc(var(--metatable-font-size) - 1px);\n}\n.metatable-sidebar.root {\n margin: 10px;\n}\n\ndetails {\n margin-bottom: 20px;\n}\n\nsummary {\n background: var(--metatable-summary-background);\n color: var(--metatable-summary-color);\n\n cursor: pointer;\n\n display: grid;\n grid-gap: 4px;\n grid-template-columns: 10px auto;\n}\n\nsummary::before {\n display: block;\n font-size: 10px;\n padding-top: 4px;\n content: var(--metatable-collapsed-symbol);\n}\n\ndetails[open] summary::before {\n padding-top: 5px;\n content: var(--metatable-expanded-symbol);\n}\n\nsummary:focus,\nsummary:focus-visible {\n background: var(--metatable-summary-background-focus);\n\n outline: none;\n}\n\nsummary + * {\n margin-top: 20px;\n}\n\n.metatable-sidebar > .summary {\n font-size: var(--font-text-size, 1.2rem);\n margin-top: 0;\n}\n\n\n.set {\n background: var(--metatable-set-background);\n color: var(--metatable-set-color);\n\n display: grid;\n grid-gap: 2px;\n}\n\n.member {\n background: var(--metatable-member-background);\n color: var(--metatable-member-color);\n\n grid-gap: 2px;\n display: grid;\n grid-template-areas: "key value";\n grid-template-columns: minmax(0, 2fr) minmax(0, 4fr);\n}\n\n.member:nth-child(even) {\n background: var(--metatable-background-alt);\n}\n\n.tight .member {\n display: block;\n}\n\n.member .key {\n background: var(--metatable-key-background);\n color: var(--metatable-key-color);\n\n display: block;\n font-weight: 600;\n overflow: hidden;\n padding: 2px 4px;\n text-align: left;\n text-overflow: ellipsis;\n}\n\n.key > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.member .key.toggle {\n display: grid;\n grid-area: key;\n grid-gap: 4px;\n grid-template-columns: 10px auto;\n}\n\n.member .key[role=button] {\n cursor: pointer;\n}\n\n.member .key:focus,\n.member .key:focus-visible {\n background: var(--metatable-key-background-focus);\n color: var(--metatable-key-color-focus);\n\n outline: none;\n}\n\n.key[aria-expanded]::before {\n font-size: 8px;\n padding-top: 6px;\n}\n\n.key[aria-expanded=true]::before {\n padding-top: 7px;\n}\n\n.metatable-sidebar .key[aria-expanded]::before {\n padding-top: 1px;\n}\n\n.metatable-sidebar .key[aria-expanded=true]::before {\n padding-top: 2px;\n}\n\n.key[aria-expanded=true]::before {\n content: var(--metatable-expanded-symbol);\n}\n\n.key[aria-expanded=false]::before {\n content: var(--metatable-collapsed-symbol);\n}\n\n.key[aria-expanded=false] + .value > :first-child {\n display: none;\n}\n\n.key[aria-expanded=false] + .value > .marker::after {\n content: var(--metatable-mark-symbol);\n\n display: block;\n padding-top: 2px;\n}\n\n.member .value {\n background: var(--metatable-value-background);\n color: var(--metatable-value-color);\n\n display: block;\n grid-area: value;\n margin: 0;\n overflow: auto;\n padding: 2px 4px;\n}\n\n.tight .member .value {\n margin-left: 16px;\n}\n\n.member .toggle + .value {\n padding: 0;\n}\n\n.list {\n margin: 0;\n padding: 0 0 0 16px;\n}\n\n.list-item {\n margin-left: 1rem;\n}\n\n/* warning */\n.parse-error {\n background: var(--metatable-warning-background);\n color: var(--metatable-warning-color);\n border: var(--metatable-warning-border);\n\n margin: 0;\n padding: 8px;\n}\n\n.parse-error p {\n margin-top: 0;\n}\n\n\n/* Leafs */\n.number {\n color: var(--metatable-leaf-number-color);\n}\n\n.boolean {\n color: var(--metatable-leaf-boolean-color);\n}\n\n.isodate {\n color: var(--metatable-leaf-date-color);\n}\n\n.nil {\n color: var(--metatable-leaf-nil-color);\n}\n\n\n/* links */\n.external-link {\n background: var(--metatable-external-link-background);\n color: var(--metatable-external-link-color);\n\n display: inline-block;\n white-space: nowrap;\n}\n\n.external-link::after {\n content: var(--metatable-external-link-icon);\n\n display: inline-block;\n margin-left: 0.3rem;\n vertical-align: sub;\n}\n\n.external-link:hover {\n background: var(--metatable-external-link-background-hover);\n color: var(--metatable-external-link-color-hover);\n}\n\n.external-link:focus, .external-link:focus-visible {\n background: var(--metatable-internal-link-background-focus);\n color: var(--metatable-internal-link-color-focus);\n}\n\n.internal-link {\n background: var(--metatable-internal-link-background);\n color: var(--metatable-internal-link-color);\n\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 450px;\n white-space: nowrap;\n}\n\n.internal-link:hover {\n background: var(--metatable-internal-link-background-hover);\n color: var(--metatable-internal-link-color-hover);\n}\n\n.internal-link:focus, .internal-link:focus-visible {\n background: var(--metatable-internal-link-background-focus);\n color: var(--metatable-internal-link-color-focus);\n}\n\n\n/* tags */\n.value .list-tags {\n padding: 2px 0 0 0;\n}\n\n.list-tags li {\n display: inline-block;\n margin: 0 4px 4px 0;\n}\n\n.tag {\n background: var(--metatable-tag-background);\n color: var(--metatable-tag-color);\n border: var(--metatable-tag-border);\n\n display: block;\n border-radius: 16px;\n margin: 0;\n padding: 0 10px;\n text-decoration: none;\n}\n\n.tag::before {\n content: var(--metatable-tag-symbol);\n}\n\n.tag:hover {\n filter: brightness(0.8);\n}\n\n.tag:focus, .external-link:focus, .internal-link:focus {\n outline: none;\n}\n\n.tag:focus-visible, .external-link:focus-visible, .internal-link:focus-visible {\n background: var(--metatable-tag-background-focus);\n color: var(--metatable-tag-color-focus);\n\n outline: none;\n}\n\n\n\n.pane-empty {\n color: var(--metadata-text-primary);\n font-size: 16px;\n margin: 6px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n';
|
|
|
|
// src/components/Sidebar.tsx
|
|
var _tmpl$13 = /* @__PURE__ */ template(`<style></style>`, 2);
|
|
var _tmpl$24 = /* @__PURE__ */ template(`<h1 part="summary">Metadata for \u201C<!>\u201D</h1>`, 3);
|
|
var _tmpl$34 = /* @__PURE__ */ template(`<section part="root"></section>`, 2);
|
|
var _tmpl$43 = /* @__PURE__ */ template(`<p class="pane-empty">No markdown files active.</p>`, 2);
|
|
var _tmpl$53 = /* @__PURE__ */ template(`<p>(empty)</p>`, 2);
|
|
function Sidebar() {
|
|
const {
|
|
workspace,
|
|
settings,
|
|
isNaked
|
|
} = useMixture();
|
|
let root;
|
|
let listeners = [];
|
|
const [state, setState] = createState(settings);
|
|
const [isTight, setIsTight] = createSignal(false);
|
|
const rootClasses = ["metatable-sidebar", "root"];
|
|
const rootClass = () => {
|
|
const classes = isTight() ? ["tight", ...rootClasses] : rootClasses;
|
|
return classes.join(" ");
|
|
};
|
|
const fetchData = () => {
|
|
const view = workspace.getActiveViewOfType(import_obsidian4.MarkdownView);
|
|
if (view instanceof import_obsidian4.MarkdownView) {
|
|
const name = view.getDisplayText();
|
|
const content = view.getViewData();
|
|
setState({
|
|
name,
|
|
content
|
|
});
|
|
} else {
|
|
const leaves = workspace.getLeavesOfType("markdown");
|
|
if (leaves.length == 0) {
|
|
setState(null);
|
|
}
|
|
}
|
|
};
|
|
onMount(() => {
|
|
fetchData();
|
|
listeners = [workspace.on("active-leaf-change", () => fetchData()), workspace.on("editor-change", (0, import_obsidian4.debounce)(() => fetchData(), 180, true)), workspace.on("resize", () => {
|
|
setIsTight(root.clientWidth < 260);
|
|
})];
|
|
});
|
|
onCleanup(() => {
|
|
listeners.forEach((listener) => workspace.offref(listener));
|
|
});
|
|
return [createComponent(Show, {
|
|
when: !isNaked,
|
|
get children() {
|
|
const _el$ = _tmpl$13.cloneNode(true);
|
|
insert(_el$, metatable_default);
|
|
return _el$;
|
|
}
|
|
}), (() => {
|
|
const _el$2 = _tmpl$34.cloneNode(true);
|
|
const _ref$ = root;
|
|
typeof _ref$ === "function" ? use(_ref$, _el$2) : root = _el$2;
|
|
insert(_el$2, createComponent(Show, {
|
|
get when() {
|
|
return state().name !== void 0;
|
|
},
|
|
get fallback() {
|
|
return _tmpl$43.cloneNode(true);
|
|
},
|
|
get children() {
|
|
return [(() => {
|
|
const _el$3 = _tmpl$24.cloneNode(true), _el$4 = _el$3.firstChild, _el$6 = _el$4.nextSibling, _el$5 = _el$6.nextSibling;
|
|
insert(_el$3, () => state().name, _el$6);
|
|
return _el$3;
|
|
})(), createComponent(Switch, {
|
|
get fallback() {
|
|
return _tmpl$53.cloneNode(true);
|
|
},
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
get when() {
|
|
return state().error !== void 0;
|
|
},
|
|
get children() {
|
|
return createComponent(ParseError, {
|
|
message: () => state().error.message
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
get when() {
|
|
return state().metadata !== void 0;
|
|
},
|
|
get children() {
|
|
return createComponent(Metatable, {
|
|
get data() {
|
|
return state().metadata;
|
|
}
|
|
});
|
|
}
|
|
})];
|
|
}
|
|
})];
|
|
}
|
|
}));
|
|
createRenderEffect(() => className(_el$2, rootClass()));
|
|
return _el$2;
|
|
})()];
|
|
}
|
|
|
|
// src/sidebarView.tsx
|
|
var SidebarViewType = "metatable-sidebar-view";
|
|
var SidebarView = class extends import_obsidian5.ItemView {
|
|
constructor(leaf, settings, iconName) {
|
|
super(leaf);
|
|
this.settings = settings;
|
|
this.iconName = iconName;
|
|
}
|
|
getViewType() {
|
|
return SidebarViewType;
|
|
}
|
|
getDisplayText() {
|
|
return "Metatable Sidebar";
|
|
}
|
|
getIcon() {
|
|
return this.iconName;
|
|
}
|
|
async onOpen() {
|
|
const root = this.containerEl.children[1];
|
|
const wrapper = root.createEl("div");
|
|
let dock;
|
|
wrapper.classList.add("obsidian-metatable-sidebar");
|
|
wrapper.classList.add(this.settings.theme);
|
|
const themeObserver = observeTheme(wrapper);
|
|
if (this.settings.naked) {
|
|
dock = wrapper;
|
|
} else {
|
|
wrapper.attachShadow({
|
|
mode: "open"
|
|
});
|
|
dock = wrapper.shadowRoot;
|
|
}
|
|
const _self$ = this;
|
|
this.dispose = render(() => createComponent(MixtureProvider, {
|
|
get app() {
|
|
return _self$.app;
|
|
},
|
|
get settings() {
|
|
return _self$.settings;
|
|
},
|
|
themeObserver,
|
|
get children() {
|
|
return createComponent(Sidebar, {});
|
|
}
|
|
}), dock);
|
|
}
|
|
async onClose() {
|
|
this.dispose();
|
|
}
|
|
};
|
|
|
|
// src/components/Inline.tsx
|
|
var _tmpl$14 = /* @__PURE__ */ template(`<style></style>`, 2);
|
|
var _tmpl$25 = /* @__PURE__ */ template(`<details class="metatable root" part="root"><summary part="summary">Metatable</summary></details>`, 4);
|
|
function Inline(props) {
|
|
let {
|
|
settings,
|
|
isOpen: isOpen2,
|
|
cleanData: cleanData2
|
|
} = useMixture();
|
|
let metadata;
|
|
try {
|
|
metadata = cleanData2(parseFrontmatter(props.data));
|
|
} catch (err) {
|
|
metadata = err;
|
|
}
|
|
return [createComponent(Show, {
|
|
get when() {
|
|
return !settings.naked;
|
|
},
|
|
get children() {
|
|
const _el$ = _tmpl$14.cloneNode(true);
|
|
insert(_el$, metatable_default);
|
|
return _el$;
|
|
}
|
|
}), createComponent(Switch, {
|
|
get children() {
|
|
return [createComponent(Match, {
|
|
when: metadata instanceof Error,
|
|
get children() {
|
|
return createComponent(ParseError, {
|
|
message: () => metadata.message
|
|
});
|
|
}
|
|
}), createComponent(Match, {
|
|
when: metadata !== void 0,
|
|
get children() {
|
|
const _el$2 = _tmpl$25.cloneNode(true), _el$3 = _el$2.firstChild;
|
|
insert(_el$2, createComponent(Metatable, {
|
|
data: metadata
|
|
}), null);
|
|
createRenderEffect(() => _el$2.open = isOpen2(0));
|
|
return _el$2;
|
|
}
|
|
})];
|
|
}
|
|
})];
|
|
}
|
|
|
|
// src/inliner.tsx
|
|
function createInline(root, data, context) {
|
|
let dock;
|
|
let {
|
|
app,
|
|
settings
|
|
} = context;
|
|
const wrapper = root.createEl("div");
|
|
wrapper.classList.add("obsidian-metatable");
|
|
wrapper.classList.add(settings.theme);
|
|
const observer = observeTheme(wrapper);
|
|
if (settings.naked) {
|
|
dock = wrapper;
|
|
} else {
|
|
wrapper.attachShadow({
|
|
mode: "open"
|
|
});
|
|
dock = wrapper.shadowRoot;
|
|
}
|
|
const dispose2 = render(() => createComponent(MixtureProvider, {
|
|
app,
|
|
settings,
|
|
themeObserver: observer,
|
|
get children() {
|
|
return createComponent(Inline, {
|
|
data
|
|
});
|
|
}
|
|
}), dock);
|
|
return dispose2;
|
|
}
|
|
|
|
// src/plugin.ts
|
|
var MetatablePlugin = class extends import_obsidian6.Plugin {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "settings");
|
|
__publicField(this, "sidebarView");
|
|
__publicField(this, "toggleSidebar", async () => {
|
|
const { workspace } = this.app;
|
|
const existing = workspace.getLeavesOfType(SidebarViewType);
|
|
if (existing.length > 0) {
|
|
workspace.detachLeavesOfType(SidebarViewType);
|
|
} else {
|
|
await workspace.getRightLeaf(false).setViewState({
|
|
type: SidebarViewType,
|
|
active: true
|
|
});
|
|
workspace.revealLeaf(workspace.getLeavesOfType(SidebarViewType)[0]);
|
|
}
|
|
});
|
|
}
|
|
async onload() {
|
|
const iconName = "bracket-glyph";
|
|
await this.loadSettings();
|
|
this.settings.theme = queryTheme();
|
|
this.registerMarkdownPostProcessor(frontmatterProcessor.bind(this));
|
|
this.addSettingTab(new MetatableSettingTab(this.app, this));
|
|
this.registerView(
|
|
SidebarViewType,
|
|
(leaf) => this.sidebarView = new SidebarView(leaf, this.settings, iconName)
|
|
);
|
|
this.addRibbonIcon(iconName, "Metatable", () => this.toggleSidebar());
|
|
this.addCommand({
|
|
id: "toggle-metatable-sidebar",
|
|
name: "Toggle Metatable sidebar",
|
|
callback: () => this.toggleSidebar()
|
|
});
|
|
}
|
|
onunload() {
|
|
this.app.workspace.detachLeavesOfType(SidebarViewType);
|
|
}
|
|
async loadSettings() {
|
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
|
}
|
|
async saveSettings() {
|
|
await this.saveData(this.settings);
|
|
}
|
|
};
|
|
async function frontmatterProcessor(el) {
|
|
var _a;
|
|
const plugin = this;
|
|
const frontmatter = el.querySelector(".frontmatter");
|
|
if (frontmatter !== null) {
|
|
const embed = el.querySelector(".internal-embed");
|
|
if (embed !== null) {
|
|
return;
|
|
}
|
|
const target = el.querySelector(".frontmatter-container");
|
|
target.style.display = "none";
|
|
const raw = (_a = frontmatter.querySelector("code")) == null ? void 0 : _a.textContent;
|
|
const context = {
|
|
app: plugin.app,
|
|
settings: plugin.settings
|
|
};
|
|
const _dispose = createInline(target.parentNode, raw, context);
|
|
}
|
|
}
|
|
|
|
// src/main.ts
|
|
var main_default = MetatablePlugin;
|