@mks2508/mks-ui 0.6.5 → 0.6.7
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/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts +10 -2
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.js +13 -25
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module-7y-To7On.css +20 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module.js +0 -0
- package/dist/react-ui/ui/Tabs/Tabs.module-CFzRKHsx.css +38 -0
- package/dist/react-ui/ui/Tabs/Tabs.module.js +0 -0
- package/dist/react-ui/ui/Tabs/index.d.ts +1 -0
- package/dist/react-ui/ui/Tabs/index.d.ts.map +1 -1
- package/dist/react-ui/ui/Tabs/index.js +1 -22
- package/package.json +4 -2
- /package/dist/react-ui/blocks/Terminal/panel/{terminal-filter-dropdown.module-C6oDcFBS.css → terminal-filter-dropdown.module-p4Aks9qK.css} +0 -0
- /package/dist/react-ui/blocks/Terminal/panel/{terminal-session-tabs.module-D_-sgyza.css → terminal-session-tabs.module-D7g8zk0W.css} +0 -0
- /package/dist/react-ui/components/MorphingPopover/{morphing-popover.module-B1ftlaYj.css → morphing-popover.module-s63snw7C.css} +0 -0
- /package/dist/react-ui/ui/DynamicToggle/{DynamicToggle.module-D2yWn1ia.css → DynamicToggle.module-BE6uirOX.css} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './useViewTransitions.module.css';
|
|
1
2
|
import type { IViewTransitionsOptions, IViewTransitionsAPI } from '../Morph.types';
|
|
2
3
|
/**
|
|
3
4
|
* Hook for the View Transitions API.
|
|
@@ -10,18 +11,25 @@ import type { IViewTransitionsOptions, IViewTransitionsAPI } from '../Morph.type
|
|
|
10
11
|
* - Firefox 144+
|
|
11
12
|
* - Safari latest
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* View transition styles are applied via CSS module, eliminating
|
|
15
|
+
* the need for runtime style injection. Elements should have
|
|
16
|
+
* `view-transition-name` applied via inline style or CSS class.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Optional view transition name (deprecated, use inline style)
|
|
14
19
|
* @returns View Transitions API with support detection and transition trigger
|
|
15
20
|
*
|
|
16
21
|
* @example
|
|
17
22
|
* ```tsx
|
|
18
|
-
* const { isSupported, startTransition } = useViewTransitions(
|
|
23
|
+
* const { isSupported, startTransition } = useViewTransitions();
|
|
19
24
|
*
|
|
20
25
|
* const handleTransition = async () => {
|
|
21
26
|
* await startTransition(() => {
|
|
22
27
|
* setActiveImage(nextImage);
|
|
23
28
|
* });
|
|
24
29
|
* };
|
|
30
|
+
*
|
|
31
|
+
* // Apply view-transition-name to elements
|
|
32
|
+
* <div style={{ viewTransitionName: 'hero' }}>...</div>
|
|
25
33
|
* ```
|
|
26
34
|
*/
|
|
27
35
|
export declare function useViewTransitions(options?: IViewTransitionsOptions): IViewTransitionsAPI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useViewTransitions.d.ts","sourceRoot":"","sources":["../../../../../../src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useViewTransitions.d.ts","sourceRoot":"","sources":["../../../../../../src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts"],"names":[],"mappings":"AAGA,OAAO,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,mBAAmB,CAoCzF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import "./useViewTransitions.module.js";
|
|
3
4
|
import { useCallback, useMemo, useRef } from "react";
|
|
4
5
|
|
|
5
6
|
//#region src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts
|
|
@@ -14,22 +15,29 @@ import { useCallback, useMemo, useRef } from "react";
|
|
|
14
15
|
* - Firefox 144+
|
|
15
16
|
* - Safari latest
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
+
* View transition styles are applied via CSS module, eliminating
|
|
19
|
+
* the need for runtime style injection. Elements should have
|
|
20
|
+
* `view-transition-name` applied via inline style or CSS class.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Optional view transition name (deprecated, use inline style)
|
|
18
23
|
* @returns View Transitions API with support detection and transition trigger
|
|
19
24
|
*
|
|
20
25
|
* @example
|
|
21
26
|
* ```tsx
|
|
22
|
-
* const { isSupported, startTransition } = useViewTransitions(
|
|
27
|
+
* const { isSupported, startTransition } = useViewTransitions();
|
|
23
28
|
*
|
|
24
29
|
* const handleTransition = async () => {
|
|
25
30
|
* await startTransition(() => {
|
|
26
31
|
* setActiveImage(nextImage);
|
|
27
32
|
* });
|
|
28
33
|
* };
|
|
34
|
+
*
|
|
35
|
+
* // Apply view-transition-name to elements
|
|
36
|
+
* <div style={{ viewTransitionName: 'hero' }}>...</div>
|
|
29
37
|
* ```
|
|
30
38
|
*/
|
|
31
39
|
function useViewTransitions(options) {
|
|
32
|
-
|
|
40
|
+
useRef(options);
|
|
33
41
|
const typesRef = useRef(options?.types || []);
|
|
34
42
|
const isSupported = useMemo(() => {
|
|
35
43
|
if (typeof document === "undefined") return false;
|
|
@@ -45,30 +53,10 @@ function useViewTransitions(options) {
|
|
|
45
53
|
await callback();
|
|
46
54
|
return;
|
|
47
55
|
}
|
|
48
|
-
const viewTransitionName = optionsRef.current?.name;
|
|
49
|
-
const setupStyles = () => {
|
|
50
|
-
if (viewTransitionName) {
|
|
51
|
-
const styleEl = document.createElement("style");
|
|
52
|
-
styleEl.id = `view-transition-${viewTransitionName}`;
|
|
53
|
-
styleEl.textContent = `
|
|
54
|
-
::view-transition-old(${viewTransitionName}),
|
|
55
|
-
::view-transition-new(${viewTransitionName}) {
|
|
56
|
-
animation-duration: 300ms;
|
|
57
|
-
animation-timing-function: ease-out;
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
document.head.appendChild(styleEl);
|
|
61
|
-
return () => {
|
|
62
|
-
styleEl.remove();
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return () => {};
|
|
66
|
-
};
|
|
67
|
-
const cleanup = setupStyles();
|
|
68
56
|
try {
|
|
69
57
|
await document.startViewTransition(callback).finished;
|
|
70
|
-
}
|
|
71
|
-
|
|
58
|
+
} catch (error) {
|
|
59
|
+
await callback();
|
|
72
60
|
}
|
|
73
61
|
}, []),
|
|
74
62
|
setTypes
|
package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module-7y-To7On.css
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View Transitions API - Default transition styles.
|
|
3
|
+
*
|
|
4
|
+
* These styles apply to all view-transition pseudo-elements by default,
|
|
5
|
+
* eliminating the need for dynamic style injection based on transition names.
|
|
6
|
+
*
|
|
7
|
+
* Usage: Apply `view-transition-name` via inline style or CSS variable:
|
|
8
|
+
* <div style={{ viewTransitionName: 'hero' }}>...</div>
|
|
9
|
+
*
|
|
10
|
+
* Or via CSS:
|
|
11
|
+
* .my-element { view-transition-name: hero; }
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/* Default animation for all view transitions */
|
|
15
|
+
::view-transition-old(*),
|
|
16
|
+
::view-transition-new(*) {
|
|
17
|
+
animation-duration: 300ms;
|
|
18
|
+
animation-timing-function: ease-out;
|
|
19
|
+
}
|
|
20
|
+
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs CSS Anchor Positioning.
|
|
3
|
+
*
|
|
4
|
+
* Zero-JS position tracking for the sliding indicator using CSS Anchor API.
|
|
5
|
+
* The indicator automatically follows the active tab via anchor positioning.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Scope anchors per Tabs instance */
|
|
9
|
+
[data-slot="tabs-list"] {
|
|
10
|
+
anchor-scope: --tabs-active;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Active tab becomes the anchor */
|
|
14
|
+
[data-slot="tabs-tab"][data-active] {
|
|
15
|
+
anchor-name: --tabs-active;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Indicator follows the active anchor */
|
|
19
|
+
[data-slot="tabs-indicator"] {
|
|
20
|
+
position-anchor: --tabs-active;
|
|
21
|
+
left: anchor(left);
|
|
22
|
+
right: anchor(right);
|
|
23
|
+
transition:
|
|
24
|
+
top 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
25
|
+
left 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
26
|
+
right 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
27
|
+
bottom 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
28
|
+
width 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
29
|
+
height 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Respect reduced motion preference */
|
|
33
|
+
@media (prefers-reduced-motion: reduce) {
|
|
34
|
+
[data-slot="tabs-indicator"] {
|
|
35
|
+
transition-duration: 0ms;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tabsListVariants, tabsTabVariants, tabsIndicatorVariants } from './Tabs.styles';
|
|
2
|
+
import './Tabs.module.css';
|
|
2
3
|
import type { ITabsProps, ITabsHighlightProps, ITabsHighlightItemProps, ITabsListProps, ITabsTabProps, ITabsPanelProps, ITabsPanelsProps } from './Tabs.types';
|
|
3
4
|
/**
|
|
4
5
|
* Root Tabs component -- provides active tab value context and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/Tabs/index.tsx"],"names":[],"mappings":"AAoEA,OAAO,EAEL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACtB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/Tabs/index.tsx"],"names":[],"mappings":"AAoEA,OAAO,EAEL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAEV,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAqBtB;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAiB/D;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,aAAa,CAAC,EACrB,UAA4D,EAC5D,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,mBAAmB,2CAcrB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,QAAQ,CAAC,EAChB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,2CA8BhB;AAMD;;;;;;;;;;;;;;GAcG;AACH,iBAAS,iBAAiB,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAEtE;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAgB5E;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,WAAW,EACX,UAAiD,EACjD,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,2CAsBjB;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,UAAU,CAAC,KAAK,EAAE,gBAAgB,2CAiD1C;AAMD,OAAO,EACL,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,qBAAqB,GACtB,CAAC;AAGF,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { AutoHeight } from "../../primitives/AutoHeight/index.js";
|
|
|
6
6
|
import { getStrictContext } from "../../lib/get-strict-context.js";
|
|
7
7
|
import { useControlledState } from "../../hooks/State/UseControlledState.js";
|
|
8
8
|
import { tabsIndicatorVariants, tabsListVariants, tabsStyles, tabsTabVariants } from "./Tabs.styles.js";
|
|
9
|
+
import "./Tabs.module.js";
|
|
9
10
|
import * as React$1 from "react";
|
|
10
11
|
import { AnimatePresence, motion } from "motion/react";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -61,27 +62,6 @@ import { Tabs } from "@base-ui/react/tabs";
|
|
|
61
62
|
* </Tabs>
|
|
62
63
|
* ```
|
|
63
64
|
*/
|
|
64
|
-
const TABS_CSS_ID = "mks-tabs-anchor-css";
|
|
65
|
-
const TABS_ANCHOR_CSS = `
|
|
66
|
-
[data-slot="tabs-list"]{anchor-scope:--tabs-active}
|
|
67
|
-
[data-slot="tabs-tab"][data-active]{anchor-name:--tabs-active}
|
|
68
|
-
[data-slot="tabs-indicator"]{position-anchor:--tabs-active;left:anchor(left);right:anchor(right);transition:top 200ms cubic-bezier(.25,.46,.45,.94),left 200ms cubic-bezier(.25,.46,.45,.94),right 200ms cubic-bezier(.25,.46,.45,.94),bottom 200ms cubic-bezier(.25,.46,.45,.94),width 200ms cubic-bezier(.25,.46,.45,.94),height 200ms cubic-bezier(.25,.46,.45,.94)}
|
|
69
|
-
@media(prefers-reduced-motion:reduce){[data-slot="tabs-indicator"]{transition-duration:0ms}}
|
|
70
|
-
`;
|
|
71
|
-
/**
|
|
72
|
-
* Injects the CSS Anchor Positioning rules into the document head once.
|
|
73
|
-
* Safe for SSR -- no-ops on the server.
|
|
74
|
-
*/
|
|
75
|
-
function useTabsAnchorCSS() {
|
|
76
|
-
React$1.useEffect(() => {
|
|
77
|
-
if (typeof document === "undefined") return;
|
|
78
|
-
if (document.getElementById(TABS_CSS_ID)) return;
|
|
79
|
-
const style = document.createElement("style");
|
|
80
|
-
style.id = TABS_CSS_ID;
|
|
81
|
-
style.textContent = TABS_ANCHOR_CSS;
|
|
82
|
-
document.head.appendChild(style);
|
|
83
|
-
}, []);
|
|
84
|
-
}
|
|
85
65
|
const [TabsProvider, useTabs] = getStrictContext("TabsContext");
|
|
86
66
|
const TabsVariantCtx = React$1.createContext({});
|
|
87
67
|
/**
|
|
@@ -175,7 +155,6 @@ function TabsHighlight({ transition = {
|
|
|
175
155
|
* ```
|
|
176
156
|
*/
|
|
177
157
|
function TabsList({ variant, size, indicator, slots, className, children, ...props }) {
|
|
178
|
-
useTabsAnchorCSS();
|
|
179
158
|
const resolvedVariant = variant ?? "default";
|
|
180
159
|
const showIndicator = indicator ?? !["ghost", "underline"].includes(resolvedVariant);
|
|
181
160
|
return /* @__PURE__ */ jsx(TabsVariantCtx.Provider, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mks2508/mks-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "UI component library - Shadcn/Animate UI based with DevEnv components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -82,7 +82,9 @@
|
|
|
82
82
|
"import": "./dist/react-ui/blocks/Terminal/display.js",
|
|
83
83
|
"default": "./dist/react-ui/blocks/Terminal/display.js"
|
|
84
84
|
},
|
|
85
|
-
"./index.css":
|
|
85
|
+
"./index.css": {
|
|
86
|
+
"style": "./dist/index.css"
|
|
87
|
+
}
|
|
86
88
|
},
|
|
87
89
|
"files": [
|
|
88
90
|
"dist"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|