@pritzlaff/nano-app 0.0.0-stage → 0.5.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 (85) hide show
  1. package/AGENTS.md +66 -0
  2. package/LICENSE +21 -0
  3. package/README.md +6 -2
  4. package/app/app.css +160 -0
  5. package/app/bundle/nano-ui.js +2553 -0
  6. package/app/examples/auth/example.auth.js +6 -0
  7. package/app/examples/auth/nano.json +46 -0
  8. package/app/examples/chat/example.chat.js +6 -0
  9. package/app/examples/chat/example.messaging.js +3 -0
  10. package/app/examples/chat/nano.json +115 -0
  11. package/app/examples/drift/example.drift.js +3 -0
  12. package/app/examples/drift/nano.json +31 -0
  13. package/app/examples/kv/example.kv.js +3 -0
  14. package/app/examples/nano.json +353 -0
  15. package/app/examples/originkey/_nano/bundle/nano-ui.js +212 -0
  16. package/app/examples/originkey/_nano/sandbox/boot.js +1 -0
  17. package/app/examples/originkey/_nano/shared/chunks/nano-core-2gg2vg5g.js +2 -0
  18. package/app/examples/originkey/_nano/shared/chunks/nano-core-5h5dssvv.js +3 -0
  19. package/app/examples/originkey/_nano/shared/chunks/nano-core-72b5e6vd.js +17 -0
  20. package/app/examples/originkey/_nano/shared/chunks/nano-core-87v2yejk.js +2 -0
  21. package/app/examples/originkey/_nano/shared/chunks/nano-core-hm29e227.js +7 -0
  22. package/app/examples/originkey/_nano/shared/chunks/nano-core-jtgk4ch8.js +2 -0
  23. package/app/examples/originkey/_nano/shared/chunks/nano-core-mqaje7vc.js +2 -0
  24. package/app/examples/originkey/_nano/shared/chunks/nano-core-mxgap7rs.js +2 -0
  25. package/app/examples/originkey/_nano/shared/chunks/nano-core-qy0mwf7y.js +1 -0
  26. package/app/examples/originkey/_nano/shared/chunks/nano-core-wanb7xw1.js +1 -0
  27. package/app/examples/originkey/_nano/shared/lit-class-map.js +1 -0
  28. package/app/examples/originkey/_nano/shared/lit-decorators.js +1 -0
  29. package/app/examples/originkey/_nano/shared/lit-directive.js +1 -0
  30. package/app/examples/originkey/_nano/shared/lit-if-defined.js +1 -0
  31. package/app/examples/originkey/_nano/shared/lit-ref.js +1 -0
  32. package/app/examples/originkey/_nano/shared/lit-repeat.js +1 -0
  33. package/app/examples/originkey/_nano/shared/lit-style-map.js +1 -0
  34. package/app/examples/originkey/_nano/shared/lit.js +1 -0
  35. package/app/examples/originkey/_nano/shared/nano-core.js +1 -0
  36. package/app/examples/originkey/_nano/shared/nano-elements.js +280 -0
  37. package/app/examples/originkey/_nano/shared/typebox-value.js +1 -0
  38. package/app/examples/originkey/_nano/shared/typebox.js +1 -0
  39. package/app/examples/originkey/example.originkey.js +6 -0
  40. package/app/examples/originkey/frame.html +1 -0
  41. package/app/examples/originkey/nano.json +50 -0
  42. package/app/examples/raft/example.raft.js +30 -0
  43. package/app/examples/raft/nano.json +74 -0
  44. package/app/examples/slice/nano.json +63 -0
  45. package/app/examples/slice/shout.js +14 -0
  46. package/app/examples/template/acme.template.js +11 -0
  47. package/app/examples/template/index.js +194 -0
  48. package/app/examples/template/nano.json +32 -0
  49. package/app/examples/todo/example.todo.js +8 -0
  50. package/app/examples/todo/nano.json +77 -0
  51. package/app/examples/typing/nano.json +33 -0
  52. package/app/favicon.svg +1 -0
  53. package/app/index.html +152 -0
  54. package/app/main.js +15906 -0
  55. package/app/react/index.html +50 -0
  56. package/app/react/main.js +9 -0
  57. package/app/sandbox/boot.js +980 -0
  58. package/app/shared/chunks/nano-core-296y9rgd.js +4321 -0
  59. package/app/shared/chunks/nano-core-2zz7d74m.js +16 -0
  60. package/app/shared/chunks/nano-core-35ryhkm1.js +33 -0
  61. package/app/shared/chunks/nano-core-5a3r312d.js +866 -0
  62. package/app/shared/chunks/nano-core-89mtxedm.js +186 -0
  63. package/app/shared/chunks/nano-core-bf13r20v.js +77 -0
  64. package/app/shared/chunks/nano-core-g3414rnc.js +248 -0
  65. package/app/shared/chunks/nano-core-hyg0qdwg.js +547 -0
  66. package/app/shared/chunks/nano-core-sxgrxy03.js +53 -0
  67. package/app/shared/chunks/nano-core-wg5c961d.js +4564 -0
  68. package/app/shared/lit-class-map.js +60 -0
  69. package/app/shared/lit-decorators.js +228 -0
  70. package/app/shared/lit-directive.js +11 -0
  71. package/app/shared/lit-if-defined.js +10 -0
  72. package/app/shared/lit-ref.js +12 -0
  73. package/app/shared/lit-repeat.js +141 -0
  74. package/app/shared/lit-style-map.js +67 -0
  75. package/app/shared/lit.js +47 -0
  76. package/app/shared/nano-core.js +2348 -0
  77. package/app/shared/nano-elements.js +1178 -0
  78. package/app/shared/typebox-value.js +78 -0
  79. package/app/shared/typebox.js +580 -0
  80. package/app/shared/versions.json +6 -0
  81. package/bin/nano-app.ts +34 -0
  82. package/package.json +22 -4
  83. package/src/events.ts +11 -0
  84. package/src/serve.ts +68 -0
  85. package/src/watch.ts +27 -0
@@ -0,0 +1,33 @@
1
+ {
2
+ "pods": {
3
+ "input": { "implementation": "nano.ui/input", "config": { "kind": "text" }, "eager": true },
4
+ "debounce": { "implementation": "nano.ui/debounce", "config": { "quietMs": 1000, "maxWaitMs": 4000 }, "eager": true },
5
+ "map": { "implementation": "nano.ui/map", "config": { "code": "return String(x).toUpperCase()" }, "eager": true },
6
+ "log": { "implementation": "nano.ui/log", "eager": true },
7
+ "clock": { "implementation": "nano.ui/clock", "eager": true }
8
+ },
9
+ "runtimes": {
10
+ "main": {
11
+ "pods": ["input", "debounce", "map", "log", "clock"],
12
+ "subscriptions": [
13
+ { "kind": "call", "from": "debounce", "to": "clock" },
14
+ { "kind": "pipe", "from": "input", "source": "nano.ui.Input/change", "to": "debounce", "target": "nano.ui.Debounce/push" },
15
+ { "kind": "pipe", "from": "debounce", "source": "nano.ui.Debounce/flushed", "to": "map", "target": "nano.ui.Map/map" },
16
+ { "kind": "pipe", "from": "map", "source": "nano.ui.Map/map", "to": "log", "target": "nano.ui.Log/log" }
17
+ ]
18
+ }
19
+ },
20
+ "modules": { "nano.ui": "../../bundle/nano-ui.js" },
21
+ "layout": {
22
+ "slots": [
23
+ { "id": "input", "runtime": "main", "pod": "input" },
24
+ { "id": "debounce", "runtime": "main", "pod": "debounce" },
25
+ { "id": "log", "runtime": "main", "pod": "log" }
26
+ ],
27
+ "geometry": {
28
+ "input": { "x": 0, "y": 0, "w": 1, "h": 0.2 },
29
+ "debounce": { "x": 0, "y": 0.2, "w": 1, "h": 0.5 },
30
+ "log": { "x": 0, "y": 0.7, "w": 1, "h": 0.3 }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>Nano</title><rect width="32" height="32" rx="7" fill="#14171D"/><rect x="5" y="5" width="9" height="9" rx="2" fill="#6FA8FF"/><rect x="18" y="18" width="9" height="9" rx="2" fill="#7EE787"/><path d="M14 9.5h3.5a5 5 0 0 1 5 5V18" fill="none" stroke="#E7E9EE" stroke-width="2.2" stroke-linecap="round"/></svg>
package/app/index.html ADDED
@@ -0,0 +1,152 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
+ <title>Nano</title>
7
+ <link rel="icon" href="./favicon.svg" type="image/svg+xml">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;600&family=Bricolage+Grotesque:wght@500;600;700&family=Fraunces:wght@500;600&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;600&family=JetBrains+Mono:wght@400;600&family=Architects+Daughter&family=Caveat:wght@600;700&family=Pixelify+Sans:wght@500;700&display=swap">
10
+ <link rel="stylesheet" href="./app.css">
11
+ <!-- The shared libraries, for packages imported from a URL (src/shared/specifiers.ts): one copy, the host's. -->
12
+ <script type="importmap">
13
+ {
14
+ "imports": {
15
+ "@pritzlaff/nano-core": "./shared/nano-core.js",
16
+ "@pritzlaff/nano-elements": "./shared/nano-elements.js",
17
+ "lit": "./shared/lit.js",
18
+ "lit/decorators.js": "./shared/lit-decorators.js",
19
+ "lit/directive.js": "./shared/lit-directive.js",
20
+ "lit/directives/class-map.js": "./shared/lit-class-map.js",
21
+ "lit/directives/style-map.js": "./shared/lit-style-map.js",
22
+ "lit/directives/repeat.js": "./shared/lit-repeat.js",
23
+ "lit/directives/ref.js": "./shared/lit-ref.js",
24
+ "@pritzlaff/nano-ui": "./bundle/nano-ui.js",
25
+ "lit/directives/if-defined.js": "./shared/lit-if-defined.js",
26
+ "typebox": "./shared/typebox.js",
27
+ "typebox/value": "./shared/typebox-value.js"
28
+ }
29
+ }
30
+ </script>
31
+ <script type="module" src="./main.js"></script>
32
+ </head>
33
+ <body>
34
+ <app-shell>
35
+ <span slot="title">Nano</span>
36
+ <nano-file-menu slot="title-actions"></nano-file-menu>
37
+ <nano-app-bar name="app" slot="title-actions"></nano-app-bar>
38
+ <nano-profile name="profile" slot="actions"></nano-profile>
39
+
40
+ <!-- Navigation: one link per <app-route> below, in order. -->
41
+ <!-- Workspaces: Main's row, then the other pages' as the Outline's tree (components/workspace-pages.ts fills Main's row like the others and adds theirs and their routes, and + and ✎ beside the title: a new page, and the nav's edit mode). -->
42
+ <div slot="nav" class="nav-row" data-workspaces><a href="#/p/workspace"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 4h18v16H3zM12 4v16M12 12h9"/></svg>Workspaces</a></div>
43
+ <div slot="drawer-footer" class="drawer-foot"><theme-picker layout="icons" themes="warm,blueprint,enterprise,shadcn"></theme-picker><span>Nano · v0.1</span></div>
44
+ <status-line slot="footer"></status-line>
45
+
46
+ <!-- Workspace: a golden-layout dock. Each <template> is a widget the picker can add. -->
47
+ <app-route path="/p/workspace" bleed>
48
+ <!-- <c-wires> tilts the live dock to show the connections behind it. -->
49
+ <div class="ws-page">
50
+ <c-wires>
51
+ <workspace-dock id="workspace" storage-key="workspace-starter.layout" open="nano-explorer" arrangement="grid">
52
+ <template data-widget="notes" data-title="Notes"><notes-panel></notes-panel></template>
53
+ <template data-widget="chart" data-title="Chart" data-flush><line-chart style="border:0;border-radius:0;box-shadow:none"></line-chart></template>
54
+ <template data-widget="metrics" data-title="Metrics"><div class="cards"><stat-card index="0"></stat-card><stat-card index="1"></stat-card><stat-card index="2"></stat-card><stat-card index="3"></stat-card></div></template>
55
+ <template data-widget="activity" data-title="Activity"><bus-log limit="40"></bus-log></template>
56
+ <!-- The app on nano-core: its pods (nano-ui's explorer; clicking one opens a `pod` panel showing its view),
57
+ and its wiring. A pod's own panel (`pod`) is the dock's, filled with the pod's view. BACKLOG(1): Instances and the Puzzle editor are gone. -->
58
+ <template data-widget="nano-explorer" data-title="Systems"><nano-explorer></nano-explorer></template>
59
+ <template data-widget="nano-wiring" data-title="Connections"><nano-wiring></nano-wiring></template>
60
+ <template data-widget="nano-gallery" data-title="Components gallery"><nano-gallery></nano-gallery></template>
61
+ </workspace-dock>
62
+ </c-wires>
63
+ </div>
64
+ </app-route>
65
+
66
+ <!-- Systems: every system and its components, by system or by component. Select an action, then connect it to
67
+ one that fits. The example below is made by composable.ts; these elements attach to it by name. -->
68
+ <app-route path="/systems">
69
+ <header class="page-head">
70
+ <h1>Systems</h1>
71
+ <p>Move the range: its values queue in the debounce and land in the log as a batch. Type a number into the input and press Enter: the map doubles it into the log. Select an action in the tree, then connect it to one that fits.</p>
72
+ </header>
73
+ <section class="panel"><nano-explorer></nano-explorer></section>
74
+ <!-- BACKLOG(1): the Instances table and the worked example (range → debounce → log, input → map → log) were @composable components. -->
75
+ <div class="cards composable-row" hidden>
76
+ <section class="panel"><h2>Range</h2><c-range name="ex-range"></c-range></section>
77
+ <section class="panel"><h2>Debounce</h2><c-debounce name="ex-debounce"></c-debounce></section>
78
+ <section class="panel"><h2>Input</h2><c-input name="ex-input"></c-input></section>
79
+ <section class="panel"><h2>Map</h2><c-map name="ex-map"></c-map></section>
80
+ <section class="panel"><h2>Log</h2><c-log name="ex-log"></c-log></section>
81
+ </div>
82
+ </app-route>
83
+
84
+ <!-- Components: the widgets' component library under the chosen theme, or every theme side by side. -->
85
+ <app-route path="/components">
86
+ <nano-gallery></nano-gallery>
87
+ </app-route>
88
+
89
+ <app-route path="/themes">
90
+ <header class="page-head">
91
+ <h1>Themes</h1>
92
+ <p>Themes are sets of CSS custom properties in <code>src/lib/themes.ts</code>. Your choice is remembered in this browser.</p>
93
+ </header>
94
+ <section class="panel">
95
+ <h2>Theme</h2>
96
+ <theme-picker layout="cards"></theme-picker>
97
+ </section>
98
+ </app-route>
99
+
100
+ <!-- Desk: the system as runtimes of pod columns; Connections flips the last workspace's dock. -->
101
+ <app-route path="/desk" bleed>
102
+ <div class="wiring-page">
103
+ <nav class="wiring-views" aria-label="Wiring view"><a href="#/p/workspace" data-connections hidden>Connections</a><a href="#/desk" aria-current="page">Desk</a><a href="#/messages">Messages</a><a href="#/ring">Ring</a></nav>
104
+ <nano-time-machine></nano-time-machine>
105
+ <c-desk></c-desk>
106
+ </div>
107
+ </app-route>
108
+
109
+ <!-- Messages: the recording as a searchable table, on the same time machine as the Desk. -->
110
+ <app-route path="/messages" bleed>
111
+ <div class="wiring-page">
112
+ <nav class="wiring-views" aria-label="Wiring view"><a href="#/p/workspace" data-connections hidden>Connections</a><a href="#/desk">Desk</a><a href="#/messages" aria-current="page">Messages</a><a href="#/ring">Ring</a></nav>
113
+ <nano-time-machine></nano-time-machine>
114
+ <c-messages></c-messages>
115
+ </div>
116
+ </app-route>
117
+
118
+ <!-- Ring: one ring per runtime, each pod as its view, messages between them; scrubbed back, the state at the cursor. -->
119
+ <app-route path="/ring" bleed>
120
+ <div class="wiring-page">
121
+ <nav class="wiring-views" aria-label="Wiring view"><a href="#/p/workspace" data-connections hidden>Connections</a><a href="#/desk">Desk</a><a href="#/messages">Messages</a><a href="#/ring" aria-current="page">Ring</a></nav>
122
+ <nano-time-machine></nano-time-machine>
123
+ <nano-ring></nano-ring>
124
+ </div>
125
+ </app-route>
126
+
127
+ <app-route path="/settings">
128
+ <header class="page-head">
129
+ <h1>Settings</h1>
130
+ <p>The decisions in force: each runtime's policy, isolation, where code comes from, and how the workspace remembers its layout.</p>
131
+ </header>
132
+ <section class="panel"><nano-settings></nano-settings></section>
133
+ <section class="panel">
134
+ <h2>Layout</h2>
135
+ <p>Resizable areas remember their sizes, and the workspace remembers a layout when you press Save layout in the app bar.</p>
136
+ <button type="button" class="btn" id="reset-splits">Forget pane sizes and the saved workspace</button>
137
+ </section>
138
+ </app-route>
139
+
140
+ <app-route path="*">
141
+ <header class="page-head"><h1>Page not found</h1><p>Nothing lives at this address. <a href="#/p/workspace">Go to the workspace</a>.</p></header>
142
+ </app-route>
143
+ </app-shell>
144
+ <script type="module">
145
+ /* Small page-level wiring: clear remembered split sizes, then reload. */
146
+ document.getElementById('reset-splits').addEventListener('click', () => {
147
+ try { Object.keys(localStorage).filter((k) => k.startsWith('split:') || k === 'workspace-starter.layout').forEach((k) => localStorage.removeItem(k)); } catch {}
148
+ location.reload();
149
+ });
150
+ </script>
151
+ </body>
152
+ </html>