@bun-native/solid 0.0.0-stage → 0.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bunly contributors
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.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
- # Temporary Holding Version
1
+ # @bun-native/solid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ SolidJS renderer for Bun Native desktop windows.
4
+
5
+ Part of [Bun Native](https://github.com/0xPlayerOne/bun-native), an experimental developer preview. Version 0.33.1 was built from [c56fdd675365](https://github.com/0xPlayerOne/bun-native/tree/c56fdd6753653a10144a4167c1d3dfb3c38a0647) and published from GitHub Actions with npm provenance. Use the Bun revision pinned in that commit's toolchain.json. Start with the [getting-started guide](https://github.com/0xPlayerOne/bun-native/blob/c56fdd6753653a10144a4167c1d3dfb3c38a0647/docs/getting-started.md); `bun-native host install` fetches the matching release host. The license notice is in LICENSE.
@@ -0,0 +1,43 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "commit": "c56fdd6753653a10144a4167c1d3dfb3c38a0647",
4
+ "tree": "c6e81b3f9d041e11dd0413b5fdd7a50910383854",
5
+ "files": {
6
+ "package.json": {
7
+ "bytes": 2115,
8
+ "sha256": "caf866d56f3cd7530d5735ecbf62512e9e22526bc44c75a4b48a18c26352c0b8"
9
+ },
10
+ "packages/solid/package.json": {
11
+ "bytes": 310,
12
+ "sha256": "5da76ecbbb9ba781fc827191b33a42b25ddcfd8ba1838c0256f82ea1c6838b84"
13
+ },
14
+ "packages/solid/src/index.ts": {
15
+ "bytes": 695,
16
+ "sha256": "88fe2cfc3d59011bb756bb86bfb040e6280feabd1edb33b7cdeecfc524652250"
17
+ },
18
+ "packages/solid/src/jsx.ts": {
19
+ "bytes": 2731,
20
+ "sha256": "0ea5386e11e9df63541c381d4794fe0edc0e8269158fa3ac6b6739d12f16c729"
21
+ },
22
+ "packages/solid/src/mount.ts": {
23
+ "bytes": 1936,
24
+ "sha256": "6395762b787d7929cf616b083d91b171df14e756196f33cf8195391049f2ce55"
25
+ },
26
+ "packages/solid/src/renderer.ts": {
27
+ "bytes": 1292,
28
+ "sha256": "2d1682b885c1dee1953ba09fdf28bf524945654f7c460840c113cc7b00213ab1"
29
+ },
30
+ "LICENSE": {
31
+ "bytes": 1075,
32
+ "sha256": "86673fb485f12fa9aaa3941dfccc9f69a7f8322f8141d0d5c73db4323de10ac5"
33
+ }
34
+ },
35
+ "toolchain": {
36
+ "bytes": 3234,
37
+ "sha256": "9f4d9362cb4cc38c0f4e705295789a0cbfec46ffdd007e0541b9441a7c3003a7"
38
+ },
39
+ "dependencyLock": {
40
+ "bytes": 28357,
41
+ "sha256": "65e3dbd01be4a1889367690faf1a9c3f08fb31d22dbd273d9bb9f39dd6baa6fb"
42
+ }
43
+ }
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@bun-native/solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.33.1",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "files": [
7
+ "src",
8
+ "LICENSE",
9
+ "README.md",
10
+ "bun-native-source.json"
11
+ ],
12
+ "engines": {
13
+ "bun": "1.4.4-canary.1"
14
+ },
15
+ "exports": {
16
+ ".": "./src/index.ts",
17
+ "./jsx-runtime": "./src/jsx.ts"
18
+ },
19
+ "description": "SolidJS renderer for Bun Native desktop windows.",
20
+ "dependencies": {
21
+ "@bun-native/core": "0.33.1",
22
+ "@bun-native/renderer": "0.33.1"
23
+ },
24
+ "peerDependencies": {
25
+ "solid-js": "1.9.18"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/0xPlayerOne/bun-native.git",
30
+ "directory": "packages/solid"
31
+ },
32
+ "homepage": "https://github.com/0xPlayerOne/bun-native#readme",
33
+ "bugs": "https://github.com/0xPlayerOne/bun-native/issues",
34
+ "publishConfig": {
35
+ "access": "public",
36
+ "provenance": true
37
+ }
38
+ }
package/src/index.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { renderer } from './renderer.ts'
2
+
3
+ export { render } from './mount.ts'
4
+ export type { RenderOptions, RenderRoot } from './mount.ts'
5
+ export {
6
+ focusNode,
7
+ inputState,
8
+ registerDropTarget,
9
+ scrollNodeIntoView,
10
+ scrollNodeTo,
11
+ } from '@bun-native/renderer'
12
+ export type { RendererNode as SolidNode } from '@bun-native/renderer'
13
+ export type { JSX } from './jsx.ts'
14
+
15
+ // This is the helper contract emitted by Solid's official universal JSX compiler.
16
+ export const {
17
+ effect,
18
+ memo,
19
+ createComponent,
20
+ createElement,
21
+ createTextNode,
22
+ insertNode,
23
+ insert,
24
+ spread,
25
+ setProp,
26
+ mergeProps,
27
+ use,
28
+ } = renderer
29
+
30
+ export { For, Show, Switch, Match, Index, ErrorBoundary } from 'solid-js'
package/src/jsx.ts ADDED
@@ -0,0 +1,67 @@
1
+ import type { Element as NativeElement, InputState } from '@bun-native/core'
2
+ import type { EventHandlers, RendererNode as SolidNode } from '@bun-native/renderer'
3
+
4
+ export namespace JSX {
5
+ export type Element = SolidNode | string | number | boolean | null | undefined | Element[]
6
+ export interface ElementChildrenAttribute {
7
+ children: unknown
8
+ }
9
+ type Base<Kind extends NativeElement['kind']> = EventHandlers & {
10
+ style?: Extract<NativeElement, { kind: Kind }>['style']
11
+ ref?: (node: SolidNode) => void
12
+ }
13
+ type TextContent = { text?: string; children?: Element }
14
+ export interface IntrinsicElements {
15
+ /**
16
+ * Requires `accessibility_lists_v1` for the accessible members. A list's
17
+ * `accessibleSetSize` counts every item, mounted or not; an item's
18
+ * `accessiblePosition` is its 1-based place in that full set.
19
+ */
20
+ box: Base<'box'> & { children?: Element } & {
21
+ accessibleRole?: 'list' | 'list_item'
22
+ /** Only with `accessibleRole`. */
23
+ accessibleLabel?: string
24
+ /** Only on a `list`. */
25
+ accessibleSetSize?: number
26
+ /** Only on a `list_item`; 1-based. */
27
+ accessiblePosition?: number
28
+ /** Only on a `list_item`. */
29
+ accessibleSelected?: boolean
30
+ }
31
+ text: Base<'text'> &
32
+ TextContent & {
33
+ /** Requires `accessibility_lists_v1`: announce the text when it appears and changes. */
34
+ accessibleLive?: 'polite' | 'assertive'
35
+ }
36
+ button: Base<'button'> & TextContent & { disabled?: boolean }
37
+ input: Base<'input'> & {
38
+ value?: string | InputState
39
+ placeholder?: string
40
+ /** Requires the host's `input_states_v1` capability. */
41
+ disabled?: boolean
42
+ /** Requires the host's `input_states_v1` capability. */
43
+ readOnly?: boolean
44
+ }
45
+ /** At most two pane children; the host owns the divider drag and keyboard steps. */
46
+ split: Base<'split'> & {
47
+ children?: Element
48
+ ratio?: number
49
+ min_size?: number
50
+ /** Requires `accessibility_v1`: the divider's accessible name. */
51
+ accessibleLabel?: string
52
+ }
53
+ /** Painted above the ordinary tree; only window-anchored overlays may be modal. */
54
+ overlay: Base<'overlay'> & {
55
+ children?: Element
56
+ /** Requires `overlay_keyboard_v1`: focus the first enabled control on open. */
57
+ autofocus?: boolean
58
+ /** Requires `overlay_keyboard_v1`: `menu` adds arrow-key roving focus and type-ahead. */
59
+ navigation?: 'tab' | 'menu'
60
+ /** Requires `accessibility_v1`: the dialog's accessible name. */
61
+ accessibleLabel?: string
62
+ } & (
63
+ | { anchor?: 'window'; modal?: boolean; surface?: 'layer' }
64
+ | { anchor: 'parent'; modal?: false; surface?: 'layer' | 'window' }
65
+ )
66
+ }
67
+ }
package/src/mount.ts ADDED
@@ -0,0 +1,57 @@
1
+ import { NativeStateError, type NativeWindow } from '@bun-native/core'
2
+ import { createRenderRoot, type RenderOptions, type RenderRoot } from '@bun-native/renderer'
3
+ import { catchError, createMemo, createRoot, createSignal } from 'solid-js'
4
+ import type { JSX } from './jsx.ts'
5
+ import { renderer } from './renderer.ts'
6
+
7
+ export type { RenderOptions, RenderRoot } from '@bun-native/renderer'
8
+
9
+ function assertReactiveRuntime(): void {
10
+ let observed = -1
11
+ createRoot((dispose) => {
12
+ const [value, set] = createSignal(0)
13
+ const derived = createMemo(value)
14
+ set(1)
15
+ observed = derived()
16
+ dispose()
17
+ })
18
+ if (observed !== 1)
19
+ throw new Error(
20
+ 'Solid native rendering requires Bun --conditions=browser (reactive Solid exports)'
21
+ )
22
+ }
23
+
24
+ /** Mount one Solid owner into an independently disposable native container. */
25
+ export function render(
26
+ component: () => JSX.Element,
27
+ window: NativeWindow,
28
+ options: RenderOptions = {}
29
+ ): RenderRoot {
30
+ if (typeof component !== 'function')
31
+ throw new NativeStateError('invalid_state', 'Solid render requires a component function')
32
+ assertReactiveRuntime()
33
+ return createRenderRoot(
34
+ window,
35
+ ({ container, onCleanup, fail }) => {
36
+ createRoot((dispose) => {
37
+ onCleanup(dispose)
38
+ // An error from a later reactive update ends only this root, as in
39
+ // React, instead of escaping through whichever setter (usually a
40
+ // native listener) ran it and ending the application. An error while
41
+ // evaluating the component still rejects `ready` synchronously.
42
+ let mounted = false
43
+ let initial: { cause: unknown } | undefined
44
+ catchError(
45
+ () => renderer.insert(container, component()),
46
+ (cause) => {
47
+ if (mounted) fail(cause)
48
+ else initial ??= { cause }
49
+ }
50
+ )
51
+ if (initial) throw initial.cause
52
+ mounted = true
53
+ })
54
+ },
55
+ options
56
+ )
57
+ }
@@ -0,0 +1,33 @@
1
+ import { createRenderer } from 'solid-js/universal'
2
+ import {
3
+ asNode,
4
+ createElement,
5
+ createTextNode,
6
+ firstChild,
7
+ insertNode,
8
+ nextSibling,
9
+ removeNode,
10
+ replaceText,
11
+ setProperty,
12
+ type ElementTag,
13
+ type PropertyName,
14
+ type RendererNode,
15
+ } from '@bun-native/renderer'
16
+
17
+ export const renderer = createRenderer<RendererNode>({
18
+ // The compiler hands over JSX tags and names as strings; the renderer rejects
19
+ // any it does not know with an UnsupportedFeatureError.
20
+ createElement: (tag) => createElement(tag as ElementTag),
21
+ createTextNode,
22
+ isTextNode: (node) => asNode(node).kind === 'text-node',
23
+ replaceText: (node, value) => replaceText(asNode(node), value),
24
+ setProperty: (node, name, value) => setProperty(asNode(node), name as PropertyName, value),
25
+ // The official universal JSX compiler uses null to delimit a trailing
26
+ // dynamic region. Both absent forms append; every real anchor stays owned.
27
+ insertNode: (parent, node, anchor) =>
28
+ insertNode(asNode(parent), asNode(node), anchor == null ? undefined : asNode(anchor)),
29
+ removeNode: (parent, node) => removeNode(asNode(parent), asNode(node)),
30
+ getParentNode: (node) => asNode(node).parent,
31
+ getFirstChild: (node) => firstChild(asNode(node)),
32
+ getNextSibling: (node) => nextSibling(asNode(node)),
33
+ })