@open-pioneer/runtime 4.7.0-dev.20260727091735 → 4.7.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 +175 -175
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @open-pioneer/runtime
|
|
2
2
|
|
|
3
|
-
## 4.7.0
|
|
3
|
+
## 4.7.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
- e433296: Update Chakra UI to 3.36.1
|
|
10
10
|
- 278515d: Add `runtime.LocaleService` and opt-in reactive locale switching.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
You can opt-in by configuring the property `advanced.enableLiveLocaleChanges` when calling `createCustomElement`.
|
|
13
|
+
Once enabled, locale switches can be done without restarting the application.
|
|
14
|
+
Use `LocaleService.changeLocale` to update the application's locale.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Also export `parseLocale` and `tryParseLocale` algorithms.
|
|
17
|
+
These can be used to construct a (cleaned up) `Intl.Locale` object from a string.
|
|
18
18
|
|
|
19
19
|
### Patch Changes
|
|
20
20
|
|
|
21
21
|
- 8c277a2: Include service id in deprecation message of 'serviceOptions.intl'.
|
|
22
|
-
- 9d84f1e: Migrated from eslint to oxlint.
|
|
22
|
+
- 9d84f1e: Migrated from eslint to oxlint and from prettier to oxfmt.
|
|
23
23
|
- 78aad9d: Refactor: use private javascript properties instead of typescript private keyword.
|
|
24
24
|
- 7c7e6d1: Refactor equality comparisons using shallow equals from @open-pioneer/core.
|
|
25
25
|
- 8b5c324: Fix 'useIntl' not transporting reactive changes of the intl object in production (e.g. when the locale changes).
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
- 05425c6: runtime - Introduce support for ServiceFactories, to provide constructor indirection during service creation
|
|
34
34
|
- 63db133: Support for hot reloading of i18n messages (requires updated vite plugin).
|
|
35
35
|
When i18n messages are updated:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
- React components rerender automatically with new `intl` object returned by `useIntl()`.
|
|
37
|
+
- Services that use the new `serviceOptions.currentIntl` interface also receive a new `intl` object (if they are watching for changes).
|
|
38
|
+
- Services that that still use the deprecated `serviceOptions.intl` interface cause the application to reload instead.
|
|
39
39
|
|
|
40
40
|
### Patch Changes
|
|
41
41
|
|
|
42
42
|
- e6db101: Update to Chakra UI 3.35.0
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
- update to Chakra UI @ 3.35.0, Ark UI @ 5.36.2, Zag JS @ 1.40.0
|
|
44
|
+
- use TooltipProviderProps to override `openDelay` globally (instead of Tooltip snippet)
|
|
45
45
|
|
|
46
46
|
- b092b75: Declare css property `color-scheme` on the application root. This can be used by the browser to render builtin controls differently.
|
|
47
47
|
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
### Minor Changes
|
|
51
51
|
|
|
52
52
|
- 89d743b: Provide `runtime.ThemeService`:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
- Supports switching between color modes `light` and `dark`.
|
|
54
|
+
- Supports changing the chakra theme ("systemConfig") at runtime.
|
|
55
|
+
- Supports reactive access to the preferred (system) color mode.
|
|
56
56
|
|
|
57
57
|
- 89d743b: Support for color modes (light and dark).
|
|
58
58
|
The default color mode remains `light` for backwards compatibility.
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
|
|
102
102
|
- b7a854d: Update dependencies
|
|
103
103
|
- 3881d08: - Update Chakra UI from 3.22.0 to 3.24.2
|
|
104
|
-
|
|
104
|
+
- Update to latest Chakra snippets
|
|
105
105
|
- adf277b: Update dependencies
|
|
106
106
|
|
|
107
107
|
## 4.0.0
|
|
@@ -111,41 +111,41 @@
|
|
|
111
111
|
- 9f074d8: Update to Chakra 3.x
|
|
112
112
|
- 53c92ba: Introduce an advanced option to disable the shadow root.
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
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.
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
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`.
|
|
117
|
+
- New option `advanced.enableShadowRoot`:
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const element = createCustomElement({
|
|
125
|
-
component: AppUI,
|
|
126
|
-
appMetadata,
|
|
127
|
-
advanced: {
|
|
128
|
-
enableShadowRoot: false,
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
customElements.define("no-shadowroot-sample", element);
|
|
133
|
-
```
|
|
119
|
+
```ts
|
|
120
|
+
import { createCustomElement } from "@open-pioneer/runtime";
|
|
121
|
+
import * as appMetadata from "open-pioneer:app";
|
|
122
|
+
import { AppUI } from "./AppUI";
|
|
134
123
|
|
|
135
|
-
|
|
124
|
+
const element = createCustomElement({
|
|
125
|
+
component: AppUI,
|
|
126
|
+
appMetadata,
|
|
127
|
+
advanced: {
|
|
128
|
+
enableShadowRoot: false
|
|
129
|
+
}
|
|
130
|
+
});
|
|
136
131
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const shadowRoot = ctx.getShadowRoot(); // ShadowRoot | undefined
|
|
140
|
-
```
|
|
132
|
+
customElements.define("no-shadowroot-sample", element);
|
|
133
|
+
```
|
|
141
134
|
|
|
142
|
-
|
|
135
|
+
- **Breaking:** As a consequence, the `ApplicationContext`'s `getShadowRoot()` method will now return `undefined` if the shadow root is disabled (previous: always a `ShadowRoot`):
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
```ts
|
|
138
|
+
const ctx: ApplicationContext = ...; // injected
|
|
139
|
+
const shadowRoot = ctx.getShadowRoot(); // ShadowRoot | undefined
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- New method on the `ApplicationContext` that returns _either_ the `ShadowRoot` _or_ the `Document` (if the shadow root is disabled):
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
const ctx: ApplicationContext = ...; // injected
|
|
146
|
+
const root = ctx.getRoot(); // Document | ShadowRoot
|
|
147
|
+
root.getElementById("...") // always works
|
|
148
|
+
```
|
|
149
149
|
|
|
150
150
|
- 9f074d8: **Breaking:** Rename `theme` option of `createCustomElement()` to `chakraSystemConfig`.
|
|
151
151
|
|
|
@@ -161,54 +161,54 @@
|
|
|
161
161
|
In addition to primitive values, rich text formatting supports react values and custom react tags.
|
|
162
162
|
It always returns a react node, so can only be used in combination with react components.
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
164
|
+
_Example with react node as value:_
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
function Example() {
|
|
168
|
+
const intl = useIntl();
|
|
169
|
+
// Given i18n message "Hello, {name}!"
|
|
170
|
+
// replaces 'name' with the given react node:
|
|
171
|
+
const message = intl.formatRichMessage(
|
|
172
|
+
{ id: "foo" },
|
|
173
|
+
{
|
|
174
|
+
name: <FancyUserName />
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
return <Box>{message}</Box>;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
_Example with basic formatting:_
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
function Example() {
|
|
185
|
+
const intl = useIntl();
|
|
186
|
+
// Given i18n message "Hello, <strong>{name}</strong>!"
|
|
187
|
+
// renders with actual <strong> html node:
|
|
188
|
+
return <Box>{intl.formatRichMessage({ id: "foo" }, { name: "User" })}</Box>;
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Note that only a few basic formatting tags are predefined ("b", "strong", "i", "em", "code", "br").
|
|
193
|
+
If you need more advanced tags, you can define your own, see below.
|
|
194
|
+
_Example with custom tag:_
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
function Example() {
|
|
198
|
+
const intl = useIntl();
|
|
199
|
+
// Given i18n message "Open <foo>the door</foo>!",
|
|
200
|
+
// renders 'foo' using the formatter function below:
|
|
201
|
+
const message = intl.formatRichMessage(
|
|
202
|
+
{ id: "foo" },
|
|
203
|
+
{
|
|
204
|
+
foo: (parts) => <FancyTag>{parts}</FancyTag>
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
return <Box>{message}</Box>;
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
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).
|
|
212
212
|
|
|
213
213
|
### Patch Changes
|
|
214
214
|
|
|
@@ -219,13 +219,13 @@
|
|
|
219
219
|
### Major Changes
|
|
220
220
|
|
|
221
221
|
- 9477e54: Update dependencies
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
- React 19
|
|
223
|
+
- Vite 6
|
|
224
|
+
- FormatJS 3
|
|
225
|
+
- Open Pioneer Build Tools
|
|
226
|
+
- ...
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
For more details, see https://github.com/open-pioneer/trails-core-packages/pull/81
|
|
229
229
|
|
|
230
230
|
## 2.4.0
|
|
231
231
|
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
### Patch Changes
|
|
267
267
|
|
|
268
268
|
- e945264: Improve error message when metadata is missing (#55)
|
|
269
|
-
|
|
269
|
+
- @open-pioneer/runtime-react-support@1.0.2
|
|
270
270
|
|
|
271
271
|
## 2.1.5
|
|
272
272
|
|
|
@@ -277,16 +277,16 @@
|
|
|
277
277
|
Note that with the current implementation, the application will simply restart with the new locale.
|
|
278
278
|
The application's state will be lost.
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
Example:
|
|
281
281
|
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
```ts
|
|
283
|
+
import { ApplicationContext } from "@open-pioneer/runtime";
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
const appCtx: ApplicationContext = ...; // injected
|
|
286
|
+
appCtx.setLocale("en-US");
|
|
287
|
+
```
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
- @open-pioneer/runtime-react-support@1.0.2
|
|
290
290
|
|
|
291
291
|
## 2.1.4
|
|
292
292
|
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
### Patch Changes
|
|
309
309
|
|
|
310
310
|
- f749d96: Add a hint that `DECLARE_SERVICE_INTERFACE` should be imported via `import type`.
|
|
311
|
-
|
|
311
|
+
- @open-pioneer/runtime-react-support@1.0.0
|
|
312
312
|
|
|
313
313
|
## 2.1.0
|
|
314
314
|
|
|
@@ -316,46 +316,46 @@
|
|
|
316
316
|
|
|
317
317
|
- 80cd62d: Improve TypeScript integration for service classes.
|
|
318
318
|
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
Add a way for a service class to specify its interface name directly.
|
|
320
|
+
Usually services used across package boundaries split their public interface and their implementation such as this:
|
|
321
321
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// In an implementation file, usually private.
|
|
329
|
-
class MyServiceImpl implements MyService {
|
|
330
|
-
method(): void {
|
|
331
|
-
// ...
|
|
322
|
+
```ts
|
|
323
|
+
// Exported from package
|
|
324
|
+
interface MyService extends DeclaredService<"my-package.SomeInterface"> {
|
|
325
|
+
method(): void;
|
|
332
326
|
}
|
|
333
|
-
}
|
|
334
|
-
```
|
|
335
327
|
|
|
336
|
-
|
|
337
|
-
|
|
328
|
+
// In an implementation file, usually private.
|
|
329
|
+
class MyServiceImpl implements MyService {
|
|
330
|
+
method(): void {
|
|
331
|
+
// ...
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
338
335
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
class MyServiceImpl implements DeclaredService<"my-package.InterfaceName"> {
|
|
342
|
-
method() {}
|
|
343
|
-
}
|
|
344
|
-
```
|
|
336
|
+
Until now, there was no way for a service class to declare its interface directly.
|
|
337
|
+
This could be convenient within a package, or with a group of tightly coupled packages:
|
|
345
338
|
|
|
346
|
-
|
|
339
|
+
```ts
|
|
340
|
+
// Error: Type 'MyServiceImpl' has no properties in common with type 'DeclaredService<"my-package.InterfaceName">'.
|
|
341
|
+
class MyServiceImpl implements DeclaredService<"my-package.InterfaceName"> {
|
|
342
|
+
method() {}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
347
345
|
|
|
348
|
-
|
|
349
|
-
class MyServiceImpl {
|
|
350
|
-
// Tells TypeScript which interface name must be used.
|
|
351
|
-
// See documentation of `DECLARE_SERVICE_INTERFACE` for more details.
|
|
352
|
-
declare [DECLARE_SERVICE_INTERFACE]: "my-package.InterfaceName";
|
|
346
|
+
From now on, you can write this instead:
|
|
353
347
|
|
|
354
|
-
|
|
355
|
-
|
|
348
|
+
```ts
|
|
349
|
+
class MyServiceImpl {
|
|
350
|
+
// Tells TypeScript which interface name must be used.
|
|
351
|
+
// See documentation of `DECLARE_SERVICE_INTERFACE` for more details.
|
|
352
|
+
declare [DECLARE_SERVICE_INTERFACE]: "my-package.InterfaceName";
|
|
353
|
+
|
|
354
|
+
method(): void {
|
|
355
|
+
// ...
|
|
356
|
+
}
|
|
356
357
|
}
|
|
357
|
-
|
|
358
|
-
```
|
|
358
|
+
```
|
|
359
359
|
|
|
360
360
|
### Patch Changes
|
|
361
361
|
|
|
@@ -375,51 +375,51 @@
|
|
|
375
375
|
- 6f954e3: **Breaking Change**: change how services integrate into TypeScript (fixes #22).
|
|
376
376
|
The old TypeScript integration had unexpected edge cases, see the linked issue.
|
|
377
377
|
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
NOTE: The changes below have no impact on runtime behavior, but they may trigger TypeScript errors in your code.
|
|
379
|
+
- To register a service's type with TypeScript, one previously used a block such as this:
|
|
380
380
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
381
|
+
```ts
|
|
382
|
+
// OLD! Can be removed
|
|
383
|
+
import "@open-pioneer/runtime";
|
|
384
|
+
declare module "@open-pioneer/runtime" {
|
|
385
|
+
interface ServiceRegistry {
|
|
386
|
+
"http.HttpService": HttpService;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
390
|
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
The new method requires the developer to change the service's declaration.
|
|
392
|
+
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`).
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
```diff
|
|
395
|
+
+ import { DeclaredService } from "@open-pioneer/runtime";
|
|
396
396
|
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
- export interface HttpService {
|
|
398
|
+
+ export interface HttpService extends DeclaredService<"http.HttpService"> {
|
|
399
399
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
400
|
+
- import "@open-pioneer/runtime";
|
|
401
|
+
- declare module "@open-pioneer/runtime" {
|
|
402
|
+
- interface ServiceRegistry {
|
|
403
|
+
- "http.HttpService": HttpService;
|
|
404
|
+
- }
|
|
405
|
+
- }
|
|
406
|
+
```
|
|
407
407
|
|
|
408
|
-
|
|
408
|
+
- 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`:
|
|
409
409
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
410
|
+
```diff
|
|
411
|
+
+ import { HttpService } from "@open-pioneer/http";
|
|
412
|
+
- const httpService = useService("http.HttpService");
|
|
413
|
+
+ const httpService = useService<HttpService>("http.HttpService");
|
|
414
|
+
```
|
|
415
415
|
|
|
416
|
-
|
|
416
|
+
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.
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
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.
|
|
419
419
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
420
|
+
- The types `InterfaceName` and `ServiceType<I>` have been removed. Use explicit service interfaces instead.
|
|
421
|
+
- The interfaces `ServiceRegistry` and `PropertiesRegistry` have been removed as global registration is no longer possible.
|
|
422
|
+
- The type `RawApplicationProperties` has been removed. Use `ApplicationProperties` instead.
|
|
423
423
|
|
|
424
424
|
### Patch Changes
|
|
425
425
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/runtime",
|
|
4
|
-
"version": "4.7.0
|
|
4
|
+
"version": "4.7.0",
|
|
5
5
|
"description": "Implements the runtime environment for Open Pioneer Trails apps.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"@formatjs/intl-localematcher": "^0.8.13",
|
|
23
23
|
"react": "^19.2.8",
|
|
24
24
|
"react-dom": "^19.2.8",
|
|
25
|
-
"@open-pioneer/base-theme": "4.7.0
|
|
26
|
-
"@open-pioneer/
|
|
27
|
-
"@open-pioneer/
|
|
25
|
+
"@open-pioneer/base-theme": "4.7.0",
|
|
26
|
+
"@open-pioneer/core": "4.7.0",
|
|
27
|
+
"@open-pioneer/reactivity": "4.7.0"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
"./package.json": "./package.json",
|