@pathscale/ui 0.0.160 → 0.0.161
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Component } from "solid-js";
|
|
2
|
+
import type { IComponentBaseProps } from "../types";
|
|
3
|
+
import { type SizePreset } from "./sizeStore";
|
|
4
|
+
export interface SizePickerProps extends IComponentBaseProps {
|
|
5
|
+
storagePrefix?: string;
|
|
6
|
+
onSizeChange?: (size: SizePreset) => void;
|
|
7
|
+
"aria-label"?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const SizePicker: Component<SizePickerProps>;
|
|
10
|
+
export default SizePicker;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type SizePreset = "M" | "L" | "XL";
|
|
2
|
+
export interface SizeStore {
|
|
3
|
+
size: () => SizePreset;
|
|
4
|
+
setSize: (size: SizePreset) => void;
|
|
5
|
+
scale: () => number;
|
|
6
|
+
}
|
|
7
|
+
export declare function createSizeStore(storagePrefix: string): SizeStore;
|
|
8
|
+
export declare function getDefaultSizeStore(): SizeStore;
|
package/dist/index.d.ts
CHANGED
|
@@ -107,6 +107,8 @@ export type { StreamingTableStore } from "./components/streaming-table";
|
|
|
107
107
|
export { default as Tabs } from "./components/tabs";
|
|
108
108
|
export type { RadioTabProps, TabProps, TabsProps } from "./components/tabs";
|
|
109
109
|
export { default as Textarea } from "./components/textarea";
|
|
110
|
+
export { SizePicker, createSizeStore, getDefaultSizeStore, } from "./components/size-picker";
|
|
111
|
+
export type { SizePickerProps, SizeStore, SizePreset, } from "./components/size-picker";
|
|
110
112
|
export { ThemeColorPicker, createHueShiftStore, getDefaultHueShiftStore, resetHueShift, } from "./components/theme-color-picker";
|
|
111
113
|
export type { ThemeColorPickerProps, HueShiftStore, } from "./components/theme-color-picker";
|
|
112
114
|
export { Timeline, TimelineEnd, TimelineItem, TimelineMiddle, TimelineStart, } from "./components/timeline";
|
package/dist/index.js
CHANGED
|
@@ -18352,6 +18352,96 @@ const Textarea = (props)=>{
|
|
|
18352
18352
|
})();
|
|
18353
18353
|
};
|
|
18354
18354
|
const textarea_Textarea = Textarea;
|
|
18355
|
+
const SIZE_SCALE = {
|
|
18356
|
+
M: 100,
|
|
18357
|
+
L: 112.5,
|
|
18358
|
+
XL: 125
|
|
18359
|
+
};
|
|
18360
|
+
function applySize(preset) {
|
|
18361
|
+
document.documentElement.style.fontSize = `${SIZE_SCALE[preset]}%`;
|
|
18362
|
+
}
|
|
18363
|
+
function createSizeStore(storagePrefix) {
|
|
18364
|
+
const STORAGE_KEY = `${storagePrefix}_size_preset`;
|
|
18365
|
+
const getInitial = ()=>{
|
|
18366
|
+
if ("undefined" == typeof window) return "M";
|
|
18367
|
+
const saved = localStorage.getItem(STORAGE_KEY);
|
|
18368
|
+
if (saved && saved in SIZE_SCALE) return saved;
|
|
18369
|
+
return "M";
|
|
18370
|
+
};
|
|
18371
|
+
const [size, setSizeInternal] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(getInitial());
|
|
18372
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
18373
|
+
const s = size();
|
|
18374
|
+
if ("undefined" == typeof window) return;
|
|
18375
|
+
localStorage.setItem(STORAGE_KEY, s);
|
|
18376
|
+
applySize(s);
|
|
18377
|
+
});
|
|
18378
|
+
return {
|
|
18379
|
+
size,
|
|
18380
|
+
setSize: setSizeInternal,
|
|
18381
|
+
scale: ()=>SIZE_SCALE[size()]
|
|
18382
|
+
};
|
|
18383
|
+
}
|
|
18384
|
+
let defaultStore = null;
|
|
18385
|
+
function getDefaultSizeStore() {
|
|
18386
|
+
if (!defaultStore) defaultStore = createSizeStore("theme");
|
|
18387
|
+
return defaultStore;
|
|
18388
|
+
}
|
|
18389
|
+
var SizePicker_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div role=radiogroup>");
|
|
18390
|
+
const PRESETS = [
|
|
18391
|
+
"M",
|
|
18392
|
+
"L",
|
|
18393
|
+
"XL"
|
|
18394
|
+
];
|
|
18395
|
+
const SizePicker_SizePicker = (props)=>{
|
|
18396
|
+
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
18397
|
+
"storagePrefix",
|
|
18398
|
+
"onSizeChange",
|
|
18399
|
+
"aria-label",
|
|
18400
|
+
"class",
|
|
18401
|
+
"className",
|
|
18402
|
+
"style",
|
|
18403
|
+
"dataTheme"
|
|
18404
|
+
]);
|
|
18405
|
+
const store = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>createSizeStore(local.storagePrefix ?? "theme"));
|
|
18406
|
+
const handleClick = (preset)=>{
|
|
18407
|
+
store().setSize(preset);
|
|
18408
|
+
local.onSizeChange?.(preset);
|
|
18409
|
+
};
|
|
18410
|
+
const classes = ()=>twMerge("inline-flex gap-1", clsx(local.class, local.className));
|
|
18411
|
+
return (()=>{
|
|
18412
|
+
var _el$ = SizePicker_tmpl$();
|
|
18413
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)({
|
|
18414
|
+
get ["class"] () {
|
|
18415
|
+
return classes();
|
|
18416
|
+
},
|
|
18417
|
+
get style () {
|
|
18418
|
+
return local.style;
|
|
18419
|
+
},
|
|
18420
|
+
get ["aria-label"] () {
|
|
18421
|
+
return local["aria-label"] ?? "Change text size";
|
|
18422
|
+
}
|
|
18423
|
+
}, others), false, true);
|
|
18424
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
18425
|
+
each: PRESETS,
|
|
18426
|
+
children: (preset)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(button_Button, {
|
|
18427
|
+
type: "button",
|
|
18428
|
+
size: "xs",
|
|
18429
|
+
get color () {
|
|
18430
|
+
return store().size() === preset ? "primary" : "ghost";
|
|
18431
|
+
},
|
|
18432
|
+
onClick: ()=>handleClick(preset),
|
|
18433
|
+
role: "radio",
|
|
18434
|
+
get ["aria-checked"] () {
|
|
18435
|
+
return store().size() === preset;
|
|
18436
|
+
},
|
|
18437
|
+
"aria-label": `Size ${preset}`,
|
|
18438
|
+
children: preset
|
|
18439
|
+
})
|
|
18440
|
+
}));
|
|
18441
|
+
return _el$;
|
|
18442
|
+
})();
|
|
18443
|
+
};
|
|
18444
|
+
const SizePicker = SizePicker_SizePicker;
|
|
18355
18445
|
let cspAllowsInlineStyles = null;
|
|
18356
18446
|
const checkCspAllowsInlineStyles = ()=>{
|
|
18357
18447
|
if (null !== cspAllowsInlineStyles) return cspAllowsInlineStyles;
|
|
@@ -18793,10 +18883,10 @@ function createHueShiftStore(storagePrefix) {
|
|
|
18793
18883
|
isAvailable: ()=>checkCspAllowsInlineStyles()
|
|
18794
18884
|
};
|
|
18795
18885
|
}
|
|
18796
|
-
let
|
|
18886
|
+
let hueShift_defaultStore = null;
|
|
18797
18887
|
function getDefaultHueShiftStore() {
|
|
18798
|
-
if (!
|
|
18799
|
-
return
|
|
18888
|
+
if (!hueShift_defaultStore) hueShift_defaultStore = createHueShiftStore("theme");
|
|
18889
|
+
return hueShift_defaultStore;
|
|
18800
18890
|
}
|
|
18801
18891
|
var ThemeColorPicker_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class="absolute right-0 mt-2 p-6 bg-base-100 rounded-lg shadow-xl border border-base-300 z-50">'), ThemeColorPicker_tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div>");
|
|
18802
18892
|
function hueToColorValue(hue, sat) {
|
|
@@ -19735,4 +19825,4 @@ const createRouteTransitionResolver = (options)=>{
|
|
|
19735
19825
|
return fallback ?? noMotion;
|
|
19736
19826
|
};
|
|
19737
19827
|
};
|
|
19738
|
-
export { accordion_Accordion as Accordion, alert_Alert as Alert, AlphaSlider, 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, colorpicker_ColorInput as ColorInput, colorpicker_ColorPicker as ColorPicker, ColorPickerContext, ColorPickerFlowerSelector, colorpicker_ColorPickerGradientSelector as ColorPickerGradientSelector, ColorPickerWheelSelector, colorpicker_ColorPreview as ColorPreview, colorpicker_ColorSwatches as ColorSwatches, ColorWheel, colorpicker_ColorWheelFlower as ColorWheelFlower, ConfirmDialog, connectionstatus_ConnectionStatus as ConnectionStatus, CookieConsent, copy_button_CopyButton as CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, DropdownSelect, EmptyState, EnhancedTable, Fieldset, FileInput, FirefoxPWABanner, flex_Flex as Flex, floating_dock_FloatingDock as FloatingDock, footer_Footer as Footer, form_Form as Form, form_actions_FormActions as FormActions, glass_panel_GlassPanel as GlassPanel, GlowCard, Grid, hero_Hero as Hero, colorpicker_HueSlider as HueSlider, I18nContext, I18nProvider, icon_Icon as Icon, immersive_landing_ImmersiveLanding as ImmersiveLanding, ImmersiveLandingContext, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, language_switcher_LanguageSwitcher as LanguageSwitcher, LightnessSlider, link_Link as Link, live_chat_LiveChatBubble as LiveChatBubble, LiveChatPanel, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, MotionDiv, navbar_Navbar as Navbar, noise_background_NoiseBackground as NoiseBackground, PWAInstallPrompt, Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, radio_group_RadioGroup as RadioGroup, range_Range as Range, Rating, colorpicker_SaturationBrightness as SaturationBrightness, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, 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, SkipLink, RangeSlider as SliderField, 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, switch_field_SwitchField as SwitchField, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, ThemeColorPicker, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, ToastStack_ToastStack as ToastStack, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, video_preview_VideoPreview as VideoPreview, windowmockup_WindowMockup as WindowMockup, createHueShiftStore, createI18n, createMotionPresets, createMotionSystem, createPopmotionDriver, createRouteTransitionResolver, createStreamingTableStore, connectionstatus_ConnectionStatus as default, defaultMotionTokens, enablePopmotion, getDefaultHueShiftStore, getMotionDriver, presets_getPreset as getPreset, immediateDriver, mergeMotionTokens, motionDistances, motionDurations, motionEasings, motionPresets, noMotion, prefersReducedMotion, presets_registerPreset as registerPreset, resetHueShift, resolveEase, presets_resolvePreset as resolvePreset, routeTransition, runMotion, setMotionDriver, toastStore, useColorPickerContext, useDesktop, useFormValidation, useI18n, useImmersiveLanding, useImmersiveLandingContext };
|
|
19828
|
+
export { accordion_Accordion as Accordion, alert_Alert as Alert, AlphaSlider, 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, colorpicker_ColorInput as ColorInput, colorpicker_ColorPicker as ColorPicker, ColorPickerContext, ColorPickerFlowerSelector, colorpicker_ColorPickerGradientSelector as ColorPickerGradientSelector, ColorPickerWheelSelector, colorpicker_ColorPreview as ColorPreview, colorpicker_ColorSwatches as ColorSwatches, ColorWheel, colorpicker_ColorWheelFlower as ColorWheelFlower, ConfirmDialog, connectionstatus_ConnectionStatus as ConnectionStatus, CookieConsent, copy_button_CopyButton as CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, DropdownSelect, EmptyState, EnhancedTable, Fieldset, FileInput, FirefoxPWABanner, flex_Flex as Flex, floating_dock_FloatingDock as FloatingDock, footer_Footer as Footer, form_Form as Form, form_actions_FormActions as FormActions, glass_panel_GlassPanel as GlassPanel, GlowCard, Grid, hero_Hero as Hero, colorpicker_HueSlider as HueSlider, I18nContext, I18nProvider, icon_Icon as Icon, immersive_landing_ImmersiveLanding as ImmersiveLanding, ImmersiveLandingContext, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, language_switcher_LanguageSwitcher as LanguageSwitcher, LightnessSlider, link_Link as Link, live_chat_LiveChatBubble as LiveChatBubble, LiveChatPanel, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, MotionDiv, navbar_Navbar as Navbar, noise_background_NoiseBackground as NoiseBackground, PWAInstallPrompt, Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, radio_group_RadioGroup as RadioGroup, range_Range as Range, Rating, colorpicker_SaturationBrightness as SaturationBrightness, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, 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, SizePicker, skeleton_Skeleton as Skeleton, SkipLink, RangeSlider as SliderField, 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, switch_field_SwitchField as SwitchField, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, ThemeColorPicker, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, ToastStack_ToastStack as ToastStack, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, video_preview_VideoPreview as VideoPreview, windowmockup_WindowMockup as WindowMockup, createHueShiftStore, createI18n, createMotionPresets, createMotionSystem, createPopmotionDriver, createRouteTransitionResolver, createSizeStore, createStreamingTableStore, connectionstatus_ConnectionStatus as default, defaultMotionTokens, enablePopmotion, getDefaultHueShiftStore, getDefaultSizeStore, getMotionDriver, presets_getPreset as getPreset, immediateDriver, mergeMotionTokens, motionDistances, motionDurations, motionEasings, motionPresets, noMotion, prefersReducedMotion, presets_registerPreset as registerPreset, resetHueShift, resolveEase, presets_resolvePreset as resolvePreset, routeTransition, runMotion, setMotionDriver, toastStore, useColorPickerContext, useDesktop, useFormValidation, useI18n, useImmersiveLanding, useImmersiveLandingContext };
|