@manakind/shiptight-ui 0.2.0 → 0.3.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.
Files changed (112) hide show
  1. package/README.md +41 -3
  2. package/dist/chart-scene/chart-scene.css +46 -0
  3. package/dist/chart-scene/chart-scene.css.d.ts +2 -0
  4. package/dist/chart-scene/chart-scene.d.ts +75 -0
  5. package/dist/chart-scene/chart-scene.d.ts.map +1 -0
  6. package/dist/chart-scene/chart-scene.js +93 -0
  7. package/dist/chart-scene/chart-scene.js.map +1 -0
  8. package/dist/chart-scene/index.d.ts +3 -0
  9. package/dist/chart-scene/index.d.ts.map +1 -0
  10. package/dist/chart-scene/index.js +2 -0
  11. package/dist/chart-scene/index.js.map +1 -0
  12. package/dist/chart-scene/layout.d.ts +72 -0
  13. package/dist/chart-scene/layout.d.ts.map +1 -0
  14. package/dist/chart-scene/layout.js +120 -0
  15. package/dist/chart-scene/layout.js.map +1 -0
  16. package/dist/illustrations/anchor.d.ts +4 -0
  17. package/dist/illustrations/anchor.d.ts.map +1 -0
  18. package/dist/illustrations/anchor.js +6 -0
  19. package/dist/illustrations/anchor.js.map +1 -0
  20. package/dist/illustrations/chart.d.ts +4 -0
  21. package/dist/illustrations/chart.d.ts.map +1 -0
  22. package/dist/illustrations/chart.js +6 -0
  23. package/dist/illustrations/chart.js.map +1 -0
  24. package/dist/illustrations/course.d.ts +4 -0
  25. package/dist/illustrations/course.d.ts.map +1 -0
  26. package/dist/illustrations/course.js +6 -0
  27. package/dist/illustrations/course.js.map +1 -0
  28. package/dist/illustrations/day-sail.d.ts +4 -0
  29. package/dist/illustrations/day-sail.d.ts.map +1 -0
  30. package/dist/illustrations/day-sail.js +6 -0
  31. package/dist/illustrations/day-sail.js.map +1 -0
  32. package/dist/illustrations/fitting-out.d.ts +4 -0
  33. package/dist/illustrations/fitting-out.d.ts.map +1 -0
  34. package/dist/illustrations/fitting-out.js +6 -0
  35. package/dist/illustrations/fitting-out.js.map +1 -0
  36. package/dist/illustrations/frame.d.ts +12 -0
  37. package/dist/illustrations/frame.d.ts.map +1 -0
  38. package/dist/illustrations/frame.js +15 -0
  39. package/dist/illustrations/frame.js.map +1 -0
  40. package/dist/illustrations/half-hull.d.ts +4 -0
  41. package/dist/illustrations/half-hull.d.ts.map +1 -0
  42. package/dist/illustrations/half-hull.js +6 -0
  43. package/dist/illustrations/half-hull.js.map +1 -0
  44. package/dist/illustrations/index.d.ts +26 -0
  45. package/dist/illustrations/index.d.ts.map +1 -0
  46. package/dist/illustrations/index.js +39 -0
  47. package/dist/illustrations/index.js.map +1 -0
  48. package/dist/illustrations/keel.d.ts +4 -0
  49. package/dist/illustrations/keel.d.ts.map +1 -0
  50. package/dist/illustrations/keel.js +6 -0
  51. package/dist/illustrations/keel.js.map +1 -0
  52. package/dist/illustrations/landfall.d.ts +4 -0
  53. package/dist/illustrations/landfall.d.ts.map +1 -0
  54. package/dist/illustrations/landfall.js +6 -0
  55. package/dist/illustrations/landfall.js.map +1 -0
  56. package/dist/illustrations/lodestar.d.ts +4 -0
  57. package/dist/illustrations/lodestar.d.ts.map +1 -0
  58. package/dist/illustrations/lodestar.js +6 -0
  59. package/dist/illustrations/lodestar.js.map +1 -0
  60. package/dist/illustrations/log.d.ts +4 -0
  61. package/dist/illustrations/log.d.ts.map +1 -0
  62. package/dist/illustrations/log.js +6 -0
  63. package/dist/illustrations/log.js.map +1 -0
  64. package/dist/illustrations/paint.d.ts +10 -0
  65. package/dist/illustrations/paint.d.ts.map +1 -0
  66. package/dist/illustrations/paint.js +9 -0
  67. package/dist/illustrations/paint.js.map +1 -0
  68. package/dist/illustrations/passage-plan.d.ts +4 -0
  69. package/dist/illustrations/passage-plan.d.ts.map +1 -0
  70. package/dist/illustrations/passage-plan.js +6 -0
  71. package/dist/illustrations/passage-plan.js.map +1 -0
  72. package/dist/illustrations/passage.d.ts +4 -0
  73. package/dist/illustrations/passage.d.ts.map +1 -0
  74. package/dist/illustrations/passage.js +6 -0
  75. package/dist/illustrations/passage.js.map +1 -0
  76. package/dist/illustrations/scuttled.d.ts +4 -0
  77. package/dist/illustrations/scuttled.d.ts.map +1 -0
  78. package/dist/illustrations/scuttled.js +6 -0
  79. package/dist/illustrations/scuttled.js.map +1 -0
  80. package/dist/illustrations/sounding.d.ts +4 -0
  81. package/dist/illustrations/sounding.d.ts.map +1 -0
  82. package/dist/illustrations/sounding.js +6 -0
  83. package/dist/illustrations/sounding.js.map +1 -0
  84. package/dist/illustrations/voyage.d.ts +4 -0
  85. package/dist/illustrations/voyage.d.ts.map +1 -0
  86. package/dist/illustrations/voyage.js +6 -0
  87. package/dist/illustrations/voyage.js.map +1 -0
  88. package/dist/index.d.ts +7 -3
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +6 -3
  91. package/dist/index.js.map +1 -1
  92. package/dist/scene/geometry.d.ts +17 -0
  93. package/dist/scene/geometry.d.ts.map +1 -0
  94. package/dist/scene/geometry.js +37 -0
  95. package/dist/scene/geometry.js.map +1 -0
  96. package/dist/scene/scene.css +123 -0
  97. package/dist/scene/scene.css.d.ts +2 -0
  98. package/dist/scene/vessels.d.ts +14 -0
  99. package/dist/scene/vessels.d.ts.map +1 -0
  100. package/dist/scene/vessels.js +19 -0
  101. package/dist/scene/vessels.js.map +1 -0
  102. package/dist/voyage-scene/index.d.ts +3 -0
  103. package/dist/voyage-scene/index.d.ts.map +1 -0
  104. package/dist/voyage-scene/index.js +2 -0
  105. package/dist/voyage-scene/index.js.map +1 -0
  106. package/dist/voyage-scene/voyage-scene.css +11 -0
  107. package/dist/voyage-scene/voyage-scene.css.d.ts +2 -0
  108. package/dist/voyage-scene/voyage-scene.d.ts +57 -0
  109. package/dist/voyage-scene/voyage-scene.d.ts.map +1 -0
  110. package/dist/voyage-scene/voyage-scene.js +54 -0
  111. package/dist/voyage-scene/voyage-scene.js.map +1 -0
  112. package/package.json +34 -8
@@ -0,0 +1,123 @@
1
+ /*
2
+ * The parts every ShipTight scene shares: the sea it is drawn on, the chart's
3
+ * lines and land, and its two faces of type. Colour lives here; geometry
4
+ * (stroke weights, dashes, text sizes) is on the SVG, in the scene's own units.
5
+ */
6
+ @layer components {
7
+ .sti-scene {
8
+ display: block;
9
+ width: 100%;
10
+ height: auto;
11
+ background-color: var(--component-scene-bg);
12
+ border: 1px solid var(--component-scene-border);
13
+ border-radius: var(--semantic-radius-surface);
14
+ font-family: var(--primitives-font-family-sans);
15
+ }
16
+
17
+ .sti-scene__label {
18
+ fill: var(--component-scene-text);
19
+ stroke: none;
20
+ font-family: var(--primitives-font-family-mono);
21
+ letter-spacing: 0.12em;
22
+ text-transform: uppercase;
23
+ }
24
+
25
+ .sti-scene__label--muted {
26
+ fill: var(--component-scene-text-muted);
27
+ }
28
+
29
+ /* A knockout in the sea's colour, so a label stays legible over a route. */
30
+ .sti-scene__label--haloed {
31
+ stroke: var(--component-scene-bg);
32
+ stroke-linejoin: round;
33
+ }
34
+
35
+ .sti-scene__name {
36
+ fill: var(--component-scene-text);
37
+ font-family: var(--primitives-font-family-serif);
38
+ font-style: italic;
39
+ }
40
+
41
+ .sti-scene__name--muted {
42
+ fill: var(--component-scene-text-muted);
43
+ }
44
+
45
+ .sti-scene__note {
46
+ fill: var(--component-scene-text-muted);
47
+ }
48
+
49
+ .sti-scene__grid {
50
+ fill: none;
51
+ stroke: var(--component-scene-grid-color);
52
+ }
53
+
54
+ .sti-scene__contour {
55
+ fill: none;
56
+ stroke: var(--component-scene-contour-color);
57
+ }
58
+
59
+ .sti-scene__line,
60
+ .sti-scene__ahead {
61
+ fill: none;
62
+ stroke: var(--component-scene-line-color);
63
+ }
64
+
65
+ .sti-scene__sailed {
66
+ fill: none;
67
+ stroke: var(--semantic-color-line-accent);
68
+ }
69
+
70
+ .sti-scene__land {
71
+ fill: var(--component-scene-land-bg);
72
+ stroke: var(--component-scene-land-border);
73
+ }
74
+
75
+ .sti-scene__coastline {
76
+ fill: none;
77
+ stroke: var(--component-scene-land-border);
78
+ }
79
+
80
+ .sti-scene__ink {
81
+ fill: none;
82
+ stroke: var(--component-scene-text);
83
+ }
84
+
85
+ .sti-scene__flag {
86
+ fill: var(--semantic-color-line-accent);
87
+ stroke: none;
88
+ }
89
+
90
+ .sti-scene__gate {
91
+ fill: var(--component-scene-bg);
92
+ stroke: var(--component-scene-text);
93
+ }
94
+
95
+ .sti-scene__gate--opened {
96
+ fill: var(--component-scene-text);
97
+ }
98
+
99
+ .sti-scene__faded {
100
+ opacity: var(--component-scene-faded-opacity);
101
+ }
102
+
103
+ .sti-scene__bob {
104
+ animation: sti-scene-bob 3.2s ease-in-out infinite;
105
+ }
106
+
107
+ @media (prefers-reduced-motion: reduce) {
108
+ .sti-scene__bob {
109
+ animation: none;
110
+ }
111
+ }
112
+
113
+ @keyframes sti-scene-bob {
114
+ 0%,
115
+ 100% {
116
+ transform: translateY(0);
117
+ }
118
+
119
+ 50% {
120
+ transform: translateY(-2px);
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,2 @@
1
+ /* AUTOGENERATED: types for the stylesheet beside it. */
2
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { IllustrationSource } from '@manakind/ui-core';
2
+ /** The vessel a scene draws for a passage: under sail, at anchor, or wrecked. */
3
+ export type SceneVessel = 'voyage' | 'daysail' | 'anchor' | 'wreck';
4
+ export declare const VESSEL_ARTWORK: Record<SceneVessel, IllustrationSource>;
5
+ /** A vessel still sailing: it bobs, where one at anchor, wrecked or arrived holds still. */
6
+ export declare function isUnderWay(vessel: SceneVessel, progress: number): boolean;
7
+ /**
8
+ * The gates a scene draws on a route. A wreck has no leg ahead, so the gates
9
+ * it never reached aren't drawn either; every other vessel shows them all.
10
+ */
11
+ export declare function gatesDrawn<Gate extends {
12
+ opened?: unknown;
13
+ }>(vessel: SceneVessel, gates: readonly Gate[]): readonly Gate[];
14
+ //# sourceMappingURL=vessels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vessels.d.ts","sourceRoot":"","sources":["../../src/scene/vessels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpE,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAKlE,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,EAC1D,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,SAAS,IAAI,EAAE,GACrB,SAAS,IAAI,EAAE,CAEjB"}
@@ -0,0 +1,19 @@
1
+ import { AnchorArtwork, DaySailArtwork, ScuttledArtwork, VoyageArtwork } from '../illustrations';
2
+ export const VESSEL_ARTWORK = {
3
+ voyage: VoyageArtwork,
4
+ daysail: DaySailArtwork,
5
+ anchor: AnchorArtwork,
6
+ wreck: ScuttledArtwork,
7
+ };
8
+ /** A vessel still sailing: it bobs, where one at anchor, wrecked or arrived holds still. */
9
+ export function isUnderWay(vessel, progress) {
10
+ return (vessel === 'voyage' || vessel === 'daysail') && progress < 1;
11
+ }
12
+ /**
13
+ * The gates a scene draws on a route. A wreck has no leg ahead, so the gates
14
+ * it never reached aren't drawn either; every other vessel shows them all.
15
+ */
16
+ export function gatesDrawn(vessel, gates) {
17
+ return vessel === 'wreck' ? gates.filter((gate) => Boolean(gate.opened)) : gates;
18
+ }
19
+ //# sourceMappingURL=vessels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vessels.js","sourceRoot":"","sources":["../../src/scene/vessels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjG,MAAM,CAAC,MAAM,cAAc,GAA4C;IACrE,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,eAAe;CACvB,CAAC;AAEF,4FAA4F;AAC5F,MAAM,UAAU,UAAU,CAAC,MAAmB,EAAE,QAAgB;IAC9D,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,SAAS,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,MAAmB,EACnB,KAAsB;IAEtB,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACnF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { VoyageSceneGate, VoyageSceneProps, VoyageSceneStage } from './voyage-scene';
2
+ export { VoyageScene } from './voyage-scene';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/voyage-scene/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { VoyageScene } from './voyage-scene';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/voyage-scene/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,11 @@
1
+ @layer components {
2
+ .sti-voyage-scene__stage-name {
3
+ fill: var(--component-scene-text);
4
+ font-family: var(--primitives-font-family-grotesk);
5
+ font-weight: var(--primitives-font-weight-semibold);
6
+ }
7
+
8
+ .sti-voyage-scene__stage-name--current {
9
+ font-weight: var(--primitives-font-weight-bold);
10
+ }
11
+ }
@@ -0,0 +1,2 @@
1
+ /* AUTOGENERATED: types for the stylesheet beside it. */
2
+ export {};
@@ -0,0 +1,57 @@
1
+ import { type IllustrationSource } from '@manakind/ui-core';
2
+ import '../scene/scene.css';
3
+ import { type SceneVessel } from '../scene/vessels';
4
+ import './voyage-scene.css';
5
+ export interface VoyageSceneStage {
6
+ id: string;
7
+ /** The stage's name, e.g. "Laying the keel". */
8
+ name: string;
9
+ /** Its plain-language meaning, shown under the name, e.g. "Prove the architecture". */
10
+ plain: string;
11
+ /** The vocabulary drawing shown above the stage. */
12
+ illustration: IllustrationSource;
13
+ /** A stage this voyage passes over, as a Day sail does. Drawn receded and labelled "Skipped". */
14
+ skipped?: boolean;
15
+ }
16
+ export interface VoyageSceneGate {
17
+ id: string;
18
+ /** The gate's name, shown under its marker. */
19
+ name: string;
20
+ /** Where the gate sits along the route, 0 (home port) to 1 (the Landfall). */
21
+ at: number;
22
+ /** Set once the gate is opened; `label` says when and by whom. */
23
+ opened?: {
24
+ label: string;
25
+ };
26
+ /** A gate this voyage does not pass through. Not drawn. */
27
+ skipped?: boolean;
28
+ }
29
+ export interface VoyageSceneProps {
30
+ /**
31
+ * The scene's accessible name, summarising the voyage's state, e.g.
32
+ * "PSG-12 is Fitting out: building. 3 of 5 gates opened."
33
+ */
34
+ title: string;
35
+ /** The stages, left to right, spread evenly along the route. */
36
+ stages: readonly VoyageSceneStage[];
37
+ /** The gates along the route. */
38
+ gates: readonly VoyageSceneGate[];
39
+ /** Where the vessel is, 0 (home port) to 1 (arrived). */
40
+ progress: number;
41
+ /** The vessel drawn at `progress`. A wreck's route has no leg ahead. */
42
+ vessel: SceneVessel;
43
+ /** Extra class names on the root `<svg>`. */
44
+ className?: string;
45
+ }
46
+ /**
47
+ * One voyage drawn as a route from home port to its Landfall: each stage's
48
+ * drawing, name and plain name above the route, each gate below it, the
49
+ * sailed leg solid and the leg ahead dashed, and the vessel where it is now.
50
+ *
51
+ * A picture with no interactive parts, so it is one `role="img"` named by
52
+ * `title`. It is never the only representation: the host renders the stages
53
+ * and gates as text too. The vessel bobs while under way, and holds still
54
+ * under `prefers-reduced-motion`.
55
+ */
56
+ export declare function VoyageScene({ title, stages, gates, progress, vessel, className, }: VoyageSceneProps): import("react/jsx-runtime").JSX.Element;
57
+ //# sourceMappingURL=voyage-scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voyage-scene.d.ts","sourceRoot":"","sources":["../../src/voyage-scene/voyage-scene.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAA0B,KAAK,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAC5F,OAAO,oBAAoB,CAAC;AAE5B,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,YAAY,EAAE,kBAAkB,CAAC;IACjC,iGAAiG;IACjG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,kEAAkE;IAClE,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACpC,iCAAiC;IACjC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,MAAM,EAAE,WAAW,CAAC;IACpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoBD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,GACV,EAAE,gBAAgB,2CA8ClB"}
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { cx, Illustration } from '@manakind/ui-core';
3
+ import { useId } from 'react';
4
+ import { pathOf, pointAt, split } from '../scene/geometry';
5
+ import '../scene/scene.css';
6
+ import { gatesDrawn, isUnderWay, VESSEL_ARTWORK } from '../scene/vessels';
7
+ import './voyage-scene.css';
8
+ const WIDTH = 1200;
9
+ const HEIGHT = 300;
10
+ const ROUTE = [
11
+ { x: 96, y: 196 },
12
+ { x: 420, y: 250 },
13
+ { x: 760, y: 130 },
14
+ { x: 1096, y: 176 },
15
+ ];
16
+ const STAGE_ART = 40;
17
+ const SHIP = 52;
18
+ const HOME_PORT = 'Home port';
19
+ const LANDFALL = 'Landfall';
20
+ const SKIPPED = 'Skipped';
21
+ const AHEAD = 'ahead';
22
+ // Text sizes and stroke weights are in the scene's user units: they scale
23
+ // with the scene, so they are part of the drawing, not type or space tokens.
24
+ /**
25
+ * One voyage drawn as a route from home port to its Landfall: each stage's
26
+ * drawing, name and plain name above the route, each gate below it, the
27
+ * sailed leg solid and the leg ahead dashed, and the vessel where it is now.
28
+ *
29
+ * A picture with no interactive parts, so it is one `role="img"` named by
30
+ * `title`. It is never the only representation: the host renders the stages
31
+ * and gates as text too. The vessel bobs while under way, and holds still
32
+ * under `prefers-reduced-motion`.
33
+ */
34
+ export function VoyageScene({ title, stages, gates, progress, vessel, className, }) {
35
+ const titleId = useId();
36
+ const [sailed, ahead] = split(ROUTE, progress);
37
+ const ship = pointAt(ROUTE, progress);
38
+ const current = Math.min(stages.length - 1, Math.floor(progress * stages.length));
39
+ return (_jsxs("svg", { viewBox: `0 0 ${WIDTH} ${HEIGHT}`, className: cx('sti-scene', 'sti-voyage-scene', className), role: "img", "aria-labelledby": titleId, children: [_jsx("title", { id: titleId, children: title }), _jsx(Backdrop, {}), stages.map((stage, i) => (_jsx(Stage, { stage: stage, x: pointAt(ROUTE, (i + 0.5) / stages.length).x, current: i === current }, stage.id))), progress > 0 && _jsx("path", { className: "sti-scene__sailed", d: pathOf(sailed), strokeWidth: 3 }), progress < 1 && vessel !== 'wreck' && (_jsx("path", { className: "sti-scene__ahead", d: pathOf(ahead), strokeWidth: 2, strokeDasharray: "6 7" })), gatesDrawn(vessel, gates)
40
+ .filter((gate) => !gate.skipped)
41
+ .map((gate) => (_jsx(Gate, { gate: gate }, gate.id))), _jsx("g", { className: cx(isUnderWay(vessel, progress) && 'sti-scene__bob'), children: _jsx(Illustration, { source: VESSEL_ARTWORK[vessel], at: { x: ship.x - SHIP / 2, y: ship.y - 44, size: SHIP }, decorative: true }) })] }));
42
+ }
43
+ function Backdrop() {
44
+ const columns = Array.from({ length: WIDTH / 100 - 1 }, (_, i) => (i + 1) * 100);
45
+ return (_jsxs(_Fragment, { children: [_jsxs("g", { className: "sti-scene__grid", strokeWidth: 1, children: [[100, 200].map((y) => (_jsx("path", { d: `M0 ${y} H${WIDTH}` }, `y${y}`))), columns.map((x) => (_jsx("path", { d: `M${x} 0 V${HEIGHT}` }, `x${x}`)))] }), _jsx("path", { className: "sti-scene__contour", strokeWidth: 1, d: "M0 260 C300 250 500 280 800 262 S1100 250 1200 258" }), _jsx("path", { className: "sti-scene__land", d: "M0 150 C40 150 70 170 80 210 L70 300 H0 Z" }), _jsx("text", { x: 12, y: 290, fontSize: 10, className: "sti-scene__label", children: HOME_PORT }), _jsx("path", { className: "sti-scene__land", d: "M1200 120 C1150 118 1112 140 1108 180 C1106 220 1140 250 1200 262 Z" }), _jsx("path", { className: "sti-scene__ink", d: "M1150 130 V96" }), _jsx("path", { className: "sti-scene__flag", d: "M1150 96 L1170 103 L1150 110 Z" }), _jsx("text", { x: 1188, y: 290, fontSize: 10, textAnchor: "end", className: "sti-scene__label sti-scene__label--muted", children: LANDFALL })] }));
46
+ }
47
+ function Stage({ stage, x, current }) {
48
+ return (_jsxs("g", { children: [_jsx(Illustration, { source: stage.illustration, at: { x: x - STAGE_ART / 2, y: 14, size: STAGE_ART }, className: cx(stage.skipped && 'sti-scene__faded'), decorative: true }), _jsx("text", { x: x, y: 74, fontSize: 14, textAnchor: "middle", className: cx('sti-voyage-scene__stage-name', current && 'sti-voyage-scene__stage-name--current'), children: stage.name }), _jsx("text", { x: x, y: 90, fontSize: 9.5, textAnchor: "middle", className: "sti-scene__label sti-scene__label--muted", children: stage.skipped ? SKIPPED : stage.plain })] }));
49
+ }
50
+ function Gate({ gate }) {
51
+ const at = pointAt(ROUTE, gate.at);
52
+ return (_jsxs("g", { children: [_jsx("path", { className: "sti-scene__ink", d: `M${at.x} ${at.y - 16} V${at.y + 16}`, strokeWidth: 1.5 }), _jsx("circle", { className: cx('sti-scene__gate', gate.opened && 'sti-scene__gate--opened'), cx: at.x, cy: at.y, r: 6, strokeWidth: 1.5 }), _jsx("text", { x: at.x, y: at.y + 34, fontSize: 9.5, textAnchor: "middle", className: "sti-scene__label", children: gate.name }), _jsx("text", { x: at.x, y: at.y + 48, fontSize: 11, textAnchor: "middle", className: "sti-scene__note", children: gate.opened?.label ?? AHEAD })] }));
53
+ }
54
+ //# sourceMappingURL=voyage-scene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voyage-scene.js","sourceRoot":"","sources":["../../src/voyage-scene/voyage-scene.tsx"],"names":[],"mappings":";A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AAK,GACjC,IACL,CACL,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,EAAE,IAAI,EAA6B;IAC/C,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,OAAO,CACL,wBACE,eACE,SAAS,EAAC,gBAAgB,EAC1B,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,EACxC,WAAW,EAAE,GAAG,GAChB,EACF,iBACE,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,MAAM,IAAI,yBAAyB,CAAC,EAC1E,EAAE,EAAE,EAAE,CAAC,CAAC,EACR,EAAE,EAAE,EAAE,CAAC,CAAC,EACR,CAAC,EAAE,CAAC,EACJ,WAAW,EAAE,GAAG,GAChB,EACF,eAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAC,kBAAkB,YACzF,IAAI,CAAC,IAAI,GACL,EACP,eAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAC,iBAAiB,YACvF,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,KAAK,GACvB,IACL,CACL,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/shiptight-ui",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,24 +26,50 @@
26
26
  }
27
27
  },
28
28
  "scripts": {
29
- "build": "tsc -p tsconfig.build.json",
29
+ "build": "tsc -p tsconfig.build.json && bunx tsx ../ds-config/scripts/copy-assets.ts src dist .css",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "lint:css": "stylelint 'src/**/*.css'",
30
33
  "lint": "biome lint .",
31
34
  "typecheck": "tsc --noEmit",
32
- "test": "vitest run --passWithNoTests",
33
- "test:watch": "vitest"
35
+ "storybook": "storybook dev -p 6008",
36
+ "build-storybook": "storybook build",
37
+ "vr": "playwright test"
34
38
  },
35
39
  "dependencies": {
36
- "@manakind/shiptight-tokens": "0.2.0",
37
- "@manakind/ui-core": "0.2.0"
40
+ "@manakind/shiptight-tokens": "0.3.0",
41
+ "@manakind/ui-core": "0.3.0"
38
42
  },
39
43
  "peerDependencies": {
40
- "react": "^19.2.5",
41
- "react-dom": "^19.2.5"
44
+ "react": "^19.0.0",
45
+ "react-dom": "^19.0.0"
42
46
  },
43
47
  "devDependencies": {
44
48
  "@manakind/ds-config": "*",
49
+ "@playwright/test": "1.63.0",
50
+ "@storybook/addon-a11y": "^10.3.6",
51
+ "@storybook/addon-docs": "^10.3.6",
52
+ "@storybook/addon-vitest": "10.3.6",
53
+ "@storybook/react-vite": "^10.3.6",
54
+ "@testing-library/jest-dom": "^6.9.1",
55
+ "@testing-library/react": "^16.3.2",
56
+ "@testing-library/user-event": "^14.6.1",
45
57
  "@types/react": "^19.2.14",
58
+ "@types/react-dom": "^19.2.3",
59
+ "@vitest/browser": "4.1.11",
60
+ "@vitest/browser-playwright": "4.1.11",
61
+ "@vitest/coverage-v8": "^4.1.11",
62
+ "jest-axe": "^10.0.0",
63
+ "jsdom": "^29.1.1",
64
+ "playwright": "1.63.0",
65
+ "react": "^19.2.5",
66
+ "react-dom": "^19.2.5",
67
+ "storybook": "^10.3.6",
68
+ "storybook-addon-pseudo-states": "10.3.6",
69
+ "stylelint": "^17.9.1",
70
+ "stylelint-declaration-strict-value": "^1.11.1",
46
71
  "typescript": "^6.0.3",
72
+ "vite": "^8.0.16",
47
73
  "vitest": "4.1.11"
48
74
  }
49
75
  }