@cloudcrane/app-runtime 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +39 -2
- package/THIRD_PARTY_LICENSES.txt +980 -0
- package/dist/compiler/compile.d.ts +16 -0
- package/dist/compiler/compile.js +56 -0
- package/dist/compiler/runtime.generated.d.ts +3 -0
- package/dist/compiler/runtime.generated.js +4 -0
- package/dist/host.d.ts +3 -0
- package/dist/host.js +7 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/runtime/styles.d.ts +2 -0
- package/dist/runtime/styles.js +12 -0
- package/dist/runtime/theme.d.ts +10 -0
- package/dist/runtime/theme.js +71 -0
- package/package.json +68 -3
- package/runtime-lock.json +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chirag Phor
|
|
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,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cloudcrane/app-runtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Builds a CloudCrane app spec into one HTML page: the same bytes for the same
|
|
4
|
+
spec and runtime version, every time. It writes no code and uses no AI: it
|
|
5
|
+
checks the spec, turns its tokens into CSS, puts the spec in the page as data,
|
|
6
|
+
and inlines the runtime that draws it with A2UI's renderer.
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
import { compile } from "@cloudcrane/app-runtime";
|
|
10
|
+
|
|
11
|
+
const { html, sha256, runtime } = compile(spec);
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- `compile(spec)` returns the page, its sha256 and the runtime it was built
|
|
15
|
+
with (`@cloudcrane/app-runtime@0.2.0+<hash>`); it throws `CompileError`
|
|
16
|
+
listing every problem when the spec doesn't validate.
|
|
17
|
+
- Each runtime version is locked to one bundle hash (`runtime-lock.json`), so a
|
|
18
|
+
version always draws apps the same way.
|
|
19
|
+
- A coded component runs in a frame that's sandboxed (scripts only, so it has
|
|
20
|
+
no storage and nothing of the page's), in a closed shadow root, reached only
|
|
21
|
+
through a `MessagePort`. Under CloudCrane's lockdown the lockdown makes the
|
|
22
|
+
frame (`window.__ccFrame`); elsewhere the runtime makes the same kind. The
|
|
23
|
+
page drives it: a seed and the inputs, then its clock each frame, paused
|
|
24
|
+
while hidden. The game kit turns that clock into fixed steps, so a game moves
|
|
25
|
+
the same way for the same time and seed:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
game.start({ rate: 6, setup() {}, step() {}, draw(g, width, height) {} });
|
|
29
|
+
game.on("swipe", (dir) => {}); // also "tap" and "input"
|
|
30
|
+
game.state = { score }; // shown at /ui/coded/<id>/state
|
|
31
|
+
game.emit("over", { score }); // the screen's action for "over" runs
|
|
32
|
+
game.random(); // seeded by the page
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `@cloudcrane/app-runtime/host`: what a host publishing spec apps needs in one
|
|
36
|
+
import (validate, compile, derive the blueprint).
|
|
37
|
+
|
|
38
|
+
The runtime inlined in every page includes code from other open-source
|
|
39
|
+
packages; their licences are in `THIRD_PARTY_LICENSES.txt`. `zod` 3.25 is a
|
|
40
|
+
peer dependency. MIT licensed.
|