@rosyn/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,145 @@
1
- # Temporary Holding Version
1
+ # @rosyn/ui
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
+ Unified, fine-grained reactive UI framework and compiled DOM engine for ROSYN.
4
+
5
+ Zero virtual DOM. Zero external runtime dependencies. 100% fine-grained dependency tracking.
6
+
7
+ ## Highlights
8
+
9
+ - **Fine-Grained Reactivity**: Signal graph (`createSignal`, `createMemo`, `createEffect`, `createResource`, `createStore`, `batch`).
10
+ - **Compiled DOM Engine**: Direct DOM node mutation without virtual DOM reconciliation overhead.
11
+ - **Component Primitives**: First-class reactive components (`Show`, `For`, `Switch`, `Match`, `Dynamic`, `Portal`, `ErrorBoundary`, `Suspense`).
12
+ - **Reactive Router**: Client-side declarative router with parameter extraction and history manipulation (`Router`, `Route`, `Link`, `useNavigate`, `useLocation`, `useParams`).
13
+ - **SSR & Hydration**: Native streaming and string serialization (`renderToString`, `hydrate`).
14
+ - **Zero Runtime Dependencies**: Completely self-contained in 1 single package.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ bun add @rosyn/ui
20
+ ```
21
+
22
+ Or using pnpm / npm:
23
+
24
+ ```bash
25
+ pnpm add @rosyn/ui
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ### 1. Fine-Grained Signals
31
+
32
+ ```typescript
33
+ import { createSignal, createEffect, createMemo } from "@rosyn/ui";
34
+
35
+ const [count, setCount] = createSignal(0);
36
+ const doubled = createMemo(() => count() * 2);
37
+
38
+ createEffect(() => {
39
+ console.log(`Count: ${count()}, Doubled: ${doubled()}`);
40
+ });
41
+
42
+ setCount(1);
43
+ setCount((prev) => prev + 1);
44
+ ```
45
+
46
+ ### 2. Reactive Components
47
+
48
+ ```typescript
49
+ import { createSignal, Show, For } from "@rosyn/ui";
50
+
51
+ function TodoApp() {
52
+ const [todos, setTodos] = createSignal([
53
+ { id: 1, text: "Build ROSYN UI engine" },
54
+ { id: 2, text: "Deploy to production" }
55
+ ]);
56
+ const [showList, setShowList] = createSignal(true);
57
+
58
+ return (
59
+ <div>
60
+ <h1>Todo List</h1>
61
+ <Show when={showList} fallback={<p>List hidden</p>}>
62
+ <ul>
63
+ <For each={todos}>
64
+ {(todo, index) => (
65
+ <li>
66
+ {index() + 1}. {todo.text}
67
+ </li>
68
+ )}
69
+ </For>
70
+ </ul>
71
+ </Show>
72
+ </div>
73
+ );
74
+ }
75
+ ```
76
+
77
+ ### 3. Server-Side Rendering (SSR)
78
+
79
+ ```typescript
80
+ import { renderToString } from "@rosyn/ui";
81
+
82
+ const html = renderToString(() => TodoApp());
83
+ console.log(html);
84
+ ```
85
+
86
+ ### 4. Client Router
87
+
88
+ ```typescript
89
+ import { Router, Route, Link, useParams } from "@rosyn/ui";
90
+
91
+ function UserProfile() {
92
+ const params = useParams();
93
+ return <h1>User: {params().id}</h1>;
94
+ }
95
+
96
+ function App() {
97
+ return (
98
+ <Router>
99
+ <nav>
100
+ <Link href="/">Home</Link>
101
+ <Link href="/users/42">User Profile</Link>
102
+ </nav>
103
+
104
+ <Route path="/" component={() => <h2>Home Page</h2>} />
105
+ <Route path="/users/:id" component={UserProfile} />
106
+ </Router>
107
+ );
108
+ }
109
+ ```
110
+
111
+ ## API Reference
112
+
113
+ ### Reactivity
114
+
115
+ - `createSignal<T>(initial): [() => T, (next) => T]`
116
+ - `createEffect(fn: () => void | (() => void)): void`
117
+ - `createMemo<T>(fn: () => T): () => T`
118
+ - `createRoot<T>(fn: (dispose) => T): T`
119
+ - `batch<T>(fn: () => T): T`
120
+ - `untrack<T>(fn: () => T): T`
121
+ - `onMount(fn: () => void): void`
122
+ - `onCleanup(fn: () => void): void`
123
+ - `createContext<T>(defaultValue?): Context<T>`
124
+ - `useContext<T>(context: Context<T>): T`
125
+ - `createResource<T, S>(source?, fetcher): [Resource<T>, ResourceActions<T>]`
126
+ - `createStore<T>(initial): [T, (fn) => void]`
127
+
128
+ ### Components
129
+
130
+ - `<Show when={...} fallback={...}>{...}</Show>`
131
+ - `<For each={...} fallback={...}>{(item, index) => ...}</For>`
132
+ - `<Switch fallback={...}><Match when={...}>...</Match></Switch>`
133
+ - `<Dynamic component={...} {...props} />`
134
+ - `<Portal mount={document.body}>...</Portal>`
135
+ - `<ErrorBoundary fallback={(err, reset) => ...}>...</ErrorBoundary>`
136
+ - `<Suspense fallback={...}>...</Suspense>`
137
+
138
+ ### SSR
139
+
140
+ - `renderToString(fn: () => any): string`
141
+ - `hydrate(fn: () => any, container: Element): () => void`
142
+
143
+ ## License
144
+
145
+ MIT © ROSYN Team
@@ -0,0 +1,43 @@
1
+ export interface ShowProps<T> {
2
+ when: T | undefined | null | false | (() => T | undefined | null | false);
3
+ fallback?: any;
4
+ children: any | ((item: T) => any);
5
+ }
6
+ export declare function Show<T>(props: ShowProps<T>): any;
7
+ export interface ForProps<T> {
8
+ each: readonly T[] | (() => readonly T[]) | undefined | null;
9
+ fallback?: any;
10
+ children: (item: T, index: () => number) => any;
11
+ }
12
+ export declare function For<T>(props: ForProps<T>): any;
13
+ export interface SwitchProps {
14
+ fallback?: any;
15
+ children: any;
16
+ }
17
+ export declare function Switch(props: SwitchProps): any;
18
+ export interface MatchProps<T> {
19
+ when: T | undefined | null | false | (() => T | undefined | null | false);
20
+ children: any | ((item: T) => any);
21
+ }
22
+ export declare function Match<T>(props: MatchProps<T>): any;
23
+ export interface DynamicProps {
24
+ component: string | ((props: any) => any);
25
+ [key: string]: any;
26
+ }
27
+ export declare function Dynamic(props: DynamicProps): any;
28
+ export interface PortalProps {
29
+ mount?: Node;
30
+ children: any;
31
+ }
32
+ export declare function Portal(props: PortalProps): any;
33
+ export interface ErrorBoundaryProps {
34
+ fallback: any | ((err: any, reset: () => void) => any);
35
+ children: any;
36
+ }
37
+ export declare function ErrorBoundary(props: ErrorBoundaryProps): any;
38
+ export interface SuspenseProps {
39
+ fallback?: any;
40
+ children: any;
41
+ }
42
+ export declare function Suspense(props: SuspenseProps): any;
43
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC;IAC1E,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;CACpC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAahD;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IAC7D,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,MAAM,KAAK,GAAG,CAAC;CACjD;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,CAqF9C;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAc9C;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC;IAC1E,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;CACpC;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAElD;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAMhD;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAiB9C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,GAAG,CAAC,CAAC;IACvD,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAiB5D;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,GAAG,CAWlD"}
@@ -0,0 +1,154 @@
1
+ import { createMemo, createRoot, createSignal, onCleanup } from "./reactivity.js";
2
+ import { createElement, insert, isServer } from "./dom.js";
3
+ export function Show(props) {
4
+ const condition = createMemo(() => {
5
+ return typeof props.when === "function" ? props.when() : props.when;
6
+ });
7
+ return () => {
8
+ const val = condition();
9
+ if (val) {
10
+ const child = props.children;
11
+ return typeof child === "function" ? child(val) : child;
12
+ }
13
+ return props.fallback ?? null;
14
+ };
15
+ }
16
+ export function For(props) {
17
+ const list = createMemo(() => {
18
+ const raw = typeof props.each === "function" ? props.each() : props.each;
19
+ return Array.isArray(raw) ? raw : [];
20
+ });
21
+ if (isServer()) {
22
+ return () => {
23
+ const items = list();
24
+ if (items.length === 0) {
25
+ return props.fallback ?? null;
26
+ }
27
+ return items.map((item, index) => props.children(item, () => index));
28
+ };
29
+ }
30
+ const cache = new Map();
31
+ onCleanup(() => {
32
+ for (const cached of cache.values()) {
33
+ cached.dispose();
34
+ }
35
+ cache.clear();
36
+ });
37
+ return () => {
38
+ const items = list();
39
+ if (items.length === 0) {
40
+ for (const cached of cache.values()) {
41
+ cached.dispose();
42
+ }
43
+ cache.clear();
44
+ return props.fallback ?? null;
45
+ }
46
+ const currentKeys = new Set();
47
+ const renderedNodes = [];
48
+ for (let i = 0; i < items.length; i++) {
49
+ const item = items[i];
50
+ const key = item?.id ?? item;
51
+ currentKeys.add(key);
52
+ let record = cache.get(key);
53
+ if (!record) {
54
+ let setIndex;
55
+ let nodeResult;
56
+ const dispose = createRoot((d) => {
57
+ const [indexSignal, indexSetter] = createSignal(i);
58
+ setIndex = indexSetter;
59
+ nodeResult = props.children(item, indexSignal);
60
+ return d;
61
+ });
62
+ record = {
63
+ item,
64
+ node: nodeResult,
65
+ setIndex,
66
+ dispose
67
+ };
68
+ cache.set(key, record);
69
+ }
70
+ else {
71
+ record.setIndex(i);
72
+ }
73
+ renderedNodes.push(record.node);
74
+ }
75
+ for (const [key, record] of cache.entries()) {
76
+ if (!currentKeys.has(key)) {
77
+ record.dispose();
78
+ cache.delete(key);
79
+ }
80
+ }
81
+ return renderedNodes;
82
+ };
83
+ }
84
+ export function Switch(props) {
85
+ const children = Array.isArray(props.children) ? props.children : [props.children];
86
+ return () => {
87
+ for (const rawChild of children) {
88
+ const child = typeof rawChild === "function" ? rawChild() : rawChild;
89
+ if (child && typeof child === "object" && child.when !== undefined) {
90
+ const cond = typeof child.when === "function" ? child.when() : child.when;
91
+ if (cond) {
92
+ return typeof child.children === "function" ? child.children(cond) : child.children;
93
+ }
94
+ }
95
+ }
96
+ return props.fallback ?? null;
97
+ };
98
+ }
99
+ export function Match(props) {
100
+ return props;
101
+ }
102
+ export function Dynamic(props) {
103
+ const { component, ...rest } = props;
104
+ if (typeof component === "function") {
105
+ return component(rest);
106
+ }
107
+ return createElement(component, rest);
108
+ }
109
+ export function Portal(props) {
110
+ if (isServer()) {
111
+ return null;
112
+ }
113
+ const mount = props.mount || document.body;
114
+ const container = document.createElement("div");
115
+ mount.appendChild(container);
116
+ insert(container, props.children);
117
+ onCleanup(() => {
118
+ if (container.parentNode === mount) {
119
+ mount.removeChild(container);
120
+ }
121
+ });
122
+ return null;
123
+ }
124
+ export function ErrorBoundary(props) {
125
+ const [error, setError] = createSignal(null);
126
+ const reset = () => setError(null);
127
+ return () => {
128
+ const err = error();
129
+ if (err) {
130
+ return typeof props.fallback === "function" ? props.fallback(err, reset) : props.fallback;
131
+ }
132
+ try {
133
+ return typeof props.children === "function" ? props.children() : props.children;
134
+ }
135
+ catch (caught) {
136
+ setError(caught);
137
+ return typeof props.fallback === "function" ? props.fallback(caught, reset) : props.fallback;
138
+ }
139
+ };
140
+ }
141
+ export function Suspense(props) {
142
+ return () => {
143
+ try {
144
+ return typeof props.children === "function" ? props.children() : props.children;
145
+ }
146
+ catch (maybePromise) {
147
+ if (maybePromise && typeof maybePromise.then === "function") {
148
+ return props.fallback ?? null;
149
+ }
150
+ throw maybePromise;
151
+ }
152
+ };
153
+ }
154
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,E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,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,OAAO,GAAG,EAAE;QACV,IAAI,CAAC;YACH,OAAO,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;QAClF,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACtB,IAAI,YAAY,IAAI,OAAQ,YAAoB,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBACrE,OAAO,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;YAChC,CAAC;YACD,MAAM,YAAY,CAAC;QACrB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/dist/dom.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare function isServer(): boolean;
2
+ export declare function createElement(tag: string | ((props: any) => any), props?: Record<string, any> | null, ...children: any[]): any;
3
+ export declare function createText(content: any): any;
4
+ export declare function setAttribute(el: Element, name: string, value: any): void;
5
+ export declare function insert(parent: Node, accessor: any, marker?: Node | null): void;
6
+ export declare function createFragment(...children: any[]): any;
7
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAyBA,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,EACnC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAW,EACxC,GAAG,QAAQ,EAAE,GAAG,EAAE,GACjB,GAAG,CAyCL;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,CAkB5C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CA8BxE;AAiDD,wBAAgB,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAE,IAAI,GAAG,IAAW,GAAG,IAAI,CAsCpF;AAsBD,wBAAgB,cAAc,CAAC,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CActD"}
package/dist/dom.js ADDED
@@ -0,0 +1,221 @@
1
+ import { createEffect, onCleanup } from "./reactivity.js";
2
+ const DANGEROUS_PROTOCOLS = /^(\s*javascript:|\s*vbscript:|\s*data:text\/html)/i;
3
+ const SVG_TAGS = new Set([
4
+ "svg",
5
+ "path",
6
+ "circle",
7
+ "rect",
8
+ "line",
9
+ "polyline",
10
+ "polygon",
11
+ "text",
12
+ "tspan",
13
+ "g",
14
+ "defs",
15
+ "use",
16
+ "symbol",
17
+ "clipPath",
18
+ "mask",
19
+ "pattern",
20
+ "linearGradient",
21
+ "radialGradient",
22
+ "stop"
23
+ ]);
24
+ export function isServer() {
25
+ return typeof document === "undefined";
26
+ }
27
+ export function createElement(tag, props = null, ...children) {
28
+ const combinedProps = Object.assign({}, props);
29
+ if (children.length === 1) {
30
+ combinedProps.children = children[0];
31
+ }
32
+ else if (children.length > 1) {
33
+ combinedProps.children = children;
34
+ }
35
+ if (typeof tag === "function") {
36
+ return () => tag(combinedProps);
37
+ }
38
+ if (isServer()) {
39
+ return {
40
+ type: "element",
41
+ tag,
42
+ props: props || {},
43
+ children: combinedProps.children !== undefined ? (Array.isArray(combinedProps.children) ? combinedProps.children : [combinedProps.children]) : []
44
+ };
45
+ }
46
+ const isSvg = SVG_TAGS.has(tag.toLowerCase());
47
+ const element = isSvg
48
+ ? document.createElementNS("http://www.w3.org/2000/svg", tag)
49
+ : document.createElement(tag);
50
+ if (props) {
51
+ for (const [name, value] of Object.entries(props)) {
52
+ if (name === "children") {
53
+ continue;
54
+ }
55
+ setAttribute(element, name, value);
56
+ }
57
+ }
58
+ const flattenedChildren = children.flat(Infinity);
59
+ for (const child of flattenedChildren) {
60
+ insert(element, child);
61
+ }
62
+ return element;
63
+ }
64
+ export function createText(content) {
65
+ if (isServer()) {
66
+ return {
67
+ type: "text",
68
+ value: typeof content === "function" ? content() : content
69
+ };
70
+ }
71
+ if (typeof content === "function") {
72
+ const node = document.createTextNode("");
73
+ createEffect(() => {
74
+ const val = content();
75
+ node.textContent = val == null ? "" : String(val);
76
+ });
77
+ return node;
78
+ }
79
+ return document.createTextNode(content == null ? "" : String(content));
80
+ }
81
+ export function setAttribute(el, name, value) {
82
+ if (isServer()) {
83
+ return;
84
+ }
85
+ if (name.startsWith("on") && name.length > 2) {
86
+ const eventName = name.slice(2).toLowerCase();
87
+ if (typeof value === "function") {
88
+ el.addEventListener(eventName, value);
89
+ onCleanup(() => {
90
+ el.removeEventListener(eventName, value);
91
+ });
92
+ }
93
+ return;
94
+ }
95
+ if (name === "ref" && typeof value === "function") {
96
+ value(el);
97
+ return;
98
+ }
99
+ if (typeof value === "function") {
100
+ createEffect(() => {
101
+ const resolved = value();
102
+ applyAttribute(el, name, resolved);
103
+ });
104
+ return;
105
+ }
106
+ applyAttribute(el, name, value);
107
+ }
108
+ function applyAttribute(el, name, value) {
109
+ if (name === "class" || name === "className") {
110
+ if (value == null || value === false) {
111
+ el.removeAttribute("class");
112
+ }
113
+ else {
114
+ el.setAttribute("class", String(value));
115
+ }
116
+ return;
117
+ }
118
+ if (name === "style") {
119
+ if (typeof value === "object" && value !== null) {
120
+ const htmlEl = el;
121
+ for (const [k, v] of Object.entries(value)) {
122
+ htmlEl.style[k] = v == null ? "" : String(v);
123
+ }
124
+ }
125
+ else if (value == null) {
126
+ el.removeAttribute("style");
127
+ }
128
+ else {
129
+ el.setAttribute("style", String(value));
130
+ }
131
+ return;
132
+ }
133
+ if (name === "href" || name === "src") {
134
+ if (typeof value === "string" && DANGEROUS_PROTOCOLS.test(value)) {
135
+ el.removeAttribute(name);
136
+ return;
137
+ }
138
+ }
139
+ if (typeof value === "boolean") {
140
+ if (value) {
141
+ el.setAttribute(name, "");
142
+ }
143
+ else {
144
+ el.removeAttribute(name);
145
+ }
146
+ return;
147
+ }
148
+ if (value == null) {
149
+ el.removeAttribute(name);
150
+ }
151
+ else {
152
+ el.setAttribute(name, String(value));
153
+ }
154
+ }
155
+ export function insert(parent, accessor, marker = null) {
156
+ if (isServer()) {
157
+ return;
158
+ }
159
+ if (typeof accessor === "function") {
160
+ let currentNodes = [];
161
+ createEffect(() => {
162
+ const value = accessor();
163
+ const newNodes = normalizeNodes(value);
164
+ for (const node of currentNodes) {
165
+ if (node.parentNode === parent) {
166
+ parent.removeChild(node);
167
+ }
168
+ }
169
+ currentNodes = newNodes;
170
+ for (const node of currentNodes) {
171
+ if (marker) {
172
+ parent.insertBefore(node, marker);
173
+ }
174
+ else {
175
+ parent.appendChild(node);
176
+ }
177
+ }
178
+ });
179
+ return;
180
+ }
181
+ const nodes = normalizeNodes(accessor);
182
+ for (const node of nodes) {
183
+ if (marker) {
184
+ parent.insertBefore(node, marker);
185
+ }
186
+ else {
187
+ parent.appendChild(node);
188
+ }
189
+ }
190
+ }
191
+ function normalizeNodes(value) {
192
+ if (value == null || typeof value === "boolean") {
193
+ return [];
194
+ }
195
+ if (value instanceof Node) {
196
+ return [value];
197
+ }
198
+ if (Array.isArray(value)) {
199
+ const list = [];
200
+ for (const item of value) {
201
+ list.push(...normalizeNodes(item));
202
+ }
203
+ return list;
204
+ }
205
+ return [document.createTextNode(String(value))];
206
+ }
207
+ export function createFragment(...children) {
208
+ if (isServer()) {
209
+ return {
210
+ type: "fragment",
211
+ children: children.flat(Infinity)
212
+ };
213
+ }
214
+ const fragment = document.createDocumentFragment();
215
+ const flattened = children.flat(Infinity);
216
+ for (const child of flattened) {
217
+ insert(fragment, child);
218
+ }
219
+ return fragment;
220
+ }
221
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings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,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;SAClC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,sBAAsB,EAAE,CAAC;IACnD,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { createSignal, createEffect, createMemo, createRoot, batch, untrack, onMount, onCleanup, createContext, useContext, createResource, createStore, type Context, type Resource, type ResourceActions } from "./reactivity.js";
2
+ export { createElement, createText, insert, setAttribute, createFragment, isServer } from "./dom.js";
3
+ export { Show, For, Switch, Match, Dynamic, Portal, ErrorBoundary, Suspense, type ShowProps, type ForProps, type SwitchProps, type MatchProps, type DynamicProps, type PortalProps, type ErrorBoundaryProps, type SuspenseProps } from "./components.js";
4
+ export { Router, Route, Link, useNavigate, useLocation, useParams, type LocationState, type RouterContextType, type RouterProps, type RouteProps, type LinkProps } from "./router.js";
5
+ export { renderToString, hydrate, escapeHtml } from "./ssr.js";
6
+ export { jsx, jsxs, jsxDEV, Fragment } from "./jsx-runtime.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,EACN,aAAa,EACb,QAAQ,EACR,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAW,EACX,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,GAAG,EACH,IAAI,EACJ,MAAM,EACN,QAAQ,EACT,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { createSignal, createEffect, createMemo, createRoot, batch, untrack, onMount, onCleanup, createContext, useContext, createResource, createStore } from "./reactivity.js";
2
+ export { createElement, createText, insert, setAttribute, createFragment, isServer } from "./dom.js";
3
+ export { Show, For, Switch, Match, Dynamic, Portal, ErrorBoundary, Suspense } from "./components.js";
4
+ export { Router, Route, Link, useNavigate, useLocation, useParams } from "./router.js";
5
+ export { renderToString, hydrate, escapeHtml } from "./ssr.js";
6
+ export { jsx, jsxs, jsxDEV, Fragment } from "./jsx-runtime.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EAIZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,aAAa,EACb,UAAU,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,EACN,aAAa,EACb,QAAQ,EAST,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAW,EACX,SAAS,EAMV,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,GAAG,EACH,IAAI,EACJ,MAAM,EACN,QAAQ,EACT,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function Fragment(props: {
2
+ children?: any;
3
+ }): any;
4
+ export declare function jsx(type: any, props: any, key?: any): any;
5
+ export declare const jsxs: typeof jsx;
6
+ export declare const jsxDEV: typeof jsx;
7
+ //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,GAAG,CAEvD;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,CAUzD;AAED,eAAO,MAAM,IAAI,YAAM,CAAC;AACxB,eAAO,MAAM,MAAM,YAAM,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { createElement, createFragment } from "./dom.js";
2
+ export function Fragment(props) {
3
+ return createFragment(props?.children);
4
+ }
5
+ export function jsx(type, props, key) {
6
+ if (type === Fragment) {
7
+ return Fragment(props);
8
+ }
9
+ const { children, ...rest } = props || {};
10
+ const childArgs = children !== undefined ? (Array.isArray(children) ? children : [children]) : [];
11
+ if (key !== undefined) {
12
+ rest.key = key;
13
+ }
14
+ return createElement(type, rest, ...childArgs);
15
+ }
16
+ export const jsxs = jsx;
17
+ export const jsxDEV = jsx;
18
+ //# sourceMappingURL=jsx-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,UAAU,QAAQ,CAAC,KAAyB;IAChD,OAAO,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,IAAS,EAAE,KAAU,EAAE,GAAS;IAClD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClG,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC"}