Skip to content

docs: document plugins + sync #66/#67 docs; fix contributed-prop override typing#68

Merged
bigmistqke merged 5 commits into
solidjs-community:next-cleanupfrom
bigmistqke:docs/events-api-fixups
Jun 6, 2026
Merged

docs: document plugins + sync #66/#67 docs; fix contributed-prop override typing#68
bigmistqke merged 5 commits into
solidjs-community:next-cleanupfrom
bigmistqke:docs/events-api-fixups

Conversation

@bigmistqke

@bigmistqke bigmistqke commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

The #66 events rewrite and the #67 plugin system both shipped without their doc updates — the site was describing an API that no longer exists and a feature that was never documented. This clears that debt, adds an interactive plugins tour chapter, and fixes one plugin-typing bug the demo surfaced.

Stale docs corrected (#66)

Plugins documented (#67)

  • utilities/plugin — new API page: what a plugin is, the three plugin() forms (global / class-filtered / type-guard), registration via createT and <Entity plugins>, and the typed contributed-prop guarantee.
  • Tour chapter 09 "Plugins" — builds a lookAt plugin from the "props set properties, they don't call methods" motivation, ending in a live demo: a field of cones that turn to face the pointer. Inserted before the WebGPU peek (renumbered 09 → 10 so the peek stays the finale); chapter 08's close now hands off to it.

Library fix: contributed props override native members

Writing the lookAt demo surfaced a bug in the #67 plugin typing. A plugin intercepts its prop at runtime (applyProp checks pluginMethods first), so a contributed prop should be able to reuse a native member's name — e.g. lookAt driving Object3D.lookAt. But Props intersected the contributed type with the base, producing nativeMethod & V, which no value satisfies, so <T.Mesh lookAt={vec} /> failed to type-check even though it worked at runtime.

Props now drops the contributed keys from BaseProps before adding them, so the contributed type replaces the native one — matching the runtime. Guarded so the common no-plugins case is untouched (the loose default readonly Plugin[] has length: number; only a real inferred tuple contributes override keys). Regression test added. This is what lets the tour demo use the natural lookAt prop name.

Test plan

  • pnpm build + pnpm lint (circular + eslint + types) green.
  • Browser suite green, incl. a new test that a Vector3 is assignable to a contributed lookAt prop.
  • lookAt demo verified in-browser — cones point at the cursor and track it.
  • Dev server: no more mid-session re-optimize / reload after the optimizeDeps.include change.

…y#66 rewrite

The source-agnostic pointer rewrite (solidjs-community#66) shipped without updating the docs, leaving two pages describing an API that no longer exists:

- events/overview: drop the `onMouse*` family (removed in solidjs-community#66 — only `onPointer*`/`onClick`/`onWheel` remain) from the supported, stoppable, and non-stoppable lists and the event-applicability table.
- utilities/raycasters: `EventRaycaster` adds `cast(registry, context)`, not the deleted `update(event, context)`. Rewrite the interface, the custom-raycaster example (subclass `CursorRaycaster`/override `setCursor`), and document `ScreenRaycaster` and `ControllerRaycaster`.
…ur chapter

solidjs-community#67 shipped the plugin system without docs. Add both halves:

- API reference (utilities/plugin): what a plugin is, the three plugin() forms, registration via createT and <Entity plugins>, and the typed contributed-prop guarantee.
- Tour chapter 09 "Plugins": builds a lookAt plugin from the "props set properties, not call methods" motivation, ending in a live demo — a field of cones that turn to face the pointer (verified in-browser). Insert it before the WebGPU peek (renumbered 09 -> 10 so the peek stays the finale) and retarget chapter 08's closing handoff.
… deps)

The <Demo> editor and three are all behind dynamic imports / optimizeDeps.exclude, so vite didn't see them at startup — it discovered them on first demo mount, re-optimized, and forced a full page reload mid-session (and ran the 1MB three.module.js through vite-plugin-solid's Babel on the way). Pre-bundle the editor stack (@bigmistqke/repl, tm-textarea/solid, and its transitive @bigmistqke/solid-whenever + @solid-primitives/resize-observer) and move three from exclude to include, so the optimize cost is paid once at startup and three skips the Babel transform. optimizeDeps is dev-only — the production build is unaffected.
A Mesh's lookAt() points +Z at the target (three swaps eye/target for non-camera objects; only cameras/lights aim -Z). Rotate the cone tip onto +Z so the tips point at the cursor, not away. Verified in-browser.
A plugin intercepts its prop at runtime (applyProp checks pluginMethods first), so a contributed prop should be able to reuse a native member's name — e.g. a `lookAt` plugin driving `Object3D.lookAt`. But `Props` intersected the contributed type with the base, yielding `nativeMethod & V`, which no value satisfies (`<T.Mesh lookAt={vec}/>` failed to type-check).

Drop the contributed keys from `BaseProps` before adding the contributed props, so the contributed type replaces the native one — matching the runtime. Guarded for the no-plugins case: the loose default `readonly Plugin[]` has `length: number`, so `keyof PluginPropsOf` would be every key; yield `never` (drop nothing) unless a real tuple of plugins is inferred. The inference-critical second half stays a direct `Partial<PluginPropsOf<…>>`.
@bigmistqke bigmistqke changed the title docs: sync events/raycaster/plugin docs with #66 + #67, add a plugins tour chapter docs: document plugins + sync #66/#67 docs; fix contributed-prop override typing Jun 6, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 6, 2026

Copy link
Copy Markdown

commit: 0b819d1

@bigmistqke bigmistqke merged commit 220c2be into solidjs-community:next-cleanup Jun 6, 2026
2 checks passed
@bigmistqke bigmistqke deleted the docs/events-api-fixups branch June 6, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant