vault backup: 2026-04-16 20:14:53
This commit is contained in:
462
.obsidian/plugins/multi-properties/duplicate.js
vendored
462
.obsidian/plugins/multi-properties/duplicate.js
vendored
@@ -681,6 +681,43 @@ function apply_adjustments(error) {
|
||||
}
|
||||
}
|
||||
|
||||
// node_modules/svelte/src/internal/client/reactivity/status.js
|
||||
var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
|
||||
function set_signal_status(signal, status) {
|
||||
signal.f = signal.f & STATUS_MASK | status;
|
||||
}
|
||||
function update_derived_status(derived2) {
|
||||
if ((derived2.f & CONNECTED) !== 0 || derived2.deps === null) {
|
||||
set_signal_status(derived2, CLEAN);
|
||||
} else {
|
||||
set_signal_status(derived2, MAYBE_DIRTY);
|
||||
}
|
||||
}
|
||||
|
||||
// node_modules/svelte/src/internal/client/reactivity/utils.js
|
||||
function clear_marked(deps) {
|
||||
if (deps === null) return;
|
||||
for (const dep of deps) {
|
||||
if ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {
|
||||
continue;
|
||||
}
|
||||
dep.f ^= WAS_MARKED;
|
||||
clear_marked(
|
||||
/** @type {Derived} */
|
||||
dep.deps
|
||||
);
|
||||
}
|
||||
}
|
||||
function defer_effect(effect2, dirty_effects, maybe_dirty_effects) {
|
||||
if ((effect2.f & DIRTY) !== 0) {
|
||||
dirty_effects.add(effect2);
|
||||
} else if ((effect2.f & MAYBE_DIRTY) !== 0) {
|
||||
maybe_dirty_effects.add(effect2);
|
||||
}
|
||||
clear_marked(effect2.deps);
|
||||
set_signal_status(effect2, CLEAN);
|
||||
}
|
||||
|
||||
// node_modules/svelte/src/internal/client/reactivity/batch.js
|
||||
var batches = /* @__PURE__ */ new Set();
|
||||
var current_batch = null;
|
||||
@@ -731,14 +768,14 @@ var Batch = class _Batch {
|
||||
#deferred = null;
|
||||
/**
|
||||
* Deferred effects (which run after async work has completed) that are DIRTY
|
||||
* @type {Effect[]}
|
||||
* @type {Set<Effect>}
|
||||
*/
|
||||
#dirty_effects = [];
|
||||
#dirty_effects = /* @__PURE__ */ new Set();
|
||||
/**
|
||||
* Deferred effects that are MAYBE_DIRTY
|
||||
* @type {Effect[]}
|
||||
* @type {Set<Effect>}
|
||||
*/
|
||||
#maybe_dirty_effects = [];
|
||||
#maybe_dirty_effects = /* @__PURE__ */ new Set();
|
||||
/**
|
||||
* A set of branches that still exist, but will be destroyed when this batch
|
||||
* is committed — we skip over these during `process`
|
||||
@@ -757,28 +794,22 @@ var Batch = class _Batch {
|
||||
queued_root_effects = [];
|
||||
previous_batch = null;
|
||||
this.apply();
|
||||
var target = {
|
||||
parent: null,
|
||||
effect: null,
|
||||
effects: [],
|
||||
render_effects: [],
|
||||
block_effects: []
|
||||
};
|
||||
var effects = [];
|
||||
var render_effects = [];
|
||||
for (const root6 of root_effects) {
|
||||
this.#traverse_effect_tree(root6, target);
|
||||
this.#traverse_effect_tree(root6, effects, render_effects);
|
||||
}
|
||||
if (!this.is_fork) {
|
||||
this.#resolve();
|
||||
}
|
||||
if (this.is_deferred()) {
|
||||
this.#defer_effects(target.effects);
|
||||
this.#defer_effects(target.render_effects);
|
||||
this.#defer_effects(target.block_effects);
|
||||
this.#defer_effects(render_effects);
|
||||
this.#defer_effects(effects);
|
||||
} else {
|
||||
previous_batch = this;
|
||||
current_batch = null;
|
||||
flush_queued_effects(target.render_effects);
|
||||
flush_queued_effects(target.effects);
|
||||
flush_queued_effects(render_effects);
|
||||
flush_queued_effects(effects);
|
||||
previous_batch = null;
|
||||
this.#deferred?.resolve();
|
||||
}
|
||||
@@ -788,34 +819,32 @@ var Batch = class _Batch {
|
||||
* Traverse the effect tree, executing effects or stashing
|
||||
* them for later execution as appropriate
|
||||
* @param {Effect} root
|
||||
* @param {EffectTarget} target
|
||||
* @param {Effect[]} effects
|
||||
* @param {Effect[]} render_effects
|
||||
*/
|
||||
#traverse_effect_tree(root6, target) {
|
||||
#traverse_effect_tree(root6, effects, render_effects) {
|
||||
root6.f ^= CLEAN;
|
||||
var effect2 = root6.first;
|
||||
var pending_boundary = null;
|
||||
while (effect2 !== null) {
|
||||
var flags2 = effect2.f;
|
||||
var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
|
||||
var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
|
||||
var skip = is_skippable_branch || (flags2 & INERT) !== 0 || this.skipped_effects.has(effect2);
|
||||
if ((effect2.f & BOUNDARY_EFFECT) !== 0 && effect2.b?.is_pending()) {
|
||||
target = {
|
||||
parent: target,
|
||||
effect: effect2,
|
||||
effects: [],
|
||||
render_effects: [],
|
||||
block_effects: []
|
||||
};
|
||||
if (async_mode_flag && pending_boundary === null && (flags2 & BOUNDARY_EFFECT) !== 0 && effect2.b?.is_pending) {
|
||||
pending_boundary = effect2;
|
||||
}
|
||||
if (!skip && effect2.fn !== null) {
|
||||
if (is_branch) {
|
||||
effect2.f ^= CLEAN;
|
||||
} else if (pending_boundary !== null && (flags2 & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {
|
||||
pending_boundary.b.defer_effect(effect2);
|
||||
} else if ((flags2 & EFFECT) !== 0) {
|
||||
target.effects.push(effect2);
|
||||
effects.push(effect2);
|
||||
} else if (async_mode_flag && (flags2 & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {
|
||||
target.render_effects.push(effect2);
|
||||
render_effects.push(effect2);
|
||||
} else if (is_dirty(effect2)) {
|
||||
if ((effect2.f & BLOCK_EFFECT) !== 0) target.block_effects.push(effect2);
|
||||
if ((flags2 & BLOCK_EFFECT) !== 0) this.#dirty_effects.add(effect2);
|
||||
update_effect(effect2);
|
||||
}
|
||||
var child2 = effect2.first;
|
||||
@@ -827,12 +856,8 @@ var Batch = class _Batch {
|
||||
var parent = effect2.parent;
|
||||
effect2 = effect2.next;
|
||||
while (effect2 === null && parent !== null) {
|
||||
if (parent === target.effect) {
|
||||
this.#defer_effects(target.effects);
|
||||
this.#defer_effects(target.render_effects);
|
||||
this.#defer_effects(target.block_effects);
|
||||
target = /** @type {EffectTarget} */
|
||||
target.parent;
|
||||
if (parent === pending_boundary) {
|
||||
pending_boundary = null;
|
||||
}
|
||||
effect2 = parent.next;
|
||||
parent = parent.parent;
|
||||
@@ -843,27 +868,8 @@ var Batch = class _Batch {
|
||||
* @param {Effect[]} effects
|
||||
*/
|
||||
#defer_effects(effects) {
|
||||
for (const e of effects) {
|
||||
const target = (e.f & DIRTY) !== 0 ? this.#dirty_effects : this.#maybe_dirty_effects;
|
||||
target.push(e);
|
||||
this.#clear_marked(e.deps);
|
||||
set_signal_status(e, CLEAN);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {Value[] | null} deps
|
||||
*/
|
||||
#clear_marked(deps) {
|
||||
if (deps === null) return;
|
||||
for (const dep of deps) {
|
||||
if ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {
|
||||
continue;
|
||||
}
|
||||
dep.f ^= WAS_MARKED;
|
||||
this.#clear_marked(
|
||||
/** @type {Derived} */
|
||||
dep.deps
|
||||
);
|
||||
for (var i = 0; i < effects.length; i += 1) {
|
||||
defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -873,7 +879,7 @@ var Batch = class _Batch {
|
||||
* @param {any} value
|
||||
*/
|
||||
capture(source2, value) {
|
||||
if (!this.previous.has(source2)) {
|
||||
if (value !== UNINITIALIZED && !this.previous.has(source2)) {
|
||||
this.previous.set(source2, value);
|
||||
}
|
||||
if ((source2.f & ERROR_VALUE) === 0) {
|
||||
@@ -920,13 +926,6 @@ var Batch = class _Batch {
|
||||
this.previous.clear();
|
||||
var previous_batch_values = batch_values;
|
||||
var is_earlier = true;
|
||||
var dummy_target = {
|
||||
parent: null,
|
||||
effect: null,
|
||||
effects: [],
|
||||
render_effects: [],
|
||||
block_effects: []
|
||||
};
|
||||
for (const batch of batches) {
|
||||
if (batch === this) {
|
||||
is_earlier = false;
|
||||
@@ -959,7 +958,7 @@ var Batch = class _Batch {
|
||||
current_batch = batch;
|
||||
batch.apply();
|
||||
for (const root6 of queued_root_effects) {
|
||||
batch.#traverse_effect_tree(root6, dummy_target);
|
||||
batch.#traverse_effect_tree(root6, [], []);
|
||||
}
|
||||
batch.deactivate();
|
||||
}
|
||||
@@ -991,6 +990,7 @@ var Batch = class _Batch {
|
||||
}
|
||||
revive() {
|
||||
for (const e of this.#dirty_effects) {
|
||||
this.#maybe_dirty_effects.delete(e);
|
||||
set_signal_status(e, DIRTY);
|
||||
schedule_effect(e);
|
||||
}
|
||||
@@ -998,8 +998,6 @@ var Batch = class _Batch {
|
||||
set_signal_status(e, MAYBE_DIRTY);
|
||||
schedule_effect(e);
|
||||
}
|
||||
this.#dirty_effects = [];
|
||||
this.#maybe_dirty_effects = [];
|
||||
this.flush();
|
||||
}
|
||||
/** @param {() => void} fn */
|
||||
@@ -1284,7 +1282,7 @@ function boundary(node, props, children) {
|
||||
var Boundary = class {
|
||||
/** @type {Boundary | null} */
|
||||
parent;
|
||||
#pending = false;
|
||||
is_pending = false;
|
||||
/** @type {TemplateNode} */
|
||||
#anchor;
|
||||
/** @type {TemplateNode | null} */
|
||||
@@ -1308,6 +1306,10 @@ var Boundary = class {
|
||||
#local_pending_count = 0;
|
||||
#pending_count = 0;
|
||||
#is_creating_fallback = false;
|
||||
/** @type {Set<Effect>} */
|
||||
#dirty_effects = /* @__PURE__ */ new Set();
|
||||
/** @type {Set<Effect>} */
|
||||
#maybe_dirty_effects = /* @__PURE__ */ new Set();
|
||||
/**
|
||||
* A source containing the number of pending async deriveds/expressions.
|
||||
* Only created if `$effect.pending()` is used inside the boundary,
|
||||
@@ -1336,7 +1338,7 @@ var Boundary = class {
|
||||
this.#children = children;
|
||||
this.parent = /** @type {Effect} */
|
||||
active_effect.b;
|
||||
this.#pending = !!this.#props.pending;
|
||||
this.is_pending = !!this.#props.pending;
|
||||
this.#effect = block(() => {
|
||||
active_effect.b = this;
|
||||
if (hydrating) {
|
||||
@@ -1351,6 +1353,9 @@ var Boundary = class {
|
||||
this.#hydrate_pending_content();
|
||||
} else {
|
||||
this.#hydrate_resolved_content();
|
||||
if (this.#pending_count === 0) {
|
||||
this.is_pending = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var anchor = this.#get_anchor();
|
||||
@@ -1362,7 +1367,7 @@ var Boundary = class {
|
||||
if (this.#pending_count > 0) {
|
||||
this.#show_pending_snippet();
|
||||
} else {
|
||||
this.#pending = false;
|
||||
this.is_pending = false;
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
@@ -1379,7 +1384,6 @@ var Boundary = class {
|
||||
} catch (error) {
|
||||
this.error(error);
|
||||
}
|
||||
this.#pending = false;
|
||||
}
|
||||
#hydrate_pending_content() {
|
||||
const pending2 = this.#props.pending;
|
||||
@@ -1403,13 +1407,13 @@ var Boundary = class {
|
||||
this.#pending_effect = null;
|
||||
}
|
||||
);
|
||||
this.#pending = false;
|
||||
this.is_pending = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
#get_anchor() {
|
||||
var anchor = this.#anchor;
|
||||
if (this.#pending) {
|
||||
if (this.is_pending) {
|
||||
this.#pending_anchor = create_text();
|
||||
this.#anchor.before(this.#pending_anchor);
|
||||
anchor = this.#pending_anchor;
|
||||
@@ -1417,11 +1421,18 @@ var Boundary = class {
|
||||
return anchor;
|
||||
}
|
||||
/**
|
||||
* Returns `true` if the effect exists inside a boundary whose pending snippet is shown
|
||||
* Defer an effect inside a pending boundary until the boundary resolves
|
||||
* @param {Effect} effect
|
||||
*/
|
||||
defer_effect(effect2) {
|
||||
defer_effect(effect2, this.#dirty_effects, this.#maybe_dirty_effects);
|
||||
}
|
||||
/**
|
||||
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is_pending() {
|
||||
return this.#pending || !!this.parent && this.parent.is_pending();
|
||||
is_rendered() {
|
||||
return !this.is_pending && (!this.parent || this.parent.is_rendered());
|
||||
}
|
||||
has_pending_snippet() {
|
||||
return !!this.#props.pending;
|
||||
@@ -1478,7 +1489,17 @@ var Boundary = class {
|
||||
}
|
||||
this.#pending_count += d;
|
||||
if (this.#pending_count === 0) {
|
||||
this.#pending = false;
|
||||
this.is_pending = false;
|
||||
for (const e of this.#dirty_effects) {
|
||||
set_signal_status(e, DIRTY);
|
||||
schedule_effect(e);
|
||||
}
|
||||
for (const e of this.#maybe_dirty_effects) {
|
||||
set_signal_status(e, MAYBE_DIRTY);
|
||||
schedule_effect(e);
|
||||
}
|
||||
this.#dirty_effects.clear();
|
||||
this.#maybe_dirty_effects.clear();
|
||||
if (this.#pending_effect) {
|
||||
pause_effect(this.#pending_effect, () => {
|
||||
this.#pending_effect = null;
|
||||
@@ -1555,7 +1576,7 @@ var Boundary = class {
|
||||
this.#failed_effect = null;
|
||||
});
|
||||
}
|
||||
this.#pending = this.has_pending_snippet();
|
||||
this.is_pending = this.has_pending_snippet();
|
||||
this.#main_effect = this.#run(() => {
|
||||
this.#is_creating_fallback = false;
|
||||
return branch(() => this.#children(this.#anchor));
|
||||
@@ -1563,7 +1584,7 @@ var Boundary = class {
|
||||
if (this.#pending_count > 0) {
|
||||
this.#show_pending_snippet();
|
||||
} else {
|
||||
this.#pending = false;
|
||||
this.is_pending = false;
|
||||
}
|
||||
};
|
||||
var previous_reaction = active_reaction;
|
||||
@@ -1717,7 +1738,7 @@ function derived(fn) {
|
||||
return signal;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function async_derived(fn, location) {
|
||||
function async_derived(fn, label, location) {
|
||||
let parent = (
|
||||
/** @type {Effect | null} */
|
||||
active_effect
|
||||
@@ -1738,6 +1759,7 @@ function async_derived(fn, location) {
|
||||
/** @type {V} */
|
||||
UNINITIALIZED
|
||||
);
|
||||
if (dev_fallback_default) signal.label = label;
|
||||
var should_suspend = !active_reaction;
|
||||
var deferreds = /* @__PURE__ */ new Map();
|
||||
async_effect(() => {
|
||||
@@ -1761,7 +1783,7 @@ function async_derived(fn, location) {
|
||||
current_batch
|
||||
);
|
||||
if (should_suspend) {
|
||||
var blocking = !boundary2.is_pending();
|
||||
var blocking = boundary2.is_rendered();
|
||||
boundary2.update_pending_count(1);
|
||||
batch.increment(blocking);
|
||||
deferreds.get(batch)?.reject(STALE_REACTION);
|
||||
@@ -1901,10 +1923,14 @@ function execute_derived(derived2) {
|
||||
function update_derived(derived2) {
|
||||
var value = execute_derived(derived2);
|
||||
if (!derived2.equals(value)) {
|
||||
if (!current_batch?.is_fork) {
|
||||
derived2.v = value;
|
||||
}
|
||||
derived2.wv = increment_write_version();
|
||||
if (!current_batch?.is_fork || derived2.deps === null) {
|
||||
derived2.v = value;
|
||||
if (derived2.deps === null) {
|
||||
set_signal_status(derived2, CLEAN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_destroying_effect) {
|
||||
return;
|
||||
@@ -1914,8 +1940,7 @@ function update_derived(derived2) {
|
||||
batch_values.set(derived2, value);
|
||||
}
|
||||
} else {
|
||||
var status = (derived2.f & CONNECTED) === 0 ? MAYBE_DIRTY : CLEAN;
|
||||
set_signal_status(derived2, status);
|
||||
update_derived_status(derived2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2016,13 +2041,14 @@ function internal_set(source2, value) {
|
||||
}
|
||||
}
|
||||
if ((source2.f & DERIVED) !== 0) {
|
||||
const derived2 = (
|
||||
/** @type {Derived} */
|
||||
source2
|
||||
);
|
||||
if ((source2.f & DIRTY) !== 0) {
|
||||
execute_derived(
|
||||
/** @type {Derived} */
|
||||
source2
|
||||
);
|
||||
execute_derived(derived2);
|
||||
}
|
||||
set_signal_status(source2, (source2.f & CONNECTED) !== 0 ? CLEAN : MAYBE_DIRTY);
|
||||
update_derived_status(derived2);
|
||||
}
|
||||
source2.wv = increment_write_version();
|
||||
mark_reactions(source2, DIRTY);
|
||||
@@ -2989,23 +3015,24 @@ function is_dirty(reaction) {
|
||||
reaction.f &= ~WAS_MARKED;
|
||||
}
|
||||
if ((flags2 & MAYBE_DIRTY) !== 0) {
|
||||
var dependencies = reaction.deps;
|
||||
if (dependencies !== null) {
|
||||
var length = dependencies.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var dependency = dependencies[i];
|
||||
if (is_dirty(
|
||||
var dependencies = (
|
||||
/** @type {Value[]} */
|
||||
reaction.deps
|
||||
);
|
||||
var length = dependencies.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var dependency = dependencies[i];
|
||||
if (is_dirty(
|
||||
/** @type {Derived} */
|
||||
dependency
|
||||
)) {
|
||||
update_derived(
|
||||
/** @type {Derived} */
|
||||
dependency
|
||||
)) {
|
||||
update_derived(
|
||||
/** @type {Derived} */
|
||||
dependency
|
||||
);
|
||||
}
|
||||
if (dependency.wv > reaction.wv) {
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
if (dependency.wv > reaction.wv) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ((flags2 & CONNECTED) !== 0 && // During time traveling we don't want to reset the status so that
|
||||
@@ -3154,20 +3181,17 @@ function remove_reaction(signal, dependency) {
|
||||
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
||||
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
||||
(new_deps === null || !new_deps.includes(dependency))) {
|
||||
set_signal_status(dependency, MAYBE_DIRTY);
|
||||
if ((dependency.f & CONNECTED) !== 0) {
|
||||
dependency.f ^= CONNECTED;
|
||||
dependency.f &= ~WAS_MARKED;
|
||||
}
|
||||
destroy_derived_effects(
|
||||
/** @type {Derived} **/
|
||||
var derived2 = (
|
||||
/** @type {Derived} */
|
||||
dependency
|
||||
);
|
||||
remove_reactions(
|
||||
/** @type {Derived} **/
|
||||
dependency,
|
||||
0
|
||||
);
|
||||
if ((derived2.f & CONNECTED) !== 0) {
|
||||
derived2.f ^= CONNECTED;
|
||||
derived2.f &= ~WAS_MARKED;
|
||||
}
|
||||
update_derived_status(derived2);
|
||||
destroy_derived_effects(derived2);
|
||||
remove_reactions(derived2, 0);
|
||||
}
|
||||
}
|
||||
function remove_reactions(signal, start_index) {
|
||||
@@ -3284,15 +3308,15 @@ function get(signal) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_destroying_effect) {
|
||||
if (old_values.has(signal)) {
|
||||
return old_values.get(signal);
|
||||
}
|
||||
if (is_derived) {
|
||||
var derived2 = (
|
||||
/** @type {Derived} */
|
||||
signal
|
||||
);
|
||||
if (is_destroying_effect && old_values.has(signal)) {
|
||||
return old_values.get(signal);
|
||||
}
|
||||
if (is_derived) {
|
||||
var derived2 = (
|
||||
/** @type {Derived} */
|
||||
signal
|
||||
);
|
||||
if (is_destroying_effect) {
|
||||
var value = derived2.v;
|
||||
if ((derived2.f & CLEAN) === 0 && derived2.reactions !== null || depends_on_old_values(derived2)) {
|
||||
value = execute_derived(derived2);
|
||||
@@ -3300,13 +3324,15 @@ function get(signal) {
|
||||
old_values.set(derived2, value);
|
||||
return value;
|
||||
}
|
||||
} else if (is_derived && (!batch_values?.has(signal) || current_batch?.is_fork && !effect_tracking())) {
|
||||
derived2 = /** @type {Derived} */
|
||||
signal;
|
||||
var should_connect = (derived2.f & CONNECTED) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & CONNECTED) !== 0);
|
||||
var is_new = derived2.deps === null;
|
||||
if (is_dirty(derived2)) {
|
||||
if (should_connect) {
|
||||
derived2.f |= CONNECTED;
|
||||
}
|
||||
update_derived(derived2);
|
||||
}
|
||||
if (is_updating_effect && effect_tracking() && (derived2.f & CONNECTED) === 0) {
|
||||
if (should_connect && !is_new) {
|
||||
reconnect(derived2);
|
||||
}
|
||||
}
|
||||
@@ -3320,7 +3346,7 @@ function get(signal) {
|
||||
}
|
||||
function reconnect(derived2) {
|
||||
if (derived2.deps === null) return;
|
||||
derived2.f ^= CONNECTED;
|
||||
derived2.f |= CONNECTED;
|
||||
for (const dep of derived2.deps) {
|
||||
(dep.reactions ??= []).push(derived2);
|
||||
if ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {
|
||||
@@ -3356,10 +3382,6 @@ function untrack(fn) {
|
||||
untracking = previous_untracking;
|
||||
}
|
||||
}
|
||||
var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
|
||||
function set_signal_status(signal, status) {
|
||||
signal.f = signal.f & STATUS_MASK | status;
|
||||
}
|
||||
|
||||
// node_modules/svelte/src/utils.js
|
||||
var DOM_BOOLEAN_ATTRIBUTES = [
|
||||
@@ -4432,14 +4454,6 @@ function remove_input_defaults(input) {
|
||||
queue_micro_task(remove_defaults);
|
||||
add_form_reset_listener();
|
||||
}
|
||||
function set_checked(element2, checked) {
|
||||
var attributes = get_attributes(element2);
|
||||
if (attributes.checked === (attributes.checked = // treat null and undefined the same for the initial value
|
||||
checked ?? void 0)) {
|
||||
return;
|
||||
}
|
||||
element2.checked = checked;
|
||||
}
|
||||
function set_attribute2(element2, attribute, value, skip_warning) {
|
||||
var attributes = get_attributes(element2);
|
||||
if (hydrating) {
|
||||
@@ -5417,9 +5431,9 @@ var KNOWN_BAD_CHARACTERS = [
|
||||
];
|
||||
|
||||
// src/AddPropForm.svelte
|
||||
var root_12 = from_html(`<button type="button" class="prop-chip"> </button>`);
|
||||
var root_12 = from_html(`<button type="button" class="suggested-prop"> </button>`);
|
||||
var root2 = from_html(`<div id="multi-properties-modal" class="modal-content"><div id="alert-container" class="alert-container hidden svelte-18exwij"><div>ERROR</div> <div id="alert-text"> </div></div> <p>Select from existing properties or create new ones:</p> <div class="suggested-props svelte-18exwij"></div> <p>Type in a property name, then value. Use the dropbox to choose what type of
|
||||
data you wish to store.</p> <p> </p> <p>If you want to add Tags, use the name "tags".</p> <form><label><input type="checkbox"/> </label> <div class="modal-inputs-container svelte-18exwij"></div> <div class="modal-add-container svelte-18exwij"><button type="button" class="a-btn">Add</button></div> <div class="modal-button-container"><button type="submit" class="btn-submit">Submit</button></div></form></div>`);
|
||||
data you wish to store.</p> <p> </p> <p>If you want to add Tags, use the name "tags".</p> <form><label> <select id="alter-prop-select"><option>Ignore the prop entirely.</option><option>Overwrite new value over prop.</option><option>Append new value to prop.</option></select></label> <div class="modal-inputs-container svelte-18exwij"></div> <div class="modal-add-container svelte-18exwij"><button type="button" class="a-btn">Add</button></div> <div class="modal-button-container"><button type="submit" class="btn-submit">Submit</button></div></form></div>`);
|
||||
var $$css2 = {
|
||||
hash: "svelte-18exwij",
|
||||
code: ".modal-inputs-container.svelte-18exwij {height:200px;width:100%;overflow-y:scroll;border-radius:5px;border-style:solid;display:flex;flex-direction:column;align-items:center;}.modal-add-container.svelte-18exwij {margin-top:10px;}.alert-container.svelte-18exwij {display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:10px;background-color:red;font-weight:bold;}.suggested-props.svelte-18exwij {overflow-y:scroll;max-height:100px;}.hidden.svelte-18exwij {display:none;}"
|
||||
@@ -5427,15 +5441,14 @@ var $$css2 = {
|
||||
function AddPropForm($$anchor, $$props) {
|
||||
push($$props, true);
|
||||
append_styles($$anchor, $$css2);
|
||||
let overwrite = prop($$props, "overwrite", 15);
|
||||
let alterProp = prop($$props, "alterProp", 15);
|
||||
let countInputs = 0;
|
||||
let formEl = state(proxy(document.createElement("form")));
|
||||
let errorEl = state(proxy(document.createElement("div")));
|
||||
let alertText = state(".");
|
||||
let inputEls = state(proxy([]));
|
||||
function onCheckboxChange() {
|
||||
overwrite(!overwrite());
|
||||
$$props.changeBool(overwrite());
|
||||
function onDropdownChange(newSetting) {
|
||||
$$props.changeSetting(newSetting);
|
||||
}
|
||||
onMount(() => {
|
||||
$$props.defaultProps.length > 0 ? addInputs($$props.defaultProps) : addInputs([{ type: "text", name: "", value: "" }]);
|
||||
@@ -5523,7 +5536,7 @@ function AddPropForm($$anchor, $$props) {
|
||||
let propObj = {
|
||||
type: obsidianType,
|
||||
data: value,
|
||||
overwrite: false,
|
||||
alterProp: alterProp(),
|
||||
delimiter: $$props.delimiter
|
||||
};
|
||||
obj.set(name, propObj);
|
||||
@@ -5553,11 +5566,17 @@ function AddPropForm($$anchor, $$props) {
|
||||
reset(p);
|
||||
var form = sibling(p, 4);
|
||||
var label = child(form);
|
||||
var input_1 = child(label);
|
||||
remove_input_defaults(input_1);
|
||||
input_1.__change = onCheckboxChange;
|
||||
var text_3 = sibling(input_1, 1, true);
|
||||
text_3.nodeValue = "Overwrite existing properties";
|
||||
var text_3 = child(label);
|
||||
text_3.nodeValue = "How to alter props that already exist on notes. ";
|
||||
var select = sibling(text_3);
|
||||
select.__change = () => onDropdownChange(alterProp());
|
||||
var option = child(select);
|
||||
option.value = option.__value = "ignore";
|
||||
var option_1 = sibling(option);
|
||||
option_1.value = option_1.__value = "overwrite";
|
||||
var option_2 = sibling(option_1);
|
||||
option_2.value = option_2.__value = "append";
|
||||
reset(select);
|
||||
reset(label);
|
||||
var div_4 = sibling(label, 2);
|
||||
each(div_4, 21, () => get(inputEls), (input) => input.id, ($$anchor2, input, $$index_1) => {
|
||||
@@ -5602,9 +5621,9 @@ function AddPropForm($$anchor, $$props) {
|
||||
set_text(text2, get(alertText));
|
||||
set_text(text_2, `If you want to make a List property, use the Text data type and separate
|
||||
each value with a "${$$props.delimiter ?? ""}".`);
|
||||
set_checked(input_1, overwrite());
|
||||
});
|
||||
event("submit", form, onSubmit);
|
||||
bind_select_value(select, alterProp);
|
||||
append($$anchor, div);
|
||||
pop();
|
||||
}
|
||||
@@ -5623,9 +5642,18 @@ var $$css3 = {
|
||||
function AddConfirmForm($$anchor, $$props) {
|
||||
push($$props, true);
|
||||
append_styles($$anchor, $$css3);
|
||||
let overwrite = prop($$props, "overwrite", 3, true);
|
||||
let btnCancel = state(null);
|
||||
let msg = user_derived(() => overwrite() ? "Any pre-existing text props will have their values overwritten." : "Any pre-existing text props will have their values be appended to.");
|
||||
let msg = user_derived(() => createPropMsg($$props.alterProp));
|
||||
function createPropMsg(value) {
|
||||
switch (value) {
|
||||
case "ignore":
|
||||
return "Any of these text props on existing notes will not be affected.";
|
||||
case "append":
|
||||
return "NOTE: Any pre-existing text props will have their values be appended to.";
|
||||
case "overwrite":
|
||||
return "WARNING: Any pre-existing text props will have their values overwritten.";
|
||||
}
|
||||
}
|
||||
function onSubmit(e) {
|
||||
e.preventDefault();
|
||||
$$props.submission();
|
||||
@@ -5666,10 +5694,10 @@ delegate(["click"]);
|
||||
|
||||
// src/AddConfirmModal.ts
|
||||
var AddConfirmModal = class extends import_obsidian.Modal {
|
||||
constructor(app, props, overwrite, submission) {
|
||||
constructor(app, props, alterProp, submission) {
|
||||
super(app);
|
||||
this.props = props;
|
||||
this.overwrite = overwrite;
|
||||
this.alterProp = alterProp;
|
||||
this.submission = submission;
|
||||
}
|
||||
onSubmit() {
|
||||
@@ -5685,7 +5713,7 @@ var AddConfirmModal = class extends import_obsidian.Modal {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
newProps: this.props,
|
||||
overwrite: this.overwrite,
|
||||
alterProp: this.alterProp,
|
||||
submission: this.onSubmit.bind(this),
|
||||
cancel: this.onCancel.bind(this)
|
||||
}
|
||||
@@ -5695,13 +5723,13 @@ var AddConfirmModal = class extends import_obsidian.Modal {
|
||||
|
||||
// src/AddPropModal.ts
|
||||
var PropModal = class extends import_obsidian2.Modal {
|
||||
constructor(app, submission, overwrite, delimiter, defaultProps, changeBool, suggestedProps) {
|
||||
constructor(app, submission, alterProp, delimiter, defaultProps, changeSetting, suggestedProps) {
|
||||
super(app);
|
||||
this.submission = submission;
|
||||
this.overwrite = overwrite;
|
||||
this.alterProp = alterProp;
|
||||
this.delimiter = delimiter;
|
||||
this.defaultProps = defaultProps;
|
||||
this.changeBool = changeBool;
|
||||
this.changeSetting = changeSetting;
|
||||
this.suggestedProps = suggestedProps;
|
||||
}
|
||||
//Run form submission if user clicks confirm.
|
||||
@@ -5709,9 +5737,9 @@ var PropModal = class extends import_obsidian2.Modal {
|
||||
this.submission(this.props);
|
||||
this.close();
|
||||
}
|
||||
updateBool(bool) {
|
||||
this.overwrite = bool;
|
||||
this.changeBool(bool);
|
||||
updateSetting(value) {
|
||||
this.alterProp = value;
|
||||
this.changeSetting(value);
|
||||
}
|
||||
//Pull up confirmation form when user submits base form.
|
||||
onSubmit(props) {
|
||||
@@ -5719,7 +5747,7 @@ var PropModal = class extends import_obsidian2.Modal {
|
||||
new AddConfirmModal(
|
||||
this.app,
|
||||
this.props,
|
||||
this.overwrite,
|
||||
this.alterProp,
|
||||
this.onConfirm.bind(this)
|
||||
).open();
|
||||
}
|
||||
@@ -5729,10 +5757,10 @@ var PropModal = class extends import_obsidian2.Modal {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
submission: this.onSubmit.bind(this),
|
||||
overwrite: this.overwrite,
|
||||
alterProp: this.alterProp,
|
||||
delimiter: this.delimiter,
|
||||
defaultProps: this.defaultProps,
|
||||
changeBool: this.updateBool.bind(this),
|
||||
changeSetting: this.updateSetting.bind(this),
|
||||
suggestedProps: this.suggestedProps
|
||||
}
|
||||
});
|
||||
@@ -5749,12 +5777,11 @@ var SettingTab = class extends import_obsidian3.PluginSettingTab {
|
||||
display() {
|
||||
let { containerEl } = this;
|
||||
containerEl.empty();
|
||||
new import_obsidian3.Setting(containerEl).setName("Overwrite existing text").setDesc(
|
||||
"When adding a property with a name that already exists, the text will overwrite the prop's existing value. If left disabled, the new value will be appended to the old as a List."
|
||||
).addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.overwrite);
|
||||
toggle.onChange(async (value) => {
|
||||
this.plugin.settings.overwrite = value;
|
||||
new import_obsidian3.Setting(containerEl).setName("How to alter existing properties.").setDesc(
|
||||
"Determine what to do when a property with the same name already exists in a file. Note that incompatible types cannot be appended.(adding a number to a date)"
|
||||
).addDropdown((dropdown) => {
|
||||
dropdown.addOption("overwrite", "Overwrite prop").addOption("append", "Append to prop").addOption("ignore", "Ignore prop").setValue(this.plugin.settings.alterProp).onChange(async (value) => {
|
||||
this.plugin.settings.alterProp = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
@@ -5818,8 +5845,8 @@ function RemovePropForm($$anchor, $$props) {
|
||||
});
|
||||
let isMaxChecked = user_derived(() => get(inputs).length > 0 && get(checkCount) >= get(inputs).length);
|
||||
function onCheckboxChange(event2) {
|
||||
let checked = event2.target.checked;
|
||||
checked ? update(checkCount) : update(checkCount, -1);
|
||||
const target = event2.currentTarget;
|
||||
target.checked ? update(checkCount) : update(checkCount, -1);
|
||||
}
|
||||
function toggleAll() {
|
||||
const shouldCheckAll = !get(isMaxChecked);
|
||||
@@ -5989,14 +6016,17 @@ var RemoveModal = class extends import_obsidian5.Modal {
|
||||
|
||||
// src/frontmatter.ts
|
||||
var import_obsidian6 = require("obsidian");
|
||||
async function addProperties(fileProcessor, file, props, overwrite, propCache) {
|
||||
async function addProperties(fileProcessor, file, props, alterProp, propCache) {
|
||||
await fileProcessor(file, (frontmatter) => {
|
||||
for (const [key2, value] of props) {
|
||||
if (alterProp === "ignore" && frontmatter[key2]) {
|
||||
continue;
|
||||
}
|
||||
if (key2 === "tags" && !frontmatter.hasOwnProperty("tags") && !Array.isArray(value.data)) {
|
||||
frontmatter[key2] = [value.data];
|
||||
continue;
|
||||
}
|
||||
if (!frontmatter[key2] || overwrite) {
|
||||
if (!frontmatter[key2] || alterProp === "overwrite") {
|
||||
frontmatter[key2] = value.data;
|
||||
continue;
|
||||
}
|
||||
@@ -6009,7 +6039,6 @@ async function addProperties(fileProcessor, file, props, overwrite, propCache) {
|
||||
frontmatter[key2] = arr;
|
||||
continue;
|
||||
} else {
|
||||
frontmatter[key2] = value.data;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -6044,7 +6073,7 @@ function mergeIntoArrays(...args) {
|
||||
|
||||
// src/main.ts
|
||||
var defaultSettings = {
|
||||
overwrite: false,
|
||||
alterProp: "ignore",
|
||||
recursive: true,
|
||||
delimiter: ",",
|
||||
defaultPropPath: ""
|
||||
@@ -6056,8 +6085,8 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
async changeOverwrite(bool) {
|
||||
this.settings.overwrite = bool;
|
||||
async changeAlterProp(value) {
|
||||
this.settings.alterProp = value;
|
||||
await this.saveSettings();
|
||||
}
|
||||
_getFilesFromTabGroup(leaf) {
|
||||
@@ -6247,8 +6276,9 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
})
|
||||
);
|
||||
}
|
||||
async getPropsFromFolder(folder, names) {
|
||||
for (let obj of folder.children) {
|
||||
async getPropsFromFolder(iterable, names) {
|
||||
let objs = iterable instanceof import_obsidian7.TFolder ? iterable.children : iterable;
|
||||
for (let obj of objs) {
|
||||
if (obj instanceof import_obsidian7.TFile && obj.extension === "md") {
|
||||
names = await addPropToSet(
|
||||
this.app.fileManager.processFrontMatter.bind(this.app.fileManager),
|
||||
@@ -6277,8 +6307,9 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
return [...names];
|
||||
}
|
||||
/** Iterates through all files in a folder and runs callback on each file. */
|
||||
async searchFolders(folder, callback) {
|
||||
for (let obj of folder.children) {
|
||||
async searchFolders(iterable, callback) {
|
||||
let objs = iterable instanceof import_obsidian7.TFolder ? iterable.children : iterable;
|
||||
for (let obj of objs) {
|
||||
if (obj instanceof import_obsidian7.TFolder) {
|
||||
if (this.settings.recursive) {
|
||||
await this.searchFolders(obj, callback);
|
||||
@@ -6305,31 +6336,22 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
}
|
||||
async createPropModal(iterable) {
|
||||
let iterateFunc;
|
||||
if (iterable instanceof import_obsidian7.TFolder) {
|
||||
const allFiles = [];
|
||||
this.searchFolders(iterable, async (f) => allFiles.push(f));
|
||||
iterateFunc = async (props) => {
|
||||
await this.searchFolders(
|
||||
iterable,
|
||||
await this.addPropsCallback(props, allFiles.length)
|
||||
);
|
||||
};
|
||||
} else {
|
||||
iterateFunc = async (props) => this.searchFiles(
|
||||
iterable,
|
||||
await this.addPropsCallback(props, iterable.length)
|
||||
);
|
||||
}
|
||||
const allFiles = [];
|
||||
this.searchFolders(iterable, async (f) => allFiles.push(f));
|
||||
iterateFunc = async (props) => this.searchFolders(
|
||||
iterable,
|
||||
await this.addPropsCallback(props, allFiles.length)
|
||||
);
|
||||
let defaultProps;
|
||||
defaultProps = this.loadDefaultProps();
|
||||
const allProps = this.getAllUsedProperties();
|
||||
new PropModal(
|
||||
this.app,
|
||||
iterateFunc,
|
||||
this.settings.overwrite,
|
||||
this.settings.alterProp,
|
||||
this.settings.delimiter,
|
||||
defaultProps,
|
||||
this.changeOverwrite.bind(this),
|
||||
this.changeAlterProp.bind(this),
|
||||
allProps
|
||||
).open();
|
||||
}
|
||||
@@ -6340,25 +6362,17 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
);
|
||||
}
|
||||
/** Create modal for removing properties.
|
||||
* Will call a different function depending on whether files or a folder is used. */
|
||||
* Will create a different callback function depending on whether files or a folder is used. */
|
||||
async createRemoveModal(iterable) {
|
||||
let names;
|
||||
let iterateFunc;
|
||||
if (iterable instanceof import_obsidian7.TFolder) {
|
||||
names = await this.getPropsFromFolder(iterable, /* @__PURE__ */ new Set());
|
||||
const allFiles = [];
|
||||
this.searchFolders(iterable, async (f) => allFiles.push(f));
|
||||
iterateFunc = (props) => this.searchFolders(
|
||||
iterable,
|
||||
this.removePropsCallback(props, allFiles.length)
|
||||
);
|
||||
} else {
|
||||
names = await this.getPropsFromFiles(iterable, /* @__PURE__ */ new Set());
|
||||
iterateFunc = (props) => this.searchFiles(
|
||||
iterable,
|
||||
this.removePropsCallback(props, iterable.length)
|
||||
);
|
||||
}
|
||||
names = await this.getPropsFromFolder(iterable, /* @__PURE__ */ new Set());
|
||||
const allFiles = [];
|
||||
this.searchFolders(iterable, async (f) => allFiles.push(f));
|
||||
iterateFunc = (props) => this.searchFolders(
|
||||
iterable,
|
||||
this.removePropsCallback(props, allFiles.length)
|
||||
);
|
||||
if (names.length === 0) {
|
||||
new import_obsidian7.Notice("No properties to remove", 4e3);
|
||||
return;
|
||||
@@ -6417,7 +6431,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.app.fileManager.processFrontMatter.bind(this.app.fileManager),
|
||||
file,
|
||||
props,
|
||||
this.settings.overwrite,
|
||||
this.settings.alterProp,
|
||||
this.app.metadataCache.getAllPropertyInfos()
|
||||
);
|
||||
count++;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"type":"0","state":true,"pluginVersion":"1.3.0","translationVersion":1742044447802}
|
||||
{"type":"0","state":true,"pluginVersion":"1.4.0","translationVersion":1742044447802}
|
||||
|
||||
52
.obsidian/plugins/multi-properties/main.js
vendored
52
.obsidian/plugins/multi-properties/main.js
vendored
@@ -5433,7 +5433,7 @@ var KNOWN_BAD_CHARACTERS = [
|
||||
// src/AddPropForm.svelte
|
||||
var root_12 = from_html(`<button type="button" class="suggested-prop"> </button>`);
|
||||
var root2 = from_html(`<div id="multi-properties-modal" class="modal-content"><div id="alert-container" class="alert-container hidden svelte-18exwij"><div>ERROR</div> <div id="alert-text"> </div></div> <p>Select from existing properties or create new ones:</p> <div class="suggested-props svelte-18exwij"></div> <p>Type in a property name, then value. Use the dropbox to choose what type of
|
||||
data you wish to store.</p> <p> </p> <p>If you want to add Tags, use the name "tags".</p> <form><label> <select id="alter-prop-select"><option>Ignore the prop entirely.</option><option>Overwrite new value over prop.</option><option>Append new value to prop.</option></select></label> <div class="modal-inputs-container svelte-18exwij"></div> <div class="modal-add-container svelte-18exwij"><button type="button" class="a-btn">Add</button></div> <div class="modal-button-container"><button type="submit" class="btn-submit">Submit</button></div></form></div>`);
|
||||
data you wish to store.</p> <p> </p> <p>如需添加标签,请使用属性名 "tags"。</p> <form><label> <select id="alter-prop-select"><option>Ignore the prop entirely.</option><option>Overwrite new value over prop.</option><option>Append new value to prop.</option></select></label> <div class="modal-inputs-container svelte-18exwij"></div> <div class="modal-add-container svelte-18exwij"><button type="button" class="a-btn">Add</button></div> <div class="modal-button-container"><button type="submit" class="btn-submit">Submit</button></div></form></div>`);
|
||||
var $$css2 = {
|
||||
hash: "svelte-18exwij",
|
||||
code: ".modal-inputs-container.svelte-18exwij {height:200px;width:100%;overflow-y:scroll;border-radius:5px;border-style:solid;display:flex;flex-direction:column;align-items:center;}.modal-add-container.svelte-18exwij {margin-top:10px;}.alert-container.svelte-18exwij {display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:10px;background-color:red;font-weight:bold;}.suggested-props.svelte-18exwij {overflow-y:scroll;max-height:100px;}.hidden.svelte-18exwij {display:none;}"
|
||||
@@ -5634,7 +5634,7 @@ var import_obsidian = require("obsidian");
|
||||
|
||||
// src/AddConfirmForm.svelte
|
||||
var root_13 = from_html(`<li> </li>`);
|
||||
var root3 = from_html(`<div><form><p class="msg svelte-n0gky0"> </p> <p>The following props will be added:</p> <ul></ul> <p>Are you sure you wish to proceed?</p> <button class="mod-warning" type="submit">Confirm</button> <button type="button">Cancel</button></form></div>`);
|
||||
var root3 = from_html(`<div><form><p class="msg svelte-n0gky0"> </p> <p>以下属性将被添加:</p> <ul></ul> <p>确认要继续执行吗?</p> <button class="mod-warning" type="submit">Confirm</button> <button type="button">Cancel</button></form></div>`);
|
||||
var $$css3 = {
|
||||
hash: "svelte-n0gky0",
|
||||
code: ".msg.svelte-n0gky0 {font-weight:bold;padding-bottom:10px;}"
|
||||
@@ -5708,7 +5708,7 @@ var AddConfirmModal = class extends import_obsidian.Modal {
|
||||
this.close();
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.createEl("h2", { text: "Add Properties" });
|
||||
this.titleEl.createEl("h2", { text: "添加属性" });
|
||||
this.component = mount(AddConfirmForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -5752,7 +5752,7 @@ var PropModal = class extends import_obsidian2.Modal {
|
||||
).open();
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.createEl("h2", { text: "Add Properties" });
|
||||
this.titleEl.createEl("h2", { text: "添加属性" });
|
||||
this.component = mount(AddPropForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -5785,7 +5785,7 @@ var SettingTab = class extends import_obsidian3.PluginSettingTab {
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian3.Setting(containerEl).setName("Recursive Iteration").setDesc(
|
||||
new import_obsidian3.Setting(containerEl).setName("递归迭代").setDesc(
|
||||
"When toggled on, while looping through all files in a folder, you will also loop through any sub-folders."
|
||||
).addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.recursive);
|
||||
@@ -5794,22 +5794,22 @@ var SettingTab = class extends import_obsidian3.PluginSettingTab {
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian3.Setting(containerEl).setName("List Delimiter").setDesc(
|
||||
new import_obsidian3.Setting(containerEl).setName("列表分隔符").setDesc(
|
||||
"Set delimiter to use when creating a list. Commas(,) are used by default."
|
||||
).addText((text2) => {
|
||||
text2.setValue(this.plugin.settings.delimiter);
|
||||
text2.onChange(async (value) => {
|
||||
if (value.length > 1) {
|
||||
text2.setValue(value[0]);
|
||||
new import_obsidian3.Notice("Delimiter must be a single character.");
|
||||
new import_obsidian3.Notice("分隔符必须是单个字符。");
|
||||
return;
|
||||
}
|
||||
this.plugin.settings.delimiter = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian3.Setting(containerEl).setName("Default Props File").setDesc(
|
||||
"Select a file with properties that you want to load into the Multi Properties form by default. Type in the full path of the desired file.(ex. Templates/PropFile 1)"
|
||||
new import_obsidian3.Setting(containerEl).setName("默认属性文件").setDesc(
|
||||
"选择一个包含属性的文件,该文件将默认载入多属性表单。请输入目标文件的完整路径。(例如:Templates/PropFile 1)"
|
||||
).addText((text2) => {
|
||||
text2.setValue(this.plugin.settings.defaultPropPath);
|
||||
text2.onChange(async (value) => {
|
||||
@@ -5825,7 +5825,7 @@ var import_obsidian5 = require("obsidian");
|
||||
|
||||
// src/RemovePropForm.svelte
|
||||
var root_14 = from_html(`<label><input type="checkbox"/> </label>`);
|
||||
var root4 = from_html(`<div><div id="alert-container" class="alert-container hidden svelte-1c8m26c"><div>ERROR</div> <div id="alert-text"> </div></div> <p>Select the properties you wish to remove from the file selection.</p> <form><div class="name-container svelte-1c8m26c"></div> <div class="button-container svelte-1c8m26c"><button type="submit">Confirm</button> <button type="button"> </button></div></form></div>`);
|
||||
var root4 = from_html(`<div><div id="alert-container" class="alert-container hidden svelte-1c8m26c"><div>ERROR</div> <div id="alert-text"> </div></div> <p>从文件选择中勾选您希望移除的属性。</p> <form><div class="name-container svelte-1c8m26c"></div> <div class="button-container svelte-1c8m26c"><button type="submit">Confirm</button> <button type="button"> </button></div></form></div>`);
|
||||
var $$css4 = {
|
||||
hash: "svelte-1c8m26c",
|
||||
code: ".name-container.svelte-1c8m26c {display:flex;flex-direction:column;gap:5px;margin-top:10px;margin-bottom:20px;}.alert-container.svelte-1c8m26c {display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:10px;background-color:red;font-weight:bold;}.button-container.svelte-1c8m26c {display:flex;flex-direction:row;justify-content:space-between;}.hidden.svelte-1c8m26c {display:none;}"
|
||||
@@ -5856,7 +5856,7 @@ function RemovePropForm($$anchor, $$props) {
|
||||
function onSubmit(e) {
|
||||
e.preventDefault();
|
||||
if (get(checkCount) === 0) {
|
||||
set(alertText, "Please select at least one property to remove.");
|
||||
set(alertText, "请至少选择一个要移除的属性。");
|
||||
get(errorEl) === null || get(errorEl) === void 0 ? void 0 : get(errorEl).classList.remove("hidden");
|
||||
return;
|
||||
}
|
||||
@@ -5907,7 +5907,7 @@ var import_obsidian4 = require("obsidian");
|
||||
|
||||
// src/RemoveConfirmForm.svelte
|
||||
var root_15 = from_html(`<li> </li>`);
|
||||
var root5 = from_html(`<div><form><p> </p> <ul></ul> <p>Are you sure you wish to proceed?</p> <button class="mod-warning" type="submit">Delete</button> <button type="button">Cancel</button></form></div>`);
|
||||
var root5 = from_html(`<div><form><p> </p> <ul></ul> <p>确认要继续执行吗?</p> <button class="mod-warning" type="submit">Delete</button> <button type="button">Cancel</button></form></div>`);
|
||||
function RemoveConfirmForm($$anchor, $$props) {
|
||||
push($$props, true);
|
||||
let names = prop($$props, "names", 19, () => ["test", "test2"]);
|
||||
@@ -5941,7 +5941,7 @@ function RemoveConfirmForm($$anchor, $$props) {
|
||||
bind_this(button, ($$value) => set(btnCancel, $$value), () => get(btnCancel));
|
||||
reset(form);
|
||||
reset(div);
|
||||
template_effect(() => set_text(text2, `The following ${get(word) ?? ""} will be removed:`));
|
||||
template_effect(() => set_text(text2, `下列 ${get(word) ?? ""} 将被移除:`));
|
||||
event("submit", form, onSubmit);
|
||||
append($$anchor, div);
|
||||
pop();
|
||||
@@ -5964,10 +5964,10 @@ var RemoveConfirmModal = class extends import_obsidian4.Modal {
|
||||
}
|
||||
onOpen() {
|
||||
if (!this.names || this.names.length === 0) {
|
||||
new import_obsidian4.Notice("Please check at least one property to remove.");
|
||||
new import_obsidian4.Notice("请检查至少一个要删除的属性。");
|
||||
this.close();
|
||||
}
|
||||
this.titleEl.createEl("h2", { text: "Remove Properties" });
|
||||
this.titleEl.createEl("h2", { text: "移除属性" });
|
||||
this.component = mount(RemoveConfirmForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -5983,7 +5983,7 @@ var RemoveConfirmModal = class extends import_obsidian4.Modal {
|
||||
var RemoveModal = class extends import_obsidian5.Modal {
|
||||
constructor(app, names, submission) {
|
||||
if (!names || names.length === 0) {
|
||||
new import_obsidian5.Notice("No properties to remove");
|
||||
new import_obsidian5.Notice("没有要删除的属性");
|
||||
return;
|
||||
}
|
||||
super(app);
|
||||
@@ -6003,7 +6003,7 @@ var RemoveModal = class extends import_obsidian5.Modal {
|
||||
).open();
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.createEl("h2", { text: "Remove Properties" });
|
||||
this.titleEl.createEl("h2", { text: "移除属性" });
|
||||
this.component = mount(RemovePropForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -6235,7 +6235,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.app.workspace.on("files-menu", (menu, nodes) => {
|
||||
let obj = nodes;
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Add props to selected files").onClick(() => this.createPropModal(obj));
|
||||
item.setIcon("archive").setTitle("向所选文件添加props").onClick(() => this.createPropModal(obj));
|
||||
});
|
||||
})
|
||||
);
|
||||
@@ -6243,17 +6243,17 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.app.workspace.on("files-menu", (menu, nodes) => {
|
||||
let obj = nodes;
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Remove props from selected files").onClick(async () => this.createRemoveModal(obj));
|
||||
item.setIcon("archive").setTitle("从选定的文件中删除props").onClick(async () => this.createRemoveModal(obj));
|
||||
});
|
||||
})
|
||||
);
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("search:results-menu", (menu, leaf) => {
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Add props to search results").onClick(() => {
|
||||
item.setIcon("archive").setTitle("在搜索结果中添加props").onClick(() => {
|
||||
let files = this.getFilesFromSearch(leaf);
|
||||
if (!files.length) {
|
||||
new import_obsidian7.Notice("No files to add properties to.", 4e3);
|
||||
new import_obsidian7.Notice("没有要添加属性的文件。", 4e3);
|
||||
return;
|
||||
}
|
||||
this.createPropModal(files);
|
||||
@@ -6264,10 +6264,10 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("search:results-menu", (menu, leaf) => {
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Remove props from search results").onClick(async () => {
|
||||
item.setIcon("archive").setTitle("在搜索结果中移除props").onClick(async () => {
|
||||
let files = this.getFilesFromSearch(leaf);
|
||||
if (!files.length) {
|
||||
new import_obsidian7.Notice("No files to remove properties from.", 4e3);
|
||||
new import_obsidian7.Notice("没有要从中删除属性的文件。", 4e3);
|
||||
return;
|
||||
}
|
||||
this.createRemoveModal(files);
|
||||
@@ -6374,7 +6374,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.removePropsCallback(props, allFiles.length)
|
||||
);
|
||||
if (names.length === 0) {
|
||||
new import_obsidian7.Notice("No properties to remove", 4e3);
|
||||
new import_obsidian7.Notice("无属性可移除", 4e3);
|
||||
return;
|
||||
}
|
||||
const sortedNames = [...names].sort(
|
||||
@@ -6389,7 +6389,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
const metadata = this.app.metadataCache.getFileCache(file);
|
||||
const frontmatter = metadata?.frontmatter;
|
||||
if (!frontmatter) {
|
||||
new import_obsidian7.Notice("Not a valid Props template.", 4e3);
|
||||
new import_obsidian7.Notice("无效的属性模板。", 4e3);
|
||||
return;
|
||||
}
|
||||
const allPropsWithType = this.app.metadataCache.getAllPropertyInfos();
|
||||
@@ -6416,7 +6416,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
return tmp;
|
||||
} catch (e) {
|
||||
new import_obsidian7.Notice(
|
||||
`${e}. Check if you entered a valid path in the Default Props File setting.`,
|
||||
`${e}. 请检查默认属性文件设置中输入的路径是否有效。`,
|
||||
1e4
|
||||
);
|
||||
}
|
||||
|
||||
16
.obsidian/plugins/multi-properties/manifest.json
vendored
16
.obsidian/plugins/multi-properties/manifest.json
vendored
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"id": "multi-properties",
|
||||
"name": "Multi Properties",
|
||||
"version": "1.4.0",
|
||||
"minAppVersion": "1.4.13",
|
||||
"description": "Adds Properties to multiple notes at once. Either right-click a folder, or select multiple notes and right-click the selection.",
|
||||
"author": "technohiker",
|
||||
"authorUrl": "https://github.com/technohiker",
|
||||
"isDesktopOnly": false
|
||||
"id": "multi-properties",
|
||||
"name": "Multi Properties",
|
||||
"version": "1.4.0",
|
||||
"minAppVersion": "1.4.13",
|
||||
"description": "Adds Properties to multiple notes at once. Either right-click a folder, or select multiple notes and right-click the selection.",
|
||||
"author": "technohiker",
|
||||
"authorUrl": "https://github.com/technohiker",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user