@polyipseity/obsidian-plugin-library 1.34.0 → 1.35.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 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.fromCharCode(cp) !== value) {
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/util.ts
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/util.ts
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
- return obj instanceof Error ? obj : new Error(String(obj));
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 === -1 ? "" : base.slice(idx);
1577
+ return idx <= 0 ? "" : base.slice(idx);
1576
1578
  }
1577
1579
  function getKeyModifiers(event) {
1578
1580
  const ret = [];
@@ -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) {
@@ -2311,14 +2314,14 @@ function fixTyped(defaults, from, key, types) {
2311
2314
  return genericTypeofGuardE(types, val) ? val : primitiveOfE(defaults[key]);
2312
2315
  }
2313
2316
  function fixArray(defaults, from, key, types) {
2314
- const val = from[key];
2315
- if (isHomogenousArray(types, val)) {
2316
- return val;
2317
- }
2318
2317
  const default0 = defaults[key];
2319
2318
  if (!Array.isArray(default0)) {
2320
2319
  throw new TypeError(String(default0));
2321
2320
  }
2321
+ const val = from[key];
2322
+ if (isHomogenousArray(types, val)) {
2323
+ return val;
2324
+ }
2322
2325
  const default1 = default0;
2323
2326
  return default1.map(primitiveOfE);
2324
2327
  }
@@ -2354,6 +2357,7 @@ function revealPrivate(context, args, func, fallback) {
2354
2357
  ...args
2355
2358
  );
2356
2359
  } catch (error) {
2360
+ /* @__PURE__ */ self.console.debug(error);
2357
2361
  self.console.warn(
2358
2362
  context.language.value.t("errors.private-API-changed"),
2359
2363
  error
@@ -2367,6 +2371,7 @@ async function revealPrivateAsync(context, args, func, fallback) {
2367
2371
  ...args
2368
2372
  );
2369
2373
  } catch (error) {
2374
+ /* @__PURE__ */ self.console.debug(error);
2370
2375
  self.console.warn(
2371
2376
  context.language.value.t("errors.private-API-changed"),
2372
2377
  error
@@ -4539,8 +4544,10 @@ var Rules;
4539
4544
  if (type === "error") {
4540
4545
  continue;
4541
4546
  }
4542
- if (type === (ret ? "-" : "+") && value.test(str)) {
4543
- ret = !ret;
4547
+ if (type === "+" && value.test(str)) {
4548
+ ret = true;
4549
+ } else if (type === "-" && value.test(str)) {
4550
+ ret = false;
4544
4551
  }
4545
4552
  }
4546
4553
  return ret;
@@ -4956,13 +4963,17 @@ import { fromObject, fromSource } from "convert-source-map";
4956
4963
  import { isEmpty as isEmpty5 } from "lodash-es";
4957
4964
  function attachFunctionSourceMap(...args) {
4958
4965
  const [, script] = args;
4966
+ const comment = fromObject(
4967
+ generateFunctionSourceMap(...args).toJSON()
4968
+ ).toComment();
4959
4969
  return `${script}
4960
- ${fromObject(generateFunctionSourceMap(...args).toJSON()).toComment()}`;
4970
+ ${comment}`;
4961
4971
  }
4962
4972
  function attachSourceMap(...args) {
4963
4973
  const [script] = args;
4974
+ const comment = fromObject(generateSourceMap(...args).toJSON()).toComment();
4964
4975
  return `${script}
4965
- ${fromObject(generateSourceMap(...args).toJSON()).toComment()}`;
4976
+ ${comment}`;
4966
4977
  }
4967
4978
  var FUNCTION_CONSTRUCTOR_OFFSETS = /* @__PURE__ */ new WeakMap();
4968
4979
  function generateFunctionSourceMap(ctor, script, options) {
@@ -4981,11 +4992,12 @@ function generateFunctionSourceMap(ctor, script, options) {
4981
4992
  return generateSourceMap(script, { ...options, offset });
4982
4993
  }
4983
4994
  function generateSourceMap(script, options) {
4984
- const subSourceMap0 = fromSource(script), offset = options?.offset ?? { column: 0, line: 1 }, genOpts = { skipValidation: true };
4995
+ const offset = options?.offset ?? { column: 0, line: 1 }, genOpts = { skipValidation: true };
4985
4996
  assignExact(genOpts, "file", options?.file);
4986
4997
  assignExact(genOpts, "sourceRoot", options?.sourceRoot);
4987
4998
  let subSourceMap = null;
4988
4999
  try {
5000
+ const subSourceMap0 = fromSource(script);
4989
5001
  if (subSourceMap0) {
4990
5002
  subSourceMap = new TraceMap(subSourceMap0.toJSON());
4991
5003
  }
@@ -5060,6 +5072,9 @@ var StatusBarHider = class _StatusBarHider extends Component2 {
5060
5072
  this.class = InternalDOMClasses.HIDE_STATUS_BAR;
5061
5073
  }
5062
5074
  #hiders = [];
5075
+ get _hiders() {
5076
+ return this.#hiders;
5077
+ }
5063
5078
  onload() {
5064
5079
  super.onload();
5065
5080
  this.register(() => {