├── .changeset └── config.json ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.yml │ └── feature-request.yml └── workflows │ ├── codeql.yml │ ├── format.yml │ ├── release.yml │ └── tests.yml ├── .gitignore ├── .gitpod.yml ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vscode └── extensions.json ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── assets ├── badges │ ├── stage-0.json │ ├── stage-1.json │ ├── stage-2.json │ ├── stage-3.json │ └── stage-4.json ├── banner.png └── img │ ├── foo.svg │ ├── logo.svg │ ├── npm-monochrome.svg │ ├── pnpm-duplicate.svg │ ├── pnpm-monochrome.svg │ ├── solid-blocks-heading-0.svg │ ├── solid-blocks-heading-1.svg │ ├── solid-blocks-heading-2.svg │ ├── solid-blocks-heading-left-block.svg │ ├── solid-blocks-heading-mid-block-shadow.svg │ ├── solid-blocks-heading-mid-block.svg │ ├── solid-blocks-heading-right-block.svg │ ├── solid-blocks-heading.svg │ ├── solid-squares.webp │ └── yarn-monochrome.svg ├── configs └── vitest.config.ts ├── eslint.config.mjs ├── netlify.toml ├── package.json ├── packages ├── active-element │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ └── utils.ts │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── analytics │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── ga.ts │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── audio │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ ├── sample1.mp3 │ │ ├── sample2.mp3 │ │ └── sample3.mp3 │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── autofocus │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.tsx │ └── tsconfig.json ├── bounds │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── broadcast-channel │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── hooks │ │ │ └── useTrackPages.tsx │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── clipboard │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── img.png │ │ ├── img2.png │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── connectivity │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── context │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.tsx │ │ └── server.test.tsx │ └── tsconfig.json ├── controlled-props │ ├── CHANGELOG.md │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.tsx │ ├── test │ │ └── testProps.test.tsx │ └── tsconfig.json ├── cookies │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── cursor │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── App.tsx │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── date │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ ├── lib.tsx │ │ └── utils.ts │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── primitives.ts │ │ ├── types.ts │ │ ├── utils.ts │ │ └── variables.ts │ ├── test │ │ ├── date-difference.test.ts │ │ ├── date-now.test.ts │ │ └── utils.test.ts │ └── tsconfig.json ├── db-store │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── README.md │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── supabase-mock.ts │ └── tsconfig.json ├── deep │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── store-updates.ts │ │ ├── track-deep.ts │ │ └── track-store.ts │ ├── test │ │ ├── track.bench.ts │ │ ├── track.test.ts │ │ └── updates.test.ts │ └── tsconfig.json ├── destructure │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── destructure.test.ts │ └── tsconfig.json ├── devices │ ├── CHANGELOG.md │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── event-bus │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── emitter.ts │ │ ├── eventBus.ts │ │ ├── eventHub.ts │ │ ├── eventStack.ts │ │ ├── index.ts │ │ └── utils.ts │ ├── test │ │ ├── emitter.test.ts │ │ ├── eventBus.test.ts │ │ ├── eventHub.test.ts │ │ ├── eventStack.test.ts │ │ └── utils.test.ts │ └── tsconfig.json ├── event-dispatcher │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ └── utils.ts │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── event-listener │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── components.tsx │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── callbackWrappers.ts │ │ ├── components.ts │ │ ├── eventListener.ts │ │ ├── eventListenerMap.ts │ │ ├── eventListenerStack.ts │ │ ├── index.ts │ │ └── types.ts │ ├── test │ │ ├── event-listener-map.test.ts │ │ ├── event-listener.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── event-props │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── fetch │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── cache.ts │ │ ├── fetch.ts │ │ ├── index.ts │ │ ├── modifiers.ts │ │ └── request.ts │ ├── test │ │ ├── index.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── filesystem │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── adapter-mocks.ts │ │ ├── adapter-node.ts │ │ ├── adapter-tauri.ts │ │ ├── adapter-vfs.ts │ │ ├── adapter-web.ts │ │ ├── index.ts │ │ ├── reactive.ts │ │ ├── tools.ts │ │ ├── types.ts │ │ └── watcher-chokidar.ts │ ├── test │ │ ├── fsaccess-mock.ts │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── tauri-mock.ts │ └── tsconfig.json ├── flux-store │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── components │ │ │ ├── BoxesDemo.tsx │ │ │ ├── CounterButton.tsx │ │ │ ├── CounterControls.tsx │ │ │ └── index.ts │ │ ├── index.tsx │ │ └── stores │ │ │ ├── ages-store.ts │ │ │ └── counter-store.ts │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.tsx │ └── tsconfig.json ├── fullscreen │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── geolocation │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── client.tsx │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── gestures │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── core.ts │ │ ├── index.ts │ │ ├── pan.ts │ │ ├── pinch.ts │ │ ├── rotate.ts │ │ ├── swipe.ts │ │ └── tap.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── graphql │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── codegen.yml │ │ ├── gqlgen.ts │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── history │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── i18n │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── en.ts │ │ ├── es.ts │ │ ├── fr.ts │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.tsx │ └── tsconfig.json ├── idle │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── createIdleTimer.ts │ │ ├── index.ts │ │ └── types.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── immutable │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── input-mask │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.tsx │ └── tsconfig.json ├── intersection-observer │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── jsx-tokenizer │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.tsx │ │ └── server.test.tsx │ └── tsconfig.json ├── keyboard │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── keyed │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── entries.tsx │ │ ├── index.tsx │ │ ├── key.tsx │ │ ├── mapEntries.tsx │ │ └── setValues.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.tsx │ └── tsconfig.json ├── lifecycle │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── list │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.bench.tsx │ │ └── index.test.tsx │ └── tsconfig.json ├── map │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── marker │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── masonry │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── media │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ └── style.css │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── memo │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── async.tsx │ │ ├── cache.tsx │ │ ├── grouped.tsx │ │ ├── index.tsx │ │ ├── lazy-suspense.tsx │ │ ├── lazy.tsx │ │ └── writable-page.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── async.test.ts │ │ ├── cache.test.ts │ │ ├── cachedDerivation.test.disabled.ts │ │ ├── latest.test.ts │ │ ├── lazy.test.ts │ │ ├── pureReaction.test.ts │ │ ├── reducer.test.ts │ │ └── writable.test.ts │ └── tsconfig.json ├── mouse │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── components.tsx │ │ ├── index.tsx │ │ └── utils.ts │ ├── package.json │ ├── src │ │ ├── common.ts │ │ ├── index.ts │ │ ├── primitives.ts │ │ └── types.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── mutable │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── dev.test.ts │ │ ├── modifiers.test.ts │ │ ├── mutable.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── mutation-observer │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── components.tsx │ │ ├── index.tsx │ │ └── utils.ts │ ├── index.html │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── page-visibility │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── pagination │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── permission │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── platform │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── server.test.ts │ └── tsconfig.json ├── pointer │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── helpers.ts │ │ ├── index.ts │ │ └── types.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── presence │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── createPresence.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── promise │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── intex.test.ts │ └── tsconfig.json ├── props │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── combineProps.ts │ │ ├── filterProps.ts │ │ ├── index.ts │ │ └── propTraps.ts │ ├── test │ │ ├── combineProps.test.ts │ │ └── filterProps.test.ts │ └── tsconfig.json ├── raf │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ └── raf.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── range │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── common.ts │ │ ├── index.ts │ │ ├── indexRange.ts │ │ ├── mapRange.ts │ │ └── repeat.ts │ ├── test │ │ ├── indexRange.test.ts │ │ ├── mapRange.test.ts │ │ └── repeat.test.ts │ └── tsconfig.json ├── refs │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── mergeRefs.test.tsx │ │ └── server.test.tsx │ └── tsconfig.json ├── resize-observer │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── resource │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── rootless │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── root-pool.test.ts │ └── tsconfig.json ├── scheduled │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ ├── reactive.tsx │ │ └── timeline.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── create-scheduled.test.ts │ │ ├── debounce.test.ts │ │ ├── server.test.ts │ │ └── throttle.test.ts │ └── tsconfig.json ├── script-loader │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── scroll │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── selection │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.tsx │ └── tsconfig.json ├── set │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── share │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── networks.ts │ │ ├── social-share.ts │ │ └── web-share.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── signal-builders │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── array.ts │ │ ├── convert.ts │ │ ├── index.ts │ │ ├── number.ts │ │ ├── object.ts │ │ ├── string.ts │ │ └── update.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── spring │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── state-machine │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── static-store │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── storage │ ├── CHANGELOG.md │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── cookies.ts │ │ ├── index.ts │ │ ├── persisted.ts │ │ ├── tauri.ts │ │ └── tools.ts │ ├── tauri-storage │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── extensions.json │ │ ├── README.md │ │ ├── index.html │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src-tauri │ │ │ ├── .gitignore │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── capabilities │ │ │ │ └── default.json │ │ │ ├── icons │ │ │ │ ├── 128x128.png │ │ │ │ ├── 128x128@2x.png │ │ │ │ ├── 32x32.png │ │ │ │ ├── Square107x107Logo.png │ │ │ │ ├── Square142x142Logo.png │ │ │ │ ├── Square150x150Logo.png │ │ │ │ ├── Square284x284Logo.png │ │ │ │ ├── Square30x30Logo.png │ │ │ │ ├── Square310x310Logo.png │ │ │ │ ├── Square44x44Logo.png │ │ │ │ ├── Square71x71Logo.png │ │ │ │ ├── Square89x89Logo.png │ │ │ │ ├── StoreLogo.png │ │ │ │ ├── icon.icns │ │ │ │ ├── icon.ico │ │ │ │ └── icon.png │ │ │ ├── src │ │ │ │ └── main.rs │ │ │ └── tauri.conf.json │ │ ├── src │ │ │ ├── App.tsx │ │ │ ├── index.tsx │ │ │ ├── styles.css │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.node.json │ │ └── vite.config.ts │ ├── test │ │ ├── cookies.test.ts │ │ ├── persisted.test.ts │ │ ├── tauri.test.ts │ │ └── tools.test.ts │ └── tsconfig.json ├── stream │ ├── CHANGELOG.md │ ├── README.md │ ├── demo │ │ ├── index.html │ │ ├── index.tsx │ │ └── vite.config.ts │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ ├── server.test.ts │ │ └── setup.ts │ └── tsconfig.json ├── styles │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── timer │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── transition-group │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ ├── index.tsx │ │ ├── list-page.tsx │ │ └── switch-page.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── list-transition.test.ts │ │ ├── server.test.ts │ │ └── switch-transition.test.ts │ └── tsconfig.json ├── trigger │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── tween │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ └── index.test.ts │ └── tsconfig.json ├── upload │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ ├── createDropzone.ts │ │ ├── createFileUploader.ts │ │ ├── helpers.ts │ │ ├── index.ts │ │ └── types.ts │ ├── test │ │ └── index.test.tsx │ └── tsconfig.json ├── utils │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── immutable │ │ │ ├── array.ts │ │ │ ├── copy.ts │ │ │ ├── index.ts │ │ │ ├── number.ts │ │ │ ├── object.ts │ │ │ ├── types.ts │ │ │ └── update.ts │ │ ├── index.ts │ │ └── types.ts │ ├── test │ │ ├── immutable.test.ts │ │ ├── index.test.ts │ │ └── server.test.ts │ └── tsconfig.json ├── virtual │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.tsx │ ├── test │ │ ├── index.test.tsx │ │ └── server.test.tsx │ └── tsconfig.json ├── websocket │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ │ └── index.tsx │ ├── package.json │ ├── src │ │ └── index.ts │ ├── test │ │ ├── index.test.ts │ │ └── setup.ts │ └── tsconfig.json └── workers │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dev │ └── index.tsx │ ├── index.html │ ├── package.json │ ├── src │ ├── index.ts │ ├── types.d.ts │ └── utils.ts │ └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── scripts ├── build.ts ├── dev.ts ├── measure.ts ├── new-package.ts ├── update-readme.ts ├── update-tsconfigs.ts └── utils │ ├── calculate-bundlesize.ts │ ├── get-modules-data.ts │ ├── index.ts │ └── utils.ts ├── site ├── .env ├── .gitignore ├── app.config.ts ├── package.json ├── postcss.config.cjs ├── public │ ├── favicons │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── browserconfig.xml │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── icon-192x192.png │ │ ├── icon-256x256.png │ │ ├── icon-384x384.png │ │ ├── icon-512x512.png │ │ └── mstile-150x150.png │ ├── fonts │ │ └── Gordita │ │ │ ├── Gordita-Black-Italic.otf │ │ │ ├── Gordita-Black-Italic.woff │ │ │ ├── Gordita-Black-Italic.woff2 │ │ │ ├── Gordita-Black.otf │ │ │ ├── Gordita-Black.woff │ │ │ ├── Gordita-Black.woff2 │ │ │ ├── Gordita-Bold-Italic.woff │ │ │ ├── Gordita-Bold-italic.otf │ │ │ ├── Gordita-Bold-italic.woff2 │ │ │ ├── Gordita-Bold.eot │ │ │ ├── Gordita-Bold.otf │ │ │ ├── Gordita-Bold.ttf │ │ │ ├── Gordita-Bold.woff │ │ │ ├── Gordita-Bold.woff2 │ │ │ ├── Gordita-Light-Italic.otf │ │ │ ├── Gordita-Light-Italic.woff │ │ │ ├── Gordita-Light-Italic.woff2 │ │ │ ├── Gordita-Light.otf │ │ │ ├── Gordita-Light.woff │ │ │ ├── Gordita-Light.woff2 │ │ │ ├── Gordita-Medium-Italic.otf │ │ │ ├── Gordita-Medium-Italic.woff │ │ │ ├── Gordita-Medium-Italic.woff2 │ │ │ ├── Gordita-Medium.eot │ │ │ ├── Gordita-Medium.otf │ │ │ ├── Gordita-Medium.ttf │ │ │ ├── Gordita-Medium.woff │ │ │ ├── Gordita-Medium.woff2 │ │ │ ├── Gordita-Regular-Italic.otf │ │ │ ├── Gordita-Regular-Italic.woff │ │ │ ├── Gordita-Regular-Italic.woff2 │ │ │ ├── Gordita-Regular.eot │ │ │ ├── Gordita-Regular.otf │ │ │ ├── Gordita-Regular.ttf │ │ │ ├── Gordita-Regular.woff │ │ │ ├── Gordita-Regular.woff2 │ │ │ ├── Gordita-Thin-Italic.otf │ │ │ ├── Gordita-Thin-Italic.woff │ │ │ ├── Gordita-Thin-Italic.woff2 │ │ │ ├── Gordita-Thin.eot │ │ │ ├── Gordita-Thin.otf │ │ │ ├── Gordita-Thin.ttf │ │ │ ├── Gordita-Thin.woff │ │ │ ├── Gordita-Thin.woff2 │ │ │ ├── Gordita-Ultra-Italic.otf │ │ │ ├── Gordita-Ultra-Italic.woff │ │ │ ├── Gordita-Ultra-Italic.woff2 │ │ │ ├── Gordita-Ultra.otf │ │ │ ├── Gordita-Ultra.woff │ │ │ └── Gordita-Ultra.woff2 │ ├── img │ │ ├── solid-primitives-dark-logo.svg │ │ ├── solid-primitives-logo.svg │ │ ├── solid-primitives-stacked-dark-logo.svg │ │ └── solid-primitives-stacked-logo.svg │ └── og.jpeg ├── scripts │ └── generate.ts ├── src │ ├── api.ts │ ├── app.scss │ ├── app.tsx │ ├── components │ │ ├── BundleSizeModal │ │ │ └── BundleSizeModal.tsx │ │ ├── Footer │ │ │ └── Footer.tsx │ │ ├── Header │ │ │ ├── Header.tsx │ │ │ ├── NavMenu.tsx │ │ │ └── ThemeBtn.tsx │ │ ├── Icons │ │ │ ├── HalfSun.tsx │ │ │ ├── Hamburger.tsx │ │ │ ├── NpmLogo.tsx │ │ │ ├── NpmMonochrome.tsx │ │ │ ├── NpmOppositeMonochrome.tsx │ │ │ ├── PnpmLogo.tsx │ │ │ ├── PnpmMonochrome.tsx │ │ │ ├── SolidBlocksHeaderClusterDefs.tsx │ │ │ ├── YarnLogo.tsx │ │ │ └── YarnMonochrome.tsx │ │ ├── Modal │ │ │ └── SlideModal.tsx │ │ ├── Primitives │ │ │ ├── BundleSizeWrapper.tsx │ │ │ ├── CodePrimitive.tsx │ │ │ ├── InfoBar.tsx │ │ │ ├── PrimitiveBtn.tsx │ │ │ ├── PrimitiveBtnLineWrapper.tsx │ │ │ ├── SizeBadge.tsx │ │ │ ├── SizeUnitSpan.tsx │ │ │ ├── StageBadge.tsx │ │ │ └── VersionBadge.tsx │ │ ├── Search │ │ │ ├── CheckBox │ │ │ │ ├── CheckBox.tsx │ │ │ │ └── checkbox.module.scss │ │ │ ├── ClientSearchModal.tsx │ │ │ ├── Search.tsx │ │ │ ├── SearchBtn.tsx │ │ │ └── SearchModal.tsx │ │ ├── Stage │ │ │ └── Stage.tsx │ │ ├── prose.tsx │ │ └── table.tsx │ ├── constants.ts │ ├── entry-client.tsx │ ├── entry-server.tsx │ ├── env.d.ts │ ├── hljs.scss │ ├── primitives-page-main.module.scss │ ├── primitives-page-main.scss │ ├── primitives │ │ ├── DocumentHydrationHelper.tsx │ │ ├── client-only.ts │ │ ├── createShortcut.ts │ │ └── document-class.tsx │ ├── routes │ │ ├── [...404].tsx │ │ ├── index.tsx │ │ ├── package │ │ │ └── [name] │ │ │ │ ├── (package).tsx │ │ │ │ └── components │ │ │ │ ├── heading.tsx │ │ │ │ ├── package-installation.tsx │ │ │ │ ├── primitive-name-tooltip.client.tsx │ │ │ │ └── primitive-name-tooltips.tsx │ │ └── playground │ │ │ ├── [name].tsx │ │ │ └── playground.scss │ ├── types.ts │ └── utils.ts ├── tailwind.config.cjs └── tsconfig.json ├── template ├── LICENSE ├── README.md ├── dev │ └── index.tsx ├── package.json ├── src │ └── index.ts ├── test │ ├── index.test.ts │ └── server.test.ts └── tsconfig.json └── tsconfig.json /.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": [], 6 | "linked": [], 7 | "access": "public", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": ["site"] 11 | } 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = LF 7 | charset = utf-8 8 | insert_final_newline = true -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | name: "Feature Request" 2 | description: For feature requests and primitive proposals. Please search for existing issues first. Also see CONTRIBUTING. 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Thank you for bringing your ideas here :pray:. 8 | 9 | The more information you fill in, the better the community can understand your idea. 10 | - type: textarea 11 | id: problem 12 | attributes: 13 | label: Describe The Problem To Be Solved 14 | description: Provide a clear and concise description of the challenge you are running into. 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: solution 19 | attributes: 20 | label: Suggest A Solution 21 | description: | 22 | A concise description of your preferred solution. Things to address include: 23 | - Details of the technical implementation 24 | - Tradeoffs made in design decisions 25 | - Caveats and considerations for the future 26 | validations: 27 | required: true 28 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | 7 | concurrency: ${{ github.workflow }}-${{ github.ref }} 8 | 9 | jobs: 10 | release: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - uses: pnpm/action-setup@v4 16 | 17 | - name: Setup Node.js environment 18 | uses: actions/setup-node@v4 19 | with: 20 | node-version: 20 21 | cache: pnpm 22 | 23 | - name: Install Dependencies 24 | run: pnpm i 25 | 26 | - name: Create Release Pull Request or Publish to npm 27 | id: changesets 28 | uses: changesets/action@v1 29 | with: 30 | version: pnpm run version 31 | publish: pnpm run release 32 | env: 33 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 34 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 35 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build-test: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | 16 | - uses: pnpm/action-setup@v4 17 | 18 | - name: Setup Node.js environment 19 | uses: actions/setup-node@v4 20 | with: 21 | node-version: 20 22 | cache: pnpm 23 | 24 | - name: Install dependencies 25 | run: pnpm install 26 | 27 | - name: Build all packages 28 | run: pnpm build 29 | 30 | - name: Lint 31 | # Will run the step even if build step failed 32 | if: success() || failure() 33 | run: pnpm lint 34 | 35 | - name: Test all packages 36 | # Will run the step even if lint step failed 37 | if: success() || failure() 38 | run: pnpm test 39 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - init: pnpm install && pnpm run build 3 | vscode: 4 | extensions: ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies=false 2 | auto-install-peers=true 3 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | 2 | node_modules/ 3 | dist/ 4 | assets 5 | 6 | # TypeScript cache 7 | *.tsbuildinfo 8 | 9 | .vscode 10 | 11 | # Temporary folders 12 | tmp/ 13 | temp/ 14 | _temp_* 15 | 16 | _generated 17 | 18 | .netlify 19 | .vinxi 20 | .idea 21 | 22 | tsconfig.json 23 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 100, 5 | "semi": true, 6 | "singleQuote": false, 7 | "useTabs": false, 8 | "arrowParens": "avoid", 9 | "bracketSpacing": true, 10 | "endOfLine": "lf", 11 | "plugins": ["prettier-plugin-tailwindcss"] 12 | } 13 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "esbenp.prettier-vscode", 4 | "dbaeumer.vscode-eslint", 5 | "bradlc.vscode-tailwindcss" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Core Team 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /assets/badges/stage-0.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "label": "STAGE", 4 | "message": "0", 5 | "color": "#FA233E" 6 | } 7 | -------------------------------------------------------------------------------- /assets/badges/stage-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "label": "STAGE", 4 | "message": "1", 5 | "color": "#FFA15C" 6 | } 7 | -------------------------------------------------------------------------------- /assets/badges/stage-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "label": "STAGE", 4 | "message": "2", 5 | "color": "#E9DE47" 6 | } 7 | -------------------------------------------------------------------------------- /assets/badges/stage-3.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "label": "STAGE", 4 | "message": "3", 5 | "color": "#12C3A2" 6 | } 7 | -------------------------------------------------------------------------------- /assets/badges/stage-4.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "label": "STAGE", 4 | "message": "4", 5 | "color": "#2962FF" 6 | } 7 | -------------------------------------------------------------------------------- /assets/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/assets/banner.png -------------------------------------------------------------------------------- /assets/img/npm-monochrome.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/img/pnpm-duplicate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /assets/img/solid-blocks-heading-mid-block-shadow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/img/solid-blocks-heading-mid-block.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/img/solid-squares.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/assets/img/solid-squares.webp -------------------------------------------------------------------------------- /assets/img/yarn-monochrome.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | base = "/" 3 | publish = "site/dist" 4 | command = "pnpm build && pnpm -dir site run deploy" 5 | -------------------------------------------------------------------------------- /packages/active-element/dev/utils.ts: -------------------------------------------------------------------------------- 1 | export const genNodeList = () => 2 | Array.from({ length: 10 }, (_, id) => ({ 3 | x: Math.random() * (window.innerWidth - 192), 4 | y: Math.random() * (window.innerHeight - 192), 5 | size: Math.random() + 0.15, 6 | id, 7 | })); 8 | -------------------------------------------------------------------------------- /packages/active-element/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect, vi } from "vitest"; 2 | import { makeActiveElementListener, createActiveElement, createFocusSignal } from "../src/index.js"; 3 | 4 | describe("API doesn't break in SSR", () => { 5 | // check if the API doesn't throw when calling it in SSR 6 | test("makeActiveElementListener() - SSR", () => { 7 | const cb = vi.fn(); 8 | expect(() => makeActiveElementListener(cb)).not.toThrow(); 9 | expect(cb).not.toBeCalled(); 10 | }); 11 | 12 | test("createActiveElement() - SSR", () => { 13 | expect(() => createActiveElement()).not.toThrow(); 14 | }); 15 | 16 | test("createFocusSignal() - SSR", () => { 17 | const el = vi.fn(); 18 | expect(() => createFocusSignal(el)).not.toThrow(); 19 | expect(el).not.toBeCalled(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/active-element/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../utils" 14 | } 15 | ], 16 | "include": [ 17 | "src" 18 | ] 19 | } -------------------------------------------------------------------------------- /packages/analytics/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/analytics 2 | 3 | ## 0.2.0 4 | 5 | ### Minor Changes 6 | 7 | - ea09f71: Remove CJS support. The package is ESM only now. 8 | 9 | ## 0.1.6 10 | 11 | ### Patch Changes 12 | 13 | - d23dd74: Add type exports for cjs 14 | 15 | ## 0.1.5 16 | 17 | ### Patch Changes 18 | 19 | - 3fad3789: Revert from publishing separate server, development, and production builds that has to rely on export conditions 20 | to publishing a single build that can be used in any environment. 21 | Envs will be checked at with `isDev`and `isServer` consts exported by `"solid-js/web"` so it's still tree-shakeable. 22 | 23 | ## 0.1.4 24 | 25 | ### Patch Changes 26 | 27 | - 865d5ee9: Fix build. (remove keepNames option) 28 | 29 | ## 0.1.3 30 | 31 | ### Patch Changes 32 | 33 | - dd2d7d1c: Improve export conditions. 34 | 35 | ## 0.1.2 36 | 37 | ### Patch Changes 38 | 39 | - b662fe9f: Improve package export contidions for SSR (node, workers, deno) 40 | 41 | ## 0.1.1 42 | 43 | ### Patch Changes 44 | 45 | - 7ac41ed: Update to solid-js version 1.5 46 | 47 | ## Changelog up to version 0.1.0 48 | 49 | 0.0.100 50 | -------------------------------------------------------------------------------- /packages/analytics/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/analytics/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | Name: analytics 3 | Stage: 0 4 | Package: "@solid-primitives/analytics" 5 | Primitives: createAnalytics 6 | Category: Utilities 7 | --- 8 | 9 |

10 | Solid Primitives Analytics 11 |

12 | 13 | # @solid-primitives/analytics 14 | 15 | [![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolidjs-community%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-0.json)](https://github.com/solidjs-community/solid-primitives#contribution-process) 16 | 17 | Creates a primitive for analytics management. 18 | 19 | ## How to use it 20 | 21 | ```ts 22 | const [running, start, stop] = createAnalytics(() => console.log('hi'))); 23 | start(); 24 | ``` 25 | 26 | ## Demo 27 | 28 | You may view a working example here: https://codesandbox.io/s/solid-create-analytics?file=/src/index.tsx 29 | 30 | ## Changelog 31 | 32 | See [CHANGELOG.md](./CHANGELOG.md) 33 | -------------------------------------------------------------------------------- /packages/analytics/src/index.ts: -------------------------------------------------------------------------------- 1 | export enum EventType { 2 | Pageview = "page", 3 | Event = "event", 4 | Social = "social", 5 | } 6 | export type TrackEventData = { 7 | category?: string; 8 | action?: string; 9 | label?: string; 10 | value?: string; 11 | location?: string; 12 | other?: object; 13 | }; 14 | export type TrackSocialData = { 15 | network: string; 16 | action: string; 17 | socialtarget: string; 18 | }; 19 | export type TrackPageview = { 20 | location?: string; 21 | other?: object; 22 | }; 23 | export type TrackHandler = ( 24 | type: EventType, 25 | data: TrackEventData | TrackSocialData | TrackPageview, 26 | ) => void; 27 | 28 | /** 29 | * Creates a method that support with analytics reporting. 30 | * 31 | * @param handlers A list of reporting handlers 32 | * @returns Returns a tracking a single tracking handler 33 | * 34 | */ 35 | const createAnalytics = (handlers: Array): TrackHandler => { 36 | const track: TrackHandler = (type, data) => { 37 | for (const i in handlers) { 38 | handlers[i]!(type, data); 39 | } 40 | }; 41 | return track; 42 | }; 43 | 44 | export default createAnalytics; 45 | -------------------------------------------------------------------------------- /packages/analytics/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "vitest"; 2 | 3 | import createAnalytics, { EventType } from "../src/index.js"; 4 | 5 | describe("createPrimitiveTemplate", () => { 6 | it("track function calls all handlers with the event", () => { 7 | const called: any[][] = []; 8 | const handlers = [...new Array(5)].map( 9 | (_, i) => 10 | (...args) => 11 | (called[i] = args), 12 | ); 13 | const track = createAnalytics(handlers); 14 | const eventData = {}; 15 | track(EventType.Event, eventData); 16 | expect(called).toEqual(new Array(5).fill([EventType.Event, eventData])); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/analytics/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/audio/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/audio/dev/sample1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/audio/dev/sample1.mp3 -------------------------------------------------------------------------------- /packages/audio/dev/sample2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/audio/dev/sample2.mp3 -------------------------------------------------------------------------------- /packages/audio/dev/sample3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/audio/dev/sample3.mp3 -------------------------------------------------------------------------------- /packages/audio/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../static-store" 11 | }, 12 | { 13 | "path": "../utils" 14 | } 15 | ], 16 | "include": [ 17 | "src" 18 | ] 19 | } -------------------------------------------------------------------------------- /packages/autofocus/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/bounds/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it, vi } from "vitest"; 2 | import { createElementBounds } from "../src/index.js"; 3 | 4 | describe("createElementBounds", () => { 5 | it("is a noop on the server", () => { 6 | const el = vi.fn(); 7 | const bounds = createElementBounds(el); 8 | expect(bounds).toEqual({ 9 | top: null, 10 | left: null, 11 | bottom: null, 12 | right: null, 13 | width: null, 14 | height: null, 15 | }); 16 | expect(el).not.toBeCalled(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/bounds/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../resize-observer" 14 | }, 15 | { 16 | "path": "../static-store" 17 | }, 18 | { 19 | "path": "../utils" 20 | } 21 | ], 22 | "include": [ 23 | "src" 24 | ] 25 | } -------------------------------------------------------------------------------- /packages/broadcast-channel/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/broadcast-channel 2 | 3 | ## 0.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | 10 | ## 0.1.0 11 | 12 | ### Minor Changes 13 | 14 | - ea09f71: Remove CJS support. The package is ESM only now. 15 | 16 | ## 0.0.105 17 | 18 | ### Patch Changes 19 | 20 | - 74db287: Correct the "homepage" field in package.json 21 | 22 | ## 0.0.104 23 | 24 | ### Patch Changes 25 | 26 | - d23dd74: Add type exports for cjs 27 | 28 | ## 0.0.103 29 | 30 | ### Patch Changes 31 | 32 | - 3fad3789: Revert from publishing separate server, development, and production builds that has to rely on export conditions 33 | to publishing a single build that can be used in any environment. 34 | Envs will be checked at with `isDev`and `isServer` consts exported by `"solid-js/web"` so it's still tree-shakeable. 35 | 36 | ## 0.0.102 37 | 38 | ### Patch Changes 39 | 40 | - 865d5ee9: Fix build. (remove keepNames option) 41 | 42 | ## 0.0.101 43 | 44 | ### Patch Changes 45 | 46 | - dd2d7d1c: Improve export conditions. 47 | -------------------------------------------------------------------------------- /packages/broadcast-channel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/clipboard/dev/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/clipboard/dev/img.png -------------------------------------------------------------------------------- /packages/clipboard/dev/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/clipboard/dev/img2.png -------------------------------------------------------------------------------- /packages/clipboard/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import "./setup"; 2 | import { createComputed, createRoot } from "solid-js"; 3 | import { createClipboard } from "../src/index.js"; 4 | import { describe, expect, it } from "vitest"; 5 | 6 | describe("createClipboard", () => { 7 | it("test initial read values", () => 8 | createRoot(async () => { 9 | const [clipboard, refetch] = createClipboard(); 10 | let i = 0; 11 | 12 | await new Promise(resolve => { 13 | createComputed(() => { 14 | const items = clipboard(); 15 | if (i === 0) { 16 | expect(items).toHaveLength(0); 17 | queueMicrotask(() => refetch()); 18 | } else { 19 | expect(items).toHaveLength(1); 20 | expect(items[0]!.text).toBe("InitialValue"); 21 | resolve(); 22 | } 23 | i++; 24 | }); 25 | }); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/clipboard/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { createClipboard } from "../src/index.js"; 2 | import { describe, expect, it } from "vitest"; 3 | 4 | describe("API doesn't break in SSR", () => { 5 | it("createClipboard() - SSR", () => { 6 | const [clipboard, refetch, modify] = createClipboard(); 7 | expect(clipboard()).toEqual([]); 8 | expect(refetch).toBeInstanceOf(Function); 9 | expect(modify).toBeInstanceOf(Function); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/clipboard/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/connectivity/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import type { Component } from "solid-js"; 2 | 3 | import { createConnectivitySignal } from "../src/index.js"; 4 | 5 | const App: Component = () => { 6 | const onLine = createConnectivitySignal(); 7 | return ( 8 |
9 | You are currently: {onLine() ? online : offline} (try 10 | toggling your network state in dev tools!) 11 |
12 | ); 13 | }; 14 | 15 | export default App; 16 | -------------------------------------------------------------------------------- /packages/connectivity/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { setOnline } from "./setup.js"; 2 | import { describe, expect, it } from "vitest"; 3 | import { createRoot } from "solid-js"; 4 | import { makeConnectivityListener, createConnectivitySignal } from "../src/index.js"; 5 | 6 | describe("makeConnectivityListener", () => { 7 | it("works", () => 8 | createRoot(dispose => { 9 | let captured!: boolean; 10 | makeConnectivityListener(e => (captured = e)); 11 | expect(captured, "0").toBe(undefined); 12 | setOnline(false); 13 | expect(captured, "1").toBe(false); 14 | setOnline(true); 15 | expect(captured, "2").toBe(true); 16 | dispose(); 17 | })); 18 | }); 19 | 20 | describe("createConnectivitySignal", () => { 21 | it("works", () => 22 | createRoot(dispose => { 23 | const onLine = createConnectivitySignal(); 24 | expect(onLine()).toBe(true); 25 | setOnline(false); 26 | expect(onLine()).toBe(false); 27 | setOnline(true); 28 | expect(onLine()).toBe(true); 29 | dispose(); 30 | })); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/connectivity/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, vi, it } from "vitest"; 2 | import { makeConnectivityListener, createConnectivitySignal } from "../src/index.js"; 3 | 4 | describe("makeConnectivityListener", () => { 5 | it("works in server", () => { 6 | const cb = vi.fn(); 7 | makeConnectivityListener(cb); 8 | expect(cb).not.toBeCalled(); 9 | }); 10 | }); 11 | 12 | describe("createConnectivitySignal", () => { 13 | it("works in server", () => { 14 | const onLine = createConnectivitySignal(); 15 | expect(onLine()).toBe(true); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/connectivity/test/setup.ts: -------------------------------------------------------------------------------- 1 | let online = true; 2 | 3 | export const setOnline = (value: boolean) => { 4 | online = value; 5 | window.dispatchEvent(new Event(value ? "online" : "offline")); 6 | }; 7 | 8 | Object.defineProperty(navigator, "onLine", { 9 | get: () => online, 10 | }); 11 | -------------------------------------------------------------------------------- /packages/connectivity/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../rootless" 14 | }, 15 | { 16 | "path": "../utils" 17 | } 18 | ], 19 | "include": [ 20 | "src" 21 | ] 22 | } -------------------------------------------------------------------------------- /packages/context/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/controlled-props/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createSignal, JSX } from "solid-js"; 2 | 3 | import { createControlledProps } from "../src/index.js"; 4 | 5 | const App: Component = () => { 6 | const [props, controls] = createControlledProps({ 7 | bool: true, 8 | number: 0, 9 | string: "test", 10 | }); 11 | 12 | return ( 13 |
14 |

Props

15 |
    16 |
  • bool: {props.bool() ? "true" : "false"}
  • 17 |
  • number: {props.number()}
  • 18 |
  • string: {props.string()}
  • 19 |
20 |

Controls

21 | {controls} 22 |
23 | ); 24 | }; 25 | 26 | export default App; 27 | -------------------------------------------------------------------------------- /packages/controlled-props/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/cookies/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/cookies 2 | 3 | ## 0.0.2 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | -------------------------------------------------------------------------------- /packages/cookies/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | import { createUserTheme } from "../src/index.js"; 3 | 4 | const App: Component = () => { 5 | const [theme, setTheme] = createUserTheme(); 6 | const increment = () => setTheme(theme() === "light" ? "dark" : "light"); 7 | return ( 8 |
9 |
10 |
11 |

Counter component

12 |

it's very important...

13 | 16 |
17 |
18 |
19 | ); 20 | }; 21 | 22 | export default App; 23 | -------------------------------------------------------------------------------- /packages/cookies/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/cursor/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { App } from "./App.js"; 2 | 3 | export default App; 4 | -------------------------------------------------------------------------------- /packages/cursor/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect, vi } from "vitest"; 2 | import { createBodyCursor, createElementCursor } from "../src/index.js"; 3 | 4 | describe("createBodyCursor", () => { 5 | it("works in ssr", () => { 6 | const cb = vi.fn(); 7 | createBodyCursor(cb); 8 | expect(cb).not.toBeCalled(); 9 | }); 10 | }); 11 | 12 | describe("createElementCursor", () => { 13 | it("works in ssr", () => { 14 | const el = vi.fn(); 15 | const cb = vi.fn(); 16 | createElementCursor(el, cb); 17 | expect(cb).not.toBeCalled(); 18 | expect(el).not.toBeCalled(); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/cursor/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/date/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/date/dev/utils.ts: -------------------------------------------------------------------------------- 1 | export const flipVal = (val: number, min: number, max: number): number => 2 | Math.abs(val * (Math.sign(val) || 1) - max) + min; 3 | 4 | export const pToVal = (p: number, zero: number, hundred: number): number => 5 | p * (hundred - zero) + zero; 6 | 7 | export function valToP(value: number, min: number, max: number): number { 8 | if (min > max) { 9 | [min, max] = [max, min]; 10 | value = flipVal(value, min, max); 11 | } 12 | return (value - min) / (max - min); 13 | } 14 | 15 | export const clamp = (value: number, min: number, max: number): number => 16 | Math.min(Math.max(value, min), max); 17 | -------------------------------------------------------------------------------- /packages/date/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types.js"; 2 | export * from "./variables.js"; 3 | export * from "./utils.js"; 4 | export * from "./primitives.js"; 5 | -------------------------------------------------------------------------------- /packages/date/test/utils.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { getDate, getTime } from "../src/index.js"; 3 | 4 | describe("getDate", () => { 5 | it("transforms init values to a date", () => { 6 | const inputString = "2020 1 11"; // 1578697200000 7 | const inputNumber = 1641408329089; 8 | const inputDate = new Date(); 9 | 10 | expect(getDate(inputString)).toBeInstanceOf(Date); 11 | // assert.is(getDate(inputString).getTime(), 1578697200000); 12 | expect(getDate(inputNumber)).toBeInstanceOf(Date); 13 | expect(getDate(inputNumber).getTime()).toBe(1641408329089); 14 | expect(getDate(inputDate)).toBe(inputDate); 15 | }); 16 | }); 17 | 18 | describe("getTime", () => { 19 | it("transforms init values to a timestamp", () => { 20 | const inputString = "2020 1 11"; // 1578697200000 21 | const inputNumber = 1641408329089; 22 | const inputDate = new Date("2020 1 11"); 23 | 24 | expect(typeof getTime(inputString)).toBe("number"); 25 | expect(getTime(inputNumber)).toBe(1641408329089); 26 | expect(typeof getTime(inputDate)).toBe("number"); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /packages/date/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../memo" 11 | }, 12 | { 13 | "path": "../timer" 14 | }, 15 | { 16 | "path": "../utils" 17 | } 18 | ], 19 | "include": [ 20 | "src" 21 | ] 22 | } -------------------------------------------------------------------------------- /packages/db-store/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/db-store 2 | 3 | ## 1.1.2 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | - Updated dependencies [53f08cc] 10 | - @solid-primitives/resource@0.4.2 11 | 12 | ## 1.1.1 13 | 14 | ### Patch Changes 15 | 16 | - Updated dependencies [9914bfc] 17 | - @solid-primitives/resource@0.4.1 18 | 19 | ## 1.1.0 20 | 21 | ### Minor Changes 22 | 23 | - 645a847: support schemas and default fields 24 | 25 | ## 1.0.0 26 | 27 | ### Major Changes 28 | 29 | - 4c9dad5: new package: db-store - a store transparently bound to a database 30 | -------------------------------------------------------------------------------- /packages/db-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../resource" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/deep/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/deep/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./track-deep.js"; 2 | export * from "./track-store.js"; 3 | export * from "./store-updates.js"; 4 | -------------------------------------------------------------------------------- /packages/deep/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../memo" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/destructure/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/devices/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { 3 | createAccelerometer, 4 | createCameras, 5 | createDevices, 6 | createGyroscope, 7 | createMicrophones, 8 | createSpeakers, 9 | } from "../src/index.js"; 10 | 11 | describe("API doesn't break in SSR", () => { 12 | // check if the API doesn't throw when calling it in SSR 13 | test("createDevices() - SSR", () => { 14 | expect(createDevices()()).toEqual([]); 15 | }); 16 | 17 | test("createMicrophones() - SSR", () => { 18 | expect(createMicrophones()()).toEqual([]); 19 | }); 20 | 21 | test("createSpeakers() - SSR", () => { 22 | expect(createSpeakers()()).toEqual([]); 23 | }); 24 | 25 | test("createCameras() - SSR", () => { 26 | expect(createCameras()()).toEqual([]); 27 | }); 28 | 29 | test("createAccelerometer() - SSR", () => { 30 | expect(createAccelerometer()()).toEqual({ x: 0, y: 0, z: 0 }); 31 | }); 32 | 33 | test("createGyroscope() - SSR", () => { 34 | expect(createGyroscope()).toEqual({ alpha: 0, beta: 0, gamma: 0 }); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /packages/devices/test/setup.ts: -------------------------------------------------------------------------------- 1 | (window as any).__devices__ = [] as MediaDeviceInfo[]; 2 | 3 | // (navigator.mediaDevices as any) = Object.assign(new EventTarget(), { 4 | // enumerateDevices: () => Promise.resolve((window as any).__devices__ as MediaDeviceInfo[]) 5 | // }); 6 | 7 | // needed to create a fake event target 8 | // because using EventTarget() resulted in weird error, when trying to use .dispatchEvent(): 9 | // => "The "event" argument must be an instance of Event. Received an instance of Event" 10 | const listeners: (() => void)[] = []; 11 | (navigator.mediaDevices as any) = { 12 | enumerateDevices: () => Promise.resolve((window as any).__devices__ as MediaDeviceInfo[]), 13 | addEventListener: (ev: string, cb: () => void) => listeners.push(cb), 14 | removeEventListener: (ev: string, cb: () => void) => listeners.splice(listeners.indexOf(cb), 1), 15 | dispatchFakeEvent: () => listeners.forEach(cb => cb()), 16 | }; 17 | -------------------------------------------------------------------------------- /packages/devices/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/event-bus/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./eventBus.js"; 2 | export * from "./eventHub.js"; 3 | export * from "./eventStack.js"; 4 | export * from "./emitter.js"; 5 | export * from "./utils.js"; 6 | -------------------------------------------------------------------------------- /packages/event-bus/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/event-dispatcher/dev/utils.ts: -------------------------------------------------------------------------------- 1 | function makeDelay(ms?: number): Promise { 2 | return new Promise(resolve => setTimeout(() => resolve(true), ms ?? 500)); 3 | } 4 | 5 | export function sendEmailDefault(data: FormData) { 6 | return makeDelay().then( 7 | () => `Your email was sent to ${data.get("to") || "no one"} with your default provider`, 8 | ); 9 | } 10 | 11 | export function sendEmailAlternative(data: FormData) { 12 | return makeDelay().then( 13 | () => `Your email was sent to ${data.get("to") || "no one"} with an alternative provider`, 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /packages/event-dispatcher/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/event-listener/dev/components.tsx: -------------------------------------------------------------------------------- 1 | import { access, MaybeAccessor } from "@solid-primitives/utils"; 2 | import { Component, For } from "solid-js"; 3 | 4 | export const DisplayRecord: Component<{ record: Record> }> = props => ( 5 | 6 | {k => ( 7 |

8 | {k}:{" "} 9 | {() => { 10 | const val = access(props.record[k]); 11 | return typeof val === "number" ? parseInt(val as any) : String(val); 12 | }} 13 |

14 | )} 15 |
16 | ); 17 | -------------------------------------------------------------------------------- /packages/event-listener/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./eventListener.js"; 2 | export * from "./eventListenerMap.js"; 3 | export * from "./components.js"; 4 | export * from "./eventListenerStack.js"; 5 | export * from "./callbackWrappers.js"; 6 | export * from "./types.js"; 7 | -------------------------------------------------------------------------------- /packages/event-listener/test/setup.ts: -------------------------------------------------------------------------------- 1 | export const event_target = new EventTarget(); 2 | 3 | const globalListeners: Record void>> = {}; 4 | 5 | // @ts-ignore 6 | event_target.addEventListener = (name: string, callback: (e: Event) => void, o: any) => { 7 | if (!globalListeners[name]) globalListeners[name] = new Set(); 8 | // @ts-ignore 9 | globalListeners[name].add(callback); 10 | }; 11 | // @ts-ignore 12 | event_target.removeEventListener = (name: string, callback: (e: Event) => void, o: any) => { 13 | if (!globalListeners[name]) return; 14 | // @ts-ignore 15 | globalListeners[name].delete(callback); 16 | }; 17 | 18 | export const dispatchFakeEvent = (name: string, event: Event) => { 19 | // @ts-ignore 20 | if (!globalListeners[name]) return; 21 | // @ts-ignore 22 | [...globalListeners[name]].forEach(fn => fn(event)); 23 | }; 24 | -------------------------------------------------------------------------------- /packages/event-listener/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/event-props/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/fetch/src/index.ts: -------------------------------------------------------------------------------- 1 | export { createFetch, type FetchReturn, type FetchOptions, type RequestContext } from "./fetch.js"; 2 | export { 3 | withAbort, 4 | withAggregation, 5 | withCatchAll, 6 | withTimeout, 7 | withRetry, 8 | withRefetchEvent, 9 | wrapFetcher, 10 | wrapResource, 11 | } from "./modifiers.js"; 12 | export { withCache, withRefetchOnExpiry, withCacheStorage, serializeRequest } from "./cache.js"; 13 | export { fetchRequest } from "./request.js"; 14 | -------------------------------------------------------------------------------- /packages/fetch/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/filesystem/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./adapter-mocks.js"; 2 | export * from "./adapter-node.js"; 3 | export * from "./adapter-tauri.js"; 4 | export * from "./adapter-web.js"; 5 | export * from "./adapter-vfs.js"; 6 | export * from "./reactive.js"; 7 | export * from "./tools.js"; 8 | export * from "./types.js"; 9 | export * from "./watcher-chokidar.js"; 10 | -------------------------------------------------------------------------------- /packages/filesystem/src/watcher-chokidar.ts: -------------------------------------------------------------------------------- 1 | import { Operation, Watcher } from "./types.js"; 2 | 3 | export const makeChokidarWatcher = (basePath: string = "/"): Watcher => { 4 | let subscriber: ((operation: Operation, path: string) => void) | undefined; 5 | 6 | import("chokidar") 7 | .then(chokidar => 8 | chokidar 9 | .watch(`${basePath}${basePath.endsWith("/") ? "" : "/"}**/*`, { persistent: true }) 10 | .on("change", path => subscriber?.("writeFile", path)) 11 | .on("add", path => subscriber?.("writeFile", path)) 12 | .on("addDir", path => subscriber?.("mkdir", path)) 13 | .on("unlink", path => subscriber?.("rm", path)) 14 | .on("unlinkDir", path => subscriber?.("rm", path)), 15 | ) 16 | // eslint-disable-next-line no-console 17 | .catch(e => console.warn(e)); 18 | 19 | return fn => { 20 | subscriber = fn; 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/filesystem/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/flux-store/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/flux-store 2 | 3 | ## 0.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | 10 | ## 0.1.0 11 | 12 | ### Minor Changes 13 | 14 | - ea09f71: Remove CJS support. The package is ESM only now. 15 | 16 | ## 0.0.4 17 | 18 | ### Patch Changes 19 | 20 | - 74db287: Correct the "homepage" field in package.json 21 | 22 | ## 0.0.3 23 | 24 | ### Patch Changes 25 | 26 | - d23dd74: Add type exports for cjs 27 | 28 | ## 0.0.2 29 | 30 | ### Patch Changes 31 | 32 | - 3fad3789: Revert from publishing separate server, development, and production builds that has to rely on export conditions 33 | to publishing a single build that can be used in any environment. 34 | Envs will be checked at with `isDev`and `isServer` consts exported by `"solid-js/web"` so it's still tree-shakeable. 35 | 36 | ## 0.0.100 37 | 38 | - Initial commit and [**PR**](https://github.com/solidjs-community/solid-primitives/pull/327). 39 | -------------------------------------------------------------------------------- /packages/flux-store/dev/components/CounterControls.tsx: -------------------------------------------------------------------------------- 1 | import type { ParentComponent, ComponentProps } from "solid-js"; 2 | import { IncreaseButton, DecreaseButton, ResetButton } from "./CounterButton.js"; 3 | 4 | export const CounterControls: ParentComponent> = props => ( 5 | <> 6 |
14 | 15 | 16 | 17 |
18 | 19 | ); 20 | 21 | export default CounterControls; 22 | -------------------------------------------------------------------------------- /packages/flux-store/dev/components/index.ts: -------------------------------------------------------------------------------- 1 | export { BoxesDemo } from "./BoxesDemo.js"; 2 | export { CounterControls } from "./CounterControls.js"; 3 | export { CounterButton, IncreaseButton, DecreaseButton, ResetButton } from "./CounterButton.js"; 4 | -------------------------------------------------------------------------------- /packages/flux-store/dev/stores/ages-store.ts: -------------------------------------------------------------------------------- 1 | import { createFluxStoreFactory } from "../../src/index.js"; 2 | 3 | const agesFluxFactory = createFluxStoreFactory( 4 | { 5 | age: 0, 6 | mana: 100, 7 | name: "unknown", 8 | }, 9 | { 10 | getters: state => ({ 11 | days: () => state.age * 365, 12 | yearsOld: () => `${state.age} years old`, 13 | isWizard: () => state.mana > 100 || state.age >= 50, 14 | }), 15 | actions: (setState, state) => ({ 16 | birthday: () => setState("age", state.age + 1), 17 | }), 18 | }, 19 | ); 20 | 21 | export type Person = ReturnType; 22 | 23 | export const aliceAge: Person = agesFluxFactory(init => ({ ...init, age: 45, name: "Alice" })); 24 | export const bobAge: Person = agesFluxFactory({ age: 40, mana: 200, name: "Bob" }); 25 | export const tomAge: Person = agesFluxFactory(init => ({ ...init, age: 35, name: "Tom" })); 26 | 27 | export const getPeople: () => Person[] = () => [aliceAge, bobAge, tomAge]; 28 | export const getWizards: () => Person[] = () => 29 | getPeople().filter(person => person.getters.isWizard()); 30 | -------------------------------------------------------------------------------- /packages/flux-store/dev/stores/counter-store.ts: -------------------------------------------------------------------------------- 1 | import { createFluxStore } from "../../src/index.js"; 2 | 3 | export type CounterState = { 4 | id?: string; 5 | value: number; 6 | initialValue: number; 7 | }; 8 | 9 | export const counterStore = createFluxStore( 10 | { 11 | value: 0, 12 | initialValue: 0, 13 | } as CounterState, 14 | { 15 | getters: state => ({ 16 | toString: () => `${state.id && "-"}(${state.value})`, 17 | isZero: () => state.value === 0, 18 | isNegative: () => state.value < 0, 19 | isPositive: () => state.value >= 0, 20 | get: () => state.value, 21 | }), 22 | actions: setState => ({ 23 | setState, 24 | updateId: (newId: string) => setState("id", newId), 25 | resetCount: (overrideValue?: number) => 26 | setState(proxy => ({ ...proxy, value: overrideValue ?? proxy.initialValue })), 27 | }), 28 | }, 29 | ); 30 | 31 | export type CounterGetters = typeof counterStore.getters; 32 | export type CounterActions = typeof counterStore.actions; 33 | -------------------------------------------------------------------------------- /packages/flux-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/fullscreen/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createFullscreen } from "../src/index.js"; 3 | 4 | describe("API doesn't break in SSR", () => { 5 | // check if the API doesn't throw when calling it in SSR 6 | test("createFullScreen() - SSR", () => { 7 | expect(createFullscreen(undefined, () => false)()).toEqual(false); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/fullscreen/test/setup.ts: -------------------------------------------------------------------------------- 1 | export const setup_state = { 2 | current_el: undefined as HTMLElement | undefined, 3 | current_options: undefined as FullscreenOptions | undefined, 4 | }; 5 | 6 | HTMLElement.prototype.requestFullscreen = function ( 7 | this: HTMLElement, 8 | options?: FullscreenOptions, 9 | ) { 10 | setup_state.current_el = this; 11 | setup_state.current_options = options; 12 | document.dispatchEvent(new Event("fullscreenchange")); 13 | return Promise.resolve(); 14 | }; 15 | 16 | Object.defineProperty(document, "fullscreenElement", { 17 | value: setup_state.current_el, 18 | writable: false, 19 | }); 20 | 21 | Object.defineProperty(document, "exitFullscreen", { 22 | value: () => { 23 | setup_state.current_el = undefined; 24 | }, 25 | writable: false, 26 | }); 27 | -------------------------------------------------------------------------------- /packages/fullscreen/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/geolocation/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, Suspense, createSignal, lazy, onMount } from "solid-js"; 2 | 3 | const Client = lazy(() => import("./client.jsx")); 4 | 5 | const App: Component = () => { 6 | const [mounted, setMounted] = createSignal(false); 7 | onMount(() => setMounted(true)); 8 | 9 | return {mounted() && }; 10 | }; 11 | 12 | export default App; 13 | -------------------------------------------------------------------------------- /packages/geolocation/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { createGeolocation, createGeolocationWatcher } from "../src/index.js"; 2 | import { describe, expect, it } from "vitest"; 3 | 4 | describe("API doesn't break in SSR", () => { 5 | it("createGeolocation() - SSR", () => { 6 | const [location, refetch] = createGeolocation(); 7 | expect(location()).toBe(undefined); 8 | expect(location.loading).toBe(true); 9 | expect(location.error).toBe(undefined); 10 | expect(refetch).toBeInstanceOf(Function); 11 | }); 12 | 13 | it("createGeolocationWatcher() - SSR", () => { 14 | expect(createGeolocationWatcher(true)).toEqual({ location: null, error: null }); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/geolocation/test/setup.ts: -------------------------------------------------------------------------------- 1 | export const mockCoordinates = { 2 | latitude: 43.65107, 3 | longitude: -79.347015, 4 | }; 5 | 6 | Object.defineProperty(global.navigator, "geolocation", { 7 | value: { 8 | clearWatch: () => {}, 9 | getCurrentPosition( 10 | successCallback: PositionCallback, 11 | errorCallback?: PositionErrorCallback | null, 12 | options?: PositionOptions, 13 | ) { 14 | successCallback({ coords: mockCoordinates } as GeolocationPosition); 15 | }, 16 | watchPosition( 17 | successCallback: PositionCallback, 18 | errorCallback?: PositionErrorCallback | null, 19 | options?: PositionOptions, 20 | ) { 21 | successCallback({ coords: mockCoordinates } as GeolocationPosition); 22 | }, 23 | }, 24 | }); 25 | -------------------------------------------------------------------------------- /packages/geolocation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../static-store" 11 | }, 12 | { 13 | "path": "../utils" 14 | } 15 | ], 16 | "include": [ 17 | "src" 18 | ] 19 | } -------------------------------------------------------------------------------- /packages/gestures/README.md: -------------------------------------------------------------------------------- 1 |

2 | Solid Primitives Gestures 3 |

4 | 5 | # @solid-primitives/gestures 6 | 7 | [![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolidjs-community%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-0.json)](https://github.com/solidjs-community/solid-primitives#contribution-process) 8 | 9 | Helpful directives to react to user gestures. 10 | 11 | `pan` - 12 | `pinch` - 13 | `rotate` - 14 | `swipe` - 15 | `tap` - 16 | 17 | ## Changelog 18 | 19 | See [CHANGELOG.md](./CHANGELOG.md) 20 | 21 | ## Contributors 22 | 23 | Ported from the amazing work by at https://github.com/Rezi/svelte-gestures. 24 | -------------------------------------------------------------------------------- /packages/gestures/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./core.js"; 2 | export * from "./pinch.js"; 3 | export * from "./pan.js"; 4 | export * from "./rotate.js"; 5 | export * from "./swipe.js"; 6 | export * from "./tap.js"; 7 | -------------------------------------------------------------------------------- /packages/gestures/src/pan.ts: -------------------------------------------------------------------------------- 1 | import { registerPointerListener } from "./core.js"; 2 | import type { PointerCallback } from "./core.js"; 3 | 4 | type Props = { 5 | callback: (position: { x: number; y: number }) => any; 6 | }; 7 | 8 | declare module "solid-js" { 9 | namespace JSX { 10 | interface HTMLAttributes extends AriaAttributes, DOMAttributes { 11 | ["use:pan"]?: Props; 12 | } 13 | } 14 | } 15 | 16 | export const pan = (node: HTMLElement, props: () => Props) => { 17 | const moveCallback: PointerCallback = (activeEvents, event) => { 18 | if (activeEvents.length === 1) { 19 | const rect = node.getBoundingClientRect(); 20 | const x = Math.round(event.x - rect.left); 21 | const y = Math.round(event.y - rect.top); 22 | if (x >= 0 && y >= 0 && x <= rect.width && y <= rect.height) { 23 | props().callback({ x, y }); 24 | } 25 | } 26 | }; 27 | 28 | registerPointerListener(node, undefined, moveCallback); 29 | }; 30 | -------------------------------------------------------------------------------- /packages/gestures/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "vitest"; 2 | 3 | describe("gestures", () => { 4 | it.todo("write tests"); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/gestures/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/graphql/dev/codegen.yml: -------------------------------------------------------------------------------- 1 | schema: https://countries.trevorblades.com/ 2 | documents: "./dev/**/*.{ts,tsx,graphql}" 3 | generates: 4 | ./dev/gqlgen.ts: 5 | plugins: 6 | - typescript 7 | - typescript-operations 8 | - typed-document-node 9 | -------------------------------------------------------------------------------- /packages/graphql/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/history/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/i18n/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/i18n/dev/en.ts: -------------------------------------------------------------------------------- 1 | import * as i18n from "../src/index.js"; 2 | 3 | export const dict = { 4 | hello: i18n.template<{ name: string }>("hello {{ name }}, how are you?"), 5 | goodbye: ({ name }: { name: string }) => `goodbye ${name}`, 6 | food: { 7 | meat: "meat", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/i18n/dev/es.ts: -------------------------------------------------------------------------------- 1 | import type { RawDictionary } from "./index.jsx"; 2 | 3 | export const dict: RawDictionary = { 4 | hello: "hola {{ name }}, como usted?" as any, 5 | goodbye: ({ name }: { name: string }) => `adios ${name}`, 6 | food: { 7 | meat: "carne", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/i18n/dev/fr.ts: -------------------------------------------------------------------------------- 1 | import type { RawDictionary } from "./index.jsx"; 2 | 3 | export const dict: RawDictionary = { 4 | hello: "bonjour {{ name }}, comment vas-tu ?" as any, 5 | goodbye: ({ name }: { name: string }) => `au revoir ${name}`, 6 | food: { 7 | meat: "viande", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/i18n/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/idle/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/idle/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./createIdleTimer.js"; 2 | export * from "./types.js"; 3 | -------------------------------------------------------------------------------- /packages/idle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/immutable/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../keyed" 11 | }, 12 | { 13 | "path": "../utils" 14 | } 15 | ], 16 | "include": [ 17 | "src" 18 | ] 19 | } -------------------------------------------------------------------------------- /packages/input-mask/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/intersection-observer/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { 2 | makeIntersectionObserver, 3 | createIntersectionObserver, 4 | createViewportObserver, 5 | createVisibilityObserver, 6 | } from "../src/index.js"; 7 | import { describe, test, expect, vi } from "vitest"; 8 | 9 | describe("API works in SSR", () => { 10 | test("makeIntersectionObserver() - SSR", () => { 11 | expect(() => makeIntersectionObserver([], () => {})).not.toThrow(); 12 | }); 13 | 14 | test("createIntersectionObserver() - SSR", () => { 15 | const el = vi.fn(() => []); 16 | const cb = vi.fn(() => {}); 17 | expect(() => createIntersectionObserver(el, cb)).not.toThrow(); 18 | expect(el).not.toBeCalled(); 19 | expect(cb).not.toBeCalled(); 20 | }); 21 | 22 | test("createViewportObserver() - SSR", () => { 23 | expect(() => createViewportObserver()).not.toThrow(); 24 | }); 25 | 26 | test("createVisibilityObserver() - SSR", () => { 27 | expect(() => createVisibilityObserver()).not.toThrow(); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/intersection-observer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/jsx-tokenizer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/keyboard/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../rootless" 14 | }, 15 | { 16 | "path": "../utils" 17 | } 18 | ], 19 | "include": [ 20 | "src" 21 | ] 22 | } -------------------------------------------------------------------------------- /packages/keyed/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | 3 | import Key from "./key.js"; 4 | import Entries from "./entries.js"; 5 | import MapEntries from "./mapEntries.js"; 6 | import SetValues from "./setValues.js"; 7 | 8 | const App: Component = () => { 9 | return ( 10 |
11 |
12 |

Key

13 | 14 |
15 |
16 |

Entries

17 | 18 |
19 |
20 |

MapEntries

21 | 22 |
23 |
24 |

SetValues

25 | 26 |
27 |
28 | ); 29 | }; 30 | export default App; 31 | -------------------------------------------------------------------------------- /packages/keyed/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/lifecycle/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/lifecycle 2 | 3 | ## 0.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | 10 | ## 0.1.0 11 | 12 | ### Minor Changes 13 | 14 | - ea09f71: Remove CJS support. The package is ESM only now. 15 | 16 | ## 0.0.102 17 | 18 | ### Patch Changes 19 | 20 | - 74db287: Correct the "homepage" field in package.json 21 | 22 | ## 0.0.101 23 | 24 | ### Patch Changes 25 | 26 | - d23dd74: Add type exports for cjs 27 | -------------------------------------------------------------------------------- /packages/lifecycle/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { children, createSignal, JSX, onMount } from "solid-js"; 2 | 3 | import { onElementConnect } from "../src/index.js"; 4 | 5 | function Button() { 6 | const [count, setCount] = createSignal(1); 7 | const increment = () => setCount(count() + 1); 8 | 9 | let ref!: HTMLButtonElement; 10 | 11 | onMount(() => { 12 | console.log("onMount", ref.isConnected); 13 | 14 | onElementConnect(ref, () => { 15 | console.log("onConnect", ref.isConnected); 16 | }); 17 | }); 18 | 19 | return ( 20 | 23 | ); 24 | } 25 | 26 | function App() { 27 | const r = children(() => 23 |

{memo() + ""}

24 | 25 | ); 26 | }; 27 | 28 | export default Async; 29 | -------------------------------------------------------------------------------- /packages/memo/dev/writable-page.tsx: -------------------------------------------------------------------------------- 1 | import { batch, createEffect, createSignal } from "solid-js"; 2 | import { createWritableMemo } from "../src/index.js"; 3 | 4 | export default function Cache() { 5 | const [source, setSource] = createSignal(1); 6 | const [memo, setMemo] = createWritableMemo(p => (source(), ++p), -2); 7 | const [memo2, setMemo2] = createWritableMemo(source, -2); 8 | 9 | batch(() => { 10 | setSource(2); 11 | console.log(2, source(), memo2()); 12 | }); 13 | 14 | batch(() => { 15 | setMemo2(-3); 16 | console.log(-3, memo2()); 17 | }); 18 | 19 | return ( 20 | <> 21 |

Signal:

22 | 25 |

Setter:

26 | 29 |

Result: {memo()}

30 | 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /packages/memo/test/reducer.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createRoot } from "solid-js"; 3 | import { createReducer } from "../src/index.js"; 4 | 5 | describe("createReducer", () => { 6 | test("reducer works", () => 7 | createRoot(dispose => { 8 | const initialValue = 1; 9 | const numberOfDoubles = 3; 10 | 11 | const [counter, doubleCounter] = createReducer(counter => counter * 2, initialValue); 12 | 13 | let expectedCounter = initialValue; 14 | 15 | for (let i = 0; i < numberOfDoubles; i++) { 16 | doubleCounter(); 17 | expectedCounter *= 2; 18 | } 19 | 20 | expect(counter()).toEqual(expectedCounter); 21 | 22 | dispose(); 23 | })); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/memo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../scheduled" 11 | }, 12 | { 13 | "path": "../utils" 14 | } 15 | ], 16 | "include": [ 17 | "src" 18 | ] 19 | } -------------------------------------------------------------------------------- /packages/mouse/dev/components.tsx: -------------------------------------------------------------------------------- 1 | import { access, MaybeAccessor } from "@solid-primitives/utils"; 2 | import { Component, For } from "solid-js"; 3 | 4 | export const DisplayRecord: Component<{ record: Record> }> = props => ( 5 | 6 | {k => ( 7 |

8 | {k}:{" "} 9 | {() => { 10 | const val = access(props.record[k]); 11 | return typeof val === "number" ? parseInt(val as any) : String(val); 12 | }} 13 |

14 | )} 15 |
16 | ); 17 | -------------------------------------------------------------------------------- /packages/mouse/dev/utils.ts: -------------------------------------------------------------------------------- 1 | export const lerp = (current: number, goal: number, p: number): number => 2 | (1 - p) * current + p * goal; 3 | -------------------------------------------------------------------------------- /packages/mouse/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types.js"; 2 | export { 3 | makeMousePositionListener, 4 | makeMouseInsideListener, 5 | getPositionToElement, 6 | getPositionToScreen, 7 | getPositionInElement, 8 | } from "./common.js"; 9 | export * from "./primitives.js"; 10 | -------------------------------------------------------------------------------- /packages/mouse/src/types.ts: -------------------------------------------------------------------------------- 1 | import { Position } from "@solid-primitives/utils"; 2 | 3 | export type MouseSourceType = "mouse" | "touch" | null; 4 | 5 | export type MousePosition = Position & { sourceType: MouseSourceType }; 6 | export type MousePositionInside = MousePosition & { isInside: boolean }; 7 | 8 | export interface PositionRelativeToElement extends Position { 9 | top: number; 10 | left: number; 11 | width: number; 12 | height: number; 13 | isInside: boolean; 14 | } 15 | 16 | export interface UseTouchOptions { 17 | /** 18 | * Listen to touch events. If enabled, position will be updated on `touchstart` event. 19 | * @default true 20 | */ 21 | touch?: boolean; 22 | } 23 | export interface FollowTouchOptions { 24 | /** 25 | * If enabled, position will be updated on `touchmove` event. 26 | * @default true 27 | */ 28 | followTouch?: boolean; 29 | } 30 | -------------------------------------------------------------------------------- /packages/mouse/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../rootless" 14 | }, 15 | { 16 | "path": "../static-store" 17 | }, 18 | { 19 | "path": "../utils" 20 | } 21 | ], 22 | "include": [ 23 | "src" 24 | ] 25 | } -------------------------------------------------------------------------------- /packages/mutable/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/mutable 2 | 3 | ## 1.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | 10 | ## 1.1.0 11 | 12 | ### Minor Changes 13 | 14 | - ea09f71: Remove CJS support. The package is ESM only now. 15 | 16 | ## 1.0.2 17 | 18 | ### Patch Changes 19 | 20 | - 74db287: Correct the "homepage" field in package.json 21 | 22 | ## 1.0.1 23 | 24 | ### Patch Changes 25 | 26 | - d23dd74: Add type exports for cjs 27 | -------------------------------------------------------------------------------- /packages/mutable/test/dev.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect, vi } from "vitest"; 2 | import { DEV, unwrap } from "solid-js/store"; 3 | import { createMutable } from "../src/index.js"; 4 | 5 | describe("Dev features", () => { 6 | test("OnStoreNodeUpdate Hook", () => { 7 | const cb = vi.fn(); 8 | DEV!.hooks.onStoreNodeUpdate = cb; 9 | 10 | const store = createMutable({ firstName: "John", lastName: "Smith", inner: { foo: 1 } }); 11 | expect(cb).toHaveBeenCalledTimes(0); 12 | 13 | store.firstName = "Matt"; 14 | expect(cb).toHaveBeenCalledTimes(1); 15 | expect(cb).toHaveBeenCalledWith(unwrap(store), "firstName", "Matt", "John"); 16 | 17 | store.inner.foo = 2; 18 | expect(cb).toHaveBeenCalledTimes(2); 19 | expect(cb).toHaveBeenCalledWith(unwrap(store.inner), "foo", 2, 1); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/mutable/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createMutable } from "../src/index.js"; 3 | 4 | describe("createPrimitiveTemplate", () => { 5 | test("doesn't break in SSR", () => { 6 | const mutable = createMutable({ value: 0 }); 7 | expect(mutable.value).toBe(0); 8 | 9 | mutable.value = 1; 10 | expect(mutable.value).toBe(1); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/mutable/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/mutation-observer/dev/utils.ts: -------------------------------------------------------------------------------- 1 | export const updateItem = (array: readonly T[], index: number, fn: (item: T) => T): T[] => { 2 | const copy = array.slice(); 3 | const newItem = fn(array[index]); 4 | copy.splice(index, 1, newItem); 5 | return copy; 6 | }; 7 | 8 | export const toggleItems = (array: readonly boolean[], toggle: number[]): boolean[] => { 9 | if (!toggle.length) return array as boolean[]; 10 | const copy = array.slice(); 11 | toggle.forEach(i => (copy[i] = !copy[i])); 12 | return copy; 13 | }; 14 | -------------------------------------------------------------------------------- /packages/mutation-observer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Solid App 9 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /packages/mutation-observer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/page-visibility/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "vitest"; 2 | import { createRoot } from "solid-js"; 3 | import { createPageVisibility } from "../src/index.js"; 4 | 5 | describe("createPageVisibility", () => { 6 | it("observes visibilitychange events", () => 7 | createRoot(dispose => { 8 | let doc_visibility = "prerender"; 9 | Object.defineProperty(document, "visibilityState", { 10 | get() { 11 | return doc_visibility; 12 | }, 13 | }); 14 | 15 | const visibility = createPageVisibility(); 16 | expect(visibility()).toBe(false); 17 | 18 | doc_visibility = "visible"; 19 | document.dispatchEvent(new Event("visibilitychange")); 20 | expect(visibility()).toBe(true); 21 | 22 | doc_visibility = "hidden"; 23 | document.dispatchEvent(new Event("visibilitychange")); 24 | expect(visibility()).toBe(false); 25 | 26 | dispose(); 27 | 28 | doc_visibility = "visible"; 29 | document.dispatchEvent(new Event("visibilitychange")); 30 | expect(visibility()).toBe(false); 31 | })); 32 | }); 33 | -------------------------------------------------------------------------------- /packages/page-visibility/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../rootless" 14 | }, 15 | { 16 | "path": "../utils" 17 | } 18 | ], 19 | "include": [ 20 | "src" 21 | ] 22 | } -------------------------------------------------------------------------------- /packages/pagination/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/permission/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createPermission } from "../src/index.js"; 3 | 4 | describe("createPermission", () => { 5 | test("doesn't break in SSR", () => { 6 | expect(createPermission("camera")()).toBe("unknown"); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/permission/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/platform/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | 3 | import * as platform from "../src/index.js"; 4 | 5 | const App: Component = () => { 6 | return ( 7 |
8 |
9 |

Platform:

10 |
    11 | {Object.entries(platform).map(([name, value]) => ( 12 |
  • 13 |
    17 |
  • 18 | ))} 19 |
20 |
21 |
22 | ); 23 | }; 24 | 25 | export default App; 26 | -------------------------------------------------------------------------------- /packages/platform/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/pointer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../rootless" 14 | }, 15 | { 16 | "path": "../utils" 17 | } 18 | ], 19 | "include": [ 20 | "src" 21 | ] 22 | } -------------------------------------------------------------------------------- /packages/presence/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/promise/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/props/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./propTraps.js"; 2 | export * from "./filterProps.js"; 3 | export * from "./combineProps.js"; 4 | -------------------------------------------------------------------------------- /packages/props/src/propTraps.ts: -------------------------------------------------------------------------------- 1 | /* 2 | The propTraps object coles from solid-js repository: 3 | https://github.com/solidjs/solid/blob/main/packages/solid/src/render/component.ts 4 | */ 5 | 6 | import { $PROXY } from "solid-js"; 7 | 8 | function trueFn() { 9 | return true; 10 | } 11 | 12 | export const propTraps: ProxyHandler<{ 13 | get: (k: string | number | symbol) => any; 14 | has: (k: string | number | symbol) => boolean; 15 | keys: () => string[]; 16 | }> = { 17 | get(_, property, receiver) { 18 | if (property === $PROXY) return receiver; 19 | return _.get(property); 20 | }, 21 | has(_, property) { 22 | return _.has(property); 23 | }, 24 | set: trueFn, 25 | deleteProperty: trueFn, 26 | getOwnPropertyDescriptor(_, property) { 27 | return { 28 | configurable: true, 29 | enumerable: true, 30 | get() { 31 | return _.get(property); 32 | }, 33 | set: trueFn, 34 | deleteProperty: trueFn, 35 | }; 36 | }, 37 | ownKeys(_) { 38 | return _.keys(); 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /packages/props/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/raf/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/raf/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createSignal, Show, createEffect } from "solid-js"; 2 | 3 | import RAF from "./raf.js"; 4 | 5 | const App: Component = () => { 6 | return ( 7 |
8 |

Target FPS Dev Test

9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | ); 26 | }; 27 | 28 | export default App; 29 | -------------------------------------------------------------------------------- /packages/raf/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/range/src/common.ts: -------------------------------------------------------------------------------- 1 | import type { MaybeAccessor, MaybeAccessorValue } from "@solid-primitives/utils"; 2 | import type { Accessor } from "solid-js"; 3 | 4 | export type RangeProps = 5 | | { start?: number; to: number; step?: number } 6 | | [start: MaybeAccessor, to: MaybeAccessor, step?: MaybeAccessor]; 7 | 8 | export const { abs, sign, min, ceil, floor } = Math; 9 | 10 | export const accessor = >(a: Accessor) => 11 | (typeof a() === "function" ? a() : a.bind(void 0)) as Accessor>; 12 | 13 | export const toFunction = 14 | (a: Accessor T)>) => 15 | (...args: A) => { 16 | const v = a(); 17 | return typeof v === "function" ? (v as any)(...args) : v; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/range/src/index.ts: -------------------------------------------------------------------------------- 1 | export { type RangeProps } from "./common.js"; 2 | export * from "./repeat.js"; 3 | export * from "./mapRange.js"; 4 | export * from "./indexRange.js"; 5 | -------------------------------------------------------------------------------- /packages/range/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/refs/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/refs/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Rerun } from "../../keyed/src/index.js"; 2 | import { Component, createSignal } from "solid-js"; 3 | import { Transition } from "solid-transition-group"; 4 | 5 | const App: Component = () => { 6 | const [count, setCount] = createSignal(0); 7 | 8 | return ( 9 | <> 10 |
11 | { 13 | el.animate([{ opacity: 0 }, { opacity: 1 }], { 14 | duration: 600, 15 | }).finished.then(done); 16 | }} 17 | onExit={(el, done) => { 18 | el.animate([{ opacity: 1 }, { opacity: 0 }], { 19 | duration: 600, 20 | }).finished.then(done); 21 | }} 22 | mode="outin" 23 | > 24 | 25 | 28 | 29 | 30 |
31 | 32 | ); 33 | }; 34 | export default App; 35 | -------------------------------------------------------------------------------- /packages/refs/test/mergeRefs.test.tsx: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createRoot, onMount } from "solid-js"; 3 | import { mergeRefs, RefProps } from "../src/index.js"; 4 | 5 | describe("mergeRefs", () => { 6 | test("passes ref to props and local var", () => 7 | createRoot(dispose => { 8 | let local!: HTMLButtonElement; 9 | let forwared!: HTMLButtonElement; 10 | 11 | const Button = (props: RefProps) => { 12 | return 17 | 20 | 21 | 22 | 23 | ); 24 | }; 25 | 26 | export default App; 27 | -------------------------------------------------------------------------------- /packages/scheduled/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/script-loader/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "vitest"; 2 | import { createScriptLoader } from "../src/index.js"; 3 | 4 | describe("API doesn't break in SSR", () => { 5 | it("createScriptLoader() - SSR", () => { 6 | expect(createScriptLoader({ src: "url" })).toEqual(undefined); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/script-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/scroll/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "vitest"; 2 | import { createScrollPosition, getScrollPosition, useWindowScrollPosition } from "../src/index.js"; 3 | 4 | describe("getScrollPosition", () => { 5 | it("returns null", () => { 6 | expect(getScrollPosition(undefined)).toEqual({ x: 0, y: 0 }); 7 | }); 8 | }); 9 | 10 | describe("createScrollPosition", () => { 11 | it("returns null", () => { 12 | expect(createScrollPosition()).toEqual({ x: 0, y: 0 }); 13 | }); 14 | }); 15 | 16 | describe("useWindowScrollPosition", () => { 17 | it("returns null", () => { 18 | expect(useWindowScrollPosition()).toEqual({ x: 0, y: 0 }); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/scroll/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../event-listener" 11 | }, 12 | { 13 | "path": "../rootless" 14 | }, 15 | { 16 | "path": "../static-store" 17 | } 18 | ], 19 | "include": [ 20 | "src" 21 | ] 22 | } -------------------------------------------------------------------------------- /packages/selection/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/set/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /packages/set/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createEffect, For } from "solid-js"; 2 | 3 | import { ReactiveSet } from "../src/index.js"; 4 | 5 | const App: Component = () => { 6 | const set = new ReactiveSet([1, 2, 3]); 7 | 8 | setInterval(() => { 9 | const n = Math.round(Math.random() * 10); 10 | set.add(n) || set.delete(n); 11 | }, 1000); 12 | 13 | for (let i = 0; i <= 10; i++) { 14 | createEffect(() => console.log(`HAS ${i}: ${set.has(i)}`)); 15 | } 16 | 17 | return ( 18 |
19 |
20 | {n =>
{n}
}
21 |
22 |

size: {set.size}

23 |
24 | ); 25 | }; 26 | 27 | export default App; 28 | -------------------------------------------------------------------------------- /packages/set/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../trigger" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/share/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createEffect, createSignal } from "solid-js"; 2 | 3 | import { createWebShare } from "../src/index.js"; 4 | 5 | const App: Component = () => { 6 | const [data, setData] = createSignal({}); 7 | const shareStatus = createWebShare(data); 8 | 9 | return ( 10 |
11 |
12 |

Web Share component

13 |

share data: [ url: "https://solidjs.com" ]

14 |

15 | {shareStatus.status === undefined 16 | ? "Haven't started sharing yet." 17 | : shareStatus.status 18 | ? "Sharing success" 19 | : `Sharing failed, ${shareStatus.message}`} 20 |

21 | 24 |
25 |
26 | ); 27 | }; 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /packages/share/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./networks.js"; 2 | export * from "./social-share.js"; 3 | export * from "./web-share.js"; 4 | -------------------------------------------------------------------------------- /packages/share/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect, it } from "vitest"; 2 | import { createRoot, createSignal } from "solid-js"; 3 | import { createWebShare } from "../src/index.js"; 4 | 5 | describe("createWebShare", () => { 6 | test("createWebShare initial values", () => 7 | createRoot(async dispose => { 8 | const [data] = createSignal({}); 9 | const status = createWebShare(data); 10 | 11 | expect(status.status, "Test starting status should be undefined.").toBe(undefined); 12 | expect(status.message, "Test starting message should be undefined.").toBe(undefined); 13 | 14 | dispose(); 15 | })); 16 | 17 | // todo: Asynchronous test. 18 | it.todo("Asynchronous test to change data."); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/share/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { createRoot, createSignal } from "solid-js"; 2 | import { describe, test, expect } from "vitest"; 3 | import { createWebShare } from "../src/index.js"; 4 | 5 | describe("createWebShare", () => { 6 | test("doesn't break in SSR", () => { 7 | createRoot(dispose => { 8 | const [data] = createSignal({}); 9 | const status = createWebShare(data); 10 | 11 | expect(status.status, "Server test starting status should be undefined.").toBe(undefined); 12 | expect(status.message, "Server test starting message should be undefined.").toBe(undefined); 13 | 14 | dispose(); 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/share/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/signal-builders/src/convert.ts: -------------------------------------------------------------------------------- 1 | import { access, MaybeAccessor } from "@solid-primitives/utils"; 2 | import { Accessor, createMemo } from "solid-js"; 3 | 4 | /** 5 | * signal-builder turning passed value to a string 6 | */ 7 | export const string = (from: any): Accessor => createMemo(() => access(from) + ""); 8 | 9 | /** 10 | * signal-builder turning passed string to an float number 11 | */ 12 | export const float = (input: MaybeAccessor): Accessor => 13 | createMemo(() => Number.parseFloat(access(input))); 14 | 15 | /** 16 | * signal-builder turning passed string to an intiger 17 | */ 18 | export const int = (input: MaybeAccessor, radix?: number): Accessor => 19 | createMemo(() => Number.parseInt(access(input), radix)); 20 | 21 | /** 22 | * signal-builder joining array with a separator to a string 23 | */ 24 | export const join = ( 25 | list: MaybeAccessor, 26 | separator?: MaybeAccessor, 27 | ): Accessor => createMemo(() => access(list).join(access(separator))); 28 | -------------------------------------------------------------------------------- /packages/signal-builders/src/index.ts: -------------------------------------------------------------------------------- 1 | // CONVERT 2 | export * from "./convert.js"; 3 | 4 | // STRING 5 | 6 | export * from "./string.js"; 7 | 8 | // NUMBER 9 | export * from "./number.js"; 10 | 11 | // ARRAY 12 | export * from "./array.js"; 13 | 14 | // OBJECT 15 | export * from "./object.js"; 16 | export * from "./update.js"; 17 | -------------------------------------------------------------------------------- /packages/signal-builders/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/spring/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/spring 2 | 3 | ## 0.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | 10 | ## 0.1.0 11 | 12 | ### Minor Changes 13 | 14 | - ea09f71: Remove CJS support. The package is ESM only now. 15 | -------------------------------------------------------------------------------- /packages/spring/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createDerivedSpring, createSpring } from "../src/index.js"; 3 | import { createSignal } from "solid-js"; 4 | 5 | describe("createSpring", () => { 6 | test("doesn't break in SSR", () => { 7 | const [value, setValue] = createSpring({ progress: 0 }); 8 | expect(value().progress, "initial value should be { progress: 0 }").toBe(0); 9 | }); 10 | }); 11 | 12 | describe("createDerivedSpring", () => { 13 | test("doesn't break in SSR", () => { 14 | const [signal, setSignal] = createSignal({ progress: 0 }); 15 | const value = createDerivedSpring(signal); 16 | expect(value().progress, "initial value should be { progress: 0 }").toBe(0); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/spring/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/state-machine/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/state-machine 2 | 3 | ## 0.1.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | 10 | ## 0.1.0 11 | 12 | ### Minor Changes 13 | 14 | - ea09f71: Remove CJS support. The package is ESM only now. 15 | 16 | ## 0.0.3 17 | 18 | ### Patch Changes 19 | 20 | - 74db287: Correct the "homepage" field in package.json 21 | 22 | ## 0.0.2 23 | 24 | ### Patch Changes 25 | 26 | - d23dd74: Add type exports for cjs 27 | -------------------------------------------------------------------------------- /packages/state-machine/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test } from "vitest"; 2 | import { createRoot } from "solid-js"; 3 | import { createMachine } from "../src/index.js"; 4 | 5 | describe("createMachine", () => { 6 | test("works", () => 7 | createRoot(() => { 8 | createMachine<{ 9 | idle: { value: "foo" }; 10 | loading: { value: "bar" }; 11 | }>({ 12 | initial: "idle", 13 | states: { 14 | idle: () => "foo", 15 | loading: () => "bar", 16 | }, 17 | }); 18 | })); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/state-machine/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/static-store/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createSignal } from "solid-js"; 2 | 3 | const App: Component = () => { 4 | const [count, setCount] = createSignal(0); 5 | const increment = () => setCount(count() + 1); 6 | 7 | return ( 8 |
9 |
10 |

Counter component

11 |

it's very important...

12 | 15 |
16 |
17 | ); 18 | }; 19 | 20 | export default App; 21 | -------------------------------------------------------------------------------- /packages/static-store/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "vitest"; 2 | import { 3 | createHydratableStaticStore, 4 | createStaticStore, 5 | createDerivedStaticStore, 6 | } from "../src/index.js"; 7 | 8 | describe("createStaticStore", () => { 9 | test("doesn't break in SSR", () => { 10 | const [state, setState] = createStaticStore({ foo: "server" }); 11 | expect(state).toEqual({ foo: "server" }); 12 | expect(setState).toBeInstanceOf(Function); 13 | }); 14 | }); 15 | 16 | describe("createHydratableStaticStore", () => { 17 | test("createHydratableStaticStore() - SSR", () => { 18 | const [state, setState] = createHydratableStaticStore({ foo: "server" }, () => ({ 19 | foo: "client", 20 | })); 21 | expect(state).toEqual({ foo: "server" }); 22 | expect(setState).toBeInstanceOf(Function); 23 | }); 24 | }); 25 | 26 | describe("createDerivedStaticStore", () => { 27 | test("createDerivedStaticStore() - SSR", () => { 28 | const state = createDerivedStaticStore(() => ({ foo: "server" })); 29 | expect(state).toEqual({ foo: "server" }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/static-store/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/storage/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createSignal, untrack } from "solid-js"; 2 | import { makePersisted } from "../src/index.js"; 3 | 4 | const App: Component = () => { 5 | const [value, setValue] = makePersisted(createSignal("initial value"), { name: "value" }); 6 | 7 | return ( 8 |
9 |
10 |

Persisted signal in localStorage

11 | setValue(ev.currentTarget.value)} /> 12 |

Try to change the value and reload the page - it is persisted in localStorage.

13 |
14 |
15 | ); 16 | }; 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /packages/storage/src/index.ts: -------------------------------------------------------------------------------- 1 | import { type CookieOptions, cookieStorage } from "./cookies.js"; 2 | import { 3 | addClearMethod, 4 | addWithOptionsMethod, 5 | multiplexStorage, 6 | makeObjectStorage, 7 | } from "./tools.js"; 8 | import { 9 | type SyncStorage, 10 | type SyncStorageWithOptions, 11 | type AsyncStorage, 12 | type AsyncStorageWithOptions, 13 | type PersistenceOptions, 14 | type PersistenceSyncAPI, 15 | type PersistenceSyncData, 16 | type PersistenceSyncCallback, 17 | makePersisted, 18 | multiplexSync, 19 | storageSync, 20 | messageSync, 21 | wsSync, 22 | } from "./persisted.js"; 23 | export { 24 | type CookieOptions, 25 | cookieStorage, 26 | addClearMethod, 27 | addWithOptionsMethod, 28 | multiplexStorage, 29 | makeObjectStorage, 30 | type SyncStorage, 31 | type SyncStorageWithOptions, 32 | type AsyncStorage, 33 | type AsyncStorageWithOptions, 34 | type PersistenceOptions, 35 | type PersistenceSyncCallback, 36 | type PersistenceSyncData, 37 | type PersistenceSyncAPI, 38 | makePersisted, 39 | multiplexSync, 40 | storageSync, 41 | wsSync, 42 | messageSync, 43 | }; 44 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist -------------------------------------------------------------------------------- /packages/storage/tauri-storage/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/README.md: -------------------------------------------------------------------------------- 1 | # tauriStorage Demo 2 | 3 | This is a demo application for tauriStorage from @solid-primitives/storage. 4 | 5 | > **Warning:** installing/running this locally requires the use of a package manager different than pnpm, since otherwise there will be a conflict with the workspace. 6 | 7 | ## Setup: 8 | 9 | ```bash 10 | npm i 11 | ``` 12 | 13 | ## Run 14 | 15 | ```bash 16 | # web version 17 | npm run dev 18 | # tauri version 19 | npm run tauri dev 20 | ``` 21 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Tauri + Solid + Typescript App 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tauri-storage", 3 | "version": "0.0.0", 4 | "description": "a demonstration of tauriStorage", 5 | "type": "module", 6 | "scripts": { 7 | "start": "vite", 8 | "dev": "vite", 9 | "build": "vite build", 10 | "serve": "vite preview", 11 | "tauri": "tauri" 12 | }, 13 | "license": "MIT", 14 | "dependencies": { 15 | "solid-js": "^1.7.8", 16 | "@tauri-apps/api": ">=2.0.0-beta.0", 17 | "@tauri-apps/plugin-store": ">=2.0.0-beta.0" 18 | }, 19 | "devDependencies": { 20 | "typescript": "^5.0.2", 21 | "vite": "^5.0.0", 22 | "vite-plugin-solid": "^2.8.0", 23 | "@tauri-apps/cli": ">=2.0.0-beta.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | 5 | # Generated by Tauri 6 | # will have schema files for capabilities auto-completion 7 | /gen/schemas 8 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tauri-storage" 3 | version = "0.0.0" 4 | description = "A Tauri App demonstrating the use of tauriStorage" 5 | authors = ["Alex Lohr"] 6 | edition = "2021" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [build-dependencies] 11 | tauri-build = { version = "2.0.0-beta", features = [] } 12 | 13 | [dependencies] 14 | tauri = { version = "2.0.0-beta", features = [] } 15 | tauri-plugin-store = "2.0.0-beta" 16 | serde = { version = "1", features = ["derive"] } 17 | serde_json = "1" 18 | 19 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | tauri_build::build() 3 | } 4 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/capabilities/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../gen/schemas/desktop-schema.json", 3 | "identifier": "default", 4 | "description": "Capability for the main window", 5 | "windows": ["main"], 6 | "permissions": [ 7 | "path:default", 8 | "event:default", 9 | "window:default", 10 | "app:default", 11 | "image:default", 12 | "resources:default", 13 | "menu:default", 14 | "tray:default", 15 | "store:allow-get", 16 | "store:allow-set", 17 | "store:allow-delete", 18 | "store:allow-keys", 19 | "store:allow-clear", 20 | "store:allow-load", 21 | "store:allow-save" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/128x128.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/128x128@2x.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/32x32.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square107x107Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square107x107Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square142x142Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square142x142Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square150x150Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square150x150Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square284x284Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square284x284Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square30x30Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square30x30Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square310x310Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square310x310Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square44x44Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square44x44Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square71x71Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square71x71Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/Square89x89Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/Square89x89Logo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/StoreLogo.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/icon.icns -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/icon.ico -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/packages/storage/tauri-storage/src-tauri/icons/icon.png -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/src/main.rs: -------------------------------------------------------------------------------- 1 | // Prevents additional console window on Windows in release, DO NOT REMOVE!! 2 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] 3 | 4 | fn main() { 5 | tauri::Builder::default() 6 | .plugin(tauri_plugin_store::Builder::new().build()) 7 | .run(tauri::generate_context!()) 8 | .expect("error while running tauri application"); 9 | } 10 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src-tauri/tauri.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "productName": "tauri-storage", 3 | "version": "0.0.0", 4 | "identifier": "com.tauri.storage-demo", 5 | "build": { 6 | "beforeDevCommand": "npm run dev", 7 | "devUrl": "http://localhost:1420", 8 | "beforeBuildCommand": "npm run build", 9 | "frontendDist": "../dist" 10 | }, 11 | "app": { 12 | "windows": [ 13 | { 14 | "title": "tauri-storage", 15 | "width": 800, 16 | "height": 600 17 | } 18 | ], 19 | "security": { 20 | "csp": null 21 | } 22 | }, 23 | "bundle": { 24 | "active": true, 25 | "targets": "all", 26 | "icon": [ 27 | "icons/32x32.png", 28 | "icons/128x128.png", 29 | "icons/128x128@2x.png", 30 | "icons/icon.icns", 31 | "icons/icon.ico" 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src/index.tsx: -------------------------------------------------------------------------------- 1 | /* @refresh reload */ 2 | import { render } from "solid-js/web"; 3 | 4 | import "./styles.css"; 5 | import App from "./App.jsx"; 6 | 7 | render(() => , document.getElementById("root") as HTMLElement); 8 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "include": ["src"], 25 | "references": [{ "path": "./tsconfig.node.json" }] 26 | } 27 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/storage/tauri-storage/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import solid from "vite-plugin-solid"; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig(async () => ({ 6 | plugins: [solid()], 7 | 8 | // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` 9 | // 10 | // 1. prevent vite from obscuring rust errors 11 | clearScreen: false, 12 | // 2. tauri expects a fixed port, fail if that port is not available 13 | server: { 14 | port: 1420, 15 | strictPort: true, 16 | watch: { 17 | // 3. tell vite to ignore watching `src-tauri` 18 | ignored: ["**/src-tauri/**"], 19 | }, 20 | }, 21 | })); 22 | -------------------------------------------------------------------------------- /packages/storage/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/stream/demo/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { viteConfig } from "../../../configs/vite.config.js"; 2 | export default viteConfig; 3 | -------------------------------------------------------------------------------- /packages/stream/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { 3 | createStream, 4 | createAmplitudeStream, 5 | createMediaPermissionRequest, 6 | createScreen, 7 | } from "../src/index.js"; 8 | 9 | describe("API doesn't break in SSR", () => { 10 | // check if the API doesn't throw when calling it in SSR 11 | test("createStream() - SSR", () => { 12 | expect(createStream({ audio: true })[0]()).toBe(undefined); 13 | }); 14 | 15 | test("createAmplitudeStream() - SSR", () => { 16 | expect(createAmplitudeStream({ audio: true })[0]()).toBe(0); 17 | }); 18 | 19 | test("createMediaPermissionRequest() - SSR", () => { 20 | expect(createMediaPermissionRequest()).toBeInstanceOf(Promise); 21 | }); 22 | 23 | test("createScreen() - SSR", () => { 24 | expect(createScreen({ audio: true })[0]()).toBe(undefined); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/stream/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/styles/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | 3 | import { createRemSize } from "../src/index.js"; 4 | 5 | const App: Component = () => { 6 | const remSize = createRemSize(); 7 | 8 | return ( 9 |
10 |
11 |

Rem size: {remSize()}

12 |
13 |
14 | ); 15 | }; 16 | 17 | export default App; 18 | -------------------------------------------------------------------------------- /packages/styles/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "vitest"; 2 | 3 | describe("styles", () => { 4 | it.todo("write tests"); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/styles/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "vitest"; 2 | 3 | describe("styles", () => { 4 | it.todo("write tests"); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/styles/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../rootless" 11 | }, 12 | { 13 | "path": "../utils" 14 | } 15 | ], 16 | "include": [ 17 | "src" 18 | ] 19 | } -------------------------------------------------------------------------------- /packages/timer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/transition-group/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import ListPage from "./list-page.js"; 2 | import SwitchPage from "./switch-page.js"; 3 | import { Match, Switch, createSignal } from "solid-js"; 4 | 5 | function App() { 6 | const [page, setPage] = createSignal("list" as "list" | "switch"); 7 | 8 | return ( 9 | <> 10 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | ); 30 | } 31 | 32 | export default App; 33 | -------------------------------------------------------------------------------- /packages/transition-group/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/trigger/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createSignal } from "solid-js"; 2 | 3 | const App: Component = () => { 4 | // const [count, setCount] = createSignal(0); 5 | // const increment = () => setCount(count() + 1); 6 | 7 | return ( 8 |
9 |
10 |

Counter component

11 |

it's very important...

12 | {/* */} 15 |
16 |
17 | ); 18 | }; 19 | 20 | export default App; 21 | -------------------------------------------------------------------------------- /packages/trigger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/tween/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/upload/test/index.test.tsx: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from "vitest"; 2 | import { createRoot } from "solid-js"; 3 | import { createFileUploader } from "../src/index.js"; 4 | 5 | describe("createFileUploader", () => { 6 | it("file upload", () => { 7 | createRoot(dispose => { 8 | const { files: file } = createFileUploader(); 9 | const { files } = createFileUploader({ multiple: true }); 10 | 11 | expect(file()).toEqual([]); 12 | expect(files()).toEqual([]); 13 | dispose(); 14 | }); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/upload/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/utils/src/immutable/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./copy.js"; 2 | export * from "./number.js"; 3 | export * from "./update.js"; 4 | export * from "./object.js"; 5 | export * from "./array.js"; 6 | export * from "./types.js"; 7 | -------------------------------------------------------------------------------- /packages/utils/src/immutable/types.ts: -------------------------------------------------------------------------------- 1 | import { ItemsOf } from "../index.js"; 2 | 3 | export type Predicate = (item: T, index: number, array: readonly T[]) => boolean; 4 | export type MappingFn = (item: T, index: number, array: readonly T[]) => V; 5 | 6 | export type FlattenArray = T extends any[] ? FlattenArray> : T; 7 | 8 | export type ModifyValue = Omit & { [key in K]: V }; 9 | -------------------------------------------------------------------------------- /packages/utils/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { createHydratableSignal } from "../src/index.js"; 2 | import { describe, expect, test } from "vitest"; 3 | 4 | describe("API doesn't break in SSR", () => { 5 | test("createHydratableSignal() - SSR", () => { 6 | const [state, setState] = createHydratableSignal("server", () => "client"); 7 | expect(state()).toEqual("server"); 8 | expect(setState).toBeInstanceOf(Function); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/virtual/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @solid-primitives/virtual 2 | 3 | ## 0.2.1 4 | 5 | ### Patch Changes 6 | 7 | - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json 8 | (Fixes #774, Fixes #749) 9 | - Updated dependencies [53f08cc] 10 | - @solid-primitives/utils@6.3.1 11 | 12 | ## 0.2.0 13 | 14 | ### Minor Changes 15 | 16 | - ea09f71: Remove CJS support. The package is ESM only now. 17 | 18 | ### Patch Changes 19 | 20 | - Updated dependencies [ea09f71] 21 | - @solid-primitives/utils@6.3.0 22 | 23 | ## 0.1.1 24 | 25 | ### Patch Changes 26 | 27 | - b3d7917: Add solid export condition 28 | 29 | ## 0.1.0 30 | 31 | ### Minor Changes 32 | 33 | - e1ebe61: Add a headless virtual list primitive: `createVirtualList` in #702 34 | -------------------------------------------------------------------------------- /packages/virtual/test/server.test.tsx: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { renderToString } from "solid-js/web"; 3 | import { VirtualList } from "../src/index.jsx"; 4 | 5 | const TEST_LIST = Array.from({ length: 1000 }, (_, i) => i); 6 | 7 | describe("VirtualList", () => { 8 | test("doesn't break in SSR", () => { 9 | const virtualListStr = renderToString(() => ( 10 | 11 | {item =>
{item}
} 12 |
13 | )); 14 | 15 | expect(virtualListStr).toEqual( 16 | [ 17 | '
', 18 | '
', 19 | '
', 20 | '
0
', 21 | '
1
', 22 | '
2
', 23 | "
", 24 | "
", 25 | "
", 26 | ] 27 | .map(v => v.trim()) 28 | .join(""), 29 | ); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/virtual/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [ 9 | { 10 | "path": "../utils" 11 | } 12 | ], 13 | "include": [ 14 | "src" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/websocket/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/workers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Solid Primitives Development 9 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /packages/workers/src/types.d.ts: -------------------------------------------------------------------------------- 1 | export type WorkerSignal = number; 2 | 3 | export type WorkerCallbacks = Map; 4 | 5 | export type WorkerMessage = { 6 | type: WorkerSignal; 7 | id?: string; 8 | error?: string; 9 | method?: string; 10 | signal?: string | number; 11 | result?: string; 12 | params?: any; 13 | }; 14 | 15 | export type WorkerExports = [ 16 | worker: Worker, 17 | start: () => void, 18 | stop: () => void, 19 | exports?: Set, 20 | ]; 21 | 22 | export interface PostMessageOptions { 23 | transfer?: any[] | undefined; 24 | } 25 | -------------------------------------------------------------------------------- /packages/workers/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - packages/* 3 | - site 4 | -------------------------------------------------------------------------------- /scripts/dev.ts: -------------------------------------------------------------------------------- 1 | import child_process from "node:child_process"; 2 | import * as utils from "./utils/index.js"; 3 | 4 | const args = process.argv.slice(2); 5 | const package_name = utils.getPackageNameFromCWD(); 6 | if (package_name == null) { 7 | throw "this script should be ran from one of the pacakges"; 8 | } 9 | 10 | utils.log_info( 11 | `Starting dev server for the ${package_name} package...\n 12 | Visit the playground at http://localhost:3000/playground/${package_name} to test your changes.`, 13 | ); 14 | 15 | // execute dev script 16 | child_process.spawn("pnpm", ["run", "dev", ...args], { 17 | stdio: "inherit", 18 | shell: true, 19 | cwd: utils.ROOT_DIR, 20 | }); 21 | -------------------------------------------------------------------------------- /scripts/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./calculate-bundlesize.js"; 2 | export * from "./get-modules-data.js"; 3 | export * from "./utils.js"; 4 | -------------------------------------------------------------------------------- /site/.env: -------------------------------------------------------------------------------- 1 | # Public Environment Variables 2 | # These variables are available to the public and can be accessed by anyone. 3 | 4 | VITE_SITE_URL=https://solid-primitives.netlify.app 5 | VITE_SUPABASE_URL=https://hpinwklbtszwebhaqjxr.supabase.co 6 | VITE_SUPABASE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImhwaW53a2xidHN6d2ViaGFxanhyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mzc1NTc1MTUsImV4cCI6MjA1MzEzMzUxNX0._D88mlVMZvkvipFkSwQBA8QZ9i0cl1tutWdYpM02cdI 7 | NODE_VERSION=18.15.0 8 | -------------------------------------------------------------------------------- /site/.gitignore: -------------------------------------------------------------------------------- 1 | # SolidStart 2 | .solid 3 | .vinxi 4 | .output 5 | 6 | # TEMP 7 | src/_generated/* 8 | -------------------------------------------------------------------------------- /site/app.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "@solidjs/start/config"; 2 | 3 | const packages = await (async () => { 4 | try { 5 | // @ts-ignore 6 | return (await import("./src/_generated/packages.json")).default; 7 | } catch (e) { 8 | throw new Error("No packages found. Did you run `pnpm generate`?"); 9 | } 10 | })(); 11 | 12 | export default defineConfig({ 13 | vite: { 14 | resolve: { 15 | // use files in packages src dir 16 | conditions: ["@solid-primitives/source"], 17 | }, 18 | build: { 19 | sourcemap: true, 20 | }, 21 | }, 22 | server: { 23 | prerender: { 24 | routes: [ 25 | "/", 26 | ...packages.flatMap(({ name }: { name: string }) => [ 27 | `/package/${name}`, 28 | `/playground/${name}`, 29 | ]), 30 | ], 31 | }, 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /site/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /site/public/favicons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/android-chrome-192x192.png -------------------------------------------------------------------------------- /site/public/favicons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/android-chrome-512x512.png -------------------------------------------------------------------------------- /site/public/favicons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/apple-touch-icon.png -------------------------------------------------------------------------------- /site/public/favicons/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /site/public/favicons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/favicon-16x16.png -------------------------------------------------------------------------------- /site/public/favicons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/favicon-32x32.png -------------------------------------------------------------------------------- /site/public/favicons/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/favicon.ico -------------------------------------------------------------------------------- /site/public/favicons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/icon-192x192.png -------------------------------------------------------------------------------- /site/public/favicons/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/icon-256x256.png -------------------------------------------------------------------------------- /site/public/favicons/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/icon-384x384.png -------------------------------------------------------------------------------- /site/public/favicons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/icon-512x512.png -------------------------------------------------------------------------------- /site/public/favicons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/favicons/mstile-150x150.png -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Black-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Black-Italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Black-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Black-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Black-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Black-Italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Black.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Black.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Black.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold-italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold-italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold.eot -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold.ttf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Bold.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Light-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Light-Italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Light-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Light-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Light-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Light-Italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Light.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Light.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Light.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium-Italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium-Italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium.eot -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium.ttf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Medium.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular-Italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular-Italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular.eot -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular.ttf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Regular.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin-Italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin-Italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin.eot -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin.ttf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Thin.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Ultra-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Ultra-Italic.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Ultra-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Ultra-Italic.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Ultra-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Ultra-Italic.woff2 -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Ultra.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Ultra.otf -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Ultra.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Ultra.woff -------------------------------------------------------------------------------- /site/public/fonts/Gordita/Gordita-Ultra.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/fonts/Gordita/Gordita-Ultra.woff2 -------------------------------------------------------------------------------- /site/public/og.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidjs-community/solid-primitives/e8461ce312c510ac6d187992c3d0888bc67f32b9/site/public/og.jpeg -------------------------------------------------------------------------------- /site/src/api.ts: -------------------------------------------------------------------------------- 1 | import { isServer } from "solid-js/web"; 2 | import { PackageData, PackageListItem } from "./types.js"; 3 | 4 | const GEN_DIR = "_generated"; 5 | 6 | let packageList: PackageListItem[] | null = null; 7 | 8 | export function getCachedPackageListItemData(name: string): PackageListItem | null { 9 | if (isServer) { 10 | return null; 11 | } 12 | 13 | if (!packageList) { 14 | fetchPackageList(); 15 | return null; 16 | } 17 | 18 | return packageList.find(item => item.name === name) ?? null; 19 | } 20 | 21 | export async function fetchPackageData(name: string): Promise { 22 | return import(`./${GEN_DIR}/packages/${name}.json`); 23 | } 24 | 25 | export async function fetchPackageList(): Promise { 26 | const data = (await import(`./${GEN_DIR}/packages.json`)).default as PackageListItem[]; 27 | 28 | if (!isServer) { 29 | packageList = data; 30 | } 31 | 32 | return data; 33 | } 34 | 35 | export async function fetchHomeContent(): Promise { 36 | return (await import(`./${GEN_DIR}/home-content.html?raw`)).default; 37 | } 38 | -------------------------------------------------------------------------------- /site/src/components/Footer/Footer.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | 3 | const Footer: Component = () => { 4 | return ( 5 | 30 | ); 31 | }; 32 | 33 | export default Footer; 34 | -------------------------------------------------------------------------------- /site/src/components/Icons/HalfSun.tsx: -------------------------------------------------------------------------------- 1 | const HalfSun = () => { 2 | return ( 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ); 23 | }; 24 | 25 | export default HalfSun; 26 | -------------------------------------------------------------------------------- /site/src/components/Icons/NpmLogo.tsx: -------------------------------------------------------------------------------- 1 | const NpmLogo = () => { 2 | return ( 3 | 4 | 8 | 9 | 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default NpmLogo; 16 | -------------------------------------------------------------------------------- /site/src/components/Icons/NpmMonochrome.tsx: -------------------------------------------------------------------------------- 1 | const NpmMonochrome = () => { 2 | return ( 3 | 4 | 9 | 14 | 15 | ); 16 | }; 17 | 18 | export default NpmMonochrome; 19 | -------------------------------------------------------------------------------- /site/src/components/Icons/NpmOppositeMonochrome.tsx: -------------------------------------------------------------------------------- 1 | const NpmOppositeMonochrome = () => { 2 | return ( 3 | 4 | 5 | 6 | 7 | 8 | ); 9 | }; 10 | 11 | export default NpmOppositeMonochrome; 12 | -------------------------------------------------------------------------------- /site/src/components/Icons/PnpmLogo.tsx: -------------------------------------------------------------------------------- 1 | const PnpmLogo = () => { 2 | return ( 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | }; 19 | 20 | export default PnpmLogo; 21 | -------------------------------------------------------------------------------- /site/src/components/Icons/PnpmMonochrome.tsx: -------------------------------------------------------------------------------- 1 | const PnpmMonochrome = () => { 2 | return ( 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | }; 19 | 20 | export default PnpmMonochrome; 21 | -------------------------------------------------------------------------------- /site/src/components/Icons/YarnLogo.tsx: -------------------------------------------------------------------------------- 1 | const YarnLogo = () => { 2 | return ( 3 | 9 | 13 | 14 | ); 15 | }; 16 | 17 | export default YarnLogo; 18 | -------------------------------------------------------------------------------- /site/src/components/Primitives/BundleSizeWrapper.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | 3 | const BundleSizeWrapper: Component<{ value: number; unit: string }> = ({ unit, value }) => { 4 | return ( 5 | 6 | {value} {unit} 7 | 8 | ); 9 | }; 10 | 11 | export default BundleSizeWrapper; 12 | -------------------------------------------------------------------------------- /site/src/components/Primitives/CodePrimitive.tsx: -------------------------------------------------------------------------------- 1 | import { createSignal, ParentComponent } from "solid-js"; 2 | import { useTippy } from "solid-tippy"; 3 | 4 | const CodePrimitive: ParentComponent = props => { 5 | const [anchor, setAnchor] = createSignal(); 6 | 7 | useTippy(anchor, { 8 | props: { 9 | content: "This is a tooltip.", 10 | }, 11 | }); 12 | return {props.children}; 13 | }; 14 | 15 | export default CodePrimitive; 16 | -------------------------------------------------------------------------------- /site/src/components/Primitives/PrimitiveBtn.tsx: -------------------------------------------------------------------------------- 1 | import { ParentComponent } from "solid-js"; 2 | import { A } from "@solidjs/router"; 3 | 4 | const PrimitiveBtn: ParentComponent<{ href: string }> = props => { 5 | return ( 6 | 10 | {props.children} 11 | 12 | ); 13 | }; 14 | 15 | export default PrimitiveBtn; 16 | -------------------------------------------------------------------------------- /site/src/components/Primitives/PrimitiveBtnLineWrapper.tsx: -------------------------------------------------------------------------------- 1 | import { ParentComponent } from "solid-js"; 2 | 3 | const PrimitiveBtnLineWrapper: ParentComponent<{ primitiveName: string }> = props => { 4 | return ( 5 |
6 |
{props.children}
7 | 12 | ); 13 | }; 14 | 15 | export default PrimitiveBtnLineWrapper; 16 | -------------------------------------------------------------------------------- /site/src/components/Primitives/SizeUnitSpan.tsx: -------------------------------------------------------------------------------- 1 | import { ParentComponent } from "solid-js"; 2 | 3 | const SizeUnitSpan: ParentComponent = props => { 4 | return {props.children}; 5 | }; 6 | 7 | export default SizeUnitSpan; 8 | -------------------------------------------------------------------------------- /site/src/components/Search/CheckBox/CheckBox.tsx: -------------------------------------------------------------------------------- 1 | import { ParentComponent } from "solid-js"; 2 | import s from "./checkbox.module.scss.js"; 3 | 4 | const CheckBox: ParentComponent<{ 5 | checked: boolean; 6 | onChange: (props: boolean) => void; 7 | }> = props => { 8 | return ( 9 | 21 | ); 22 | }; 23 | export default CheckBox; 24 | -------------------------------------------------------------------------------- /site/src/components/Search/CheckBox/checkbox.module.scss: -------------------------------------------------------------------------------- 1 | .checkbox:checked[type="checkbox"] { 2 | --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); 3 | } 4 | 5 | .checkbox:checked { 6 | background-color: #306fc4; 7 | border-color: #306fc4; 8 | } 9 | 10 | .checkbox[type="checkbox"] { 11 | border-radius: 999px; 12 | } 13 | 14 | .checkbox { 15 | width: 1em; 16 | height: 1em; 17 | margin-top: 0.25em; 18 | vertical-align: top; 19 | background-image: var(--bs-form-check-bg-image); 20 | background-repeat: no-repeat; 21 | background-position: center; 22 | background-size: contain; 23 | border: 1px solid #306fc4; 24 | -webkit-appearance: none; 25 | -moz-appearance: none; 26 | appearance: none; 27 | -webkit-print-color-adjust: exact; 28 | color-adjust: exact; 29 | print-color-adjust: exact; 30 | } 31 | -------------------------------------------------------------------------------- /site/src/components/Search/SearchBtn.tsx: -------------------------------------------------------------------------------- 1 | import { isIOS, isWindows } from "@solid-primitives/platform"; 2 | import { FiSearch } from "solid-icons/fi"; 3 | import { Component, Show } from "solid-js"; 4 | import { focusSearchInput } from "./Search.js"; 5 | 6 | const SearchBtn: Component<{ ref: HTMLButtonElement }> = props => { 7 | return ( 8 | 25 | ); 26 | }; 27 | 28 | export default SearchBtn; 29 | -------------------------------------------------------------------------------- /site/src/components/Search/SearchModal.tsx: -------------------------------------------------------------------------------- 1 | import { lazy, Suspense } from "solid-js"; 2 | import { ClientOnly } from "~/primitives/client-only"; 3 | import type * as API from "./ClientSearchModal.js"; 4 | 5 | const ClientSearchModal = lazy(() => import("./ClientSearchModal")); 6 | 7 | const SearchModal: typeof API.default = props => { 8 | return ( 9 | 10 | 11 | 12 | 13 | 14 | ); 15 | }; 16 | 17 | export default SearchModal; 18 | -------------------------------------------------------------------------------- /site/src/components/prose.tsx: -------------------------------------------------------------------------------- 1 | import { Component } from "solid-js"; 2 | 3 | export const H2: Component<{ text: string }> = props => { 4 | const id = () => props.text.toLowerCase().replace(/ /g, "-"); 5 | return ( 6 |

7 | 8 | # 9 | 10 | {props.text} 11 |

12 | ); 13 | }; 14 | -------------------------------------------------------------------------------- /site/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const BASE = "/"; 2 | export const BASE_NOFS = BASE.replace(/\/$/, ""); 3 | export const pageWidthClass = "max-w-[900px]"; 4 | export const GITHUB_REPO = "https://github.com/solidjs-community/solid-primitives"; 5 | -------------------------------------------------------------------------------- /site/src/entry-client.tsx: -------------------------------------------------------------------------------- 1 | // @refresh reload 2 | import { debounce } from "@solid-primitives/scheduled"; 3 | import { mount, StartClient } from "@solidjs/start/client"; 4 | 5 | // import "solid-devtools"; 6 | 7 | // Primitives/Table.tsx produces a lot of hydration warnings in development mode. 8 | if (import.meta.env.MODE === "development") { 9 | const keys: string[] = []; 10 | // eslint-disable-next-line no-console 11 | const cw = console.warn; 12 | // eslint-disable-next-line no-console 13 | console.warn = (...args) => { 14 | if (args[0] === "Unable to find DOM nodes for hydration key:") { 15 | keys.push(args[1]); 16 | logStoredWarnings(); 17 | } else cw(...args); 18 | }; 19 | const logStoredWarnings = debounce(() => { 20 | // eslint-disable-next-line no-console 21 | console.groupCollapsed(`There were ${keys.length} hydration warnings.`); 22 | keys.forEach(key => cw("Unable to find DOM nodes for hydration key:", key)); 23 | // eslint-disable-next-line no-console 24 | console.groupEnd(); 25 | keys.length = 0; 26 | }, 1000); 27 | } 28 | 29 | mount(() => , document); 30 | -------------------------------------------------------------------------------- /site/src/entry-server.tsx: -------------------------------------------------------------------------------- 1 | // @refresh reload 2 | import { createHandler, StartServer } from "@solidjs/start/server"; 3 | 4 | export default createHandler(() => props.children} />, { 5 | mode: "async", 6 | }); 7 | -------------------------------------------------------------------------------- /site/src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | // declare import.meta.env 4 | interface ImportMetaEnv { 5 | readonly VITE_SITE_URL: string; 6 | readonly VITE_SUPABASE_URL: string; 7 | readonly VITE_SUPABASE_KEY: string; 8 | } 9 | 10 | interface ImportMeta { 11 | readonly env: ImportMetaEnv; 12 | } 13 | -------------------------------------------------------------------------------- /site/src/primitives-page-main.module.scss: -------------------------------------------------------------------------------- 1 | :global([data-html]) { 2 | background-image: linear-gradient(94deg, #f2f8fa, #f1f3fa); 3 | background: #f2f8fa; 4 | } 5 | -------------------------------------------------------------------------------- /site/src/primitives-page-main.scss: -------------------------------------------------------------------------------- 1 | html { 2 | background-image: linear-gradient(94deg, #f2f8fa, #f1f3fa); 3 | background: #f2f8fa; 4 | } 5 | -------------------------------------------------------------------------------- /site/src/primitives/client-only.ts: -------------------------------------------------------------------------------- 1 | import { createMemo, createSignal, FlowComponent, JSX, onMount, sharedConfig } from "solid-js"; 2 | import { isServer } from "solid-js/web"; 3 | 4 | // https://github.com/solidjs/solid/pull/1592 5 | 6 | export const ClientOnly: FlowComponent = props => { 7 | if (isServer) return undefined; 8 | if (sharedConfig.context) { 9 | const [flag, setFlag] = createSignal(false); 10 | onMount(() => setFlag(true)); 11 | return createMemo(() => 12 | flag() ? createMemo(() => props.children) : undefined, 13 | ) as unknown as JSX.Element; 14 | } 15 | return createMemo(() => props.children) as unknown as JSX.Element; 16 | }; 17 | -------------------------------------------------------------------------------- /site/src/primitives/document-class.tsx: -------------------------------------------------------------------------------- 1 | import { Component, onCleanup } from "solid-js"; 2 | import { isServer, NoHydration } from "solid-js/web"; 3 | 4 | export const DocumentClass: Component<{ class: string }> = props => { 5 | if (!isServer) { 6 | document.documentElement.classList.add(props.class); 7 | onCleanup(() => { 8 | document.documentElement.classList.remove(props.class); 9 | }); 10 | } 11 | 12 | return ( 13 | 14 | 15 | 16 | ); 17 | }; 18 | -------------------------------------------------------------------------------- /site/src/routes/package/[name]/components/primitive-name-tooltips.tsx: -------------------------------------------------------------------------------- 1 | import { Accessor, createEffect, untrack, createSignal } from "solid-js"; 2 | import { BundlesizeItem } from "~/types"; 3 | 4 | export function createPrimitiveNameTooltips( 5 | target: HTMLElement, 6 | primitives: Accessor, 7 | ) { 8 | const [fn, setFn] = 9 | createSignal(); 10 | 11 | createEffect(() => { 12 | const fnValue = fn(); 13 | if (fnValue) { 14 | createEffect(() => { 15 | const primitivesList = primitives(); 16 | if (primitivesList) untrack(() => fnValue({ target, primitives: primitivesList })); 17 | }); 18 | } 19 | }); 20 | 21 | import("./primitive-name-tooltip.client").then(({ createPrimitiveNameTooltips }) => 22 | setFn(() => createPrimitiveNameTooltips), 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /site/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { FormattedBytes } from "../../scripts/utils/calculate-bundlesize.js"; 2 | import type { ModuleData } from "../../scripts/utils/get-modules-data.js"; 3 | 4 | export { FormattedBytes, ModuleData }; 5 | 6 | export type Bundlesize = { 7 | min: FormattedBytes; 8 | gzip: FormattedBytes; 9 | }; 10 | 11 | export type BundlesizeItem = Bundlesize & { 12 | name: string; 13 | }; 14 | 15 | export type PackageListItem = Omit & { 16 | primitives: BundlesizeItem[]; 17 | packageSize: Bundlesize | null; 18 | }; 19 | 20 | export type PackageData = PackageListItem & { readme: string }; 21 | -------------------------------------------------------------------------------- /site/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "resolveJsonModule": true, 5 | "types": ["vinxi/client", "vite/client", "node"], 6 | "baseUrl": "./", 7 | "paths": { 8 | "~/*": ["./src/*"] 9 | } 10 | }, 11 | "include": ["./src", "./scripts", "./app.config.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /template/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Solid Primitives Working Group 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /template/dev/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, createSignal } from "solid-js"; 2 | 3 | const App: Component = () => { 4 | const [count, setCount] = createSignal(0); 5 | const increment = () => setCount(count() + 1); 6 | 7 | return ( 8 |
9 |
10 |

Counter component

11 |

it's very important...

12 | 15 |
16 |
17 | ); 18 | }; 19 | 20 | export default App; 21 | -------------------------------------------------------------------------------- /template/test/index.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createRoot } from "solid-js"; 3 | import { createPrimitiveTemplate } from "../src/index.js"; 4 | 5 | describe("createPrimitiveTemplate", () => { 6 | test("createPrimitiveTemplate return values", () => { 7 | const { value, setValue, dispose } = createRoot(dispose => { 8 | const [value, setValue] = createPrimitiveTemplate(true); 9 | expect(value(), "initial value should be true").toBe(true); 10 | 11 | return { value, setValue, dispose }; 12 | }); 13 | 14 | setValue(false); 15 | expect(value(), "value after change should be false").toBe(false); 16 | 17 | dispose(); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /template/test/server.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, test, expect } from "vitest"; 2 | import { createPrimitiveTemplate } from "../src/index.js"; 3 | 4 | describe("createPrimitiveTemplate", () => { 5 | test("doesn't break in SSR", () => { 6 | const [value, setValue] = createPrimitiveTemplate(true); 7 | expect(value(), "initial value should be true").toBe(true); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /template/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "outDir": "dist", 6 | "rootDir": "src" 7 | }, 8 | "references": [], 9 | "include": [ 10 | "src" 11 | ] 12 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "target": "ESNext", 5 | "newLine": "LF", 6 | "lib": ["DOM", "ESNext"], 7 | "moduleResolution": "NodeNext", 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "esModuleInterop": true, 11 | "isolatedModules": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "noUncheckedIndexedAccess": true, 14 | "skipLibCheck": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | "types": ["node"], 18 | /* 19 | Use source files locally 20 | */ 21 | "customConditions": ["@solid-primitives/source"] 22 | }, 23 | "exclude": ["node_modules", "dist"] 24 | } 25 | --------------------------------------------------------------------------------