@open-pioneer/runtime 4.9.0-dev.20261029090037 → 4.9.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/CHANGELOG.md +178 -178
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @open-pioneer/runtime
|
|
2
2
|
|
|
3
|
-
## 4.9.0
|
|
3
|
+
## 4.9.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
11
|
- 6b160f3: Fix a set of smaller issues:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
- `element.when()` rejects with an abort error when the app failed to start, also when it is called after the failure. Previously such a call returned a promise that never settled.
|
|
13
|
+
- The deprecated `ApplicationContext.setLocale()` throws `runtime:unsupported-locale` again for a string that is not a valid BCP 47 tag, instead of silently switching to automatic locale selection.
|
|
14
|
+
- `useService()` no longer repeats the service lookup on every render when an options object is passed inline.
|
|
15
|
+
- The development-only intl watch of a service is released when the service constructor throws, and the `AppIntl` instance is released when the app is destroyed during startup.
|
|
16
16
|
|
|
17
17
|
- 42ca366: Update dependencies
|
|
18
18
|
- 7053566: An `undefined` value returned from `resolveConfig()` (for example `locale`) no longer overrides the default value of `config`.
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
- e433296: Update Chakra UI to 3.36.1
|
|
37
37
|
- 278515d: Add `runtime.LocaleService` and opt-in reactive locale switching.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
You can opt-in by configuring the property `advanced.enableLiveLocaleChanges` when calling `createCustomElement`.
|
|
40
|
+
Once enabled, locale switches can be done without restarting the application.
|
|
41
|
+
Use `LocaleService.changeLocale` to update the application's locale.
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
Also export `parseLocale` and `tryParseLocale` algorithms.
|
|
44
|
+
These can be used to construct a (cleaned up) `Intl.Locale` object from a string.
|
|
45
45
|
|
|
46
46
|
### Patch Changes
|
|
47
47
|
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
- 05425c6: runtime - Introduce support for ServiceFactories, to provide constructor indirection during service creation
|
|
61
61
|
- 63db133: Support for hot reloading of i18n messages (requires updated vite plugin).
|
|
62
62
|
When i18n messages are updated:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
- React components rerender automatically with new `intl` object returned by `useIntl()`.
|
|
64
|
+
- Services that use the new `serviceOptions.currentIntl` interface also receive a new `intl` object (if they are watching for changes).
|
|
65
|
+
- Services that that still use the deprecated `serviceOptions.intl` interface cause the application to reload instead.
|
|
66
66
|
|
|
67
67
|
### Patch Changes
|
|
68
68
|
|
|
69
69
|
- e6db101: Update to Chakra UI 3.35.0
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
- update to Chakra UI @ 3.35.0, Ark UI @ 5.36.2, Zag JS @ 1.40.0
|
|
71
|
+
- use TooltipProviderProps to override `openDelay` globally (instead of Tooltip snippet)
|
|
72
72
|
|
|
73
73
|
- b092b75: Declare css property `color-scheme` on the application root. This can be used by the browser to render builtin controls differently.
|
|
74
74
|
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
### Minor Changes
|
|
78
78
|
|
|
79
79
|
- 89d743b: Provide `runtime.ThemeService`:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
- Supports switching between color modes `light` and `dark`.
|
|
81
|
+
- Supports changing the chakra theme ("systemConfig") at runtime.
|
|
82
|
+
- Supports reactive access to the preferred (system) color mode.
|
|
83
83
|
|
|
84
84
|
- 89d743b: Support for color modes (light and dark).
|
|
85
85
|
The default color mode remains `light` for backwards compatibility.
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
|
|
129
129
|
- b7a854d: Update dependencies
|
|
130
130
|
- 3881d08: - Update Chakra UI from 3.22.0 to 3.24.2
|
|
131
|
-
|
|
131
|
+
- Update to latest Chakra snippets
|
|
132
132
|
- adf277b: Update dependencies
|
|
133
133
|
|
|
134
134
|
## 4.0.0
|
|
@@ -138,41 +138,41 @@
|
|
|
138
138
|
- 9f074d8: Update to Chakra 3.x
|
|
139
139
|
- 53c92ba: Introduce an advanced option to disable the shadow root.
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
By default, trails applications use a shadow root to avoid conflicts (e.g. styles) with other parts of the site where the application may be embedded.
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
Applications that use the entire browser viewport may not need this feature, since there may be no "other" parts that may conflict with the app. In this case, you can disable the shadow root by setting this property to `false`.
|
|
144
|
+
- New option `advanced.enableShadowRoot`:
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const element = createCustomElement({
|
|
152
|
-
component: AppUI,
|
|
153
|
-
appMetadata,
|
|
154
|
-
advanced: {
|
|
155
|
-
enableShadowRoot: false,
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
customElements.define("no-shadowroot-sample", element);
|
|
160
|
-
```
|
|
146
|
+
```ts
|
|
147
|
+
import { createCustomElement } from "@open-pioneer/runtime";
|
|
148
|
+
import * as appMetadata from "open-pioneer:app";
|
|
149
|
+
import { AppUI } from "./AppUI";
|
|
161
150
|
|
|
162
|
-
|
|
151
|
+
const element = createCustomElement({
|
|
152
|
+
component: AppUI,
|
|
153
|
+
appMetadata,
|
|
154
|
+
advanced: {
|
|
155
|
+
enableShadowRoot: false
|
|
156
|
+
}
|
|
157
|
+
});
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const shadowRoot = ctx.getShadowRoot(); // ShadowRoot | undefined
|
|
167
|
-
```
|
|
159
|
+
customElements.define("no-shadowroot-sample", element);
|
|
160
|
+
```
|
|
168
161
|
|
|
169
|
-
|
|
162
|
+
- **Breaking:** As a consequence, the `ApplicationContext`'s `getShadowRoot()` method will now return `undefined` if the shadow root is disabled (previous: always a `ShadowRoot`):
|
|
170
163
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
```ts
|
|
165
|
+
const ctx: ApplicationContext = ...; // injected
|
|
166
|
+
const shadowRoot = ctx.getShadowRoot(); // ShadowRoot | undefined
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
- New method on the `ApplicationContext` that returns _either_ the `ShadowRoot` _or_ the `Document` (if the shadow root is disabled):
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
const ctx: ApplicationContext = ...; // injected
|
|
173
|
+
const root = ctx.getRoot(); // Document | ShadowRoot
|
|
174
|
+
root.getElementById("...") // always works
|
|
175
|
+
```
|
|
176
176
|
|
|
177
177
|
- 9f074d8: **Breaking:** Rename `theme` option of `createCustomElement()` to `chakraSystemConfig`.
|
|
178
178
|
|
|
@@ -188,54 +188,54 @@
|
|
|
188
188
|
In addition to primitive values, rich text formatting supports react values and custom react tags.
|
|
189
189
|
It always returns a react node, so can only be used in combination with react components.
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
191
|
+
_Example with react node as value:_
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
function Example() {
|
|
195
|
+
const intl = useIntl();
|
|
196
|
+
// Given i18n message "Hello, {name}!"
|
|
197
|
+
// replaces 'name' with the given react node:
|
|
198
|
+
const message = intl.formatRichMessage(
|
|
199
|
+
{ id: "foo" },
|
|
200
|
+
{
|
|
201
|
+
name: <FancyUserName />
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
return <Box>{message}</Box>;
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
_Example with basic formatting:_
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
function Example() {
|
|
212
|
+
const intl = useIntl();
|
|
213
|
+
// Given i18n message "Hello, <strong>{name}</strong>!"
|
|
214
|
+
// renders with actual <strong> html node:
|
|
215
|
+
return <Box>{intl.formatRichMessage({ id: "foo" }, { name: "User" })}</Box>;
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Note that only a few basic formatting tags are predefined ("b", "strong", "i", "em", "code", "br").
|
|
220
|
+
If you need more advanced tags, you can define your own, see below.
|
|
221
|
+
_Example with custom tag:_
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
function Example() {
|
|
225
|
+
const intl = useIntl();
|
|
226
|
+
// Given i18n message "Open <foo>the door</foo>!",
|
|
227
|
+
// renders 'foo' using the formatter function below:
|
|
228
|
+
const message = intl.formatRichMessage(
|
|
229
|
+
{ id: "foo" },
|
|
230
|
+
{
|
|
231
|
+
foo: (parts) => <FancyTag>{parts}</FancyTag>
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
return <Box>{message}</Box>;
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The TypeScript signature for the `intl.formatMessage()` function has been made a little bit stricter compared with FormatJS: only primitive values are allowed for the `values` argument (this should not affect users in practice).
|
|
239
239
|
|
|
240
240
|
### Patch Changes
|
|
241
241
|
|
|
@@ -246,13 +246,13 @@
|
|
|
246
246
|
### Major Changes
|
|
247
247
|
|
|
248
248
|
- 9477e54: Update dependencies
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
- React 19
|
|
250
|
+
- Vite 6
|
|
251
|
+
- FormatJS 3
|
|
252
|
+
- Open Pioneer Build Tools
|
|
253
|
+
- ...
|
|
254
254
|
|
|
255
|
-
|
|
255
|
+
For more details, see https://github.com/open-pioneer/trails-core-packages/pull/81
|
|
256
256
|
|
|
257
257
|
## 2.4.0
|
|
258
258
|
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
### Patch Changes
|
|
294
294
|
|
|
295
295
|
- e945264: Improve error message when metadata is missing (#55)
|
|
296
|
-
|
|
296
|
+
- @open-pioneer/runtime-react-support@1.0.2
|
|
297
297
|
|
|
298
298
|
## 2.1.5
|
|
299
299
|
|
|
@@ -304,16 +304,16 @@
|
|
|
304
304
|
Note that with the current implementation, the application will simply restart with the new locale.
|
|
305
305
|
The application's state will be lost.
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
Example:
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
```ts
|
|
310
|
+
import { ApplicationContext } from "@open-pioneer/runtime";
|
|
311
311
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
const appCtx: ApplicationContext = ...; // injected
|
|
313
|
+
appCtx.setLocale("en-US");
|
|
314
|
+
```
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
- @open-pioneer/runtime-react-support@1.0.2
|
|
317
317
|
|
|
318
318
|
## 2.1.4
|
|
319
319
|
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
### Patch Changes
|
|
336
336
|
|
|
337
337
|
- f749d96: Add a hint that `DECLARE_SERVICE_INTERFACE` should be imported via `import type`.
|
|
338
|
-
|
|
338
|
+
- @open-pioneer/runtime-react-support@1.0.0
|
|
339
339
|
|
|
340
340
|
## 2.1.0
|
|
341
341
|
|
|
@@ -343,46 +343,46 @@
|
|
|
343
343
|
|
|
344
344
|
- 80cd62d: Improve TypeScript integration for service classes.
|
|
345
345
|
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
Add a way for a service class to specify its interface name directly.
|
|
347
|
+
Usually services used across package boundaries split their public interface and their implementation such as this:
|
|
348
348
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// In an implementation file, usually private.
|
|
356
|
-
class MyServiceImpl implements MyService {
|
|
357
|
-
method(): void {
|
|
358
|
-
// ...
|
|
349
|
+
```ts
|
|
350
|
+
// Exported from package
|
|
351
|
+
interface MyService extends DeclaredService<"my-package.SomeInterface"> {
|
|
352
|
+
method(): void;
|
|
359
353
|
}
|
|
360
|
-
}
|
|
361
|
-
```
|
|
362
354
|
|
|
363
|
-
|
|
364
|
-
|
|
355
|
+
// In an implementation file, usually private.
|
|
356
|
+
class MyServiceImpl implements MyService {
|
|
357
|
+
method(): void {
|
|
358
|
+
// ...
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
365
362
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
class MyServiceImpl implements DeclaredService<"my-package.InterfaceName"> {
|
|
369
|
-
method() {}
|
|
370
|
-
}
|
|
371
|
-
```
|
|
363
|
+
Until now, there was no way for a service class to declare its interface directly.
|
|
364
|
+
This could be convenient within a package, or with a group of tightly coupled packages:
|
|
372
365
|
|
|
373
|
-
|
|
366
|
+
```ts
|
|
367
|
+
// Error: Type 'MyServiceImpl' has no properties in common with type 'DeclaredService<"my-package.InterfaceName">'.
|
|
368
|
+
class MyServiceImpl implements DeclaredService<"my-package.InterfaceName"> {
|
|
369
|
+
method() {}
|
|
370
|
+
}
|
|
371
|
+
```
|
|
374
372
|
|
|
375
|
-
|
|
376
|
-
class MyServiceImpl {
|
|
377
|
-
// Tells TypeScript which interface name must be used.
|
|
378
|
-
// See documentation of `DECLARE_SERVICE_INTERFACE` for more details.
|
|
379
|
-
declare [DECLARE_SERVICE_INTERFACE]: "my-package.InterfaceName";
|
|
373
|
+
From now on, you can write this instead:
|
|
380
374
|
|
|
381
|
-
|
|
382
|
-
|
|
375
|
+
```ts
|
|
376
|
+
class MyServiceImpl {
|
|
377
|
+
// Tells TypeScript which interface name must be used.
|
|
378
|
+
// See documentation of `DECLARE_SERVICE_INTERFACE` for more details.
|
|
379
|
+
declare [DECLARE_SERVICE_INTERFACE]: "my-package.InterfaceName";
|
|
380
|
+
|
|
381
|
+
method(): void {
|
|
382
|
+
// ...
|
|
383
|
+
}
|
|
383
384
|
}
|
|
384
|
-
|
|
385
|
-
```
|
|
385
|
+
```
|
|
386
386
|
|
|
387
387
|
### Patch Changes
|
|
388
388
|
|
|
@@ -402,51 +402,51 @@
|
|
|
402
402
|
- 6f954e3: **Breaking Change**: change how services integrate into TypeScript (fixes #22).
|
|
403
403
|
The old TypeScript integration had unexpected edge cases, see the linked issue.
|
|
404
404
|
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
NOTE: The changes below have no impact on runtime behavior, but they may trigger TypeScript errors in your code.
|
|
406
|
+
- To register a service's type with TypeScript, one previously used a block such as this:
|
|
407
407
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
408
|
+
```ts
|
|
409
|
+
// OLD! Can be removed
|
|
410
|
+
import "@open-pioneer/runtime";
|
|
411
|
+
declare module "@open-pioneer/runtime" {
|
|
412
|
+
interface ServiceRegistry {
|
|
413
|
+
"http.HttpService": HttpService;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
417
|
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
The new method requires the developer to change the service's declaration.
|
|
419
|
+
Simply add `extends DeclaredService<"SERVICE_ID">` to your service interface, where `SERVICE_ID` should match the service's interface name (`"provides"` in `build.config.mjs`).
|
|
420
420
|
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
```diff
|
|
422
|
+
+ import { DeclaredService } from "@open-pioneer/runtime";
|
|
423
423
|
|
|
424
|
-
|
|
425
|
-
|
|
424
|
+
- export interface HttpService {
|
|
425
|
+
+ export interface HttpService extends DeclaredService<"http.HttpService"> {
|
|
426
426
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
427
|
+
- import "@open-pioneer/runtime";
|
|
428
|
+
- declare module "@open-pioneer/runtime" {
|
|
429
|
+
- interface ServiceRegistry {
|
|
430
|
+
- "http.HttpService": HttpService;
|
|
431
|
+
- }
|
|
432
|
+
- }
|
|
433
|
+
```
|
|
434
434
|
|
|
435
|
-
|
|
435
|
+
- To use a service from React code (i.e. `useService` and `useServices`), you must now use the explicit service type in the hook's generic parameter list. Otherwise the hook will simply return `unknown`:
|
|
436
436
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
```diff
|
|
438
|
+
+ import { HttpService } from "@open-pioneer/http";
|
|
439
|
+
- const httpService = useService("http.HttpService");
|
|
440
|
+
+ const httpService = useService<HttpService>("http.HttpService");
|
|
441
|
+
```
|
|
442
442
|
|
|
443
|
-
|
|
443
|
+
This change was necessary to fix an issue where the global registration of the service interface (and its association with the string constant) was not available.
|
|
444
444
|
|
|
445
|
-
|
|
445
|
+
The system will still check that the provided string matches the string constant used in the service's declaration (`DeclaredService<...>`), so type safety is preserved.
|
|
446
446
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
- The types `InterfaceName` and `ServiceType<I>` have been removed. Use explicit service interfaces instead.
|
|
448
|
+
- The interfaces `ServiceRegistry` and `PropertiesRegistry` have been removed as global registration is no longer possible.
|
|
449
|
+
- The type `RawApplicationProperties` has been removed. Use `ApplicationProperties` instead.
|
|
450
450
|
|
|
451
451
|
### Patch Changes
|
|
452
452
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/runtime",
|
|
4
|
-
"version": "4.9.0
|
|
4
|
+
"version": "4.9.0",
|
|
5
5
|
"description": "Implements the runtime environment for Open Pioneer Trails apps.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@emotion/react": "^11.14.0",
|
|
21
21
|
"@formatjs/intl": "^6.1.4",
|
|
22
22
|
"@formatjs/intl-localematcher": "^0.9.0",
|
|
23
|
-
"@open-pioneer/base-theme": "4.9.0
|
|
24
|
-
"@open-pioneer/core": "4.9.0
|
|
25
|
-
"@open-pioneer/reactivity": "4.9.0
|
|
23
|
+
"@open-pioneer/base-theme": "4.9.0",
|
|
24
|
+
"@open-pioneer/core": "4.9.0",
|
|
25
|
+
"@open-pioneer/reactivity": "4.9.0",
|
|
26
26
|
"react": "^19.3.1",
|
|
27
27
|
"react-dom": "^19.3.1"
|
|
28
28
|
},
|