@geastack/core 0.1.27 → 0.1.29
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/README.md +33 -0
- package/index.d.ts +2 -0
- package/package.json +3 -3
- package/runtime/compiler.ts +1 -0
package/README.md
CHANGED
|
@@ -24,6 +24,39 @@ and include roots to compile, and run its build driver, which bundles the app
|
|
|
24
24
|
with Vite, compiles it with `geatsc` and the Gea plugin, and hands the emitted
|
|
25
25
|
C++ to the target.
|
|
26
26
|
|
|
27
|
+
## Component startup
|
|
28
|
+
|
|
29
|
+
Use `@geastack/core` for applications targeting the native GeaStack hosts.
|
|
30
|
+
`Component` is the component base; `ReactiveComponent` makes its own fields
|
|
31
|
+
reactive, and `Store` holds shared reactive state. The web target supplies the
|
|
32
|
+
matching browser runtime. Direct use of `@geajs/core` belongs to the Gea web
|
|
33
|
+
framework and is not the native application contract.
|
|
34
|
+
|
|
35
|
+
Start loading data or drawing in `onAfterRender()`. The component's `el` is set
|
|
36
|
+
before this hook runs. Field initializers and constructors initialize state;
|
|
37
|
+
code that needs a rendered canvas belongs in the hook.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { ReactiveComponent } from '@geastack/core'
|
|
41
|
+
|
|
42
|
+
class Counter extends ReactiveComponent {
|
|
43
|
+
count = 0
|
|
44
|
+
onAfterRender(): void {
|
|
45
|
+
this.count = 1
|
|
46
|
+
}
|
|
47
|
+
template(): JSX.Element {
|
|
48
|
+
return <div>{this.count}</div>
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Compiler/runtime regressions should use generic language or framework cases.
|
|
54
|
+
Report compiler issues in `geastack/compiler`, host API and application-runtime
|
|
55
|
+
issues in `geastack/core`, Apple rendering/bindings in `geastack/apple`, and web
|
|
56
|
+
target integration in `geastack/simulator`. Contributions should include a
|
|
57
|
+
reproduction and target-specific validation. Lifecycle and representation
|
|
58
|
+
changes need to preserve the shared component and native-type contracts.
|
|
59
|
+
|
|
27
60
|
## Related packages
|
|
28
61
|
|
|
29
62
|
- `@geastack/engine` renders the element tree, `@geastack/host` supplies the
|
package/index.d.ts
CHANGED
|
@@ -746,6 +746,8 @@ export class Component<RootElement extends GeaElement = GeaElement, Props = void
|
|
|
746
746
|
// same thing as the mounted host node `el` points at. `null` is the base's
|
|
747
747
|
// own stub answer in `runtime/compiler.ts`.
|
|
748
748
|
template(props?: Props): GeaJsxElement | null
|
|
749
|
+
/** Called after the rendered root is available in el; start loading or drawing here. */
|
|
750
|
+
onAfterRender(): void
|
|
749
751
|
}
|
|
750
752
|
|
|
751
753
|
// Opt-in base for a component that holds its OWN reactive state — its instance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "GeaStack app API, reactivity headers, runtime sources, and type declarations.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@babel/types": "^7.23.0",
|
|
63
63
|
"@geajs/core": "1.5.1",
|
|
64
64
|
"@geajs/vite-plugin": "1.5.0",
|
|
65
|
-
"@geastack/compiler": "^1.0.
|
|
66
|
-
"@geastack/geatsc-plugin-gea": "^0.1.
|
|
65
|
+
"@geastack/compiler": "^1.0.19",
|
|
66
|
+
"@geastack/geatsc-plugin-gea": "^0.1.9",
|
|
67
67
|
"opentype.js": "^2.0.0",
|
|
68
68
|
"vite": "^8.0.0"
|
|
69
69
|
}
|
package/runtime/compiler.ts
CHANGED
|
@@ -22,6 +22,7 @@ export class Component<RootElement extends GeaElement = GeaElement, Props = void
|
|
|
22
22
|
template(_props?: Props): GeaJsxElement | null {
|
|
23
23
|
return null
|
|
24
24
|
}
|
|
25
|
+
onAfterRender(): void {}
|
|
25
26
|
// NB: deliberately NO `render` here. `render` is synthesised onto compiled
|
|
26
27
|
// components by the embedded compiler. Declaring it on the base looks tidier
|
|
27
28
|
// (it would let mount() drop its cast) but it BREAKS embedded codegen: once
|