@yschimke/livery-a2ui 0.0.0-stage → 0.11.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.
Files changed (149) hide show
  1. package/README.md +194 -2
  2. package/dist/angular.d.ts +32 -0
  3. package/dist/angular.js +51 -0
  4. package/dist/api.d.ts +35 -0
  5. package/dist/api.js +35 -0
  6. package/dist/catalog.d.ts +18 -0
  7. package/dist/catalog.js +55 -0
  8. package/dist/cmp-player.d.ts +3 -0
  9. package/dist/cmp-player.js +125 -0
  10. package/dist/controller.d.ts +61 -0
  11. package/dist/controller.js +330 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.js +4 -0
  14. package/dist/livery-web/livery-livery-web.d.mts +75 -0
  15. package/dist/livery-web/livery-livery-web.import-object.mjs +370 -0
  16. package/dist/livery-web/livery-livery-web.js-builtins.mjs +52 -0
  17. package/dist/livery-web/livery-livery-web.mjs +104 -0
  18. package/dist/livery-web/livery-livery-web.wasm +0 -0
  19. package/dist/livery-web-compose/fonts/NotoSansSymbols2-OFL.txt +117 -0
  20. package/dist/livery-web-compose/fonts/NotoSansSymbols2-Regular.ttf +0 -0
  21. package/dist/livery-web-compose/fonts/README.md +8 -0
  22. package/dist/livery-web-compose/fonts/RobotoFlex-OFL.txt +93 -0
  23. package/dist/livery-web-compose/fonts/RobotoFlex.ttf +0 -0
  24. package/dist/livery-web-compose/livery-livery-web-compose.d.mts +60 -0
  25. package/dist/livery-web-compose/livery-livery-web-compose.import-object.mjs +653 -0
  26. package/dist/livery-web-compose/livery-livery-web-compose.js-builtins.mjs +52 -0
  27. package/dist/livery-web-compose/livery-livery-web-compose.mjs +89 -0
  28. package/dist/livery-web-compose/livery-livery-web-compose.wasm +0 -0
  29. package/dist/livery-web-compose/skiko.mjs +1118 -0
  30. package/dist/livery-web-compose/skiko.wasm +0 -0
  31. package/dist/livery.d.ts +165 -0
  32. package/dist/livery.js +87 -0
  33. package/dist/player.d.ts +2 -0
  34. package/dist/player.js +2 -0
  35. package/dist/react.d.ts +24 -0
  36. package/dist/react.js +36 -0
  37. package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
  38. package/node_modules/@js-joda/core/CheatSheet.md +947 -0
  39. package/node_modules/@js-joda/core/LICENSE +34 -0
  40. package/node_modules/@js-joda/core/README.md +155 -0
  41. package/node_modules/@js-joda/core/bower.json +21 -0
  42. package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
  43. package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
  44. package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
  45. package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
  46. package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
  47. package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
  48. package/node_modules/@js-joda/core/package.json +76 -0
  49. package/node_modules/@js-joda/core/src/Clock.js +330 -0
  50. package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
  51. package/node_modules/@js-joda/core/src/Duration.js +1205 -0
  52. package/node_modules/@js-joda/core/src/Enum.js +30 -0
  53. package/node_modules/@js-joda/core/src/Instant.js +1012 -0
  54. package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
  55. package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
  56. package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
  57. package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
  58. package/node_modules/@js-joda/core/src/Month.js +600 -0
  59. package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
  60. package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
  61. package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
  62. package/node_modules/@js-joda/core/src/Period.js +933 -0
  63. package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
  64. package/node_modules/@js-joda/core/src/Year.js +1015 -0
  65. package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
  66. package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
  67. package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
  68. package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
  69. package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
  70. package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
  71. package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
  72. package/node_modules/@js-joda/core/src/_init.js +68 -0
  73. package/node_modules/@js-joda/core/src/assert.js +33 -0
  74. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
  75. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
  76. package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
  77. package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
  78. package/node_modules/@js-joda/core/src/convert.js +83 -0
  79. package/node_modules/@js-joda/core/src/errors.js +54 -0
  80. package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
  81. package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
  82. package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
  83. package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
  84. package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
  85. package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
  86. package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
  87. package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
  88. package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
  89. package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
  90. package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
  91. package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
  92. package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
  93. package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
  94. package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
  95. package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
  96. package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
  97. package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
  98. package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
  99. package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
  100. package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
  101. package/node_modules/@js-joda/core/src/js-joda.js +210 -0
  102. package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
  103. package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
  104. package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
  105. package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
  106. package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
  107. package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
  108. package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
  109. package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
  110. package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
  111. package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
  112. package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
  113. package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
  114. package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
  115. package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
  116. package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
  117. package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
  118. package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
  119. package/node_modules/@js-joda/core/src/use.js +20 -0
  120. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
  121. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
  122. package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
  123. package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
  124. package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
  125. package/node_modules/@yschimke/livery-web/README.md +112 -0
  126. package/node_modules/@yschimke/livery-web/dist/descriptor.d.ts +24 -0
  127. package/node_modules/@yschimke/livery-web/dist/descriptor.js +32 -0
  128. package/node_modules/@yschimke/livery-web/dist/index.d.ts +9 -0
  129. package/node_modules/@yschimke/livery-web/dist/index.js +5 -0
  130. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.d.mts +63 -0
  131. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.import-object.mjs +333 -0
  132. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.js-builtins.mjs +52 -0
  133. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.mjs +92 -0
  134. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.wasm +0 -0
  135. package/node_modules/@yschimke/livery-web/dist/player.d.ts +65 -0
  136. package/node_modules/@yschimke/livery-web/dist/player.js +117 -0
  137. package/node_modules/@yschimke/livery-web/dist/preview.d.ts +57 -0
  138. package/node_modules/@yschimke/livery-web/dist/preview.js +214 -0
  139. package/node_modules/@yschimke/livery-web/dist/publication.d.ts +7 -0
  140. package/node_modules/@yschimke/livery-web/dist/publication.js +103 -0
  141. package/node_modules/@yschimke/livery-web/dist/session.d.ts +71 -0
  142. package/node_modules/@yschimke/livery-web/dist/session.js +55 -0
  143. package/node_modules/@yschimke/livery-web/dist/viewer.d.ts +1 -0
  144. package/node_modules/@yschimke/livery-web/dist/viewer.js +18 -0
  145. package/node_modules/@yschimke/livery-web/package.json +39 -0
  146. package/node_modules/@yschimke/livery-web/vendor/PROVENANCE.md +18 -0
  147. package/node_modules/@yschimke/livery-web/vendor/remote-compose-player.d.mts +30 -0
  148. package/node_modules/@yschimke/livery-web/vendor/remote-compose-player.mjs +86 -0
  149. package/package.json +102 -4
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Livery's web session: Kotlin's own pipeline (`livery-web`, compiled to Wasm), behind a typed
3
+ * API. Nothing here selects, trusts or binds: it passes JSON across and back.
4
+ */
5
+ export interface LiveryConfig {
6
+ /** The catalog's base URL; `manifest.json` is fetched from beside it. */
7
+ catalog: string;
8
+ /** App-configured HTTPS POST endpoint for contract decisions (§8.3); never supplied by the agent. */
9
+ decisionEndpoint?: string;
10
+ decisionContext?: {
11
+ nowEpochMs?: number;
12
+ platform: string;
13
+ locale: string;
14
+ appVersion: number;
15
+ bucketingId: string;
16
+ segments?: string[];
17
+ };
18
+ /** Trusted Ed25519 keys, the public key as base64 of its raw 32 bytes. */
19
+ keys?: {
20
+ keyId: string;
21
+ publicKey: string;
22
+ contracts?: string[];
23
+ }[];
24
+ /** Accept an unsigned catalog: development only. */
25
+ unsigned?: boolean;
26
+ /** Persist catalog state and blobs in IndexedDB (default true); false uses session memory. */
27
+ persistentCache?: boolean;
28
+ /** Documents an agent sends with a message (`template.inline`): refused unless set. */
29
+ agentBytes?: {
30
+ contracts: string[];
31
+ maxBytes?: number;
32
+ allowedKinds?: string[];
33
+ };
34
+ /** Risky features a signed inline document may use (`shaders`, …). */
35
+ signedFeatures?: string[];
36
+ /** Hosts images are fetched from directly. */
37
+ imageHosts?: string[];
38
+ /** URL prefixes an `open-url` action may open. */
39
+ urlAllowlist?: string[];
40
+ /** Action kinds the page handles itself when the agent didn't wire them. */
41
+ appKinds?: string[];
42
+ }
43
+ export interface LiveryPropertySpec {
44
+ key: string;
45
+ kind: 'DynamicString' | 'DynamicNumber' | 'DynamicBoolean' | 'DynamicValue' | 'String' | 'Action' | 'Actions' | 'Any';
46
+ required: boolean;
47
+ /** For `Actions`: the contract's action names. */
48
+ properties?: string[];
49
+ }
50
+ export interface LiveryComponentSpec {
51
+ name: string;
52
+ contract: string;
53
+ description: string;
54
+ /** The component's JSON schema, as A2UI advertises it. */
55
+ schema: Record<string, unknown>;
56
+ properties: LiveryPropertySpec[];
57
+ /** Inputs the contract's `set` actions write back. */
58
+ setInputs: string[];
59
+ }
60
+ export interface LiverySpace {
61
+ widthDp?: number;
62
+ heightDp?: number;
63
+ density?: number;
64
+ colorScheme?: string;
65
+ /** Theme roles (`primary`, `surface`, `onSurface`, …) as `#RRGGBB` or `#AARRGGBB`. */
66
+ theme?: Record<string, string>;
67
+ /** What the render's events carry as `decisionId`: `a2ui:<surfaceId>/<componentId>` for an A2UI component. */
68
+ decisionId?: string;
69
+ }
70
+ export type Rendered = {
71
+ ok: true;
72
+ render: number;
73
+ /** The document to play; load it only when [documentKey] changes, otherwise set [values]. */
74
+ document: Uint8Array;
75
+ documentKey: string;
76
+ /** Impression identity; a new decision can reuse the same documentKey. */
77
+ presentationKey: string;
78
+ /** Its named values: strings, numbers (booleans as 1 or 0), colours as `#AARRGGBB`. */
79
+ values: Record<string, string | number>;
80
+ design: string;
81
+ sha256: string;
82
+ /** The template's own height in dp: what to draw it at when the page gives the component none. */
83
+ heightDp?: number;
84
+ pending?: boolean;
85
+ /** An authored target minimum, retained when sizing to the measured root. */
86
+ minHeightDp?: number;
87
+ } | {
88
+ ok: false;
89
+ reason: string;
90
+ waiting?: boolean;
91
+ pending?: boolean;
92
+ };
93
+ export type Routed = {
94
+ route: 'agent';
95
+ action: Record<string, unknown>;
96
+ shadowed: string[];
97
+ } | {
98
+ route: 'set';
99
+ input: string;
100
+ value: unknown;
101
+ agent?: {
102
+ action: Record<string, unknown>;
103
+ shadowed: string[];
104
+ };
105
+ } | {
106
+ route: 'app';
107
+ kind: string;
108
+ action: string;
109
+ args: Record<string, string>;
110
+ } | {
111
+ route: 'dropped';
112
+ reason: string;
113
+ };
114
+ /** The `livery-web` module's exports (`livery-livery-web.mjs`). */
115
+ export interface LiveryWebModule {
116
+ liveryOpen(config: string): Promise<unknown>;
117
+ liveryClose(session: number): void;
118
+ liveryRefresh(session: number): Promise<unknown>;
119
+ liveryComponents(session: number): Promise<unknown>;
120
+ liveryCatalogSchema(session: number, catalogId: string): Promise<unknown>;
121
+ liveryRender(session: number, name: string, props: string, space: string): Promise<unknown>;
122
+ liveryShown(session: number, render: number): void;
123
+ liveryRelease(session: number, render: number): void;
124
+ liveryAction(session: number, render: number, name: string, valueType: string, value: string | null): Promise<unknown>;
125
+ liveryEvents(session: number): string;
126
+ liveryFetchPending(session: number): Promise<unknown>;
127
+ liveryFetchImages(session: number): Promise<unknown>;
128
+ }
129
+ /** Loads the Wasm module shipped in this package (`dist/livery-web/`). */
130
+ export declare function loadLiveryWeb(): Promise<LiveryWebModule>;
131
+ export declare class LiverySession {
132
+ private readonly lib;
133
+ readonly id: number;
134
+ private constructor();
135
+ /** Opens [config]'s catalog (fetching it once) with [lib], or the module this package ships. */
136
+ static open(config: LiveryConfig, lib?: LiveryWebModule): Promise<LiverySession>;
137
+ /** Close after removing the session's components. Cancels pending work and clears listeners. */
138
+ close(): void;
139
+ refresh(): Promise<string>;
140
+ /** The components to register: one per contract the catalog can play here now. */
141
+ components(): Promise<LiveryComponentSpec[]>;
142
+ /** The A2UI catalog JSON of those components, to prompt an agent with. */
143
+ catalogSchema(catalogId: string): Promise<Record<string, unknown>>;
144
+ render(name: string, props: Record<string, unknown>, space?: LiverySpace): Promise<Rendered>;
145
+ private pendingFetch;
146
+ /** Run after rendering an answer marked pending, then render again. */
147
+ fetchPending(): Promise<void>;
148
+ private fetching;
149
+ private readonly waiting;
150
+ /**
151
+ * Fetches the images renders were waiting for (`waiting: true`), off the render path, then calls
152
+ * every [whenImagesArrive] callback, whichever render asked: the session's misses are one queue,
153
+ * so one fetch can bring another component's image. Fetches run one after another. `arrived` is
154
+ * false when one of them could not be fetched: render again, and a render still waiting has
155
+ * failed.
156
+ */
157
+ fetchImages(): Promise<void>;
158
+ /** [callback] runs once, when the next fetch ends: render again then. */
159
+ whenImagesArrive(callback: (arrived: boolean) => void): void;
160
+ shown(render: number): void;
161
+ release(render: number): void;
162
+ action(render: number, name: string, valueType: string, value: unknown): Promise<Routed>;
163
+ /** Livery's events since the last call: impressions, actions, fallbacks, errors. */
164
+ events(): Record<string, unknown>[];
165
+ }
package/dist/livery.js ADDED
@@ -0,0 +1,87 @@
1
+ /** Loads the Wasm module shipped in this package (`dist/livery-web/`). */
2
+ export async function loadLiveryWeb() {
3
+ // The path is computed so a bundler leaves it alone: the module fetches its .wasm beside itself.
4
+ const url = new URL('./livery-web/livery-livery-web.mjs', import.meta.url).href;
5
+ return (await import(/* @vite-ignore */ url));
6
+ }
7
+ export class LiverySession {
8
+ constructor(lib, id) {
9
+ this.lib = lib;
10
+ this.id = id;
11
+ this.pendingFetch = Promise.resolve();
12
+ this.fetching = Promise.resolve();
13
+ this.waiting = new Set();
14
+ }
15
+ /** Opens [config]'s catalog (fetching it once) with [lib], or the module this package ships. */
16
+ static async open(config, lib) {
17
+ const m = lib ?? (await loadLiveryWeb());
18
+ return new LiverySession(m, Number(await m.liveryOpen(JSON.stringify(config))));
19
+ }
20
+ /** Close after removing the session's components. Cancels pending work and clears listeners. */
21
+ close() { this.waiting.clear(); this.lib.liveryClose(this.id); }
22
+ async refresh() {
23
+ return String(await this.lib.liveryRefresh(this.id));
24
+ }
25
+ /** The components to register: one per contract the catalog can play here now. */
26
+ async components() {
27
+ return JSON.parse(String(await this.lib.liveryComponents(this.id)));
28
+ }
29
+ /** The A2UI catalog JSON of those components, to prompt an agent with. */
30
+ async catalogSchema(catalogId) {
31
+ return JSON.parse(String(await this.lib.liveryCatalogSchema(this.id, catalogId)));
32
+ }
33
+ async render(name, props, space = {}) {
34
+ const r = JSON.parse(String(await this.lib.liveryRender(this.id, name, JSON.stringify(props), JSON.stringify(space))));
35
+ return r.ok ? { ...r, document: base64ToBytes(r.document) } : r;
36
+ }
37
+ /** Run after rendering an answer marked pending, then render again. */
38
+ fetchPending() {
39
+ this.pendingFetch = this.pendingFetch.then(async () => { await this.lib.liveryFetchPending(this.id); }).catch(() => { });
40
+ return this.pendingFetch;
41
+ }
42
+ /**
43
+ * Fetches the images renders were waiting for (`waiting: true`), off the render path, then calls
44
+ * every [whenImagesArrive] callback, whichever render asked: the session's misses are one queue,
45
+ * so one fetch can bring another component's image. Fetches run one after another. `arrived` is
46
+ * false when one of them could not be fetched: render again, and a render still waiting has
47
+ * failed.
48
+ */
49
+ fetchImages() {
50
+ this.fetching = this.fetching.then(async () => {
51
+ let arrived = false;
52
+ try {
53
+ arrived = String(await this.lib.liveryFetchImages(this.id)) === 'true';
54
+ }
55
+ catch { /* as a miss */ }
56
+ const callbacks = [...this.waiting];
57
+ this.waiting.clear();
58
+ callbacks.forEach((c) => c(arrived));
59
+ }).catch(() => { });
60
+ return this.fetching;
61
+ }
62
+ /** [callback] runs once, when the next fetch ends: render again then. */
63
+ whenImagesArrive(callback) {
64
+ this.waiting.add(callback);
65
+ }
66
+ shown(render) {
67
+ this.lib.liveryShown(this.id, render);
68
+ }
69
+ release(render) {
70
+ this.lib.liveryRelease(this.id, render);
71
+ }
72
+ async action(render, name, valueType, value) {
73
+ const text = value === null || value === undefined ? null : String(value);
74
+ return JSON.parse(String(await this.lib.liveryAction(this.id, render, name, valueType, text)));
75
+ }
76
+ /** Livery's events since the last call: impressions, actions, fallbacks, errors. */
77
+ events() {
78
+ return JSON.parse(this.lib.liveryEvents(this.id));
79
+ }
80
+ }
81
+ function base64ToBytes(b64) {
82
+ const s = atob(b64);
83
+ const out = new Uint8Array(s.length);
84
+ for (let i = 0; i < s.length; i++)
85
+ out[i] = s.charCodeAt(i);
86
+ return out;
87
+ }
@@ -0,0 +1,2 @@
1
+ export { RcCanvasPlayer } from '@yschimke/livery-web/player';
2
+ export type { NamedAction, LiveryPlayer, LiveryPlayerFactory, HostValue } from '@yschimke/livery-web/player';
package/dist/player.js ADDED
@@ -0,0 +1,2 @@
1
+ // The neutral player is bundled into the published A2UI package.
2
+ export { RcCanvasPlayer } from '@yschimke/livery-web/player';
@@ -0,0 +1,24 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type LiveryCatalogOptions } from './api.js';
3
+ import type { LiverySession } from './livery.js';
4
+ export { LiverySession, loadLiveryWeb } from './livery.js';
5
+ export declare function liveryReactCatalog(session: LiverySession, options: LiveryCatalogOptions): Promise<{
6
+ catalog: import("@a2ui/web_core").Catalog<any, any>;
7
+ components: {
8
+ name: string;
9
+ tagName: string;
10
+ schema: import("zod").ZodTypeAny;
11
+ spec: import("./livery.js").LiveryComponentSpec;
12
+ session: LiverySession;
13
+ options: LiveryCatalogOptions;
14
+ render: import("react").FC<{
15
+ context: import("@a2ui/web_core").ComponentContext;
16
+ buildChild: (id: string, basePath?: string) => ReactNode;
17
+ metadata?: import("@a2ui/web_core").A2uiMetadata;
18
+ }>;
19
+ view?: import("react").FC<import("@a2ui/react").NodeViewProps>;
20
+ allowedParents?: string[];
21
+ allowedChildren?: string[];
22
+ metadata?: import("@a2ui/web_core").A2uiMetadata;
23
+ }[];
24
+ }>;
package/dist/react.js ADDED
@@ -0,0 +1,36 @@
1
+ import { createElement, useLayoutEffect, useRef, useState } from 'react';
2
+ import { createComponentImplementation } from '@a2ui/react/v0_9';
3
+ import { basicCatalog } from '@a2ui/web_core/v0_9/basic_catalog';
4
+ import { componentApi, preparePlayerOptions } from './api.js';
5
+ import { hostStyle, LiveryController } from './controller.js';
6
+ export { LiverySession, loadLiveryWeb } from './livery.js';
7
+ export async function liveryReactCatalog(session, options) {
8
+ options = await preparePlayerOptions(options);
9
+ const components = (await session.components()).map((spec) => {
10
+ const api = componentApi(session, spec, options);
11
+ function View({ context, props }) {
12
+ const host = useRef(null);
13
+ const controller = useRef(null);
14
+ const [, update] = useState(0);
15
+ useLayoutEffect(() => {
16
+ const el = host.current;
17
+ el.style.cssText = hostStyle;
18
+ const c = new LiveryController(el, () => update((n) => n + 1), () => new Promise(requestAnimationFrame));
19
+ controller.current = c;
20
+ (el.shadowRoot ?? el.attachShadow({ mode: 'open' })).append(c.box);
21
+ c.connect();
22
+ c.update(api, context, props);
23
+ return () => { c.disconnect(); c.box.remove(); controller.current = null; };
24
+ }, []);
25
+ useLayoutEffect(() => { controller.current?.update(api, context, props); });
26
+ const reason = controller.current?.fallback;
27
+ // The player owns its shadow tree; React owns the optional fallback beside it.
28
+ if (controller.current)
29
+ controller.current.box.style.display = reason === undefined ? '' : 'none';
30
+ return createElement('div', null, createElement('div', { ref: host, 'data-livery-component': spec.name }), reason === undefined ? null : options.fallback?.(spec, reason));
31
+ }
32
+ return { ...createComponentImplementation(api, View), ...api };
33
+ });
34
+ const base = options.base ?? basicCatalog;
35
+ return { catalog: base.derive({ catalogId: options.catalogId, components: [...base.components.keys(), ...components] }), components };
36
+ }
@@ -0,0 +1,363 @@
1
+ Changelog
2
+ =========
3
+
4
+ ### next (upcoming)
5
+
6
+ ### 3.2.0
7
+
8
+ * add typescript definitions for OffsetDateTime and OffsetTime #448 by jonfreedman
9
+
10
+ ### 3.1.0
11
+
12
+ * Fix bitwise or #439 by @pithu
13
+ * Tests for TS declaration run with ts-node #423 by InExtremaRes
14
+ * dependabot Bump elliptic from 6.5.2 to 6.5.3
15
+ * dependabot Bump lodash from 4.17.15 to 4.17.19
16
+ * dependabot Bump npm-registry-fetch from 4.0.2 to 4.0.5
17
+
18
+ ### 3.0.0
19
+
20
+ This is a major release because of these following minor/ breaking cleanups:
21
+
22
+ * Renamed method getDisplayName to displayName for
23
+ * WeekFields
24
+ * DayOfWeek
25
+ * Month
26
+ * IsoFields
27
+ * Removed duplicate function YearMonth.with(number, number)
28
+ * YearMonth.with(year, month), use YearMonth.of() instead
29
+ * YearMonth.withYearMonth(year, month), use YearMonth.of() instead
30
+
31
+ All updates:
32
+
33
+ * Implement OffsetTime and OffsetDateTim #416 by exoego
34
+ * TS types reorganized and documentation added #418 by InExtremaRes
35
+ * Fix isBrowserTest check #419 by pithu
36
+ * Duration#(minus|plus) should accept TemporalUnit, not just ChronoUnit #417 by exoego
37
+ * TS types refactor part 1 #415 by InExtremaRes
38
+ * Remove YearMonth#with that takes (number, number) #412 by InExtremaRes
39
+ * Fixes and cleanups to TemporalFields and TemporalUnits #408 by InExtremaRes
40
+ * Switch to travis-ci.com #409 by pithu
41
+ * Error base name changed to "JsJodaException" and exceptions exposed in TS #407 by InExtremaRes
42
+ * Some fixes to TS declarations #404 by InExtremaRes
43
+ * remove android saucelabs test setup #403 by pithu
44
+ * Fix TS declarations of some TemporalAdjuster implementations (like DayOfWeak) #402 by InExtremaRes
45
+ * Fixed types of DateTimeFormatterBuilder.prototype.toFormatter to allow zero arguments #388 by InExtremaRes
46
+ * Add missing types for Clock.offset() #387 by InExtremaRes
47
+ * Added missing nanoAdjustment to Duration.ofSeconds static method #383 by jseter
48
+ * changed bitwise or to logical or #379 by bowersj
49
+ * Add Typescript for IsoChronology.INSTANCE #373 by cranberyxl
50
+ * Remove `withTemporalAdjuster` and others non-public methods from TS declaration #363 by InExtremaRes
51
+
52
+ ### 2.0.0
53
+
54
+ This is a major release because some 'internal' methods were hidden from the typescript definitions
55
+ and were renamed in the javascript code.
56
+ Resolve those conflicts by using the 'public shorthand' methods, like instead of using `with*()` use `with(...)`.
57
+
58
+ * Improve of the TS declarations #353 from InExtremaRes
59
+ * Add missing methods to `Temporal` interface #361 from thrucker
60
+ * LocalDateTime.of requires at least 3 arguments #356
61
+
62
+ ### 1.12.0
63
+
64
+ * Cleanup documentation and configuration
65
+ * Upgrade dependencies
66
+ * Add ISO formatters definitions #358 akonior/iso-formetters
67
+ * Improve TS declarations with no breaking change #357 InExtremaRes/ts-declarations
68
+ * Fixes to docu and LocalDateTime.of() according to the typescript changes #359
69
+
70
+ ### 1.11.0
71
+
72
+ * Added ts defs for new methods in DayOfWeek and Month #301
73
+ * add method params for #appendValue and #appendValueReduced #288
74
+ * add type definition for ChronoUnit.NANOS #296
75
+ * Add ZoneRulesProvider TypeScript definition #317
76
+ * Add type definition for Instant.atZone #313
77
+
78
+ ### 1.10.1
79
+
80
+ * implement methods on DayOfWeek and Month #300
81
+ * Adding private constructors and abstract modifiers to TypeScript definitions #298
82
+
83
+ ### 1.9.3
84
+
85
+ * fix typescript definitions: add `ZoneId#id()` #265
86
+ * fix typescript definitions: Fix DateTimeFormatter.withLocale() #277
87
+ * Remove unreachable code #278
88
+ * add package-lock for dev dependencies
89
+
90
+ ### 1.9.2
91
+
92
+ #### public API
93
+
94
+ * implement atZone in Instant
95
+ * Add DateTimeParseException to typings file
96
+
97
+ ### 1.9.1
98
+
99
+ #### dependency updates
100
+
101
+ * revert babel to previous version
102
+
103
+ ### 1.9.0
104
+
105
+ #### public API
106
+
107
+ * add OffsetClock and add withZone and equals to other Clock impls
108
+
109
+ #### bugfixes
110
+
111
+ * fix error when parsing dates from string with e.g. WeekOfWeekbasedYear fields
112
+ * fix call to `substring` in generating error message when parsing
113
+
114
+ #### dependency updates
115
+
116
+ ### 1.8.2
117
+
118
+ #### public API
119
+
120
+ * add ESM module to pkg.module build with rollup
121
+
122
+ #### dev setup
123
+
124
+ * Migrate from webpack to rollup
125
+
126
+ #### etc
127
+
128
+ * Remove usage of module.exports
129
+
130
+ #### dependency updates
131
+
132
+ ### 1.7.0 1.7.1 1.8.0 1.8.1
133
+
134
+ * issues with build artifacts, dont use it.
135
+
136
+ ### 1.6.3
137
+
138
+ #### public API
139
+
140
+ * improve typescript definition (see PR #196)
141
+
142
+ #### dependency updates
143
+
144
+ ### etc
145
+
146
+ * Remove usage of call on constructors
147
+
148
+ ### 1.6.2
149
+
150
+ #### public API
151
+
152
+ * improve typescript definition (see PR #188)
153
+
154
+ #### internal API
155
+
156
+ * add `DateTimeBuilder` to internal API
157
+
158
+ #### dependency updates
159
+
160
+ ### 1.6.1
161
+
162
+ #### dependency updates
163
+
164
+ #### bugs
165
+
166
+ * fix issue #166, bug from upstream project, parse zoned date time during overlap
167
+
168
+ ### 1.6.0
169
+
170
+ #### public API
171
+
172
+ * update API: export all public classes/interfaces
173
+ * add `IsoChronology#date(temporal)` function
174
+ * add export of "internal" APIs needed e.g. for plugins, these should *not* be used by users of the `js-joda` library.
175
+ Since we do not consider these a public APIs, they may change without warning!
176
+ These internal APIs are exported as the `_` object
177
+
178
+ ### 1.5.5
179
+
180
+ #### bugs
181
+
182
+ * fix Period.ofDays() if called with none number string values
183
+
184
+ #### public API
185
+
186
+ * improve typescript definition
187
+
188
+ ### 1.5.4
189
+
190
+ #### public API
191
+
192
+ * fail if temporals ar created with float values
193
+ * fix typescript definition and esdoc
194
+
195
+ #### dependency updates
196
+
197
+ ### 1.5.2
198
+
199
+ #### public API
200
+
201
+ * fix LocalDate.now in typescript definition and esdoc
202
+ * fix LocalTime static properties in typescript definition
203
+
204
+ ### 1.5.1
205
+
206
+ #### public API
207
+
208
+ * Add `use` function to typescript definition
209
+ * Add `convert` function to typescript definition
210
+
211
+ ### 1.5.0
212
+
213
+ #### public API
214
+
215
+ * Add toJSON methods where missing and useful
216
+ * Remove protected class DateTimeBuilder from esdoc and typescript definition
217
+
218
+ #### lint
219
+
220
+ * add linter rules `no-var`, `prefer-const`
221
+
222
+ #### dependency updates
223
+
224
+ ### 1.4.0
225
+
226
+ #### public API
227
+
228
+ * Remove private constructors, functions and classes from typescript definition (see #134)
229
+
230
+ ### 1.3.1
231
+
232
+ #### public API
233
+
234
+ * Add `DateTimeFormatter.withResolverStyle` function
235
+
236
+ #### etc
237
+
238
+ * Fix DateTimeFormatterBuilder.constructor esdoc/ typescript definition
239
+ * Fix esdoc/ typescript definition for ZoneId
240
+ * Remove private functions, classses and constructors from esdoc
241
+ * unify the format pattern esdoc in `DateTimeFormatter.ofPattern`
242
+ and `DateTimeFormatterBuilder.appendPattern`, and add `u` Symbol to documentation
243
+
244
+ ### 1.3.0
245
+
246
+ #### public API
247
+
248
+ * export zone/ZoneOffsetTransition
249
+
250
+ ### 1.2.0
251
+
252
+ #### iana tzdb
253
+
254
+ * Complete parsing of ZoneRegions
255
+
256
+ #### etc
257
+
258
+ * Fix bower.json
259
+ * Fix LocalTime.parse esdoc/ typescript definition
260
+
261
+ #### dependency updates
262
+
263
+ ### 1.1.17
264
+
265
+ #### Bugfixes
266
+
267
+ * Improve LocalDateTime.toInstant error handling
268
+ * Improve validation of LocalDate parameter values when passed as Strings
269
+
270
+ #### iana tzdb
271
+
272
+ * First quick approach for parsing ZoneRegions
273
+
274
+ ### 1.1.14
275
+
276
+ #### Add more classes to public export
277
+
278
+ * add all error classes
279
+ * add zone/ZoneRules
280
+
281
+ #### code cleanup
282
+
283
+ * fix lint issues
284
+ * fix ESDoc tags
285
+ * Replace var by let/ const declaration
286
+
287
+ #### dependency updates
288
+
289
+ ### 1.1.13
290
+
291
+ #### Add ZoneRulesProvider stub
292
+
293
+ Add the ZoneRulesProvider. This should be the last step to enable js-joda for an external js-joda-timezone plugin.
294
+
295
+ #### Provide a way to extend js-joda
296
+
297
+ [Implement a use function](https://github.com/js-joda/js-joda/pull/100#issuecomment-252425196)
298
+
299
+ ### Bugfixes
300
+
301
+ * Fix SystemDefaultZoneRules transition (fix a bug in convert and LocalDate.startOfDay)
302
+
303
+ ### 1.1.12
304
+
305
+ #### Implement daylight saving transition functionality
306
+
307
+ Complete / implement methods/ interfaces
308
+ - LocalDate.atStartOfDayWithZone
309
+ - ZonedDateTime.ofLocal
310
+ - ZonedDateTime.ofStrict
311
+ - ZonedDateTime.withEarlierOffsetAtOverlap
312
+ - ZonedDateTime.withLaterOffsetAtOverlap
313
+ - ZonedDateTime.until
314
+ - ZoneRules
315
+ - Pseudo zones for testing purpose
316
+
317
+ Increased test coverage for zone related classes
318
+
319
+ #### Test Coverage and more threetenbp Features
320
+
321
+ increased Test Coverage by adding/extending more tests from threetenbp
322
+ but also adding own tests that increase the coverage.
323
+
324
+ This also led to missing features implemented, e.g. more Fields in `DateTimeBuilder` being handled
325
+
326
+ #### Bugfixes
327
+
328
+ fixes found by extended Tests in
329
+ - `Duration`
330
+ - `DateTimeBuilder`
331
+ - `DateTimeFormatterBuilder`
332
+ - `YearMonth`
333
+
334
+ #### dependency updates
335
+
336
+ ### 1.1.11
337
+
338
+ #### Typescript typings
339
+
340
+ make typescript definitions to be module definitions (see PR #86)
341
+
342
+ #### ESDoc Updates
343
+
344
+ fixed some warnings in esdoc build regarding signature mismatches (see PR #87)
345
+
346
+ #### Bugfixes
347
+
348
+ #### dependency updates
349
+
350
+ ### 1.1.9
351
+
352
+ #### Typescript typings
353
+
354
+ added initial typescript typings (`.d.ts`) provided by [@spencerwi](https://github.com/spencerwi) and test based on the code from [CheatSheet](CheatSheet.md) to verify the typings
355
+
356
+ #### Bugfixes
357
+
358
+ #### dependency updates
359
+ * several dev dependency updates
360
+
361
+ ### 1.1.8
362
+
363
+ last release without a CHANGELOG.md