@ankhorage/zora 25.5.0 → 25.6.2
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 +30 -0
- package/README.md +2 -1
- package/dist/capabilities/index.d.ts +2 -74
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +6158 -59
- package/dist/capabilities/index.js.map +118 -1
- package/dist/cli/index.d.ts +2 -74
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/features/grid-view/adapters/inbound/GridView.d.ts +2 -7
- package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
- package/dist/features/grid-view/adapters/inbound/GridView.js +309 -51
- package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
- package/dist/features/grid-view/adapters/inbound/TileGrid.d.ts +1 -1
- package/dist/features/grid-view/adapters/inbound/TileGrid.d.ts.map +1 -1
- package/dist/features/grid-view/adapters/inbound/TileGrid.js +11 -4
- package/dist/features/grid-view/adapters/inbound/TileGrid.js.map +1 -1
- package/dist/features/matrix-grid/adapters/inbound/MatrixGrid.d.ts +5 -0
- package/dist/features/matrix-grid/adapters/inbound/MatrixGrid.d.ts.map +1 -0
- package/dist/features/matrix-grid/adapters/inbound/MatrixGrid.js +59 -0
- package/dist/features/matrix-grid/adapters/inbound/MatrixGrid.js.map +1 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridContentSize.d.ts +7 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridContentSize.d.ts.map +1 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridContentSize.js +24 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridContentSize.js.map +1 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridSelection.d.ts +5 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridSelection.d.ts.map +1 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridSelection.js +8 -0
- package/dist/features/matrix-grid/application/resolveMatrixGridSelection.js.map +1 -0
- package/dist/features/matrix-grid/meta.d.ts +11 -0
- package/dist/features/matrix-grid/meta.d.ts.map +1 -0
- package/dist/features/matrix-grid/meta.js +11 -0
- package/dist/features/matrix-grid/meta.js.map +1 -0
- package/dist/features/matrix-grid/public.d.ts +4 -0
- package/dist/features/matrix-grid/public.d.ts.map +1 -0
- package/dist/features/matrix-grid/public.js +3 -0
- package/dist/features/matrix-grid/public.js.map +1 -0
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js +2 -0
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js.map +1 -1
- 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/registry/createEventCapabilities.d.ts +4 -0
- package/dist/features/registry/createEventCapabilities.d.ts.map +1 -0
- package/dist/features/registry/createEventCapabilities.js +76 -0
- package/dist/features/registry/createEventCapabilities.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/grid-view.d.ts +18 -1
- package/dist/types/grid-view.d.ts.map +1 -1
- package/dist/types/grid-view.js.map +1 -1
- package/dist/types/matrix-grid.d.ts +23 -0
- package/dist/types/matrix-grid.d.ts.map +1 -0
- package/dist/types/matrix-grid.js +2 -0
- package/dist/types/matrix-grid.js.map +1 -0
- package/package.json +1822 -4
- package/src/capabilities/index.test.ts +87 -15
- package/src/capabilities/index.ts +5 -2
- package/src/cli/index.test.ts +5 -3
- package/src/cli/index.ts +5 -2
- package/src/features/grid-view/adapters/inbound/GridView.interaction.test.tsx +585 -0
- package/src/features/grid-view/adapters/inbound/GridView.test.tsx +74 -0
- package/src/features/grid-view/adapters/inbound/GridView.tsx +506 -77
- package/src/features/grid-view/adapters/inbound/TileGrid.tsx +26 -3
- package/src/features/matrix-grid/adapters/inbound/MatrixGrid.test.tsx +232 -0
- package/src/features/matrix-grid/adapters/inbound/MatrixGrid.tsx +142 -0
- package/src/features/matrix-grid/application/resolveMatrixGridContentSize.test.ts +32 -0
- package/src/features/matrix-grid/application/resolveMatrixGridContentSize.ts +28 -0
- package/src/features/matrix-grid/application/resolveMatrixGridSelection.test.ts +10 -0
- package/src/features/matrix-grid/application/resolveMatrixGridSelection.ts +15 -0
- package/src/features/matrix-grid/application/resolveMatrixGridVisibleCells.test.ts +35 -0
- package/src/features/matrix-grid/meta.ts +12 -0
- package/src/features/matrix-grid/public.ts +3 -0
- package/src/features/registry/ZORA_COMPONENT_REGISTRY.ts +2 -0
- package/src/features/registry/componentMeta.ts +2 -0
- package/src/features/registry/createEventCapabilities.ts +108 -0
- package/src/features/time-grid/adapters/inbound/TimeGrid.test.tsx +35 -8
- package/src/index.ts +2 -0
- package/src/structureOwnership.test.ts +5 -0
- package/src/types/grid-view.ts +27 -1
- package/src/types/matrix-grid.ts +29 -0
- package/web-dist/chunks/{Accordion-d6azgz09.js → Accordion-2r0gqk3x.js} +1 -1
- package/web-dist/chunks/Accordion-a6551mh4.js +515 -0
- package/web-dist/chunks/{Accordion-0my2z6qe.js → Accordion-bz04casa.js} +132 -3
- package/web-dist/chunks/{Accordion-7qfd4cb4.js → Accordion-jh72azm2.js} +1 -1
- package/web-dist/components/explorer/Explorer.js +2 -2
- package/web-dist/components/file-explorer/FileExplorer.js +2 -2
- package/web-dist/components/grid-line-overlay/GridLineOverlay.js +1 -1
- package/web-dist/components/grid-ruler/GridRuler.js +1 -1
- package/web-dist/components/grid-view/GridView.js +1 -1
- package/web-dist/components/matrix-grid/MatrixGrid.d.ts +3 -0
- package/web-dist/components/matrix-grid/MatrixGrid.js +153 -0
- package/web-dist/components/matrix-grid/index.d.ts +1 -0
- package/web-dist/components/matrix-grid/index.js +2 -0
- package/web-dist/components/media-explorer/MediaExplorer.js +2 -2
- package/web-dist/components/reader/Reader.js +1 -1
- package/web-dist/components/spatial-grid/SpatialGrid.js +1 -1
- package/web-dist/components/tile-grid/TileGrid.js +1 -1
- package/web-dist/components/time-grid/TimeGrid.js +2 -2
- package/web-dist/components/uploader/Uploader.js +2 -2
- package/web-dist/manifest.json +53 -24
- package/web-dist/chunks/Accordion-gxj5qbpr.js +0 -194
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import {
|
|
3
|
-
getVisibleGridItems,
|
|
4
|
-
revealWorldRect,
|
|
5
|
-
worldToViewport
|
|
6
|
-
} from "./Accordion-0my2z6qe.js";
|
|
7
|
-
import {
|
|
8
|
-
require_cjs
|
|
9
|
-
} from "./Accordion-xgpzh4wq.js";
|
|
10
|
-
import {
|
|
11
|
-
__toESM
|
|
12
|
-
} from "./Accordion-nh0cs9hq.js";
|
|
13
|
-
|
|
14
|
-
// src/features/grid-view/adapters/inbound/GridView.tsx
|
|
15
|
-
var import_react_native = __toESM(require_cjs(), 1);
|
|
16
|
-
import React from "react";
|
|
17
|
-
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
function GridView2({
|
|
19
|
-
items,
|
|
20
|
-
contentWidth,
|
|
21
|
-
contentHeight,
|
|
22
|
-
width,
|
|
23
|
-
height,
|
|
24
|
-
zoom = 1,
|
|
25
|
-
overscanPixels = 160,
|
|
26
|
-
focusedItemId,
|
|
27
|
-
revealPaddingPixels = 8,
|
|
28
|
-
interactionPolicy,
|
|
29
|
-
onViewportChange,
|
|
30
|
-
onVisibleItemIdsChange,
|
|
31
|
-
renderItem,
|
|
32
|
-
testID
|
|
33
|
-
}) {
|
|
34
|
-
const [scrollX, setScrollX] = React.useState(0);
|
|
35
|
-
const [scrollY, setScrollY] = React.useState(0);
|
|
36
|
-
const horizontalScrollRef = React.useRef(null);
|
|
37
|
-
const verticalScrollRef = React.useRef(null);
|
|
38
|
-
const scale = Math.max(0.01, zoom);
|
|
39
|
-
const viewport = React.useMemo(() => ({
|
|
40
|
-
width,
|
|
41
|
-
height,
|
|
42
|
-
offsetX: scrollX / scale,
|
|
43
|
-
offsetY: scrollY / scale,
|
|
44
|
-
pixelsPerUnitX: scale,
|
|
45
|
-
pixelsPerUnitY: scale
|
|
46
|
-
}), [height, scale, scrollX, scrollY, width]);
|
|
47
|
-
const visibleItems = React.useMemo(() => getVisibleGridItems(items, viewport, overscanPixels), [items, overscanPixels, viewport]);
|
|
48
|
-
const viewportVisibleIds = React.useMemo(() => getVisibleGridItems(visibleItems, viewport).map((item) => item.id), [viewport, visibleItems]);
|
|
49
|
-
const previousVisibleIdsRef = React.useRef([]);
|
|
50
|
-
React.useEffect(() => {
|
|
51
|
-
if (!onVisibleItemIdsChange)
|
|
52
|
-
return;
|
|
53
|
-
const previous = previousVisibleIdsRef.current;
|
|
54
|
-
if (previous.length === viewportVisibleIds.length && previous.every((id, index) => id === viewportVisibleIds.at(index))) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
previousVisibleIdsRef.current = viewportVisibleIds;
|
|
58
|
-
onVisibleItemIdsChange(viewportVisibleIds);
|
|
59
|
-
}, [onVisibleItemIdsChange, viewportVisibleIds]);
|
|
60
|
-
React.useEffect(() => {
|
|
61
|
-
onViewportChange?.(viewport);
|
|
62
|
-
}, [onViewportChange, viewport]);
|
|
63
|
-
const viewportRef = React.useRef(viewport);
|
|
64
|
-
React.useEffect(() => {
|
|
65
|
-
viewportRef.current = viewport;
|
|
66
|
-
}, [viewport]);
|
|
67
|
-
React.useEffect(() => {
|
|
68
|
-
const currentViewport = viewportRef.current;
|
|
69
|
-
const focusedItem = items.find((item) => item.id === focusedItemId);
|
|
70
|
-
if (!focusedItem)
|
|
71
|
-
return;
|
|
72
|
-
const revealed = revealWorldRect(currentViewport, focusedItem, revealPaddingPixels);
|
|
73
|
-
if (revealed.offsetX !== currentViewport.offsetX) {
|
|
74
|
-
horizontalScrollRef.current?.scrollTo({ x: revealed.offsetX * scale, animated: true });
|
|
75
|
-
}
|
|
76
|
-
if (revealed.offsetY !== currentViewport.offsetY) {
|
|
77
|
-
verticalScrollRef.current?.scrollTo({ y: revealed.offsetY * scale, animated: true });
|
|
78
|
-
}
|
|
79
|
-
}, [focusedItemId, height, items, revealPaddingPixels, scale, width]);
|
|
80
|
-
return /* @__PURE__ */ jsx(import_react_native.ScrollView, {
|
|
81
|
-
ref: horizontalScrollRef,
|
|
82
|
-
horizontal: true,
|
|
83
|
-
scrollEnabled: interactionPolicy !== "passive",
|
|
84
|
-
scrollEventThrottle: 32,
|
|
85
|
-
showsHorizontalScrollIndicator: true,
|
|
86
|
-
style: { width, height },
|
|
87
|
-
testID,
|
|
88
|
-
onScroll: (event) => setScrollX(event.nativeEvent.contentOffset.x),
|
|
89
|
-
children: /* @__PURE__ */ jsx(import_react_native.ScrollView, {
|
|
90
|
-
ref: verticalScrollRef,
|
|
91
|
-
scrollEnabled: interactionPolicy !== "passive",
|
|
92
|
-
scrollEventThrottle: 32,
|
|
93
|
-
showsVerticalScrollIndicator: true,
|
|
94
|
-
style: { width: contentWidth * scale, height },
|
|
95
|
-
onScroll: (event) => setScrollY(event.nativeEvent.contentOffset.y),
|
|
96
|
-
children: /* @__PURE__ */ jsx(import_react_native.View, {
|
|
97
|
-
style: { width: contentWidth * scale, height: contentHeight * scale },
|
|
98
|
-
children: visibleItems.map((item) => {
|
|
99
|
-
const position = worldToViewport({ x: item.x, y: item.y }, {
|
|
100
|
-
...viewport,
|
|
101
|
-
offsetX: 0,
|
|
102
|
-
offsetY: 0
|
|
103
|
-
});
|
|
104
|
-
return /* @__PURE__ */ jsx(import_react_native.View, {
|
|
105
|
-
style: {
|
|
106
|
-
position: "absolute",
|
|
107
|
-
left: position.x,
|
|
108
|
-
top: position.y,
|
|
109
|
-
width: item.width * scale,
|
|
110
|
-
height: item.height * scale
|
|
111
|
-
},
|
|
112
|
-
children: renderItem(item)
|
|
113
|
-
}, item.id);
|
|
114
|
-
})
|
|
115
|
-
})
|
|
116
|
-
})
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// src/features/grid-view/adapters/inbound/TileGrid.tsx
|
|
121
|
-
var import_react_native2 = __toESM(require_cjs(), 1);
|
|
122
|
-
import React2 from "react";
|
|
123
|
-
|
|
124
|
-
// src/features/grid-view/application/layoutTileGrid.ts
|
|
125
|
-
function layoutTileGrid(items, viewportWidth, tileSize, gap, zoom = 1) {
|
|
126
|
-
if (![viewportWidth, tileSize, gap, zoom].every(Number.isFinite) || viewportWidth < 0 || tileSize <= 0 || gap < 0 || zoom <= 0) {
|
|
127
|
-
throw new RangeError("Tile layout requires finite, nonnegative dimensions and positive scales.");
|
|
128
|
-
}
|
|
129
|
-
const columns = Math.max(1, Math.floor((viewportWidth / zoom + gap) / (tileSize + gap)));
|
|
130
|
-
const rows = Math.ceil(items.length / columns);
|
|
131
|
-
return {
|
|
132
|
-
columns,
|
|
133
|
-
width: columns * (tileSize + gap) - gap,
|
|
134
|
-
height: Math.max(0, rows * (tileSize + gap) - gap),
|
|
135
|
-
items: items.map((item, index) => ({
|
|
136
|
-
id: item.id,
|
|
137
|
-
x: index % columns * (tileSize + gap),
|
|
138
|
-
y: Math.floor(index / columns) * (tileSize + gap),
|
|
139
|
-
width: tileSize,
|
|
140
|
-
height: tileSize
|
|
141
|
-
}))
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// src/features/grid-view/adapters/inbound/TileGrid.tsx
|
|
146
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
147
|
-
function TileGrid2({
|
|
148
|
-
items,
|
|
149
|
-
width,
|
|
150
|
-
height = 440,
|
|
151
|
-
tileSize = 120,
|
|
152
|
-
gap = 12,
|
|
153
|
-
zoom = 1,
|
|
154
|
-
overscanPixels,
|
|
155
|
-
focusedItemId,
|
|
156
|
-
revealPaddingPixels,
|
|
157
|
-
onColumnsChange,
|
|
158
|
-
onVisibleItemIdsChange,
|
|
159
|
-
renderItem,
|
|
160
|
-
interactionPolicy,
|
|
161
|
-
testID
|
|
162
|
-
}) {
|
|
163
|
-
const [measuredWidth, setMeasuredWidth] = React2.useState(0);
|
|
164
|
-
const resolvedWidth = width ?? measuredWidth;
|
|
165
|
-
const layout = React2.useMemo(() => layoutTileGrid(items, resolvedWidth, tileSize, gap, zoom), [items, resolvedWidth, tileSize, gap, zoom]);
|
|
166
|
-
const itemLookup = React2.useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);
|
|
167
|
-
React2.useEffect(() => {
|
|
168
|
-
if (resolvedWidth > 0)
|
|
169
|
-
onColumnsChange?.(layout.columns);
|
|
170
|
-
}, [layout.columns, onColumnsChange, resolvedWidth]);
|
|
171
|
-
return /* @__PURE__ */ jsx2(import_react_native2.View, {
|
|
172
|
-
onLayout: (event) => setMeasuredWidth(event.nativeEvent.layout.width),
|
|
173
|
-
style: { width, height, overflow: "hidden" },
|
|
174
|
-
testID,
|
|
175
|
-
children: resolvedWidth > 0 ? /* @__PURE__ */ jsx2(GridView2, {
|
|
176
|
-
contentHeight: layout.height,
|
|
177
|
-
contentWidth: Math.max(resolvedWidth / zoom, layout.width),
|
|
178
|
-
height,
|
|
179
|
-
focusedItemId,
|
|
180
|
-
interactionPolicy,
|
|
181
|
-
items: layout.items,
|
|
182
|
-
onVisibleItemIdsChange,
|
|
183
|
-
overscanPixels,
|
|
184
|
-
renderItem: (item) => {
|
|
185
|
-
const source = itemLookup.get(item.id);
|
|
186
|
-
return source ? renderItem(source) : null;
|
|
187
|
-
},
|
|
188
|
-
revealPaddingPixels,
|
|
189
|
-
width: resolvedWidth,
|
|
190
|
-
zoom
|
|
191
|
-
}) : null
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
export { GridView2, TileGrid2 };
|