├── .changeset
├── README.md
└── config.json
├── .editorconfig
├── .github
├── dependabot.yml
└── workflows
│ └── release.yml
├── .gitignore
├── .yarn
└── releases
│ └── yarn-4.0.2.cjs
├── .yarnrc.yml
├── LICENSE
├── README.md
├── apps
└── benchmarks
│ ├── .gitignore
│ ├── .prettierrc
│ ├── README.md
│ ├── index.html
│ ├── package.json
│ └── src
│ ├── arancini.js
│ ├── index.js
│ ├── run-benchmarks.js
│ └── suites
│ ├── add-remove.js
│ ├── addition.js
│ ├── destroy.js
│ └── velocity.js
├── package.json
├── packages
├── arancini-core
│ ├── .eslintrc
│ ├── .gitignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── rollup.config.js
│ ├── src
│ │ ├── entity-collection.ts
│ │ ├── index.ts
│ │ ├── query.ts
│ │ ├── topic.ts
│ │ └── world.ts
│ ├── tsconfig.json
│ └── tst
│ │ ├── topic.spec.ts
│ │ └── world.spec.ts
├── arancini-react
│ ├── .eslintrc
│ ├── .gitignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── rollup.config.js
│ ├── src
│ │ ├── hooks.ts
│ │ └── index.tsx
│ ├── tsconfig.json
│ ├── tst
│ │ ├── index.spec.tsx
│ │ └── setup.ts
│ └── vite.config.ts
└── arancini
│ ├── .eslintrc
│ ├── .gitignore
│ ├── .prettierrc
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── cover.png
│ ├── package.json
│ ├── rollup.config.js
│ ├── src
│ ├── index.ts
│ └── react.ts
│ ├── storybook-static
│ ├── assets
│ │ ├── Bounds-a89dda79.js
│ │ ├── Color-6VNJS4EI-e80a34cc.js
│ │ ├── DocsRenderer-NNNQARDV-a9823a9d.js
│ │ ├── WithTooltip-V3YHNWJZ-cc53982d.js
│ │ ├── _commonjsHelpers-de833af9.js
│ │ ├── _getPrototype-1e53b583.js
│ │ ├── client-8a8da4b9.js
│ │ ├── entry-preview-68bf576c.js
│ │ ├── entry-preview-docs-c7c6facc.js
│ │ ├── existing-world.stories-eb8727d7.js
│ │ ├── extends-98964cd2.js
│ │ ├── external-physics-library.stories-b887c252.js
│ │ ├── find-the-bomb.stories-51e9b26e.css
│ │ ├── find-the-bomb.stories-e4ae4ff2.js
│ │ ├── formatter-SWP5E3XI-959451e4.js
│ │ ├── iframe-45bb0dfa.js
│ │ ├── index-11d98b33.js
│ │ ├── index-356e4a49.js
│ │ ├── index-3fd0d1ea.js
│ │ ├── index-76fb7be0.js
│ │ ├── index.es-6456b573.js
│ │ ├── overlapping-circles.stories-e038c80f.js
│ │ ├── pong.stories-86c4837c.js
│ │ ├── preview-0ef86afd.js
│ │ ├── preview-21802b0a.js
│ │ ├── preview-30b54f76.js
│ │ ├── preview-3964b600.js
│ │ ├── preview-43d83ba8.js
│ │ ├── preview-632f5ece.css
│ │ ├── preview-73104b77.js
│ │ ├── preview-c2aa3ab7.js
│ │ ├── preview-c56bf6ac.js
│ │ ├── preview-da31036b.js
│ │ ├── random-walkers.stories-bef084b1.js
│ │ ├── random-walkers.stories-fcd817f3.js
│ │ ├── react-18-ce37f4e2.js
│ │ ├── react-three-fiber.esm-dca5276d.js
│ │ ├── selection.stories-7431ac8e.js
│ │ ├── setup-1d901612.js
│ │ ├── syntaxhighlighter-V7JZZA35-2abe4516.js
│ │ └── timeline-composer.esm-08db1a3e.js
│ ├── favicon.svg
│ ├── iframe.html
│ ├── index.html
│ ├── index.json
│ ├── project.json
│ ├── sb-addons
│ │ ├── essentials-actions-2
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── essentials-backgrounds-3
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── essentials-controls-1
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── essentials-measure-6
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── essentials-outline-7
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── essentials-toolbars-5
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── essentials-viewport-4
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── interactions-9
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ ├── links-0
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ │ └── onboarding-8
│ │ │ ├── manager-bundle.js
│ │ │ └── manager-bundle.js.LEGAL.txt
│ ├── sb-common-assets
│ │ ├── fonts.css
│ │ ├── nunito-sans-bold-italic.woff2
│ │ ├── nunito-sans-bold.woff2
│ │ ├── nunito-sans-italic.woff2
│ │ └── nunito-sans-regular.woff2
│ ├── sb-manager
│ │ ├── WithTooltip-V3YHNWJZ-LVYLGZW2.js
│ │ ├── chunk-2IXBUOFS.js
│ │ ├── chunk-INSKDKQB.js
│ │ ├── chunk-MF5WFFGF.js
│ │ ├── chunk-NGTUFCUO.js
│ │ ├── chunk-ZEU7PDD3.js
│ │ ├── formatter-SWP5E3XI-7BGIK6BL.js
│ │ ├── globals-module-info.js
│ │ ├── globals.js
│ │ ├── runtime.js
│ │ └── syntaxhighlighter-V7JZZA35-DXZCI2WR.js
│ ├── sb-preview
│ │ ├── globals.js
│ │ └── runtime.js
│ └── stories.json
│ └── tsconfig.json
└── yarn.lock
/.changeset/README.md:
--------------------------------------------------------------------------------
1 | # Changesets
2 |
3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4 | with multi-package repos, or single-package repos to help you version and publish your code. You can
5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6 |
7 | We have a quick list of common questions to get you started engaging with this project in
8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
9 |
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [["arancini", "@arancini/*"]],
6 | "linked": [],
7 | "access": "public",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": ["benchmarks"],
11 | "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
12 | "onlyUpdatePeerDependentsWhenOutOfRange": true
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 |
7 | [*.{js,json,yml}]
8 | charset = utf-8
9 | indent_style = space
10 | indent_size = 2
11 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "npm" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | concurrency: ${{ github.workflow }}-${{ github.ref }}
9 |
10 | jobs:
11 | release:
12 | name: Release
13 | if: github.repository_owner == 'isaac-mason'
14 | runs-on: ubuntu-latest
15 | steps:
16 | - name: Checkout Repo
17 | uses: actions/checkout@v2
18 |
19 | - name: Setup Node.js 20.x
20 | uses: actions/setup-node@v2
21 | with:
22 | node-version: 20.x
23 |
24 | - name: Install Dependencies
25 | run: yarn
26 |
27 | - name: Create Release Pull Request or Publish to npm
28 | id: changesets
29 | uses: changesets/action@v1
30 | with:
31 | version: yarn bump
32 | publish: yarn release
33 | commit: "chore(changeset): release packages"
34 | env:
35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .yarn/*
2 | !.yarn/patches
3 | !.yarn/plugins
4 | !.yarn/releases
5 | !.yarn/sdks
6 | !.yarn/versions
7 | .pnp.*
8 | node_modules
--------------------------------------------------------------------------------
/.yarnrc.yml:
--------------------------------------------------------------------------------
1 | compressionLevel: mixed
2 |
3 | enableGlobalCache: false
4 |
5 | nodeLinker: node-modules
6 |
7 | yarnPath: .yarn/releases/yarn-4.0.2.cjs
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright © 2023 Isaac Mason
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | packages/arancini/README.md
--------------------------------------------------------------------------------
/apps/benchmarks/.gitignore:
--------------------------------------------------------------------------------
1 | dist
--------------------------------------------------------------------------------
/apps/benchmarks/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5",
3 | "tabWidth": 2,
4 | "semi": false,
5 | "singleQuote": true
6 | }
7 |
--------------------------------------------------------------------------------
/apps/benchmarks/README.md:
--------------------------------------------------------------------------------
1 | # benchmarks
2 |
3 | Benchmarks, taken from: https://github.com/ddmills/js-ecs-benchmarks
4 |
5 | Intending to merge benchmarks in once lib is stable.
--------------------------------------------------------------------------------
/apps/benchmarks/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | arancini benchmarks
8 |
9 |
10 | arancini benchmarks
11 |
12 |
13 |
14 |
32 |
33 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/apps/benchmarks/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "benchmarks",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "bench": "node src/index.js",
8 | "dev": "vite",
9 | "build": "vite build",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "arancini": "workspace:^"
14 | },
15 | "devDependencies": {
16 | "prettier": "^3.2.5",
17 | "vite": "^5.0.13"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/arancini.js:
--------------------------------------------------------------------------------
1 | import { World } from '@arancini/core'
2 |
3 | let updateCount = 0
4 |
5 | export const arancini = {
6 | setup() {
7 | this.world = new World()
8 |
9 | this.query = this.world.query((e) => e.has('position', 'velocity'))
10 |
11 | this.movementSystem = () => {
12 | for (let i = 0; i < this.query.entities.length; i++) {
13 | const { position, velocity } = this.query.entities[i]
14 |
15 | position.x += velocity.x
16 | position.y += velocity.y
17 | position.z += velocity.z
18 |
19 | updateCount++
20 | }
21 | }
22 |
23 | updateCount = 0
24 | },
25 | createEntity() {
26 | const entity = {}
27 | this.world.create(entity)
28 | return entity
29 | },
30 | addPositionComponent(entity) {
31 | this.world.add(entity, 'position', { x: 0, y: 0, z: 0 })
32 | },
33 | addVelocityComponent(entity) {
34 | this.world.add(entity, 'velocity', {
35 | dx: Math.random() - 0.5,
36 | dy: Math.random() - 0.5,
37 | dz: Math.random() - 0.5,
38 | })
39 | },
40 | removePositionComponent(entity) {
41 | this.world.remove(entity, 'position')
42 | },
43 | removeVelocityComponent(entity) {
44 | this.world.remove(entity, 'velocity')
45 | },
46 | destroyEntity(entity) {
47 | this.world.destroy(entity)
48 | },
49 | cleanup() {
50 | this.world.clear()
51 | },
52 | updateMovementSystem() {
53 | this.movementSystem()
54 | },
55 | getMovementSystemUpdateCount() {
56 | return updateCount
57 | },
58 | }
59 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/index.js:
--------------------------------------------------------------------------------
1 | import { hrtime } from 'process'
2 | import { runBenchmarks } from './run-benchmarks.js'
3 |
4 | const nowInMicroSeconds = () => {
5 | const hr = hrtime()
6 | return (hr[0] * 1e9 + hr[1]) / 1000
7 | }
8 |
9 | runBenchmarks(nowInMicroSeconds, console.log)
10 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/run-benchmarks.js:
--------------------------------------------------------------------------------
1 | import { arancini } from './arancini.js'
2 | import { addRemove } from './suites/add-remove.js'
3 | import { addition } from './suites/addition.js'
4 | import { destroy } from './suites/destroy.js'
5 | import { velocity } from './suites/velocity.js'
6 |
7 | /**
8 | * Runs benchmarks
9 | * @param {*} now function that returns the current time in micro seconds
10 | */
11 | export const runBenchmarks = (now, log) => {
12 | const bench = (suite) => {
13 | suite.setup(arancini)
14 |
15 | let sum = 0
16 |
17 | for (let i = 0; i < suite.iterations; i++) {
18 | const start = now()
19 |
20 | suite.perform(arancini)
21 |
22 | sum += now() - start
23 | }
24 |
25 | arancini.cleanup()
26 |
27 | const average = sum / suite.iterations
28 | const updates = arancini.getMovementSystemUpdateCount()
29 |
30 | const nameTxt = suite.name.padEnd(12, ' ')
31 | const sumText = `${sum.toFixed(6)}`.padStart(20, ' ') + ' micro seconds'
32 | const averageText =
33 | `${average.toFixed(6)}`.padStart(20 + ' ') + ' micro seconds'
34 | const updateText = updates > 0 ? `${updates} updates`.padStart(20) : ''
35 |
36 | log(`${nameTxt} ${averageText} ${sumText} ${updateText}`)
37 | }
38 |
39 | log('running benchmarks...\n')
40 |
41 | const suites = [addRemove, addition, destroy, velocity]
42 |
43 | suites.forEach((suite) => {
44 | bench(suite)
45 | })
46 | }
47 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/suites/add-remove.js:
--------------------------------------------------------------------------------
1 | export const addRemove = {
2 | name: 'Add/Remove',
3 | iterations: 5000,
4 | setup(ctx) {
5 | ctx.setup()
6 | },
7 | perform(ctx) {
8 | const entity1 = ctx.createEntity()
9 | const entity2 = ctx.createEntity()
10 |
11 | ctx.addPositionComponent(entity1)
12 | ctx.addVelocityComponent(entity1)
13 |
14 | ctx.addPositionComponent(entity2)
15 | ctx.addVelocityComponent(entity2)
16 |
17 | ctx.updateMovementSystem()
18 |
19 | ctx.removePositionComponent(entity1)
20 |
21 | ctx.updateMovementSystem()
22 |
23 | ctx.destroyEntity(entity1)
24 | },
25 | }
26 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/suites/addition.js:
--------------------------------------------------------------------------------
1 | export const addition = {
2 | name: 'Addition',
3 | iterations: 100000,
4 | setup(ctx) {
5 | ctx.setup()
6 | },
7 | perform(ctx) {
8 | const entity = ctx.createEntity()
9 |
10 | ctx.addPositionComponent(entity)
11 | ctx.addVelocityComponent(entity)
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/suites/destroy.js:
--------------------------------------------------------------------------------
1 | export const destroy = {
2 | name: 'Destroy',
3 | iterations: 100000,
4 | setup(ctx) {
5 | ctx.setup()
6 | },
7 | perform(ctx) {
8 | const entity = ctx.createEntity()
9 |
10 | ctx.addPositionComponent(entity)
11 | ctx.addVelocityComponent(entity)
12 |
13 | ctx.destroyEntity(entity)
14 | },
15 | }
16 |
--------------------------------------------------------------------------------
/apps/benchmarks/src/suites/velocity.js:
--------------------------------------------------------------------------------
1 | export const velocity = {
2 | name: 'Velocity',
3 | iterations: 2000,
4 | setup(ctx) {
5 | ctx.setup()
6 | },
7 | perform(ctx) {
8 | const entity = ctx.createEntity()
9 |
10 | ctx.addPositionComponent(entity)
11 | ctx.addVelocityComponent(entity)
12 |
13 | ctx.updateMovementSystem()
14 | },
15 | }
16 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "root",
3 | "private": true,
4 | "packageManager": "yarn@4.0.2",
5 | "workspaces": [
6 | "packages/*",
7 | "apps/*"
8 | ],
9 | "scripts": {
10 | "build": "yarn workspaces foreach -A -t run build",
11 | "test": "yarn workspaces foreach -A -t run test",
12 | "lint": "yarn workspaces foreach -A -t run lint",
13 | "change": "yarn changeset",
14 | "bump": "yarn changeset version && yarn install --mode update-lockfile",
15 | "release": "yarn build && yarn test && changeset publish"
16 | },
17 | "devDependencies": {
18 | "@changesets/cli": "^2.26.1",
19 | "concurrently": "^8.2.1"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/packages/arancini-core/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@isaac-mason/eslint-config-typescript"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/arancini-core/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
26 | # jest coverage
27 | coverage
28 |
29 | storybook-static
--------------------------------------------------------------------------------
/packages/arancini-core/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5",
3 | "tabWidth": 2,
4 | "semi": false,
5 | "singleQuote": true
6 | }
7 |
--------------------------------------------------------------------------------
/packages/arancini-core/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright © 2023 Isaac Mason
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/arancini-core/README.md:
--------------------------------------------------------------------------------
1 | # @arancini/core
2 |
3 | Arancini core functionality.
4 |
5 | See the [**arancini** README](https://github.com/isaac-mason/arancini/tree/main/packages/arancini) for more information.
--------------------------------------------------------------------------------
/packages/arancini-core/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@arancini/core",
3 | "description": "An object based Entity Component System",
4 | "keywords": [
5 | "gamedev",
6 | "ecs",
7 | "entity-component-system"
8 | ],
9 | "author": "Isaac Mason ",
10 | "license": "MIT",
11 | "version": "8.0.0",
12 | "homepage": "https://github.com/isaac-mason/arancini",
13 | "bugs": {
14 | "url": "https://github.com/isaac-mason/arancini/issues"
15 | },
16 | "scripts": {
17 | "test": "tsc && vitest run --coverage",
18 | "test:watch": "vitest",
19 | "lint": "eslint --ext .ts src",
20 | "build": "yarn build:before && rollup --config rollup.config.js --bundleConfigAsCjs",
21 | "build:before": "rm -rf dist"
22 | },
23 | "devDependencies": {
24 | "@babel/core": "^7.24.5",
25 | "@babel/preset-env": "^7.24.5",
26 | "@babel/preset-typescript": "^7.24.1",
27 | "@isaac-mason/eslint-config-typescript": "^0.0.5",
28 | "@rollup/plugin-babel": "^6.0.4",
29 | "@rollup/plugin-node-resolve": "^15.0.1",
30 | "@rollup/plugin-typescript": "^11.1.6",
31 | "@vitest/coverage-v8": "^2.1.8",
32 | "eslint": "^8.56.0",
33 | "prettier": "^3.2.5",
34 | "rollup": "^4.22.4",
35 | "rollup-plugin-copy": "^3.5.0",
36 | "rollup-plugin-filesize": "^10.0.0",
37 | "typescript": "^5.3.3",
38 | "vitest": "^2.1.8"
39 | },
40 | "files": [
41 | "dist",
42 | "LICENSE",
43 | "README.md"
44 | ],
45 | "type": "module",
46 | "main": "dist/index.mjs",
47 | "types": "dist/index.d.ts"
48 | }
49 |
--------------------------------------------------------------------------------
/packages/arancini-core/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from '@rollup/plugin-babel'
2 | import { nodeResolve } from '@rollup/plugin-node-resolve'
3 | import typescript from '@rollup/plugin-typescript'
4 | import path from 'path'
5 | import filesize from 'rollup-plugin-filesize'
6 |
7 | const babelOptions = {
8 | babelrc: false,
9 | extensions: ['.ts'],
10 | exclude: '**/node_modules/**',
11 | babelHelpers: 'bundled',
12 | presets: [
13 | [
14 | '@babel/preset-env',
15 | {
16 | loose: true,
17 | modules: false,
18 | targets: '>1%, not dead, not ie 11, not op_mini all',
19 | },
20 | ],
21 | '@babel/preset-typescript',
22 | ],
23 | }
24 |
25 | export default [
26 | {
27 | input: `./src/index.ts`,
28 | output: [
29 | {
30 | file: `dist/index.mjs`,
31 | format: 'es',
32 | sourcemap: true,
33 | exports: 'named',
34 | },
35 | ],
36 | plugins: [
37 | nodeResolve(),
38 | typescript({
39 | tsconfig: path.resolve(__dirname, `tsconfig.json`),
40 | emitDeclarationOnly: true,
41 | }),
42 | babel(babelOptions),
43 | filesize(),
44 | ],
45 | },
46 | ]
47 |
--------------------------------------------------------------------------------
/packages/arancini-core/src/entity-collection.ts:
--------------------------------------------------------------------------------
1 | import { Topic } from './topic'
2 | import type { AnyEntity } from './world'
3 |
4 | export class EntityCollection {
5 | entities: Entity[] = []
6 |
7 | version = 0
8 |
9 | onEntityAdded = new Topic<[entity: Entity]>()
10 |
11 | onEntityRemoved = new Topic<[entity: Entity]>()
12 |
13 | /** @ignore */
14 | _entityPositions = new Map()
15 |
16 | get first(): Entity | undefined {
17 | return this.entities[0]
18 | }
19 |
20 | get size() {
21 | return this.entities.length
22 | }
23 |
24 | [Symbol.iterator]() {
25 | let index = this.entities.length
26 |
27 | const result: {
28 | value: Entity
29 | done: boolean
30 | } = {
31 | value: undefined!,
32 | done: false,
33 | }
34 |
35 | return {
36 | next: () => {
37 | result.value = this.entities[--index]
38 | result.done = index < 0
39 | return result
40 | },
41 | }
42 | }
43 |
44 | has(entity: Entity): boolean {
45 | return this._entityPositions.has(entity)
46 | }
47 | }
48 |
49 | export const addToCollection = (
50 | collection: EntityCollection,
51 | entity: E
52 | ): void => {
53 | // assumes the entity is not already in the collection
54 |
55 | collection.entities.push(entity)
56 | collection._entityPositions.set(entity, collection.entities.length - 1)
57 |
58 | collection.version++
59 |
60 | collection.onEntityAdded.emit(entity)
61 | }
62 |
63 | export const removeFromCollection = (
64 | collection: EntityCollection,
65 | entity: E
66 | ): void => {
67 | // assumes the entity is in the collection
68 |
69 | const index = collection._entityPositions.get(entity)!
70 | collection._entityPositions.delete(entity)
71 |
72 | const other = collection.entities[collection.entities.length - 1]
73 | if (other !== entity) {
74 | collection.entities[index] = other
75 | collection._entityPositions.set(other, index)
76 | }
77 | collection.entities.pop()
78 |
79 | collection.version++
80 |
81 | collection.onEntityRemoved.emit(entity)
82 | }
83 |
--------------------------------------------------------------------------------
/packages/arancini-core/src/index.ts:
--------------------------------------------------------------------------------
1 | export { EntityCollection as EntityContainer } from './entity-collection'
2 | export {
3 | Query,
4 | QueryBuilder,
5 | type QueryConditions,
6 | type QueryFn,
7 | type With,
8 | type Without,
9 | } from './query'
10 | export { Topic } from './topic'
11 | export { World, type AnyEntity } from './world'
12 |
--------------------------------------------------------------------------------
/packages/arancini-core/src/query.ts:
--------------------------------------------------------------------------------
1 | import { EntityCollection } from './entity-collection'
2 |
3 | export type With = T & Required>
4 |
5 | export type Without = Pick> &
6 | Partial>
7 |
8 | export type Strict = WithoutOptionalProperties
9 |
10 | type OptionalProperties = {
11 | [P in keyof T]-?: undefined extends T[P] ? P : never
12 | }
13 |
14 | type WithoutOptionalProperties = Pick<
15 | T,
16 | Exclude[keyof T]>
17 | >
18 |
19 | export type QueryConditionType = 'all' | 'any' | 'not'
20 |
21 | export type QueryCondition = {
22 | type: QueryConditionType
23 | components: (keyof Entity)[]
24 | }
25 |
26 | export type QueryConditions = QueryCondition[]
27 |
28 | export type QueryFn = (
29 | q: QueryBuilder
30 | ) => QueryBuilder
31 |
32 | export class Query extends EntityCollection {
33 | references = new Set()
34 |
35 | constructor(
36 | public dedupe: string,
37 | public conditions: QueryConditions,
38 | ) {
39 | super()
40 | }
41 | }
42 |
43 | export const prepareQuery = (
44 | queryFn: QueryFn
45 | ): { conditions: QueryConditions; dedupe: string } => {
46 | /* evaluate queryFn */
47 | const queryBuilder = new QueryBuilder()
48 | queryFn(queryBuilder)
49 | const queryBuilderConditions = queryBuilder.conditions
50 |
51 | /* validate conditions */
52 | if (queryBuilderConditions.length <= 0) {
53 | throw new Error('Query must have at least one condition')
54 | }
55 |
56 | if (queryBuilderConditions.some((condition) => condition.components.length <= 0)) {
57 | throw new Error('Query conditions must have at least one component')
58 | }
59 |
60 | /* normalize conditions */
61 | const normalisedConditions: QueryConditions = []
62 |
63 | const combinedAllCondition: QueryCondition = { type: 'all', components: [] }
64 | const combinedNotCondition: QueryCondition = { type: 'not', components: [] }
65 |
66 | for (const condition of queryBuilderConditions) {
67 | if (condition.type === 'all') {
68 | combinedAllCondition.components.push(...condition.components)
69 | } else if (condition.type === 'not') {
70 | combinedNotCondition.components.push(...condition.components)
71 | } else {
72 | normalisedConditions.push(condition)
73 | }
74 | }
75 |
76 | if (combinedAllCondition.components.length > 0) {
77 | normalisedConditions.push(combinedAllCondition)
78 | }
79 | if (combinedNotCondition.components.length > 0) {
80 | normalisedConditions.push(combinedNotCondition)
81 | }
82 |
83 | /* create query dedupe string */
84 | const dedupe = normalisedConditions
85 | .map(({ type, components }) => {
86 | return `${type}(${components.sort().join(', ')})`
87 | })
88 | .sort()
89 | .join(' && ')
90 |
91 | return {
92 | conditions: normalisedConditions,
93 | dedupe,
94 | }
95 | }
96 |
97 | export const evaluateQueryConditions = (
98 | conditions: QueryConditions,
99 | entity: Entity
100 | ): boolean => {
101 | for (let c = 0; c < conditions.length; c++) {
102 | const condition = conditions[c]
103 |
104 | if (
105 | (condition.type === 'all' &&
106 | !condition.components.every((c) => entity[c] !== undefined)) ||
107 | (condition.type === 'any' &&
108 | !condition.components.some((c) => entity[c] !== undefined)) ||
109 | (condition.type === 'not' &&
110 | condition.components.some((c) => entity[c] !== undefined))
111 | ) {
112 | return false
113 | }
114 | }
115 |
116 | return true
117 | }
118 |
119 | export class QueryBuilder {
120 | T!: Entity
121 |
122 | conditions: QueryConditions = []
123 |
124 | /* conditions */
125 | all = (...components: C[]) => {
126 | this.conditions.push({ type: 'all', components })
127 | return this as unknown as QueryBuilder>
128 | }
129 |
130 | any = (...components: C[]): QueryBuilder => {
131 | this.conditions.push({ type: 'any', components })
132 | return this
133 | }
134 |
135 | not = (...components: C[]) => {
136 | this.conditions.push({ type: 'not', components })
137 | return this as unknown as QueryBuilder>
138 | }
139 |
140 | /* condition aliases */
141 | with = this.all
142 | have = this.all
143 | has = this.all
144 | every = this.all
145 | is = this.all
146 |
147 | some = this.any
148 | one = this.any
149 |
150 | none = this.not
151 | without = this.not
152 |
153 | /* no-op grammar */
154 | get and() {
155 | return this
156 | }
157 |
158 | get but() {
159 | return this
160 | }
161 |
162 | get where() {
163 | return this
164 | }
165 |
166 | get are() {
167 | return this
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/packages/arancini-core/src/topic.ts:
--------------------------------------------------------------------------------
1 | export type Listener = (...data: T) => void
2 |
3 | export type Unsubscribe = () => void
4 |
5 | export class Topic {
6 | listeners: Set<(...data: T) => void> = new Set()
7 |
8 | add(handler: Listener): Unsubscribe {
9 | this.listeners.add(handler)
10 |
11 | return () => this.remove(handler)
12 | }
13 |
14 | remove(handler: Listener): void {
15 | this.listeners.delete(handler)
16 | }
17 |
18 | emit(...data: T): void {
19 | for (const handler of this.listeners) {
20 | handler(...data)
21 | }
22 | }
23 |
24 | clear(): void {
25 | this.listeners.clear()
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/packages/arancini-core/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2022",
4 | "useDefineForClassFields": true,
5 | "module": "ES2022",
6 | "lib": ["ES2022", "DOM"],
7 | "moduleResolution": "Node",
8 | "strict": true,
9 | "resolveJsonModule": true,
10 | "isolatedModules": true,
11 | "esModuleInterop": true,
12 | "noUnusedLocals": true,
13 | "noUnusedParameters": true,
14 | "noImplicitReturns": true,
15 | "skipLibCheck": true,
16 | "baseUrl": "./",
17 | "rootDir": "./src",
18 | "allowSyntheticDefaultImports": true,
19 | "noEmit": true,
20 | "declaration": true,
21 | "outDir": "./dist",
22 | "experimentalDecorators": true,
23 | },
24 | "files": ["./src/index.ts"]
25 | }
26 |
--------------------------------------------------------------------------------
/packages/arancini-core/tst/topic.spec.ts:
--------------------------------------------------------------------------------
1 | import { describe, expect, test, vi } from 'vitest'
2 | import { Topic } from '../src'
3 |
4 | describe('Topic', () => {
5 | test('should emit events to listeners', () => {
6 | const topic = new Topic()
7 | const listenerOne = vi.fn()
8 | const listenerTwo = vi.fn()
9 |
10 | topic.add(listenerOne)
11 | topic.add(listenerTwo)
12 |
13 | topic.emit('1')
14 |
15 | expect(listenerOne).toHaveBeenCalledWith('1')
16 | expect(listenerTwo).toHaveBeenCalledWith('1')
17 |
18 | topic.remove(listenerTwo)
19 |
20 | topic.emit('2')
21 |
22 | expect(listenerOne).toHaveBeenCalledWith('2')
23 | expect(listenerTwo).not.toHaveBeenCalledWith('2')
24 |
25 | topic.clear()
26 |
27 | topic.emit('3')
28 |
29 | expect(listenerOne).not.toHaveBeenCalledWith('3')
30 | expect(listenerTwo).not.toHaveBeenCalledWith('3')
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/packages/arancini-react/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@isaac-mason/eslint-config-typescript"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/arancini-react/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
26 | storybook-static
27 | coverage
28 |
--------------------------------------------------------------------------------
/packages/arancini-react/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5",
3 | "tabWidth": 2,
4 | "semi": false,
5 | "singleQuote": true
6 | }
7 |
--------------------------------------------------------------------------------
/packages/arancini-react/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright © 2023 Isaac Mason
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/arancini-react/README.md:
--------------------------------------------------------------------------------
1 | # @arancini/react
2 |
3 | React glue for the [arancini](https://github.com/isaac-mason/arancini/tree/main/packages/arancini) Entity Component System.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | > npm install @arancini/react
9 | ```
10 |
11 | ## Creating the React glue
12 |
13 | To get started, use `createReactAPI` to get glue components and hooks scoped to a given arancini world. Because the react glue is scoped, libraries can use @arancini/react without worrying about context conflicts.
14 |
15 | ```ts
16 | import { World } from '@arancini/core'
17 | import { createReactAPI } from '@arancini/react'
18 |
19 | type EntityType = {
20 | health?: number
21 | position?: [number, number]
22 | }
23 |
24 | const world = new World()
25 |
26 | const { Entity, Entities, Component, useQuery } = createReactAPI(world)
27 | ```
28 |
29 | ## Entities and Components
30 |
31 | `` can be used to declaratively create entities with components.
32 |
33 | ```tsx
34 | const Example = () =>
35 | ```
36 |
37 | You can also pass an existing entity to ``.
38 |
39 | ```tsx
40 | const entity = world.create({ position: [0, 0] })
41 |
42 | const Example = () =>
43 | ```
44 |
45 | `` can be used to add components to an entity.
46 |
47 | ```tsx
48 | const Example = () => (
49 |
50 |
51 |
52 | )
53 | ```
54 |
55 | ### Capturing React Component refs
56 |
57 | If a child is passed to `Component`, it will be captured and used as the value of the component. This is useful for keeping your logic decoupled from React.
58 |
59 | ```tsx
60 | const RefCaptureExample = () => (
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | )
70 | ```
71 |
72 | ### Rendering multiple entities
73 |
74 | `@arancini/react` also provides an `` component that can be used to render a collection of entities or add components to existing entities. `` also supports [render props](https://reactjs.org/docs/render-props.html).
75 |
76 | ```tsx
77 | const Simple = () => {/* ... */}
78 |
79 | const AddComponentToEntities = () => (
80 |
81 |
82 |
83 | )
84 |
85 | const RenderProps = () => (
86 |
87 | {(entity) => {
88 | // ...
89 | }}
90 |
91 | )
92 | ```
93 |
94 | `Entities` can also be passed a query.
95 |
96 | ```tsx
97 | const withExampleTag = world.query((e) => e.with('exampleTag'))
98 |
99 | const SimpleExample = () => (
100 |
101 |
102 |
103 |
104 |
105 |
106 | )
107 | ```
108 |
109 | ## Queries
110 |
111 | ### `useQuery`
112 |
113 | The `useQuery` hook subscribes a component to a query, re-rendering the component when entities are added to or removed from the query.
114 |
115 | ```tsx
116 | const withHealth = world.query((e) => e.with('health'))
117 |
118 | const Example = () => {
119 | const entitiesWithHealth = useQuery(withHealth)
120 |
121 | // ...
122 | }
123 | ```
124 |
--------------------------------------------------------------------------------
/packages/arancini-react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@arancini/react",
3 | "description": "React glue for the 'arancini' entity manager",
4 | "keywords": [
5 | "react",
6 | "gamedev",
7 | "entity-manager",
8 | "entity"
9 | ],
10 | "author": "Isaac Mason ",
11 | "license": "MIT",
12 | "version": "8.0.0",
13 | "scripts": {
14 | "test": "tsc && vitest run --coverage",
15 | "test:watch": "vitest",
16 | "lint": "eslint --ext .ts,.tsx src",
17 | "build": "yarn build:before && rollup --config rollup.config.js --bundleConfigAsCjs",
18 | "build:before": "rm -rf dist"
19 | },
20 | "dependencies": {
21 | "@arancini/core": "8.0.0"
22 | },
23 | "peerDependencies": {
24 | "react": "^18.0.0",
25 | "react-dom": "^18.0.0"
26 | },
27 | "devDependencies": {
28 | "@babel/core": "^7.24.5",
29 | "@babel/preset-env": "^7.24.5",
30 | "@babel/preset-react": "^7.24.1",
31 | "@babel/preset-typescript": "^7.24.1",
32 | "@isaac-mason/eslint-config-typescript": "^0.0.5",
33 | "@rollup/plugin-babel": "^6.0.4",
34 | "@rollup/plugin-node-resolve": "^15.0.1",
35 | "@rollup/plugin-typescript": "^11.1.6",
36 | "@testing-library/jest-dom": "^6.2.0",
37 | "@testing-library/react": "^14.2.1",
38 | "@types/react": "^18.3.12",
39 | "@types/react-dom": "^18.3.1",
40 | "@vitejs/plugin-react": "^4.1.0",
41 | "@vitest/coverage-v8": "^2.1.8",
42 | "eslint": "^8.56.0",
43 | "jsdom": "^24.0.0",
44 | "react": "^18.3.1",
45 | "react-dom": "^18.3.1",
46 | "rollup": "^4.22.4",
47 | "rollup-plugin-copy": "^3.5.0",
48 | "rollup-plugin-filesize": "^10.0.0",
49 | "typescript": "^5.3.3",
50 | "vite": "^5.2.10",
51 | "vitest": "^2.1.8"
52 | },
53 | "files": [
54 | "dist",
55 | "LICENSE",
56 | "README.md"
57 | ],
58 | "type": "module",
59 | "main": "dist/index.mjs",
60 | "types": "dist/index.d.ts"
61 | }
62 |
--------------------------------------------------------------------------------
/packages/arancini-react/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from '@rollup/plugin-babel'
2 | import { nodeResolve } from '@rollup/plugin-node-resolve'
3 | import typescript from '@rollup/plugin-typescript'
4 | import path from 'path'
5 | import filesize from 'rollup-plugin-filesize'
6 |
7 | const babelOptions = {
8 | babelrc: false,
9 | extensions: ['.ts', '.tsx'],
10 | exclude: '**/node_modules/**',
11 | babelHelpers: 'bundled',
12 | presets: [
13 | [
14 | '@babel/preset-env',
15 | {
16 | loose: true,
17 | modules: false,
18 | targets: '>1%, not dead, not ie 11, not op_mini all',
19 | },
20 | ],
21 | '@babel/preset-typescript',
22 | '@babel/preset-react',
23 | ],
24 | }
25 |
26 | export default [
27 | {
28 | input: `./src/index.tsx`,
29 | external: ['@arancini/core', 'react', 'react-dom', 'react/jsx-runtime'],
30 | output: [
31 | {
32 | file: `dist/index.mjs`,
33 | format: 'es',
34 | sourcemap: true,
35 | exports: 'named',
36 | },
37 | ],
38 | plugins: [
39 | nodeResolve(),
40 | typescript({
41 | tsconfig: path.resolve(__dirname, `tsconfig.json`),
42 | emitDeclarationOnly: true,
43 | }),
44 | babel(babelOptions),
45 | filesize(),
46 | ],
47 | },
48 | ]
49 |
--------------------------------------------------------------------------------
/packages/arancini-react/src/hooks.ts:
--------------------------------------------------------------------------------
1 | import { useCallback, useEffect, useLayoutEffect, useState } from 'react'
2 |
3 | export const useIsomorphicLayoutEffect =
4 | typeof window !== 'undefined' ? useLayoutEffect : useEffect
5 |
6 | export const useRerender = () => {
7 | const [, setState] = useState(0)
8 |
9 | const rerender = useCallback(() => {
10 | setState((state) => state + 1)
11 | }, [])
12 |
13 | return rerender
14 | }
15 |
--------------------------------------------------------------------------------
/packages/arancini-react/src/index.tsx:
--------------------------------------------------------------------------------
1 | import * as A from '@arancini/core'
2 | import React, {
3 | createContext,
4 | ForwardedRef,
5 | forwardRef,
6 | memo,
7 | ReactElement,
8 | ReactNode,
9 | useContext,
10 | useEffect,
11 | useImperativeHandle,
12 | useMemo,
13 | useRef,
14 | useState,
15 | } from 'react'
16 | import { useIsomorphicLayoutEffect, useRerender } from './hooks'
17 |
18 | type Children = ReactNode | JSX.Element
19 |
20 | type EntityProviderContext = Entity
21 |
22 | export type EntityProps = {
23 | entity?: Entity
24 | children?: Children
25 | ref?: ForwardedRef
26 | } & (
27 | | {
28 | [C in keyof Entity]?: Entity[C]
29 | }
30 | | object
31 | )
32 |
33 | export type ComponentProps = {
34 | name: C
35 | value?: E[C]
36 | children?: Children
37 | }
38 |
39 | export type ReactAPI = ReturnType<
40 | typeof createReactAPI
41 | >
42 |
43 | export const createReactAPI = (world: A.World) => {
44 | const entityContext = createContext(null! as EntityProviderContext)
45 |
46 | let entityIdCounter = 0
47 | const entityToId = new WeakMap()
48 |
49 | const entityId = (entity: E) => {
50 | let id = entityToId.get(entity)
51 |
52 | if (id === undefined) {
53 | id = entityIdCounter++
54 | entityToId.set(entity, id)
55 | }
56 |
57 | return id
58 | }
59 |
60 | const useCurrentEntity = (): E | undefined => {
61 | const entity = useContext(entityContext)
62 |
63 | if (!entity) {
64 | throw new Error(
65 | 'useCurrentEntity must be used within an component'
66 | )
67 | }
68 |
69 | return entity
70 | }
71 |
72 | const RawEntity = (
73 | { children, entity: existingEntity, ...propComponents }: EntityProps,
74 | ref: ForwardedRef
75 | ) => {
76 | const newEntity = useRef({})
77 | const entity = existingEntity || (newEntity.current as T)
78 |
79 | useEffect(() => {
80 | if (world.has(entity)) return
81 |
82 | world.create(entity)
83 |
84 | return () => {
85 | world.destroy(entity)
86 | }
87 | }, [])
88 |
89 | useImperativeHandle(ref, () => entity!, [entity])
90 |
91 | return (
92 |
93 | {children}
94 |
95 | {Object.entries(propComponents).map(([name, value]) => {
96 | return
97 | })}
98 |
99 | )
100 | }
101 |
102 | const Entity = memo(forwardRef(RawEntity)) as (
103 | props: EntityProps
104 | ) => ReactElement
105 |
106 | const Component = ({
107 | name,
108 | value,
109 | children,
110 | }: ComponentProps) => {
111 | const [childRef, setChildRef] = useState()
112 |
113 | const entity = useContext(entityContext)
114 |
115 | if (!entity) {
116 | throw new Error(
117 | ' must within an or component'
118 | )
119 | }
120 |
121 | useIsomorphicLayoutEffect(() => {
122 | let componentValue: E[C]
123 |
124 | if (children !== undefined) {
125 | componentValue = childRef as never
126 | } else if (value !== undefined) {
127 | componentValue = value
128 | } else {
129 | // default to true if no value is provided
130 | componentValue = true as never
131 | }
132 |
133 | world.add(entity, name, componentValue!)
134 |
135 | return () => {
136 | world.remove(entity, name)
137 | }
138 | }, [entity, name, value, childRef])
139 |
140 | const refCatpureProps = useMemo(() => {
141 | return {
142 | ref: setChildRef,
143 | }
144 | }, [])
145 |
146 | // capture ref of child
147 | if (children) {
148 | const child = React.Children.only(children) as ReactElement
149 |
150 | return React.cloneElement(child, refCatpureProps)
151 | }
152 |
153 | return null
154 | }
155 |
156 | const useContainer = (container: A.EntityContainer) => {
157 | const rerender = useRerender()
158 |
159 | const originalVersion = useMemo(() => container.version, [container])
160 |
161 | useIsomorphicLayoutEffect(() => {
162 | if (container.version !== originalVersion) rerender()
163 | }, [container])
164 |
165 | useIsomorphicLayoutEffect(
166 | () => container.onEntityAdded.add(rerender),
167 | [container, rerender]
168 | )
169 |
170 | useIsomorphicLayoutEffect(
171 | () => container.onEntityRemoved.add(rerender),
172 | [container, rerender]
173 | )
174 |
175 | return container
176 | }
177 |
178 | const useQuery = (query: A.Query) => {
179 | return useContainer(query)
180 | }
181 |
182 | type EntitiesInListProps = {
183 | entities: T[]
184 | children: Children | ((entity: T) => Children)
185 | }
186 |
187 | const EntitiesInList = ({
188 | entities,
189 | children,
190 | }: EntitiesInListProps) => {
191 | return (
192 | <>
193 | {entities.map((entity) => (
194 |
195 | {typeof children === 'function' ? children(entity) : children}
196 |
197 | ))}
198 | >
199 | )
200 | }
201 |
202 | type EntitiesInContainerProps = {
203 | container: A.EntityContainer
204 | children: Children | ((entity: T) => Children)
205 | }
206 |
207 | const EntitiesInContainer = ({
208 | container: entities,
209 | children,
210 | }: EntitiesInContainerProps) => {
211 | const container = useContainer(entities)
212 |
213 | return (
214 |
215 | )
216 | }
217 |
218 | const Entities = (props: {
219 | in: T[] | A.EntityContainer
220 | children: Children | ((entity: T) => Children)
221 | }): ReactElement => {
222 | if (props.in instanceof A.EntityContainer) {
223 | return (
224 |
225 | )
226 | }
227 |
228 | return (
229 |
230 | )
231 | }
232 |
233 | return {
234 | Entity,
235 | Entities,
236 | Component,
237 | useCurrentEntity,
238 | useQuery,
239 | world,
240 | }
241 | }
242 |
--------------------------------------------------------------------------------
/packages/arancini-react/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2022",
4 | "useDefineForClassFields": true,
5 | "module": "ES2022",
6 | "lib": ["ES2022", "DOM"],
7 | "moduleResolution": "Node",
8 | "strict": true,
9 | "resolveJsonModule": true,
10 | "isolatedModules": true,
11 | "esModuleInterop": true,
12 | "noUnusedLocals": true,
13 | "noUnusedParameters": true,
14 | "noImplicitReturns": true,
15 | "skipLibCheck": true,
16 | "baseUrl": "./",
17 | "rootDir": "./src",
18 | "allowSyntheticDefaultImports": true,
19 | "jsx": "react-jsx",
20 | "noEmit": true,
21 | "declaration": true,
22 | "outDir": "./dist"
23 | },
24 | "include": ["./src"]
25 | }
26 |
--------------------------------------------------------------------------------
/packages/arancini-react/tst/index.spec.tsx:
--------------------------------------------------------------------------------
1 | import { World } from '@arancini/core'
2 | import '@testing-library/jest-dom'
3 | import { act, render, renderHook } from '@testing-library/react'
4 | import React, {
5 | forwardRef,
6 | useEffect,
7 | useImperativeHandle,
8 | useState,
9 | } from 'react'
10 | import { describe, expect, test } from 'vitest'
11 | import { createReactAPI } from '../src'
12 |
13 | type Entity = {
14 | foo?: boolean
15 | bar?: string
16 | }
17 |
18 | describe('createReactAPI', () => {
19 | describe('', () => {
20 | test('creates an entity', () => {
21 | const world = new World()
22 |
23 | const reactAPI = createReactAPI(world)
24 |
25 | render()
26 |
27 | expect(world.entities.length).toBe(1)
28 | })
29 |
30 | test('can take an existing entity via props', () => {
31 | const world = new World()
32 |
33 | const reactAPI = createReactAPI(world)
34 |
35 | const entity = world.create({})
36 |
37 | render()
38 |
39 | expect(world.entities.length).toBe(1)
40 | expect(world.has(entity)).toBe(true)
41 | })
42 |
43 | test('creates components from props', () => {
44 | const world = new World()
45 |
46 | const reactAPI = createReactAPI(world)
47 |
48 | render(
49 |
50 |
51 |
52 | )
53 |
54 | const entity = world.entities[0]
55 |
56 | expect(entity.foo).toBe(true)
57 | expect(entity.bar).toBe('123')
58 | })
59 |
60 | test('supports forwarding ref', () => {
61 | const world = new World()
62 |
63 | const reactAPI = createReactAPI(world)
64 |
65 | const ref = React.createRef()
66 | const entity = world.create({})
67 |
68 | render()
69 |
70 | expect(ref.current).toBe(entity)
71 | })
72 | })
73 |
74 | describe('', () => {
75 | test('adds components to entities', () => {
76 | const world = new World()
77 |
78 | const reactAPI = createReactAPI(world)
79 |
80 | const entities = [world.create({}), world.create({}), world.create({})]
81 |
82 | render(
83 |
84 |
85 |
86 | )
87 |
88 | expect(entities.every((entity) => !!entity.foo)).toBe(true)
89 | })
90 |
91 | test('supports query instances', () => {
92 | const world = new World()
93 |
94 | const reactAPI = createReactAPI(world)
95 |
96 | const entities = [world.create({}), world.create({}), world.create({})]
97 |
98 | world.update(entities[0], (e) => {
99 | e.foo = true
100 | })
101 |
102 | world.update(entities[1], (e) => {
103 | e.foo = true
104 | })
105 |
106 | const query = world.query((e) => e.has('foo'))
107 |
108 | render(
109 |
110 |
111 |
112 | )
113 |
114 | expect(!!entities[0].bar).toBe(true)
115 | expect(!!entities[1].bar).toBe(true)
116 | expect(!!entities[2].bar).toBe(false)
117 | })
118 | })
119 |
120 | describe('', () => {
121 | test('adds and removes the given component to an entity', () => {
122 | const world = new World()
123 |
124 | const reactAPI = createReactAPI(world)
125 |
126 | const entity = world.create({})
127 |
128 | const { unmount } = render(
129 |
130 |
131 |
132 | )
133 |
134 | expect(entity.foo).toBe(true)
135 |
136 | act(() => {
137 | unmount()
138 | })
139 |
140 | expect(!!entity.foo).toBe(false)
141 | })
142 |
143 | test('prop changes after the initial render update the component', () => {
144 | const world = new World()
145 |
146 | const reactAPI = createReactAPI(world)
147 |
148 | const entity = world.create({})
149 |
150 | const { rerender, unmount } = render(
151 |
152 |
153 |
154 | )
155 |
156 | expect(entity.bar).toBe('123')
157 |
158 | rerender(
159 |
160 |
161 |
162 | )
163 |
164 | expect(entity.bar).toBe('456')
165 |
166 | unmount()
167 |
168 | expect(entity.bar).toBe(undefined)
169 | })
170 |
171 | test('value defaults to true if no "value" prop provided and no child', () => {
172 | const world = new World()
173 |
174 | const reactAPI = createReactAPI(world)
175 |
176 | const entity = world.create({})
177 |
178 | render(
179 |
180 |
181 |
182 | )
183 |
184 | expect(entity.foo).toBe(true)
185 | })
186 |
187 | test('captures child ref and use it as a component arg', () => {
188 | const world = new World()
189 |
190 | const reactAPI = createReactAPI(world)
191 |
192 | const entity = world.create({})
193 |
194 | const stateChangeListeners = new Set<() => void>()
195 |
196 | const updateState = () => {
197 | stateChangeListeners.forEach((listener) => listener())
198 | }
199 |
200 | const TestComponentWithRef = forwardRef((_props, ref) => {
201 | const [value, setValue] = useState(0)
202 |
203 | useImperativeHandle(ref, () => value, [value])
204 |
205 | useEffect(() => {
206 | const fn = () =>
207 | setValue((v) => {
208 | return v + 1
209 | })
210 |
211 | stateChangeListeners.add(fn)
212 |
213 | return () => {
214 | stateChangeListeners.delete(fn)
215 | }
216 | }, [])
217 |
218 | return null
219 | })
220 |
221 | render(
222 |
223 |
224 |
225 |
226 |
227 | )
228 |
229 | expect(entity.bar).toBe(0)
230 |
231 | expect(stateChangeListeners.size).toBe(1)
232 |
233 | act(() => {
234 | updateState()
235 | })
236 |
237 | expect(entity.bar).toBe(1)
238 | })
239 |
240 | test('throws an error when not used within an Entity component', () => {
241 | const world = new World()
242 |
243 | const reactAPI = createReactAPI(world)
244 |
245 | expect(() => {
246 | render()
247 | }).toThrow()
248 | })
249 | })
250 |
251 | describe('useQuery', () => {
252 | test('rerenders when entities are added to or removed from the query', () => {
253 | const world = new World()
254 |
255 | const reactAPI = createReactAPI(world)
256 |
257 | const entities = [world.create({}), world.create({}), world.create({})]
258 |
259 | entities.forEach((e) => {
260 | world.add(e, 'foo', true)
261 | })
262 |
263 | const query = world.query((e) => e.has('foo'))
264 |
265 | const { result } = renderHook(() => reactAPI.useQuery(query))
266 |
267 | expect(result.current.entities).toEqual(entities)
268 |
269 | act(() => {
270 | world.remove(entities[2], 'foo')
271 | })
272 |
273 | expect(result.current.entities).toEqual([entities[0], entities[1]])
274 | })
275 | })
276 |
277 | describe('useCurrentEntity', () => {
278 | test('returns the current entity', () => {
279 | const world = new World()
280 |
281 | const reactAPI = createReactAPI(world)
282 |
283 | const entity = world.create({})
284 |
285 | const { result } = renderHook(() => reactAPI.useCurrentEntity(), {
286 | wrapper: ({ children }) => (
287 | {children}
288 | ),
289 | })
290 |
291 | expect(result.current).toBe(entity)
292 | })
293 |
294 | test('throws an error when not used within an Entity component', () => {
295 | const world = new World()
296 |
297 | const reactAPI = createReactAPI(world)
298 |
299 | expect(() => {
300 | renderHook(() => reactAPI.useCurrentEntity())
301 | }).toThrow()
302 | })
303 | })
304 | })
305 |
--------------------------------------------------------------------------------
/packages/arancini-react/tst/setup.ts:
--------------------------------------------------------------------------------
1 | import { cleanup } from '@testing-library/react'
2 | import { afterEach } from 'vitest'
3 |
4 | afterEach(() => {
5 | cleanup()
6 | })
7 |
--------------------------------------------------------------------------------
/packages/arancini-react/vite.config.ts:
--------------------------------------------------------------------------------
1 | import react from '@vitejs/plugin-react'
2 | import { defineConfig } from 'vite'
3 |
4 | export default defineConfig({
5 | plugins: [react()],
6 | test: {
7 | globals: true,
8 | environment: 'jsdom',
9 | setupFiles: ['./tst/setup.ts'],
10 | },
11 | })
12 |
--------------------------------------------------------------------------------
/packages/arancini/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@isaac-mason/eslint-config-typescript"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/arancini/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
26 | # jest coverage
27 | coverage
28 |
29 | index.js
30 | index.js.map
31 | index.d.ts
32 |
33 | react.js
34 | react.js.map
35 | react.d.ts
36 |
--------------------------------------------------------------------------------
/packages/arancini/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5",
3 | "tabWidth": 2,
4 | "semi": false,
5 | "singleQuote": true
6 | }
7 |
--------------------------------------------------------------------------------
/packages/arancini/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright © 2023 Isaac Mason
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/arancini/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | [](https://www.npmjs.com/package/arancini)
4 | 
5 | [](https://www.npmjs.com/package/arancini)
6 | [](https://bundlephobia.com/result?p=arancini)
7 |
8 | # arancini
9 |
10 | An entity manager for JavaScript.
11 |
12 | ```
13 | > npm i arancini
14 | ```
15 |
16 | - 👾 Manage game or simulation entities
17 | - 🛹 Strikes a balance between ease of use and performance
18 | - 🍱 Entities are regular objects, components are properties on objects
19 | - 🧩 Framework agnostic, plug arancini into anything
20 | - 💙 TypeScript friendly
21 | - ⚛️ [Easy integration with React](https://github.com/isaac-mason/arancini/tree/main/packages/arancini-react)
22 |
23 | ## Introduction
24 |
25 | Arancini is an entity manager for JavaScript that helps you write data-oriented code for games, simulations, and other applications.
26 |
27 | Arancini has a few key features/differentiators:
28 | - Entities are regular objects, and components are properties on objects.
29 | - Queries update reactively as components are added and removed from entities.
30 | - The core library has no concept of "Systems", it's easy to plug arancini into your existing gameloop.
31 | - Strong TypeScript support for queries
32 |
33 | ## Overview
34 |
35 | ### 🌎 Creating a World
36 |
37 | A world is a container for entities. It provides methods for managing entities, and methods for querying entities based on their components.
38 |
39 | ```ts
40 | import { World } from "arancini";
41 |
42 | // (optional) define a type for entities in the world
43 | type Entity = {
44 | position?: { x: number; y: number };
45 | health?: number;
46 | velocity?: { x: number; y: number };
47 | inventory?: { items: string[] };
48 | };
49 |
50 | const world = new World();
51 | ```
52 |
53 | ### 🍱 Creating Entities
54 |
55 | You can use `world.create` to create an entity from any object.
56 |
57 | ```ts
58 | const playerEntity = { position: { x: 0, y: 0 } };
59 |
60 | world.create(playerEntity);
61 | ```
62 |
63 | ### 📦 Adding and Removing Components
64 |
65 | To add and remove components from an entity, you can use `world.add`, `world.remove`.
66 |
67 | ```ts
68 | /* add a component */
69 | world.add(playerEntity, "health", 100);
70 |
71 | /* remove a component */
72 | world.remove(playerEntity, "health");
73 | ```
74 |
75 | You can also use `world.update` to add and remove multiple components at once.
76 |
77 | ```ts
78 | /* add and remove multiple components with a partial entity */
79 | world.update(playerEntity, {
80 | // add a component
81 | velocity: { x: 1, y: 0 },
82 | // remove a component
83 | poisioned: undefined,
84 | });
85 |
86 | /* add and remove multiple components with an update callback */
87 | world.update(playerEntity, (e) => {
88 | // add a component
89 | e.velocity = { x: 1, y: 0 };
90 |
91 | // remove a component
92 | delete e.poisioned;
93 | });
94 | ```
95 |
96 | > **Warning:** Avoid adding/removing properties without using `world.add`, `world.remove`, or `world.update`. These methods ensure that queries are updated correctly.
97 |
98 | ### 🔎 Querying Entities
99 |
100 | You can query entities based on their components with `world.query`. Queries are reactive, they will update as components are added and removed from components.
101 |
102 | ```ts
103 | const monsters = world.query((e) => e.all("health", "position", "velocity"));
104 | ```
105 |
106 | > **Note:** Arancini dedupes queries with the same conditions, so you can create multiple of the same query without performance penalty!
107 |
108 | ### 🧠 Iterating over Query results
109 |
110 | You can use a `for...of` loop to iterate over queries in reverse order. This prevents problems that can occur when removing entities from queries within a loop.
111 |
112 | ```ts
113 | const moving = world.query((e) => e.all("position", "velocity"));
114 |
115 | const alive = world.query((e) => e.all("health"));
116 |
117 | const movementSystem = () => {
118 | for (const entity of moving) {
119 | const position = entity.position;
120 | const velocity = entity.velocity;
121 |
122 | position.x += velocity.x;
123 | position.y += velocity.y;
124 | }
125 | };
126 |
127 | const healthSystem = () => {
128 | for (const entity of alive) {
129 | if (entity.health <= 0) {
130 | world.destroy(entity);
131 | }
132 | }
133 | };
134 | ```
135 |
136 | You can also use `query.entities` directly.
137 |
138 | ```ts
139 | const moving = world.query((e) => e.all("position", "velocity"));
140 |
141 | console.log(moving.entities); // [...]
142 | ```
143 |
144 | ### ⍰ Query Conditions
145 |
146 | Query functions support `all`, `any`, and `none` conditions. The query builder also has some no-op grammar and aliases to make queries easier to read.
147 |
148 | ```ts
149 | const monsters = world.query((e) =>
150 | e.all("health", "position").any("skeleton", "zombie").none("dead"),
151 | );
152 |
153 | const monsters = world.query((entities) =>
154 | entities
155 | .with("health", "position")
156 | .and.any("skeleton", "zombie")
157 | .but.not("dead"),
158 | );
159 | ```
160 |
161 | ### 🗑 Destroying Entities
162 |
163 | `world.destroy` removes an entity from the world and from all queries.
164 |
165 | ```ts
166 | world.destroy(playerEntity);
167 | ```
168 |
169 | Destroying an entity doesn't remove any properties from the entity object.
170 |
171 |
172 | ### 📡 Query Events
173 |
174 | Queries emit events when entities are added or removed.
175 |
176 | ```ts
177 | const query = world.query((e) => e.has("position"));
178 |
179 | query.onEntityAdded.add((entity) => {
180 | console.log("added!", entity);
181 | });
182 |
183 | query.onEntityRemoved.add((entity) => {
184 | console.log("removed!", entity);
185 | });
186 | ```
187 |
188 | ### 🔦 Ad-hoc Queries
189 |
190 | You can use `world.filter` and `world.find` to get ad-hoc query results.
191 |
192 | ```ts
193 | const monsters = world.filter((e) => e.has("health", "position", "velocity"));
194 |
195 | const player = world.find((e) => e.has("player"));
196 | ```
197 |
198 | This is useful for cases where you want to get results infrequently, without the cost of evaluating a reactive query as the world changes.
199 |
200 | If there is an existing query with the same conditions, the query results will be reused.
201 |
202 | ### 🧠 Systems
203 |
204 | The core library (`@arancini/core`) does not have a built-in concept of systems.
205 |
206 | A "System" can be anything that operates on the world. You can write simple functions and call them however you like, e.g. inside setInterval, requestAnimationFrame, or in your existing game loop.
207 |
208 | ## Packages
209 |
210 | You can install all of arancini with the umbrella `arancini` package, or you can install individual packages under the `@arancini/*` scope.
211 |
212 | > **Note:** In order to use entrypoints with typescript, you must use a `moduleResolution` option that supports entrypoints, for example `bundler` or `NodeNext`.
213 |
214 | > **Note:** Bundles are ECMAScript modules, there are no CommonJS bundles right now.
215 |
216 | ### [**`arancini`**](https://github.com/isaac-mason/arancini/tree/main/packages/arancini)
217 |
218 | [](https://www.npmjs.com/package/arancini)
219 |
220 | The umbrella package for `arancini`.
221 |
222 | ```bash
223 | > npm install arancini
224 | ```
225 |
226 | ```ts
227 | import { World } from "arancini";
228 | import { createReactAPI } from "arancini/react";
229 | ```
230 |
231 | ### [**`@arancini/core`**](https://github.com/isaac-mason/arancini/tree/main/packages/arancini-core)
232 |
233 | [](https://www.npmjs.com/package/@arancini/core)
234 |
235 | The core library!
236 |
237 | ```bash
238 | > npm install @arancini/core
239 | ```
240 |
241 | ```ts
242 | import { World } from "@arancini/core";
243 | ```
244 |
245 | ### [**`@arancini/react`**](https://github.com/isaac-mason/arancini/tree/main/packages/arancini-react)
246 |
247 | [](https://www.npmjs.com/package/@arancini/react)
248 |
249 | React glue for arancini.
250 |
251 | See the [**@arancini/react README**](https://github.com/isaac-mason/arancini/tree/main/packages/arancini-react) for docs.
252 |
253 | ```bash
254 | > npm install @arancini/react
255 | ```
256 |
257 | ```ts
258 | import { createReactAPI } from "@arancini/react";
259 | ```
260 |
--------------------------------------------------------------------------------
/packages/arancini/cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/cover.png
--------------------------------------------------------------------------------
/packages/arancini/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "arancini",
3 | "description": "An entity manager for JavaScript.",
4 | "keywords": [
5 | "gamedev",
6 | "entity-manager",
7 | "entity"
8 | ],
9 | "author": "Isaac Mason ",
10 | "license": "MIT",
11 | "version": "8.0.0",
12 | "homepage": "https://github.com/isaac-mason/arancini",
13 | "bugs": {
14 | "url": "https://github.com/isaac-mason/arancini/issues"
15 | },
16 | "scripts": {
17 | "build": "yarn build:before && rollup --config rollup.config.js --bundleConfigAsCjs",
18 | "build:before": "rm -rf dist",
19 | "lint": "eslint --ext .ts src"
20 | },
21 | "dependencies": {
22 | "@arancini/core": "8.0.0",
23 | "@arancini/react": "8.0.0"
24 | },
25 | "peerDependencies": {
26 | "react": "^18.0.0",
27 | "react-dom": "^18.0.0"
28 | },
29 | "devDependencies": {
30 | "@babel/core": "^7.24.5",
31 | "@babel/preset-env": "^7.24.5",
32 | "@babel/preset-react": "^7.24.1",
33 | "@babel/preset-typescript": "^7.24.1",
34 | "@isaac-mason/eslint-config-typescript": "^0.0.5",
35 | "@rollup/plugin-babel": "^6.0.4",
36 | "@rollup/plugin-node-resolve": "^15.0.1",
37 | "@rollup/plugin-typescript": "^11.1.6",
38 | "@types/react": "^18.3.12",
39 | "@types/react-dom": "^18.3.1",
40 | "eslint": "^8.56.0",
41 | "prettier": "^3.4.1",
42 | "rollup": "^4.22.4",
43 | "rollup-plugin-copy": "^3.5.0",
44 | "rollup-plugin-filesize": "^10.0.0",
45 | "typescript": "^5.3.3"
46 | },
47 | "type": "module",
48 | "main": "./dist/index.mjs",
49 | "types": "./dist/index.d.ts",
50 | "exports": {
51 | ".": {
52 | "types": "./dist/index.d.ts",
53 | "import": "./dist/index.mjs"
54 | },
55 | "./react": {
56 | "types": "./dist/react.d.ts",
57 | "import": "./dist/react.mjs"
58 | }
59 | },
60 | "files": [
61 | "dist",
62 | "LICENSE",
63 | "README.md"
64 | ]
65 | }
66 |
--------------------------------------------------------------------------------
/packages/arancini/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from '@rollup/plugin-babel'
2 | import { nodeResolve } from '@rollup/plugin-node-resolve'
3 | import typescript from '@rollup/plugin-typescript'
4 | import path from 'path'
5 | import filesize from 'rollup-plugin-filesize'
6 |
7 | const babelOptions = {
8 | babelrc: false,
9 | extensions: ['.ts'],
10 | exclude: '**/node_modules/**',
11 | babelHelpers: 'bundled',
12 | presets: [
13 | [
14 | '@babel/preset-env',
15 | {
16 | loose: true,
17 | modules: false,
18 | targets: '>1%, not dead, not ie 11, not op_mini all',
19 | },
20 | ],
21 | '@babel/preset-typescript',
22 | ],
23 | }
24 |
25 | const plugins = [
26 | nodeResolve(),
27 | typescript({
28 | tsconfig: path.resolve(__dirname, `tsconfig.json`),
29 | emitDeclarationOnly: true,
30 | }),
31 | babel(babelOptions),
32 | filesize(),
33 | ]
34 |
35 | const entrypoint = ({ name, external }) => ({
36 | input: `./src/${name}.ts`,
37 | external: external ?? [],
38 | output: [
39 | {
40 | file: `./dist/${name}.mjs`,
41 | format: 'es',
42 | sourcemap: true,
43 | exports: 'named',
44 | },
45 | ],
46 | plugins,
47 | })
48 |
49 | export default [
50 | entrypoint({ name: 'index', external: ['@arancini/core'] }),
51 | entrypoint({
52 | name: 'react',
53 | external: ['@arancini/core', '@arancini/react', 'react', 'react-dom'],
54 | }),
55 | ]
56 |
--------------------------------------------------------------------------------
/packages/arancini/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from '@arancini/core'
2 |
--------------------------------------------------------------------------------
/packages/arancini/src/react.ts:
--------------------------------------------------------------------------------
1 | export * from '@arancini/react'
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/Bounds-a89dda79.js:
--------------------------------------------------------------------------------
1 | import{_ as j}from"./extends-98964cd2.js";import{r}from"./index-76fb7be0.js";import{a as P,W as A,L as k,H as D,e as V,F as q,u as I,V as f,B as G,f as C}from"./react-three-fiber.esm-dca5276d.js";function U(i){return function(l){i.forEach(function(y){typeof y=="function"?y(l):y!=null&&(y.current=l)})}}function J(i,l,y){const b=P(z=>z.size),w=P(z=>z.viewport),h=typeof i=="number"?i:b.width*w.dpr,g=typeof l=="number"?l:b.height*w.dpr,F=(typeof i=="number"?y:i)||{},{samples:M=0,depth:e,...p}=F,d=r.useMemo(()=>{const z=new A(h,g,{minFilter:k,magFilter:k,type:D,...p});return e&&(z.depthTexture=new V(h,g,q)),z.samples=M,z},[]);return r.useLayoutEffect(()=>{d.setSize(h,g),M&&(d.samples=M)},[M,d,h,g]),r.useEffect(()=>()=>d.dispose(),[]),d}const K=i=>typeof i=="function",$=r.forwardRef(({envMap:i,resolution:l=256,frames:y=1/0,makeDefault:b,children:w,...h},g)=>{const F=P(({set:u})=>u),M=P(({camera:u})=>u),e=P(({size:u})=>u),p=r.useRef(null),d=r.useRef(null),z=J(l);r.useLayoutEffect(()=>{h.manual||(p.current.aspect=e.width/e.height)},[e,h]),r.useLayoutEffect(()=>{p.current.updateProjectionMatrix()});let o=0,R=null;const S=K(w);return I(u=>{S&&(y===1/0||o{if(b){const u=M;return F(()=>({camera:p.current})),()=>F(()=>({camera:u}))}},[p,b,F]),r.createElement(r.Fragment,null,r.createElement("perspectiveCamera",j({ref:U([p,g])},h),!S&&w),r.createElement("group",{ref:d},S&&w(z.texture)))}),L=i=>i&&i.isOrthographicCamera,N=i=>i&&i.isBox3,Q=r.createContext(null);function ee({children:i,damping:l=6,fit:y,clip:b,observe:w,margin:h=1.2,eps:g=.01,onFit:F}){const M=r.useRef(null),{camera:e,invalidate:p,size:d,controls:z}=P(),o=z,R=r.useRef(F);R.current=F;function S(s,t){return Math.abs(s.x-t.x)({animating:!1,focus:new f,camera:new f,zoom:1})),[m]=r.useState(()=>({focus:new f,camera:new f,zoom:1})),[n]=r.useState(()=>new G),T=r.useMemo(()=>{function s(){const t=n.getSize(new f),c=n.getCenter(new f),x=Math.max(t.x,t.y,t.z),E=L(e)?x*4:x/(2*Math.atan(Math.PI*e.fov/360)),v=L(e)?x*4:E/e.aspect,W=h*Math.max(E,v);return{box:n,size:t,center:c,distance:W}}return{getSize:s,refresh(t){if(N(t))n.copy(t);else{const c=t||M.current;if(!c)return this;c.updateWorldMatrix(!0,!0),n.setFromObject(c)}if(n.isEmpty()){const c=e.position.length()||10;n.setFromCenterAndSize(new f,new f(c,c,c))}if((o==null?void 0:o.constructor.name)==="OrthographicTrackballControls"){const{distance:c}=s(),x=e.position.clone().sub(o.target).normalize().multiplyScalar(c),E=o.target.clone().add(x);e.position.copy(E)}return this},clip(){const{distance:t}=s();return o&&(o.maxDistance=t*10),e.near=t/100,e.far=t*100,e.updateProjectionMatrix(),o&&o.update(),p(),this},to({position:t,target:c}){a.camera.copy(e.position);const{center:x}=s();return m.camera.set(...t),c?m.focus.set(...c):m.focus.copy(x),l?a.animating=!0:e.position.set(...t),this},fit(){a.camera.copy(e.position),o&&a.focus.copy(o.target);const{center:t,distance:c}=s(),x=t.clone().sub(e.position).normalize().multiplyScalar(c);if(m.camera.copy(t).sub(x),m.focus.copy(t),L(e)){a.zoom=e.zoom;let E=0,v=0;const W=[new f(n.min.x,n.min.y,n.min.z),new f(n.min.x,n.max.y,n.min.z),new f(n.min.x,n.min.y,n.max.z),new f(n.min.x,n.max.y,n.max.z),new f(n.max.x,n.max.y,n.max.z),new f(n.max.x,n.max.y,n.min.z),new f(n.max.x,n.min.y,n.max.z),new f(n.max.x,n.min.y,n.min.z)];t.applyMatrix4(e.matrixWorldInverse);for(const B of W)B.applyMatrix4(e.matrixWorldInverse),E=Math.max(E,Math.abs(B.y-t.y)),v=Math.max(v,Math.abs(B.x-t.x));E*=2,v*=2;const O=(e.top-e.bottom)/E,_=(e.right-e.left)/v;m.zoom=Math.min(O,_)/h,l||(e.zoom=m.zoom,e.updateProjectionMatrix())}return l?a.animating=!0:(e.position.copy(m.camera),e.lookAt(m.focus),o&&(o.target.copy(m.focus),o.update())),R.current&&R.current(this.getSize()),p(),this}}},[n,e,o,h,l,p]);r.useLayoutEffect(()=>{if(o){const s=()=>a.animating=!1;return o.addEventListener("start",s),()=>o.removeEventListener("start",s)}},[o]);const H=r.useRef(0);return r.useLayoutEffect(()=>{(w||H.current++===0)&&(T.refresh(),y&&T.fit(),b&&T.clip())},[d,b,y,w,e,o]),I((s,t)=>{if(a.animating){if(u(a.focus,m.focus,l,t),u(a.camera,m.camera,l,t),a.zoom=C.damp(a.zoom,m.zoom,l,t),e.position.copy(a.camera),L(e)&&(e.zoom=a.zoom,e.updateProjectionMatrix()),o?(o.target.copy(a.focus),o.update()):e.lookAt(a.focus),p(),L(e)&&!(Math.abs(a.zoom-m.zoom){let{id:n,component:e}=t;if(!e)throw new Error(`Unable to render story ${n} as the component annotation is missing from the default export`);return o.createElement(e,{...r})},E=class extends i.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){let{hasError:r}=this.state,{showMain:t}=this.props;r||t()}componentDidCatch(r){let{showException:t}=this.props;t(r)}render(){let{hasError:r}=this.state,{children:t}=this.props;return r?null:t}},c=s!=null&&s.strictMode?i.StrictMode:i.Fragment;async function C({storyContext:r,unboundStoryFn:t,showMain:n,showException:e,forceRemount:l},a){let m=o.createElement(E,{showMain:n,showException:e},o.createElement(t,{...r})),h=c?o.createElement(c,null,m):m;return l&&p(a),await d(h,a),()=>p(a)}var D={renderer:"react"};export{D as parameters,_ as render,C as renderToCanvas};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/existing-world.stories-eb8727d7.js:
--------------------------------------------------------------------------------
1 | import{g as Ee,j as E,F as We,a as je}from"./index.es-6456b573.js";import{a as Re,u as $e,D as Ce,V as z,O as oe,P as ae,b as Oe}from"./react-three-fiber.esm-dca5276d.js";import{r as n}from"./index-76fb7be0.js";import{R as Fe,L as He}from"./timeline-composer.esm-08db1a3e.js";import{S as Te}from"./setup-1d901612.js";import{_ as Ie}from"./extends-98964cd2.js";import{a as ze}from"./client-8a8da4b9.js";import"./_commonjsHelpers-de833af9.js";const $=new z,_=new z,Ae=new z;function Le(e,t,s){const i=$.setFromMatrixPosition(e.matrixWorld);i.project(t);const o=s.width/2,a=s.height/2;return[i.x*o+o,-(i.y*a)+a]}function Ve(e,t){const s=$.setFromMatrixPosition(e.matrixWorld),i=_.setFromMatrixPosition(t.matrixWorld),o=s.sub(i),a=t.getWorldDirection(Ae);return o.angleTo(a)>Math.PI/2}function De(e,t,s,i){const o=$.setFromMatrixPosition(e.matrixWorld),a=o.clone();a.project(t),s.setFromCamera(a,t);const x=s.intersectObjects(i,!0);if(x.length){const b=x[0].distance;return o.distanceTo(s.ray.origin)Math.abs(e)<1e-10?0:e;function ce(e,t,s=""){let i="matrix3d(";for(let o=0;o!==16;o++)i+=k(t[o]*e.elements[o])+(o!==15?",":")");return s+i}const Ne=(e=>t=>ce(t,e))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Be=(e=>(t,s)=>ce(t,e(s),"translate(-50%,-50%)"))(e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1]);function Ze(e){return e&&typeof e=="object"&&"current"in e}const Ge=n.forwardRef(({children:e,eps:t=.001,style:s,className:i,prepend:o,center:a,fullscreen:x,portal:b,distanceFactor:W,sprite:le=!1,transform:h=!1,occlude:c,onOcclude:B,castShadow:ue,receiveShadow:de,material:fe,geometry:Z,zIndexRange:C=[16777271,0],calculatePosition:G=Le,as:me="div",wrapperClass:A,pointerEvents:q="auto",...p},J)=>{const{gl:K,camera:l,scene:Q,size:d,raycaster:he,events:xe,viewport:pe}=Re(),[u]=n.useState(()=>document.createElement(me)),L=n.useRef(),m=n.useRef(null),U=n.useRef(0),O=n.useRef([0,0]),j=n.useRef(null),V=n.useRef(null),S=(b==null?void 0:b.current)||xe.connected||K.domElement.parentNode,y=n.useRef(null),F=n.useRef(!1),H=n.useMemo(()=>c&&c!=="blending"||Array.isArray(c)&&c.length&&Ze(c[0]),[c]);n.useLayoutEffect(()=>{const f=K.domElement;c&&c==="blending"?(f.style.zIndex=`${Math.floor(C[0]/2)}`,f.style.position="absolute",f.style.pointerEvents="none"):(f.style.zIndex=null,f.style.position=null,f.style.pointerEvents=null)},[c]),n.useLayoutEffect(()=>{if(m.current){const f=L.current=ze(u);if(Q.updateMatrixWorld(),h)u.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const r=G(m.current,l,d);u.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${r[0]}px,${r[1]}px,0);transform-origin:0 0;`}return S&&(o?S.prepend(u):S.appendChild(u)),()=>{S&&S.removeChild(u),f.unmount()}}},[S,h]),n.useLayoutEffect(()=>{A&&(u.className=A)},[A]);const X=n.useMemo(()=>h?{position:"absolute",top:0,left:0,width:d.width,height:d.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:a?"translate3d(-50%,-50%,0)":"none",...x&&{top:-d.height/2,left:-d.width/2,width:d.width,height:d.height},...s},[s,a,x,d,h]),ve=n.useMemo(()=>({position:"absolute",pointerEvents:q}),[q]);n.useLayoutEffect(()=>{if(F.current=!1,h){var f;(f=L.current)==null||f.render(n.createElement("div",{ref:j,style:X},n.createElement("div",{ref:V,style:ve},n.createElement("div",{ref:J,className:i,style:s,children:e}))))}else{var r;(r=L.current)==null||r.render(n.createElement("div",{ref:J,style:X,className:i,children:e}))}});const w=n.useRef(!0);$e(f=>{if(m.current){l.updateMatrixWorld(),m.current.updateWorldMatrix(!0,!1);const r=h?O.current:G(m.current,l,d);if(h||Math.abs(U.current-l.zoom)>t||Math.abs(O.current[0]-r[0])>t||Math.abs(O.current[1]-r[1])>t){const g=Ve(m.current,l);let v=!1;H&&(Array.isArray(c)?v=c.map(M=>M.current):c!=="blending"&&(v=[Q]));const R=w.current;if(v){const M=De(m.current,l,he,v);w.current=M&&!g}else w.current=!g;R!==w.current&&(B?B(!w.current):u.style.display=w.current?"block":"none");const T=Math.floor(C[0]/2),ye=c?H?[C[0],T]:[T-1,0]:C;if(u.style.zIndex=`${_e(m.current,l,ye)}`,h){const[M,ee]=[d.width/2,d.height/2],D=l.projectionMatrix.elements[5]*ee,{isOrthographicCamera:te,top:ge,left:Me,bottom:Pe,right:be}=l,Se=Ne(l.matrixWorldInverse),we=te?`scale(${D})translate(${k(-(be+Me)/2)}px,${k((ge+Pe)/2)}px)`:`translateZ(${D}px)`;let P=m.current.matrixWorld;le&&(P=l.matrixWorldInverse.clone().transpose().copyPosition(P).scale(m.current.scale),P.elements[3]=P.elements[7]=P.elements[11]=0,P.elements[15]=1),u.style.width=d.width+"px",u.style.height=d.height+"px",u.style.perspective=te?"":`${D}px`,j.current&&V.current&&(j.current.style.transform=`${we}${Se}translate(${M}px,${ee}px)`,V.current.style.transform=Be(P,1/((W||10)/400)))}else{const M=W===void 0?1:ke(m.current,l)*W;u.style.transform=`translate3d(${r[0]}px,${r[1]}px,0) scale(${M})`}O.current=r,U.current=l.zoom}}if(!H&&y.current&&!F.current)if(h){if(j.current){const r=j.current.children[0];if(r!=null&&r.clientWidth&&r!=null&&r.clientHeight){const{isOrthographicCamera:g}=l;if(g||Z)p.scale&&(Array.isArray(p.scale)?p.scale instanceof z?y.current.scale.copy(p.scale.clone().divideScalar(1)):y.current.scale.set(1/p.scale[0],1/p.scale[1],1/p.scale[2]):y.current.scale.setScalar(1/p.scale));else{const v=(W||10)/400,R=r.clientWidth*v,T=r.clientHeight*v;y.current.scale.set(R,T,1)}F.current=!0}}}else{const r=u.children[0];if(r!=null&&r.clientWidth&&r!=null&&r.clientHeight){const g=1/pe.factor,v=r.clientWidth*g,R=r.clientHeight*g;y.current.scale.set(v,R,1),F.current=!0}y.current.lookAt(f.camera.position)}});const Y=n.useMemo(()=>({vertexShader:h?void 0:`
2 | /*
3 | This shader is from the THREE's SpriteMaterial.
4 | We need to turn the backing plane into a Sprite
5 | (make it always face the camera) if "transfrom"
6 | is false.
7 | */
8 | #include
9 |
10 | void main() {
11 | vec2 center = vec2(0., 1.);
12 | float rotation = 0.0;
13 |
14 | // This is somewhat arbitrary, but it seems to work well
15 | // Need to figure out how to derive this dynamically if it even matters
16 | float size = 0.03;
17 |
18 | vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
19 | vec2 scale;
20 | scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
21 | scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
22 |
23 | bool isPerspective = isPerspectiveMatrix( projectionMatrix );
24 | if ( isPerspective ) scale *= - mvPosition.z;
25 |
26 | vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
27 | vec2 rotatedPosition;
28 | rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
29 | rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
30 | mvPosition.xy += rotatedPosition;
31 |
32 | gl_Position = projectionMatrix * mvPosition;
33 | }
34 | `,fragmentShader:`
35 | void main() {
36 | gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
37 | }
38 | `}),[h]);return n.createElement("group",Ie({},p,{ref:m}),c&&!H&&n.createElement("mesh",{castShadow:ue,receiveShadow:de,ref:y},Z||n.createElement("planeGeometry",null),fe||n.createElement("shaderMaterial",{side:Ce,vertexShader:Y.vertexShader,fragmentShader:Y.fragmentShader})))}),tt={title:"React / Existing World"},N=new Ee;N.init();const{Entity:ne}=Oe(N),I=()=>{const[e,t]=n.useState("");return n.useEffect(()=>{const s=setInterval(()=>{const i=N.entities.length;t(`${i} ${i===1?"entity":"entities"}`)},.1);return()=>{clearInterval(s)}},[]),E(We,{children:je(Te,{cameraPosition:[0,0,20],children:[E(ne,{}),E(Fe,{seconds:4,children:E(He,{seconds:2,children:E(ne,{})})}),E(Ge,{style:{color:"white"},transform:!0,scale:3,children:e})]})})};var re,se,ie;I.parameters={...I.parameters,docs:{...(re=I.parameters)==null?void 0:re.docs,source:{originalSource:`() => {
39 | const [worldStats, setWorldStats] = useState('');
40 | useEffect(() => {
41 | const interval = setInterval(() => {
42 | const n = world.entities.length;
43 | setWorldStats(\`\${n} \${n === 1 ? 'entity' : 'entities'}\`);
44 | }, 1 / 10);
45 | return () => {
46 | clearInterval(interval);
47 | };
48 | }, []);
49 | return <>
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
62 | {worldStats}
63 |
64 |
65 | >;
66 | }`,...(ie=(se=I.parameters)==null?void 0:se.docs)==null?void 0:ie.source}}};const nt=["ExistingWorld"];export{I as ExistingWorld,nt as __namedExportsOrder,tt as default};
67 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/extends-98964cd2.js:
--------------------------------------------------------------------------------
1 | function e(){return e=Object.assign?Object.assign.bind():function(a){for(var n=1;ns in o?M(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;var m=(o,s,e)=>(B(o,typeof s!="symbol"?s+"":s,e),e);import{g as L,j as l,F as R,a as q,m as f}from"./index.es-6456b573.js";import{r as D}from"./index-76fb7be0.js";import"./_commonjsHelpers-de833af9.js";class U extends f{constructor(){super(...arguments);m(this,"emojisToRender",this.query(e=>e.with("position","emoji","distanceToTarget")));m(this,"emojisDomElement",document.getElementById("emojis"))}onInit(){this.emojisToRender.onEntityAdded.add(e=>{const{emoji:t}=e;this.emojisDomElement.appendChild(t.domElement),t.dirty=!0})}onDestroy(){for(const e of this.emojisToRender){const{emoji:t}=e;t.domElement.remove()}}onUpdate(){for(const e of this.emojisToRender){const{emoji:t}=e;if(!t.dirty)continue;const{position:a,distanceToTarget:r}=e;if(!r)continue;const{distance:i}=r;t.revealed?i>8?t.domElement.innerText="🥶":i>5?t.domElement.innerText="❄️":i>3?t.domElement.innerText="🕯":i>=2?t.domElement.innerText="🔥":i>=1?t.domElement.innerText="🫣":t.domElement.innerText="💣":t.domElement.innerText="☁";const c=28,n=a.x*c,d=a.y*c;t.domElement.className=`emoji ${t.revealed?"revealed":""}`,t.domElement.style.left=`${n+document.body.clientWidth/2-c/2}px`,t.domElement.style.top=`${d-c/2}px`,t.dirty=!1}}}class G extends f{constructor(){super(...arguments);m(this,"emojis",this.query(e=>e.with("emoji","position")));m(this,"target",this.query(e=>e.with("target","position")))}onInit(){this.emojis.onEntityAdded.add(e=>{const{position:{x:t,y:a}}=e,{position:r}=this.target.first,i=Math.sqrt(Math.pow(r.x-t,2)+Math.pow(r.y-a,2));this.world.add(e,"distanceToTarget",{distance:i})})}}class w extends f{constructor(){super(...arguments);m(this,"emojis",this.query(e=>e.with("emoji","position")));m(this,"target",this.query(e=>e.with("target","position")));m(this,"gameState",this.singleton("gameState",{required:!0}));m(this,"nRevealedDomElement",document.createElement("p"))}onInit(){document.querySelector("#score").appendChild(this.nRevealedDomElement),this.nRevealedDomElement.innerText="Click on an emoji to start",this.emojis.onEntityAdded.add(e=>{const{emoji:t}=e;t.domElement.addEventListener("click",()=>{if(!(!this.gameState||this.gameState.foundBomb)&&!t.revealed){t.revealed=!0,this.gameState.clicks+=1;const a=this.target.first,{position:r}=a,{position:i}=e;r.x===i.x&&r.y===i.y?(this.gameState.foundBomb=!0,this.nRevealedDomElement.innerText="You found the bomb in "+this.gameState.clicks.toString()+" clicks!"):this.nRevealedDomElement.innerText=w.scoreText(this.gameState.clicks),t.dirty=!0}})})}static scoreText(e){return`${e} clicks so far...`}}const p=()=>(D.useEffect(()=>{const o=new L({components:["position","emoji","distanceToTarget","target","gameState"]});o.registerSystem(G).registerSystem(U).registerSystem(w),o.init();const s=(n,d)=>Math.floor(Math.random()*(d-n+1)+n),e=()=>{const n={gameState:{clicks:0,foundBomb:!1}};o.create(n);const d=11,y=-Math.floor(d/2),g=Math.ceil(d/2),j=11,E=-Math.floor(j/2),T=Math.ceil(j/2),b={position:{x:s(y+2,g-2),y:s(E+2,T-2)},target:!0};o.create(b);for(let u=y;u{o.reset()}};let t=e();document.querySelector("#reset").addEventListener("click",()=>{t(),t=e()}),window.addEventListener("resize",()=>{o.filter(n=>n.with("emoji")).forEach(n=>{n.emoji.dirty=!0})});const a=()=>performance.now()/1e3;let r=!0,i=a();const c=()=>{if(!r)return;requestAnimationFrame(c);const n=a(),d=n-i;i=n,o.step(d)};return c(),()=>{r=!1,o.reset()}}),l(R,{children:q("div",{id:"emoji-sweeper",children:[l("p",{children:"Click the emojis to reveal them. Try to find the bomb in as few clicks as possible!"}),l("div",{id:"score"}),l("button",{id:"reset",children:"Reset"}),l("div",{id:"emojis"})]})})),$={name:"Vanilla / Find The Bomb",component:p};var x,v,S;p.parameters={...p.parameters,docs:{...(x=p.parameters)==null?void 0:x.docs,source:{originalSource:`() => {
2 | useEffect(() => {
3 | const world = new World({
4 | components: ['position', 'emoji', 'distanceToTarget', 'target', 'gameState']
5 | });
6 | world.registerSystem(DistanceSystem).registerSystem(EmojiRendererSystem).registerSystem(InteractionSystem);
7 | world.init();
8 | const randomBetween = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1) + min);
9 | const setupGame = () => {
10 | const gameState = {
11 | gameState: {
12 | clicks: 0,
13 | foundBomb: false
14 | }
15 | };
16 | world.create(gameState);
17 | const rows = 11;
18 | const rowsLower = -Math.floor(rows / 2);
19 | const rowsUpper = Math.ceil(rows / 2);
20 | const cols = 11;
21 | const colsLower = -Math.floor(cols / 2);
22 | const colsUpper = Math.ceil(cols / 2);
23 | const target = {
24 | position: {
25 | x: randomBetween(rowsLower + 2, rowsUpper - 2),
26 | y: randomBetween(colsLower + 2, colsUpper - 2)
27 | },
28 | target: true
29 | };
30 | world.create(target);
31 | for (let i = rowsLower; i < rowsUpper; i++) {
32 | for (let j = colsLower; j < colsUpper; j++) {
33 | const emoji = {
34 | position: {
35 | x: j,
36 | y: i
37 | },
38 | emoji: {
39 | revealed: false,
40 | dirty: false,
41 | domElement: document.createElement('div')
42 | }
43 | };
44 | world.create(emoji);
45 | }
46 | }
47 | return () => {
48 | world.reset();
49 | };
50 | };
51 | let destroyGame = setupGame();
52 | document.querySelector('#reset')!.addEventListener('click', () => {
53 | destroyGame();
54 | destroyGame = setupGame();
55 | });
56 | window.addEventListener('resize', () => {
57 | world.filter(entities => entities.with('emoji')).forEach(entity => {
58 | entity.emoji.dirty = true;
59 | });
60 | });
61 | const now = () => performance.now() / 1000;
62 | let running = true;
63 | let lastTime = now();
64 | const update = () => {
65 | if (!running) return;
66 | requestAnimationFrame(update);
67 | const time = now();
68 | const delta = time - lastTime;
69 | lastTime = time;
70 | world.step(delta);
71 | };
72 | update();
73 | return () => {
74 | running = false;
75 | world.reset();
76 | };
77 | });
78 | return <>
79 |
80 |
81 | Click the emojis to reveal them. Try to find the bomb in as few clicks
82 | as possible!
83 |
84 |
85 |
86 |
87 |
88 | >;
89 | }`,...(S=(v=p.parameters)==null?void 0:v.docs)==null?void 0:S.source}}};const P=["FindTheBomb"];export{p as FindTheBomb,P as __namedExportsOrder,$ as default};
90 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/iframe-45bb0dfa.js:
--------------------------------------------------------------------------------
1 | import"../sb-preview/runtime.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const e of r)if(e.type==="childList")for(const o of e.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&a(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const e={};return r.integrity&&(e.integrity=r.integrity),r.referrerPolicy&&(e.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?e.credentials="include":r.crossOrigin==="anonymous"?e.credentials="omit":e.credentials="same-origin",e}function a(r){if(r.ep)return;r.ep=!0;const e=n(r);fetch(r.href,e)}})();const E="modulepreload",d=function(_,i){return new URL(_,i).href},u={},t=function(i,n,a){if(!n||n.length===0)return i();const r=document.getElementsByTagName("link");return Promise.all(n.map(e=>{if(e=d(e,a),e in u)return;u[e]=!0;const o=e.endsWith(".css"),O=o?'[rel="stylesheet"]':"";if(!!a)for(let l=r.length-1;l>=0;l--){const c=r[l];if(c.href===e&&(!o||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${O}`))return;const s=document.createElement("link");if(s.rel=o?"stylesheet":E,o||(s.as="script",s.crossOrigin=""),s.href=e,document.head.appendChild(s),o)return new Promise((l,c)=>{s.addEventListener("load",l),s.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${e}`)))})})).then(()=>i()).catch(e=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=e,window.dispatchEvent(o),!o.defaultPrevented)throw e})},{createBrowserChannel:p}=__STORYBOOK_MODULE_CHANNELS__,{addons:R}=__STORYBOOK_MODULE_PREVIEW_API__,m=p({page:"preview"});R.setChannel(m);window.__STORYBOOK_ADDONS_CHANNEL__=m;window.CONFIG_TYPE==="DEVELOPMENT"&&(window.__STORYBOOK_SERVER_CHANNEL__=m);const f={"./stories/react/existing-world.stories.tsx":async()=>t(()=>import("./existing-world.stories-eb8727d7.js"),["./existing-world.stories-eb8727d7.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-three-fiber.esm-dca5276d.js","./extends-98964cd2.js","./timeline-composer.esm-08db1a3e.js","./setup-1d901612.js","./client-8a8da4b9.js"],import.meta.url),"./stories/react/external-physics-library.stories.tsx":async()=>t(()=>import("./external-physics-library.stories-b887c252.js"),["./external-physics-library.stories-b887c252.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-three-fiber.esm-dca5276d.js","./extends-98964cd2.js","./timeline-composer.esm-08db1a3e.js"],import.meta.url),"./stories/react/pong.stories.tsx":async()=>t(()=>import("./pong.stories-86c4837c.js"),["./pong.stories-86c4837c.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-three-fiber.esm-dca5276d.js","./extends-98964cd2.js","./setup-1d901612.js","./Bounds-a89dda79.js"],import.meta.url),"./stories/react/random-walkers.stories.tsx":async()=>t(()=>import("./random-walkers.stories-bef084b1.js"),["./random-walkers.stories-bef084b1.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-three-fiber.esm-dca5276d.js","./extends-98964cd2.js","./setup-1d901612.js"],import.meta.url),"./stories/react/selection.stories.tsx":async()=>t(()=>import("./selection.stories-7431ac8e.js"),["./selection.stories-7431ac8e.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-three-fiber.esm-dca5276d.js","./extends-98964cd2.js","./setup-1d901612.js","./Bounds-a89dda79.js"],import.meta.url),"./stories/vanilla/find-the-bomb/find-the-bomb.stories.tsx":async()=>t(()=>import("./find-the-bomb.stories-e4ae4ff2.js"),["./find-the-bomb.stories-e4ae4ff2.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./find-the-bomb.stories-51e9b26e.css"],import.meta.url),"./stories/vanilla/overlapping-circles/overlapping-circles.stories.tsx":async()=>t(()=>import("./overlapping-circles.stories-e038c80f.js"),["./overlapping-circles.stories-e038c80f.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js"],import.meta.url),"./stories/vanilla/random-walkers.stories.tsx":async()=>t(()=>import("./random-walkers.stories-fcd817f3.js"),["./random-walkers.stories-fcd817f3.js","./index.es-6456b573.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js"],import.meta.url)};async function P(_){return f[_]()}const{composeConfigs:T,PreviewWeb:w,ClientApi:v}=__STORYBOOK_MODULE_PREVIEW_API__,L=async()=>{const _=await Promise.all([t(()=>import("./entry-preview-68bf576c.js"),["./entry-preview-68bf576c.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-18-ce37f4e2.js","./client-8a8da4b9.js"],import.meta.url),t(()=>import("./entry-preview-docs-c7c6facc.js"),["./entry-preview-docs-c7c6facc.js","./_getPrototype-1e53b583.js","./_commonjsHelpers-de833af9.js","./index-356e4a49.js","./index-76fb7be0.js"],import.meta.url),t(()=>import("./preview-73104b77.js"),["./preview-73104b77.js","./index-11d98b33.js"],import.meta.url),t(()=>import("./preview-43d83ba8.js"),[],import.meta.url),t(()=>import("./preview-3964b600.js"),["./preview-3964b600.js","./index-356e4a49.js"],import.meta.url),t(()=>import("./preview-30b54f76.js"),["./preview-30b54f76.js","./index-356e4a49.js"],import.meta.url),t(()=>import("./preview-c56bf6ac.js"),[],import.meta.url),t(()=>import("./preview-da31036b.js"),["./preview-da31036b.js","./index-356e4a49.js"],import.meta.url),t(()=>import("./preview-0ef86afd.js"),[],import.meta.url),t(()=>import("./preview-21802b0a.js"),["./preview-21802b0a.js","./_commonjsHelpers-de833af9.js"],import.meta.url),t(()=>import("./preview-c2aa3ab7.js"),["./preview-c2aa3ab7.js","./preview-632f5ece.css"],import.meta.url)]);return T(_)};window.__STORYBOOK_PREVIEW__=window.__STORYBOOK_PREVIEW__||new w;window.__STORYBOOK_STORY_STORE__=window.__STORYBOOK_STORY_STORE__||window.__STORYBOOK_PREVIEW__.storyStore;window.__STORYBOOK_CLIENT_API__=window.__STORYBOOK_CLIENT_API__||new v({storyStore:window.__STORYBOOK_PREVIEW__.storyStore});window.__STORYBOOK_PREVIEW__.initialize({importFn:P,getProjectAnnotations:L});export{t as _};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/index-11d98b33.js:
--------------------------------------------------------------------------------
1 | var A=Object.create,g=Object.defineProperty,d=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,h=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,x=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),P=(r,e,i,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of j(e))!m.call(r,a)&&a!==i&&g(r,a,{get:()=>e[a],enumerable:!(u=d(e,a))||u.enumerable});return r},S=(r,e,i)=>(i=r!=null?A(h(r)):{},P(e||!r||!r.__esModule?g(i,"default",{value:r,enumerable:!0}):i,r)),U=x(r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isEqual=function(){var e=Object.prototype.toString,i=Object.getPrototypeOf,u=Object.getOwnPropertySymbols?function(a){return Object.keys(a).concat(Object.getOwnPropertySymbols(a))}:Object.keys;return function(a,c){return function f(t,n,o){var y,s,l,p=e.call(t),w=e.call(n);if(t===n)return!0;if(t==null||n==null)return!1;if(o.indexOf(t)>-1&&o.indexOf(n)>-1)return!0;if(o.push(t,n),p!=w||(y=u(t),s=u(n),y.length!=s.length||y.some(function(O){return!f(t[O],n[O],o)})))return!1;switch(p.slice(8,-1)){case"Symbol":return t.valueOf()==n.valueOf();case"Date":case"Number":return+t==+n||+t!=+t&&+n!=+n;case"RegExp":case"Function":case"String":case"Boolean":return""+t==""+n;case"Set":case"Map":y=t.entries(),s=n.entries();do if(!f((l=y.next()).value,s.next().value,o))return!1;while(!l.done);return!0;case"ArrayBuffer":t=new Uint8Array(t),n=new Uint8Array(n);case"DataView":t=new Uint8Array(t.buffer),n=new Uint8Array(n.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(t.length!=n.length)return!1;for(l=0;lr.map(e=>typeof e<"u").filter(Boolean).length,q=(r,e)=>{let{exists:i,eq:u,neq:a,truthy:c}=r;if(v([i,u,a,c])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:i,eq:u,neq:a})}`);if(typeof u<"u")return(0,b.isEqual)(e,u);if(typeof a<"u")return!(0,b.isEqual)(e,a);if(typeof i<"u"){let f=typeof e<"u";return i?f:!f}return typeof c>"u"||c?!!e:!e},E=(r,e,i)=>{if(!r.if)return!0;let{arg:u,global:a}=r.if;if(v([u,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:u,global:a})}`);let c=u?e[u]:i[a];return q(r.if,c)},I=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,"");export{I as L,E as O};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/index-356e4a49.js:
--------------------------------------------------------------------------------
1 | function l(o){for(var f=[],i=1;itypeof t=="function"?t(e):{...e,...t},[e,t])}const c={};function a({components:t,children:e,disableParentContext:r}){let n;return r?n=typeof t=="function"?t({}):t||c:n=i(t),o.createElement(u.Provider,{value:n},e)}export{u as MDXContext,a as MDXProvider,i as useMDXComponents,C as withMDXComponents};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/index-76fb7be0.js:
--------------------------------------------------------------------------------
1 | import{g as D}from"./_commonjsHelpers-de833af9.js";function T(e,t){for(var n=0;nu[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var $={exports:{}},r={};/**
2 | * @license React
3 | * react.production.min.js
4 | *
5 | * Copyright (c) Facebook, Inc. and its affiliates.
6 | *
7 | * This source code is licensed under the MIT license found in the
8 | * LICENSE file in the root directory of this source tree.
9 | */var y=Symbol.for("react.element"),V=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),M=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),B=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),R=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=R&&e[R]||e["@@iterator"],typeof e=="function"?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function p(e,t,n){this.props=e,this.context=t,this.refs=C,this.updater=n||g}p.prototype.isReactComponent={};p.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function O(){}O.prototype=p.prototype;function v(e,t,n){this.props=e,this.context=t,this.refs=C,this.updater=n||g}var S=v.prototype=new O;S.constructor=v;j(S,p.prototype);S.isPureReactComponent=!0;var k=Array.isArray,x=Object.prototype.hasOwnProperty,E={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function I(e,t,n){var u,o={},c=null,s=null;if(t!=null)for(u in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(c=""+t.key),t)x.call(t,u)&&!P.hasOwnProperty(u)&&(o[u]=t[u]);var f=arguments.length-2;if(f===1)o.children=n;else if(1i in e?q(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var d=(e,i,t)=>(M(e,typeof i!="symbol"?i+"":i,t),t);import{m as u,g as W,j as T}from"./index.es-6456b573.js";import{r as b}from"./index-76fb7be0.js";import"./_commonjsHelpers-de833af9.js";class g{constructor(){d(this,"x");d(this,"y");this.x=0,this.y=0}set(i,t){return this.x=i,this.y=t,this}copy(i){return this.x=i.x,this.y=i.y,this}clone(){return new g().set(this.x,this.y)}}function m(e,i){return Math.random()*(i-e)+e}function H(e,i){const t=i.position.x-e.position.x,r=i.position.y-e.position.y,s=Math.sqrt(r*r+t*t);if(s>e.radius+i.radius||st.with("movement","circle")));d(this,"context",this.singleton("canvas"))}onUpdate(t){let r=this.context.width,s=this.context.height,c=.5,l=this.movingCircles.entities;for(let o=0;o1&&(a.acceleration.x-=t*c),a.acceleration.y>1&&(a.acceleration.y-=t*c),a.acceleration.x<1&&(a.acceleration.x=1),a.acceleration.y<1&&(a.acceleration.y=1),n.position.y+n.radius<0&&(n.position.y=s+n.radius),n.position.y-n.radius>s&&(n.position.y=-n.radius),n.position.x-n.radius>r&&(n.position.x=0),n.position.x+n.radius<0&&(n.position.x=r)}}}class P extends u{constructor(){super(...arguments);d(this,"circles",this.query(t=>t.with("circle")))}onUpdate(){let t=this.circles.entities;for(let r=0;rt.with("circle")));d(this,"intersectingCircles",this.query(t=>t.with("intersecting")));d(this,"context",this.singleton("canvas"))}onUpdate(){const{ctx:t,width:r,height:s}=this.context;t.fillStyle="black",t.fillRect(0,0,r,r);let c=this.circles.entities;for(let o=0;o(b.useEffect(()=>{const e=new W({components:["circle","movement","intersecting","canvas"]});e.registerSystem(I).registerSystem(j).registerSystem(P);const i=document.querySelector("#example-canvas");i.width=window.innerWidth,i.height=window.innerHeight;const t={canvas:{canvasElement:i,ctx:i.getContext("2d"),width:i.width,height:i.height}};e.create(t),window.addEventListener("resize",()=>{t.canvas.width=i.width=window.innerWidth,t.canvas.height=i.height=window.innerHeight},!1);for(let o=0;o<30;o++){const n={circle:{position:new g,radius:0},movement:{velocity:new g,acceleration:new g}};e.create(n),n.circle.position.set(m(0,t.canvas.width),m(0,t.canvas.height)),n.circle.radius=m(20,100),n.movement.velocity.set(m(-20,20),m(-20,20))}e.init();const r=()=>performance.now()/1e3;let s=!0,c=r();const l=()=>{if(!s)return;requestAnimationFrame(l);const o=r(),n=o-c;c=o,e.step(n)};return l(),()=>{s=!1,e.reset()}}),T("canvas",{id:"example-canvas"})),_={name:"Vanilla / Overlapping Circles",component:y};var v,w,f;y.parameters={...y.parameters,docs:{...(v=y.parameters)==null?void 0:v.docs,source:{originalSource:`() => {
2 | useEffect(() => {
3 | const world = new World({
4 | components: ['circle', 'movement', 'intersecting', 'canvas']
5 | });
6 | world.registerSystem(MovementSystem).registerSystem(Renderer).registerSystem(IntersectionSystem);
7 | const canvasElement = (document.querySelector('#example-canvas') as HTMLCanvasElement);
8 | canvasElement.width = window.innerWidth;
9 | canvasElement.height = window.innerHeight;
10 | const canvasEntity = {
11 | canvas: {
12 | canvasElement,
13 | ctx: canvasElement.getContext('2d')!,
14 | width: canvasElement.width,
15 | height: canvasElement.height
16 | }
17 | };
18 | world.create(canvasEntity);
19 | window.addEventListener('resize', () => {
20 | canvasEntity.canvas.width = canvasElement.width = window.innerWidth;
21 | canvasEntity.canvas.height = canvasElement.height = window.innerHeight;
22 | }, false);
23 | for (let i = 0; i < 30; i++) {
24 | const entity = {
25 | circle: {
26 | position: new Vector2(),
27 | radius: 0
28 | },
29 | movement: {
30 | velocity: new Vector2(),
31 | acceleration: new Vector2()
32 | }
33 | };
34 | world.create(entity);
35 | entity.circle.position.set(random(0, canvasEntity.canvas.width), random(0, canvasEntity.canvas.height));
36 | entity.circle.radius = random(20, 100);
37 | entity.movement.velocity.set(random(-20, 20), random(-20, 20));
38 | }
39 | world.init();
40 | const now = () => performance.now() / 1000;
41 | let running = true;
42 | let lastTime = now();
43 | const update = () => {
44 | if (!running) return;
45 | requestAnimationFrame(update);
46 | const time = now();
47 | const delta = time - lastTime;
48 | lastTime = time;
49 | world.step(delta);
50 | };
51 | update();
52 | return () => {
53 | running = false;
54 | world.reset();
55 | };
56 | });
57 | return ;
58 | }`,...(f=(w=y.parameters)==null?void 0:w.docs)==null?void 0:f.source}}};const U=["MovementSystem","IntersectionSystem","Renderer","OverlappingCircles"];export{P as IntersectionSystem,I as MovementSystem,y as OverlappingCircles,j as Renderer,U as __namedExportsOrder,_ as default};
59 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-0ef86afd.js:
--------------------------------------------------------------------------------
1 | const{global:r}=__STORYBOOK_MODULE_GLOBAL__,{addons:s}=__STORYBOOK_MODULE_PREVIEW_API__,{STORY_CHANGED:O}=__STORYBOOK_MODULE_CORE_EVENTS__;var i="storybook/highlight",d="storybookHighlight",g=`${i}/add`,E=`${i}/reset`,{document:l}=r,H=(e="#FF4785",t="dashed")=>`
2 | outline: 2px ${t} ${e};
3 | outline-offset: 2px;
4 | box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
5 | `,I=e=>({outline:`2px dashed ${e}`,outlineOffset:2,boxShadow:"0 0 0 6px rgba(255,255,255,0.6)"}),_=s.getChannel(),T=e=>{let t=d;n();let o=Array.from(new Set(e.elements)),h=l.createElement("style");h.setAttribute("id",t),h.innerHTML=o.map(a=>`${a}{
6 | ${H(e.color,e.style)}
7 | }`).join(" "),l.head.appendChild(h)},n=()=>{var o;let e=d,t=l.getElementById(e);t&&((o=t.parentNode)==null||o.removeChild(t))};_.on(O,n);_.on(E,n);_.on(g,T);export{I as highlightObject,H as highlightStyle};
8 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-30b54f76.js:
--------------------------------------------------------------------------------
1 | import{d as E}from"./index-356e4a49.js";const{useMemo:f,useEffect:v}=__STORYBOOK_MODULE_PREVIEW_API__,{global:M}=__STORYBOOK_MODULE_GLOBAL__,{logger:h}=__STORYBOOK_MODULE_CLIENT_LOGGER__;var p="backgrounds",{document:s,window:B}=M,S=()=>B.matchMedia("(prefers-reduced-motion: reduce)").matches,x=(r,e=[],a)=>{if(r==="transparent")return"transparent";if(e.find(t=>t.value===r))return r;let n=e.find(t=>t.name===a);if(n)return n.value;if(a){let t=e.map(o=>o.name).join(", ");h.warn(E`
2 | Backgrounds Addon: could not find the default color "${a}".
3 | These are the available colors for your story based on your configuration:
4 | ${t}.
5 | `)}return"transparent"},k=r=>{(Array.isArray(r)?r:[r]).forEach(O)},O=r=>{var a;let e=s.getElementById(r);e&&((a=e.parentElement)==null||a.removeChild(e))},w=(r,e)=>{let a=s.getElementById(r);if(a)a.innerHTML!==e&&(a.innerHTML=e);else{let n=s.createElement("style");n.setAttribute("id",r),n.innerHTML=e,s.head.appendChild(n)}},A=(r,e,a)=>{var t;let n=s.getElementById(r);if(n)n.innerHTML!==e&&(n.innerHTML=e);else{let o=s.createElement("style");o.setAttribute("id",r),o.innerHTML=e;let i=`addon-backgrounds-grid${a?`-docs-${a}`:""}`,d=s.getElementById(i);d?(t=d.parentElement)==null||t.insertBefore(o,d):s.head.appendChild(o)}},L=(r,e)=>{var c;let{globals:a,parameters:n}=e,t=(c=a[p])==null?void 0:c.value,o=n[p],i=f(()=>o.disable?"transparent":x(t,o.values,o.default),[o,t]),d=f(()=>i&&i!=="transparent",[i]),g=e.viewMode==="docs"?`#anchor--${e.id} .docs-story`:".sb-show-main",u=f(()=>{let l="transition: background-color 0.3s;";return`
6 | ${g} {
7 | background: ${i} !important;
8 | ${S()?"":l}
9 | }
10 | `},[i,g]);return v(()=>{let l=e.viewMode==="docs"?`addon-backgrounds-docs-${e.id}`:"addon-backgrounds-color";if(!d){k(l);return}A(l,u,e.viewMode==="docs"?e.id:null)},[d,u,e]),r()},T=(r,e)=>{var y;let{globals:a,parameters:n}=e,t=n[p].grid,o=((y=a[p])==null?void 0:y.grid)===!0&&t.disable!==!0,{cellAmount:i,cellSize:d,opacity:g}=t,u=e.viewMode==="docs",c=n.layout===void 0||n.layout==="padded"?16:0,l=t.offsetX??(u?20:c),m=t.offsetY??(u?20:c),$=f(()=>{let b=e.viewMode==="docs"?`#anchor--${e.id} .docs-story`:".sb-show-main",_=[`${d*i}px ${d*i}px`,`${d*i}px ${d*i}px`,`${d}px ${d}px`,`${d}px ${d}px`].join(", ");return`
11 | ${b} {
12 | background-size: ${_} !important;
13 | background-position: ${l}px ${m}px, ${l}px ${m}px, ${l}px ${m}px, ${l}px ${m}px !important;
14 | background-blend-mode: difference !important;
15 | background-image: linear-gradient(rgba(130, 130, 130, ${g}) 1px, transparent 1px),
16 | linear-gradient(90deg, rgba(130, 130, 130, ${g}) 1px, transparent 1px),
17 | linear-gradient(rgba(130, 130, 130, ${g/2}) 1px, transparent 1px),
18 | linear-gradient(90deg, rgba(130, 130, 130, ${g/2}) 1px, transparent 1px) !important;
19 | }
20 | `},[d]);return v(()=>{let b=e.viewMode==="docs"?`addon-backgrounds-grid-docs-${e.id}`:"addon-backgrounds-grid";if(!o){k(b);return}w(b,$)},[o,$,e]),r()},I=[T,L],R={[p]:{grid:{cellSize:20,opacity:.5,cellAmount:5},values:[{name:"light",value:"#F8F8F8"},{name:"dark",value:"#333333"}]}},G={[p]:null};export{I as decorators,G as globals,R as parameters};
21 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-3964b600.js:
--------------------------------------------------------------------------------
1 | import{d as N}from"./index-356e4a49.js";let R;const V=new Uint8Array(16);function A(){if(!R&&(R=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!R))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return R(V)}const E=[];for(let t=0;t<256;++t)E.push((t+256).toString(16).slice(1));function D(t,e=0){return(E[t[e+0]]+E[t[e+1]]+E[t[e+2]]+E[t[e+3]]+"-"+E[t[e+4]]+E[t[e+5]]+"-"+E[t[e+6]]+E[t[e+7]]+"-"+E[t[e+8]]+E[t[e+9]]+"-"+E[t[e+10]]+E[t[e+11]]+E[t[e+12]]+E[t[e+13]]+E[t[e+14]]+E[t[e+15]]).toLowerCase()}const P=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),h={randomUUID:P};function S(t,e,n){if(h.randomUUID&&!e&&!t)return h.randomUUID();t=t||{};const o=t.random||(t.rng||A)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){n=n||0;for(let r=0;r<16;++r)e[n+r]=o[r];return e}return D(o)}var b=class extends Error{constructor(){super(...arguments),this.data={},this.documentation=!1,this.fromStorybook=!0}get fullErrorCode(){let t=String(this.code).padStart(4,"0");return`SB_${this.category}_${t}`}get name(){let t=this.constructor.name;return`${this.fullErrorCode} (${t})`}get message(){let t;return this.documentation===!0?t=`https://storybook.js.org/error/${this.fullErrorCode}`:typeof this.documentation=="string"?t=this.documentation:Array.isArray(this.documentation)&&(t=`
2 | ${this.documentation.map(e=>` - ${e}`).join(`
3 | `)}`),`${this.template()}${t!=null?`
4 |
5 | More info: ${t}
6 | `:""}`}},W=(t=>(t.PREVIEW_CLIENT_LOGGER="PREVIEW_CLIENT-LOGGER",t.PREVIEW_CHANNELS="PREVIEW_CHANNELS",t.PREVIEW_CORE_EVENTS="PREVIEW_CORE-EVENTS",t.PREVIEW_INSTRUMENTER="PREVIEW_INSTRUMENTER",t.PREVIEW_API="PREVIEW_API",t.PREVIEW_REACT_DOM_SHIM="PREVIEW_REACT-DOM-SHIM",t.PREVIEW_ROUTER="PREVIEW_ROUTER",t.PREVIEW_THEMING="PREVIEW_THEMING",t.RENDERER_HTML="RENDERER_HTML",t.RENDERER_PREACT="RENDERER_PREACT",t.RENDERER_REACT="RENDERER_REACT",t.RENDERER_SERVER="RENDERER_SERVER",t.RENDERER_SVELTE="RENDERER_SVELTE",t.RENDERER_VUE="RENDERER_VUE",t.RENDERER_VUE3="RENDERER_VUE3",t.RENDERER_WEB_COMPONENTS="RENDERER_WEB-COMPONENTS",t))(W||{}),f=class extends b{constructor(t){super(),this.data=t,this.category="PREVIEW_API",this.code=2,this.documentation="https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#using-implicit-actions-during-rendering-is-deprecated-for-example-in-the-play-function"}template(){return N`
7 | We detected that you use an implicit action arg during ${this.data.phase} of your story.
8 | ${this.data.deprecated?`
9 | This is deprecated and won't work in Storybook 8 anymore.
10 | `:""}
11 | Please provide an explicit spy to your args like this:
12 | import { fn } from '@storybook/test';
13 | ...
14 | args: {
15 | ${this.data.name}: fn()
16 | }
17 | `}};const{addons:U}=__STORYBOOK_MODULE_PREVIEW_API__,{global:g}=__STORYBOOK_MODULE_GLOBAL__;var M="storybook/actions",w=`${M}/action-event`,x={depth:10,clearOnStoryChange:!0,limit:50},y=(t,e)=>{let n=Object.getPrototypeOf(t);return!n||e(n)?n:y(n,e)},j=t=>!!(typeof t=="object"&&t&&y(t,e=>/^Synthetic(?:Base)?Event$/.test(e.constructor.name))&&typeof t.persist=="function"),L=t=>{if(j(t)){let e=Object.create(t.constructor.prototype,Object.getOwnPropertyDescriptors(t));e.persist();let n=Object.getOwnPropertyDescriptor(e,"view"),o=n==null?void 0:n.value;return typeof o=="object"&&(o==null?void 0:o.constructor.name)==="Window"&&Object.defineProperty(e,"view",{...n,value:Object.create(o.constructor.prototype)}),e}return t},$=()=>typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?S():Date.now().toString(36)+Math.random().toString(36).substring(2);function p(t,e={}){let n={...x,...e},o=function(...r){var l,u;if(e.implicit){let _=(l="__STORYBOOK_PREVIEW__"in g?g.__STORYBOOK_PREVIEW__:void 0)==null?void 0:l.storyRenders.find(a=>a.phase==="playing"||a.phase==="rendering");if(_){let a=!((u=window==null?void 0:window.FEATURES)!=null&&u.disallowImplicitActionsInRenderV8),m=new f({phase:_.phase,name:t,deprecated:a});if(a)console.warn(m);else throw m}}let i=U.getChannel(),s=$(),c=5,d=r.map(L),O=r.length>1?d:d[0],T={id:s,count:0,data:{name:t,args:O},options:{...n,maxDepth:c+(n.depth||3),allowFunction:n.allowFunction||!1}};i.emit(w,T)};return o.isAction=!0,o}var I=(t,e)=>typeof e[t]>"u"&&!(t in e),k=t=>{let{initialArgs:e,argTypes:n,id:o,parameters:{actions:r}}=t;if(!r||r.disable||!r.argTypesRegex||!n)return{};let i=new RegExp(r.argTypesRegex);return Object.entries(n).filter(([s])=>!!i.test(s)).reduce((s,[c,d])=>(I(c,e)&&(s[c]=p(c,{implicit:!0,id:o})),s),{})},v=t=>{let{initialArgs:e,argTypes:n,parameters:{actions:o}}=t;return o!=null&&o.disable||!n?{}:Object.entries(n).filter(([r,i])=>!!i.action).reduce((r,[i,s])=>(I(i,e)&&(r[i]=p(typeof s.action=="string"?s.action:i)),r),{})},F=[v,k],B=t=>{let{args:e,parameters:{actions:n}}=t;n!=null&&n.disable||Object.entries(e).filter(([,o])=>typeof o=="function"&&"_isMockFunction"in o&&o._isMockFunction).forEach(([o,r])=>{let i=r.getMockImplementation();if((i==null?void 0:i._actionAttached)!==!0&&(i==null?void 0:i.isAction)!==!0){let s=(...c)=>(p(o)(...c),i==null?void 0:i(...c));s._actionAttached=!0,r.mockImplementation(s)}})},G=[B];export{F as argsEnhancers,G as loaders};
18 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-43d83ba8.js:
--------------------------------------------------------------------------------
1 | import{_ as t}from"./iframe-45bb0dfa.js";import"../sb-preview/runtime.js";var _={docs:{renderer:async()=>{let{DocsRenderer:r}=await t(()=>import("./DocsRenderer-NNNQARDV-a9823a9d.js").then(e=>e.D),["./DocsRenderer-NNNQARDV-a9823a9d.js","./iframe-45bb0dfa.js","./index-76fb7be0.js","./_commonjsHelpers-de833af9.js","./react-18-ce37f4e2.js","./client-8a8da4b9.js","./index-11d98b33.js","./extends-98964cd2.js","./_getPrototype-1e53b583.js","./index-356e4a49.js"],import.meta.url);return new r}}};export{_ as parameters};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-632f5ece.css:
--------------------------------------------------------------------------------
1 | html,body,#storybook-root{width:100%;height:100%;margin:0;padding:0!important;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:#121212}#root{overflow:auto}
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-73104b77.js:
--------------------------------------------------------------------------------
1 | import"./index-11d98b33.js";const{global:O}=__STORYBOOK_MODULE_GLOBAL__,{makeDecorator:E,addons:_}=__STORYBOOK_MODULE_PREVIEW_API__,{STORY_CHANGED:l,SELECT_STORY:L}=__STORYBOOK_MODULE_CORE_EVENTS__;var c="links",{document:i,HTMLElement:m}=O,v=e=>_.getChannel().emit(L,e),o=e=>{let{target:t}=e;if(!(t instanceof m))return;let s=t,{sbKind:a,sbStory:r}=s.dataset;(a||r)&&(e.preventDefault(),v({kind:a,story:r}))},n=!1,d=()=>{n||(n=!0,i.addEventListener("click",o))},k=()=>{n&&(n=!1,i.removeEventListener("click",o))},R=E({name:"withLinks",parameterName:c,wrapper:(e,t)=>(d(),_.getChannel().once(l,k),e(t))}),T=[R];export{T as decorators};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-c2aa3ab7.js:
--------------------------------------------------------------------------------
1 | const e={parameters:{actions:{argTypesRegex:"^on[A-Z].*"},controls:{matchers:{color:/(background|color)$/i,date:/Date$/}}}};export{e as default};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-c56bf6ac.js:
--------------------------------------------------------------------------------
1 | var K=!0,S="Invariant failed";function A(o,t){if(!o){if(K)throw new Error(S);var e=typeof t=="function"?t():t,l=e?"".concat(S,": ").concat(e):S;throw new Error(l)}}const{useEffect:W}=__STORYBOOK_MODULE_PREVIEW_API__,{global:d}=__STORYBOOK_MODULE_GLOBAL__;function H(){let o=d.document.documentElement,t=Math.max(o.scrollHeight,o.offsetHeight);return{width:Math.max(o.scrollWidth,o.offsetWidth),height:t}}function U(){let o=d.document.createElement("canvas");o.id="storybook-addon-measure";let t=o.getContext("2d");A(t!=null);let{width:e,height:l}=H();return P(o,t,{width:e,height:l}),o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.zIndex="2147483647",o.style.pointerEvents="none",d.document.body.appendChild(o),{canvas:o,context:t,width:e,height:l}}function P(o,t,{width:e,height:l}){o.style.width=`${e}px`,o.style.height=`${l}px`;let i=d.window.devicePixelRatio;o.width=Math.floor(e*i),o.height=Math.floor(l*i),t.scale(i,i)}var s={};function V(){s.canvas||(s=U())}function C(){s.context&&s.context.clearRect(0,0,s.width??0,s.height??0)}function Z(o){C(),o(s.context)}function G(){A(s.canvas,"Canvas should exist in the state."),A(s.context,"Context should exist in the state."),P(s.canvas,s.context,{width:0,height:0});let{width:o,height:t}=H();P(s.canvas,s.context,{width:o,height:t}),s.width=o,s.height=t}function J(){var o;s.canvas&&(C(),(o=s.canvas.parentNode)==null||o.removeChild(s.canvas),s={})}var w={margin:"#f6b26b",border:"#ffe599",padding:"#93c47d",content:"#6fa8dc",text:"#232020"},p=6;function B(o,{x:t,y:e,w:l,h:i,r:n}){t=t-l/2,e=e-i/2,l<2*n&&(n=l/2),i<2*n&&(n=i/2),o.beginPath(),o.moveTo(t+n,e),o.arcTo(t+l,e,t+l,e+i,n),o.arcTo(t+l,e+i,t,e+i,n),o.arcTo(t,e+i,t,e,n),o.arcTo(t,e,t+l,e,n),o.closePath()}function Q(o,{padding:t,border:e,width:l,height:i,top:n,left:f}){let r=l-e.left-e.right-t.left-t.right,a=i-t.top-t.bottom-e.top-e.bottom,h=f+e.left+t.left,u=n+e.top+t.top;return o==="top"?h+=r/2:o==="right"?(h+=r,u+=a/2):o==="bottom"?(h+=r/2,u+=a):o==="left"?u+=a/2:o==="center"&&(h+=r/2,u+=a/2),{x:h,y:u}}function x(o,t,{margin:e,border:l,padding:i},n,f){let r=m=>0,a=0,h=0,u=f?1:.5,c=f?n*2:0;return o==="padding"?r=m=>i[m]*u+c:o==="border"?r=m=>i[m]+l[m]*u+c:o==="margin"&&(r=m=>i[m]+l[m]+e[m]*u+c),t==="top"?h=-r("top"):t==="right"?a=r("right"):t==="bottom"?h=r("bottom"):t==="left"&&(a=-r("left")),{offsetX:a,offsetY:h}}function tt(o,t){return Math.abs(o.x-t.x){let r=l&&n.position==="center"?lt(o,t,n):et(o,t,n,i[f-1],l);i[f]=r})}function nt(o,t,e,l){let i=e.reduce((n,f)=>{var r;return Object.prototype.hasOwnProperty.call(n,f.position)||(n[f.position]=[]),(r=n[f.position])==null||r.push(f),n},{});i.top&&v(o,t,i.top,l),i.right&&v(o,t,i.right,l),i.bottom&&v(o,t,i.bottom,l),i.left&&v(o,t,i.left,l),i.center&&v(o,t,i.center,l)}var L={margin:"#f6b26ba8",border:"#ffe599a8",padding:"#93c47d8c",content:"#6fa8dca8"},O=30;function g(o){return parseInt(o.replace("px",""),10)}function b(o){return Number.isInteger(o)?o:o.toFixed(2)}function _(o){return o.filter(t=>t.text!==0&&t.text!=="0")}function rt(o){let t={top:d.window.scrollY,bottom:d.window.scrollY+d.window.innerHeight,left:d.window.scrollX,right:d.window.scrollX+d.window.innerWidth},e={top:Math.abs(t.top-o.top),bottom:Math.abs(t.bottom-o.bottom),left:Math.abs(t.left-o.left),right:Math.abs(t.right-o.right)};return{x:e.left>e.right?"left":"right",y:e.top>e.bottom?"top":"bottom"}}function ft(o){let t=d.getComputedStyle(o),{top:e,left:l,right:i,bottom:n,width:f,height:r}=o.getBoundingClientRect(),{marginTop:a,marginBottom:h,marginLeft:u,marginRight:c,paddingTop:m,paddingBottom:E,paddingLeft:F,paddingRight:I,borderBottomWidth:D,borderTopWidth:$,borderLeftWidth:N,borderRightWidth:q}=t;e=e+d.window.scrollY,l=l+d.window.scrollX,n=n+d.window.scrollY,i=i+d.window.scrollX;let y={top:g(a),bottom:g(h),left:g(u),right:g(c)},z={top:g(m),bottom:g(E),left:g(F),right:g(I)},j={top:g($),bottom:g(D),left:g(N),right:g(q)},T={top:e-y.top,bottom:n+y.bottom,left:l-y.left,right:i+y.right};return{margin:y,padding:z,border:j,top:e,left:l,bottom:n,right:i,width:f,height:r,extremities:T,floatingAlignment:rt(T)}}function at(o,{margin:t,width:e,height:l,top:i,left:n,bottom:f,right:r}){let a=l+t.bottom+t.top;o.fillStyle=L.margin,o.fillRect(n,i-t.top,e,t.top),o.fillRect(r,i-t.top,t.right,a),o.fillRect(n,f,e,t.bottom),o.fillRect(n-t.left,i-t.top,t.left,a);let h=[{type:"margin",text:b(t.top),position:"top"},{type:"margin",text:b(t.right),position:"right"},{type:"margin",text:b(t.bottom),position:"bottom"},{type:"margin",text:b(t.left),position:"left"}];return _(h)}function ht(o,{padding:t,border:e,width:l,height:i,top:n,left:f,bottom:r,right:a}){let h=l-e.left-e.right,u=i-t.top-t.bottom-e.top-e.bottom;o.fillStyle=L.padding,o.fillRect(f+e.left,n+e.top,h,t.top),o.fillRect(a-t.right-e.right,n+t.top+e.top,t.right,u),o.fillRect(f+e.left,r-t.bottom-e.bottom,h,t.bottom),o.fillRect(f+e.left,n+t.top+e.top,t.left,u);let c=[{type:"padding",text:t.top,position:"top"},{type:"padding",text:t.right,position:"right"},{type:"padding",text:t.bottom,position:"bottom"},{type:"padding",text:t.left,position:"left"}];return _(c)}function st(o,{border:t,width:e,height:l,top:i,left:n,bottom:f,right:r}){let a=l-t.top-t.bottom;o.fillStyle=L.border,o.fillRect(n,i,e,t.top),o.fillRect(n,f-t.bottom,e,t.bottom),o.fillRect(n,i+t.top,t.left,a),o.fillRect(r-t.right,i+t.top,t.right,a);let h=[{type:"border",text:t.top,position:"top"},{type:"border",text:t.right,position:"right"},{type:"border",text:t.bottom,position:"bottom"},{type:"border",text:t.left,position:"left"}];return _(h)}function ut(o,{padding:t,border:e,width:l,height:i,top:n,left:f}){let r=l-e.left-e.right-t.left-t.right,a=i-t.top-t.bottom-e.top-e.bottom;return o.fillStyle=L.content,o.fillRect(f+e.left+t.left,n+e.top+t.top,r,a),[{type:"content",position:"center",text:`${b(r)} x ${b(a)}`}]}function dt(o){return t=>{if(o&&t){let e=ft(o),l=at(t,e),i=ht(t,e),n=st(t,e),f=ut(t,e),r=e.width<=O*3||e.height<=O;nt(t,e,[...f,...i,...n,...l],r)}}}function mt(o){Z(dt(o))}var ct=(o,t)=>{let e=d.document.elementFromPoint(o,t),l=i=>{if(i&&i.shadowRoot){let n=i.shadowRoot.elementFromPoint(o,t);return i.isEqualNode(n)?i:n.shadowRoot?l(n):n}return i};return l(e)||e},R,M={x:0,y:0};function Y(o,t){R=ct(o,t),mt(R)}var gt=(o,t)=>{let{measureEnabled:e}=t.globals;return W(()=>{let l=i=>{window.requestAnimationFrame(()=>{i.stopPropagation(),M.x=i.clientX,M.y=i.clientY})};return document.addEventListener("pointermove",l),()=>{document.removeEventListener("pointermove",l)}},[]),W(()=>{let l=n=>{window.requestAnimationFrame(()=>{n.stopPropagation(),Y(n.clientX,n.clientY)})},i=()=>{window.requestAnimationFrame(()=>{G()})};return t.viewMode==="story"&&e&&(document.addEventListener("pointerover",l),V(),window.addEventListener("resize",i),Y(M.x,M.y)),()=>{window.removeEventListener("resize",i),J()}},[e,t.viewMode]),o()},pt="measureEnabled",wt=[gt],bt={[pt]:!1};export{wt as decorators,bt as globals};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/preview-da31036b.js:
--------------------------------------------------------------------------------
1 | import{d as $}from"./index-356e4a49.js";const{useMemo:x,useEffect:f}=__STORYBOOK_MODULE_PREVIEW_API__,{global:p}=__STORYBOOK_MODULE_GLOBAL__;var u=i=>{(Array.isArray(i)?i:[i]).forEach(r)},r=i=>{let t=typeof i=="string"?i:i.join(""),o=p.document.getElementById(t);o&&o.parentElement&&o.parentElement.removeChild(o)},b=(i,t)=>{let o=p.document.getElementById(i);if(o)o.innerHTML!==t&&(o.innerHTML=t);else{let n=p.document.createElement("style");n.setAttribute("id",i),n.innerHTML=t,p.document.head.appendChild(n)}},m="outline";function s(i){return $`
2 | ${i} body {
3 | outline: 1px solid #2980b9 !important;
4 | }
5 |
6 | ${i} article {
7 | outline: 1px solid #3498db !important;
8 | }
9 |
10 | ${i} nav {
11 | outline: 1px solid #0088c3 !important;
12 | }
13 |
14 | ${i} aside {
15 | outline: 1px solid #33a0ce !important;
16 | }
17 |
18 | ${i} section {
19 | outline: 1px solid #66b8da !important;
20 | }
21 |
22 | ${i} header {
23 | outline: 1px solid #99cfe7 !important;
24 | }
25 |
26 | ${i} footer {
27 | outline: 1px solid #cce7f3 !important;
28 | }
29 |
30 | ${i} h1 {
31 | outline: 1px solid #162544 !important;
32 | }
33 |
34 | ${i} h2 {
35 | outline: 1px solid #314e6e !important;
36 | }
37 |
38 | ${i} h3 {
39 | outline: 1px solid #3e5e85 !important;
40 | }
41 |
42 | ${i} h4 {
43 | outline: 1px solid #449baf !important;
44 | }
45 |
46 | ${i} h5 {
47 | outline: 1px solid #c7d1cb !important;
48 | }
49 |
50 | ${i} h6 {
51 | outline: 1px solid #4371d0 !important;
52 | }
53 |
54 | ${i} main {
55 | outline: 1px solid #2f4f90 !important;
56 | }
57 |
58 | ${i} address {
59 | outline: 1px solid #1a2c51 !important;
60 | }
61 |
62 | ${i} div {
63 | outline: 1px solid #036cdb !important;
64 | }
65 |
66 | ${i} p {
67 | outline: 1px solid #ac050b !important;
68 | }
69 |
70 | ${i} hr {
71 | outline: 1px solid #ff063f !important;
72 | }
73 |
74 | ${i} pre {
75 | outline: 1px solid #850440 !important;
76 | }
77 |
78 | ${i} blockquote {
79 | outline: 1px solid #f1b8e7 !important;
80 | }
81 |
82 | ${i} ol {
83 | outline: 1px solid #ff050c !important;
84 | }
85 |
86 | ${i} ul {
87 | outline: 1px solid #d90416 !important;
88 | }
89 |
90 | ${i} li {
91 | outline: 1px solid #d90416 !important;
92 | }
93 |
94 | ${i} dl {
95 | outline: 1px solid #fd3427 !important;
96 | }
97 |
98 | ${i} dt {
99 | outline: 1px solid #ff0043 !important;
100 | }
101 |
102 | ${i} dd {
103 | outline: 1px solid #e80174 !important;
104 | }
105 |
106 | ${i} figure {
107 | outline: 1px solid #ff00bb !important;
108 | }
109 |
110 | ${i} figcaption {
111 | outline: 1px solid #bf0032 !important;
112 | }
113 |
114 | ${i} table {
115 | outline: 1px solid #00cc99 !important;
116 | }
117 |
118 | ${i} caption {
119 | outline: 1px solid #37ffc4 !important;
120 | }
121 |
122 | ${i} thead {
123 | outline: 1px solid #98daca !important;
124 | }
125 |
126 | ${i} tbody {
127 | outline: 1px solid #64a7a0 !important;
128 | }
129 |
130 | ${i} tfoot {
131 | outline: 1px solid #22746b !important;
132 | }
133 |
134 | ${i} tr {
135 | outline: 1px solid #86c0b2 !important;
136 | }
137 |
138 | ${i} th {
139 | outline: 1px solid #a1e7d6 !important;
140 | }
141 |
142 | ${i} td {
143 | outline: 1px solid #3f5a54 !important;
144 | }
145 |
146 | ${i} col {
147 | outline: 1px solid #6c9a8f !important;
148 | }
149 |
150 | ${i} colgroup {
151 | outline: 1px solid #6c9a9d !important;
152 | }
153 |
154 | ${i} button {
155 | outline: 1px solid #da8301 !important;
156 | }
157 |
158 | ${i} datalist {
159 | outline: 1px solid #c06000 !important;
160 | }
161 |
162 | ${i} fieldset {
163 | outline: 1px solid #d95100 !important;
164 | }
165 |
166 | ${i} form {
167 | outline: 1px solid #d23600 !important;
168 | }
169 |
170 | ${i} input {
171 | outline: 1px solid #fca600 !important;
172 | }
173 |
174 | ${i} keygen {
175 | outline: 1px solid #b31e00 !important;
176 | }
177 |
178 | ${i} label {
179 | outline: 1px solid #ee8900 !important;
180 | }
181 |
182 | ${i} legend {
183 | outline: 1px solid #de6d00 !important;
184 | }
185 |
186 | ${i} meter {
187 | outline: 1px solid #e8630c !important;
188 | }
189 |
190 | ${i} optgroup {
191 | outline: 1px solid #b33600 !important;
192 | }
193 |
194 | ${i} option {
195 | outline: 1px solid #ff8a00 !important;
196 | }
197 |
198 | ${i} output {
199 | outline: 1px solid #ff9619 !important;
200 | }
201 |
202 | ${i} progress {
203 | outline: 1px solid #e57c00 !important;
204 | }
205 |
206 | ${i} select {
207 | outline: 1px solid #e26e0f !important;
208 | }
209 |
210 | ${i} textarea {
211 | outline: 1px solid #cc5400 !important;
212 | }
213 |
214 | ${i} details {
215 | outline: 1px solid #33848f !important;
216 | }
217 |
218 | ${i} summary {
219 | outline: 1px solid #60a1a6 !important;
220 | }
221 |
222 | ${i} command {
223 | outline: 1px solid #438da1 !important;
224 | }
225 |
226 | ${i} menu {
227 | outline: 1px solid #449da6 !important;
228 | }
229 |
230 | ${i} del {
231 | outline: 1px solid #bf0000 !important;
232 | }
233 |
234 | ${i} ins {
235 | outline: 1px solid #400000 !important;
236 | }
237 |
238 | ${i} img {
239 | outline: 1px solid #22746b !important;
240 | }
241 |
242 | ${i} iframe {
243 | outline: 1px solid #64a7a0 !important;
244 | }
245 |
246 | ${i} embed {
247 | outline: 1px solid #98daca !important;
248 | }
249 |
250 | ${i} object {
251 | outline: 1px solid #00cc99 !important;
252 | }
253 |
254 | ${i} param {
255 | outline: 1px solid #37ffc4 !important;
256 | }
257 |
258 | ${i} video {
259 | outline: 1px solid #6ee866 !important;
260 | }
261 |
262 | ${i} audio {
263 | outline: 1px solid #027353 !important;
264 | }
265 |
266 | ${i} source {
267 | outline: 1px solid #012426 !important;
268 | }
269 |
270 | ${i} canvas {
271 | outline: 1px solid #a2f570 !important;
272 | }
273 |
274 | ${i} track {
275 | outline: 1px solid #59a600 !important;
276 | }
277 |
278 | ${i} map {
279 | outline: 1px solid #7be500 !important;
280 | }
281 |
282 | ${i} area {
283 | outline: 1px solid #305900 !important;
284 | }
285 |
286 | ${i} a {
287 | outline: 1px solid #ff62ab !important;
288 | }
289 |
290 | ${i} em {
291 | outline: 1px solid #800b41 !important;
292 | }
293 |
294 | ${i} strong {
295 | outline: 1px solid #ff1583 !important;
296 | }
297 |
298 | ${i} i {
299 | outline: 1px solid #803156 !important;
300 | }
301 |
302 | ${i} b {
303 | outline: 1px solid #cc1169 !important;
304 | }
305 |
306 | ${i} u {
307 | outline: 1px solid #ff0430 !important;
308 | }
309 |
310 | ${i} s {
311 | outline: 1px solid #f805e3 !important;
312 | }
313 |
314 | ${i} small {
315 | outline: 1px solid #d107b2 !important;
316 | }
317 |
318 | ${i} abbr {
319 | outline: 1px solid #4a0263 !important;
320 | }
321 |
322 | ${i} q {
323 | outline: 1px solid #240018 !important;
324 | }
325 |
326 | ${i} cite {
327 | outline: 1px solid #64003c !important;
328 | }
329 |
330 | ${i} dfn {
331 | outline: 1px solid #b4005a !important;
332 | }
333 |
334 | ${i} sub {
335 | outline: 1px solid #dba0c8 !important;
336 | }
337 |
338 | ${i} sup {
339 | outline: 1px solid #cc0256 !important;
340 | }
341 |
342 | ${i} time {
343 | outline: 1px solid #d6606d !important;
344 | }
345 |
346 | ${i} code {
347 | outline: 1px solid #e04251 !important;
348 | }
349 |
350 | ${i} kbd {
351 | outline: 1px solid #5e001f !important;
352 | }
353 |
354 | ${i} samp {
355 | outline: 1px solid #9c0033 !important;
356 | }
357 |
358 | ${i} var {
359 | outline: 1px solid #d90047 !important;
360 | }
361 |
362 | ${i} mark {
363 | outline: 1px solid #ff0053 !important;
364 | }
365 |
366 | ${i} bdi {
367 | outline: 1px solid #bf3668 !important;
368 | }
369 |
370 | ${i} bdo {
371 | outline: 1px solid #6f1400 !important;
372 | }
373 |
374 | ${i} ruby {
375 | outline: 1px solid #ff7b93 !important;
376 | }
377 |
378 | ${i} rt {
379 | outline: 1px solid #ff2f54 !important;
380 | }
381 |
382 | ${i} rp {
383 | outline: 1px solid #803e49 !important;
384 | }
385 |
386 | ${i} span {
387 | outline: 1px solid #cc2643 !important;
388 | }
389 |
390 | ${i} br {
391 | outline: 1px solid #db687d !important;
392 | }
393 |
394 | ${i} wbr {
395 | outline: 1px solid #db175b !important;
396 | }`}var e=(i,t)=>{let{globals:o}=t,n=[!0,"true"].includes(o[m]),d=t.viewMode==="docs",l=x(()=>s(d?'[data-story-block="true"]':".sb-show-main"),[t]);return f(()=>{let a=d?`addon-outline-docs-${t.id}`:"addon-outline";return n?b(a,l):u(a),()=>{u(a)}},[n,l,t]),i()},g=[e],h={[m]:!1};export{g as decorators,h as globals};
397 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/random-walkers.stories-bef084b1.js:
--------------------------------------------------------------------------------
1 | var u=Object.defineProperty;var g=(t,r,o)=>r in t?u(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var i=(t,r,o)=>(g(t,typeof r!="symbol"?r+"":r,o),o);import{g as k,j as a,F as l,m as w,a as m}from"./index.es-6456b573.js";import{b as x,u as M}from"./react-three-fiber.esm-dca5276d.js";import{S as y,O as b}from"./setup-1d901612.js";import"./index-76fb7be0.js";import"./_commonjsHelpers-de833af9.js";import"./extends-98964cd2.js";const P={title:"React / Random Walkers"};class f extends w{constructor(){super(...arguments);i(this,"walking",this.query(o=>o.has("object3D","walking")))}onUpdate(o){for(const d of this.walking){const{object3D:n}=d;n.position.x+=(Math.random()-.5)*2*o,n.position.y+=(Math.random()-.5)*2*o,n.position.z+=(Math.random()-.5)*2*o,n.rotation.x+=(Math.random()-.5)*2*o,n.rotation.y+=(Math.random()-.5)*2*o,n.rotation.z+=(Math.random()-.5)*2*o}}}const s=new k({components:["object3D","walking"]});s.registerSystem(f);s.init();const{Entity:j,Entities:S,Component:E}=x(s),_=()=>(M((t,r)=>{s.step(r)}),m(l,{children:[Array.from({length:10}).map((t,r)=>a(j,{walking:!0},r)),a(S,{where:t=>t.has("walking"),children:()=>a(E,{name:"object3D",children:m("mesh",{position:[(Math.random()-.5)*4,(Math.random()-.5)*4,(Math.random()-.5)*4],children:[a("boxGeometry",{args:[1,1,1]}),a("meshNormalMaterial",{})]})})}),a(b,{})]})),e=()=>a(l,{children:a(y,{cameraPosition:[0,0,-10],children:a(_,{})})});var p,c,h;e.parameters={...e.parameters,docs:{...(p=e.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
2 | return <>
3 |
4 |
5 |
6 | >;
7 | }`,...(h=(c=e.parameters)==null?void 0:c.docs)==null?void 0:h.source}}};const R=["Example"];export{e as Example,R as __namedExportsOrder,P as default};
8 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/random-walkers.stories-fcd817f3.js:
--------------------------------------------------------------------------------
1 | var x=Object.defineProperty;var E=(t,n,e)=>n in t?x(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var r=(t,n,e)=>(E(t,typeof n!="symbol"?n+"":n,e),e);import{g as C,j as S,m as p}from"./index.es-6456b573.js";import{r as M}from"./index-76fb7be0.js";import"./_commonjsHelpers-de833af9.js";const u=10;class b extends p{constructor(){super(...arguments);r(this,"context",this.singleton("canvasContext"));r(this,"toDraw",this.query(e=>e.with("position").and.any("red","blue")))}onUpdate(){const{ctx:e,width:s,height:o}=this.context;e.clearRect(0,0,s,o);const m=s/2,h=o/2;for(const c of this.toDraw){const{position:{x:w,y:i}}=c,a=c.red?"red":"blue";e.fillStyle=a,e.fillRect(m+(w-u/2),h+(i-u/2),u,u)}}}const l=class l extends p{constructor(){super(...arguments);r(this,"walkers",this.query(e=>e.with("position")));r(this,"movementCountdown",l.timeBetweenMovements)}onUpdate(e){if(this.movementCountdown-=e,this.movementCountdown<=0){for(const s of this.walkers){const{position:o}=s;o.x=o.x+(Math.random()-.5)*3,o.y=o.y+(Math.random()-.5)*3}this.movementCountdown=l.timeBetweenMovements}}};r(l,"timeBetweenMovements",.05);let v=l;class W extends p{constructor(){super(...arguments);r(this,"walkers",this.query(e=>e.some("red","blue")))}onUpdate(){for(const e of this.walkers)Math.random()>=.95&&(e.blue?(this.world.remove(e,"blue"),this.world.add(e,"red",!0)):(this.world.remove(e,"red"),this.world.add(e,"blue",!0)))}}const d=()=>(M.useEffect(()=>{const t=new C({components:["position","red","blue","canvasContext"]});t.registerSystem(v),t.registerSystem(b),t.registerSystem(W);const n=100;for(let i=0;i{s.canvasContext.width=e.width=window.innerWidth,s.canvasContext.height=e.height=window.innerHeight};window.addEventListener("resize",o,!1),o(),t.init();const m=()=>performance.now()/1e3;let h=!0,c=m();const w=()=>{if(!h)return;requestAnimationFrame(w);const i=m(),a=i-c;c=i,t.step(a)};return w(),()=>{h=!1,t.reset()}}),S("canvas",{id:"example-canvas"})),R={name:"Vanilla / Random Walkers",component:d};var y,g,f;d.parameters={...d.parameters,docs:{...(y=d.parameters)==null?void 0:y.docs,source:{originalSource:`() => {
2 | useEffect(() => {
3 | const world = new World({
4 | components: ['position', 'red', 'blue', 'canvasContext']
5 | });
6 | world.registerSystem(WalkSystem);
7 | world.registerSystem(DrawSystem);
8 | world.registerSystem(FlipSystem);
9 |
10 | // how many entities to create
11 | const n = 100;
12 |
13 | // create entities in the World's default
14 | for (let i = 0; i < n; i++) {
15 | const entity: Entity = {
16 | position: {
17 | x: (Math.random() - 0.5) * 300,
18 | y: (Math.random() - 0.5) * 300
19 | }
20 | };
21 | if (i % 2 === 0) {
22 | entity.red = true;
23 | } else {
24 | entity.blue = true;
25 | }
26 | world.create(entity);
27 | }
28 |
29 | // create an entity with a component containing the canvas context
30 | const canvasElement = (document.querySelector('#example-canvas') as HTMLCanvasElement);
31 | canvasElement.width = window.innerWidth;
32 | canvasElement.height = window.innerHeight;
33 | const canvasEntity = {
34 | canvasContext: {
35 | ctx: canvasElement.getContext('2d')!,
36 | width: canvasElement.width,
37 | height: canvasElement.height
38 | }
39 | };
40 | world.create(canvasEntity);
41 |
42 | // handle resizing
43 | const resize = () => {
44 | canvasEntity.canvasContext.width = canvasElement.width = window.innerWidth;
45 | canvasEntity.canvasContext.height = canvasElement.height = window.innerHeight;
46 | };
47 | window.addEventListener('resize', resize, false);
48 | resize();
49 | world.init();
50 | const now = () => performance.now() / 1000;
51 | let running = true;
52 | let lastTime = now();
53 | const update = () => {
54 | if (!running) return;
55 | requestAnimationFrame(update);
56 | const time = now();
57 | const delta = time - lastTime;
58 | lastTime = time;
59 | world.step(delta);
60 | };
61 | update();
62 | return () => {
63 | running = false;
64 | world.reset();
65 | };
66 | });
67 | return ;
68 | }`,...(f=(g=d.parameters)==null?void 0:g.docs)==null?void 0:f.source}}};const T=["RandomColorChangingWalkers"];export{d as RandomColorChangingWalkers,T as __namedExportsOrder,R as default};
69 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/react-18-ce37f4e2.js:
--------------------------------------------------------------------------------
1 | import{R as s,r as n}from"./index-76fb7be0.js";import{c as u}from"./client-8a8da4b9.js";var o=new Map,c=({callback:e,children:t})=>{let r=n.useRef();return n.useLayoutEffect(()=>{r.current!==e&&(r.current=e,e())},[e]),t},R=async(e,t)=>{let r=await m(t);return new Promise(a=>{r.render(s.createElement(c,{callback:()=>a(null)},e))})},p=(e,t)=>{let r=o.get(e);r&&(r.unmount(),o.delete(e))},m=async e=>{let t=o.get(e);return t||(t=u.createRoot(e),o.set(e,t)),t};export{R as r,p as u};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/selection.stories-7431ac8e.js:
--------------------------------------------------------------------------------
1 | var k=Object.defineProperty;var v=(r,e,o)=>e in r?k(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var i=(r,e,o)=>(v(r,typeof e!="symbol"?e+"":e,o),o);import{g as C,j as t,F as p,m as D,a as y}from"./index.es-6456b573.js";import{b as E,V as u,u as L}from"./react-three-fiber.esm-dca5276d.js";import{r as h}from"./index-76fb7be0.js";import{S as w}from"./setup-1d901612.js";import{B as F,P}from"./Bounds-a89dda79.js";import"./_commonjsHelpers-de833af9.js";import"./extends-98964cd2.js";const N={title:"React / Selection"};class _ extends D{constructor(){super(...arguments);i(this,"selectedQuery",this.query(o=>o.has("selected","object3D")));i(this,"camera",this.singleton("camera",{required:!0}));i(this,"lerpedLookAt",new u(0,0,0))}onUpdate(o){const s=this.selectedQuery.entities.map(n=>n.object3D),c=new u(0,0,0);if(s.length>0){for(const n of s)c.add(n.position);c.divideScalar(s.length)}this.lerpedLookAt=this.lerpedLookAt.lerp(c,10*o),this.camera.lookAt(this.lerpedLookAt)}}const a=new C({components:["object3D","camera","selected"]});a.registerSystem(_);a.init();const{useCurrentEntity:B,Component:b,Entity:A}=E(a),O=r=>{const e=B(),[o,s]=h.useState(!1),[c,n]=h.useState(!1),j=()=>{e&&(e.selected?(a.remove(e,"selected"),s(!1)):(a.add(e,"selected",!0),s(!0)))};let m;return c?m=o?"#FFD580":"#999":m=o?"orange":"#555",t(b,{name:"object3D",children:y("mesh",{...r,onClick:j,onPointerOver:()=>n(!0),onPointerOut:()=>n(!1),children:[t("boxGeometry",{args:[1,1,1]}),t("meshStandardMaterial",{color:m})]})})},f=10,l=10,q=Array.from({length:f*l},(r,e)=>{const o=e%l-(l-1)/2,s=Math.floor(e/l)-(f-1)/2;return[o*1.5,s*1.5,0]}),M=()=>t(p,{children:q.map((r,e)=>t(A,{children:t(O,{position:r})},e))}),Q=()=>t(A,{children:t(b,{name:"camera",children:t(P,{makeDefault:!0,fov:30,position:[0,0,30]})})}),V=()=>(L((r,e)=>{a.step(e)}),y(p,{children:[t(Q,{}),t(F,{fit:!0,clip:!0,observe:!0,children:t(M,{})}),t("ambientLight",{intensity:1.5}),t("directionalLight",{intensity:3,position:[5,10,5]})]})),d=()=>t(p,{children:t(w,{controls:!1,lights:!1,children:t(V,{})})});var g,S,x;d.parameters={...d.parameters,docs:{...(g=d.parameters)==null?void 0:g.docs,source:{originalSource:`() => {
2 | return <>
3 |
4 |
5 |
6 | >;
7 | }`,...(x=(S=d.parameters)==null?void 0:S.docs)==null?void 0:x.source}}};const T=["Example"];export{d as Example,T as __namedExportsOrder,N as default};
8 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/syntaxhighlighter-V7JZZA35-2abe4516.js:
--------------------------------------------------------------------------------
1 | import{S as d,c as f,s as g}from"./DocsRenderer-NNNQARDV-a9823a9d.js";import"./iframe-45bb0dfa.js";import"../sb-preview/runtime.js";import"./index-76fb7be0.js";import"./_commonjsHelpers-de833af9.js";import"./react-18-ce37f4e2.js";import"./client-8a8da4b9.js";import"./index-11d98b33.js";import"./extends-98964cd2.js";import"./_getPrototype-1e53b583.js";import"./index-356e4a49.js";export{d as SyntaxHighlighter,f as createCopyToClipboardFunction,g as default};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/assets/timeline-composer.esm-08db1a3e.js:
--------------------------------------------------------------------------------
1 | import{r as f,R as o}from"./index-76fb7be0.js";var h=function(e,t){f.useEffect(function(){var n,a,i=function l(u){n=requestAnimationFrame(l),a||(a=u);var c=u-a,s=b(c/1e3);a=u,e(s)};return n=requestAnimationFrame(i),function(){cancelAnimationFrame(n)}},t)},A=function(e,t,n){return Math.min(Math.max(e,t),n)},b=function(e){return A(e,0,1)};function _(r){if(Array.isArray(r))return r}function g(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],a=!0,i=!1,l,u;try{for(t=t.call(r);!(a=(l=t.next()).done)&&(n.push(l.value),!(e&&n.length===e));a=!0);}catch(c){i=!0,u=c}finally{try{!a&&t.return!=null&&t.return()}finally{if(i)throw u}}return n}}function m(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t
2 |
6 |
7 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @storybook/cli - Storybook
7 |
8 |
9 |
10 |
11 |
12 |
19 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
101 |
102 |
103 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/index.json:
--------------------------------------------------------------------------------
1 | {"v":4,"entries":{"react-existing-world--existing-world":{"type":"story","id":"react-existing-world--existing-world","name":"Existing World","title":"React / Existing World","importPath":"./stories/react/existing-world.stories.tsx","tags":["story"]},"react-external-physics-library--example":{"type":"story","id":"react-external-physics-library--example","name":"Example","title":"React / External Physics Library","importPath":"./stories/react/external-physics-library.stories.tsx","tags":["story"]},"react-pong--pong":{"type":"story","id":"react-pong--pong","name":"Pong","title":"React / Pong","importPath":"./stories/react/pong.stories.tsx","tags":["story"]},"react-random-walkers--example":{"type":"story","id":"react-random-walkers--example","name":"Example","title":"React / Random Walkers","importPath":"./stories/react/random-walkers.stories.tsx","tags":["story"]},"react-selection--example":{"type":"story","id":"react-selection--example","name":"Example","title":"React / Selection","importPath":"./stories/react/selection.stories.tsx","tags":["story"]},"vanilla-find-the-bomb--find-the-bomb":{"type":"story","id":"vanilla-find-the-bomb--find-the-bomb","name":"Find The Bomb","title":"vanilla/find-the-bomb","importPath":"./stories/vanilla/find-the-bomb/find-the-bomb.stories.tsx","tags":["story"]},"vanilla-overlapping-circles--overlapping-circles":{"type":"story","id":"vanilla-overlapping-circles--overlapping-circles","name":"Overlapping Circles","title":"vanilla/overlapping-circles","importPath":"./stories/vanilla/overlapping-circles/overlapping-circles.stories.tsx","tags":["story"]},"vanilla-random-walkers--random-color-changing-walkers":{"type":"story","id":"vanilla-random-walkers--random-color-changing-walkers","name":"Random Color Changing Walkers","title":"vanilla/random-walkers","importPath":"./stories/vanilla/random-walkers.stories.tsx","tags":["story"]}}}
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/project.json:
--------------------------------------------------------------------------------
1 | {"generatedAt":1701581987389,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"monorepo":"Workspaces","packageManager":{"type":"yarn","version":"3.4.1"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"7.6.3","storybookVersionSpecifier":"^7.6.3","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"7.6.3"},"@storybook/addon-interactions":{"version":"7.6.3"},"@storybook/addon-links":{"version":"7.6.3"},"@storybook/addon-onboarding":{"version":"1.0.9"},"@storybook/blocks":{"version":"7.6.3"},"@storybook/react":{"version":"7.6.3"},"@storybook/react-vite":{"version":"7.6.3"},"@storybook/testing-library":{"version":"0.2.2"},"eslint-plugin-storybook":{"version":"0.6.13"},"storybook":{"version":"7.6.3"}},"addons":{"$SNIP/node_modules/@storybook/addon-links":{"version":null},"$SNIP/node_modules/@storybook/addon-essentials":{"version":null},"$SNIP/node_modules/@storybook/addon-onboarding":{"version":null},"$SNIP/node_modules/@storybook/addon-interactions":{"version":null}}}
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js:
--------------------------------------------------------------------------------
1 | try{
2 | (()=>{var te=Object.create;var F=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var x=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var B=(e,t)=>()=>(e&&(t=e(e=0)),t);var ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var se=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ne(t))!ie.call(e,i)&&i!==s&&F(e,i,{get:()=>t[i],enumerable:!(o=re(t,i))||o.enumerable});return e};var le=(e,t,s)=>(s=e!=null?te(oe(e)):{},se(t||!e||!e.__esModule?F(s,"default",{value:e,enumerable:!0}):s,e));var d=B(()=>{});var m=B(()=>{});var p=B(()=>{});var j=ae(($,G)=>{d();m();p();(function(e){if(typeof $=="object"&&typeof G<"u")G.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"||typeof window<"u"?t=window:typeof self<"u"?t=self:t=this,t.memoizerific=e()}})(function(){var e,t,s;return function o(i,g,l){function n(a,h){if(!g[a]){if(!i[a]){var c=typeof x=="function"&&x;if(!h&&c)return c(a,!0);if(r)return r(a,!0);var y=new Error("Cannot find module '"+a+"'");throw y.code="MODULE_NOT_FOUND",y}var f=g[a]={exports:{}};i[a][0].call(f.exports,function(b){var _=i[a][1][b];return n(_||b)},f,f.exports,o,i,g,l)}return g[a].exports}for(var r=typeof x=="function"&&x,u=0;u=0)return this.lastItem=this.list[r],this.list[r].val},l.prototype.set=function(n,r){var u;return this.lastItem&&this.isEqual(this.lastItem.key,n)?(this.lastItem.val=r,this):(u=this.indexOf(n),u>=0?(this.lastItem=this.list[u],this.list[u].val=r,this):(this.lastItem={key:n,val:r},this.list.push(this.lastItem),this.size++,this))},l.prototype.delete=function(n){var r;if(this.lastItem&&this.isEqual(this.lastItem.key,n)&&(this.lastItem=void 0),r=this.indexOf(n),r>=0)return this.size--,this.list.splice(r,1)[0]},l.prototype.has=function(n){var r;return this.lastItem&&this.isEqual(this.lastItem.key,n)?!0:(r=this.indexOf(n),r>=0?(this.lastItem=this.list[r],!0):!1)},l.prototype.forEach=function(n,r){var u;for(u=0;u0&&(R[k]={cacheItem:b,arg:arguments[k]},C?n(c,R):c.push(R),c.length>a&&r(c.shift())),f.wasMemoized=C,f.numArgs=k+1,A};return f.limit=a,f.wasMemoized=!1,f.cache=h,f.lru=c,f}};function n(a,h){var c=a.length,y=h.length,f,b,_;for(b=0;b=0&&(c=a[f],y=c.cacheItem.get(c.arg),!y||!y.size);f--)c.cacheItem.delete(c.arg)}function u(a,h){return a===h||a!==a&&h!==h}},{"map-or-similar":1}]},{},[3])(3)})});d();m();p();d();m();p();d();m();p();d();m();p();var v=__REACT__,{Children:Te,Component:Se,Fragment:w,Profiler:ke,PureComponent:Ie,StrictMode:Ee,Suspense:Ce,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:xe,cloneElement:Ae,createContext:Re,createElement:Be,createFactory:we,createRef:Le,forwardRef:Me,isValidElement:Pe,lazy:Ne,memo:L,useCallback:K,useContext:Ge,useDebugValue:ze,useEffect:De,useImperativeHandle:qe,useLayoutEffect:He,useMemo:Y,useReducer:Fe,useRef:Ke,useState:W,version:Ye}=__REACT__;d();m();p();var Ve=__STORYBOOK_API__,{ActiveTabs:Ze,Consumer:Je,ManagerContext:Qe,Provider:Xe,addons:M,combineParameters:et,controlOrMetaKey:tt,controlOrMetaSymbol:rt,eventMatchesShortcut:nt,eventToShortcut:ot,isMacLike:it,isShortcutTaken:at,keyToSymbol:st,merge:lt,mockChannel:ut,optionOrAltSymbol:ct,shortcutMatchesShortcut:ft,shortcutToHumanString:dt,types:U,useAddonState:mt,useArgTypes:pt,useArgs:ht,useChannel:gt,useGlobalTypes:bt,useGlobals:P,useParameter:N,useSharedState:yt,useStoryPrepared:_t,useStorybookApi:vt,useStorybookState:Ot}=__STORYBOOK_API__;var H=le(j());d();m();p();var Rt=__STORYBOOK_CLIENT_LOGGER__,{deprecate:Bt,logger:z,once:wt,pretty:Lt}=__STORYBOOK_CLIENT_LOGGER__;d();m();p();var zt=__STORYBOOK_COMPONENTS__,{A:Dt,ActionBar:qt,AddonPanel:Ht,Badge:Ft,Bar:Kt,Blockquote:Yt,Button:Wt,ClipboardCode:Ut,Code:$t,DL:jt,Div:Vt,DocumentWrapper:Zt,ErrorFormatter:Jt,FlexBar:Qt,Form:Xt,H1:er,H2:tr,H3:rr,H4:nr,H5:or,H6:ir,HR:ar,IconButton:D,IconButtonSkeleton:sr,Icons:q,Img:lr,LI:ur,Link:cr,ListItem:fr,Loader:dr,OL:mr,P:pr,Placeholder:hr,Pre:gr,ResetWrapper:br,ScrollArea:yr,Separator:_r,Spaced:vr,Span:Or,StorybookIcon:Tr,StorybookLogo:Sr,Symbols:kr,SyntaxHighlighter:Ir,TT:Er,TabBar:Cr,TabButton:xr,TabWrapper:Ar,Table:Rr,Tabs:Br,TabsState:wr,TooltipLinkList:V,TooltipMessage:Lr,TooltipNote:Mr,UL:Pr,WithTooltip:Z,WithTooltipPure:Nr,Zoom:Gr,codeCommon:zr,components:Dr,createCopyToClipboardFunction:qr,getStoryHref:Hr,icons:Fr,interleaveSeparators:Kr,nameSpaceClassNames:Yr,resetComponents:Wr,withReset:Ur}=__STORYBOOK_COMPONENTS__;d();m();p();var Jr=__STORYBOOK_THEMING__,{CacheProvider:Qr,ClassNames:Xr,Global:en,ThemeProvider:tn,background:rn,color:nn,convert:on,create:an,createCache:sn,createGlobal:ln,createReset:un,css:cn,darken:fn,ensure:dn,ignoreSsrWarning:mn,isPropValid:pn,jsx:hn,keyframes:gn,lighten:bn,styled:J,themes:yn,typography:_n,useTheme:vn,withTheme:On}=__STORYBOOK_THEMING__;d();m();p();var En=(()=>{let e;return typeof window<"u"?e=window:typeof globalThis<"u"?e=globalThis:typeof window<"u"?e=window:typeof self<"u"?e=self:e={},e})();d();m();p();function Q(e){for(var t=[],s=1;s({borderRadius:"1rem",display:"block",height:"1rem",width:"1rem",background:e}),({theme:e})=>({boxShadow:`${e.appBorderColor} 0 0 0 1px inset`})),ce=(e,t=[],s)=>{if(e==="transparent")return"transparent";if(t.find(i=>i.value===e))return e;let o=t.find(i=>i.name===s);if(o)return o.value;if(s){let i=t.map(g=>g.name).join(", ");z.warn(Q`
8 | Backgrounds Addon: could not find the default color "${s}".
9 | These are the available colors for your story based on your configuration:
10 | ${i}.
11 | `)}return"transparent"},ee=(0,H.default)(1e3)((e,t,s,o,i,g)=>({id:e||t,title:t,onClick:()=>{i({selected:s,name:t})},value:s,right:o?v.createElement(ue,{background:s}):void 0,active:g})),fe=(0,H.default)(10)((e,t,s)=>{let o=e.map(({name:i,value:g})=>ee(null,i,g,!0,s,g===t));return t!=="transparent"?[ee("reset","Clear background","transparent",null,s,!1),...o]:o}),de={default:null,disable:!0,values:[]},me=L(function(){let e=N(E,de),[t,s]=W(!1),[o,i]=P(),g=o[E]?.value,l=Y(()=>ce(g,e.values,e.default),[e,g]);Array.isArray(e)&&z.warn("Addon Backgrounds api has changed in Storybook 6.0. Please refer to the migration guide: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md");let n=K(r=>{i({[E]:{...o[E],value:r}})},[e,o,i]);return e.disable?null:v.createElement(w,null,v.createElement(Z,{placement:"top",closeOnOutsideClick:!0,tooltip:({onHide:r})=>v.createElement(V,{links:fe(e.values,l,({selected:u})=>{l!==u&&n(u),r()})}),onVisibleChange:s},v.createElement(D,{key:"background",title:"Change the background of the preview",active:l!=="transparent"||t},v.createElement(q,{icon:"photo"}))))}),pe=L(function(){let[e,t]=P(),{grid:s}=N(E,{grid:{disable:!1}});if(s?.disable)return null;let o=e[E]?.grid||!1;return v.createElement(D,{key:"background",active:o,title:"Apply a grid to the preview",onClick:()=>t({[E]:{...e[E],grid:!o}})},v.createElement(q,{icon:"grid"}))});M.register(X,()=>{M.add(X,{title:"Backgrounds",type:U.TOOL,match:({viewMode:e})=>!!(e&&e.match(/^(story|docs)$/)),render:()=>v.createElement(w,null,v.createElement(me,null),v.createElement(pe,null))})});})();
12 | }catch(e){ console.error("[Storybook] One of your manager-entries failed: " + import.meta.url, e); }
13 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
1 | Bundled license information:
2 |
3 | telejson/dist/index.mjs:
4 | /*!
5 | * isobject
6 | *
7 | * Copyright (c) 2014-2017, Jon Schlinkert.
8 | * Released under the MIT License.
9 | */
10 | /**
11 | * @license
12 | * Lodash (Custom Build)
13 | * Build: `lodash modularize exports="es" -o ./`
14 | * Copyright OpenJS Foundation and other contributors
15 | * Released under MIT license
16 | * Based on Underscore.js 1.8.3
17 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
18 | */
19 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js:
--------------------------------------------------------------------------------
1 | try{
2 | (()=>{var r=__REACT__,{Children:A,Component:I,Fragment:R,Profiler:L,PureComponent:M,StrictMode:B,Suspense:P,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:x,cloneElement:v,createContext:H,createElement:N,createFactory:D,createRef:F,forwardRef:W,isValidElement:K,lazy:Y,memo:G,useCallback:m,useContext:w,useDebugValue:U,useEffect:p,useImperativeHandle:V,useLayoutEffect:q,useMemo:z,useReducer:Z,useRef:$,useState:j,version:J}=__REACT__;var oe=__STORYBOOK_API__,{ActiveTabs:re,Consumer:ae,ManagerContext:ne,Provider:se,addons:l,combineParameters:le,controlOrMetaKey:ue,controlOrMetaSymbol:ce,eventMatchesShortcut:ie,eventToShortcut:me,isMacLike:pe,isShortcutTaken:Se,keyToSymbol:_e,merge:de,mockChannel:Te,optionOrAltSymbol:be,shortcutMatchesShortcut:Oe,shortcutToHumanString:ye,types:S,useAddonState:Ce,useArgTypes:Ee,useArgs:he,useChannel:fe,useGlobalTypes:ge,useGlobals:_,useParameter:ke,useSharedState:Ae,useStoryPrepared:Ie,useStorybookApi:d,useStorybookState:Re}=__STORYBOOK_API__;var xe=__STORYBOOK_COMPONENTS__,{A:ve,ActionBar:He,AddonPanel:Ne,Badge:De,Bar:Fe,Blockquote:We,Button:Ke,ClipboardCode:Ye,Code:Ge,DL:we,Div:Ue,DocumentWrapper:Ve,ErrorFormatter:qe,FlexBar:ze,Form:Ze,H1:$e,H2:je,H3:Je,H4:Qe,H5:Xe,H6:et,HR:tt,IconButton:T,IconButtonSkeleton:ot,Icons:b,Img:rt,LI:at,Link:nt,ListItem:st,Loader:lt,OL:ut,P:ct,Placeholder:it,Pre:mt,ResetWrapper:pt,ScrollArea:St,Separator:_t,Spaced:dt,Span:Tt,StorybookIcon:bt,StorybookLogo:Ot,Symbols:yt,SyntaxHighlighter:Ct,TT:Et,TabBar:ht,TabButton:ft,TabWrapper:gt,Table:kt,Tabs:At,TabsState:It,TooltipLinkList:Rt,TooltipMessage:Lt,TooltipNote:Mt,UL:Bt,WithTooltip:Pt,WithTooltipPure:xt,Zoom:vt,codeCommon:Ht,components:Nt,createCopyToClipboardFunction:Dt,getStoryHref:Ft,icons:Wt,interleaveSeparators:Kt,nameSpaceClassNames:Yt,resetComponents:Gt,withReset:wt}=__STORYBOOK_COMPONENTS__;var u="storybook/measure-addon",O=`${u}/tool`,y=()=>{let[a,c]=_(),{measureEnabled:n}=a,i=d(),s=m(()=>c({measureEnabled:!n}),[c,n]);return p(()=>{i.setAddonShortcut(u,{label:"Toggle Measure [M]",defaultShortcut:["M"],actionName:"measure",showInMenu:!1,action:s})},[s,i]),r.createElement(T,{key:O,active:n,title:"Enable measure",onClick:s},r.createElement(b,{icon:"ruler"}))};l.register(u,()=>{l.add(O,{type:S.TOOL,title:"Measure",match:({viewMode:a})=>a==="story",render:()=>r.createElement(y,null)})});})();
3 | }catch(e){ console.error("[Storybook] One of your manager-entries failed: " + import.meta.url, e); }
4 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js:
--------------------------------------------------------------------------------
1 | try{
2 | (()=>{var a=__REACT__,{Children:k,Component:I,Fragment:B,Profiler:L,PureComponent:P,StrictMode:v,Suspense:x,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:M,cloneElement:H,createContext:N,createElement:D,createFactory:F,createRef:K,forwardRef:W,isValidElement:Y,lazy:G,memo:i,useCallback:p,useContext:w,useDebugValue:U,useEffect:m,useImperativeHandle:V,useLayoutEffect:q,useMemo:z,useReducer:Z,useRef:$,useState:j,version:J}=__REACT__;var oe=__STORYBOOK_API__,{ActiveTabs:re,Consumer:ae,ManagerContext:ne,Provider:le,addons:s,combineParameters:se,controlOrMetaKey:ue,controlOrMetaSymbol:ce,eventMatchesShortcut:ie,eventToShortcut:pe,isMacLike:me,isShortcutTaken:Se,keyToSymbol:_e,merge:de,mockChannel:Te,optionOrAltSymbol:Oe,shortcutMatchesShortcut:be,shortcutToHumanString:ye,types:S,useAddonState:Ce,useArgTypes:he,useArgs:Ae,useChannel:fe,useGlobalTypes:Ee,useGlobals:_,useParameter:ge,useSharedState:Re,useStoryPrepared:ke,useStorybookApi:d,useStorybookState:Ie}=__STORYBOOK_API__;var xe=__STORYBOOK_COMPONENTS__,{A:Me,ActionBar:He,AddonPanel:Ne,Badge:De,Bar:Fe,Blockquote:Ke,Button:We,ClipboardCode:Ye,Code:Ge,DL:we,Div:Ue,DocumentWrapper:Ve,ErrorFormatter:qe,FlexBar:ze,Form:Ze,H1:$e,H2:je,H3:Je,H4:Qe,H5:Xe,H6:et,HR:tt,IconButton:T,IconButtonSkeleton:ot,Icons:O,Img:rt,LI:at,Link:nt,ListItem:lt,Loader:st,OL:ut,P:ct,Placeholder:it,Pre:pt,ResetWrapper:mt,ScrollArea:St,Separator:_t,Spaced:dt,Span:Tt,StorybookIcon:Ot,StorybookLogo:bt,Symbols:yt,SyntaxHighlighter:Ct,TT:ht,TabBar:At,TabButton:ft,TabWrapper:Et,Table:gt,Tabs:Rt,TabsState:kt,TooltipLinkList:It,TooltipMessage:Bt,TooltipNote:Lt,UL:Pt,WithTooltip:vt,WithTooltipPure:xt,Zoom:Mt,codeCommon:Ht,components:Nt,createCopyToClipboardFunction:Dt,getStoryHref:Ft,icons:Kt,interleaveSeparators:Wt,nameSpaceClassNames:Yt,resetComponents:Gt,withReset:wt}=__STORYBOOK_COMPONENTS__;var u="storybook/outline",b="outline",C=i(function(){let[r,y]=_(),c=d(),n=[!0,"true"].includes(r[b]),l=p(()=>y({[b]:!n}),[n]);return m(()=>{c.setAddonShortcut(u,{label:"Toggle Outline [O]",defaultShortcut:["O"],actionName:"outline",showInMenu:!1,action:l})},[l,c]),a.createElement(T,{key:"outline",active:n,title:"Apply outlines to the preview",onClick:l},a.createElement(O,{icon:"outline"}))});s.register(u,()=>{s.add(u,{title:"Outline",type:S.TOOL,match:({viewMode:r})=>!!(r&&r.match(/^(story|docs)$/)),render:()=>a.createElement(C,null)})});})();
3 | }catch(e){ console.error("[Storybook] One of your manager-entries failed: " + import.meta.url, e); }
4 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js:
--------------------------------------------------------------------------------
1 | try{
2 | (()=>{var l=__REACT__,{Children:le,Component:ne,Fragment:ie,Profiler:se,PureComponent:ce,StrictMode:ue,Suspense:me,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pe,cloneElement:de,createContext:be,createElement:Se,createFactory:Te,createRef:ye,forwardRef:_e,isValidElement:fe,lazy:Ce,memo:ve,useCallback:v,useContext:Ie,useDebugValue:Oe,useEffect:E,useImperativeHandle:xe,useLayoutEffect:Ee,useMemo:ge,useReducer:he,useRef:L,useState:R,version:ke}=__REACT__;var Pe=__STORYBOOK_API__,{ActiveTabs:Me,Consumer:Ne,ManagerContext:we,Provider:He,addons:g,combineParameters:Ve,controlOrMetaKey:De,controlOrMetaSymbol:Fe,eventMatchesShortcut:Ge,eventToShortcut:We,isMacLike:Ke,isShortcutTaken:Ye,keyToSymbol:$e,merge:ze,mockChannel:Ue,optionOrAltSymbol:je,shortcutMatchesShortcut:qe,shortcutToHumanString:Ze,types:B,useAddonState:Je,useArgTypes:Qe,useArgs:Xe,useChannel:et,useGlobalTypes:P,useGlobals:h,useParameter:tt,useSharedState:ot,useStoryPrepared:rt,useStorybookApi:M,useStorybookState:at}=__STORYBOOK_API__;var ct=__STORYBOOK_COMPONENTS__,{A:ut,ActionBar:mt,AddonPanel:pt,Badge:dt,Bar:bt,Blockquote:St,Button:Tt,ClipboardCode:yt,Code:_t,DL:ft,Div:Ct,DocumentWrapper:vt,ErrorFormatter:It,FlexBar:Ot,Form:xt,H1:Et,H2:gt,H3:ht,H4:kt,H5:At,H6:Lt,HR:Rt,IconButton:N,IconButtonSkeleton:Bt,Icons:k,Img:Pt,LI:Mt,Link:Nt,ListItem:wt,Loader:Ht,OL:Vt,P:Dt,Placeholder:Ft,Pre:Gt,ResetWrapper:Wt,ScrollArea:Kt,Separator:w,Spaced:Yt,Span:$t,StorybookIcon:zt,StorybookLogo:Ut,Symbols:jt,SyntaxHighlighter:qt,TT:Zt,TabBar:Jt,TabButton:Qt,TabWrapper:Xt,Table:eo,Tabs:to,TabsState:oo,TooltipLinkList:H,TooltipMessage:ro,TooltipNote:ao,UL:lo,WithTooltip:V,WithTooltipPure:no,Zoom:io,codeCommon:so,components:co,createCopyToClipboardFunction:uo,getStoryHref:mo,icons:po,interleaveSeparators:bo,nameSpaceClassNames:So,resetComponents:To,withReset:yo}=__STORYBOOK_COMPONENTS__;var G=({active:o,title:t,icon:e,description:r,onClick:a})=>l.createElement(N,{active:o,title:r,onClick:a},e&&l.createElement(k,{icon:e}),t?`\xA0${t}`:null),W=["reset"],K=o=>o.filter(t=>!W.includes(t.type)).map(t=>t.value),b="addon-toolbars",Y=async(o,t,e)=>{e&&e.next&&await o.setAddonShortcut(b,{label:e.next.label,defaultShortcut:e.next.keys,actionName:`${t}:next`,action:e.next.action}),e&&e.previous&&await o.setAddonShortcut(b,{label:e.previous.label,defaultShortcut:e.previous.keys,actionName:`${t}:previous`,action:e.previous.action}),e&&e.reset&&await o.setAddonShortcut(b,{label:e.reset.label,defaultShortcut:e.reset.keys,actionName:`${t}:reset`,action:e.reset.action})},$=o=>t=>{let{id:e,toolbar:{items:r,shortcuts:a}}=t,d=M(),[S,i]=h(),n=L([]),s=S[e],I=v(()=>{i({[e]:""})},[i]),O=v(()=>{let p=n.current,c=p.indexOf(s),m=c===p.length-1?0:c+1,T=n.current[m];i({[e]:T})},[n,s,i]),u=v(()=>{let p=n.current,c=p.indexOf(s),m=c>-1?c:0,T=m===0?p.length-1:m-1,y=n.current[T];i({[e]:y})},[n,s,i]);return E(()=>{a&&Y(d,e,{next:{...a.next,action:O},previous:{...a.previous,action:u},reset:{...a.reset,action:I}})},[d,e,a,O,u,I]),E(()=>{n.current=K(r)},[]),l.createElement(o,{cycleValues:n.current,...t})},D=({currentValue:o,items:t})=>o!=null&&t.find(e=>e.value===o&&e.type!=="reset"),z=({currentValue:o,items:t})=>{let e=D({currentValue:o,items:t});if(e)return e.icon},U=({currentValue:o,items:t})=>{let e=D({currentValue:o,items:t});if(e)return e.title},j=({left:o,right:t,title:e,value:r,icon:a,hideIcon:d,onClick:S,currentValue:i})=>{let n=a&&l.createElement(k,{style:{opacity:1},icon:a}),s={id:r??"_reset",active:i===r,right:t,title:e,left:o,onClick:S};return a&&!d&&(s.left=n),s},q=$(({id:o,name:t,description:e,toolbar:{icon:r,items:a,title:d,preventDynamicIcon:S,dynamicTitle:i}})=>{let[n,s]=h(),[I,O]=R(!1),u=n[o],p=!!u,c=r,m=d;S||(c=z({currentValue:u,items:a})||c),i&&(m=U({currentValue:u,items:a})||m),!m&&!c&&console.warn(`Toolbar '${t}' has no title or icon`);let T=v(y=>{s({[o]:y})},[u,s]);return l.createElement(V,{placement:"top",tooltip:({onHide:y})=>{let F=a.filter(({type:x})=>{let A=!0;return x==="reset"&&!u&&(A=!1),A}).map(x=>j({...x,currentValue:u,onClick:()=>{T(x.value),y()}}));return l.createElement(H,{links:F})},closeOnOutsideClick:!0,onVisibleChange:O},l.createElement(G,{active:I||p,description:e||"",icon:c,title:m||""}))}),Z={type:"item",value:""},J=(o,t)=>({...t,name:t.name||o,description:t.description||o,toolbar:{...t.toolbar,items:t.toolbar.items.map(e=>{let r=typeof e=="string"?{value:e,title:e}:e;return r.type==="reset"&&t.toolbar.icon&&(r.icon=t.toolbar.icon,r.hideIcon=!0),{...Z,...r}})}}),Q=()=>{let o=P(),t=Object.keys(o).filter(e=>!!o[e].toolbar);return t.length?l.createElement(l.Fragment,null,l.createElement(w,null),t.map(e=>{let r=J(e,o[e]);return l.createElement(q,{key:e,id:e,...r})})):null};g.register(b,()=>g.add(b,{title:b,type:B.TOOL,match:()=>!0,render:()=>l.createElement(Q,null)}));})();
3 | }catch(e){ console.error("[Storybook] One of your manager-entries failed: " + import.meta.url, e); }
4 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/interactions-9/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/interactions-9/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/links-0/manager-bundle.js:
--------------------------------------------------------------------------------
1 | try{
2 | (()=>{var _=__STORYBOOK_API__,{ActiveTabs:h,Consumer:A,ManagerContext:E,Provider:b,addons:a,combineParameters:O,controlOrMetaKey:p,controlOrMetaSymbol:k,eventMatchesShortcut:v,eventToShortcut:g,isMacLike:I,isShortcutTaken:C,keyToSymbol:M,merge:P,mockChannel:R,optionOrAltSymbol:f,shortcutMatchesShortcut:x,shortcutToHumanString:D,types:G,useAddonState:K,useArgTypes:V,useArgs:$,useChannel:B,useGlobalTypes:N,useGlobals:Q,useParameter:U,useSharedState:Y,useStoryPrepared:q,useStorybookApi:H,useStorybookState:L}=__STORYBOOK_API__;var e="storybook/links",n={NAVIGATE:`${e}/navigate`,REQUEST:`${e}/request`,RECEIVE:`${e}/receive`};a.register(e,t=>{t.on(n.REQUEST,({kind:u,name:S})=>{let c=t.storyId(u,S);t.emit(n.RECEIVE,c)})});})();
3 | }catch(e){ console.error("[Storybook] One of your manager-entries failed: " + import.meta.url, e); }
4 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-addons/onboarding-8/manager-bundle.js.LEGAL.txt:
--------------------------------------------------------------------------------
1 | Bundled license information:
2 |
3 | @storybook/addon-onboarding/dist/manager.mjs:
4 | /*! Bundled license information:
5 |
6 | exenv/index.js:
7 | (*!
8 | Copyright (c) 2015 Jed Watson.
9 | Based on code that is Copyright 2013-2015, Facebook, Inc.
10 | All rights reserved.
11 | *)
12 |
13 | react-is/cjs/react-is.production.min.js:
14 | (** @license React v16.13.1
15 | * react-is.production.min.js
16 | *
17 | * Copyright (c) Facebook, Inc. and its affiliates.
18 | *
19 | * This source code is licensed under the MIT license found in the
20 | * LICENSE file in the root directory of this source tree.
21 | *)
22 |
23 | popper.js/dist/esm/popper.js:
24 | (**!
25 | * @fileOverview Kickass library to create and place poppers near their reference elements.
26 | * @version 1.16.1
27 | * @license
28 | * Copyright (c) 2016 Federico Zivolo and contributors
29 | *
30 | * Permission is hereby granted, free of charge, to any person obtaining a copy
31 | * of this software and associated documentation files (the "Software"), to deal
32 | * in the Software without restriction, including without limitation the rights
33 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34 | * copies of the Software, and to permit persons to whom the Software is
35 | * furnished to do so, subject to the following conditions:
36 | *
37 | * The above copyright notice and this permission notice shall be included in all
38 | * copies or substantial portions of the Software.
39 | *
40 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46 | * SOFTWARE.
47 | *)
48 | */
49 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-common-assets/fonts.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Nunito Sans';
3 | font-style: normal;
4 | font-weight: 400;
5 | font-display: swap;
6 | src: url('./nunito-sans-regular.woff2') format('woff2');
7 | }
8 |
9 | @font-face {
10 | font-family: 'Nunito Sans';
11 | font-style: italic;
12 | font-weight: 400;
13 | font-display: swap;
14 | src: url('./nunito-sans-italic.woff2') format('woff2');
15 | }
16 |
17 | @font-face {
18 | font-family: 'Nunito Sans';
19 | font-style: normal;
20 | font-weight: 700;
21 | font-display: swap;
22 | src: url('./nunito-sans-bold.woff2') format('woff2');
23 | }
24 |
25 | @font-face {
26 | font-family: 'Nunito Sans';
27 | font-style: italic;
28 | font-weight: 700;
29 | font-display: swap;
30 | src: url('./nunito-sans-bold-italic.woff2') format('woff2');
31 | }
32 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-common-assets/nunito-sans-bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-common-assets/nunito-sans-bold.woff2
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-common-assets/nunito-sans-italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-common-assets/nunito-sans-italic.woff2
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-common-assets/nunito-sans-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/isaac-mason/arancini/61c705d8db350497a4ccf32859cea91c1f69ffc0/packages/arancini/storybook-static/sb-common-assets/nunito-sans-regular.woff2
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js:
--------------------------------------------------------------------------------
1 | import{WithToolTipState,WithTooltipPure}from"./chunk-NGTUFCUO.js";import"./chunk-INSKDKQB.js";import"./chunk-ZEU7PDD3.js";export{WithToolTipState,WithToolTipState as WithTooltip,WithTooltipPure};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-manager/chunk-ZEU7PDD3.js:
--------------------------------------------------------------------------------
1 | var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_memoizerific=__commonJS({"../../node_modules/memoizerific/memoizerific.js"(exports,module){(function(f){if(typeof exports=="object"&&typeof module<"u")module.exports=f();else if(typeof define=="function"&&define.amd)define([],f);else{var g;typeof window<"u"?g=window:typeof global<"u"?g=global:typeof self<"u"?g=self:g=this,g.memoizerific=f()}})(function(){var define2,module2,exports2;return function e(t,n,r){function s(o2,u){if(!n[o2]){if(!t[o2]){var a=typeof __require=="function"&&__require;if(!u&&a)return a(o2,!0);if(i)return i(o2,!0);var f=new Error("Cannot find module '"+o2+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o2]={exports:{}};t[o2][0].call(l.exports,function(e2){var n2=t[o2][1][e2];return s(n2||e2)},l,l.exports,e,t,n,r)}return n[o2].exports}for(var i=typeof __require=="function"&&__require,o=0;o=0)return this.lastItem=this.list[index],this.list[index].val},Similar.prototype.set=function(key,val){var index;return this.lastItem&&this.isEqual(this.lastItem.key,key)?(this.lastItem.val=val,this):(index=this.indexOf(key),index>=0?(this.lastItem=this.list[index],this.list[index].val=val,this):(this.lastItem={key,val},this.list.push(this.lastItem),this.size++,this))},Similar.prototype.delete=function(key){var index;if(this.lastItem&&this.isEqual(this.lastItem.key,key)&&(this.lastItem=void 0),index=this.indexOf(key),index>=0)return this.size--,this.list.splice(index,1)[0]},Similar.prototype.has=function(key){var index;return this.lastItem&&this.isEqual(this.lastItem.key,key)?!0:(index=this.indexOf(key),index>=0?(this.lastItem=this.list[index],!0):!1)},Similar.prototype.forEach=function(callback,thisArg){var i;for(i=0;i0&&(lruPath[argsLengthMinusOne]={cacheItem:currentCache,arg:arguments[argsLengthMinusOne]},isMemoized?moveToMostRecentLru(lru,lruPath):lru.push(lruPath),lru.length>limit&&removeCachedResult(lru.shift())),memoizerific.wasMemoized=isMemoized,memoizerific.numArgs=argsLengthMinusOne+1,fnResult};return memoizerific.limit=limit,memoizerific.wasMemoized=!1,memoizerific.cache=cache,memoizerific.lru=lru,memoizerific}};function moveToMostRecentLru(lru,lruPath){var lruLen=lru.length,lruPathLen=lruPath.length,isMatch,i,ii;for(i=0;i=0&&(currentLru=removedLru[i],tmp=currentLru.cacheItem.get(currentLru.arg),!tmp||!tmp.size);i--)currentLru.cacheItem.delete(currentLru.arg)}function isEqual(val1,val2){return val1===val2||val1!==val1&&val2!==val2}},{"map-or-similar":1}]},{},[3])(3)})}});var __create2=Object.create,__defProp2=Object.defineProperty,__getOwnPropDesc2=Object.getOwnPropertyDescriptor,__getOwnPropNames2=Object.getOwnPropertyNames,__getProtoOf2=Object.getPrototypeOf,__hasOwnProp2=Object.prototype.hasOwnProperty,__commonJS2=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames2(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports},__copyProps2=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames2(from))!__hasOwnProp2.call(to,key)&&key!==except&&__defProp2(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc2(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create2(__getProtoOf2(mod)):{},__copyProps2(isNodeMode||!mod||!mod.__esModule?__defProp2(target,"default",{value:mod,enumerable:!0}):target,mod));export{__esm,__commonJS,__export,__toESM,__toCommonJS,require_memoizerific,__commonJS2,__toESM2};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-manager/globals-module-info.js:
--------------------------------------------------------------------------------
1 | var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var globals_module_info_exports={};__export(globals_module_info_exports,{globalsModuleInfoMap:()=>globalsModuleInfoMap});module.exports=__toCommonJS(globals_module_info_exports);var exports_default={react:["Children","Component","Fragment","Profiler","PureComponent","StrictMode","Suspense","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","cloneElement","createContext","createElement","createFactory","createRef","forwardRef","isValidElement","lazy","memo","useCallback","useContext","useDebugValue","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useReducer","useRef","useState","version"],"react-dom":["__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","createPortal","findDOMNode","flushSync","hydrate","render","unmountComponentAtNode","unstable_batchedUpdates","unstable_createPortal","unstable_renderSubtreeIntoContainer","version"],"@storybook/components":["A","ActionBar","AddonPanel","Badge","Bar","Blockquote","Button","ClipboardCode","Code","DL","Div","DocumentWrapper","ErrorFormatter","FlexBar","Form","H1","H2","H3","H4","H5","H6","HR","IconButton","IconButtonSkeleton","Icons","Img","LI","Link","ListItem","Loader","OL","P","Placeholder","Pre","ResetWrapper","ScrollArea","Separator","Spaced","Span","StorybookIcon","StorybookLogo","Symbols","SyntaxHighlighter","TT","TabBar","TabButton","TabWrapper","Table","Tabs","TabsState","TooltipLinkList","TooltipMessage","TooltipNote","UL","WithTooltip","WithTooltipPure","Zoom","codeCommon","components","createCopyToClipboardFunction","getStoryHref","icons","interleaveSeparators","nameSpaceClassNames","resetComponents","withReset"],"@storybook/channels":["Channel","PostMessageTransport","WebsocketTransport","createBrowserChannel","createPostMessageChannel","createWebSocketChannel"],"@storybook/core-events":["CHANNEL_CREATED","CONFIG_ERROR","CURRENT_STORY_WAS_SET","DOCS_PREPARED","DOCS_RENDERED","FORCE_REMOUNT","FORCE_RE_RENDER","GLOBALS_UPDATED","IGNORED_EXCEPTION","NAVIGATE_URL","PLAY_FUNCTION_THREW_EXCEPTION","PRELOAD_ENTRIES","PREVIEW_BUILDER_PROGRESS","PREVIEW_KEYDOWN","REGISTER_SUBSCRIPTION","REQUEST_WHATS_NEW_DATA","RESET_STORY_ARGS","RESULT_WHATS_NEW_DATA","SELECT_STORY","SET_CONFIG","SET_CURRENT_STORY","SET_GLOBALS","SET_INDEX","SET_STORIES","SET_WHATS_NEW_CACHE","SHARED_STATE_CHANGED","SHARED_STATE_SET","STORIES_COLLAPSE_ALL","STORIES_EXPAND_ALL","STORY_ARGS_UPDATED","STORY_CHANGED","STORY_ERRORED","STORY_INDEX_INVALIDATED","STORY_MISSING","STORY_PREPARED","STORY_RENDERED","STORY_RENDER_PHASE_CHANGED","STORY_SPECIFIED","STORY_THREW_EXCEPTION","STORY_UNCHANGED","TELEMETRY_ERROR","TOGGLE_WHATS_NEW_NOTIFICATIONS","UPDATE_GLOBALS","UPDATE_QUERY_PARAMS","UPDATE_STORY_ARGS"],"@storybook/router":["BaseLocationProvider","DEEPLY_EQUAL","Link","Location","LocationProvider","Match","Route","buildArgsParam","deepDiff","getMatch","parsePath","queryFromLocation","queryFromString","stringifyQuery","useNavigate"],"@storybook/theming":["CacheProvider","ClassNames","Global","ThemeProvider","background","color","convert","create","createCache","createGlobal","createReset","css","darken","ensure","ignoreSsrWarning","isPropValid","jsx","keyframes","lighten","styled","themes","typography","useTheme","withTheme"],"@storybook/api":["ActiveTabs","Consumer","ManagerContext","Provider","addons","combineParameters","controlOrMetaKey","controlOrMetaSymbol","eventMatchesShortcut","eventToShortcut","isMacLike","isShortcutTaken","keyToSymbol","merge","mockChannel","optionOrAltSymbol","shortcutMatchesShortcut","shortcutToHumanString","types","useAddonState","useArgTypes","useArgs","useChannel","useGlobalTypes","useGlobals","useParameter","useSharedState","useStoryPrepared","useStorybookApi","useStorybookState"],"@storybook/manager-api":["ActiveTabs","Consumer","ManagerContext","Provider","addons","combineParameters","controlOrMetaKey","controlOrMetaSymbol","eventMatchesShortcut","eventToShortcut","isMacLike","isShortcutTaken","keyToSymbol","merge","mockChannel","optionOrAltSymbol","shortcutMatchesShortcut","shortcutToHumanString","types","useAddonState","useArgTypes","useArgs","useChannel","useGlobalTypes","useGlobals","useParameter","useSharedState","useStoryPrepared","useStorybookApi","useStorybookState"],"@storybook/addons":["addons","types","mockChannel"],"@storybook/client-logger":["deprecate","logger","once","pretty"],"@storybook/types":["Addon_TypesEnum"]};var globalsNameReferenceMap={react:"__REACT__","react-dom":"__REACT_DOM__","@storybook/components":"__STORYBOOK_COMPONENTS__","@storybook/channels":"__STORYBOOK_CHANNELS__","@storybook/core-events":"__STORYBOOK_CORE_EVENTS__","@storybook/router":"__STORYBOOK_ROUTER__","@storybook/theming":"__STORYBOOK_THEMING__","@storybook/api":"__STORYBOOK_API__","@storybook/manager-api":"__STORYBOOK_API__","@storybook/addons":"__STORYBOOK_ADDONS__","@storybook/client-logger":"__STORYBOOK_CLIENT_LOGGER__","@storybook/types":"__STORYBOOK_TYPES__"},globalPackages=Object.keys(globalsNameReferenceMap);var globalsModuleInfoMap=globalPackages.reduce((acc,key)=>(acc[key]={type:"esm",varName:globalsNameReferenceMap[key],namedExports:exports_default[key],defaultExport:!0},acc),{});0&&(module.exports={globalsModuleInfoMap});
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-manager/globals.js:
--------------------------------------------------------------------------------
1 | var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var globals_exports={};__export(globals_exports,{globalPackages:()=>globalPackages,globalsNameReferenceMap:()=>globalsNameReferenceMap});module.exports=__toCommonJS(globals_exports);var globalsNameReferenceMap={react:"__REACT__","react-dom":"__REACT_DOM__","@storybook/components":"__STORYBOOK_COMPONENTS__","@storybook/channels":"__STORYBOOK_CHANNELS__","@storybook/core-events":"__STORYBOOK_CORE_EVENTS__","@storybook/router":"__STORYBOOK_ROUTER__","@storybook/theming":"__STORYBOOK_THEMING__","@storybook/api":"__STORYBOOK_API__","@storybook/manager-api":"__STORYBOOK_API__","@storybook/addons":"__STORYBOOK_ADDONS__","@storybook/client-logger":"__STORYBOOK_CLIENT_LOGGER__","@storybook/types":"__STORYBOOK_TYPES__"},globalPackages=Object.keys(globalsNameReferenceMap);0&&(module.exports={globalPackages,globalsNameReferenceMap});
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-manager/runtime.js:
--------------------------------------------------------------------------------
1 | import{CHANNEL_CREATED,Provider,TELEMETRY_ERROR,UncaughtManagerError,addons,createBrowserChannel,dist_exports as dist_exports2,dist_exports2 as dist_exports3,dist_exports3 as dist_exports4,dist_exports4 as dist_exports5,dist_exports5 as dist_exports6,dist_exports6 as dist_exports8,mockChannel,renderStorybookUI,typesX}from"./chunk-MF5WFFGF.js";import"./chunk-2IXBUOFS.js";import"./chunk-NGTUFCUO.js";import{dist_exports,dist_exports2 as dist_exports7,require_react,require_react_dom,scope}from"./chunk-INSKDKQB.js";import{__commonJS,__toESM}from"./chunk-ZEU7PDD3.js";var require_browser_dtector_umd_min=__commonJS({"../../node_modules/browser-dtector/browser-dtector.umd.min.js"(exports,module){(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self).BrowserDetector=o()})(exports,function(){"use strict";function e(e2,o2){for(var r2=0;r21&&arguments[1]!==void 0?arguments[1]:-1,"})?")),r2=Number(e2).toString().match(o2);return r2?r2[0]:null},i=function(){return typeof window<"u"?window.navigator:null},t=function(){function t2(e2){var o2;(function(e3,o3){if(!(e3 instanceof o3))throw new TypeError("Cannot call a class as a function")})(this,t2),this.userAgent=e2||((o2=i())===null||o2===void 0?void 0:o2.userAgent)||null}var a,l,s;return a=t2,l=[{key:"parseUserAgent",value:function(e2){var t3,a2,l2,s2={},c=e2||this.userAgent||"",d=c.toLowerCase().replace(/\s\s+/g," "),u=/(edge)\/([\w.]+)/.exec(d)||/(edg)[/]([\w.]+)/.exec(d)||/(opr)[/]([\w.]+)/.exec(d)||/(opt)[/]([\w.]+)/.exec(d)||/(fxios)[/]([\w.]+)/.exec(d)||/(edgios)[/]([\w.]+)/.exec(d)||/(jsdom)[/]([\w.]+)/.exec(d)||/(samsungbrowser)[/]([\w.]+)/.exec(d)||/(electron)[/]([\w.]+)/.exec(d)||/(chrome)[/]([\w.]+)/.exec(d)||/(crios)[/]([\w.]+)/.exec(d)||/(opios)[/]([\w.]+)/.exec(d)||/(version)(applewebkit)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(d)||/(webkit)[/]([\w.]+).*(version)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(d)||/(applewebkit)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(d)||/(webkit)[/]([\w.]+)/.exec(d)||/(opera)(?:.*version|)[/]([\w.]+)/.exec(d)||/(msie) ([\w.]+)/.exec(d)||/(fennec)[/]([\w.]+)/.exec(d)||d.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(d)||d.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(d)||[],f=/(ipad)/.exec(d)||/(ipod)/.exec(d)||/(iphone)/.exec(d)||/(jsdom)/.exec(d)||/(windows phone)/.exec(d)||/(xbox)/.exec(d)||/(win)/.exec(d)||/(tablet)/.exec(d)||/(android)/.test(d)&&/(mobile)/.test(d)===!1&&["androidTablet"]||/(android)/.exec(d)||/(mac)/.exec(d)||/(linux)/.exec(d)||/(cros)/.exec(d)||[],p=u[5]||u[3]||u[1]||null,w=f[0]||null,x=u[4]||u[2]||null,b=i();p==="chrome"&&typeof(b==null||(t3=b.brave)===null||t3===void 0?void 0:t3.isBrave)=="function"&&(p="brave"),p&&(s2[p]=!0),w&&(s2[w]=!0);var v=!!(s2.tablet||s2.android||s2.androidTablet),m=!!(s2.ipad||s2.tablet||s2.androidTablet),g=!!(s2.android||s2.androidTablet||s2.tablet||s2.ipad||s2.ipod||s2.iphone||s2["windows phone"]),h=!!(s2.cros||s2.mac||s2.linux||s2.win),y=!!(s2.brave||s2.chrome||s2.crios||s2.opr||s2.safari||s2.edg||s2.electron),A=!!(s2.msie||s2.rv);return{name:(a2=o[p])!==null&&a2!==void 0?a2:null,platform:(l2=r[w])!==null&&l2!==void 0?l2:null,userAgent:c,version:x,shortVersion:x?n(parseFloat(x),2):null,isAndroid:v,isTablet:m,isMobile:g,isDesktop:h,isWebkit:y,isIE:A}}},{key:"getBrowserInfo",value:function(){var e2=this.parseUserAgent();return{name:e2.name,platform:e2.platform,userAgent:e2.userAgent,version:e2.version,shortVersion:e2.shortVersion}}}],s=[{key:"VERSION",get:function(){return"3.4.0"}}],l&&e(a.prototype,l),s&&e(a,s),Object.defineProperty(a,"prototype",{writable:!1}),t2}();return t})}});var REACT=__toESM(require_react()),REACT_DOM=__toESM(require_react_dom());var globalsNameValueMap={react:REACT,"react-dom":REACT_DOM,"@storybook/components":dist_exports8,"@storybook/channels":dist_exports5,"@storybook/core-events":dist_exports3,"@storybook/router":dist_exports2,"@storybook/theming":dist_exports7,"@storybook/api":dist_exports6,"@storybook/manager-api":dist_exports6,"@storybook/addons":{addons,types:typesX,mockChannel},"@storybook/client-logger":dist_exports,"@storybook/types":dist_exports4};var globalsNameReferenceMap={react:"__REACT__","react-dom":"__REACT_DOM__","@storybook/components":"__STORYBOOK_COMPONENTS__","@storybook/channels":"__STORYBOOK_CHANNELS__","@storybook/core-events":"__STORYBOOK_CORE_EVENTS__","@storybook/router":"__STORYBOOK_ROUTER__","@storybook/theming":"__STORYBOOK_THEMING__","@storybook/api":"__STORYBOOK_API__","@storybook/manager-api":"__STORYBOOK_API__","@storybook/addons":"__STORYBOOK_ADDONS__","@storybook/client-logger":"__STORYBOOK_CLIENT_LOGGER__","@storybook/types":"__STORYBOOK_TYPES__"},globalPackages=Object.keys(globalsNameReferenceMap);var import_browser_dtector=__toESM(require_browser_dtector_umd_min()),browserInfo;function getBrowserInfo(){return browserInfo||(browserInfo=new import_browser_dtector.default(scope.navigator?.userAgent).getBrowserInfo()),browserInfo}var errorMessages=["ResizeObserver loop completed with undelivered notifications.","ResizeObserver loop limit exceeded","Script error."],shouldSkipError=error=>errorMessages.includes(error?.message);function prepareForTelemetry(originalError){let error=originalError;return(originalError.target===scope||originalError.currentTarget===scope||originalError.srcElement===scope)&&(error=new Error(originalError.message),error.name=originalError.name||error.name),originalError.fromStorybook||(error=new UncaughtManagerError({error})),error.browserInfo=getBrowserInfo(),error}var{FEATURES,CONFIG_TYPE}=scope,ReactProvider=class extends Provider{constructor(){super();let channel=createBrowserChannel({page:"manager"});addons.setChannel(channel),channel.emit(CHANNEL_CREATED),this.addons=addons,this.channel=channel,scope.__STORYBOOK_ADDONS_CHANNEL__=channel,FEATURES?.storyStoreV7&&CONFIG_TYPE==="DEVELOPMENT"&&(this.serverChannel=this.channel,addons.setServerChannel(this.serverChannel))}getElements(type){return this.addons.getElements(type)}getConfig(){return this.addons.getConfig()}handleAPI(api){this.addons.loadAddons(api)}};globalPackages.forEach(key=>{scope[globalsNameReferenceMap[key]]=globalsNameValueMap[key]});scope.sendTelemetryError=error=>{shouldSkipError(error)||scope.__STORYBOOK_ADDONS_CHANNEL__.emit(TELEMETRY_ERROR,prepareForTelemetry(error))};scope.addEventListener("error",args=>{let error=args.error||args;scope.sendTelemetryError(error)});scope.addEventListener("unhandledrejection",({reason})=>{scope.sendTelemetryError(reason)});var{document}=scope,rootEl=document.getElementById("root");renderStorybookUI(rootEl,new ReactProvider);
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js:
--------------------------------------------------------------------------------
1 | import{SyntaxHighlighter2,createCopyToClipboardFunction,syntaxhighlighter_default}from"./chunk-2IXBUOFS.js";import"./chunk-INSKDKQB.js";import"./chunk-ZEU7PDD3.js";export{SyntaxHighlighter2 as SyntaxHighlighter,createCopyToClipboardFunction,syntaxhighlighter_default as default};
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/sb-preview/globals.js:
--------------------------------------------------------------------------------
1 | "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var globals_exports={};__export(globals_exports,{globalPackages:()=>globalPackages,globalsNameReferenceMap:()=>globalsNameReferenceMap});module.exports=__toCommonJS(globals_exports);var globalsNameReferenceMap={"@storybook/addons":"__STORYBOOK_MODULE_ADDONS__","@storybook/global":"__STORYBOOK_MODULE_GLOBAL__","@storybook/channel-postmessage":"__STORYBOOK_MODULE_CHANNEL_POSTMESSAGE__","@storybook/channel-websocket":"__STORYBOOK_MODULE_CHANNEL_WEBSOCKET__","@storybook/channels":"__STORYBOOK_MODULE_CHANNELS__","@storybook/client-api":"__STORYBOOK_MODULE_CLIENT_API__","@storybook/client-logger":"__STORYBOOK_MODULE_CLIENT_LOGGER__","@storybook/core-client":"__STORYBOOK_MODULE_CORE_CLIENT__","@storybook/core-events":"__STORYBOOK_MODULE_CORE_EVENTS__","@storybook/preview-web":"__STORYBOOK_MODULE_PREVIEW_WEB__","@storybook/preview-api":"__STORYBOOK_MODULE_PREVIEW_API__","@storybook/store":"__STORYBOOK_MODULE_STORE__","@storybook/types":"__STORYBOOK_MODULE_TYPES__"},globalPackages=Object.keys(globalsNameReferenceMap);0&&(module.exports={globalPackages,globalsNameReferenceMap});
2 |
--------------------------------------------------------------------------------
/packages/arancini/storybook-static/stories.json:
--------------------------------------------------------------------------------
1 | {"v":3,"stories":{"react-existing-world--existing-world":{"id":"react-existing-world--existing-world","name":"Existing World","title":"React / Existing World","importPath":"./stories/react/existing-world.stories.tsx","tags":["story"],"kind":"React / Existing World","story":"Existing World","parameters":{"__id":"react-existing-world--existing-world","docsOnly":false,"fileName":"./stories/react/existing-world.stories.tsx"}},"react-external-physics-library--example":{"id":"react-external-physics-library--example","name":"Example","title":"React / External Physics Library","importPath":"./stories/react/external-physics-library.stories.tsx","tags":["story"],"kind":"React / External Physics Library","story":"Example","parameters":{"__id":"react-external-physics-library--example","docsOnly":false,"fileName":"./stories/react/external-physics-library.stories.tsx"}},"react-pong--pong":{"id":"react-pong--pong","name":"Pong","title":"React / Pong","importPath":"./stories/react/pong.stories.tsx","tags":["story"],"kind":"React / Pong","story":"Pong","parameters":{"__id":"react-pong--pong","docsOnly":false,"fileName":"./stories/react/pong.stories.tsx"}},"react-random-walkers--example":{"id":"react-random-walkers--example","name":"Example","title":"React / Random Walkers","importPath":"./stories/react/random-walkers.stories.tsx","tags":["story"],"kind":"React / Random Walkers","story":"Example","parameters":{"__id":"react-random-walkers--example","docsOnly":false,"fileName":"./stories/react/random-walkers.stories.tsx"}},"react-selection--example":{"id":"react-selection--example","name":"Example","title":"React / Selection","importPath":"./stories/react/selection.stories.tsx","tags":["story"],"kind":"React / Selection","story":"Example","parameters":{"__id":"react-selection--example","docsOnly":false,"fileName":"./stories/react/selection.stories.tsx"}},"vanilla-find-the-bomb--find-the-bomb":{"id":"vanilla-find-the-bomb--find-the-bomb","name":"Find The Bomb","title":"vanilla/find-the-bomb","importPath":"./stories/vanilla/find-the-bomb/find-the-bomb.stories.tsx","tags":["story"],"kind":"vanilla/find-the-bomb","story":"Find The Bomb","parameters":{"__id":"vanilla-find-the-bomb--find-the-bomb","docsOnly":false,"fileName":"./stories/vanilla/find-the-bomb/find-the-bomb.stories.tsx"}},"vanilla-overlapping-circles--overlapping-circles":{"id":"vanilla-overlapping-circles--overlapping-circles","name":"Overlapping Circles","title":"vanilla/overlapping-circles","importPath":"./stories/vanilla/overlapping-circles/overlapping-circles.stories.tsx","tags":["story"],"kind":"vanilla/overlapping-circles","story":"Overlapping Circles","parameters":{"__id":"vanilla-overlapping-circles--overlapping-circles","docsOnly":false,"fileName":"./stories/vanilla/overlapping-circles/overlapping-circles.stories.tsx"}},"vanilla-random-walkers--random-color-changing-walkers":{"id":"vanilla-random-walkers--random-color-changing-walkers","name":"Random Color Changing Walkers","title":"vanilla/random-walkers","importPath":"./stories/vanilla/random-walkers.stories.tsx","tags":["story"],"kind":"vanilla/random-walkers","story":"Random Color Changing Walkers","parameters":{"__id":"vanilla-random-walkers--random-color-changing-walkers","docsOnly":false,"fileName":"./stories/vanilla/random-walkers.stories.tsx"}}}}
2 |
--------------------------------------------------------------------------------
/packages/arancini/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2022",
4 | "useDefineForClassFields": true,
5 | "module": "ES2022",
6 | "lib": ["ES2022", "DOM"],
7 | "moduleResolution": "Node",
8 | "strict": true,
9 | "resolveJsonModule": true,
10 | "isolatedModules": true,
11 | "esModuleInterop": true,
12 | "noEmit": true,
13 | "declaration": true,
14 | "noUnusedLocals": true,
15 | "noUnusedParameters": true,
16 | "noImplicitReturns": true,
17 | "skipLibCheck": true,
18 | "baseUrl": "./",
19 | "rootDir": "./src",
20 | "allowSyntheticDefaultImports": true,
21 | "jsx": "react-jsx",
22 | "outDir": "."
23 | },
24 | "include": ["./src"],
25 | "files": ["./src/index.ts", "./src/react.ts"],
26 | "exclude": ["./dist"]
27 | }
28 |
--------------------------------------------------------------------------------