@geastack/core 0.1.23
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 +202 -0
- package/README.md +36 -0
- package/app_frame_perf.cpp +77 -0
- package/css.d.ts +1 -0
- package/events.cpp +67 -0
- package/gea_app_entry.cpp +317 -0
- package/gea_sources.mjs +126 -0
- package/gea_sources.sh +36 -0
- package/include/app.h +60 -0
- package/include/apps.h +46 -0
- package/include/audio.h +90 -0
- package/include/ble.h +212 -0
- package/include/bluetooth/hid_profile.h +92 -0
- package/include/camera.h +107 -0
- package/include/canvas.h +290 -0
- package/include/display.h +390 -0
- package/include/display_present.h +869 -0
- package/include/event.h +32 -0
- package/include/events.h +116 -0
- package/include/gea/embedded.h +13 -0
- package/include/gea/reactive_runtime.h +32 -0
- package/include/gea.h +14 -0
- package/include/gea_perf_config.h +96 -0
- package/include/geaos/abi.h +165 -0
- package/include/geolocation.h +126 -0
- package/include/gpio.h +61 -0
- package/include/graphics/font.h +122 -0
- package/include/i2c.h +20 -0
- package/include/image.h +156 -0
- package/include/imu.h +23 -0
- package/include/input.h +33 -0
- package/include/memory.h +52 -0
- package/include/pixel.h +907 -0
- package/include/platform/file_cache.h +18 -0
- package/include/power.h +11 -0
- package/include/runtime.h +83 -0
- package/include/services/app_runner.h +10 -0
- package/include/services/app_state.h +14 -0
- package/include/services/battery_service.h +12 -0
- package/include/services/bluetooth_service.h +13 -0
- package/include/services/diagnostics.h +76 -0
- package/include/services/diagnostics_platform.h +54 -0
- package/include/services/frame_scheduler.h +71 -0
- package/include/services/mirror.h +49 -0
- package/include/services/network_services.h +25 -0
- package/include/services/ota.h +32 -0
- package/include/services/runtime_log.h +11 -0
- package/include/services/storage_service.h +26 -0
- package/include/touch.h +38 -0
- package/include/ui/signal.h +149 -0
- package/include/wifi.h +67 -0
- package/index.d.ts +1940 -0
- package/jsx.d.ts +1 -0
- package/package.json +70 -0
- package/runtime/ble.ts +49 -0
- package/runtime/color.ts +21 -0
- package/runtime/compiler.ts +43 -0
- package/runtime/host.ts +1083 -0
- package/runtime/images.ts +129 -0
- package/runtime/primitives.ts +49 -0
- package/runtime-surface.ts +180 -0
- package/runtime.cpp +431 -0
- package/runtime.ts +34 -0
- package/scripts/build-gea-vite-geatsc.mjs +4514 -0
- package/scripts/dotenv-defines.mjs +98 -0
- package/scripts/gea-bundle-type-hints.mjs +546 -0
- package/scripts/gea-embedded-compat-staging.mjs +17 -0
- package/scripts/gea-embedded-compat-transform.mjs +427 -0
- package/scripts/gea-vite-module-graph-plugin.mjs +578 -0
- package/scripts/generate-gea-embedded-assets.mjs +296 -0
- package/scripts/generate-gea-embedded-fonts.mjs +1252 -0
- package/scripts/generate-installed-app-plan.mjs +55 -0
- package/scripts/native-object-cache.sh +244 -0
package/jsx.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index'
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geastack/core",
|
|
3
|
+
"version": "0.1.23",
|
|
4
|
+
"description": "GeaStack app API, reactivity headers, runtime sources, and type declarations.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/geastack/core.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=20.19"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./runtime.ts"
|
|
20
|
+
},
|
|
21
|
+
"./runtime": {
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
|
+
"default": "./runtime.ts"
|
|
24
|
+
},
|
|
25
|
+
"./runtime/*": {
|
|
26
|
+
"default": "./runtime/*.ts"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
"./scripts/*": "./scripts/*",
|
|
30
|
+
"./include/*": "./include/*",
|
|
31
|
+
"./runtime.cpp": "./runtime.cpp",
|
|
32
|
+
"./gea_sources.sh": "./gea_sources.sh"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"app_frame_perf.cpp",
|
|
36
|
+
"css.d.ts",
|
|
37
|
+
"events.cpp",
|
|
38
|
+
"gea_sources.sh",
|
|
39
|
+
"gea_sources.mjs",
|
|
40
|
+
"gea_app_entry.cpp",
|
|
41
|
+
"include",
|
|
42
|
+
"index.d.ts",
|
|
43
|
+
"jsx.d.ts",
|
|
44
|
+
"runtime",
|
|
45
|
+
"runtime.cpp",
|
|
46
|
+
"runtime-surface.ts",
|
|
47
|
+
"runtime.ts",
|
|
48
|
+
"scripts",
|
|
49
|
+
"vendor"
|
|
50
|
+
],
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"sideEffects": false,
|
|
55
|
+
"optionalDependencies": {
|
|
56
|
+
"sharp": "^0.35.0"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@babel/generator": "^7.23.0",
|
|
60
|
+
"@babel/parser": "^7.23.0",
|
|
61
|
+
"@babel/traverse": "^7.23.0",
|
|
62
|
+
"@babel/types": "^7.23.0",
|
|
63
|
+
"@geajs/core": "1.4.0",
|
|
64
|
+
"@geajs/vite-plugin": "1.4.1",
|
|
65
|
+
"@geastack/compiler": "^1.0.4",
|
|
66
|
+
"@geastack/geatsc-plugin-gea": "^0.1.0",
|
|
67
|
+
"opentype.js": "^2.0.0",
|
|
68
|
+
"vite": "^8.0.0"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/runtime/ble.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Store } from './compiler'
|
|
2
|
+
import { BLE } from './host'
|
|
3
|
+
|
|
4
|
+
const bleServers: BLEServer[] = []
|
|
5
|
+
let initializedServerCount = 0
|
|
6
|
+
|
|
7
|
+
export class BLEServer extends Store {
|
|
8
|
+
deviceName: string
|
|
9
|
+
appearance: number
|
|
10
|
+
macAddress: string
|
|
11
|
+
|
|
12
|
+
constructor(deviceName: string, appearance: number, macAddress: string) {
|
|
13
|
+
super()
|
|
14
|
+
this.deviceName = deviceName
|
|
15
|
+
this.appearance = appearance
|
|
16
|
+
this.macAddress = macAddress
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onConnected(): void {}
|
|
20
|
+
onDisconnected(): void {}
|
|
21
|
+
onBound(): void {}
|
|
22
|
+
|
|
23
|
+
startAdvertising(): void {
|
|
24
|
+
BLE.startAdvertising()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
stopAdvertising(): void {
|
|
28
|
+
BLE.stopAdvertising()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Registration must happen after the complete derived instance exists. Doing
|
|
33
|
+
// this from BLEServer's base constructor snapshots only the base subobject in
|
|
34
|
+
// native builds, losing derived configuration and virtual callbacks.
|
|
35
|
+
export function registerBleServer(server: BLEServer): void {
|
|
36
|
+
// Embedded builds register the complete derived instance through the
|
|
37
|
+
// BLEServer class-factory hook. Keep this function as a source-compatible
|
|
38
|
+
// API without registering the base-class view a second time.
|
|
39
|
+
void server
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function initBleServers(): void {
|
|
43
|
+
while (initializedServerCount < bleServers.length) {
|
|
44
|
+
const server = bleServers[initializedServerCount]
|
|
45
|
+
initializedServerCount++
|
|
46
|
+
BLE.init(server.deviceName, server.appearance, server.macAddress)
|
|
47
|
+
BLE.startAdvertising()
|
|
48
|
+
}
|
|
49
|
+
}
|
package/runtime/color.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Canvas colour authoring helpers.
|
|
2
|
+
//
|
|
3
|
+
// Apps express colours in the natural 0xRRGGBBAA order (red in the high byte) —
|
|
4
|
+
// the same order you'd write a CSS hex (#RRGGBB) plus an alpha byte. `rgb()` and
|
|
5
|
+
// `rgba()` just pack the channels into that 32-bit number; the actual conversion
|
|
6
|
+
// to this board's native pixel (RGB565 on esp32 — panel-endian-aware — or
|
|
7
|
+
// RGBA8888 on iOS) happens in geatsc's canvas-colour lowering
|
|
8
|
+
// (pixel::nativeFromRrggbbaa). Literal calls fold to a constexpr at build time, so
|
|
9
|
+
// there is no runtime cost; dynamic channels (e.g. a per-face shaded colour) run
|
|
10
|
+
// the same conversion once at the call site. No per-app pixel packing.
|
|
11
|
+
//
|
|
12
|
+
// `>>> 0` keeps the result an unsigned 32-bit value — the alpha byte sets bit 31,
|
|
13
|
+
// which a bitwise OR would otherwise make negative.
|
|
14
|
+
|
|
15
|
+
export function rgb(r: number, g: number, b: number): number {
|
|
16
|
+
return (((r & 0xff) << 24) | ((g & 0xff) << 16) | ((b & 0xff) << 8) | 0xff) >>> 0
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function rgba(r: number, g: number, b: number, a: number): number {
|
|
20
|
+
return (((r & 0xff) << 24) | ((g & 0xff) << 16) | ((b & 0xff) << 8) | (a & 0xff)) >>> 0
|
|
21
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GeaElement, GeaJsxElement } from '../index'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `RootElement` is constrained and defaulted exactly as this package's own
|
|
5
|
+
* `index.d.ts` declares it. The two used to disagree -- the declaration said
|
|
6
|
+
* `extends GeaElement = GeaElement`, this implementation said `= unknown` --
|
|
7
|
+
* and since the embedded/geatsc pipeline aliases `@geastack/core` to
|
|
8
|
+
* `runtime.ts` rather than the declaration file, it was this weaker default
|
|
9
|
+
* that every compiled app actually saw. `unknown` absorbs the union in
|
|
10
|
+
* `RootElement | null`, so `el` typed as plain `unknown`: a value the compiler
|
|
11
|
+
* must box, for no reason other than the two spellings having drifted apart.
|
|
12
|
+
* `runtime-surface.ts` re-exports these element types from `./index` for the
|
|
13
|
+
* same reason and says so in the same terms.
|
|
14
|
+
*/
|
|
15
|
+
export class Component<RootElement extends GeaElement = GeaElement, Props = void> {
|
|
16
|
+
readonly el: RootElement | null = null
|
|
17
|
+
// Kept in lockstep with `index.d.ts`, which carries the reasoning. This is
|
|
18
|
+
// the copy that matters for a compiled app -- the pipeline aliases
|
|
19
|
+
// `@geastack/core` to `runtime.ts`, so this signature, not the declaration
|
|
20
|
+
// file's, is the one geatsc derives carriers from. `unknown[]`/`unknown` here
|
|
21
|
+
// meant a boxed argument array and a boxed result on every component.
|
|
22
|
+
template(_props?: Props): GeaJsxElement | null {
|
|
23
|
+
return null
|
|
24
|
+
}
|
|
25
|
+
// NB: deliberately NO `render` here. `render` is synthesised onto compiled
|
|
26
|
+
// components by the embedded compiler. Declaring it on the base looks tidier
|
|
27
|
+
// (it would let mount() drop its cast) but it BREAKS embedded codegen: once
|
|
28
|
+
// geatsc sees `render` on the statically-typed `Component`, mount()'s
|
|
29
|
+
// `new component()` constructs the base `Component` by value instead of
|
|
30
|
+
// dynamically constructing the real runtime class, so the app never mounts.
|
|
31
|
+
// Verified on esp32-s3-m5stack-papers3. Keep it off the base.
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class Store {}
|
|
35
|
+
|
|
36
|
+
// EXPERIMENTAL (component-as-store): the vite-plugin rewrites
|
|
37
|
+
// `extends ReactiveComponent` to a lean typed class before codegen (matched by
|
|
38
|
+
// source identifier). This marker only needs to exist so imports resolve during
|
|
39
|
+
// bundling / DOM execution.
|
|
40
|
+
export class ReactiveComponent<
|
|
41
|
+
RootElement extends GeaElement = GeaElement,
|
|
42
|
+
Props = void
|
|
43
|
+
> extends Component<RootElement, Props> {}
|