@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.
- package/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +133 -5
- package/dist/capabilities/index.js.map +8 -7
- package/dist/constants/authoring.d.ts +4 -3
- package/dist/constants/authoring.d.ts.map +1 -1
- package/dist/constants/authoring.js +3 -0
- package/dist/constants/authoring.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/calendar/adapters/inbound/Calendar.d.ts +1 -1
- package/dist/features/calendar/adapters/inbound/Calendar.d.ts.map +1 -1
- package/dist/features/calendar/adapters/inbound/Calendar.js +207 -75
- package/dist/features/calendar/adapters/inbound/Calendar.js.map +1 -1
- package/dist/features/calendar/calendarMeta.d.ts +106 -4
- package/dist/features/calendar/calendarMeta.d.ts.map +1 -1
- package/dist/features/calendar/calendarMeta.js +44 -4
- package/dist/features/calendar/calendarMeta.js.map +1 -1
- package/dist/features/calendar/public.d.ts +1 -1
- package/dist/features/calendar/public.d.ts.map +1 -1
- package/dist/features/calendar/public.js.map +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
- package/dist/features/data-table/dataTableMeta.d.ts +10 -0
- package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
- package/dist/features/data-table/dataTableMeta.js +7 -0
- package/dist/features/data-table/dataTableMeta.js.map +1 -1
- package/dist/features/dialog/dialogMeta.d.ts +2 -2
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/screenMeta.d.ts +1 -1
- package/dist/features/layout/scrollViewMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
- package/dist/features/popover/adapters/inbound/Popover.js +6 -3
- package/dist/features/popover/adapters/inbound/Popover.js.map +1 -1
- package/dist/features/popover/popoverMeta.d.ts +101 -0
- package/dist/features/popover/popoverMeta.d.ts.map +1 -0
- package/dist/features/popover/popoverMeta.js +78 -0
- package/dist/features/popover/popoverMeta.js.map +1 -0
- package/dist/features/reader/meta.d.ts +2 -2
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +2 -0
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
- package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
- package/dist/features/registry/componentMeta.d.ts.map +1 -1
- package/dist/features/registry/componentMeta.js +2 -0
- package/dist/features/registry/componentMeta.js.map +1 -1
- package/dist/features/scanner/meta.d.ts +2 -2
- package/dist/features/section/screenSectionMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
- package/dist/readerFree.d.ts +1 -0
- package/dist/readerFree.d.ts.map +1 -1
- package/dist/readerFree.js +1 -0
- package/dist/readerFree.js.map +1 -1
- package/dist/types/calendar.d.ts +40 -19
- package/dist/types/calendar.d.ts.map +1 -1
- package/dist/types/calendar.js.map +1 -1
- package/dist/types/popover.d.ts +4 -1
- package/dist/types/popover.d.ts.map +1 -1
- package/dist/types/popover.js.map +1 -1
- package/package.json +102 -1
- package/src/constants/authoring.ts +3 -0
- package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +95 -0
- package/src/features/calendar/adapters/inbound/Calendar.tsx +425 -135
- package/src/features/calendar/calendarMeta.ts +44 -4
- package/src/features/calendar/public.test.ts +8 -5
- package/src/features/calendar/public.ts +4 -0
- package/src/features/data-table/adapters/inbound/DataTable.test.tsx +52 -1
- package/src/features/data-table/dataTableMeta.test.ts +8 -1
- package/src/features/data-table/dataTableMeta.ts +7 -0
- package/src/features/popover/adapters/inbound/Popover.tsx +17 -2
- package/src/features/popover/manifest.test.tsx +153 -0
- package/src/features/popover/popoverMeta.ts +79 -0
- package/src/features/popover/public.test.ts +2 -1
- package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +2 -0
- package/src/features/registry/componentMeta.test.ts +2 -0
- package/src/features/registry/componentMeta.ts +2 -0
- package/src/features/registry/featureManifest.test.ts +11 -0
- package/src/readerFree.ts +6 -0
- package/src/types/calendar.ts +44 -19
- package/src/types/popover.ts +5 -1
- package/src/webPackageExports.test.ts +1 -0
- package/web-dist/chunks/Accordion-59x6e7bs.js +200 -0
- package/web-dist/chunks/Accordion-q2yxtdzc.js +426 -0
- package/web-dist/components/calendar/Calendar.d.ts +2 -2
- package/web-dist/components/calendar/Calendar.dependency-2.d.ts +165 -0
- package/web-dist/components/calendar/Calendar.js +2 -1
- package/web-dist/components/calendar/Calendar.types-0.d.ts +45 -19
- package/web-dist/components/calendar/index.d.ts +1 -1
- package/web-dist/components/date-picker/DatePicker.js +2 -1
- package/web-dist/components/popover/Popover.js +10 -2
- package/web-dist/components/popover/Popover.types-0.d.ts +4 -1
- package/web-dist/components/time-grid/TimeGrid.js +4 -198
- package/web-dist/manifest.json +6 -2
- 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));
|