@polyipseity/obsidian-plugin-library 1.34.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +115 -76
- package/dist/inject/index.js +0 -1
- package/dist/scripts/sync-locale-keys.d.mts +2 -0
- package/dist/scripts/sync-locale-keys.d.mts.map +1 -0
- package/dist/src/components/find.d.svelte.ts +49 -19
- package/dist/src/components/find.svelte +57 -29
- package/dist/src/components/index.d.ts +2 -3
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/i18n.d.ts +1 -1
- package/dist/src/i18n.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/private.d.ts.map +1 -1
- package/dist/src/rules.d.ts +1 -1
- package/dist/src/rules.d.ts.map +1 -1
- package/dist/src/source-maps.d.ts.map +1 -1
- package/dist/src/status-bar.d.ts +1 -0
- package/dist/src/status-bar.d.ts.map +1 -1
- package/dist/src/svelte.svelte.d.ts +15 -0
- package/dist/src/svelte.svelte.d.ts.map +1 -0
- package/dist/src/{util.d.ts → utils.d.ts} +1 -1
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/style.css +0 -1
- package/package.json +13 -11
- package/dist/index.js.map +0 -7
- package/dist/inject/index.js.map +0 -7
- package/dist/src/components/find.d.ts +0 -9
- package/dist/src/components/find.d.ts.map +0 -1
- package/dist/src/util.d.ts.map +0 -1
- package/dist/style.css.map +0 -7
- package/dist/tests/assets/locales.spec.d.ts +0 -2
- package/dist/tests/assets/locales.spec.d.ts.map +0 -1
- package/dist/tests/helpers.d.ts +0 -14
- package/dist/tests/helpers.d.ts.map +0 -1
- package/dist/tests/scripts/build.test.d.mts +0 -2
- package/dist/tests/scripts/build.test.d.mts.map +0 -1
- package/dist/tests/scripts/utils.spec.d.mts +0 -2
- package/dist/tests/scripts/utils.spec.d.mts.map +0 -1
- package/dist/tests/setup.d.ts +0 -2
- package/dist/tests/setup.d.ts.map +0 -1
- package/dist/tests/tests/helpers.spec.d.ts +0 -2
- package/dist/tests/tests/helpers.spec.d.ts.map +0 -1
- package/dist/tests/vi-practices.spec.d.ts +0 -2
- package/dist/tests/vi-practices.spec.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1235,7 +1235,7 @@ function opaqueOrDefault(type, value, defaultValue) {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
function codePoint(value) {
|
|
1237
1237
|
const cp = value.codePointAt(0);
|
|
1238
|
-
if (cp === void 0 || String.
|
|
1238
|
+
if (cp === void 0 || String.fromCodePoint(cp) !== value) {
|
|
1239
1239
|
throw new TypeError(value);
|
|
1240
1240
|
}
|
|
1241
1241
|
return value;
|
|
@@ -1319,7 +1319,7 @@ function primitiveOfE(value) {
|
|
|
1319
1319
|
return value;
|
|
1320
1320
|
}
|
|
1321
1321
|
|
|
1322
|
-
// src/
|
|
1322
|
+
// src/utils.ts
|
|
1323
1323
|
import {
|
|
1324
1324
|
escapeRegExp,
|
|
1325
1325
|
identity,
|
|
@@ -1344,7 +1344,7 @@ var InternalDOMClasses;
|
|
|
1344
1344
|
InternalDOMClasses2.ICON = `${NAMESPACE}:icon`;
|
|
1345
1345
|
})(InternalDOMClasses || (InternalDOMClasses = {}));
|
|
1346
1346
|
|
|
1347
|
-
// src/
|
|
1347
|
+
// src/utils.ts
|
|
1348
1348
|
var EventEmitterLite = class _EventEmitterLite {
|
|
1349
1349
|
constructor() {
|
|
1350
1350
|
this.lock = new AsyncLock({ maxPending: MAX_LOCK_PENDING });
|
|
@@ -1421,7 +1421,9 @@ function alternativeRegExp(strs) {
|
|
|
1421
1421
|
);
|
|
1422
1422
|
}
|
|
1423
1423
|
function anyToError(obj) {
|
|
1424
|
-
|
|
1424
|
+
if (obj instanceof Error) return obj;
|
|
1425
|
+
if (typeof obj === "object") return new Error(toJSONOrString(obj));
|
|
1426
|
+
return new Error(String(obj));
|
|
1425
1427
|
}
|
|
1426
1428
|
function aroundIdentityFactory() {
|
|
1427
1429
|
return (proto) => function fn(...args) {
|
|
@@ -1572,7 +1574,7 @@ function escapeQuerySelectorAttribute(value) {
|
|
|
1572
1574
|
}
|
|
1573
1575
|
function extname(path) {
|
|
1574
1576
|
const base = basename(path), idx = base.lastIndexOf(".");
|
|
1575
|
-
return idx
|
|
1577
|
+
return idx <= 0 ? "" : base.slice(idx);
|
|
1576
1578
|
}
|
|
1577
1579
|
function getKeyModifiers(event) {
|
|
1578
1580
|
const ret = [];
|
|
@@ -1642,7 +1644,7 @@ function lazyInit(initializer) {
|
|
|
1642
1644
|
};
|
|
1643
1645
|
}
|
|
1644
1646
|
function lazyProxy(initializer) {
|
|
1645
|
-
const lazy = lazyInit(initializer), functions = /* @__PURE__ */ new Map(),
|
|
1647
|
+
const lazy = lazyInit(initializer), functions = /* @__PURE__ */ new Map(), proxy3 = new Proxy(lazy, {
|
|
1646
1648
|
apply(target, thisArg, argArray) {
|
|
1647
1649
|
const target0 = target();
|
|
1648
1650
|
if (typeof target0 !== "function") {
|
|
@@ -1705,7 +1707,7 @@ function lazyProxy(initializer) {
|
|
|
1705
1707
|
}
|
|
1706
1708
|
return Reflect.apply(
|
|
1707
1709
|
ret0,
|
|
1708
|
-
this ===
|
|
1710
|
+
this === proxy3 ? target() : this,
|
|
1709
1711
|
args
|
|
1710
1712
|
);
|
|
1711
1713
|
}
|
|
@@ -1762,7 +1764,7 @@ function lazyProxy(initializer) {
|
|
|
1762
1764
|
return Reflect.setPrototypeOf(target(), proto);
|
|
1763
1765
|
}
|
|
1764
1766
|
});
|
|
1765
|
-
return
|
|
1767
|
+
return proxy3;
|
|
1766
1768
|
}
|
|
1767
1769
|
function logFormat(options, ...args) {
|
|
1768
1770
|
if (isEmpty(args)) {
|
|
@@ -1898,6 +1900,7 @@ function remove(self0, item) {
|
|
|
1898
1900
|
return removeAt(self0, self0.indexOf(item));
|
|
1899
1901
|
}
|
|
1900
1902
|
function removeAt(self0, index) {
|
|
1903
|
+
if (index < 0 || index >= self0.length) return void 0;
|
|
1901
1904
|
return self0.splice(index, 1)[0];
|
|
1902
1905
|
}
|
|
1903
1906
|
function replaceAllRegex(string) {
|
|
@@ -2160,13 +2163,19 @@ var LibraryLocales;
|
|
|
2160
2163
|
})(LibraryLocales || (LibraryLocales = {}));
|
|
2161
2164
|
|
|
2162
2165
|
// src/components/find.svelte
|
|
2166
|
+
var find_exports = {};
|
|
2167
|
+
__export(find_exports, {
|
|
2168
|
+
DIRECTIONS: () => DIRECTIONS,
|
|
2169
|
+
default: () => Find
|
|
2170
|
+
});
|
|
2163
2171
|
import "svelte/internal/disclose-version";
|
|
2164
|
-
import {
|
|
2172
|
+
import { default as i18next } from "i18next";
|
|
2165
2173
|
import { isEmpty as isEmpty2, noop as noop2 } from "lodash-es";
|
|
2166
2174
|
import { onMount } from "svelte";
|
|
2167
2175
|
import { setIcon } from "obsidian";
|
|
2168
2176
|
import { slide } from "svelte/transition";
|
|
2169
2177
|
import * as $ from "svelte/internal/client";
|
|
2178
|
+
var DIRECTIONS = ["next", "previous"];
|
|
2170
2179
|
var root = $.from_html(`<div class="document-search-container" role="search"><div class="document-search _polyipseity_obsidian-plugin-library-svelte-find"><div class="document-search-buttons"><button type="button"></button> <button type="button"></button> <button type="button"></button></div> <input class="document-search-input" type="text" role="searchbox"/> <div class="document-search-buttons"><button type="button" class="document-search-button"></button> <button type="button" class="document-search-button"></button> <div class="document-search-results" aria-live="polite"> </div> <button type="button" class="document-search-close-button"></button></div></div></div>`);
|
|
2171
2180
|
var $$css = {
|
|
2172
2181
|
hash: "_polyipseity_obsidian-plugin-library-svelte-find",
|
|
@@ -2175,7 +2184,7 @@ var $$css = {
|
|
|
2175
2184
|
function Find($$anchor, $$props) {
|
|
2176
2185
|
$.push($$props, true);
|
|
2177
2186
|
$.append_styles($$anchor, $$css);
|
|
2178
|
-
const
|
|
2187
|
+
const i18nt = $.prop($$props, "i18nt", 19, () => i18next.t.bind(i18next)), params = $.prop($$props, "params", 31, () => $.proxy({
|
|
2179
2188
|
caseSensitive: false,
|
|
2180
2189
|
findText: "",
|
|
2181
2190
|
regex: false,
|
|
@@ -2199,70 +2208,36 @@ function Find($$anchor, $$props) {
|
|
|
2199
2208
|
var div_1 = $.child(div);
|
|
2200
2209
|
var div_2 = $.child(div_1);
|
|
2201
2210
|
var button = $.child(div_2);
|
|
2202
|
-
button
|
|
2203
|
-
params(params().caseSensitive = !params().caseSensitive, true);
|
|
2204
|
-
consumeEvent(event);
|
|
2205
|
-
};
|
|
2206
|
-
$.action(button, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18n()("asset:components.find.case-sensitive-icon"));
|
|
2211
|
+
$.action(button, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18nt()("asset:components.find.case-sensitive-icon"));
|
|
2207
2212
|
var button_1 = $.sibling(button, 2);
|
|
2208
|
-
button_1
|
|
2209
|
-
params(params().wholeWord = !params().wholeWord, true);
|
|
2210
|
-
consumeEvent(event);
|
|
2211
|
-
};
|
|
2212
|
-
$.action(button_1, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18n()("asset:components.find.whole-word-icon"));
|
|
2213
|
+
$.action(button_1, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18nt()("asset:components.find.whole-word-icon"));
|
|
2213
2214
|
var button_2 = $.sibling(button_1, 2);
|
|
2214
|
-
button_2
|
|
2215
|
-
params(params().regex = !params().regex, true);
|
|
2216
|
-
consumeEvent(event);
|
|
2217
|
-
};
|
|
2218
|
-
$.action(button_2, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18n()("asset:components.find.regex-icon"));
|
|
2215
|
+
$.action(button_2, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18nt()("asset:components.find.regex-icon"));
|
|
2219
2216
|
$.reset(div_2);
|
|
2220
2217
|
var input = $.sibling(div_2, 2);
|
|
2221
2218
|
$.remove_input_defaults(input);
|
|
2222
|
-
input.__keydown = (event) => {
|
|
2223
|
-
if (event.key === "Escape" && isEmpty2(getKeyModifiers(event))) {
|
|
2224
|
-
onClose()();
|
|
2225
|
-
consumeEvent(event);
|
|
2226
|
-
}
|
|
2227
|
-
if (event.key === "Enter" && isEmpty2(getKeyModifiers(event))) {
|
|
2228
|
-
onFind()("next", params());
|
|
2229
|
-
consumeEvent(event);
|
|
2230
|
-
}
|
|
2231
|
-
};
|
|
2232
2219
|
$.bind_this(input, ($$value) => inputElement = $$value, () => inputElement);
|
|
2233
2220
|
var div_3 = $.sibling(input, 2);
|
|
2234
2221
|
var button_3 = $.child(div_3);
|
|
2235
|
-
button_3
|
|
2236
|
-
onFind()("previous", params());
|
|
2237
|
-
consumeEvent(event);
|
|
2238
|
-
};
|
|
2239
|
-
$.action(button_3, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18n()("asset:components.find.previous-icon"));
|
|
2222
|
+
$.action(button_3, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18nt()("asset:components.find.previous-icon"));
|
|
2240
2223
|
var button_4 = $.sibling(button_3, 2);
|
|
2241
|
-
button_4
|
|
2242
|
-
onFind()("next", params());
|
|
2243
|
-
consumeEvent(event);
|
|
2244
|
-
};
|
|
2245
|
-
$.action(button_4, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18n()("asset:components.find.next-icon"));
|
|
2224
|
+
$.action(button_4, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18nt()("asset:components.find.next-icon"));
|
|
2246
2225
|
var div_4 = $.sibling(button_4, 2);
|
|
2247
2226
|
var text = $.child(div_4, true);
|
|
2248
2227
|
$.reset(div_4);
|
|
2249
2228
|
var button_5 = $.sibling(div_4, 2);
|
|
2250
|
-
button_5
|
|
2251
|
-
onClose()();
|
|
2252
|
-
consumeEvent(event);
|
|
2253
|
-
};
|
|
2254
|
-
$.action(button_5, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18n()("asset:components.find.close-icon"));
|
|
2229
|
+
$.action(button_5, ($$node, $$action_arg) => setIcon?.($$node, $$action_arg), () => i18nt()("asset:components.find.close-icon"));
|
|
2255
2230
|
$.reset(div_3);
|
|
2256
2231
|
$.reset(div_1);
|
|
2257
2232
|
$.reset(div);
|
|
2258
2233
|
$.template_effect(
|
|
2259
|
-
($0, $1, $
|
|
2234
|
+
($0, $1, $22, $3, $4, $5, $6) => {
|
|
2260
2235
|
$.set_class(button, 1, `document-search-button${params().caseSensitive ? " mod-cta" : ""}`, "_polyipseity_obsidian-plugin-library-svelte-find");
|
|
2261
2236
|
$.set_attribute(button, "aria-label", $0);
|
|
2262
2237
|
$.set_class(button_1, 1, `document-search-button${params().wholeWord ? " mod-cta" : ""}`, "_polyipseity_obsidian-plugin-library-svelte-find");
|
|
2263
2238
|
$.set_attribute(button_1, "aria-label", $1);
|
|
2264
2239
|
$.set_class(button_2, 1, `document-search-button${params().regex ? " mod-cta" : ""}`, "_polyipseity_obsidian-plugin-library-svelte-find");
|
|
2265
|
-
$.set_attribute(button_2, "aria-label", $
|
|
2240
|
+
$.set_attribute(button_2, "aria-label", $22);
|
|
2266
2241
|
$.set_attribute(input, "placeholder", $3);
|
|
2267
2242
|
$.set_attribute(button_3, "aria-label", $4);
|
|
2268
2243
|
$.set_attribute(button_4, "aria-label", $5);
|
|
@@ -2270,29 +2245,56 @@ function Find($$anchor, $$props) {
|
|
|
2270
2245
|
$.set_attribute(button_5, "aria-label", $6);
|
|
2271
2246
|
},
|
|
2272
2247
|
[
|
|
2273
|
-
() =>
|
|
2274
|
-
() =>
|
|
2275
|
-
() =>
|
|
2276
|
-
() =>
|
|
2277
|
-
() =>
|
|
2278
|
-
() =>
|
|
2279
|
-
() =>
|
|
2248
|
+
() => i18nt()("components.find.case-sensitive"),
|
|
2249
|
+
() => i18nt()("components.find.whole-word"),
|
|
2250
|
+
() => i18nt()("components.find.regex"),
|
|
2251
|
+
() => i18nt()("components.find.input-placeholder"),
|
|
2252
|
+
() => i18nt()("components.find.previous"),
|
|
2253
|
+
() => i18nt()("components.find.next"),
|
|
2254
|
+
() => i18nt()("components.find.close")
|
|
2280
2255
|
]
|
|
2281
2256
|
);
|
|
2257
|
+
$.delegated("click", button, (event) => {
|
|
2258
|
+
params(params().caseSensitive = !params().caseSensitive, true);
|
|
2259
|
+
consumeEvent(event);
|
|
2260
|
+
});
|
|
2261
|
+
$.delegated("click", button_1, (event) => {
|
|
2262
|
+
params(params().wholeWord = !params().wholeWord, true);
|
|
2263
|
+
consumeEvent(event);
|
|
2264
|
+
});
|
|
2265
|
+
$.delegated("click", button_2, (event) => {
|
|
2266
|
+
params(params().regex = !params().regex, true);
|
|
2267
|
+
consumeEvent(event);
|
|
2268
|
+
});
|
|
2269
|
+
$.delegated("keydown", input, (event) => {
|
|
2270
|
+
if (event.key === "Escape" && isEmpty2(getKeyModifiers(event))) {
|
|
2271
|
+
onClose()();
|
|
2272
|
+
consumeEvent(event);
|
|
2273
|
+
}
|
|
2274
|
+
if (event.key === "Enter" && isEmpty2(getKeyModifiers(event))) {
|
|
2275
|
+
onFind()("next", params());
|
|
2276
|
+
consumeEvent(event);
|
|
2277
|
+
}
|
|
2278
|
+
});
|
|
2282
2279
|
$.bind_value(input, () => params().findText, ($$value) => params(params().findText = $$value, true));
|
|
2280
|
+
$.delegated("click", button_3, (event) => {
|
|
2281
|
+
onFind()("previous", params());
|
|
2282
|
+
consumeEvent(event);
|
|
2283
|
+
});
|
|
2284
|
+
$.delegated("click", button_4, (event) => {
|
|
2285
|
+
onFind()("next", params());
|
|
2286
|
+
consumeEvent(event);
|
|
2287
|
+
});
|
|
2288
|
+
$.delegated("click", button_5, (event) => {
|
|
2289
|
+
onClose()();
|
|
2290
|
+
consumeEvent(event);
|
|
2291
|
+
});
|
|
2283
2292
|
$.transition(3, div, () => slide);
|
|
2284
2293
|
$.append($$anchor, div);
|
|
2285
2294
|
return $.pop($$exports);
|
|
2286
2295
|
}
|
|
2287
2296
|
$.delegate(["click", "keydown"]);
|
|
2288
2297
|
|
|
2289
|
-
// src/components/find.ts
|
|
2290
|
-
var find_exports = {};
|
|
2291
|
-
__export(find_exports, {
|
|
2292
|
-
DIRECTIONS: () => DIRECTIONS
|
|
2293
|
-
});
|
|
2294
|
-
var DIRECTIONS = deepFreeze(["next", "previous"]);
|
|
2295
|
-
|
|
2296
2298
|
// src/fixers.ts
|
|
2297
2299
|
import deepEqual from "deep-equal";
|
|
2298
2300
|
function markFixed(unchecked, fixed) {
|
|
@@ -2311,14 +2313,14 @@ function fixTyped(defaults, from, key, types) {
|
|
|
2311
2313
|
return genericTypeofGuardE(types, val) ? val : primitiveOfE(defaults[key]);
|
|
2312
2314
|
}
|
|
2313
2315
|
function fixArray(defaults, from, key, types) {
|
|
2314
|
-
const val = from[key];
|
|
2315
|
-
if (isHomogenousArray(types, val)) {
|
|
2316
|
-
return val;
|
|
2317
|
-
}
|
|
2318
2316
|
const default0 = defaults[key];
|
|
2319
2317
|
if (!Array.isArray(default0)) {
|
|
2320
2318
|
throw new TypeError(String(default0));
|
|
2321
2319
|
}
|
|
2320
|
+
const val = from[key];
|
|
2321
|
+
if (isHomogenousArray(types, val)) {
|
|
2322
|
+
return val;
|
|
2323
|
+
}
|
|
2322
2324
|
const default1 = default0;
|
|
2323
2325
|
return default1.map(primitiveOfE);
|
|
2324
2326
|
}
|
|
@@ -2354,6 +2356,7 @@ function revealPrivate(context, args, func, fallback) {
|
|
|
2354
2356
|
...args
|
|
2355
2357
|
);
|
|
2356
2358
|
} catch (error) {
|
|
2359
|
+
/* @__PURE__ */ self.console.debug(error);
|
|
2357
2360
|
self.console.warn(
|
|
2358
2361
|
context.language.value.t("errors.private-API-changed"),
|
|
2359
2362
|
error
|
|
@@ -2367,6 +2370,7 @@ async function revealPrivateAsync(context, args, func, fallback) {
|
|
|
2367
2370
|
...args
|
|
2368
2371
|
);
|
|
2369
2372
|
} catch (error) {
|
|
2373
|
+
/* @__PURE__ */ self.console.debug(error);
|
|
2370
2374
|
self.console.warn(
|
|
2371
2375
|
context.language.value.t("errors.private-API-changed"),
|
|
2372
2376
|
error
|
|
@@ -4539,8 +4543,10 @@ var Rules;
|
|
|
4539
4543
|
if (type === "error") {
|
|
4540
4544
|
continue;
|
|
4541
4545
|
}
|
|
4542
|
-
if (type ===
|
|
4543
|
-
ret =
|
|
4546
|
+
if (type === "+" && value.test(str)) {
|
|
4547
|
+
ret = true;
|
|
4548
|
+
} else if (type === "-" && value.test(str)) {
|
|
4549
|
+
ret = false;
|
|
4544
4550
|
}
|
|
4545
4551
|
}
|
|
4546
4552
|
return ret;
|
|
@@ -4956,13 +4962,17 @@ import { fromObject, fromSource } from "convert-source-map";
|
|
|
4956
4962
|
import { isEmpty as isEmpty5 } from "lodash-es";
|
|
4957
4963
|
function attachFunctionSourceMap(...args) {
|
|
4958
4964
|
const [, script] = args;
|
|
4965
|
+
const comment = fromObject(
|
|
4966
|
+
generateFunctionSourceMap(...args).toJSON()
|
|
4967
|
+
).toComment();
|
|
4959
4968
|
return `${script}
|
|
4960
|
-
${
|
|
4969
|
+
${comment}`;
|
|
4961
4970
|
}
|
|
4962
4971
|
function attachSourceMap(...args) {
|
|
4963
4972
|
const [script] = args;
|
|
4973
|
+
const comment = fromObject(generateSourceMap(...args).toJSON()).toComment();
|
|
4964
4974
|
return `${script}
|
|
4965
|
-
${
|
|
4975
|
+
${comment}`;
|
|
4966
4976
|
}
|
|
4967
4977
|
var FUNCTION_CONSTRUCTOR_OFFSETS = /* @__PURE__ */ new WeakMap();
|
|
4968
4978
|
function generateFunctionSourceMap(ctor, script, options) {
|
|
@@ -4981,11 +4991,12 @@ function generateFunctionSourceMap(ctor, script, options) {
|
|
|
4981
4991
|
return generateSourceMap(script, { ...options, offset });
|
|
4982
4992
|
}
|
|
4983
4993
|
function generateSourceMap(script, options) {
|
|
4984
|
-
const
|
|
4994
|
+
const offset = options?.offset ?? { column: 0, line: 1 }, genOpts = { skipValidation: true };
|
|
4985
4995
|
assignExact(genOpts, "file", options?.file);
|
|
4986
4996
|
assignExact(genOpts, "sourceRoot", options?.sourceRoot);
|
|
4987
4997
|
let subSourceMap = null;
|
|
4988
4998
|
try {
|
|
4999
|
+
const subSourceMap0 = fromSource(script);
|
|
4989
5000
|
if (subSourceMap0) {
|
|
4990
5001
|
subSourceMap = new TraceMap(subSourceMap0.toJSON());
|
|
4991
5002
|
}
|
|
@@ -5060,6 +5071,9 @@ var StatusBarHider = class _StatusBarHider extends Component2 {
|
|
|
5060
5071
|
this.class = InternalDOMClasses.HIDE_STATUS_BAR;
|
|
5061
5072
|
}
|
|
5062
5073
|
#hiders = [];
|
|
5074
|
+
get _hiders() {
|
|
5075
|
+
return this.#hiders;
|
|
5076
|
+
}
|
|
5063
5077
|
onload() {
|
|
5064
5078
|
super.onload();
|
|
5065
5079
|
this.register(() => {
|
|
@@ -5088,6 +5102,31 @@ var StatusBarHider = class _StatusBarHider extends Component2 {
|
|
|
5088
5102
|
});
|
|
5089
5103
|
}
|
|
5090
5104
|
};
|
|
5105
|
+
|
|
5106
|
+
// src/svelte.svelte.ts
|
|
5107
|
+
import * as $2 from "svelte/internal/client";
|
|
5108
|
+
function svelteState(props) {
|
|
5109
|
+
if (arguments.length === 0) {
|
|
5110
|
+
class InternalRead {
|
|
5111
|
+
val;
|
|
5112
|
+
constructor() {
|
|
5113
|
+
const val = void 0;
|
|
5114
|
+
this.val = val;
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
return new InternalRead().val;
|
|
5118
|
+
} else {
|
|
5119
|
+
const value = props;
|
|
5120
|
+
class InternalWrite {
|
|
5121
|
+
val;
|
|
5122
|
+
constructor(v) {
|
|
5123
|
+
const val = $2.proxy(v);
|
|
5124
|
+
this.val = val;
|
|
5125
|
+
}
|
|
5126
|
+
}
|
|
5127
|
+
return new InternalWrite(value).val;
|
|
5128
|
+
}
|
|
5129
|
+
}
|
|
5091
5130
|
export {
|
|
5092
5131
|
ALWAYS_REGEX,
|
|
5093
5132
|
ALWAYS_REGEX_G,
|
|
@@ -5239,6 +5278,7 @@ export {
|
|
|
5239
5278
|
startCase,
|
|
5240
5279
|
statusUI,
|
|
5241
5280
|
stringToBase64,
|
|
5281
|
+
svelteState,
|
|
5242
5282
|
swap,
|
|
5243
5283
|
syncLocale,
|
|
5244
5284
|
toJSONOrString,
|
|
@@ -5254,4 +5294,3 @@ export {
|
|
|
5254
5294
|
writeStateCollaboratively
|
|
5255
5295
|
};
|
|
5256
5296
|
// repository: https://github.com/polyipseity/obsidian-plugin-library
|
|
5257
|
-
//# sourceMappingURL=index.js.map
|
package/dist/inject/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-locale-keys.d.mts","sourceRoot":"","sources":["../../scripts/sync-locale-keys.mjs"],"names":[],"mappings":"AAgJA,kDAyBC"}
|
|
@@ -1,23 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
// This declaration file provides TypeScript typings for the `find.svelte` component.
|
|
2
|
+
// Svelte's compiler generates its own `.d.ts` files when building the library, but
|
|
3
|
+
// during development we still need explicit types so that `import type { ... } from
|
|
4
|
+
// "./find.svelte"` works in the workspace. Keeping a separate `.d.svelte.ts`
|
|
5
|
+
// file avoids having to preprocess the `.svelte` file just for the type checker.
|
|
6
|
+
|
|
2
7
|
import type { Component } from "svelte";
|
|
8
|
+
import type { i18n } from "i18next";
|
|
3
9
|
import type { DeepWritable } from "ts-essentials";
|
|
4
|
-
import type { t as i18nt } from "i18next";
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
export const DIRECTIONS = ["next", "previous"] as const;
|
|
12
|
+
export type Direction = (typeof DIRECTIONS)[number];
|
|
13
|
+
|
|
14
|
+
export interface Params {
|
|
15
|
+
readonly caseSensitive: boolean;
|
|
16
|
+
readonly findText: string;
|
|
17
|
+
readonly regex: boolean;
|
|
18
|
+
readonly wholeWord: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Props {
|
|
22
|
+
/**
|
|
23
|
+
* Remember to bind `i18nt` if you want to use it in the component's markup.
|
|
24
|
+
* This is because the component expects a function that is already bound to
|
|
25
|
+
* the i18next instance, so it can be called directly without needing to reference
|
|
26
|
+
* the instance. By default, `i18nt` is set to `i18next.t.bind(i18next)`,
|
|
27
|
+
* so if you don't provide your own it will still work as expected.
|
|
28
|
+
*
|
|
29
|
+
* However, if you want to use a custom translation function or a different
|
|
30
|
+
* i18next instance, you can pass it in as a prop and bind it in your markup.
|
|
31
|
+
*/
|
|
32
|
+
readonly i18nt?: i18n["t"];
|
|
33
|
+
params?: DeepWritable<Params>;
|
|
34
|
+
readonly results?: string;
|
|
35
|
+
readonly onClose?: () => unknown;
|
|
36
|
+
readonly onFind?: (direction: Direction, params: Params) => unknown;
|
|
37
|
+
readonly onParamsChanged?: (params: Params) => unknown;
|
|
38
|
+
readonly initialFocus?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface Exports {
|
|
42
|
+
readonly focus: () => void;
|
|
43
|
+
readonly blur: () => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type Bindings = "params";
|
|
47
|
+
|
|
48
|
+
// the default export is the component itself. during normal builds the
|
|
49
|
+
// compiler generates a class, so our declaration mirrors that by extending the
|
|
50
|
+
// generic `Component` type. this makes the value newable and mergeable with a
|
|
51
|
+
// namespace below.
|
|
52
|
+
declare class FindComponent extends Component<Props, Exports, Bindings> {}
|
|
23
53
|
export default FindComponent;
|
|
@@ -1,20 +1,56 @@
|
|
|
1
1
|
<svelte:options />
|
|
2
2
|
|
|
3
|
-
<script
|
|
4
|
-
|
|
5
|
-
import {
|
|
3
|
+
<script lang="ts" module>
|
|
4
|
+
// exported types and constants for library consumers
|
|
5
|
+
import { type i18n, default as i18next } from "i18next";
|
|
6
6
|
import type { DeepWritable } from "ts-essentials";
|
|
7
|
-
import {
|
|
7
|
+
import { consumeEvent, getKeyModifiers } from "../utils.js";
|
|
8
8
|
import { isEmpty, noop } from "lodash-es";
|
|
9
9
|
import { onMount } from "svelte";
|
|
10
10
|
import { setIcon } from "obsidian";
|
|
11
11
|
import { slide } from "svelte/transition";
|
|
12
|
+
|
|
13
|
+
export const DIRECTIONS = ["next", "previous"] as const;
|
|
14
|
+
export type Direction = (typeof DIRECTIONS)[number];
|
|
15
|
+
|
|
16
|
+
export interface Params {
|
|
17
|
+
readonly caseSensitive: boolean;
|
|
18
|
+
readonly findText: string;
|
|
19
|
+
readonly regex: boolean;
|
|
20
|
+
readonly wholeWord: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Props {
|
|
24
|
+
/**
|
|
25
|
+
* Remember to bind `i18nt` if you want to use it in the component's markup.
|
|
26
|
+
* This is because the component expects a function that is already bound to
|
|
27
|
+
* the i18next instance, so it can be called directly without needing to reference
|
|
28
|
+
* the instance. By default, `i18nt` is set to `i18next.t.bind(i18next)`,
|
|
29
|
+
* so if you don't provide your own it will still work as expected.
|
|
30
|
+
*
|
|
31
|
+
* However, if you want to use a custom translation function or a different
|
|
32
|
+
* i18next instance, you can pass it in as a prop and bind it in your markup.
|
|
33
|
+
*/
|
|
34
|
+
readonly i18nt?: i18n["t"];
|
|
35
|
+
params?: DeepWritable<Params>;
|
|
36
|
+
readonly results?: string;
|
|
37
|
+
readonly onClose?: () => unknown;
|
|
38
|
+
readonly onFind?: (direction: Direction, params: Params) => unknown;
|
|
39
|
+
readonly onParamsChanged?: (params: Params) => unknown;
|
|
40
|
+
readonly initialFocus?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface Exports {
|
|
44
|
+
readonly focus: () => void;
|
|
45
|
+
readonly blur: () => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type Bindings = "params";
|
|
12
49
|
</script>
|
|
13
50
|
|
|
14
|
-
<script lang="
|
|
51
|
+
<script lang="ts">
|
|
15
52
|
const {
|
|
16
|
-
|
|
17
|
-
// `params` is bindable
|
|
53
|
+
i18nt = i18next.t.bind(i18next),
|
|
18
54
|
params = $bindable({
|
|
19
55
|
caseSensitive: false,
|
|
20
56
|
findText: "",
|
|
@@ -26,15 +62,7 @@
|
|
|
26
62
|
onFind = noop,
|
|
27
63
|
onParamsChanged = noop,
|
|
28
64
|
initialFocus = false,
|
|
29
|
-
}:
|
|
30
|
-
readonly i18n?: typeof i18nt;
|
|
31
|
-
params?: DeepWritable<Params>;
|
|
32
|
-
readonly results?: string;
|
|
33
|
-
readonly onClose?: () => unknown;
|
|
34
|
-
readonly onFind?: (direction: Direction, params: Params) => unknown;
|
|
35
|
-
readonly onParamsChanged?: (params: Params) => unknown;
|
|
36
|
-
readonly initialFocus?: boolean;
|
|
37
|
-
} = $props();
|
|
65
|
+
}: Props = $props();
|
|
38
66
|
|
|
39
67
|
$effect(() => {
|
|
40
68
|
onParamsChanged(params);
|
|
@@ -62,38 +90,38 @@
|
|
|
62
90
|
class={`document-search-button${
|
|
63
91
|
params.caseSensitive ? " mod-cta" : ""
|
|
64
92
|
}`}
|
|
65
|
-
aria-label={
|
|
93
|
+
aria-label={i18nt("components.find.case-sensitive")}
|
|
66
94
|
onclick={(event) => {
|
|
67
95
|
params.caseSensitive = !params.caseSensitive;
|
|
68
96
|
consumeEvent(event);
|
|
69
97
|
}}
|
|
70
|
-
use:setIcon={
|
|
98
|
+
use:setIcon={i18nt("asset:components.find.case-sensitive-icon")}
|
|
71
99
|
></button>
|
|
72
100
|
<button
|
|
73
101
|
type="button"
|
|
74
102
|
class={`document-search-button${params.wholeWord ? " mod-cta" : ""}`}
|
|
75
|
-
aria-label={
|
|
103
|
+
aria-label={i18nt("components.find.whole-word")}
|
|
76
104
|
onclick={(event) => {
|
|
77
105
|
params.wholeWord = !params.wholeWord;
|
|
78
106
|
consumeEvent(event);
|
|
79
107
|
}}
|
|
80
|
-
use:setIcon={
|
|
108
|
+
use:setIcon={i18nt("asset:components.find.whole-word-icon")}
|
|
81
109
|
></button>
|
|
82
110
|
<button
|
|
83
111
|
type="button"
|
|
84
112
|
class={`document-search-button${params.regex ? " mod-cta" : ""}`}
|
|
85
|
-
aria-label={
|
|
113
|
+
aria-label={i18nt("components.find.regex")}
|
|
86
114
|
onclick={(event) => {
|
|
87
115
|
params.regex = !params.regex;
|
|
88
116
|
consumeEvent(event);
|
|
89
117
|
}}
|
|
90
|
-
use:setIcon={
|
|
118
|
+
use:setIcon={i18nt("asset:components.find.regex-icon")}
|
|
91
119
|
></button>
|
|
92
120
|
</div>
|
|
93
121
|
<input
|
|
94
122
|
class="document-search-input"
|
|
95
123
|
type="text"
|
|
96
|
-
placeholder={
|
|
124
|
+
placeholder={i18nt("components.find.input-placeholder")}
|
|
97
125
|
role="searchbox"
|
|
98
126
|
bind:value={params.findText}
|
|
99
127
|
bind:this={inputElement}
|
|
@@ -112,33 +140,33 @@
|
|
|
112
140
|
<button
|
|
113
141
|
type="button"
|
|
114
142
|
class="document-search-button"
|
|
115
|
-
aria-label={
|
|
143
|
+
aria-label={i18nt("components.find.previous")}
|
|
116
144
|
onclick={(event) => {
|
|
117
145
|
onFind("previous", params);
|
|
118
146
|
consumeEvent(event);
|
|
119
147
|
}}
|
|
120
|
-
use:setIcon={
|
|
148
|
+
use:setIcon={i18nt("asset:components.find.previous-icon")}
|
|
121
149
|
></button>
|
|
122
150
|
<button
|
|
123
151
|
type="button"
|
|
124
152
|
class="document-search-button"
|
|
125
|
-
aria-label={
|
|
153
|
+
aria-label={i18nt("components.find.next")}
|
|
126
154
|
onclick={(event) => {
|
|
127
155
|
onFind("next", params);
|
|
128
156
|
consumeEvent(event);
|
|
129
157
|
}}
|
|
130
|
-
use:setIcon={
|
|
158
|
+
use:setIcon={i18nt("asset:components.find.next-icon")}
|
|
131
159
|
></button>
|
|
132
160
|
<div class="document-search-results" aria-live="polite">{results}</div>
|
|
133
161
|
<button
|
|
134
162
|
type="button"
|
|
135
163
|
class="document-search-close-button"
|
|
136
|
-
aria-label={
|
|
164
|
+
aria-label={i18nt("components.find.close")}
|
|
137
165
|
onclick={(event) => {
|
|
138
166
|
onClose();
|
|
139
167
|
consumeEvent(event);
|
|
140
168
|
}}
|
|
141
|
-
use:setIcon={
|
|
169
|
+
use:setIcon={i18nt("asset:components.find.close-icon")}
|
|
142
170
|
></button>
|
|
143
171
|
</div>
|
|
144
172
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,cAAc,MAAM,eAAe,CAAC"}
|
package/dist/src/i18n.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitterLite } from "./
|
|
1
|
+
import { EventEmitterLite } from "./utils.js";
|
|
2
2
|
import { type FlatNamespace, type InitOptions, type ParseKeys, type ResourceKey, type TypeOptions, type i18n } from "i18next";
|
|
3
3
|
import type { AsyncOrSync } from "ts-essentials";
|
|
4
4
|
import type { PluginContext } from "./plugin.js";
|