@pathscale/ui 0.0.105 → 0.0.107
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/streaming-table/StreamingTable.d.ts +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +497 -6
- package/dist/motion/driver.d.ts +5 -0
- package/dist/motion/easing.d.ts +2 -0
- package/dist/motion/engine.d.ts +4 -0
- package/dist/motion/index.d.ts +11 -0
- package/dist/motion/popmotion.d.ts +6 -0
- package/dist/motion/presets.d.ts +10 -0
- package/dist/motion/reduced-motion.d.ts +1 -0
- package/dist/motion/route.d.ts +11 -0
- package/dist/motion/solid/MotionDiv.d.ts +13 -0
- package/dist/motion/solid/index.d.ts +2 -0
- package/dist/motion/system.d.ts +20 -0
- package/dist/motion/tokens.d.ts +6 -0
- package/dist/motion/types.d.ts +39 -0
- package/package.json +7 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TableProps } from "../table";
|
|
2
|
-
import type { StreamingColumnDef, StreamingConfig } from "./types";
|
|
2
|
+
import type { StreamingColumnDef, StreamingConfig, SortingState } from "./types";
|
|
3
3
|
export type StreamingTableProps<TData> = {
|
|
4
4
|
data: TData[];
|
|
5
5
|
columns: StreamingColumnDef<TData>[];
|
|
@@ -21,6 +21,8 @@ export type StreamingTableProps<TData> = {
|
|
|
21
21
|
initialPage?: number;
|
|
22
22
|
/** Enable sorting (default: false) */
|
|
23
23
|
enableSorting?: boolean;
|
|
24
|
+
/** Initial sorting state (default: null) */
|
|
25
|
+
initialSorting?: SortingState;
|
|
24
26
|
} & Omit<TableProps, "children">;
|
|
25
27
|
declare const StreamingTable: <TData>(props: StreamingTableProps<TData>) => import("solid-js").JSX.Element;
|
|
26
28
|
export default StreamingTable;
|
package/dist/index.d.ts
CHANGED
|
@@ -90,4 +90,5 @@ export { default as Toggle } from "./components/toggle";
|
|
|
90
90
|
export { default as Tooltip } from "./components/tooltip";
|
|
91
91
|
export { default as WindowMockup, type WindowMockupProps, } from "./components/windowmockup";
|
|
92
92
|
export * from "./stores";
|
|
93
|
+
export * from "./motion";
|
|
93
94
|
export { default } from "./components/connectionstatus";
|
package/dist/index.js
CHANGED
|
@@ -269,19 +269,19 @@ function twJoin() {
|
|
|
269
269
|
let resolvedValue;
|
|
270
270
|
let string = '';
|
|
271
271
|
while(index < arguments.length)if (argument = arguments[index++]) {
|
|
272
|
-
if (resolvedValue =
|
|
272
|
+
if (resolvedValue = bundle_mjs_toValue(argument)) {
|
|
273
273
|
string && (string += ' ');
|
|
274
274
|
string += resolvedValue;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
return string;
|
|
278
278
|
}
|
|
279
|
-
const
|
|
279
|
+
const bundle_mjs_toValue = (mix)=>{
|
|
280
280
|
if ('string' == typeof mix) return mix;
|
|
281
281
|
let resolvedValue;
|
|
282
282
|
let string = '';
|
|
283
283
|
for(let k = 0; k < mix.length; k++)if (mix[k]) {
|
|
284
|
-
if (resolvedValue =
|
|
284
|
+
if (resolvedValue = bundle_mjs_toValue(mix[k])) {
|
|
285
285
|
string && (string += ' ');
|
|
286
286
|
string += resolvedValue;
|
|
287
287
|
}
|
|
@@ -12012,13 +12012,17 @@ const StreamingTable = (props)=>{
|
|
|
12012
12012
|
"enablePagination",
|
|
12013
12013
|
"pageSize",
|
|
12014
12014
|
"initialPage",
|
|
12015
|
-
"enableSorting"
|
|
12015
|
+
"enableSorting",
|
|
12016
|
+
"initialSorting"
|
|
12016
12017
|
]);
|
|
12017
12018
|
const store = createStreamingTableStore();
|
|
12018
|
-
const [sortingState, setSortingState] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)({
|
|
12019
|
+
const [sortingState, setSortingState] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(local.initialSorting ?? {
|
|
12019
12020
|
columnId: null,
|
|
12020
12021
|
direction: null
|
|
12021
12022
|
});
|
|
12023
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
12024
|
+
if (local.initialSorting) setSortingState(local.initialSorting);
|
|
12025
|
+
});
|
|
12022
12026
|
const config = {
|
|
12023
12027
|
maxBufferSize: local.streamingConfig?.maxBufferSize ?? 1000,
|
|
12024
12028
|
appendMode: local.streamingConfig?.appendMode ?? false
|
|
@@ -12919,4 +12923,491 @@ const WindowMockup = (props)=>{
|
|
|
12919
12923
|
})();
|
|
12920
12924
|
};
|
|
12921
12925
|
const windowmockup_WindowMockup = WindowMockup;
|
|
12922
|
-
|
|
12926
|
+
const easeOutCubic = (t)=>1 - Math.pow(1 - t, 3);
|
|
12927
|
+
const easeInCubic = (t)=>t * t * t;
|
|
12928
|
+
const easeInOutCubic = (t)=>t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
12929
|
+
const resolveEase = (easing)=>{
|
|
12930
|
+
if ("function" == typeof easing) return easing;
|
|
12931
|
+
switch(easing){
|
|
12932
|
+
case "ease-in":
|
|
12933
|
+
return easeInCubic;
|
|
12934
|
+
case "ease-in-out":
|
|
12935
|
+
return easeInOutCubic;
|
|
12936
|
+
case "linear":
|
|
12937
|
+
return (t)=>t;
|
|
12938
|
+
case "ease-out":
|
|
12939
|
+
default:
|
|
12940
|
+
return easeOutCubic;
|
|
12941
|
+
}
|
|
12942
|
+
};
|
|
12943
|
+
const immediateDriver = ({ to, onUpdate, onComplete })=>{
|
|
12944
|
+
onUpdate(to);
|
|
12945
|
+
onComplete?.();
|
|
12946
|
+
return {
|
|
12947
|
+
stop: ()=>{}
|
|
12948
|
+
};
|
|
12949
|
+
};
|
|
12950
|
+
let activeDriver = immediateDriver;
|
|
12951
|
+
const setMotionDriver = (driver)=>{
|
|
12952
|
+
activeDriver = driver;
|
|
12953
|
+
};
|
|
12954
|
+
const getMotionDriver = ()=>activeDriver;
|
|
12955
|
+
const resolveDuration = (transition)=>Math.max(0, (transition?.duration ?? 0) * 1000);
|
|
12956
|
+
const resolveDelay = (transition)=>Math.max(0, (transition?.delay ?? 0) * 1000);
|
|
12957
|
+
const readOpacity = (el)=>{
|
|
12958
|
+
const value = Number.parseFloat(getComputedStyle(el).opacity);
|
|
12959
|
+
return Number.isFinite(value) ? value : 1;
|
|
12960
|
+
};
|
|
12961
|
+
const runMotion = (el, from, to, transition, onComplete)=>{
|
|
12962
|
+
const duration = resolveDuration(transition);
|
|
12963
|
+
const delay = resolveDelay(transition);
|
|
12964
|
+
const ease = resolveEase(transition?.easing);
|
|
12965
|
+
const driver = getMotionDriver();
|
|
12966
|
+
const controls = [];
|
|
12967
|
+
const shouldTransform = void 0 !== from.x || void 0 !== from.y || void 0 !== from.scale || void 0 !== to.x || void 0 !== to.y || void 0 !== to.scale;
|
|
12968
|
+
const transformState = {
|
|
12969
|
+
x: from.x ?? 0,
|
|
12970
|
+
y: from.y ?? 0,
|
|
12971
|
+
scale: from.scale ?? 1
|
|
12972
|
+
};
|
|
12973
|
+
const applyTransform = ()=>{
|
|
12974
|
+
if (!shouldTransform) return;
|
|
12975
|
+
el.style.transform = `translate3d(${transformState.x}px, ${transformState.y}px, 0) scale(${transformState.scale})`;
|
|
12976
|
+
};
|
|
12977
|
+
if (void 0 !== from.opacity) el.style.opacity = String(from.opacity);
|
|
12978
|
+
applyTransform();
|
|
12979
|
+
const animationTargets = Object.keys(to);
|
|
12980
|
+
if (0 === animationTargets.length) {
|
|
12981
|
+
onComplete?.();
|
|
12982
|
+
return {
|
|
12983
|
+
stop: ()=>{}
|
|
12984
|
+
};
|
|
12985
|
+
}
|
|
12986
|
+
let remaining = animationTargets.length;
|
|
12987
|
+
const handleComplete = ()=>{
|
|
12988
|
+
remaining -= 1;
|
|
12989
|
+
if (remaining <= 0) onComplete?.();
|
|
12990
|
+
};
|
|
12991
|
+
const start = ()=>{
|
|
12992
|
+
animationTargets.forEach((key)=>{
|
|
12993
|
+
if ("opacity" === key) {
|
|
12994
|
+
const fromValue = from.opacity ?? (void 0 !== to.opacity ? readOpacity(el) : 1);
|
|
12995
|
+
const control = driver({
|
|
12996
|
+
from: fromValue,
|
|
12997
|
+
to: to.opacity ?? fromValue,
|
|
12998
|
+
duration,
|
|
12999
|
+
ease,
|
|
13000
|
+
onUpdate: (latest)=>{
|
|
13001
|
+
el.style.opacity = String(latest);
|
|
13002
|
+
},
|
|
13003
|
+
onComplete: handleComplete
|
|
13004
|
+
});
|
|
13005
|
+
controls.push(control);
|
|
13006
|
+
return;
|
|
13007
|
+
}
|
|
13008
|
+
const fromValue = "scale" === key ? from.scale ?? 1 : "x" === key ? from.x ?? 0 : from.y ?? 0;
|
|
13009
|
+
const toValue = to[key] ?? fromValue;
|
|
13010
|
+
const control = driver({
|
|
13011
|
+
from: fromValue,
|
|
13012
|
+
to: toValue,
|
|
13013
|
+
duration,
|
|
13014
|
+
ease,
|
|
13015
|
+
onUpdate: (latest)=>{
|
|
13016
|
+
if (!shouldTransform) return;
|
|
13017
|
+
if ("x" === key) transformState.x = latest;
|
|
13018
|
+
if ("y" === key) transformState.y = latest;
|
|
13019
|
+
if ("scale" === key) transformState.scale = latest;
|
|
13020
|
+
applyTransform();
|
|
13021
|
+
},
|
|
13022
|
+
onComplete: handleComplete
|
|
13023
|
+
});
|
|
13024
|
+
controls.push(control);
|
|
13025
|
+
});
|
|
13026
|
+
};
|
|
13027
|
+
let timeoutId = null;
|
|
13028
|
+
if (delay > 0) timeoutId = window.setTimeout(start, delay);
|
|
13029
|
+
else start();
|
|
13030
|
+
return {
|
|
13031
|
+
stop: ()=>{
|
|
13032
|
+
if (null !== timeoutId) clearTimeout(timeoutId);
|
|
13033
|
+
controls.forEach((control)=>control.stop());
|
|
13034
|
+
}
|
|
13035
|
+
};
|
|
13036
|
+
};
|
|
13037
|
+
const prefersReducedMotion = ()=>globalThis.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches ?? false;
|
|
13038
|
+
const motionDurations = {
|
|
13039
|
+
route: 0.18,
|
|
13040
|
+
routeAuth: 0.35,
|
|
13041
|
+
fast: 0.2,
|
|
13042
|
+
base: 0.3,
|
|
13043
|
+
slow: 0.45
|
|
13044
|
+
};
|
|
13045
|
+
const motionEasings = {
|
|
13046
|
+
out: "ease-out",
|
|
13047
|
+
inOut: "ease-in-out"
|
|
13048
|
+
};
|
|
13049
|
+
const motionDistances = {
|
|
13050
|
+
sm: 6,
|
|
13051
|
+
md: 12,
|
|
13052
|
+
lg: 20,
|
|
13053
|
+
slideIn: 40
|
|
13054
|
+
};
|
|
13055
|
+
const defaultMotionTokens = {
|
|
13056
|
+
durations: {
|
|
13057
|
+
...motionDurations
|
|
13058
|
+
},
|
|
13059
|
+
easings: {
|
|
13060
|
+
...motionEasings
|
|
13061
|
+
},
|
|
13062
|
+
distances: {
|
|
13063
|
+
...motionDistances
|
|
13064
|
+
}
|
|
13065
|
+
};
|
|
13066
|
+
const mergeDefined = (base, overrides)=>{
|
|
13067
|
+
const next = {
|
|
13068
|
+
...base
|
|
13069
|
+
};
|
|
13070
|
+
if (!overrides) return next;
|
|
13071
|
+
for (const [key, value] of Object.entries(overrides))if (void 0 !== value) next[key] = value;
|
|
13072
|
+
return next;
|
|
13073
|
+
};
|
|
13074
|
+
const mergeMotionTokens = (base, overrides)=>({
|
|
13075
|
+
durations: mergeDefined(base.durations, overrides?.durations),
|
|
13076
|
+
easings: mergeDefined(base.easings, overrides?.easings),
|
|
13077
|
+
distances: mergeDefined(base.distances, overrides?.distances)
|
|
13078
|
+
});
|
|
13079
|
+
const createMotionPresets = (tokens)=>{
|
|
13080
|
+
const durations = tokens.durations;
|
|
13081
|
+
const easings = tokens.easings;
|
|
13082
|
+
const distances = tokens.distances;
|
|
13083
|
+
return {
|
|
13084
|
+
route: {
|
|
13085
|
+
initial: {
|
|
13086
|
+
opacity: 0
|
|
13087
|
+
},
|
|
13088
|
+
animate: {
|
|
13089
|
+
opacity: 1
|
|
13090
|
+
},
|
|
13091
|
+
exit: {
|
|
13092
|
+
opacity: 0
|
|
13093
|
+
},
|
|
13094
|
+
transition: {
|
|
13095
|
+
duration: durations.route,
|
|
13096
|
+
easing: easings.out
|
|
13097
|
+
}
|
|
13098
|
+
},
|
|
13099
|
+
routeAuth: {
|
|
13100
|
+
initial: {
|
|
13101
|
+
opacity: 0,
|
|
13102
|
+
x: distances.slideIn
|
|
13103
|
+
},
|
|
13104
|
+
animate: {
|
|
13105
|
+
opacity: 1,
|
|
13106
|
+
x: 0
|
|
13107
|
+
},
|
|
13108
|
+
exit: {
|
|
13109
|
+
opacity: 0,
|
|
13110
|
+
x: -distances.slideIn
|
|
13111
|
+
},
|
|
13112
|
+
transition: {
|
|
13113
|
+
duration: durations.routeAuth,
|
|
13114
|
+
easing: easings.inOut
|
|
13115
|
+
}
|
|
13116
|
+
},
|
|
13117
|
+
routeAuthBack: {
|
|
13118
|
+
initial: {
|
|
13119
|
+
opacity: 0,
|
|
13120
|
+
x: -distances.slideIn
|
|
13121
|
+
},
|
|
13122
|
+
animate: {
|
|
13123
|
+
opacity: 1,
|
|
13124
|
+
x: 0
|
|
13125
|
+
},
|
|
13126
|
+
exit: {
|
|
13127
|
+
opacity: 0,
|
|
13128
|
+
x: distances.slideIn
|
|
13129
|
+
},
|
|
13130
|
+
transition: {
|
|
13131
|
+
duration: durations.routeAuth,
|
|
13132
|
+
easing: easings.inOut
|
|
13133
|
+
}
|
|
13134
|
+
},
|
|
13135
|
+
authSwap: {
|
|
13136
|
+
initial: {
|
|
13137
|
+
opacity: 0.92
|
|
13138
|
+
},
|
|
13139
|
+
animate: {
|
|
13140
|
+
opacity: 1
|
|
13141
|
+
},
|
|
13142
|
+
exit: {
|
|
13143
|
+
opacity: 0.92
|
|
13144
|
+
},
|
|
13145
|
+
transition: {
|
|
13146
|
+
duration: durations.fast,
|
|
13147
|
+
easing: easings.out
|
|
13148
|
+
}
|
|
13149
|
+
},
|
|
13150
|
+
fade: {
|
|
13151
|
+
initial: {
|
|
13152
|
+
opacity: 0
|
|
13153
|
+
},
|
|
13154
|
+
animate: {
|
|
13155
|
+
opacity: 1
|
|
13156
|
+
},
|
|
13157
|
+
exit: {
|
|
13158
|
+
opacity: 0
|
|
13159
|
+
},
|
|
13160
|
+
transition: {
|
|
13161
|
+
duration: durations.base,
|
|
13162
|
+
easing: easings.out,
|
|
13163
|
+
delay: 0.08
|
|
13164
|
+
}
|
|
13165
|
+
},
|
|
13166
|
+
fadeUp: {
|
|
13167
|
+
initial: {
|
|
13168
|
+
opacity: 0,
|
|
13169
|
+
y: distances.sm
|
|
13170
|
+
},
|
|
13171
|
+
animate: {
|
|
13172
|
+
opacity: 1,
|
|
13173
|
+
y: 0
|
|
13174
|
+
},
|
|
13175
|
+
exit: {
|
|
13176
|
+
opacity: 0,
|
|
13177
|
+
y: -distances.sm
|
|
13178
|
+
},
|
|
13179
|
+
transition: {
|
|
13180
|
+
duration: durations.base,
|
|
13181
|
+
easing: easings.out,
|
|
13182
|
+
delay: 0.08
|
|
13183
|
+
}
|
|
13184
|
+
},
|
|
13185
|
+
scaleIn: {
|
|
13186
|
+
initial: {
|
|
13187
|
+
opacity: 0,
|
|
13188
|
+
scale: 0.96
|
|
13189
|
+
},
|
|
13190
|
+
animate: {
|
|
13191
|
+
opacity: 1,
|
|
13192
|
+
scale: 1
|
|
13193
|
+
},
|
|
13194
|
+
exit: {
|
|
13195
|
+
opacity: 0,
|
|
13196
|
+
scale: 0.96
|
|
13197
|
+
},
|
|
13198
|
+
transition: {
|
|
13199
|
+
duration: durations.fast,
|
|
13200
|
+
easing: easings.out,
|
|
13201
|
+
delay: 0.08
|
|
13202
|
+
}
|
|
13203
|
+
},
|
|
13204
|
+
routeDashboard: {
|
|
13205
|
+
initial: {
|
|
13206
|
+
opacity: 0,
|
|
13207
|
+
y: distances.md,
|
|
13208
|
+
scale: 0.985
|
|
13209
|
+
},
|
|
13210
|
+
animate: {
|
|
13211
|
+
opacity: 1,
|
|
13212
|
+
y: 0,
|
|
13213
|
+
scale: 1
|
|
13214
|
+
},
|
|
13215
|
+
exit: {
|
|
13216
|
+
opacity: 0,
|
|
13217
|
+
y: -distances.sm,
|
|
13218
|
+
scale: 0.985
|
|
13219
|
+
},
|
|
13220
|
+
transition: {
|
|
13221
|
+
duration: durations.route,
|
|
13222
|
+
easing: easings.out
|
|
13223
|
+
}
|
|
13224
|
+
}
|
|
13225
|
+
};
|
|
13226
|
+
};
|
|
13227
|
+
const motionPresets = createMotionPresets(defaultMotionTokens);
|
|
13228
|
+
const routeTransition = motionPresets.route;
|
|
13229
|
+
const noMotion = {
|
|
13230
|
+
initial: {
|
|
13231
|
+
opacity: 1,
|
|
13232
|
+
y: 0,
|
|
13233
|
+
x: 0,
|
|
13234
|
+
scale: 1
|
|
13235
|
+
},
|
|
13236
|
+
animate: {
|
|
13237
|
+
opacity: 1,
|
|
13238
|
+
y: 0,
|
|
13239
|
+
x: 0,
|
|
13240
|
+
scale: 1
|
|
13241
|
+
},
|
|
13242
|
+
exit: {
|
|
13243
|
+
opacity: 1,
|
|
13244
|
+
y: 0,
|
|
13245
|
+
x: 0,
|
|
13246
|
+
scale: 1
|
|
13247
|
+
},
|
|
13248
|
+
transition: {
|
|
13249
|
+
duration: 0
|
|
13250
|
+
}
|
|
13251
|
+
};
|
|
13252
|
+
const presets_getPreset = (name)=>motionPresets[name];
|
|
13253
|
+
const presets_registerPreset = (name, preset)=>{
|
|
13254
|
+
motionPresets[name] = preset;
|
|
13255
|
+
};
|
|
13256
|
+
const presets_resolvePreset = (name, options)=>{
|
|
13257
|
+
const reduce = options?.reduceMotion ?? prefersReducedMotion();
|
|
13258
|
+
if (reduce) return noMotion;
|
|
13259
|
+
return motionPresets[name] ?? noMotion;
|
|
13260
|
+
};
|
|
13261
|
+
var MotionDiv_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div>");
|
|
13262
|
+
const MotionDiv_MotionDiv = (props)=>{
|
|
13263
|
+
const [local, rest] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
13264
|
+
"initial",
|
|
13265
|
+
"animate",
|
|
13266
|
+
"exit",
|
|
13267
|
+
"transition",
|
|
13268
|
+
"isExiting",
|
|
13269
|
+
"onExitComplete",
|
|
13270
|
+
"animateKey",
|
|
13271
|
+
"children",
|
|
13272
|
+
"ref"
|
|
13273
|
+
]);
|
|
13274
|
+
const [elementRef, setElementRef] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(void 0);
|
|
13275
|
+
let activeControl = null;
|
|
13276
|
+
let lastTrigger;
|
|
13277
|
+
let lastIsExiting = false;
|
|
13278
|
+
let hasAnimated = false;
|
|
13279
|
+
const stopActive = ()=>{
|
|
13280
|
+
activeControl?.stop();
|
|
13281
|
+
activeControl = null;
|
|
13282
|
+
};
|
|
13283
|
+
const runEnter = (target, from, to, transition)=>{
|
|
13284
|
+
if (!to) return;
|
|
13285
|
+
stopActive();
|
|
13286
|
+
activeControl = runMotion(target, from ?? {}, to ?? {}, transition);
|
|
13287
|
+
};
|
|
13288
|
+
const runExit = (target, from, to, transition, onComplete)=>{
|
|
13289
|
+
if (!to) return void onComplete?.();
|
|
13290
|
+
stopActive();
|
|
13291
|
+
activeControl = runMotion(target, from ?? {}, to ?? {}, transition, onComplete);
|
|
13292
|
+
};
|
|
13293
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
13294
|
+
const target = elementRef();
|
|
13295
|
+
if (!target) return;
|
|
13296
|
+
const isExiting = Boolean(local.isExiting);
|
|
13297
|
+
const trigger = local.animateKey;
|
|
13298
|
+
const initial = local.initial;
|
|
13299
|
+
const animate = local.animate;
|
|
13300
|
+
const exit = local.exit;
|
|
13301
|
+
const transition = local.transition;
|
|
13302
|
+
const onComplete = local.onExitComplete;
|
|
13303
|
+
if (isExiting) {
|
|
13304
|
+
if (!lastIsExiting) {
|
|
13305
|
+
lastIsExiting = true;
|
|
13306
|
+
hasAnimated = false;
|
|
13307
|
+
runExit(target, animate ?? initial, exit, transition, onComplete);
|
|
13308
|
+
}
|
|
13309
|
+
return;
|
|
13310
|
+
}
|
|
13311
|
+
lastIsExiting = false;
|
|
13312
|
+
if (!hasAnimated || trigger !== lastTrigger) {
|
|
13313
|
+
lastTrigger = trigger;
|
|
13314
|
+
hasAnimated = true;
|
|
13315
|
+
runEnter(target, initial, animate, transition);
|
|
13316
|
+
}
|
|
13317
|
+
});
|
|
13318
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
|
|
13319
|
+
stopActive();
|
|
13320
|
+
});
|
|
13321
|
+
return (()=>{
|
|
13322
|
+
var _el$ = MotionDiv_tmpl$();
|
|
13323
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)((el)=>{
|
|
13324
|
+
setElementRef(el);
|
|
13325
|
+
if ("function" == typeof local.ref) local.ref(el);
|
|
13326
|
+
}, _el$);
|
|
13327
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, rest, false, true);
|
|
13328
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, ()=>local.children);
|
|
13329
|
+
return _el$;
|
|
13330
|
+
})();
|
|
13331
|
+
};
|
|
13332
|
+
const MotionDiv = MotionDiv_MotionDiv;
|
|
13333
|
+
const createPopmotionDriver = (animate)=>(options)=>animate(options);
|
|
13334
|
+
const enablePopmotion = (animate)=>{
|
|
13335
|
+
setMotionDriver(createPopmotionDriver(animate));
|
|
13336
|
+
};
|
|
13337
|
+
const createMotionSystem = (config)=>{
|
|
13338
|
+
let tokens = mergeMotionTokens(defaultMotionTokens, config?.tokens);
|
|
13339
|
+
let customPresets = {
|
|
13340
|
+
...config?.presets ?? {}
|
|
13341
|
+
};
|
|
13342
|
+
let basePresets = createMotionPresets(tokens);
|
|
13343
|
+
let presets = {
|
|
13344
|
+
...basePresets,
|
|
13345
|
+
...customPresets
|
|
13346
|
+
};
|
|
13347
|
+
const reduceMotion = config?.reduceMotion ?? prefersReducedMotion;
|
|
13348
|
+
let noMotionPreset = config?.noMotionPreset ?? noMotion;
|
|
13349
|
+
const rebuildPresets = ()=>{
|
|
13350
|
+
basePresets = createMotionPresets(tokens);
|
|
13351
|
+
presets = {
|
|
13352
|
+
...basePresets,
|
|
13353
|
+
...customPresets
|
|
13354
|
+
};
|
|
13355
|
+
};
|
|
13356
|
+
const getTokens = ()=>tokens;
|
|
13357
|
+
const getPresets = ()=>presets;
|
|
13358
|
+
const getPreset = (name)=>presets[name];
|
|
13359
|
+
const registerPreset = (name, preset)=>{
|
|
13360
|
+
customPresets = {
|
|
13361
|
+
...customPresets,
|
|
13362
|
+
[name]: preset
|
|
13363
|
+
};
|
|
13364
|
+
presets = {
|
|
13365
|
+
...basePresets,
|
|
13366
|
+
...customPresets
|
|
13367
|
+
};
|
|
13368
|
+
};
|
|
13369
|
+
const overrideTokens = (overrides)=>{
|
|
13370
|
+
tokens = mergeMotionTokens(tokens, overrides);
|
|
13371
|
+
rebuildPresets();
|
|
13372
|
+
return tokens;
|
|
13373
|
+
};
|
|
13374
|
+
const resolvePreset = (name, options)=>{
|
|
13375
|
+
const reduce = options?.reduceMotion ?? reduceMotion();
|
|
13376
|
+
if (reduce) return noMotionPreset;
|
|
13377
|
+
return presets[name] ?? noMotionPreset;
|
|
13378
|
+
};
|
|
13379
|
+
const setNoMotionPreset = (preset)=>{
|
|
13380
|
+
noMotionPreset = preset;
|
|
13381
|
+
};
|
|
13382
|
+
return {
|
|
13383
|
+
getTokens,
|
|
13384
|
+
getPresets,
|
|
13385
|
+
getPreset,
|
|
13386
|
+
registerPreset,
|
|
13387
|
+
overrideTokens,
|
|
13388
|
+
resolvePreset,
|
|
13389
|
+
setNoMotionPreset
|
|
13390
|
+
};
|
|
13391
|
+
};
|
|
13392
|
+
const createRouteTransitionResolver = (options)=>{
|
|
13393
|
+
const resolvePreset = options.resolvePreset ?? ((name)=>motionPresets[name]);
|
|
13394
|
+
const reduceMotion = options.reduceMotion ?? prefersReducedMotion;
|
|
13395
|
+
const fallback = options.fallback ?? routeTransition;
|
|
13396
|
+
const reduceMotionPreset = options.reduceMotionPreset ?? noMotion;
|
|
13397
|
+
return (from, to)=>{
|
|
13398
|
+
if (reduceMotion()) return reduceMotionPreset;
|
|
13399
|
+
for (const rule of options.rules){
|
|
13400
|
+
const result = rule(from, to);
|
|
13401
|
+
if (result) {
|
|
13402
|
+
if ("string" == typeof result) {
|
|
13403
|
+
const resolved = resolvePreset(result);
|
|
13404
|
+
if (resolved) return resolved;
|
|
13405
|
+
continue;
|
|
13406
|
+
}
|
|
13407
|
+
return result;
|
|
13408
|
+
}
|
|
13409
|
+
}
|
|
13410
|
+
return fallback ?? noMotion;
|
|
13411
|
+
};
|
|
13412
|
+
};
|
|
13413
|
+
export { accordion_Accordion as Accordion, alert_Alert as Alert, artboard_Artboard as Artboard, avatar as Avatar, background_Background as Background, Badge, bottom_sheet_BottomSheet as BottomSheet, Breadcrumbs, breadcrumbs_BreadcrumbsItem as BreadcrumbsItem, browsermockup_BrowserMockup as BrowserMockup, button_Button as Button, Calendar, card_Card as Card, carousel_Carousel as Carousel, chatbubble_ChatBubble as ChatBubble, checkbox_Checkbox as Checkbox, codemockup_CodeMockup as CodeMockup, CodeMockupLine, collapse_Collapse as Collapse, CollapseContent, CollapseDetails, CollapseTitle, connectionstatus_ConnectionStatus as ConnectionStatus, CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, EnhancedTable, FileInput, flex_Flex as Flex, footer_Footer as Footer, form_Form as Form, Grid, hero_Hero as Hero, icon_Icon as Icon, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, link_Link as Link, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, MotionDiv, navbar_Navbar as Navbar, pagination_Pagination as Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, range_Range as Range, Rating, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, showcase_section_ShowcaseSection as ShowcaseSection, sidenav_Sidenav as Sidenav, sidenav_SidenavButton as SidenavButton, sidenav_SidenavGroup as SidenavGroup, sidenav_SidenavItem as SidenavItem, sidenav_SidenavLink as SidenavLink, sidenav_SidenavMenu as SidenavMenu, skeleton_Skeleton as Skeleton, Stack, stat_card_StatCard as StatCard, stats_Stats as Stats, status_Status as Status, steps as Steps, streaming_table_StreamingTable as StreamingTable, Summary, SvgBackground, Swap, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, windowmockup_WindowMockup as WindowMockup, createMotionPresets, createMotionSystem, createPopmotionDriver, createRouteTransitionResolver, createStreamingTableStore, connectionstatus_ConnectionStatus as default, defaultMotionTokens, enablePopmotion, getMotionDriver, presets_getPreset as getPreset, immediateDriver, mergeMotionTokens, motionDistances, motionDurations, motionEasings, motionPresets, noMotion, prefersReducedMotion, presets_registerPreset as registerPreset, resolveEase, presets_resolvePreset as resolvePreset, routeTransition, runMotion, setMotionDriver, toastStore, useDesktop, useFormValidation };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { MotionDriver, MotionDriverOptions, MotionEasing, MotionPreset, MotionState, MotionTransition, MotionTokenOverrides, MotionTokens, } from "./types";
|
|
2
|
+
export { resolveEase } from "./easing";
|
|
3
|
+
export { getMotionDriver, setMotionDriver, immediateDriver } from "./driver";
|
|
4
|
+
export { runMotion } from "./engine";
|
|
5
|
+
export { prefersReducedMotion } from "./reduced-motion";
|
|
6
|
+
export { defaultMotionTokens, mergeMotionTokens, motionDurations, motionDistances, motionEasings, } from "./tokens";
|
|
7
|
+
export { getPreset, createMotionPresets, motionPresets, noMotion, registerPreset, resolvePreset, routeTransition, } from "./presets";
|
|
8
|
+
export { MotionDiv, type MotionDivProps } from "./solid";
|
|
9
|
+
export { createPopmotionDriver, enablePopmotion, type PopmotionAnimate, } from "./popmotion";
|
|
10
|
+
export { createMotionSystem, type MotionSystemConfig } from "./system";
|
|
11
|
+
export { createRouteTransitionResolver, type RouteTransitionRule, type RouteTransitionRuleResult, type RouteTransitionResolverOptions, } from "./route";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MotionDriver, MotionDriverOptions } from "./types";
|
|
2
|
+
export type PopmotionAnimate = (options: MotionDriverOptions) => {
|
|
3
|
+
stop: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const createPopmotionDriver: (animate: PopmotionAnimate) => MotionDriver;
|
|
6
|
+
export declare const enablePopmotion: (animate: PopmotionAnimate) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MotionPreset, MotionTokens } from "./types";
|
|
2
|
+
export declare const createMotionPresets: (tokens: MotionTokens) => Record<string, MotionPreset>;
|
|
3
|
+
export declare const motionPresets: Record<string, MotionPreset>;
|
|
4
|
+
export declare const routeTransition: MotionPreset;
|
|
5
|
+
export declare const noMotion: MotionPreset;
|
|
6
|
+
export declare const getPreset: (name: string) => MotionPreset;
|
|
7
|
+
export declare const registerPreset: (name: string, preset: MotionPreset) => void;
|
|
8
|
+
export declare const resolvePreset: (name: string, options?: {
|
|
9
|
+
reduceMotion?: boolean;
|
|
10
|
+
}) => MotionPreset;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const prefersReducedMotion: () => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MotionPreset } from "./types";
|
|
2
|
+
export type RouteTransitionRuleResult = MotionPreset | string | null | undefined;
|
|
3
|
+
export type RouteTransitionRule = (from: string, to: string) => RouteTransitionRuleResult;
|
|
4
|
+
export type RouteTransitionResolverOptions = {
|
|
5
|
+
rules: RouteTransitionRule[];
|
|
6
|
+
fallback?: MotionPreset;
|
|
7
|
+
resolvePreset?: (name: string) => MotionPreset | undefined;
|
|
8
|
+
reduceMotion?: () => boolean;
|
|
9
|
+
reduceMotionPreset?: MotionPreset;
|
|
10
|
+
};
|
|
11
|
+
export declare const createRouteTransitionResolver: (options: RouteTransitionResolverOptions) => (from: string, to: string) => MotionPreset;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Component, type JSX } from "solid-js";
|
|
2
|
+
import type { MotionState, MotionTransition } from "../types";
|
|
3
|
+
export interface MotionDivProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
initial?: MotionState;
|
|
5
|
+
animate?: MotionState;
|
|
6
|
+
exit?: MotionState;
|
|
7
|
+
transition?: MotionTransition;
|
|
8
|
+
isExiting?: boolean;
|
|
9
|
+
onExitComplete?: () => void;
|
|
10
|
+
animateKey?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare const MotionDiv: Component<MotionDivProps>;
|
|
13
|
+
export default MotionDiv;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MotionPreset, MotionTokenOverrides, MotionTokens } from "./types";
|
|
2
|
+
export type MotionSystemConfig = {
|
|
3
|
+
tokens?: MotionTokenOverrides;
|
|
4
|
+
presets?: Record<string, MotionPreset>;
|
|
5
|
+
reduceMotion?: () => boolean;
|
|
6
|
+
noMotionPreset?: MotionPreset;
|
|
7
|
+
};
|
|
8
|
+
export declare const createMotionSystem: (config?: MotionSystemConfig) => {
|
|
9
|
+
getTokens: () => MotionTokens;
|
|
10
|
+
getPresets: () => {
|
|
11
|
+
[x: string]: MotionPreset;
|
|
12
|
+
};
|
|
13
|
+
getPreset: (name: string) => MotionPreset;
|
|
14
|
+
registerPreset: (name: string, preset: MotionPreset) => void;
|
|
15
|
+
overrideTokens: (overrides: MotionTokenOverrides) => MotionTokens;
|
|
16
|
+
resolvePreset: (name: string, options?: {
|
|
17
|
+
reduceMotion?: boolean;
|
|
18
|
+
}) => MotionPreset;
|
|
19
|
+
setNoMotionPreset: (preset: MotionPreset) => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MotionEasing, MotionTokens, MotionTokenOverrides } from "./types";
|
|
2
|
+
export declare const motionDurations: Record<string, number>;
|
|
3
|
+
export declare const motionEasings: Record<string, MotionEasing>;
|
|
4
|
+
export declare const motionDistances: Record<string, number>;
|
|
5
|
+
export declare const defaultMotionTokens: MotionTokens;
|
|
6
|
+
export declare const mergeMotionTokens: (base: MotionTokens, overrides?: MotionTokenOverrides) => MotionTokens;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type MotionState = {
|
|
2
|
+
opacity?: number;
|
|
3
|
+
x?: number;
|
|
4
|
+
y?: number;
|
|
5
|
+
scale?: number;
|
|
6
|
+
};
|
|
7
|
+
export type MotionEasing = "ease-in" | "ease-out" | "ease-in-out" | "linear" | ((t: number) => number);
|
|
8
|
+
export type MotionTransition = {
|
|
9
|
+
duration?: number;
|
|
10
|
+
easing?: MotionEasing;
|
|
11
|
+
delay?: number;
|
|
12
|
+
};
|
|
13
|
+
export type MotionPreset = {
|
|
14
|
+
initial: MotionState;
|
|
15
|
+
animate: MotionState;
|
|
16
|
+
exit: MotionState;
|
|
17
|
+
transition?: MotionTransition;
|
|
18
|
+
};
|
|
19
|
+
export type MotionTokens = {
|
|
20
|
+
durations: Record<string, number>;
|
|
21
|
+
easings: Record<string, MotionEasing>;
|
|
22
|
+
distances: Record<string, number>;
|
|
23
|
+
};
|
|
24
|
+
export type MotionTokenOverrides = {
|
|
25
|
+
durations?: Partial<Record<string, number>>;
|
|
26
|
+
easings?: Partial<Record<string, MotionEasing>>;
|
|
27
|
+
distances?: Partial<Record<string, number>>;
|
|
28
|
+
};
|
|
29
|
+
export type MotionDriverOptions = {
|
|
30
|
+
from: number;
|
|
31
|
+
to: number;
|
|
32
|
+
duration: number;
|
|
33
|
+
ease: (t: number) => number;
|
|
34
|
+
onUpdate: (value: number) => void;
|
|
35
|
+
onComplete?: () => void;
|
|
36
|
+
};
|
|
37
|
+
export type MotionDriver = (options: MotionDriverOptions) => {
|
|
38
|
+
stop: () => void;
|
|
39
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pathscale/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.107",
|
|
4
4
|
"author": "pathscale",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,8 +64,14 @@
|
|
|
64
64
|
"@felte/validator-zod": "^1.0.0",
|
|
65
65
|
"@tanstack/solid-table": "^8.0.0",
|
|
66
66
|
"solid-js": "^1.9",
|
|
67
|
+
"popmotion": "^11.0.5",
|
|
67
68
|
"zod": "^3.22.0"
|
|
68
69
|
},
|
|
70
|
+
"peerDependenciesMeta": {
|
|
71
|
+
"popmotion": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
69
75
|
"scripts": {
|
|
70
76
|
"build": "rslib build && bun scripts/copy-css.js",
|
|
71
77
|
"build:watch": "rslib build --watch",
|