@almadar/ui 2.15.8 → 2.15.10
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/dist/components/atoms/ContentSection.d.ts +16 -0
- package/dist/components/atoms/SectionHeader.d.ts +14 -0
- package/dist/components/atoms/StatCard.d.ts +13 -0
- package/dist/components/atoms/index.d.ts +3 -0
- package/dist/components/atoms/svg/SvgBranch.d.ts +12 -0
- package/dist/components/atoms/svg/SvgConnection.d.ts +13 -0
- package/dist/components/atoms/svg/SvgFlow.d.ts +10 -0
- package/dist/components/atoms/svg/SvgGrid.d.ts +14 -0
- package/dist/components/atoms/svg/SvgLobe.d.ts +13 -0
- package/dist/components/atoms/svg/SvgMesh.d.ts +12 -0
- package/dist/components/atoms/svg/SvgMorph.d.ts +11 -0
- package/dist/components/atoms/svg/SvgNode.d.ts +12 -0
- package/dist/components/atoms/svg/SvgPulse.d.ts +12 -0
- package/dist/components/atoms/svg/SvgRing.d.ts +13 -0
- package/dist/components/atoms/svg/SvgShield.d.ts +11 -0
- package/dist/components/atoms/svg/SvgStack.d.ts +13 -0
- package/dist/components/atoms/svg/index.d.ts +12 -0
- package/dist/{chunk-ACUO2BBW.js → components/index.cjs} +24764 -16677
- package/dist/components/index.js +37757 -889
- package/dist/components/molecules/AnimatedCounter.d.ts +18 -0
- package/dist/components/molecules/ArticleSection.d.ts +18 -0
- package/dist/components/molecules/CTABanner.d.ts +31 -0
- package/dist/components/molecules/CaseStudyCard.d.ts +24 -0
- package/dist/components/molecules/CodeExample.d.ts +23 -0
- package/dist/components/molecules/CommunityLinks.d.ts +25 -0
- package/dist/components/molecules/DocBreadcrumb.d.ts +20 -0
- package/dist/components/molecules/DocCodeBlock.d.ts +13 -0
- package/dist/components/molecules/DocPagination.d.ts +14 -0
- package/dist/components/molecules/DocSearch.d.ts +15 -0
- package/dist/components/molecules/DocSidebar.d.ts +24 -0
- package/dist/components/molecules/DocTOC.d.ts +24 -0
- package/dist/components/molecules/FeatureCard.d.ts +26 -0
- package/dist/components/molecules/FeatureGrid.d.ts +19 -0
- package/dist/components/molecules/GradientDivider.d.ts +14 -0
- package/dist/components/molecules/HeroSection.d.ts +36 -0
- package/dist/components/molecules/InstallBox.d.ts +16 -0
- package/dist/components/molecules/MarketingFooter.d.ts +27 -0
- package/dist/components/molecules/PricingCard.d.ts +21 -0
- package/dist/components/molecules/PricingGrid.d.ts +13 -0
- package/dist/components/molecules/PullQuote.d.ts +14 -0
- package/dist/components/molecules/ServiceCatalog.d.ts +19 -0
- package/dist/components/molecules/ShowcaseCard.d.ts +20 -0
- package/dist/components/molecules/SocialProof.d.ts +25 -0
- package/dist/components/molecules/SplitSection.d.ts +21 -0
- package/dist/components/molecules/StatsGrid.d.ts +17 -0
- package/dist/components/molecules/StepFlow.d.ts +20 -0
- package/dist/components/molecules/TagCloud.d.ts +18 -0
- package/dist/components/molecules/TeamCard.d.ts +18 -0
- package/dist/components/molecules/index.d.ts +19 -0
- package/dist/components/molecules/svg/AIGenerates.d.ts +7 -0
- package/dist/components/molecules/svg/ClosedCircuit.d.ts +7 -0
- package/dist/components/molecules/svg/CommunityOwnership.d.ts +7 -0
- package/dist/components/molecules/svg/CompileAnywhere.d.ts +7 -0
- package/dist/components/molecules/svg/ComposableModels.d.ts +7 -0
- package/dist/components/molecules/svg/DescribeProveDeploy.d.ts +7 -0
- package/dist/components/molecules/svg/DomainGrid.d.ts +7 -0
- package/dist/components/molecules/svg/EventBus.d.ts +7 -0
- package/dist/components/molecules/svg/OrbitalUnit.d.ts +7 -0
- package/dist/components/molecules/svg/PlanVerifyRemember.d.ts +7 -0
- package/dist/components/molecules/svg/ProveCorrect.d.ts +7 -0
- package/dist/components/molecules/svg/ServiceLayers.d.ts +7 -0
- package/dist/components/molecules/svg/SharedReality.d.ts +7 -0
- package/dist/components/molecules/svg/StandardLibrary.d.ts +7 -0
- package/dist/components/molecules/svg/StateMachine.d.ts +7 -0
- package/dist/components/molecules/svg/WorldModel.d.ts +7 -0
- package/dist/components/molecules/svg/index.d.ts +16 -0
- package/dist/components/organisms/CaseStudyOrganism.d.ts +19 -0
- package/dist/components/organisms/FeatureGridOrganism.d.ts +20 -0
- package/dist/components/organisms/HeroOrganism.d.ts +18 -0
- package/dist/components/organisms/PricingOrganism.d.ts +19 -0
- package/dist/components/organisms/ShowcaseOrganism.d.ts +20 -0
- package/dist/components/organisms/StatsOrganism.d.ts +17 -0
- package/dist/components/organisms/StepFlowOrganism.d.ts +20 -0
- package/dist/components/organisms/TeamOrganism.d.ts +18 -0
- package/dist/components/organisms/game/three/index.cjs +2525 -0
- package/dist/components/organisms/game/three/index.js +1795 -50
- package/dist/components/organisms/index.d.ts +9 -0
- package/dist/components/organisms/marketing-types.d.ts +87 -0
- package/dist/components/templates/AboutPageTemplate.d.ts +26 -0
- package/dist/components/templates/FeatureDetailPageTemplate.d.ts +27 -0
- package/dist/components/templates/LandingPageTemplate.d.ts +31 -0
- package/dist/components/templates/PricingPageTemplate.d.ts +26 -0
- package/dist/components/templates/index.d.ts +4 -0
- package/dist/context/index.cjs +550 -0
- package/dist/context/index.js +420 -6
- package/dist/docs/index.cjs +4015 -0
- package/dist/docs/index.d.cts +412 -0
- package/dist/docs/index.d.ts +29 -0
- package/dist/docs/index.js +3977 -0
- package/dist/hooks/index.cjs +2606 -0
- package/dist/hooks/index.js +2535 -8
- package/dist/illustrations/index.cjs +3004 -0
- package/dist/illustrations/index.d.cts +261 -0
- package/dist/illustrations/index.d.ts +35 -0
- package/dist/illustrations/index.js +2971 -0
- package/dist/{chunk-XL7WB2O5.js → lib/index.cjs} +454 -274
- package/dist/lib/index.js +1407 -3
- package/dist/locales/index.cjs +340 -0
- package/dist/locales/index.js +105 -2
- package/dist/marketing/index.cjs +4683 -0
- package/dist/marketing/index.d.cts +831 -0
- package/dist/marketing/index.d.ts +62 -0
- package/dist/marketing/index.js +4626 -0
- package/dist/providers/index.cjs +4811 -0
- package/dist/providers/index.js +4765 -11
- package/dist/{chunk-K2D5D3WK.js → renderer/index.cjs} +101 -42
- package/dist/renderer/index.js +1036 -2
- package/dist/runtime/index.cjs +4400 -0
- package/dist/runtime/index.js +3615 -19
- package/dist/{chunk-N7MVUW4R.js → stores/index.cjs} +24 -1
- package/dist/stores/index.js +194 -2
- package/dist/tsup.config.d.ts +2 -1
- package/package.json +27 -12
- package/tailwind-preset.cjs +9 -0
- package/themes/index.css +22 -20
- package/dist/chunk-3HJHHULT.js +0 -93
- package/dist/chunk-3JGAROCW.js +0 -149
- package/dist/chunk-4N3BAPDB.js +0 -1667
- package/dist/chunk-CDIOHSKG.js +0 -661
- package/dist/chunk-DKQN5FVU.js +0 -279
- package/dist/chunk-JJHCOO34.js +0 -375
- package/dist/chunk-PKBMQBKP.js +0 -5
- package/dist/chunk-QIABKRCN.js +0 -107
- package/dist/chunk-SD3KVCY6.js +0 -1465
- package/dist/chunk-YXZM3WCF.js +0 -222
package/dist/chunk-CDIOHSKG.js
DELETED
|
@@ -1,661 +0,0 @@
|
|
|
1
|
-
import { useEventBus } from './chunk-YXZM3WCF.js';
|
|
2
|
-
import { en_default } from './chunk-QIABKRCN.js';
|
|
3
|
-
import React2, { createContext, useRef, useEffect, useCallback, useContext, useState, useMemo } from 'react';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
function useInfiniteScroll(onLoadMore, options = {}) {
|
|
7
|
-
const { rootMargin = "200px", hasMore = true, isLoading = false } = options;
|
|
8
|
-
const observerRef = useRef(null);
|
|
9
|
-
const callbackRef = useRef(onLoadMore);
|
|
10
|
-
callbackRef.current = onLoadMore;
|
|
11
|
-
const hasMoreRef = useRef(hasMore);
|
|
12
|
-
hasMoreRef.current = hasMore;
|
|
13
|
-
const isLoadingRef = useRef(isLoading);
|
|
14
|
-
isLoadingRef.current = isLoading;
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
return () => {
|
|
17
|
-
observerRef.current?.disconnect();
|
|
18
|
-
};
|
|
19
|
-
}, []);
|
|
20
|
-
const sentinelRef = useCallback((node) => {
|
|
21
|
-
observerRef.current?.disconnect();
|
|
22
|
-
if (!node) return;
|
|
23
|
-
observerRef.current = new IntersectionObserver(
|
|
24
|
-
(entries) => {
|
|
25
|
-
const entry = entries[0];
|
|
26
|
-
if (entry.isIntersecting && hasMoreRef.current && !isLoadingRef.current) {
|
|
27
|
-
callbackRef.current();
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
{ rootMargin }
|
|
31
|
-
);
|
|
32
|
-
observerRef.current.observe(node);
|
|
33
|
-
}, [rootMargin]);
|
|
34
|
-
return { sentinelRef };
|
|
35
|
-
}
|
|
36
|
-
var { $meta: _meta, ...coreMessages } = en_default;
|
|
37
|
-
var coreLocale = coreMessages;
|
|
38
|
-
var I18nContext = createContext({
|
|
39
|
-
locale: "en",
|
|
40
|
-
direction: "ltr",
|
|
41
|
-
t: (key) => coreLocale[key] ?? key
|
|
42
|
-
// core locale fallback
|
|
43
|
-
});
|
|
44
|
-
I18nContext.displayName = "I18nContext";
|
|
45
|
-
var I18nProvider = I18nContext.Provider;
|
|
46
|
-
function useTranslate() {
|
|
47
|
-
return useContext(I18nContext);
|
|
48
|
-
}
|
|
49
|
-
function createTranslate(messages) {
|
|
50
|
-
return (key, params) => {
|
|
51
|
-
let msg = messages[key] ?? coreLocale[key] ?? key;
|
|
52
|
-
if (params) {
|
|
53
|
-
for (const [k, v] of Object.entries(params)) {
|
|
54
|
-
msg = msg.split(`{{${k}}}`).join(String(v));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return msg;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
var queryStores = /* @__PURE__ */ new Map();
|
|
61
|
-
function getOrCreateStore(query) {
|
|
62
|
-
if (!queryStores.has(query)) {
|
|
63
|
-
queryStores.set(query, {
|
|
64
|
-
search: "",
|
|
65
|
-
filters: {},
|
|
66
|
-
sortField: void 0,
|
|
67
|
-
sortDirection: void 0,
|
|
68
|
-
listeners: /* @__PURE__ */ new Set()
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return queryStores.get(query);
|
|
72
|
-
}
|
|
73
|
-
function useQuerySingleton(query) {
|
|
74
|
-
const [, forceUpdate] = useState({});
|
|
75
|
-
if (!query) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
const store = useMemo(() => getOrCreateStore(query), [query]);
|
|
79
|
-
useMemo(() => {
|
|
80
|
-
const listener = () => forceUpdate({});
|
|
81
|
-
store.listeners.add(listener);
|
|
82
|
-
return () => {
|
|
83
|
-
store.listeners.delete(listener);
|
|
84
|
-
};
|
|
85
|
-
}, [store]);
|
|
86
|
-
const notifyListeners = useCallback(() => {
|
|
87
|
-
store.listeners.forEach((listener) => listener());
|
|
88
|
-
}, [store]);
|
|
89
|
-
const setSearch = useCallback((value) => {
|
|
90
|
-
store.search = value;
|
|
91
|
-
notifyListeners();
|
|
92
|
-
}, [store, notifyListeners]);
|
|
93
|
-
const setFilter = useCallback((key, value) => {
|
|
94
|
-
store.filters = { ...store.filters, [key]: value };
|
|
95
|
-
notifyListeners();
|
|
96
|
-
}, [store, notifyListeners]);
|
|
97
|
-
const clearFilters = useCallback(() => {
|
|
98
|
-
store.filters = {};
|
|
99
|
-
store.search = "";
|
|
100
|
-
notifyListeners();
|
|
101
|
-
}, [store, notifyListeners]);
|
|
102
|
-
const setSort = useCallback((field, direction) => {
|
|
103
|
-
store.sortField = field;
|
|
104
|
-
store.sortDirection = direction;
|
|
105
|
-
notifyListeners();
|
|
106
|
-
}, [store, notifyListeners]);
|
|
107
|
-
return {
|
|
108
|
-
search: store.search,
|
|
109
|
-
setSearch,
|
|
110
|
-
filters: store.filters,
|
|
111
|
-
setFilter,
|
|
112
|
-
clearFilters,
|
|
113
|
-
sortField: store.sortField,
|
|
114
|
-
sortDirection: store.sortDirection,
|
|
115
|
-
setSort
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function parseQueryBinding(binding) {
|
|
119
|
-
const cleaned = binding.startsWith("@") ? binding.slice(1) : binding;
|
|
120
|
-
const parts = cleaned.split(".");
|
|
121
|
-
return {
|
|
122
|
-
query: parts[0],
|
|
123
|
-
field: parts.length > 1 ? parts.slice(1).join(".") : void 0
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function useLongPress(onLongPress, options = {}) {
|
|
127
|
-
const { duration = 500, moveThreshold = 10 } = options;
|
|
128
|
-
const timerRef = useRef(null);
|
|
129
|
-
const startPos = useRef({ x: 0, y: 0 });
|
|
130
|
-
const isPressedRef = useRef(false);
|
|
131
|
-
const firedRef = useRef(false);
|
|
132
|
-
const cancel = useCallback(() => {
|
|
133
|
-
if (timerRef.current) {
|
|
134
|
-
clearTimeout(timerRef.current);
|
|
135
|
-
timerRef.current = null;
|
|
136
|
-
}
|
|
137
|
-
isPressedRef.current = false;
|
|
138
|
-
}, []);
|
|
139
|
-
const onPointerDown = useCallback((e) => {
|
|
140
|
-
firedRef.current = false;
|
|
141
|
-
startPos.current = { x: e.clientX, y: e.clientY };
|
|
142
|
-
isPressedRef.current = true;
|
|
143
|
-
timerRef.current = setTimeout(() => {
|
|
144
|
-
firedRef.current = true;
|
|
145
|
-
isPressedRef.current = false;
|
|
146
|
-
onLongPress();
|
|
147
|
-
}, duration);
|
|
148
|
-
}, [duration, onLongPress]);
|
|
149
|
-
const onPointerMove = useCallback((e) => {
|
|
150
|
-
if (!isPressedRef.current) return;
|
|
151
|
-
const dx = e.clientX - startPos.current.x;
|
|
152
|
-
const dy = e.clientY - startPos.current.y;
|
|
153
|
-
if (Math.sqrt(dx * dx + dy * dy) > moveThreshold) {
|
|
154
|
-
cancel();
|
|
155
|
-
}
|
|
156
|
-
}, [moveThreshold, cancel]);
|
|
157
|
-
const onPointerUp = useCallback(() => {
|
|
158
|
-
cancel();
|
|
159
|
-
}, [cancel]);
|
|
160
|
-
const onPointerCancel = useCallback(() => {
|
|
161
|
-
cancel();
|
|
162
|
-
}, [cancel]);
|
|
163
|
-
return {
|
|
164
|
-
onPointerDown,
|
|
165
|
-
onPointerMove,
|
|
166
|
-
onPointerUp,
|
|
167
|
-
onPointerCancel,
|
|
168
|
-
isPressed: isPressedRef.current
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function useSwipeGesture(callbacks, options = {}) {
|
|
172
|
-
const { threshold = 50, velocityThreshold = 0.3, preventDefault = false } = options;
|
|
173
|
-
const startX = useRef(0);
|
|
174
|
-
const startY = useRef(0);
|
|
175
|
-
const startTime = useRef(0);
|
|
176
|
-
const currentX = useRef(0);
|
|
177
|
-
const tracking = useRef(false);
|
|
178
|
-
const offsetXRef = useRef(0);
|
|
179
|
-
const isSwipingRef = useRef(false);
|
|
180
|
-
const onPointerDown = useCallback((e) => {
|
|
181
|
-
startX.current = e.clientX;
|
|
182
|
-
startY.current = e.clientY;
|
|
183
|
-
currentX.current = e.clientX;
|
|
184
|
-
startTime.current = Date.now();
|
|
185
|
-
tracking.current = true;
|
|
186
|
-
isSwipingRef.current = false;
|
|
187
|
-
offsetXRef.current = 0;
|
|
188
|
-
e.target.setPointerCapture?.(e.pointerId);
|
|
189
|
-
}, []);
|
|
190
|
-
const onPointerMove = useCallback((e) => {
|
|
191
|
-
if (!tracking.current) return;
|
|
192
|
-
if (preventDefault) e.preventDefault();
|
|
193
|
-
currentX.current = e.clientX;
|
|
194
|
-
const dx = e.clientX - startX.current;
|
|
195
|
-
const dy = e.clientY - startY.current;
|
|
196
|
-
if (Math.abs(dx) > 10 && Math.abs(dx) > Math.abs(dy)) {
|
|
197
|
-
isSwipingRef.current = true;
|
|
198
|
-
offsetXRef.current = dx;
|
|
199
|
-
}
|
|
200
|
-
}, [preventDefault]);
|
|
201
|
-
const onPointerUp = useCallback((e) => {
|
|
202
|
-
if (!tracking.current) return;
|
|
203
|
-
tracking.current = false;
|
|
204
|
-
const dx = e.clientX - startX.current;
|
|
205
|
-
const dy = e.clientY - startY.current;
|
|
206
|
-
const elapsed = Date.now() - startTime.current;
|
|
207
|
-
const velocity = Math.abs(dx) / Math.max(elapsed, 1);
|
|
208
|
-
offsetXRef.current = 0;
|
|
209
|
-
isSwipingRef.current = false;
|
|
210
|
-
if (Math.abs(dx) < threshold && velocity < velocityThreshold) return;
|
|
211
|
-
if (Math.abs(dx) > Math.abs(dy)) {
|
|
212
|
-
if (dx < -threshold) callbacks.onSwipeLeft?.();
|
|
213
|
-
else if (dx > threshold) callbacks.onSwipeRight?.();
|
|
214
|
-
} else {
|
|
215
|
-
if (dy < -threshold) callbacks.onSwipeUp?.();
|
|
216
|
-
else if (dy > threshold) callbacks.onSwipeDown?.();
|
|
217
|
-
}
|
|
218
|
-
}, [threshold, velocityThreshold, callbacks]);
|
|
219
|
-
const onPointerCancel = useCallback(() => {
|
|
220
|
-
tracking.current = false;
|
|
221
|
-
offsetXRef.current = 0;
|
|
222
|
-
isSwipingRef.current = false;
|
|
223
|
-
}, []);
|
|
224
|
-
return {
|
|
225
|
-
onPointerDown,
|
|
226
|
-
onPointerMove,
|
|
227
|
-
onPointerUp,
|
|
228
|
-
onPointerCancel,
|
|
229
|
-
offsetX: offsetXRef.current,
|
|
230
|
-
isSwiping: isSwipingRef.current
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
function useDragReorder(initialItems, onReorder) {
|
|
234
|
-
const [items, setItems] = useState(initialItems);
|
|
235
|
-
const [dragIndex, setDragIndex] = useState(-1);
|
|
236
|
-
const [dragOverIndex, setDragOverIndex] = useState(-1);
|
|
237
|
-
const itemsRef = useRef(initialItems);
|
|
238
|
-
if (initialItems !== itemsRef.current) {
|
|
239
|
-
itemsRef.current = initialItems;
|
|
240
|
-
setItems(initialItems);
|
|
241
|
-
}
|
|
242
|
-
const isDragging = dragIndex >= 0;
|
|
243
|
-
const handleDragStart = useCallback((index) => (e) => {
|
|
244
|
-
e.preventDefault();
|
|
245
|
-
setDragIndex(index);
|
|
246
|
-
setDragOverIndex(index);
|
|
247
|
-
e.target.setPointerCapture?.(e.pointerId);
|
|
248
|
-
}, []);
|
|
249
|
-
const handleDragMove = useCallback((index) => (e) => {
|
|
250
|
-
if (dragIndex < 0) return;
|
|
251
|
-
const target = document.elementFromPoint(e.clientX, e.clientY);
|
|
252
|
-
if (!target) return;
|
|
253
|
-
let el = target;
|
|
254
|
-
while (el && !el.dataset.dragIndex) {
|
|
255
|
-
el = el.parentElement;
|
|
256
|
-
}
|
|
257
|
-
if (el?.dataset.dragIndex) {
|
|
258
|
-
const overIndex = parseInt(el.dataset.dragIndex, 10);
|
|
259
|
-
if (!isNaN(overIndex) && overIndex !== dragOverIndex) {
|
|
260
|
-
setDragOverIndex(overIndex);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}, [dragIndex, dragOverIndex]);
|
|
264
|
-
const handleDragEnd = useCallback(() => {
|
|
265
|
-
if (dragIndex >= 0 && dragOverIndex >= 0 && dragIndex !== dragOverIndex) {
|
|
266
|
-
const newItems = [...items];
|
|
267
|
-
const [movedItem] = newItems.splice(dragIndex, 1);
|
|
268
|
-
newItems.splice(dragOverIndex, 0, movedItem);
|
|
269
|
-
setItems(newItems);
|
|
270
|
-
onReorder(dragIndex, dragOverIndex, items[dragIndex]);
|
|
271
|
-
}
|
|
272
|
-
setDragIndex(-1);
|
|
273
|
-
setDragOverIndex(-1);
|
|
274
|
-
}, [dragIndex, dragOverIndex, items, onReorder]);
|
|
275
|
-
const getDragHandleProps = useCallback((index) => ({
|
|
276
|
-
onPointerDown: handleDragStart(index),
|
|
277
|
-
style: { cursor: "grab", touchAction: "none" },
|
|
278
|
-
"aria-grabbed": dragIndex === index,
|
|
279
|
-
role: "button"
|
|
280
|
-
}), [handleDragStart, dragIndex]);
|
|
281
|
-
const getItemProps = useCallback((index) => ({
|
|
282
|
-
onPointerMove: handleDragMove(index),
|
|
283
|
-
onPointerUp: handleDragEnd,
|
|
284
|
-
"aria-dropeffect": "move",
|
|
285
|
-
"data-drag-index": String(index),
|
|
286
|
-
style: {
|
|
287
|
-
opacity: dragIndex === index ? 0.5 : 1,
|
|
288
|
-
transition: isDragging ? "transform 150ms ease" : void 0,
|
|
289
|
-
transform: isDragging && dragOverIndex >= 0 ? index === dragIndex ? "scale(1.02)" : index > dragIndex && index <= dragOverIndex ? "translateY(-100%)" : index < dragIndex && index >= dragOverIndex ? "translateY(100%)" : void 0 : void 0
|
|
290
|
-
}
|
|
291
|
-
}), [handleDragMove, handleDragEnd, dragIndex, dragOverIndex, isDragging]);
|
|
292
|
-
return {
|
|
293
|
-
items,
|
|
294
|
-
dragIndex,
|
|
295
|
-
dragOverIndex,
|
|
296
|
-
isDragging,
|
|
297
|
-
getDragHandleProps,
|
|
298
|
-
getItemProps
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
function usePullToRefresh(onRefresh, options = {}) {
|
|
302
|
-
const { threshold = 60, maxPull = 120 } = options;
|
|
303
|
-
const [pullDistance, setPullDistance] = useState(0);
|
|
304
|
-
const [isPulling, setIsPulling] = useState(false);
|
|
305
|
-
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
306
|
-
const startY = useRef(0);
|
|
307
|
-
const scrollTopRef = useRef(0);
|
|
308
|
-
const onTouchStart = useCallback((e) => {
|
|
309
|
-
const container = e.currentTarget;
|
|
310
|
-
scrollTopRef.current = container.scrollTop;
|
|
311
|
-
if (scrollTopRef.current <= 0) {
|
|
312
|
-
startY.current = e.touches[0].clientY;
|
|
313
|
-
setIsPulling(true);
|
|
314
|
-
}
|
|
315
|
-
}, []);
|
|
316
|
-
const onTouchMove = useCallback((e) => {
|
|
317
|
-
if (!isPulling || isRefreshing) return;
|
|
318
|
-
const container = e.currentTarget;
|
|
319
|
-
if (container.scrollTop > 0) {
|
|
320
|
-
setPullDistance(0);
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
const dy = e.touches[0].clientY - startY.current;
|
|
324
|
-
if (dy > 0) {
|
|
325
|
-
const distance = Math.min(dy * 0.5, maxPull);
|
|
326
|
-
setPullDistance(distance);
|
|
327
|
-
}
|
|
328
|
-
}, [isPulling, isRefreshing, maxPull]);
|
|
329
|
-
const onTouchEnd = useCallback(() => {
|
|
330
|
-
if (!isPulling) return;
|
|
331
|
-
setIsPulling(false);
|
|
332
|
-
if (pullDistance >= threshold && !isRefreshing) {
|
|
333
|
-
setIsRefreshing(true);
|
|
334
|
-
setPullDistance(threshold);
|
|
335
|
-
onRefresh();
|
|
336
|
-
} else {
|
|
337
|
-
setPullDistance(0);
|
|
338
|
-
}
|
|
339
|
-
}, [isPulling, pullDistance, threshold, isRefreshing, onRefresh]);
|
|
340
|
-
const endRefresh = useCallback(() => {
|
|
341
|
-
setIsRefreshing(false);
|
|
342
|
-
setPullDistance(0);
|
|
343
|
-
}, []);
|
|
344
|
-
const containerProps = {
|
|
345
|
-
onTouchStart,
|
|
346
|
-
onTouchMove,
|
|
347
|
-
onTouchEnd,
|
|
348
|
-
style: {
|
|
349
|
-
transform: pullDistance > 0 ? `translateY(${pullDistance}px)` : void 0,
|
|
350
|
-
transition: isPulling ? "none" : "transform 300ms ease-out"
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
return {
|
|
354
|
-
pullDistance,
|
|
355
|
-
isPulling,
|
|
356
|
-
isRefreshing,
|
|
357
|
-
containerProps,
|
|
358
|
-
endRefresh
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// hooks/useAuthContext.ts
|
|
363
|
-
function useAuthContext() {
|
|
364
|
-
return {
|
|
365
|
-
user: null,
|
|
366
|
-
loading: false,
|
|
367
|
-
signIn: void 0,
|
|
368
|
-
signOut: void 0
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
var SelectionContext = createContext(null);
|
|
372
|
-
var defaultCompareEntities = (a, b) => {
|
|
373
|
-
if (a === b) return true;
|
|
374
|
-
if (!a || !b) return false;
|
|
375
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
376
|
-
const aId = a.id;
|
|
377
|
-
const bId = b.id;
|
|
378
|
-
return aId !== void 0 && aId === bId;
|
|
379
|
-
}
|
|
380
|
-
return false;
|
|
381
|
-
};
|
|
382
|
-
function SelectionProvider({
|
|
383
|
-
children,
|
|
384
|
-
debug = false,
|
|
385
|
-
compareEntities = defaultCompareEntities
|
|
386
|
-
}) {
|
|
387
|
-
const eventBus = useEventBus();
|
|
388
|
-
const [selected, setSelectedState] = useState(null);
|
|
389
|
-
const setSelected = useCallback(
|
|
390
|
-
(entity) => {
|
|
391
|
-
setSelectedState(entity);
|
|
392
|
-
if (debug) {
|
|
393
|
-
console.log("[SelectionProvider] Selection set:", entity);
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
[debug]
|
|
397
|
-
);
|
|
398
|
-
const clearSelection = useCallback(() => {
|
|
399
|
-
setSelectedState(null);
|
|
400
|
-
if (debug) {
|
|
401
|
-
console.log("[SelectionProvider] Selection cleared");
|
|
402
|
-
}
|
|
403
|
-
}, [debug]);
|
|
404
|
-
const isSelected = useCallback(
|
|
405
|
-
(entity) => {
|
|
406
|
-
return compareEntities(selected, entity);
|
|
407
|
-
},
|
|
408
|
-
[selected, compareEntities]
|
|
409
|
-
);
|
|
410
|
-
useEffect(() => {
|
|
411
|
-
const handleSelect = (event) => {
|
|
412
|
-
const row = event.payload?.row;
|
|
413
|
-
if (row) {
|
|
414
|
-
setSelected(row);
|
|
415
|
-
if (debug) {
|
|
416
|
-
console.log(`[SelectionProvider] ${event.type} received:`, row);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
const handleDeselect = (event) => {
|
|
421
|
-
clearSelection();
|
|
422
|
-
if (debug) {
|
|
423
|
-
console.log(`[SelectionProvider] ${event.type} received - clearing selection`);
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
const unsubView = eventBus.on("UI:VIEW", handleSelect);
|
|
427
|
-
const unsubSelect = eventBus.on("UI:SELECT", handleSelect);
|
|
428
|
-
const unsubClose = eventBus.on("UI:CLOSE", handleDeselect);
|
|
429
|
-
const unsubDeselect = eventBus.on("UI:DESELECT", handleDeselect);
|
|
430
|
-
const unsubCancel = eventBus.on("UI:CANCEL", handleDeselect);
|
|
431
|
-
return () => {
|
|
432
|
-
unsubView();
|
|
433
|
-
unsubSelect();
|
|
434
|
-
unsubClose();
|
|
435
|
-
unsubDeselect();
|
|
436
|
-
unsubCancel();
|
|
437
|
-
};
|
|
438
|
-
}, [eventBus, setSelected, clearSelection, debug]);
|
|
439
|
-
const contextValue = {
|
|
440
|
-
selected,
|
|
441
|
-
setSelected,
|
|
442
|
-
clearSelection,
|
|
443
|
-
isSelected
|
|
444
|
-
};
|
|
445
|
-
return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue, children });
|
|
446
|
-
}
|
|
447
|
-
function useSelection() {
|
|
448
|
-
const context = useContext(SelectionContext);
|
|
449
|
-
if (!context) {
|
|
450
|
-
throw new Error("useSelection must be used within a SelectionProvider");
|
|
451
|
-
}
|
|
452
|
-
return context;
|
|
453
|
-
}
|
|
454
|
-
function useSelectionOptional() {
|
|
455
|
-
const context = useContext(SelectionContext);
|
|
456
|
-
return context;
|
|
457
|
-
}
|
|
458
|
-
var EntityDataContext = createContext(null);
|
|
459
|
-
function EntityDataProvider({
|
|
460
|
-
adapter,
|
|
461
|
-
children
|
|
462
|
-
}) {
|
|
463
|
-
return React2.createElement(
|
|
464
|
-
EntityDataContext.Provider,
|
|
465
|
-
{ value: adapter },
|
|
466
|
-
children
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
function useEntityDataAdapter() {
|
|
470
|
-
return useContext(EntityDataContext);
|
|
471
|
-
}
|
|
472
|
-
var entityDataKeys = {
|
|
473
|
-
all: ["entities"],
|
|
474
|
-
lists: () => [...entityDataKeys.all, "list"],
|
|
475
|
-
list: (entity, filters) => [...entityDataKeys.lists(), entity, filters],
|
|
476
|
-
details: () => [...entityDataKeys.all, "detail"],
|
|
477
|
-
detail: (entity, id) => [...entityDataKeys.details(), entity, id]
|
|
478
|
-
};
|
|
479
|
-
function useEntityList(entity, options = {}) {
|
|
480
|
-
const { skip = false } = options;
|
|
481
|
-
const adapter = useContext(EntityDataContext);
|
|
482
|
-
const adapterData = useMemo(() => {
|
|
483
|
-
if (!adapter || !entity || skip) return [];
|
|
484
|
-
return adapter.getData(entity);
|
|
485
|
-
}, [adapter, entity, skip, adapter?.isLoading]);
|
|
486
|
-
const [stubData, setStubData] = useState([]);
|
|
487
|
-
const [stubLoading, setStubLoading] = useState(!skip && !!entity && !adapter);
|
|
488
|
-
const [stubError, setStubError] = useState(null);
|
|
489
|
-
useEffect(() => {
|
|
490
|
-
if (adapter || skip || !entity) {
|
|
491
|
-
setStubLoading(false);
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
setStubLoading(true);
|
|
495
|
-
const t = setTimeout(() => {
|
|
496
|
-
setStubData([]);
|
|
497
|
-
setStubLoading(false);
|
|
498
|
-
}, 100);
|
|
499
|
-
return () => clearTimeout(t);
|
|
500
|
-
}, [entity, skip, adapter]);
|
|
501
|
-
if (adapter) {
|
|
502
|
-
return {
|
|
503
|
-
data: adapterData,
|
|
504
|
-
isLoading: adapter.isLoading,
|
|
505
|
-
error: adapter.error ? new Error(adapter.error) : null,
|
|
506
|
-
refetch: () => {
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
return { data: stubData, isLoading: stubLoading, error: stubError, refetch: () => {
|
|
511
|
-
} };
|
|
512
|
-
}
|
|
513
|
-
function useEntity(entity, id) {
|
|
514
|
-
const adapter = useContext(EntityDataContext);
|
|
515
|
-
const adapterData = useMemo(() => {
|
|
516
|
-
if (!adapter || !entity || !id) return null;
|
|
517
|
-
return adapter.getById(entity, id) ?? null;
|
|
518
|
-
}, [adapter, entity, id, adapter?.isLoading]);
|
|
519
|
-
const [stubData, setStubData] = useState(null);
|
|
520
|
-
const [stubLoading, setStubLoading] = useState(!!entity && !!id && !adapter);
|
|
521
|
-
const [stubError, setStubError] = useState(null);
|
|
522
|
-
useEffect(() => {
|
|
523
|
-
if (adapter || !entity || !id) {
|
|
524
|
-
setStubLoading(false);
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
setStubLoading(true);
|
|
528
|
-
const t = setTimeout(() => {
|
|
529
|
-
setStubData(null);
|
|
530
|
-
setStubLoading(false);
|
|
531
|
-
}, 100);
|
|
532
|
-
return () => clearTimeout(t);
|
|
533
|
-
}, [entity, id, adapter]);
|
|
534
|
-
if (adapter) {
|
|
535
|
-
return {
|
|
536
|
-
data: adapterData,
|
|
537
|
-
isLoading: adapter.isLoading,
|
|
538
|
-
error: adapter.error ? new Error(adapter.error) : null
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
return { data: stubData, isLoading: stubLoading, error: stubError };
|
|
542
|
-
}
|
|
543
|
-
function useEntityDetail(entity, id) {
|
|
544
|
-
const result = useEntity(entity, id);
|
|
545
|
-
return { ...result, refetch: () => {
|
|
546
|
-
} };
|
|
547
|
-
}
|
|
548
|
-
var suspenseCache = /* @__PURE__ */ new Map();
|
|
549
|
-
function getSuspenseCacheKey(entity, type, id) {
|
|
550
|
-
return id ? `${type}:${entity}:${id}` : `${type}:${entity}`;
|
|
551
|
-
}
|
|
552
|
-
function useEntityListSuspense(entity) {
|
|
553
|
-
const adapter = useContext(EntityDataContext);
|
|
554
|
-
if (adapter) {
|
|
555
|
-
if (adapter.isLoading) {
|
|
556
|
-
const cacheKey2 = getSuspenseCacheKey(entity, "list");
|
|
557
|
-
let entry2 = suspenseCache.get(cacheKey2);
|
|
558
|
-
if (!entry2 || entry2.status === "resolved") {
|
|
559
|
-
let resolve;
|
|
560
|
-
const promise = new Promise((r) => {
|
|
561
|
-
resolve = r;
|
|
562
|
-
});
|
|
563
|
-
entry2 = { promise, status: "pending" };
|
|
564
|
-
suspenseCache.set(cacheKey2, entry2);
|
|
565
|
-
const check = setInterval(() => {
|
|
566
|
-
if (!adapter.isLoading) {
|
|
567
|
-
clearInterval(check);
|
|
568
|
-
entry2.status = "resolved";
|
|
569
|
-
resolve();
|
|
570
|
-
}
|
|
571
|
-
}, 50);
|
|
572
|
-
}
|
|
573
|
-
if (entry2.status === "pending") {
|
|
574
|
-
throw entry2.promise;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
if (adapter.error) {
|
|
578
|
-
throw new Error(adapter.error);
|
|
579
|
-
}
|
|
580
|
-
return {
|
|
581
|
-
data: adapter.getData(entity),
|
|
582
|
-
refetch: () => {
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
const cacheKey = getSuspenseCacheKey(entity, "list");
|
|
587
|
-
let entry = suspenseCache.get(cacheKey);
|
|
588
|
-
if (!entry) {
|
|
589
|
-
let resolve;
|
|
590
|
-
const promise = new Promise((r) => {
|
|
591
|
-
resolve = r;
|
|
592
|
-
setTimeout(() => {
|
|
593
|
-
entry.status = "resolved";
|
|
594
|
-
resolve();
|
|
595
|
-
}, 100);
|
|
596
|
-
});
|
|
597
|
-
entry = { promise, status: "pending" };
|
|
598
|
-
suspenseCache.set(cacheKey, entry);
|
|
599
|
-
}
|
|
600
|
-
if (entry.status === "pending") {
|
|
601
|
-
throw entry.promise;
|
|
602
|
-
}
|
|
603
|
-
return { data: [], refetch: () => {
|
|
604
|
-
} };
|
|
605
|
-
}
|
|
606
|
-
function useEntitySuspense(entity, id) {
|
|
607
|
-
const adapter = useContext(EntityDataContext);
|
|
608
|
-
if (adapter) {
|
|
609
|
-
if (adapter.isLoading) {
|
|
610
|
-
const cacheKey2 = getSuspenseCacheKey(entity, "detail", id);
|
|
611
|
-
let entry2 = suspenseCache.get(cacheKey2);
|
|
612
|
-
if (!entry2 || entry2.status === "resolved") {
|
|
613
|
-
let resolve;
|
|
614
|
-
const promise = new Promise((r) => {
|
|
615
|
-
resolve = r;
|
|
616
|
-
});
|
|
617
|
-
entry2 = { promise, status: "pending" };
|
|
618
|
-
suspenseCache.set(cacheKey2, entry2);
|
|
619
|
-
const check = setInterval(() => {
|
|
620
|
-
if (!adapter.isLoading) {
|
|
621
|
-
clearInterval(check);
|
|
622
|
-
entry2.status = "resolved";
|
|
623
|
-
resolve();
|
|
624
|
-
}
|
|
625
|
-
}, 50);
|
|
626
|
-
}
|
|
627
|
-
if (entry2.status === "pending") {
|
|
628
|
-
throw entry2.promise;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
if (adapter.error) {
|
|
632
|
-
throw new Error(adapter.error);
|
|
633
|
-
}
|
|
634
|
-
return {
|
|
635
|
-
data: adapter.getById(entity, id) ?? null,
|
|
636
|
-
refetch: () => {
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
const cacheKey = getSuspenseCacheKey(entity, "detail", id);
|
|
641
|
-
let entry = suspenseCache.get(cacheKey);
|
|
642
|
-
if (!entry) {
|
|
643
|
-
let resolve;
|
|
644
|
-
const promise = new Promise((r) => {
|
|
645
|
-
resolve = r;
|
|
646
|
-
setTimeout(() => {
|
|
647
|
-
entry.status = "resolved";
|
|
648
|
-
resolve();
|
|
649
|
-
}, 100);
|
|
650
|
-
});
|
|
651
|
-
entry = { promise, status: "pending" };
|
|
652
|
-
suspenseCache.set(cacheKey, entry);
|
|
653
|
-
}
|
|
654
|
-
if (entry.status === "pending") {
|
|
655
|
-
throw entry.promise;
|
|
656
|
-
}
|
|
657
|
-
return { data: null, refetch: () => {
|
|
658
|
-
} };
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
export { EntityDataProvider, I18nProvider, SelectionContext, SelectionProvider, createTranslate, entityDataKeys, parseQueryBinding, useAuthContext, useDragReorder, useEntity, useEntityDataAdapter, useEntityDetail, useEntityList, useEntityListSuspense, useEntitySuspense, useInfiniteScroll, useLongPress, usePullToRefresh, useQuerySingleton, useSelection, useSelectionOptional, useSwipeGesture, useTranslate };
|