@zthun/romulator-web 1.2.0 → 1.3.1

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.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Romulator: Organize your Games</title>
7
- <script type="module" crossorigin src="/assets/index-weK5iOs6.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-Dsf8H9t4.js"></script>
8
8
  </head>
9
9
  <body>
10
10
  <div id="zthunworks-romulator"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zthun/romulator-web",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Romulator frontend",
5
5
  "author": "Anthony Bonta",
6
6
  "license": "MIT",
@@ -18,21 +18,21 @@
18
18
  "access": "public"
19
19
  },
20
20
  "devDependencies": {
21
- "@types/node": "^24.0.3",
21
+ "@types/node": "^24.0.7",
22
22
  "@vitejs/plugin-react-swc": "^3.10.2",
23
- "@zthun/cirque": "^7.1.4",
24
- "@zthun/cirque-du-react": "^7.1.4",
25
- "@zthun/fashion-boutique": "^10.2.1",
23
+ "@zthun/cirque": "^7.1.5",
24
+ "@zthun/cirque-du-react": "^7.1.5",
25
+ "@zthun/fashion-boutique": "^10.2.2",
26
26
  "@zthun/fashion-tailor": "^10.2.1",
27
27
  "@zthun/fashion-theme": "^10.2.1",
28
28
  "@zthun/helpful-fn": "^9.4.0",
29
29
  "@zthun/helpful-query": "^9.4.0",
30
- "@zthun/helpful-react": "^9.4.0",
31
- "@zthun/janitor-build-config": "^19.2.4",
32
- "@zthun/romulator-client": "^1.2.0",
33
- "@zthun/webigail-http": "^4.0.3",
34
- "@zthun/webigail-rest": "^4.0.3",
35
- "@zthun/webigail-url": "^4.0.3",
30
+ "@zthun/helpful-react": "^9.4.1",
31
+ "@zthun/janitor-build-config": "^19.2.6",
32
+ "@zthun/romulator-client": "^1.3.1",
33
+ "@zthun/webigail-http": "^4.0.4",
34
+ "@zthun/webigail-rest": "^4.0.4",
35
+ "@zthun/webigail-url": "^4.0.4",
36
36
  "history": "^5.3.0",
37
37
  "lodash-es": "^4.17.21",
38
38
  "react": "^19.1.0",
@@ -44,5 +44,5 @@
44
44
  "vitest": "^3.2.4",
45
45
  "vitest-mock-extended": "^3.1.0"
46
46
  },
47
- "gitHead": "8e51e1660617d8aea4be5cd3c2d666e2bf673f52"
47
+ "gitHead": "d4a87d541e1a587abd3a7e483555e9a6a7bb58d1"
48
48
  }
@@ -13,7 +13,10 @@ import {
13
13
  ZDataSourceStatic,
14
14
  ZFilterBinaryBuilder,
15
15
  } from "@zthun/helpful-query";
16
- import { ZRomulatorSystemBuilder } from "@zthun/romulator-client";
16
+ import {
17
+ ZRomulatorSystemBuilder,
18
+ ZRomulatorSystemId,
19
+ } from "@zthun/romulator-client";
17
20
  import type { History } from "history";
18
21
  import { createMemoryHistory } from "history";
19
22
  import { noop } from "lodash-es";
@@ -30,7 +33,9 @@ interface ZRomulatorSystemPageProps {
30
33
  }
31
34
 
32
35
  describe("SystemPage", () => {
33
- const nes = new ZRomulatorSystemBuilder().id("nes").build();
36
+ const nes = new ZRomulatorSystemBuilder()
37
+ .id(ZRomulatorSystemId.Nintendo)
38
+ .build();
34
39
 
35
40
  let _driver: IZCircusDriver;
36
41
  let _renderer: IZCircusSetup;
@@ -3,7 +3,10 @@ import { ZCircusBy } from "@zthun/cirque";
3
3
  import { ZCircusSetupRenderer } from "@zthun/cirque-du-react";
4
4
  import { ZTestRouter } from "@zthun/fashion-boutique";
5
5
  import { ZDataSourceStatic } from "@zthun/helpful-query";
6
- import { ZRomulatorSystemBuilder } from "@zthun/romulator-client";
6
+ import {
7
+ ZRomulatorSystemBuilder,
8
+ ZRomulatorSystemId,
9
+ } from "@zthun/romulator-client";
7
10
  import type { MemoryHistory } from "history";
8
11
  import { createMemoryHistory } from "history";
9
12
  import type { Mocked } from "vitest";
@@ -15,8 +18,12 @@ import type { IZRomulatorSystemsService } from "./systems-service.mjs";
15
18
  import { ZRomulatorSystemsServiceContext } from "./systems-service.mjs";
16
19
 
17
20
  describe("ZRomulatorSystemsPage", () => {
18
- const nes = new ZRomulatorSystemBuilder().id("nes").build();
19
- const snes = new ZRomulatorSystemBuilder().id("snes").build();
21
+ const nes = new ZRomulatorSystemBuilder()
22
+ .id(ZRomulatorSystemId.Nintendo)
23
+ .build();
24
+ const snes = new ZRomulatorSystemBuilder()
25
+ .id(ZRomulatorSystemId.SuperNintendo)
26
+ .build();
20
27
  const systems = [nes, snes];
21
28
 
22
29
  let _systemsService: Mocked<IZRomulatorSystemsService>;
@@ -16,6 +16,7 @@ import { css, cssJoinDefined, ZOrientation } from "@zthun/helpful-fn";
16
16
  import { ZDataRequestBuilder, ZSortBuilder } from "@zthun/helpful-query";
17
17
  import type { IZRomulatorSystem } from "@zthun/romulator-client";
18
18
  import { useState } from "react";
19
+ import { ZRomulatorEnvironmentBuilder } from "../environment/environment.mjs";
19
20
  import { useSystemsService } from "./systems-service.mjs";
20
21
 
21
22
  const DefaultSystemSortOrder = new ZSortBuilder()
@@ -40,7 +41,10 @@ export function ZRomulatorSystemsPage() {
40
41
  `);
41
42
 
42
43
  const renderTile = (system: IZRomulatorSystem) => {
43
- const wheel = `/systems/wheel/${system.id}.png`;
44
+ const { api } = new ZRomulatorEnvironmentBuilder().build();
45
+ const id = `${system.id}-wheel`;
46
+ const wheel = `${api}/media/${id}`;
47
+
44
48
  return (
45
49
  <ZBox
46
50
  className="ZRomulatorSystemsPage-tile"
@@ -8,7 +8,7 @@ import type { IZRestfulGet, IZRestfulService } from "@zthun/webigail-rest";
8
8
  import { ZRestfulService } from "@zthun/webigail-rest";
9
9
  import { ZUrlBuilder } from "@zthun/webigail-url";
10
10
  import { createContext, useContext } from "react";
11
- import { ZRomulatorEnvironmentService } from "../environment/environment-service.mjs";
11
+ import { ZRomulatorEnvironmentBuilder } from "../environment/environment.mjs";
12
12
 
13
13
  export interface IZRomulatorSystemsService
14
14
  extends IZRestfulGet<IZRomulatorSystem>,
@@ -17,17 +17,14 @@ export interface IZRomulatorSystemsService
17
17
  export class ZRomulatorSystemsService implements IZRomulatorSystemsService {
18
18
  private _rest: ZLazy<IZRestfulService<IZRomulatorSystem>>;
19
19
 
20
- public async endpoint() {
21
- const env = await this._env.read();
22
- return new ZUrlBuilder().parse(env.api).append("systems").build();
20
+ public endpoint() {
21
+ const { api } = new ZRomulatorEnvironmentBuilder().build();
22
+ return new ZUrlBuilder().parse(api).append("systems").build();
23
23
  }
24
24
 
25
- public constructor(
26
- _http: IZHttpService,
27
- private readonly _env: ZRomulatorEnvironmentService,
28
- ) {
25
+ public constructor(_http: IZHttpService) {
29
26
  this._rest = new ZLazy(async () =>
30
- Promise.resolve(new ZRestfulService(_http, await this.endpoint())),
27
+ Promise.resolve(new ZRestfulService(_http, this.endpoint())),
31
28
  );
32
29
  }
33
30
 
@@ -45,10 +42,7 @@ export class ZRomulatorSystemsService implements IZRomulatorSystemsService {
45
42
  }
46
43
 
47
44
  export function createDefaultSystemsService(): IZRomulatorSystemsService {
48
- return new ZRomulatorSystemsService(
49
- new ZHttpService(),
50
- new ZRomulatorEnvironmentService(),
51
- );
45
+ return new ZRomulatorSystemsService(new ZHttpService());
52
46
  }
53
47
 
54
48
  export const ZRomulatorSystemsServiceContext = createContext(
@@ -3,7 +3,10 @@ import type { IZCircusReactHook } from "@zthun/cirque-du-react";
3
3
  import { ZCircusSetupHook } from "@zthun/cirque-du-react";
4
4
  import { ZDataRequestBuilder, ZPageBuilder } from "@zthun/helpful-query";
5
5
  import type { IZRomulatorSystem } from "@zthun/romulator-client";
6
- import { ZRomulatorSystemBuilder } from "@zthun/romulator-client";
6
+ import {
7
+ ZRomulatorSystemBuilder,
8
+ ZRomulatorSystemId,
9
+ } from "@zthun/romulator-client";
7
10
  import {
8
11
  ZHttpMethod,
9
12
  ZHttpResultBuilder,
@@ -11,11 +14,7 @@ import {
11
14
  } from "@zthun/webigail-http";
12
15
  import { ZRestfulUrlBuilder } from "@zthun/webigail-rest";
13
16
  import { ZUrlBuilder } from "@zthun/webigail-url";
14
- import type { Mocked } from "vitest";
15
17
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
16
- import { mock } from "vitest-mock-extended";
17
- import type { IZRomulatorEnvironmentService } from "../environment/environment-service.mjs";
18
- import { ZRomulatorEnvironmentBuilder } from "../environment/environment.mjs";
19
18
  import type { IZRomulatorSystemsService } from "./systems-service.mjs";
20
19
  import {
21
20
  useSystemsService,
@@ -24,19 +23,20 @@ import {
24
23
 
25
24
  describe("SystemsService", () => {
26
25
  let _http: ZHttpServiceMock;
27
- let _env: Mocked<IZRomulatorEnvironmentService>;
28
26
 
29
- const nes = new ZRomulatorSystemBuilder().id("nes").build();
30
- const snes = new ZRomulatorSystemBuilder().id("snes").build();
27
+ const nes = new ZRomulatorSystemBuilder()
28
+ .id(ZRomulatorSystemId.Nintendo)
29
+ .build();
30
+ const snes = new ZRomulatorSystemBuilder()
31
+ .id(ZRomulatorSystemId.SuperNintendo)
32
+ .build();
31
33
  const systems = [nes, snes];
32
34
 
33
35
  beforeEach(async () => {
34
36
  _http = new ZHttpServiceMock();
35
- _env = mock<IZRomulatorEnvironmentService>();
36
- _env.read.mockResolvedValue(new ZRomulatorEnvironmentBuilder().build());
37
37
  });
38
38
 
39
- const createTestTarget = () => new ZRomulatorSystemsService(_http, _env);
39
+ const createTestTarget = () => new ZRomulatorSystemsService(_http);
40
40
 
41
41
  describe("Read", () => {
42
42
  it("should retrieve a list of systems", async () => {
@@ -45,7 +45,7 @@ describe("SystemsService", () => {
45
45
  const request = new ZDataRequestBuilder().build();
46
46
 
47
47
  _http.set(
48
- await target.endpoint(),
48
+ target.endpoint(),
49
49
  ZHttpMethod.Get,
50
50
  new ZHttpResultBuilder(
51
51
  new ZPageBuilder<IZRomulatorSystem>().all(systems).build(),
@@ -64,19 +64,13 @@ describe("SystemsService", () => {
64
64
  const target = createTestTarget();
65
65
 
66
66
  _http.set(
67
- new ZUrlBuilder()
68
- .parse(await target.endpoint())
69
- .append(nes.id)
70
- .build(),
67
+ new ZUrlBuilder().parse(target.endpoint()).append(nes.id).build(),
71
68
  ZHttpMethod.Get,
72
69
  new ZHttpResultBuilder(nes).build(),
73
70
  );
74
71
 
75
72
  _http.set(
76
- new ZUrlBuilder()
77
- .parse(await target.endpoint())
78
- .append(snes.id)
79
- .build(),
73
+ new ZUrlBuilder().parse(target.endpoint()).append(snes.id).build(),
80
74
  ZHttpMethod.Get,
81
75
  new ZHttpResultBuilder(snes).build(),
82
76
  );
@@ -97,7 +91,7 @@ describe("SystemsService", () => {
97
91
  const target = createTestTarget();
98
92
 
99
93
  _http.set(
100
- new ZRestfulUrlBuilder(await target.endpoint()).count().build(),
94
+ new ZRestfulUrlBuilder(target.endpoint()).count().build(),
101
95
  ZHttpMethod.Get,
102
96
  new ZHttpResultBuilder(
103
97
  new ZPageBuilder<IZRomulatorSystem>()
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,19 +0,0 @@
1
- /* istanbul ignore file -- @preserve */
2
- import type { IZRomulatorEnvironment } from "./environment.mjs";
3
- import { ZRomulatorEnvironmentBuilder } from "./environment.mjs";
4
-
5
- export interface IZRomulatorEnvironmentService {
6
- read(): Promise<IZRomulatorEnvironment>;
7
- }
8
-
9
- export class ZRomulatorEnvironmentService
10
- implements IZRomulatorEnvironmentService
11
- {
12
- public read(): Promise<IZRomulatorEnvironment> {
13
- return Promise.resolve(new ZRomulatorEnvironmentBuilder().build());
14
- }
15
- }
16
-
17
- export function createDefaultEnvironmentService(): IZRomulatorEnvironmentService {
18
- return new ZRomulatorEnvironmentService();
19
- }