@datatechsolutions/ui 2.7.140 → 2.8.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/dist/chunk-3GDQP6AS.mjs +15 -0
- package/dist/chunk-3GDQP6AS.mjs.map +1 -0
- package/dist/{chunk-7VN2V7CT.mjs → chunk-6RXLXX5U.mjs} +17 -37
- package/dist/chunk-6RXLXX5U.mjs.map +1 -0
- package/dist/chunk-7VJ7CMMT.mjs +96 -0
- package/dist/chunk-7VJ7CMMT.mjs.map +1 -0
- package/dist/{chunk-WXI7OCNY.js → chunk-HVDLO6TN.js} +3860 -602
- package/dist/chunk-HVDLO6TN.js.map +1 -0
- package/dist/{chunk-SCGWR7XZ.mjs → chunk-NNYNGCT5.mjs} +3583 -324
- package/dist/chunk-NNYNGCT5.mjs.map +1 -0
- package/dist/chunk-QWG2FMUN.mjs +60 -0
- package/dist/chunk-QWG2FMUN.mjs.map +1 -0
- package/dist/{chunk-27M5YIVF.js → chunk-RQMB4Q4G.js} +112 -136
- package/dist/chunk-RQMB4Q4G.js.map +1 -0
- package/dist/chunk-S7KHTUHA.js +65 -0
- package/dist/chunk-S7KHTUHA.js.map +1 -0
- package/dist/chunk-VUNV25KB.js +18 -0
- package/dist/chunk-VUNV25KB.js.map +1 -0
- package/dist/chunk-YXN2K77G.js +102 -0
- package/dist/chunk-YXN2K77G.js.map +1 -0
- package/dist/index.d.mts +45 -5
- package/dist/index.d.ts +45 -5
- package/dist/index.js +381 -338
- package/dist/index.mjs +4 -1
- package/dist/lib/i18n-context.d.mts +36 -0
- package/dist/lib/i18n-context.d.ts +36 -0
- package/dist/lib/i18n-context.js +30 -0
- package/dist/lib/i18n-context.js.map +1 -0
- package/dist/lib/i18n-context.mjs +5 -0
- package/dist/lib/i18n-context.mjs.map +1 -0
- package/dist/lib/router-context.d.mts +35 -0
- package/dist/lib/router-context.d.ts +35 -0
- package/dist/lib/router-context.js +26 -0
- package/dist/lib/router-context.js.map +1 -0
- package/dist/lib/router-context.mjs +5 -0
- package/dist/lib/router-context.mjs.map +1 -0
- package/dist/navigation-ANFMVDVW.mjs +2445 -0
- package/dist/navigation-ANFMVDVW.mjs.map +1 -0
- package/dist/navigation-JQ2TJKKI.js +2447 -0
- package/dist/navigation-JQ2TJKKI.js.map +1 -0
- package/dist/{use-haptic-RDQNJYBE.js → use-haptic-2SHBMEY5.js} +3 -2
- package/dist/{use-haptic-RDQNJYBE.js.map → use-haptic-2SHBMEY5.js.map} +1 -1
- package/dist/use-haptic-4UCNQATC.mjs +5 -0
- package/dist/{use-haptic-TCMOLPGA.mjs.map → use-haptic-4UCNQATC.mjs.map} +1 -1
- package/dist/workflow/graph-node.js +1 -0
- package/dist/workflow/graph-node.mjs +1 -0
- package/dist/workflow/index.js +135 -133
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/index.mjs +7 -5
- package/dist/workflow/index.mjs.map +1 -1
- package/dist/workflow/utils.js +1 -0
- package/dist/workflow/utils.mjs +1 -0
- package/dist/workflow/workflow-canvas.js +7 -4
- package/dist/workflow/workflow-canvas.mjs +6 -3
- package/dist/workflow/workflow-preview-canvas.js +1 -1
- package/dist/workflow/workflow-preview-canvas.mjs +1 -1
- package/package.json +12 -4
- package/dist/chunk-27M5YIVF.js.map +0 -1
- package/dist/chunk-7VN2V7CT.mjs.map +0 -1
- package/dist/chunk-SCGWR7XZ.mjs.map +0 -1
- package/dist/chunk-WXI7OCNY.js.map +0 -1
- package/dist/use-haptic-TCMOLPGA.mjs +0 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext, forwardRef } from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/lib/router-context.tsx
|
|
6
|
+
var RouterContext = createContext(null);
|
|
7
|
+
function RouterProvider({ children, value }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(RouterContext.Provider, { value, children });
|
|
9
|
+
}
|
|
10
|
+
function useRouter() {
|
|
11
|
+
const context = useContext(RouterContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
return {
|
|
14
|
+
push: (href) => {
|
|
15
|
+
window.location.href = href;
|
|
16
|
+
},
|
|
17
|
+
replace: (href) => {
|
|
18
|
+
window.location.replace(href);
|
|
19
|
+
},
|
|
20
|
+
back: () => {
|
|
21
|
+
window.history.back();
|
|
22
|
+
},
|
|
23
|
+
forward: () => {
|
|
24
|
+
window.history.forward();
|
|
25
|
+
},
|
|
26
|
+
refresh: () => {
|
|
27
|
+
window.location.reload();
|
|
28
|
+
},
|
|
29
|
+
prefetch: () => {
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
push: context.navigate,
|
|
35
|
+
replace: context.replace,
|
|
36
|
+
back: context.back,
|
|
37
|
+
forward: context.forward,
|
|
38
|
+
refresh: () => {
|
|
39
|
+
window.location.reload();
|
|
40
|
+
},
|
|
41
|
+
prefetch: context.prefetch
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function usePathname() {
|
|
45
|
+
const context = useContext(RouterContext);
|
|
46
|
+
return context?.pathname ?? (typeof window !== "undefined" ? window.location.pathname : "/");
|
|
47
|
+
}
|
|
48
|
+
function useLink() {
|
|
49
|
+
const context = useContext(RouterContext);
|
|
50
|
+
if (!context) {
|
|
51
|
+
return forwardRef(function FallbackLink({ href, children, ...props }, ref) {
|
|
52
|
+
return /* @__PURE__ */ jsx("a", { href, ref, ...props, children });
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return context.Link;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { RouterProvider, useLink, usePathname, useRouter };
|
|
59
|
+
//# sourceMappingURL=chunk-QWG2FMUN.mjs.map
|
|
60
|
+
//# sourceMappingURL=chunk-QWG2FMUN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/router-context.tsx"],"names":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AAU,WAAW,aAAa,CAAA;AACxC,EAAA,OAAO,SAAS,QAAA,KAAa,OAAO,WAAW,WAAA,GAAc,MAAA,CAAO,SAAS,QAAA,GAAW,GAAA,CAAA;AAC1F;AAEO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO,UAAA,CAAyC,SAAS,YAAA,CAAa,EAAE,MAAM,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,EAAK;AACvG,MAAA,2BAAQ,GAAA,EAAA,EAAE,IAAA,EAAY,GAAA,EAAW,GAAG,OAAQ,QAAA,EAAS,CAAA;AAAA,IACvD,CAAC,CAAA;AAAA,EACH;AACA,EAAA,OAAO,OAAA,CAAQ,IAAA;AACjB","file":"chunk-QWG2FMUN.mjs","sourcesContent":["import { createContext, useContext, forwardRef, type ReactNode, type AnchorHTMLAttributes, type Ref } from 'react'\n\nexport type LinkProps = { href: string; children?: ReactNode; ref?: Ref<HTMLAnchorElement> } & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>\n\nexport type LinkComponent = React.FC<LinkProps>\n\nexport interface RouterContextValue {\n pathname: string\n navigate: (href: string) => void\n replace: (href: string) => void\n back: () => void\n forward: () => void\n prefetch: (href: string) => void\n Link: LinkComponent\n}\n\nconst RouterContext = createContext<RouterContextValue | null>(null)\n\nexport type RouterProviderProps = {\n children: ReactNode\n value: RouterContextValue\n}\n\nexport function RouterProvider({ children, value }: RouterProviderProps) {\n return <RouterContext.Provider value={value}>{children}</RouterContext.Provider>\n}\n\nexport function useRouter() {\n const context = useContext(RouterContext)\n if (!context) {\n return {\n push: (href: string) => { window.location.href = href },\n replace: (href: string) => { window.location.replace(href) },\n back: () => { window.history.back() },\n forward: () => { window.history.forward() },\n refresh: () => { window.location.reload() },\n prefetch: () => {},\n }\n }\n return {\n push: context.navigate,\n replace: context.replace,\n back: context.back,\n forward: context.forward,\n refresh: () => { window.location.reload() },\n prefetch: context.prefetch,\n }\n}\n\nexport function usePathname(): string {\n const context = useContext(RouterContext)\n return context?.pathname ?? (typeof window !== 'undefined' ? window.location.pathname : '/')\n}\n\nexport function useLink(): LinkComponent {\n const context = useContext(RouterContext)\n if (!context) {\n return forwardRef<HTMLAnchorElement, LinkProps>(function FallbackLink({ href, children, ...props }, ref) {\n return <a href={href} ref={ref} {...props}>{children}</a>\n }) as unknown as LinkComponent\n }\n return context.Link\n}\n"]}
|