feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
Lago committed 2026-04-14 18:52:25 +00:00
1 parent 1199eff6c3
commit dfa4010406
34820 files changed
+1003810 -202

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { OptionsType } from './Options';
import { CreatePluginType } from 'embla-carousel';
declare module 'embla-carousel' {
interface EmblaPluginsType {
autoplay: AutoplayType;
}
interface EmblaEventListType {
autoplayPlay: 'autoplay:play';
autoplayStop: 'autoplay:stop';
autoplaySelect: 'autoplay:select';
autoplayTimerSet: 'autoplay:timerset';
autoplayTimerStopped: 'autoplay:timerstopped';
}
}
export type AutoplayType = CreatePluginType<{
play: (jump?: boolean) => void;
stop: () => void;
reset: () => void;
isPlaying: () => boolean;
timeUntilNext: () => number | null;
}, OptionsType>;
export type AutoplayOptionsType = AutoplayType['options'];
declare function Autoplay(userOptions?: AutoplayOptionsType): AutoplayType;
declare namespace Autoplay {
let globalOptions: AutoplayOptionsType | undefined;
}
export default Autoplay;
+14
View File
@@ -0,0 +1,14 @@
import { CreateOptionsType, EmblaCarouselType } from 'embla-carousel';
export type DelayOptionType = number | ((scrollSnaps: number[], emblaApi: EmblaCarouselType) => number[]);
export type RootNodeType = null | ((emblaRoot: HTMLElement) => HTMLElement | null);
export type OptionsType = CreateOptionsType<{
delay: DelayOptionType;
jump: boolean;
playOnInit: boolean;
stopOnFocusIn: boolean;
stopOnInteraction: boolean;
stopOnMouseEnter: boolean;
stopOnLastSnap: boolean;
rootNode: RootNodeType;
}>;
export declare const defaultOptions: OptionsType;
+4
View File
@@ -0,0 +1,4 @@
import { EmblaCarouselType } from 'embla-carousel/components/EmblaCarousel';
import { DelayOptionType, RootNodeType } from './Options';
export declare function normalizeDelay(emblaApi: EmblaCarouselType, delay: DelayOptionType): number[];
export declare function getAutoplayRootNode(emblaApi: EmblaCarouselType, rootNode: RootNodeType): HTMLElement;
+197
View File
@@ -0,0 +1,197 @@
'use strict';
const defaultOptions = {
active: true,
breakpoints: {},
delay: 4000,
jump: false,
playOnInit: true,
stopOnFocusIn: true,
stopOnInteraction: true,
stopOnMouseEnter: false,
stopOnLastSnap: false,
rootNode: null
};
function normalizeDelay(emblaApi, delay) {
const scrollSnaps = emblaApi.scrollSnapList();
if (typeof delay === 'number') {
return scrollSnaps.map(() => delay);
}
return delay(scrollSnaps, emblaApi);
}
function getAutoplayRootNode(emblaApi, rootNode) {
const emblaRootNode = emblaApi.rootNode();
return rootNode && rootNode(emblaRootNode) || emblaRootNode;
}
function Autoplay(userOptions = {}) {
let options;
let emblaApi;
let destroyed;
let delay;
let timerStartTime = null;
let timerId = 0;
let autoplayActive = false;
let mouseIsOver = false;
let playOnDocumentVisible = false;
let jump = false;
function init(emblaApiInstance, optionsHandler) {
emblaApi = emblaApiInstance;
const {
mergeOptions,
optionsAtMedia
} = optionsHandler;
const optionsBase = mergeOptions(defaultOptions, Autoplay.globalOptions);
const allOptions = mergeOptions(optionsBase, userOptions);
options = optionsAtMedia(allOptions);
if (emblaApi.scrollSnapList().length <= 1) return;
jump = options.jump;
destroyed = false;
delay = normalizeDelay(emblaApi, options.delay);
const {
eventStore,
ownerDocument
} = emblaApi.internalEngine();
const isDraggable = !!emblaApi.internalEngine().options.watchDrag;
const root = getAutoplayRootNode(emblaApi, options.rootNode);
eventStore.add(ownerDocument, 'visibilitychange', visibilityChange);
if (isDraggable) {
emblaApi.on('pointerDown', pointerDown);
}
if (isDraggable && !options.stopOnInteraction) {
emblaApi.on('pointerUp', pointerUp);
}
if (options.stopOnMouseEnter) {
eventStore.add(root, 'mouseenter', mouseEnter);
}
if (options.stopOnMouseEnter && !options.stopOnInteraction) {
eventStore.add(root, 'mouseleave', mouseLeave);
}
if (options.stopOnFocusIn) {
emblaApi.on('slideFocusStart', stopAutoplay);
}
if (options.stopOnFocusIn && !options.stopOnInteraction) {
eventStore.add(emblaApi.containerNode(), 'focusout', startAutoplay);
}
if (options.playOnInit) startAutoplay();
}
function destroy() {
emblaApi.off('pointerDown', pointerDown).off('pointerUp', pointerUp).off('slideFocusStart', stopAutoplay);
stopAutoplay();
destroyed = true;
autoplayActive = false;
}
function setTimer() {
const {
ownerWindow
} = emblaApi.internalEngine();
ownerWindow.clearTimeout(timerId);
timerId = ownerWindow.setTimeout(next, delay[emblaApi.selectedScrollSnap()]);
timerStartTime = new Date().getTime();
emblaApi.emit('autoplay:timerset');
}
function clearTimer() {
const {
ownerWindow
} = emblaApi.internalEngine();
ownerWindow.clearTimeout(timerId);
timerId = 0;
timerStartTime = null;
emblaApi.emit('autoplay:timerstopped');
}
function startAutoplay() {
if (destroyed) return;
if (documentIsHidden()) {
playOnDocumentVisible = true;
return;
}
if (!autoplayActive) emblaApi.emit('autoplay:play');
setTimer();
autoplayActive = true;
}
function stopAutoplay() {
if (destroyed) return;
if (autoplayActive) emblaApi.emit('autoplay:stop');
clearTimer();
autoplayActive = false;
}
function visibilityChange() {
if (documentIsHidden()) {
playOnDocumentVisible = autoplayActive;
return stopAutoplay();
}
if (playOnDocumentVisible) startAutoplay();
}
function documentIsHidden() {
const {
ownerDocument
} = emblaApi.internalEngine();
return ownerDocument.visibilityState === 'hidden';
}
function pointerDown() {
if (!mouseIsOver) stopAutoplay();
}
function pointerUp() {
if (!mouseIsOver) startAutoplay();
}
function mouseEnter() {
mouseIsOver = true;
stopAutoplay();
}
function mouseLeave() {
mouseIsOver = false;
startAutoplay();
}
function play(jumpOverride) {
if (typeof jumpOverride !== 'undefined') jump = jumpOverride;
startAutoplay();
}
function stop() {
if (autoplayActive) stopAutoplay();
}
function reset() {
if (autoplayActive) startAutoplay();
}
function isPlaying() {
return autoplayActive;
}
function next() {
const {
index
} = emblaApi.internalEngine();
const nextIndex = index.clone().add(1).get();
const lastIndex = emblaApi.scrollSnapList().length - 1;
const kill = options.stopOnLastSnap && nextIndex === lastIndex;
if (emblaApi.canScrollNext()) {
emblaApi.scrollNext(jump);
} else {
emblaApi.scrollTo(0, jump);
}
emblaApi.emit('autoplay:select');
if (kill) return stopAutoplay();
startAutoplay();
}
function timeUntilNext() {
if (!timerStartTime) return null;
const currentDelay = delay[emblaApi.selectedScrollSnap()];
const timePastSinceStart = new Date().getTime() - timerStartTime;
return currentDelay - timePastSinceStart;
}
const self = {
name: 'autoplay',
options: userOptions,
init,
destroy,
play,
stop,
reset,
isPlaying,
timeUntilNext
};
return self;
}
Autoplay.globalOptions = undefined;
module.exports = Autoplay;
//# sourceMappingURL=embla-carousel-autoplay.cjs.js.map
@@ -0,0 +1 @@
{"version":3,"file":"embla-carousel-autoplay.cjs.js","sources":["../src/components/Options.ts","../src/components/utils.ts","../src/components/Autoplay.ts"],"sourcesContent":["import { CreateOptionsType, EmblaCarouselType } from 'embla-carousel'\n\nexport type DelayOptionType =\n | number\n | ((scrollSnaps: number[], emblaApi: EmblaCarouselType) => number[])\n\nexport type RootNodeType =\n | null\n | ((emblaRoot: HTMLElement) => HTMLElement | null)\n\nexport type OptionsType = CreateOptionsType<{\n delay: DelayOptionType\n jump: boolean\n playOnInit: boolean\n stopOnFocusIn: boolean\n stopOnInteraction: boolean\n stopOnMouseEnter: boolean\n stopOnLastSnap: boolean\n rootNode: RootNodeType\n}>\n\nexport const defaultOptions: OptionsType = {\n active: true,\n breakpoints: {},\n delay: 4000,\n jump: false,\n playOnInit: true,\n stopOnFocusIn: true,\n stopOnInteraction: true,\n stopOnMouseEnter: false,\n stopOnLastSnap: false,\n rootNode: null\n}\n","import { EmblaCarouselType } from 'embla-carousel/components/EmblaCarousel'\nimport { DelayOptionType, RootNodeType } from './Options'\n\nexport function normalizeDelay(\n emblaApi: EmblaCarouselType,\n delay: DelayOptionType\n): number[] {\n const scrollSnaps = emblaApi.scrollSnapList()\n\n if (typeof delay === 'number') {\n return scrollSnaps.map(() => delay)\n }\n return delay(scrollSnaps, emblaApi)\n}\n\nexport function getAutoplayRootNode(\n emblaApi: EmblaCarouselType,\n rootNode: RootNodeType\n): HTMLElement {\n const emblaRootNode = emblaApi.rootNode()\n return (rootNode && rootNode(emblaRootNode)) || emblaRootNode\n}\n","import { OptionsType, defaultOptions } from './Options'\nimport { getAutoplayRootNode, normalizeDelay } from './utils'\nimport {\n CreatePluginType,\n OptionsHandlerType,\n EmblaCarouselType\n} from 'embla-carousel'\n\ndeclare module 'embla-carousel' {\n interface EmblaPluginsType {\n autoplay: AutoplayType\n }\n\n interface EmblaEventListType {\n autoplayPlay: 'autoplay:play'\n autoplayStop: 'autoplay:stop'\n autoplaySelect: 'autoplay:select'\n autoplayTimerSet: 'autoplay:timerset'\n autoplayTimerStopped: 'autoplay:timerstopped'\n }\n}\n\nexport type AutoplayType = CreatePluginType<\n {\n play: (jump?: boolean) => void\n stop: () => void\n reset: () => void\n isPlaying: () => boolean\n timeUntilNext: () => number | null\n },\n OptionsType\n>\n\nexport type AutoplayOptionsType = AutoplayType['options']\n\nfunction Autoplay(userOptions: AutoplayOptionsType = {}): AutoplayType {\n let options: OptionsType\n let emblaApi: EmblaCarouselType\n let destroyed: boolean\n let delay: ReturnType<EmblaCarouselType['scrollSnapList']>\n let timerStartTime: null | number = null\n let timerId = 0\n let autoplayActive = false\n let mouseIsOver = false\n let playOnDocumentVisible = false\n let jump = false\n\n function init(\n emblaApiInstance: EmblaCarouselType,\n optionsHandler: OptionsHandlerType\n ): void {\n emblaApi = emblaApiInstance\n\n const { mergeOptions, optionsAtMedia } = optionsHandler\n const optionsBase = mergeOptions(defaultOptions, Autoplay.globalOptions)\n const allOptions = mergeOptions(optionsBase, userOptions)\n options = optionsAtMedia(allOptions)\n\n if (emblaApi.scrollSnapList().length <= 1) return\n\n jump = options.jump\n destroyed = false\n delay = normalizeDelay(emblaApi, options.delay)\n\n const { eventStore, ownerDocument } = emblaApi.internalEngine()\n const isDraggable = !!emblaApi.internalEngine().options.watchDrag\n const root = getAutoplayRootNode(emblaApi, options.rootNode)\n\n eventStore.add(ownerDocument, 'visibilitychange', visibilityChange)\n\n if (isDraggable) {\n emblaApi.on('pointerDown', pointerDown)\n }\n\n if (isDraggable && !options.stopOnInteraction) {\n emblaApi.on('pointerUp', pointerUp)\n }\n\n if (options.stopOnMouseEnter) {\n eventStore.add(root, 'mouseenter', mouseEnter)\n }\n\n if (options.stopOnMouseEnter && !options.stopOnInteraction) {\n eventStore.add(root, 'mouseleave', mouseLeave)\n }\n\n if (options.stopOnFocusIn) {\n emblaApi.on('slideFocusStart', stopAutoplay)\n }\n\n if (options.stopOnFocusIn && !options.stopOnInteraction) {\n eventStore.add(emblaApi.containerNode(), 'focusout', startAutoplay)\n }\n\n if (options.playOnInit) startAutoplay()\n }\n\n function destroy(): void {\n emblaApi\n .off('pointerDown', pointerDown)\n .off('pointerUp', pointerUp)\n .off('slideFocusStart', stopAutoplay)\n\n stopAutoplay()\n destroyed = true\n autoplayActive = false\n }\n\n function setTimer(): void {\n const { ownerWindow } = emblaApi.internalEngine()\n ownerWindow.clearTimeout(timerId)\n timerId = ownerWindow.setTimeout(next, delay[emblaApi.selectedScrollSnap()])\n timerStartTime = new Date().getTime()\n emblaApi.emit('autoplay:timerset')\n }\n\n function cLine truncated
+2
View File
@@ -0,0 +1,2 @@
export { AutoplayType, AutoplayOptionsType } from './components/Autoplay';
export { default } from './components/Autoplay';
+55
View File
@@ -0,0 +1,55 @@
{
"name": "embla-carousel-autoplay",
"version": "8.6.0",
"author": "David Jerleke",
"description": "An autoplay plugin for Embla Carousel",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte",
"solid"
],
"types": "index.d.ts",
"sideEffects": false,
"files": [
"embla-carousel-autoplay*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.22.4",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"peerDependencies": {
"embla-carousel": "8.6.0"
},
"main": "embla-carousel-autoplay.cjs.js",
"type": "commonjs"
}