@joy-ride/joy-ride 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # Joy Ride
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Drive through any website. Joy Ride turns page elements into a playground for cars, tire marks, liquids, fire, and breakable artwork. The simulation runs in TypeScript; the browser UI is optional.
4
+
5
+ ![Joy Ride homepage with the vehicle garage](docs/joy-ride-preview.png)
6
+
7
+ [Play the demo](https://jakiestfu.github.io/joy-ride/) · [Explore Splatter](https://jakiestfu.github.io/joy-ride/splatter/) · [Read the API guide](packages/ui/src/documentation/api.md) · [Explore the architecture](docs/package-architecture.md)
8
+
9
+ ## Add it to a page
10
+
11
+ ```html
12
+ <h1 data-jr-breakable data-jr-burnable>Make a mess.</h1>
13
+ <div data-jr-solid>A wall</div>
14
+ <div data-jr-liquid="paint">Paint</div>
15
+
16
+ <script
17
+ type="module"
18
+ src="https://unpkg.com/@joy-ride/joy-ride@latest/npm/embed.js"
19
+ data-jr-auto
20
+ ></script>
21
+ ```
22
+
23
+ The script starts Joy Ride on the page. For custom vehicles, liquid recipes, controls, events, and framework integration, use the [API guide](packages/ui/src/documentation/api.md).
24
+
25
+ Install the root package with `npm install @joy-ride/joy-ride` and import `JoyRide from '@joy-ride/joy-ride'` in a client-side entry point. The script above loads the same runtime through unpkg and starts it automatically; the module import waits for your call to `JoyRide.mount()`.
26
+
27
+ Package owners can follow the [npm publishing guide](docs/npm-publishing.md) for later releases.
28
+
29
+ ## Develop locally
30
+
31
+ ```sh
32
+ corepack pnpm install
33
+ corepack pnpm dev
34
+ ```
35
+
36
+ The site runs at `http://127.0.0.1:5173/`. Run `corepack pnpm check` for tests and performance gates, and `corepack pnpm build` for the production site. See the [testing guide](tests/README.md) for focused checks.
37
+
38
+ ## Repository map
39
+
40
+ - `packages/game`: simulation, rendering, physics, and authored objects
41
+ - `packages/browser` and `packages/embed`: browser runtime and distributable script
42
+ - `packages/ui`, `packages/hud`, and `packages/ai`: optional interface, HUD, and automated driving
43
+ - `packages/splatter`: procedural paint for native HTML elements and media
44
+ - `apps/site`: playable demo and driving school
45
+ - `experiments`: research that is not part of the core runtime
46
+
47
+ The [package architecture guide](docs/package-architecture.md) explains the boundaries and extension points. Licensing information for bundled third-party work is in [third-party notices](THIRD_PARTY_NOTICES.md).
48
+
49
+ Run `pre-commit install` once after cloning to check staged files with Prettier and ESLint before each commit.
@@ -0,0 +1,76 @@
1
+ # Third-party software
2
+
3
+ ## WebGL fluid simulation
4
+
5
+ `packages/game/src/rendering/webgl-fluid/solver.ts` adapts the splat, advection,
6
+ curl/vorticity, divergence, pressure, and gradient subtraction passes from
7
+ [WebGL Fluid Simulation](https://github.com/PavelDoGreat/WebGL-Fluid-Simulation)
8
+ by Pavel Dobryakov, pinned to commit `a2d292931f19d9b3b9f564e23e6c32729d2121c3`.
9
+ The original [MIT license](packages/game/src/rendering/webgl-fluid/LICENSE) is also included
10
+ in the published site at `/licenses/webgl-fluid-simulation.txt`.
11
+
12
+ Copyright (c) 2017 Pavel Dobryakov
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+
32
+ ## Engine simulation
33
+
34
+ `packages/game/src/vendor/engine-sim/` contains the JavaScript audio engine from
35
+ [Engine_Sim](https://github.com/YigitSalihEmecen/Engine_Sim) by Yigit Salih Emecen,
36
+ pinned to commit `c3ff61031050f1fc280a864f4bb445f30aeaa0a3`.
37
+ Its `package.json` declares the MIT license. The original source is kept intact;
38
+ `packages/game/src/audio/engine-audio.ts` is this project's adapter.
39
+
40
+ Copyright (c) Yigit Salih Emecen
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ of this software and associated documentation files (the "Software"), to deal
44
+ in the Software without restriction, including without limitation the rights
45
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ copies of the Software, and to permit persons to whom the Software is
47
+ furnished to do so, subject to the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be included in all
50
+ copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
+ SOFTWARE.
59
+
60
+ ## Tire screech recording
61
+
62
+ `packages/game/src/assets/audio/tire-screech-cc0.mp3` is an MP3 conversion of
63
+ [Screeching Tires #1](https://bigsoundbank.com/screeching-tires-1-s2368.html)
64
+ (sound 2368) by Dorian Clair, distributed by BigSoundBank under
65
+ [CC0](https://creativecommons.org/publicdomain/zero/1.0/). The original WAV is
66
+ 48 kHz, mono, 24-bit; this project's MP3 is encoded for compact web delivery.
67
+ Playback extracts 0.981–1.4505 seconds and applies a 40 ms circular crossfade
68
+ at runtime, with DC removal and correlation-based level compensation. This
69
+ creates a continuous 0.4295-second loop from the existing recording.
70
+
71
+ ## Untangle codebase skill
72
+
73
+ `skills/untangle-codebase/SKILL.md` is copied from
74
+ [Caldo Skills](https://github.com/caldoai/skills/blob/main/skills/untangle-codebase/SKILL.md).
75
+ It is distributed under the MIT license; the upstream copyright and permission
76
+ notice are included in `skills/untangle-codebase/LICENSE`.
@@ -0,0 +1,5 @@
1
+ import { c as PlaygroundConfiguration } from "./playground-xDP5-tDc.js";
2
+ /** A self-contained bookmark URL that captures the complete configuration. */
3
+ export declare function bookmarkletUrl(configuration: PlaygroundConfiguration): string;
4
+ /** Readable, asynchronous embed for pasting into an HTML page. */
5
+ export declare function fullEmbedCode(configuration: PlaygroundConfiguration): string;
@@ -0,0 +1,30 @@
1
+ var e=`https://unpkg.com/@joy-ride/joy-ride@latest/npm/embed.js`;function t(t){let n=t.definitions?.vehicles;if(!n)return t;let r=typeof document<`u`&&document.baseURI||e;return{...t,definitions:{...t.definitions,vehicles:Object.fromEntries(Object.entries(n).map(([e,t])=>[e,{...t,...t.image?.src?{image:{...t.image,src:new URL(t.image.src,r).href}}:{}}]))}}}function n(n){return`javascript:(()=>{const u=${JSON.stringify(e)},o=${JSON.stringify(t(n))},d=window.JoyRide;if(d){d.active?d.active.dispose():d.mount(o);return}const s=document.createElement('script');s.type='module';s.src=u;s.async=true;s.charset='utf-8';s.onload=()=>window.JoyRide.mount(o);document.head.append(s)})()`}function r(n){let r=n.workMode;return`<button type="button" id="joy-ride-toggle">${(r?.brandName??(r?.sfw?`Drive`:`Joy Ride`)).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}</button>
2
+ <script>
3
+ const joyRideOptions = ${JSON.stringify(t(n),null,2).replace(/</g,`\\u003c`).replace(/\n/g,`
4
+ `)};
5
+ const joyRideScriptUrl = ${JSON.stringify(e)};
6
+ let joyRideLoading;
7
+
8
+ function loadJoyRide() {
9
+ if (window.JoyRide) return Promise.resolve(window.JoyRide);
10
+ return joyRideLoading ??= new Promise((resolve, reject) => {
11
+ const script = document.createElement('script');
12
+ script.type = 'module';
13
+ script.src = joyRideScriptUrl;
14
+ script.async = true;
15
+ script.charset = 'utf-8';
16
+ script.onload = () => resolve(window.JoyRide);
17
+ script.onerror = () => {
18
+ joyRideLoading = undefined;
19
+ reject(new Error('Joy Ride could not load'));
20
+ };
21
+ document.head.append(script);
22
+ });
23
+ }
24
+
25
+ document.querySelector('#joy-ride-toggle').addEventListener('click', async () => {
26
+ const joyRide = await loadJoyRide();
27
+ if (joyRide.active) joyRide.active.dispose();
28
+ else joyRide.mount(joyRideOptions);
29
+ });
30
+ <\/script>`}export{n as bookmarkletUrl,r as fullEmbedCode};
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="192" height="116" viewBox="-8 -8 192 116"><polygon fill="white" points="16.67,90.79 18.25,89.60 21.20,78.96 24.21,74.97 25.86,74.94 27.38,74.84 30.27,73.41 33.34,70.11 35.05,68.07 36.52,68.55 39.35,60.31 42.46,54.41 44.24,52.07 45.67,51.53 48.42,38.07 51.57,38.66 53.42,38.36 54.82,27.83 57.50,31.85 60.68,35.57 62.61,36.32 63.97,31.49 66.57,44.49 69.79,45.01 71.80,43.81 73.13,41.26 75.65,46.97 78.89,64.74 80.98,46.54 82.30,45.25 84.73,49.76 87.99,50.40 90.16,48.50 91.46,44.39 93.82,41.91 97.08,41.40 99.33,41.31 100.64,40.73 102.91,44.30 106.17,42.94 108.50,43.76 109.81,44.33 112.00,44.59 115.25,44.48 117.67,40.43 118.99,43.74 121.09,45.93 124.34,39.94 126.84,40.35 128.17,40.91 130.19,41.28 133.42,39.44 136.00,39.87 137.35,39.86 139.30,38.89 142.49,38.93 145.15,37.12 146.54,36.27 148.41,36.91 151.57,36.66 154.30,34.29 155.73,33.01 157.52,33.21 160.64,33.26 161.92,32.29 161.10,43.29 159.79,43.84 158.30,46.41 156.61,49.34 153.56,50.27 150.65,61.39 149.11,65.58 147.48,68.51 144.49,68.82 141.52,68.30 139.92,69.50 138.35,71.67 135.42,72.43 132.39,73.30 130.73,74.01 129.22,67.30 126.34,70.03 123.27,70.52 121.54,70.14 120.08,71.96 117.27,74.84 114.15,72.67 112.35,69.34 110.93,75.25 108.20,76.25 105.04,75.70 103.16,72.99 101.78,70.12 99.12,69.50 95.93,77.96 93.98,78.58 92.62,77.95 90.05,79.18 86.82,70.33 84.80,74.86 83.46,77.35 80.97,80.40 77.72,83.01 75.61,86.38 74.30,88.29 71.88,76.70 68.63,78.57 66.44,81.52 65.13,81.61 62.80,80.97 59.54,81.21 57.26,82.46 55.96,75.36 53.71,78.58 50.45,80.81 48.09,85.60 46.78,89.63 44.61,90.98 41.36,90.31 38.92,92.33 37.60,94.82 35.52,97.78 32.28,98.92 29.76,99.80 28.42,94.92 26.42,97.72 23.20,98.43 20.60,98.91 19.24,100.44 17.31,103.38"/><g fill="white"><circle cx="18" cy="66" r="1.2"/><circle cx="29" cy="46" r=".8"/><circle cx="48" cy="32" r="1"/><circle cx="99" cy="31" r=".7"/><circle cx="165" cy="34" r="1"/><circle cx="171" cy="39" r=".7"/></g></svg>
@@ -0,0 +1 @@
1
+ .joy-code-block{--code-bg:#f5f5f5;--code-header:transparent;--code-ink:#171717;--code-muted:#737373;--code-line:#e5e5e5;--code-accent:#171717;--sh-class:#8f3c2e;--sh-identifier:var(--code-ink);--sh-sign:#72695f;--sh-property:#8f3c2e;--sh-entity:#b32d25;--sh-jsxliterals:#8f3c2e;--sh-string:#775b43;--sh-keyword:#b32d25;--sh-comment:#797267;--sh-space:inherit;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;border:1px solid var(--code-line);border-radius:var(--radius-lg,8px);background:var(--code-bg);min-width:0;color:var(--code-ink);text-align:left;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;overflow:hidden}:where(.dark,[data-jr-theme=dark],[data-theme=dark]) .joy-code-block:not([data-code-theme=light]),:host(.dark) .joy-code-block:not([data-code-theme=light]),.joy-code-block[data-code-theme=dark]{--code-bg:#1c1c1c;--code-header:transparent;--code-ink:#fafafa;--code-muted:#a3a3a3;--code-line:#333;--code-accent:#fafafa;--sh-class:#e6b49b;--sh-sign:#b5a99b;--sh-property:#e6b49b;--sh-entity:#ff998a;--sh-jsxliterals:#e6b49b;--sh-string:#d4c3aa;--sh-keyword:#ff998a;--sh-comment:#9a9389;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}.joy-code-block .joy-code-header{border-bottom:1px solid var(--code-line);background:var(--code-header);align-items:center;gap:10px;min-height:43px;padding:0 16px;display:flex}.joy-code-block .joy-code-heading{flex:1;align-items:center;gap:12px;min-width:0;display:flex}.joy-code-block .joy-code-title{color:var(--code-ink);letter-spacing:0;text-overflow:ellipsis;white-space:nowrap;font:600 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow:hidden}.joy-code-block .joy-code-language{color:var(--code-muted);font:9px ui-monospace,SFMono-Regular,Menlo,monospace}.joy-code-block button{min-height:32px;color:var(--code-muted);cursor:pointer;white-space:nowrap;background:0 0;border:0;border-radius:0;justify-content:center;align-items:center;gap:6px;padding:4px 6px;font:500 10px -apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;display:inline-flex}.joy-code-block button:hover{color:var(--code-ink);text-underline-offset:4px;text-decoration:underline}.joy-code-block .joy-code-copy{flex:none;margin-left:auto}.joy-code-block .joy-code-copy>span{text-align:left;min-width:36px}.joy-code-block .joy-code-copy svg{flex:none;width:13px;height:13px}.joy-code-block :is(button,pre):focus-visible{outline:2px solid var(--code-accent);outline-offset:-3px}.joy-code-block .joy-code-tabs{flex:1;min-width:0}.joy-code-block [role=tablist]{flex-wrap:wrap;gap:2px;display:flex}.joy-code-block button[role=tab]{text-transform:uppercase;letter-spacing:.06em;border-bottom:2px solid #0000;border-radius:0;min-height:42px;padding-inline:8px;font-weight:700}.joy-code-block button[aria-selected=true]{border-bottom-color:var(--code-accent);color:var(--code-ink)}.joy-code-block .joy-code-pre{min-width:0;max-width:100%;color:var(--code-ink);text-align:left;white-space:pre;overflow-wrap:normal;font-variant-ligatures:none;tab-size:2;-webkit-overflow-scrolling:touch;background:0 0;border:0;border-radius:0;margin:0;padding:18px;font:11.5px/1.85 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;display:block;overflow:auto}.joy-code-block code{font:inherit;color:inherit;background:0 0;padding:0}.joy-code-block .sh__line{display:inline}.joy-code-block .sh__token--comment{font-style:italic}.joy-code-block[data-wrap] .joy-code-pre{white-space:pre-wrap;overflow-wrap:anywhere}.joy-code-block[data-compact] .joy-code-header{min-height:35px;padding-inline:10px}.joy-code-block[data-compact] .joy-code-pre{padding:12px;font-size:10.5px;line-height:1.75}.joy-code-block .joy-code-status{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}.joy-code-block .joy-code-status[data-error]{clip-path:none;width:auto;height:auto;color:var(--code-accent);padding:10px 14px;font-size:11px;display:block;position:static}@media (width<=480px){.joy-code-block .joy-code-header{gap:6px;padding-inline:9px}.joy-code-block .joy-code-language{display:none}.joy-code-block .joy-code-pre{padding:14px;font-size:11px}.joy-code-block button[role=tab]{padding-inline:5px;font-size:9px}}.jr-showcase{--jr-slot:164px;--jr-ink:var(--drive-ink,#242521);--jr-muted:var(--drive-muted,#777a72);--jr-line:var(--drive-line,#d7d9d0);--jr-accent:var(--drive-accent,#df342a);min-width:0;color:var(--jr-ink);font-family:inherit;position:relative}.jr-showcase *,.jr-showcase :before,.jr-showcase :after{box-sizing:border-box}.jr-showcase-header{letter-spacing:.02em;justify-content:space-between;align-items:center;gap:16px;min-height:38px;font-size:11px;display:flex}.jr-showcase-count{color:var(--jr-muted);margin-left:9px;font:10px monospace}.jr-showcase-hint{color:var(--jr-muted);font-size:10px}.jr-showcase-hint>span{margin-left:8px}.jr-showcase-stage{height:182px;position:relative}.jr-showcase-spawn{pointer-events:none;width:1px;height:1px;position:absolute;top:50%;left:50%}.jr-showcase-parking-spot{pointer-events:none;place-items:center;display:grid;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(-45deg)}.jr-showcase-parking-spot>span{font:550 28px/1 sans-serif;transform:rotate(45deg)}.jr-showcase[data-driving=true] .jr-showcase-center>span{opacity:0}.jr-showcase-center{background:radial-gradient(ellipse, color-mix(in srgb, var(--jr-accent) 7%, transparent), transparent 70%);pointer-events:none;border-radius:50%;width:148px;position:absolute;top:12px;bottom:8px;left:50%;transform:translate(-50%)}.jr-showcase-center>span{background:var(--jr-accent);border-radius:50%;width:6px;height:6px;position:absolute;bottom:0;left:calc(50% - 3px)}.jr-showcase-scroll{height:100%;padding-inline:calc(50% - var(--jr-slot) / 2);scroll-padding-inline:calc(50% - var(--jr-slot) / 2);scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none;touch-action:pan-x pan-y;align-items:center;display:flex;position:relative;overflow:auto hidden;-webkit-mask-image:linear-gradient(90deg,#0000,#000 9% 91%,#0000);mask-image:linear-gradient(90deg,#0000,#000 9% 91%,#0000)}.jr-showcase-scroll::-webkit-scrollbar{display:none}.jr-showcase-scroll:focus-visible{outline:1px solid var(--jr-accent);outline-offset:-2px}.jr-showcase-slot{flex:0 0 var(--jr-slot);scroll-snap-align:center;cursor:pointer;height:100%;opacity:var(--presence,.6);position:relative}.jr-showcase-bay{border-inline:1px solid var(--jr-line);opacity:.5;pointer-events:none;width:88px;height:135px;transition:opacity .3s;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(45deg)}.jr-showcase-slot[aria-selected=true] .jr-showcase-bay{opacity:.9}.jr-showcase-sprite{transform:translate(-50%, -50%) scale(var(--car-scale,.85));pointer-events:none;transition:opacity .36s;position:absolute;top:50%;left:50%}.jr-showcase-car{filter:drop-shadow(-1px 4px 3px #14171138);display:block;transform:rotate(-45deg)}.jr-showcase-footer{border-bottom:1px solid var(--jr-line);justify-content:space-between;align-items:center;gap:24px;min-height:84px;padding:12px 0 17px;display:flex}.jr-showcase-footer>div:first-child{min-width:0}.jr-showcase-eyebrow{color:var(--jr-muted);text-transform:uppercase;letter-spacing:.09em;margin-bottom:7px;font:9px/1.3 monospace;display:block}.jr-showcase-footer strong{letter-spacing:-.035em;font-size:clamp(17px,2vw,23px);font-weight:550;line-height:1.15;display:block}.jr-showcase-meta{color:var(--jr-muted);max-width:560px;margin-top:7px;font-size:11px;line-height:1.5;display:block}.jr-showcase-navigation{flex-shrink:0;align-items:center;gap:16px;display:flex}.jr-showcase-navigation>span{font:10px monospace}.jr-showcase-navigation>span>span{color:var(--jr-muted)}.jr-showcase button{font:inherit;color:inherit;cursor:pointer}.jr-showcase-navigation button{border:1px solid var(--jr-line);background:0 0;border-radius:50%;place-items:center;width:32px;height:32px;display:grid}.jr-showcase-navigation button:disabled{opacity:.25;cursor:default}.jr-showcase button:focus-visible{outline:2px solid var(--jr-accent);outline-offset:3px}.jr-showcase[data-driving=true] .jr-showcase-slot[aria-selected=true] .jr-showcase-sprite{opacity:0;transition:none}@media (width<=600px){.jr-showcase{--jr-slot:108px}.jr-showcase-stage{height:168px}.jr-showcase-bay{width:72px;height:116px}.jr-showcase-footer{gap:12px}.jr-showcase-meta{font-size:10px}.jr-showcase-navigation{gap:9px}}@media (prefers-reduced-motion:reduce){.jr-showcase-sprite,.jr-showcase-bay,.jr-showcase-parking-spot{transition:none}}