apprun 3.37.3 → 3.38.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.
Files changed (65) hide show
  1. package/.claude/settings.local.json +18 -0
  2. package/.docs/done/2026/07/13/explicit-pretty-links.md +32 -0
  3. package/.docs/done/2026/07/13/first-render-dom-attributes.md +18 -0
  4. package/.docs/plans/2026/07/13/plan-explicit-pretty-links.md +119 -0
  5. package/.docs/plans/2026/07/13/plan-first-render-dom-attributes.md +66 -0
  6. package/.docs/plans/2026/07/13/plan-play-typescript-runtime.md +77 -0
  7. package/.docs/plans/2026/07/13/plan-release-3-38-1-docs.md +74 -0
  8. package/.docs/reqs/2026/07/13/req-explicit-pretty-links.md +46 -0
  9. package/.docs/reqs/2026/07/13/req-first-render-dom-attributes.md +31 -0
  10. package/.docs/reqs/2026/07/13/req-play-typescript-runtime.md +29 -0
  11. package/.docs/reqs/2026/07/13/req-release-3-38-1-docs.md +34 -0
  12. package/.playwright-mcp/console-2026-06-24T18-37-47-881Z.log +17 -0
  13. package/CHANGELOG.md +14 -1
  14. package/README.md +3 -2
  15. package/WHATSNEW.md +32 -6
  16. package/ai/apprun.prompt.md +545 -109
  17. package/apprun.d.ts +21 -6
  18. package/cli/app.js +7 -0
  19. package/dist/apprun-code.js +1 -1
  20. package/dist/apprun-code.js.map +1 -1
  21. package/dist/apprun-dev-tools.js +1 -1
  22. package/dist/apprun-dev-tools.js.map +1 -1
  23. package/dist/apprun-html.esm.js +7 -7
  24. package/dist/apprun-html.esm.js.map +1 -1
  25. package/dist/apprun-html.js +1 -1
  26. package/dist/apprun-html.js.map +1 -1
  27. package/dist/apprun-play-html.esm.js +7 -7
  28. package/dist/apprun-play-html.esm.js.map +1 -1
  29. package/dist/apprun-play.js +1 -1
  30. package/dist/apprun-play.js.map +1 -1
  31. package/dist/apprun.esm.js +1 -1
  32. package/dist/apprun.esm.js.map +1 -1
  33. package/dist/apprun.js +1 -1
  34. package/dist/apprun.js.map +1 -1
  35. package/dist/createState.js.map +1 -1
  36. package/esm/apprun-code.js +15 -3
  37. package/esm/apprun-code.js.map +1 -1
  38. package/esm/apprun-play.js +8 -2
  39. package/esm/apprun-play.js.map +1 -1
  40. package/esm/apprun.js +16 -8
  41. package/esm/apprun.js.map +1 -1
  42. package/esm/directive.js +129 -8
  43. package/esm/directive.js.map +1 -1
  44. package/esm/router.js +3 -2
  45. package/esm/router.js.map +1 -1
  46. package/esm/types.js +1 -0
  47. package/esm/types.js.map +1 -1
  48. package/esm/vdom-my-prop-attr.js +5 -11
  49. package/esm/vdom-my-prop-attr.js.map +1 -1
  50. package/esm/version.js +1 -1
  51. package/jsx-runtime.js +1 -1
  52. package/jsx-runtime.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/apprun-code.tsx +15 -3
  55. package/src/apprun-play.tsx +9 -3
  56. package/src/apprun.ts +18 -10
  57. package/src/component.ts +1 -1
  58. package/src/createState.ts +1 -1
  59. package/src/directive.ts +132 -7
  60. package/src/global.d.ts +2 -2
  61. package/src/router.ts +3 -2
  62. package/src/types.ts +6 -3
  63. package/src/vdom-my-prop-attr.ts +5 -11
  64. package/src/version.ts +1 -1
  65. package/error.log +0 -0
package/README.md CHANGED
@@ -116,7 +116,7 @@ app.start(document.body, state, view);
116
116
  ```
117
117
  <apprun-code></apprun-code>
118
118
 
119
- And, of course, you can use Components to encapsulate the logic blocks, e.g., SPA pages. Each component can have its own state, view, and update functions. Each component has its own handlers to handle the routing events. AppRun routes `/<path>`, `#<path>`, and `#/<path>` URLs to components. AppRun also does this with [hierarchical routing](docs/requirements/req-hierarchical-routing.md).
119
+ And, of course, you can use Components to encapsulate the logic blocks, e.g., SPA pages. Each component can have its own state, view, and update functions. Each component has its own handlers to handle routing events. Hash URLs work by default. To intercept ordinary `/<path>` links for SPA navigation, call `app.use_prettyLink()` before AppRun initializes. AppRun also supports [hierarchical routing](docs/requirements/req-hierarchical-routing.md).
120
120
 
121
121
  ```js
122
122
  class Home extends Component {
@@ -142,6 +142,7 @@ const App = () => <>
142
142
  <div id="pages"></div>
143
143
  </>
144
144
 
145
+ app.use_prettyLink();
145
146
  app.render(document.body, <App />);
146
147
  [About, Contact, Home].map(C => new C().start('pages'));
147
148
  ```
@@ -286,4 +287,4 @@ Copyright (c) 2015-2025 Yiyi Sun
286
287
  [twitter-badge]: https://img.shields.io/twitter/url/https/github.com/yysun/apprun.svg?style=social
287
288
 
288
289
  [discord-image]: https://img.shields.io/discord/476903999023480842.svg
289
- [discord-invite]: https://discord.gg/CETyUdx
290
+ [discord-invite]: https://discord.gg/CETyUdx
package/WHATSNEW.md CHANGED
@@ -1,5 +1,29 @@
1
1
  ## What's New
2
2
 
3
+ > July 13, 2026, V3.38.1
4
+
5
+ ### Routing compatibility
6
+
7
+ AppRun again uses hash routing and normal browser navigation by default. Applications that intentionally use SPA `/path` links must opt into pretty-link routing before AppRun initializes:
8
+
9
+ ```js
10
+ app.use_prettyLink();
11
+ ```
12
+
13
+ This restores the explicit routing contract and prevents AppRun from intercepting ordinary same-origin links unless the application requests it.
14
+
15
+ ### Fixes
16
+
17
+ - Fixed the first client render so stale server-rendered or loading classes are removed when the new vnode has null or undefined props.
18
+ - Fixed Play by loading a pinned TypeScript browser runtime and running browser-global examples early enough for startup configuration such as `app.use_prettyLink()` to take effect.
19
+ - Updated the README, CLI starter, standalone add-components demo, and Play routing examples for explicit pretty-link routing; also repaired the SVG xlink example.
20
+
21
+ > July 26, 2025, V3.38.0
22
+
23
+ - Improved `$bind` directive to support nested objects and arrays: [Effortless Two-Way Data Binding in Apprun with $bind](#docs/done/blog-bind-directive.md)
24
+ - Support for type safe props and children in components: [Typed Props and Children](#docs/done/blog-typed-props-and-children.md)
25
+ - Use `unknown` instead of `any` for generic defaults to enhance type safety: [Why `unknown` is better than `any`](#docs/done/blog-why-unknown-better-than-any.md)
26
+
3
27
  > July 22, 2025, V3.37.0
4
28
 
5
29
  - Introduced `createState` helper for simplified immutable state updates using Immer [create-state-immer](#docs/done/blog-create-state-immer.md)
@@ -27,10 +51,16 @@ Code review by using Copilot and Claude Sonnet 4, see [plan-apprun-bugfixes.md](
27
51
  > July 11, 2025, V3.35.0
28
52
 
29
53
 
30
- ### Support auto use router for pretty links
54
+ ### Support routing with pretty links
31
55
 
32
56
  AppRun now supports pretty links.
33
57
 
58
+ Enable pretty-link routing before AppRun initializes:
59
+
60
+ ```js
61
+ app.use_prettyLink();
62
+ ```
63
+
34
64
  ```html
35
65
  <a href="/about">About</a>
36
66
  ```
@@ -69,9 +99,7 @@ app.render(document.body, <App />);
69
99
 
70
100
 
71
101
 
72
- AppRun will catch the `'/about'` route as event and render the component that is subscribed to it.
73
-
74
- If you have components subscribe to '#', or '#/', Apprun will fallback to the hash-based routing.
102
+ AppRun will catch the `'/about'` route as an event and render the component that is subscribed to it. Without the explicit opt-in, AppRun uses hash routing and leaves ordinary links to the browser.
75
103
 
76
104
  > July 6, 2025, V3.33.10
77
105
 
@@ -357,5 +385,3 @@ Published on Jul 2, 2017 · 5 min read
357
385
 
358
386
  * [Building Applications with AppRun, Part 1 - Getting Started](https://www.youtube.com/watch?v=RuRmXEN2-xI)
359
387
  * [Building Applications with AppRun, Part 2 - Components](https://www.youtube.com/watch?v=qkP6HvZmhtY)
360
-
361
-