@askrjs/askr 0.0.1 → 0.0.3

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.
Files changed (52) hide show
  1. package/README.md +18 -10
  2. package/dist/chunk-2ONGHQ7Z.js +3115 -0
  3. package/dist/chunk-2ONGHQ7Z.js.map +1 -0
  4. package/dist/{chunk-UUM5W2RM.js → chunk-H3NSVHA7.js} +2 -6
  5. package/dist/chunk-H3NSVHA7.js.map +1 -0
  6. package/dist/chunk-JHOGWTAW.js +16 -0
  7. package/dist/chunk-JHOGWTAW.js.map +1 -0
  8. package/dist/chunk-OFW6DFBM.js +716 -0
  9. package/dist/chunk-OFW6DFBM.js.map +1 -0
  10. package/dist/chunk-SALJX5PZ.js +26 -0
  11. package/dist/chunk-SALJX5PZ.js.map +1 -0
  12. package/dist/index.cjs +2785 -2327
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +100 -45
  15. package/dist/index.d.ts +100 -45
  16. package/dist/index.js +430 -84
  17. package/dist/index.js.map +1 -1
  18. package/dist/jsx/jsx-dev-runtime.cjs +9 -3
  19. package/dist/jsx/jsx-dev-runtime.cjs.map +1 -1
  20. package/dist/jsx/jsx-dev-runtime.d.cts +4 -9
  21. package/dist/jsx/jsx-dev-runtime.d.ts +4 -9
  22. package/dist/jsx/jsx-dev-runtime.js +7 -4
  23. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  24. package/dist/jsx/jsx-runtime.cjs +14 -5
  25. package/dist/jsx/jsx-runtime.cjs.map +1 -1
  26. package/dist/jsx/jsx-runtime.d.cts +9 -6
  27. package/dist/jsx/jsx-runtime.d.ts +9 -6
  28. package/dist/jsx/jsx-runtime.js +6 -4
  29. package/dist/{navigate-NLQOZQGM.js → navigate-CZEUXFPM.js} +5 -5
  30. package/dist/{route-TVYWYCEJ.js → route-USEXGOBT.js} +4 -4
  31. package/dist/{ssr-4ELUFK65.js → ssr-QJ5NTQR6.js} +9 -5
  32. package/dist/{types-DUDmnzD8.d.cts → types-DLTViI21.d.cts} +15 -3
  33. package/dist/{types-DUDmnzD8.d.ts → types-DLTViI21.d.ts} +15 -3
  34. package/package.json +7 -4
  35. package/src/jsx/index.ts +4 -0
  36. package/src/jsx/jsx-dev-runtime.ts +7 -10
  37. package/src/jsx/jsx-runtime.ts +23 -11
  38. package/src/jsx/types.ts +22 -3
  39. package/src/jsx/utils.ts +19 -0
  40. package/dist/chunk-4CV4JOE5.js +0 -27
  41. package/dist/chunk-HIWJVOS4.js +0 -503
  42. package/dist/chunk-HIWJVOS4.js.map +0 -1
  43. package/dist/chunk-L7RL4LYV.js +0 -3442
  44. package/dist/chunk-L7RL4LYV.js.map +0 -1
  45. package/dist/chunk-UUM5W2RM.js.map +0 -1
  46. package/dist/chunk-YNH3D4KW.js +0 -29
  47. package/dist/chunk-YNH3D4KW.js.map +0 -1
  48. package/dist/ssr-4ELUFK65.js.map +0 -1
  49. package/src/jsx/react-jsx-runtime.d.ts +0 -0
  50. /package/dist/{chunk-4CV4JOE5.js.map → navigate-CZEUXFPM.js.map} +0 -0
  51. /package/dist/{navigate-NLQOZQGM.js.map → route-USEXGOBT.js.map} +0 -0
  52. /package/dist/{route-TVYWYCEJ.js.map → ssr-QJ5NTQR6.js.map} +0 -0
@@ -1,19 +1,23 @@
1
1
  import {
2
2
  SSRDataMissingError,
3
3
  collectResources,
4
+ popSSRStrictPurityGuard,
5
+ pushSSRStrictPurityGuard,
4
6
  renderToStream,
5
7
  renderToString,
6
8
  renderToStringSync,
7
9
  renderToStringSyncForUrl,
8
10
  resolvePlan,
9
11
  resolveResources
10
- } from "./chunk-HIWJVOS4.js";
11
- import "./chunk-L7RL4LYV.js";
12
- import "./chunk-YNH3D4KW.js";
13
- import "./chunk-4CV4JOE5.js";
12
+ } from "./chunk-OFW6DFBM.js";
13
+ import "./chunk-2ONGHQ7Z.js";
14
+ import "./chunk-SALJX5PZ.js";
15
+ import "./chunk-JHOGWTAW.js";
14
16
  export {
15
17
  SSRDataMissingError,
16
18
  collectResources,
19
+ popSSRStrictPurityGuard,
20
+ pushSSRStrictPurityGuard,
17
21
  renderToStream,
18
22
  renderToString,
19
23
  renderToStringSync,
@@ -21,4 +25,4 @@ export {
21
25
  resolvePlan,
22
26
  resolveResources
23
27
  };
24
- //# sourceMappingURL=ssr-4ELUFK65.js.map
28
+ //# sourceMappingURL=ssr-QJ5NTQR6.js.map
@@ -16,12 +16,24 @@ interface Props {
16
16
 
17
17
  /**
18
18
  * JSX type definitions
19
+ *
20
+ * These define the canonical JSX element shape used by:
21
+ * - jsx-runtime
22
+ * - jsx-dev-runtime
23
+ * - Slot / cloneElement
24
+ * - the reconciler
19
25
  */
20
26
 
27
+ declare const Fragment: unique symbol;
21
28
  interface JSXElement {
22
- type: string | ((props: Props) => JSXElement | null);
29
+ /** Internal element marker (optional for plain vnode objects) */
30
+ $$typeof?: symbol;
31
+ /** Element type: string, component, Fragment, etc */
32
+ type: unknown;
33
+ /** Props bag */
23
34
  props: Props;
24
- key?: string | number;
35
+ /** Optional key (normalized by runtime) */
36
+ key?: string | number | null;
25
37
  }
26
38
  declare global {
27
39
  namespace JSX {
@@ -35,4 +47,4 @@ declare global {
35
47
  }
36
48
  }
37
49
 
38
- export type { JSXElement as J, Props as P };
50
+ export { Fragment as F, type JSXElement as J, type Props as P };
@@ -16,12 +16,24 @@ interface Props {
16
16
 
17
17
  /**
18
18
  * JSX type definitions
19
+ *
20
+ * These define the canonical JSX element shape used by:
21
+ * - jsx-runtime
22
+ * - jsx-dev-runtime
23
+ * - Slot / cloneElement
24
+ * - the reconciler
19
25
  */
20
26
 
27
+ declare const Fragment: unique symbol;
21
28
  interface JSXElement {
22
- type: string | ((props: Props) => JSXElement | null);
29
+ /** Internal element marker (optional for plain vnode objects) */
30
+ $$typeof?: symbol;
31
+ /** Element type: string, component, Fragment, etc */
32
+ type: unknown;
33
+ /** Props bag */
23
34
  props: Props;
24
- key?: string | number;
35
+ /** Optional key (normalized by runtime) */
36
+ key?: string | number | null;
25
37
  }
26
38
  declare global {
27
39
  namespace JSX {
@@ -35,4 +47,4 @@ declare global {
35
47
  }
36
48
  }
37
49
 
38
- export type { JSXElement as J, Props as P };
50
+ export { Fragment as F, type JSXElement as J, type Props as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askrjs/askr",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,9 +23,12 @@
23
23
  "library"
24
24
  ],
25
25
  "type": "module",
26
- "packageManager": "npm",
26
+ "packageManager": "npm@11.7.0",
27
27
  "license": "Apache-2.0",
28
- "sideEffects": false,
28
+ "sideEffects": [
29
+ "src/jsx/types.ts",
30
+ "src/runtime/fastlane.ts"
31
+ ],
29
32
  "main": "./dist/index.js",
30
33
  "types": "./dist/index.d.ts",
31
34
  "files": [
@@ -76,7 +79,7 @@
76
79
  "tsup": "^8.5.1",
77
80
  "tsd": "^0.33.0",
78
81
  "typescript": "^5.9.3",
79
- "typescript-eslint": "^8.50.0",
82
+ "typescript-eslint": "^8.50.1",
80
83
  "vitest": "^4.0.16",
81
84
  "vite": "^7.3.0"
82
85
  }
@@ -0,0 +1,4 @@
1
+ export { Fragment, ELEMENT_TYPE } from './types';
2
+ export type { JSXElement } from './types';
3
+
4
+ export { isElement, cloneElement } from './utils';
@@ -1,15 +1,10 @@
1
1
  /**
2
2
  * JSX dev runtime factory
3
- * Same as production runtime but with dev warnings
3
+ * Same element shape as production runtime, with room for dev warnings.
4
4
  */
5
5
 
6
6
  import './types';
7
-
8
- export interface JSXElement {
9
- type: unknown;
10
- props: Record<string, unknown>;
11
- key?: string | number;
12
- }
7
+ import { ELEMENT_TYPE, Fragment, JSXElement } from './types';
13
8
 
14
9
  export function jsxDEV(
15
10
  type: unknown,
@@ -17,10 +12,12 @@ export function jsxDEV(
17
12
  key?: string | number
18
13
  ): JSXElement {
19
14
  return {
15
+ $$typeof: ELEMENT_TYPE,
20
16
  type,
21
- props: props || {},
22
- key,
17
+ props: props ?? {},
18
+ key: key ?? null,
23
19
  };
24
20
  }
25
21
 
26
- export const Fragment = Symbol('Fragment');
22
+ // Re-export Fragment for JSX
23
+ export { Fragment };
@@ -1,36 +1,48 @@
1
1
  /**
2
- * JSX runtime factory
3
- * Thin layer no scheduling, no logic
2
+ * JSX dev runtime
3
+ * Same shape as production runtime, with room for dev warnings.
4
4
  */
5
5
 
6
6
  import './types';
7
7
 
8
+ export const ELEMENT_TYPE = Symbol.for('askr.element');
9
+ export const Fragment = Symbol.for('askr.fragment');
10
+
8
11
  export interface JSXElement {
12
+ $$typeof: symbol;
9
13
  type: unknown;
10
14
  props: Record<string, unknown>;
11
- key?: string | number;
15
+ key: string | number | null;
12
16
  }
13
17
 
14
- export function jsx(
18
+ export function jsxDEV(
15
19
  type: unknown,
16
20
  props: Record<string, unknown> | null,
17
21
  key?: string | number
18
22
  ): JSXElement {
19
23
  return {
24
+ $$typeof: ELEMENT_TYPE,
20
25
  type,
21
- props: props || {},
22
- key,
26
+ props: props ?? {},
27
+ key: key ?? null,
23
28
  };
24
29
  }
25
30
 
31
+ // Production-style helpers: alias to the DEV factory for now
32
+ export function jsx(
33
+ type: unknown,
34
+ props: Record<string, unknown> | null,
35
+ key?: string | number
36
+ ) {
37
+ return jsxDEV(type, props, key);
38
+ }
39
+
26
40
  export function jsxs(
27
41
  type: unknown,
28
42
  props: Record<string, unknown> | null,
29
43
  key?: string | number
30
- ): JSXElement {
31
- return jsx(type, props, key);
44
+ ) {
45
+ return jsxDEV(type, props, key);
32
46
  }
33
47
 
34
- // Fragment for rendering multiple elements without wrapper
35
- // Unique fragment symbol for Askr
36
- export const Fragment = Symbol.for('@askrjs/askr.Fragment');
48
+ // `Fragment` is already exported above.
package/src/jsx/types.ts CHANGED
@@ -1,23 +1,42 @@
1
1
  /**
2
2
  * JSX type definitions
3
+ *
4
+ * These define the canonical JSX element shape used by:
5
+ * - jsx-runtime
6
+ * - jsx-dev-runtime
7
+ * - Slot / cloneElement
8
+ * - the reconciler
3
9
  */
4
10
 
5
11
  import type { Props } from '../shared/types';
6
12
 
13
+ export const ELEMENT_TYPE = Symbol.for('askr.element');
14
+ export const Fragment = Symbol.for('askr.fragment');
15
+
7
16
  export interface JSXElement {
8
- type: string | ((props: Props) => JSXElement | null);
17
+ /** Internal element marker (optional for plain vnode objects) */
18
+ $$typeof?: symbol;
19
+
20
+ /** Element type: string, component, Fragment, etc */
21
+ type: unknown;
22
+
23
+ /** Props bag */
9
24
  props: Props;
10
- key?: string | number;
25
+
26
+ /** Optional key (normalized by runtime) */
27
+ key?: string | number | null;
11
28
  }
12
29
 
13
30
  declare global {
14
31
  // eslint-disable-next-line @typescript-eslint/no-namespace
15
32
  namespace JSX {
16
- // Components must be synchronous; do not allow Promise in JSX.Element.
33
+ // Components must be synchronous
17
34
  type Element = JSXElement;
35
+
18
36
  interface IntrinsicElements {
19
37
  [elem: string]: Props;
20
38
  }
39
+
21
40
  interface ElementAttributesProperty {
22
41
  props: Props;
23
42
  }
@@ -0,0 +1,19 @@
1
+ import { ELEMENT_TYPE, JSXElement } from './types';
2
+
3
+ export function isElement(value: unknown): value is JSXElement {
4
+ return (
5
+ typeof value === 'object' &&
6
+ value !== null &&
7
+ (value as JSXElement).$$typeof === ELEMENT_TYPE
8
+ );
9
+ }
10
+
11
+ export function cloneElement(
12
+ element: JSXElement,
13
+ props: Record<string, unknown>
14
+ ): JSXElement {
15
+ return {
16
+ ...element,
17
+ props: { ...element.props, ...props },
18
+ };
19
+ }
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __esm = (fn, res) => function __init() {
6
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
- };
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- export {
23
- __esm,
24
- __export,
25
- __toCommonJS
26
- };
27
- //# sourceMappingURL=chunk-4CV4JOE5.js.map