rustfava 0.1.0__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
Files changed (32) hide show
  1. rustfava/ext/portfolio_list/PortfolioList.js +4 -4
  2. rustfava/ext/rustfava_ext_test/RustfavaExtTest.js +2 -2
  3. rustfava/help/extensions.md +4 -0
  4. rustfava/static/app.js +4 -4
  5. rustfava/static/{beancount-VTTKRGSK.js → beancount-MH465CAD.js} +2 -2
  6. rustfava/static/{chunk-V24TLQHT.js → chunk-P3BY4CCB.js} +28 -23
  7. rustfava/static/{chunk-V24TLQHT.js.map → chunk-P3BY4CCB.js.map} +2 -2
  8. rustfava/translations/bg/LC_MESSAGES/messages.mo +0 -0
  9. rustfava/translations/ca/LC_MESSAGES/messages.mo +0 -0
  10. rustfava/translations/de/LC_MESSAGES/messages.mo +0 -0
  11. rustfava/translations/es/LC_MESSAGES/messages.mo +0 -0
  12. rustfava/translations/fa/LC_MESSAGES/messages.mo +0 -0
  13. rustfava/translations/fr/LC_MESSAGES/messages.mo +0 -0
  14. rustfava/translations/ja/LC_MESSAGES/messages.mo +0 -0
  15. rustfava/translations/nl/LC_MESSAGES/messages.mo +0 -0
  16. rustfava/translations/pt/LC_MESSAGES/messages.mo +0 -0
  17. rustfava/translations/pt_BR/LC_MESSAGES/messages.mo +0 -0
  18. rustfava/translations/ru/LC_MESSAGES/messages.mo +0 -0
  19. rustfava/translations/sk/LC_MESSAGES/messages.mo +0 -0
  20. rustfava/translations/sv/LC_MESSAGES/messages.mo +0 -0
  21. rustfava/translations/uk/LC_MESSAGES/messages.mo +0 -0
  22. rustfava/translations/zh/LC_MESSAGES/messages.mo +0 -0
  23. rustfava/translations/zh_Hant_TW/LC_MESSAGES/messages.mo +0 -0
  24. rustfava-0.1.3.dist-info/METADATA +133 -0
  25. {rustfava-0.1.0.dist-info → rustfava-0.1.3.dist-info}/RECORD +31 -31
  26. {rustfava-0.1.0.dist-info → rustfava-0.1.3.dist-info}/WHEEL +1 -1
  27. rustfava-0.1.0.dist-info/METADATA +0 -102
  28. /rustfava/static/{beancount-VTTKRGSK.js.map → beancount-MH465CAD.js.map} +0 -0
  29. {rustfava-0.1.0.dist-info → rustfava-0.1.3.dist-info}/entry_points.txt +0 -0
  30. {rustfava-0.1.0.dist-info → rustfava-0.1.3.dist-info}/licenses/AUTHORS +0 -0
  31. {rustfava-0.1.0.dist-info → rustfava-0.1.3.dist-info}/licenses/LICENSE +0 -0
  32. {rustfava-0.1.0.dist-info → rustfava-0.1.3.dist-info}/top_level.txt +0 -0
@@ -1,16 +1,16 @@
1
1
  // @ts-check
2
2
 
3
- /** @type import("../../../../frontend/src/extensions").ExtensionModule */
3
+ /** @type import("../../../../frontend/src/extension-api").ExtensionModule */
4
4
  export default {
5
5
  init() {
6
- console.log("initialising extension");
6
+ console.log("initialising Javascript extension PortfolioList");
7
7
  },
8
8
  onPageLoad() {
9
- console.log("a Fava report page has loaded", window.location.pathname);
9
+ console.log("A Fava report page has loaded", window.location.pathname);
10
10
  },
11
11
  onExtensionPageLoad() {
12
12
  console.log(
13
- "the page for the PortfolioList extension has loaded",
13
+ "The page for the PortfolioList extension has loaded",
14
14
  window.location.pathname,
15
15
  );
16
16
 
@@ -1,9 +1,9 @@
1
1
  // @ts-check
2
2
 
3
- /** @type import("../../../../frontend/src/extensions").ExtensionModule */
3
+ /** @type import("../../../../frontend/src/extension-api").ExtensionModule */
4
4
  export default {
5
5
  init() {
6
- console.log("initialising extension");
6
+ console.log("Initialising extension FavaExtTest");
7
7
  },
8
8
  onPageLoad() {
9
9
  console.log("a Fava report page has loaded", window.location.pathname);
@@ -29,6 +29,10 @@ the following events/functions can be specified:
29
29
  on any further navigation).
30
30
  - `onExtensionPageLoad`: Is called when the extension report is loaded.
31
31
 
32
+ The type signature of the extension module is defined in
33
+ [extension-api.d.ts](https://github.com/beancount/fava/blob/main/frontend/src/extension-api.d.ts),
34
+ which you can vendor into your extension to get Typescript checking for it.
35
+
32
36
  The whole extension system should be considered unstable and it might change
33
37
  drastically.
34
38
 
rustfava/static/app.js CHANGED
@@ -257,7 +257,7 @@ import {
257
257
  utcYear,
258
258
  writable,
259
259
  years
260
- } from "./chunk-V24TLQHT.js";
260
+ } from "./chunk-P3BY4CCB.js";
261
261
 
262
262
  // node_modules/@ungap/custom-elements/index.js
263
263
  (function() {
@@ -768,7 +768,7 @@ var CopyableText = class extends HTMLElement {
768
768
  var BeancountTextarea = class extends HTMLTextAreaElement {
769
769
  constructor() {
770
770
  super();
771
- import("./beancount-VTTKRGSK.js").then(({ init_textarea }) => {
771
+ import("./beancount-MH465CAD.js").then(({ init_textarea }) => {
772
772
  init_textarea(this);
773
773
  }).catch(log_error);
774
774
  }
@@ -7229,7 +7229,7 @@ var editor = new Route(
7229
7229
  get_source({
7230
7230
  filename: url.searchParams.get("file_path") ?? ""
7231
7231
  }),
7232
- import("./beancount-VTTKRGSK.js")
7232
+ import("./beancount-MH465CAD.js")
7233
7233
  ]);
7234
7234
  return {
7235
7235
  source: source2,
@@ -11495,7 +11495,7 @@ function Context($$anchor, $$props) {
11495
11495
  node_5,
11496
11496
  () => Promise.all([
11497
11497
  get_source_slice({ entry_hash: get(entry_hash) }),
11498
- import("./beancount-VTTKRGSK.js")
11498
+ import("./beancount-MH465CAD.js")
11499
11499
  ]),
11500
11500
  ($$anchor6) => {
11501
11501
  var p = root_86();
@@ -12,7 +12,7 @@ import {
12
12
  put_format_source,
13
13
  tags,
14
14
  todayAsString
15
- } from "./chunk-V24TLQHT.js";
15
+ } from "./chunk-P3BY4CCB.js";
16
16
  import {
17
17
  DocInput,
18
18
  EditorState,
@@ -4639,4 +4639,4 @@ export {
4639
4639
  toggleComment,
4640
4640
  unfoldAll
4641
4641
  };
4642
- //# sourceMappingURL=beancount-VTTKRGSK.js.map
4642
+ //# sourceMappingURL=beancount-MH465CAD.js.map
@@ -7310,15 +7310,15 @@ var urlForAccount = derived2(
7310
7310
  );
7311
7311
 
7312
7312
  // src/extensions.ts
7313
- var ExtensionApi = class {
7314
- name;
7313
+ var ExtensionApiImpl = class {
7314
+ /** The extension name. */
7315
+ #name;
7315
7316
  constructor(name) {
7316
- this.name = name;
7317
+ this.#name = name;
7317
7318
  }
7318
- /** Send a request to an extension endpoint. */
7319
7319
  async request(endpoint, method, params, body, output = "json") {
7320
7320
  const $urlForRaw = get2(urlForRaw);
7321
- const url = $urlForRaw(`extension/${this.name}/${endpoint}`, params);
7321
+ const url = $urlForRaw(`extension/${this.#name}/${endpoint}`, params);
7322
7322
  let opts = {};
7323
7323
  if (body != null) {
7324
7324
  opts = body instanceof FormData ? { body } : {
@@ -7335,58 +7335,54 @@ var ExtensionApi = class {
7335
7335
  }
7336
7336
  return response;
7337
7337
  }
7338
- /** GET an endpoint with parameters and return JSON. */
7339
7338
  async get(endpoint, params) {
7340
7339
  return this.request(endpoint, "GET", params, void 0);
7341
7340
  }
7342
- /** GET an endpoint with a body and return JSON. */
7343
7341
  async put(endpoint, body) {
7344
7342
  return this.request(endpoint, "PUT", void 0, body);
7345
7343
  }
7346
- /** POST to an endpoint with a body and return JSON. */
7347
7344
  async post(endpoint, body) {
7348
7345
  return this.request(endpoint, "POST", void 0, body);
7349
7346
  }
7350
- /** DELETE an endpoint and return JSON. */
7351
7347
  async delete(endpoint) {
7352
7348
  return this.request(endpoint, "DELETE");
7353
7349
  }
7354
7350
  };
7355
7351
  var ExtensionData = class {
7356
- extension;
7357
- context;
7352
+ #extension;
7353
+ #context;
7358
7354
  constructor(extension, context) {
7359
- this.extension = extension;
7360
- this.context = context;
7355
+ this.#extension = extension;
7356
+ this.#context = context;
7361
7357
  }
7362
7358
  async init() {
7363
- await this.extension.init?.(this.context);
7359
+ await this.#extension.init?.(this.#context);
7364
7360
  }
7365
7361
  onPageLoad() {
7366
- this.extension.onPageLoad?.(this.context);
7362
+ this.#extension.onPageLoad?.(this.#context);
7367
7363
  }
7368
7364
  onExtensionPageLoad() {
7369
- this.extension.onExtensionPageLoad?.(this.context);
7365
+ this.#extension.onExtensionPageLoad?.(this.#context);
7370
7366
  }
7371
7367
  };
7372
- async function loadExtensionModule(name) {
7368
+ async function load_extension_module(name) {
7373
7369
  const $urlForRaw = get2(urlForRaw);
7374
7370
  const url = $urlForRaw(`extension_js_module/${name}.js`);
7375
7371
  const mod = await import(url);
7376
7372
  if (typeof mod.default === "object") {
7377
- return new ExtensionData(mod.default, { api: new ExtensionApi(name) });
7373
+ return new ExtensionData(mod.default, { api: new ExtensionApiImpl(name) });
7378
7374
  }
7379
7375
  throw new Error(
7380
7376
  `Error importing module for extension ${name}: module must export "default" object`
7381
7377
  );
7382
7378
  }
7383
7379
  var loaded_extensions = /* @__PURE__ */ new Map();
7384
- async function getOrInitExtension(name) {
7380
+ async function get_or_init_extension(name) {
7385
7381
  const loaded_ext = loaded_extensions.get(name);
7386
7382
  if (loaded_ext) {
7387
7383
  return loaded_ext;
7388
7384
  }
7389
- const ext_promise = loadExtensionModule(name);
7385
+ const ext_promise = load_extension_module(name);
7390
7386
  loaded_extensions.set(name, ext_promise);
7391
7387
  await (await ext_promise).init();
7392
7388
  return ext_promise;
@@ -7394,7 +7390,7 @@ async function getOrInitExtension(name) {
7394
7390
  function handleExtensionPageLoad() {
7395
7391
  const exts = get2(extensions).filter((e) => e.has_js_module);
7396
7392
  for (const { name } of exts) {
7397
- getOrInitExtension(name).then((m) => {
7393
+ get_or_init_extension(name).then((m) => {
7398
7394
  m.onPageLoad();
7399
7395
  }).catch(log_error);
7400
7396
  }
@@ -7402,7 +7398,7 @@ function handleExtensionPageLoad() {
7402
7398
  if (path2.startsWith("extension/")) {
7403
7399
  for (const { name } of exts) {
7404
7400
  if (path2.startsWith(`extension/${name}`)) {
7405
- getOrInitExtension(name).then((m) => {
7401
+ get_or_init_extension(name).then((m) => {
7406
7402
  m.onExtensionPageLoad();
7407
7403
  }).catch(log_error);
7408
7404
  }
@@ -7610,6 +7606,7 @@ var DatalessRoute = class extends Route {
7610
7606
  // src/router.ts
7611
7607
  var is_normal_click = (event2) => event2.button === 0 && !event2.altKey && !event2.ctrlKey && !event2.metaKey && !event2.shiftKey;
7612
7608
  var is_external_link = (link2) => link2.hasAttribute("data-remote") || link2 instanceof HTMLAnchorElement && (link2.host !== window.location.host || !link2.protocol.startsWith("http"));
7609
+ var navigation_api = "navigation" in window ? window.navigation : null;
7613
7610
  function set_query_param(url, key2, value) {
7614
7611
  if (value) {
7615
7612
  url.searchParams.set(key2, value);
@@ -7857,6 +7854,14 @@ var Router = class {
7857
7854
  if (this.current.hash) {
7858
7855
  const target = new URL(this.current);
7859
7856
  target.hash = "";
7857
+ if (navigation_api?.currentEntry != null && navigation_api.canGoBack) {
7858
+ const entries = navigation_api.entries();
7859
+ const previous_entry = entries[navigation_api.currentEntry.index - 1];
7860
+ if (previous_entry?.url === target.href) {
7861
+ navigation_api.back();
7862
+ return;
7863
+ }
7864
+ }
7860
7865
  this.navigate(target, false);
7861
7866
  }
7862
7867
  };
@@ -12670,4 +12675,4 @@ export {
12670
12675
  last_element,
12671
12676
  move2 as move
12672
12677
  };
12673
- //# sourceMappingURL=chunk-V24TLQHT.js.map
12678
+ //# sourceMappingURL=chunk-P3BY4CCB.js.map