@open-pioneer/runtime 4.9.0-dev.20261002130116 → 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 +179 -178
- package/package.json +8 -8
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,11 +9,12 @@
|
|
|
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
|
+
- 42ca366: Update dependencies
|
|
17
18
|
- 7053566: An `undefined` value returned from `resolveConfig()` (for example `locale`) no longer overrides the default value of `config`.
|
|
18
19
|
|
|
19
20
|
## 4.8.0
|
|
@@ -35,12 +36,12 @@
|
|
|
35
36
|
- e433296: Update Chakra UI to 3.36.1
|
|
36
37
|
- 278515d: Add `runtime.LocaleService` and opt-in reactive locale switching.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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.
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
Also export `parseLocale` and `tryParseLocale` algorithms.
|
|
44
|
+
These can be used to construct a (cleaned up) `Intl.Locale` object from a string.
|
|
44
45
|
|
|
45
46
|
### Patch Changes
|
|
46
47
|
|
|
@@ -59,15 +60,15 @@
|
|
|
59
60
|
- 05425c6: runtime - Introduce support for ServiceFactories, to provide constructor indirection during service creation
|
|
60
61
|
- 63db133: Support for hot reloading of i18n messages (requires updated vite plugin).
|
|
61
62
|
When i18n messages are updated:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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.
|
|
65
66
|
|
|
66
67
|
### Patch Changes
|
|
67
68
|
|
|
68
69
|
- e6db101: Update to Chakra UI 3.35.0
|
|
69
|
-
|
|
70
|
-
|
|
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)
|
|
71
72
|
|
|
72
73
|
- b092b75: Declare css property `color-scheme` on the application root. This can be used by the browser to render builtin controls differently.
|
|
73
74
|
|
|
@@ -76,9 +77,9 @@
|
|
|
76
77
|
### Minor Changes
|
|
77
78
|
|
|
78
79
|
- 89d743b: Provide `runtime.ThemeService`:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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.
|
|
82
83
|
|
|
83
84
|
- 89d743b: Support for color modes (light and dark).
|
|
84
85
|
The default color mode remains `light` for backwards compatibility.
|
|
@@ -127,7 +128,7 @@
|
|
|
127
128
|
|
|
128
129
|
- b7a854d: Update dependencies
|
|
129
130
|
- 3881d08: - Update Chakra UI from 3.22.0 to 3.24.2
|
|
130
|
-
|
|
131
|
+
- Update to latest Chakra snippets
|
|
131
132
|
- adf277b: Update dependencies
|
|
132
133
|
|
|
133
134
|
## 4.0.0
|
|
@@ -137,41 +138,41 @@
|
|
|
137
138
|
- 9f074d8: Update to Chakra 3.x
|
|
138
139
|
- 53c92ba: Introduce an advanced option to disable the shadow root.
|
|
139
140
|
|
|
140
|
-
|
|
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.
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
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`:
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const element = createCustomElement({
|
|
151
|
-
component: AppUI,
|
|
152
|
-
appMetadata,
|
|
153
|
-
advanced: {
|
|
154
|
-
enableShadowRoot: false,
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
customElements.define("no-shadowroot-sample", element);
|
|
159
|
-
```
|
|
146
|
+
```ts
|
|
147
|
+
import { createCustomElement } from "@open-pioneer/runtime";
|
|
148
|
+
import * as appMetadata from "open-pioneer:app";
|
|
149
|
+
import { AppUI } from "./AppUI";
|
|
160
150
|
|
|
161
|
-
|
|
151
|
+
const element = createCustomElement({
|
|
152
|
+
component: AppUI,
|
|
153
|
+
appMetadata,
|
|
154
|
+
advanced: {
|
|
155
|
+
enableShadowRoot: false
|
|
156
|
+
}
|
|
157
|
+
});
|
|
162
158
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const shadowRoot = ctx.getShadowRoot(); // ShadowRoot | undefined
|
|
166
|
-
```
|
|
159
|
+
customElements.define("no-shadowroot-sample", element);
|
|
160
|
+
```
|
|
167
161
|
|
|
168
|
-
|
|
162
|
+
- **Breaking:** As a consequence, the `ApplicationContext`'s `getShadowRoot()` method will now return `undefined` if the shadow root is disabled (previous: always a `ShadowRoot`):
|
|
169
163
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
+
```
|
|
175
176
|
|
|
176
177
|
- 9f074d8: **Breaking:** Rename `theme` option of `createCustomElement()` to `chakraSystemConfig`.
|
|
177
178
|
|
|
@@ -187,54 +188,54 @@
|
|
|
187
188
|
In addition to primitive values, rich text formatting supports react values and custom react tags.
|
|
188
189
|
It always returns a react node, so can only be used in combination with react components.
|
|
189
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
|
-
|
|
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).
|
|
238
239
|
|
|
239
240
|
### Patch Changes
|
|
240
241
|
|
|
@@ -245,13 +246,13 @@
|
|
|
245
246
|
### Major Changes
|
|
246
247
|
|
|
247
248
|
- 9477e54: Update dependencies
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
- React 19
|
|
250
|
+
- Vite 6
|
|
251
|
+
- FormatJS 3
|
|
252
|
+
- Open Pioneer Build Tools
|
|
253
|
+
- ...
|
|
253
254
|
|
|
254
|
-
|
|
255
|
+
For more details, see https://github.com/open-pioneer/trails-core-packages/pull/81
|
|
255
256
|
|
|
256
257
|
## 2.4.0
|
|
257
258
|
|
|
@@ -292,7 +293,7 @@
|
|
|
292
293
|
### Patch Changes
|
|
293
294
|
|
|
294
295
|
- e945264: Improve error message when metadata is missing (#55)
|
|
295
|
-
|
|
296
|
+
- @open-pioneer/runtime-react-support@1.0.2
|
|
296
297
|
|
|
297
298
|
## 2.1.5
|
|
298
299
|
|
|
@@ -303,16 +304,16 @@
|
|
|
303
304
|
Note that with the current implementation, the application will simply restart with the new locale.
|
|
304
305
|
The application's state will be lost.
|
|
305
306
|
|
|
306
|
-
|
|
307
|
+
Example:
|
|
307
308
|
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
```ts
|
|
310
|
+
import { ApplicationContext } from "@open-pioneer/runtime";
|
|
310
311
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
const appCtx: ApplicationContext = ...; // injected
|
|
313
|
+
appCtx.setLocale("en-US");
|
|
314
|
+
```
|
|
314
315
|
|
|
315
|
-
|
|
316
|
+
- @open-pioneer/runtime-react-support@1.0.2
|
|
316
317
|
|
|
317
318
|
## 2.1.4
|
|
318
319
|
|
|
@@ -334,7 +335,7 @@
|
|
|
334
335
|
### Patch Changes
|
|
335
336
|
|
|
336
337
|
- f749d96: Add a hint that `DECLARE_SERVICE_INTERFACE` should be imported via `import type`.
|
|
337
|
-
|
|
338
|
+
- @open-pioneer/runtime-react-support@1.0.0
|
|
338
339
|
|
|
339
340
|
## 2.1.0
|
|
340
341
|
|
|
@@ -342,46 +343,46 @@
|
|
|
342
343
|
|
|
343
344
|
- 80cd62d: Improve TypeScript integration for service classes.
|
|
344
345
|
|
|
345
|
-
|
|
346
|
-
|
|
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:
|
|
347
348
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// In an implementation file, usually private.
|
|
355
|
-
class MyServiceImpl implements MyService {
|
|
356
|
-
method(): void {
|
|
357
|
-
// ...
|
|
349
|
+
```ts
|
|
350
|
+
// Exported from package
|
|
351
|
+
interface MyService extends DeclaredService<"my-package.SomeInterface"> {
|
|
352
|
+
method(): void;
|
|
358
353
|
}
|
|
359
|
-
}
|
|
360
|
-
```
|
|
361
354
|
|
|
362
|
-
|
|
363
|
-
|
|
355
|
+
// In an implementation file, usually private.
|
|
356
|
+
class MyServiceImpl implements MyService {
|
|
357
|
+
method(): void {
|
|
358
|
+
// ...
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
364
362
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
class MyServiceImpl implements DeclaredService<"my-package.InterfaceName"> {
|
|
368
|
-
method() {}
|
|
369
|
-
}
|
|
370
|
-
```
|
|
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:
|
|
371
365
|
|
|
372
|
-
|
|
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
|
+
```
|
|
373
372
|
|
|
374
|
-
|
|
375
|
-
class MyServiceImpl {
|
|
376
|
-
// Tells TypeScript which interface name must be used.
|
|
377
|
-
// See documentation of `DECLARE_SERVICE_INTERFACE` for more details.
|
|
378
|
-
declare [DECLARE_SERVICE_INTERFACE]: "my-package.InterfaceName";
|
|
373
|
+
From now on, you can write this instead:
|
|
379
374
|
|
|
380
|
-
|
|
381
|
-
|
|
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
|
+
}
|
|
382
384
|
}
|
|
383
|
-
|
|
384
|
-
```
|
|
385
|
+
```
|
|
385
386
|
|
|
386
387
|
### Patch Changes
|
|
387
388
|
|
|
@@ -401,51 +402,51 @@
|
|
|
401
402
|
- 6f954e3: **Breaking Change**: change how services integrate into TypeScript (fixes #22).
|
|
402
403
|
The old TypeScript integration had unexpected edge cases, see the linked issue.
|
|
403
404
|
|
|
404
|
-
|
|
405
|
-
|
|
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:
|
|
406
407
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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
|
+
```
|
|
416
417
|
|
|
417
|
-
|
|
418
|
-
|
|
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`).
|
|
419
420
|
|
|
420
|
-
|
|
421
|
-
|
|
421
|
+
```diff
|
|
422
|
+
+ import { DeclaredService } from "@open-pioneer/runtime";
|
|
422
423
|
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
- export interface HttpService {
|
|
425
|
+
+ export interface HttpService extends DeclaredService<"http.HttpService"> {
|
|
425
426
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
427
|
+
- import "@open-pioneer/runtime";
|
|
428
|
+
- declare module "@open-pioneer/runtime" {
|
|
429
|
+
- interface ServiceRegistry {
|
|
430
|
+
- "http.HttpService": HttpService;
|
|
431
|
+
- }
|
|
432
|
+
- }
|
|
433
|
+
```
|
|
433
434
|
|
|
434
|
-
|
|
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`:
|
|
435
436
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
437
|
+
```diff
|
|
438
|
+
+ import { HttpService } from "@open-pioneer/http";
|
|
439
|
+
- const httpService = useService("http.HttpService");
|
|
440
|
+
+ const httpService = useService<HttpService>("http.HttpService");
|
|
441
|
+
```
|
|
441
442
|
|
|
442
|
-
|
|
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.
|
|
443
444
|
|
|
444
|
-
|
|
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.
|
|
445
446
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
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.
|
|
449
450
|
|
|
450
451
|
### Patch Changes
|
|
451
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"
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@chakra-ui/react": "^3.37.0",
|
|
18
|
-
"@conterra/reactivity-core": "^0.8.
|
|
18
|
+
"@conterra/reactivity-core": "^0.8.9",
|
|
19
19
|
"@emotion/cache": "^11.14.0",
|
|
20
20
|
"@emotion/react": "^11.14.0",
|
|
21
|
-
"@formatjs/intl": "^6.1.
|
|
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
|
|
26
|
-
"react": "^19.3.
|
|
27
|
-
"react-dom": "^19.3.
|
|
23
|
+
"@open-pioneer/base-theme": "4.9.0",
|
|
24
|
+
"@open-pioneer/core": "4.9.0",
|
|
25
|
+
"@open-pioneer/reactivity": "4.9.0",
|
|
26
|
+
"react": "^19.3.1",
|
|
27
|
+
"react-dom": "^19.3.1"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"directory": "dist",
|