@cadence-app/compiler 0.7.0 → 0.8.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.
@@ -5,7 +5,7 @@ import * as router from '@cadence-app/router';
5
5
  import { JavaScriptChannelTransport, containerBridgeObject, NativeBridge, TransportUnavailableError, createNativeApi, setActiveNativeApi, } from '@cadence-app/bridge';
6
6
  import { APP_ICON_STYLE_ID, BASE_STYLESHEET, BASE_STYLE_ID, BUILTIN_COMPONENTS, BUILTIN_COMPONENT_STYLESHEET, BUILTIN_COMPONENT_STYLE_ID, BUILTIN_ICONS, ComponentRegistry, ICON_BASE_STYLESHEET, ICON_STYLE_ID, appendStyle, iconRulesFor, applyTextScale, applyViewportGeometry, injectStyleOnce, installErrorBoundary, instructions, textScaleOf, toEngineError, } from '@cadence-app/runtime';
7
7
  import { BridgeEvents } from '@cadence-app/bridge';
8
- import { PageRegistry, ROUTER_COMPONENTS, ROUTER_COMPONENT_STYLESHEET, ROUTER_COMPONENT_STYLE_ID, ROUTER_STYLESHEET, ROUTER_STYLE_ID, Router, resolvePageChrome, setActiveRouter, } from '@cadence-app/router';
8
+ import { PageRegistry, ROUTER_COMPONENTS, ROUTER_COMPONENT_STYLESHEET, ROUTER_COMPONENT_STYLE_ID, ROUTER_STYLESHEET, ROUTER_STYLE_ID, Router, launchTargetOf, resolvePageChrome, setActiveRouter, } from '@cadence-app/router';
9
9
  import { COLOR_SCHEME_ATTRIBUTE, PLATFORM_ATTRIBUTE, THEME_STYLE_ID } from '@cadence-app/theme';
10
10
  import { allManifestPages } from "../manifest.js";
11
11
  const ENGINE_VERSION = '0.1.0';
@@ -136,12 +136,16 @@ function statusBarIconsDefault(nativeApi) {
136
136
  }
137
137
  /**
138
138
  * Le conteneur répond sous le dernier chrome qu'on lui a annoncé : sans cette
139
- * annonce, une entrée `custom` écrirait ses zones sûres sous la barre que le
140
- * conteneur affiche par défaut.
139
+ * annonce, une page d'ouverture `custom` écrirait ses zones sûres sous la
140
+ * barre que le conteneur affiche par défaut.
141
+ *
142
+ * C'est le chrome de la page **visée** qui part, et non celui de l'entrée du
143
+ * manifest : une cible dont le style de navigation diffère mesurerait sinon sa
144
+ * géométrie sous la barre d'une page qu'elle ne montrera jamais (ADR-043).
141
145
  */
142
- function announceEntryChrome(nativeApi, manifest) {
143
- nativeApi.nav.setChrome(resolvePageChrome(manifest, manifest.entry)).catch((error) => {
144
- console.error('[cadence] the container did not take the entry chrome', error);
146
+ function announceOpeningChrome(nativeApi, manifest, route) {
147
+ nativeApi.nav.setChrome(resolvePageChrome(manifest, route)).catch((error) => {
148
+ console.error('[cadence] the container did not take the opening chrome', error);
145
149
  });
146
150
  }
147
151
  /**
@@ -207,6 +211,9 @@ async function startEngine(manifest, app) {
207
211
  // Un rejet ici relancerait le gestionnaire de rejets non interceptés.
208
212
  void nativeApi.app.reportError(error).catch(() => undefined);
209
213
  };
214
+ /* Demandée dès que le pont existe, et attendue plus bas : l'aller-retour
215
+ court pendant l'installation des feuilles, qui est synchrone. */
216
+ const askingWhereToOpen = nativeApi.app.getLaunchOptions();
210
217
  injectStyleOnce(document, BASE_STYLE_ID, BASE_STYLESHEET);
211
218
  injectStyleOnce(document, ICON_STYLE_ID, ICON_BASE_STYLESHEET + iconRulesFor(BUILTIN_ICONS));
212
219
  injectStyleOnce(document, BUILTIN_COMPONENT_STYLE_ID, BUILTIN_COMPONENT_STYLESHEET);
@@ -221,7 +228,11 @@ async function startEngine(manifest, app) {
221
228
  ? {}
222
229
  : { navigationStyle: manifest.navigationStyle }),
223
230
  };
224
- announceEntryChrome(nativeApi, routerManifest);
231
+ /* Le chrome part sous la page qui s'ouvrira vraiment, et `getSystemInfo`
232
+ se mesure sous ce chrome-là (§7) : la cible précède donc les deux. C'est
233
+ l'aller-retour que l'ADR-043 ajoute à l'amorçage. */
234
+ const launchTarget = await askingWhereToOpen;
235
+ announceOpeningChrome(nativeApi, routerManifest, launchTargetOf(routerManifest.entry, launchTarget).route);
225
236
  await applyInitialEnvironment(nativeApi, tone);
226
237
  nativeBridge.on(BridgeEvents.colorSchemeChanged, (payload) => {
227
238
  applyColorScheme(tone, payload.colorScheme);
@@ -247,6 +258,7 @@ async function startEngine(manifest, app) {
247
258
  nav: nativeApi.nav,
248
259
  bridge: nativeBridge,
249
260
  manifest: routerManifest,
261
+ launchTarget,
250
262
  loadChunk: loadSubPackageChunk,
251
263
  reportError: (error) => errorBoundary.handle(toEngineError(error, 'uncaught')),
252
264
  ...(app === undefined ? {} : { app }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cadence-app/compiler",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Compilation des templates en instructions, SCSS scopé, bundling",
5
5
  "keywords": [
6
6
  "compiler",
@@ -45,9 +45,9 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@cadence-app/bridge": "0.2.0",
48
+ "@cadence-app/bridge": "0.3.0",
49
49
  "@cadence-app/core": "0.1.0",
50
- "@cadence-app/router": "0.4.0",
50
+ "@cadence-app/router": "0.5.0",
51
51
  "@cadence-app/runtime": "0.3.0",
52
52
  "@cadence-app/theme": "0.3.0",
53
53
  "esbuild": "^0.25.0",