@ankhorage/zora 28.8.3 → 28.10.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 (102) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +133 -5
  4. package/dist/capabilities/index.js.map +8 -7
  5. package/dist/constants/authoring.d.ts +4 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +3 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  11. package/dist/features/calendar/adapters/inbound/Calendar.d.ts +1 -1
  12. package/dist/features/calendar/adapters/inbound/Calendar.d.ts.map +1 -1
  13. package/dist/features/calendar/adapters/inbound/Calendar.js +207 -75
  14. package/dist/features/calendar/adapters/inbound/Calendar.js.map +1 -1
  15. package/dist/features/calendar/calendarMeta.d.ts +106 -4
  16. package/dist/features/calendar/calendarMeta.d.ts.map +1 -1
  17. package/dist/features/calendar/calendarMeta.js +44 -4
  18. package/dist/features/calendar/calendarMeta.js.map +1 -1
  19. package/dist/features/calendar/public.d.ts +1 -1
  20. package/dist/features/calendar/public.d.ts.map +1 -1
  21. package/dist/features/calendar/public.js.map +1 -1
  22. package/dist/features/card/cardMeta.d.ts +1 -1
  23. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  24. package/dist/features/card/postCardMeta.d.ts +1 -1
  25. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  26. package/dist/features/data-table/dataTableMeta.d.ts +10 -0
  27. package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
  28. package/dist/features/data-table/dataTableMeta.js +7 -0
  29. package/dist/features/data-table/dataTableMeta.js.map +1 -1
  30. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  31. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  32. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  33. package/dist/features/layout/gridMeta.d.ts +1 -1
  34. package/dist/features/layout/screenMeta.d.ts +1 -1
  35. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  36. package/dist/features/layout/viewMeta.d.ts +1 -1
  37. package/dist/features/list/flatListMeta.d.ts +1 -1
  38. package/dist/features/list/sectionListMeta.d.ts +1 -1
  39. package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
  40. package/dist/features/popover/adapters/inbound/Popover.js +6 -3
  41. package/dist/features/popover/adapters/inbound/Popover.js.map +1 -1
  42. package/dist/features/popover/popoverMeta.d.ts +101 -0
  43. package/dist/features/popover/popoverMeta.d.ts.map +1 -0
  44. package/dist/features/popover/popoverMeta.js +78 -0
  45. package/dist/features/popover/popoverMeta.js.map +1 -0
  46. package/dist/features/reader/meta.d.ts +2 -2
  47. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
  48. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +2 -0
  49. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
  50. package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
  51. package/dist/features/registry/componentMeta.d.ts.map +1 -1
  52. package/dist/features/registry/componentMeta.js +2 -0
  53. package/dist/features/registry/componentMeta.js.map +1 -1
  54. package/dist/features/scanner/meta.d.ts +2 -2
  55. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  56. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  57. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  58. package/dist/readerFree.d.ts +1 -0
  59. package/dist/readerFree.d.ts.map +1 -1
  60. package/dist/readerFree.js +1 -0
  61. package/dist/readerFree.js.map +1 -1
  62. package/dist/types/calendar.d.ts +40 -19
  63. package/dist/types/calendar.d.ts.map +1 -1
  64. package/dist/types/calendar.js.map +1 -1
  65. package/dist/types/popover.d.ts +4 -1
  66. package/dist/types/popover.d.ts.map +1 -1
  67. package/dist/types/popover.js.map +1 -1
  68. package/package.json +102 -1
  69. package/src/constants/authoring.ts +3 -0
  70. package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +95 -0
  71. package/src/features/calendar/adapters/inbound/Calendar.tsx +425 -135
  72. package/src/features/calendar/calendarMeta.ts +44 -4
  73. package/src/features/calendar/public.test.ts +8 -5
  74. package/src/features/calendar/public.ts +4 -0
  75. package/src/features/data-table/adapters/inbound/DataTable.test.tsx +52 -1
  76. package/src/features/data-table/dataTableMeta.test.ts +8 -1
  77. package/src/features/data-table/dataTableMeta.ts +7 -0
  78. package/src/features/popover/adapters/inbound/Popover.tsx +17 -2
  79. package/src/features/popover/manifest.test.tsx +153 -0
  80. package/src/features/popover/popoverMeta.ts +79 -0
  81. package/src/features/popover/public.test.ts +2 -1
  82. package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +2 -0
  83. package/src/features/registry/componentMeta.test.ts +2 -0
  84. package/src/features/registry/componentMeta.ts +2 -0
  85. package/src/features/registry/featureManifest.test.ts +11 -0
  86. package/src/readerFree.ts +6 -0
  87. package/src/types/calendar.ts +44 -19
  88. package/src/types/popover.ts +5 -1
  89. package/src/webPackageExports.test.ts +1 -0
  90. package/web-dist/chunks/Accordion-59x6e7bs.js +200 -0
  91. package/web-dist/chunks/Accordion-q2yxtdzc.js +426 -0
  92. package/web-dist/components/calendar/Calendar.d.ts +2 -2
  93. package/web-dist/components/calendar/Calendar.dependency-2.d.ts +165 -0
  94. package/web-dist/components/calendar/Calendar.js +2 -1
  95. package/web-dist/components/calendar/Calendar.types-0.d.ts +45 -19
  96. package/web-dist/components/calendar/index.d.ts +1 -1
  97. package/web-dist/components/date-picker/DatePicker.js +2 -1
  98. package/web-dist/components/popover/Popover.js +10 -2
  99. package/web-dist/components/popover/Popover.types-0.d.ts +4 -1
  100. package/web-dist/components/time-grid/TimeGrid.js +4 -198
  101. package/web-dist/manifest.json +6 -2
  102. package/web-dist/chunks/Accordion-v3bmbnfh.js +0 -237
@@ -1,6 +1,12 @@
1
1
  import { join } from 'node:path';
2
2
  import { pathToFileURL } from 'node:url';
3
3
 
4
+ import type { ComponentDataBindingRegistry, UiNode } from '@ankhorage/contracts';
5
+ import {
6
+ composeRuntimeCapabilityExecutor,
7
+ createRuntimeMemoryStateAdapter,
8
+ RuntimeRenderer,
9
+ } from '@ankhorage/runtime';
4
10
  import { expect, test } from 'bun:test';
5
11
  import { Window } from 'happy-dom';
6
12
  import React, { act } from 'react';
@@ -75,6 +81,95 @@ test('selects adjacent days through the locked GridView in regular and compact c
75
81
  });
76
82
  });
77
83
 
84
+ test('renders a Calendar manifest and reactively updates its controlled date and events', async () => {
85
+ const [{ Calendar }, { ZoraProvider }] = (await Promise.all([
86
+ import(pathToFileURL(join(webDistRoot, 'components', 'calendar', 'index.js')).href),
87
+ import(pathToFileURL(join(webDistRoot, 'runtime/ZoraProvider.js')).href),
88
+ ])) as [{ Calendar: typeof CalendarComponent }, { ZoraProvider: typeof ZoraProviderComponent }];
89
+ const node = {
90
+ id: 'calendar',
91
+ type: 'Calendar',
92
+ props: { testID: 'manifest-calendar', view: 'month' },
93
+ } as const satisfies UiNode;
94
+ const bindings = {
95
+ calendar: {
96
+ componentId: 'calendar',
97
+ events: {
98
+ dateChange: [
99
+ {
100
+ target: {
101
+ capability: 'state.set',
102
+ input: {
103
+ path: { kind: 'literal', value: 'calendar.date' },
104
+ value: { capability: 'calendar.dateChange', path: 'payload.date' },
105
+ },
106
+ },
107
+ },
108
+ ],
109
+ },
110
+ props: {
111
+ displayedDate: {
112
+ value: { kind: 'state', path: { kind: 'literal', value: 'calendar.date' } },
113
+ },
114
+ events: { value: { kind: 'state', path: { kind: 'literal', value: 'calendar.events' } } },
115
+ },
116
+ },
117
+ } as const satisfies ComponentDataBindingRegistry;
118
+ const stateAdapter = createRuntimeMemoryStateAdapter({
119
+ initialState: {
120
+ calendar: {
121
+ date: '2026-12-04',
122
+ events: [
123
+ {
124
+ id: 'zurich',
125
+ title: 'Zurich',
126
+ range: {
127
+ allDay: false,
128
+ start: '2026-12-04T09:00:00Z',
129
+ end: '2026-12-04T10:00:00Z',
130
+ timeZone: 'Europe/Zurich',
131
+ },
132
+ },
133
+ ],
134
+ },
135
+ },
136
+ });
137
+ const executeCapability = composeRuntimeCapabilityExecutor({ stateAdapter });
138
+ await withBrowserAsync(async (host) => {
139
+ const root = createRoot(host);
140
+ const render = () =>
141
+ root.render(
142
+ <ZoraProvider mode="light">
143
+ <RuntimeRenderer
144
+ dataBindings={bindings}
145
+ executeCapability={executeCapability}
146
+ isRoot
147
+ node={node}
148
+ registry={{ Calendar }}
149
+ resolveEventCapability={({ eventName }) =>
150
+ eventName === 'dateChange' ? 'calendar.dateChange' : undefined
151
+ }
152
+ stateAdapter={stateAdapter}
153
+ />
154
+ </ZoraProvider>,
155
+ );
156
+ try {
157
+ await interactAsync(render);
158
+ expect(host.textContent).toContain('Zurich');
159
+ const next = host.querySelector<HTMLButtonElement>('[data-testid="manifest-calendar-next"]');
160
+ if (!next) throw new Error('Missing manifest Calendar next navigation');
161
+ await interactAsync(() => next.click());
162
+ await new Promise((resolve) => setTimeout(resolve, 0));
163
+ expect(stateAdapter.get<string>('calendar.date')).toEqual({ data: '2027-01-04', ok: true });
164
+ stateAdapter.set('calendar.events', []);
165
+ await interactAsync(render);
166
+ expect(host.textContent).not.toContain('Zurich');
167
+ } finally {
168
+ await interactAsync(() => root.unmount());
169
+ }
170
+ });
171
+ });
172
+
78
173
  /*** Executes a React interaction after the renderer has a chance to flush effects. */
79
174
  function interactAsync(action: () => void): Promise<void> {
80
175
  return act(() => Promise.resolve().then(action));