@stenajs-webui/core
Advanced tools
Comparing version 0.0.45 to 0.0.46
@@ -0,5 +1,7 @@ | ||
declare type Value = boolean; | ||
declare type SetTrue = () => void; | ||
declare type SetFalse = () => void; | ||
declare type ToggleValue = () => void; | ||
export declare const useBoolean: (initialValue: boolean) => [boolean, SetTrue, SetFalse, ToggleValue]; | ||
declare type BooleanHook = [Value, SetTrue, SetFalse, ToggleValue]; | ||
export declare const useBoolean: (initialValue: boolean) => BooleanHook; | ||
export {}; |
import { RefObject } from "react"; | ||
declare type EventHandler<TEventName extends keyof HTMLElementEventMap> = (event: HTMLElementEventMap[TEventName]) => void; | ||
export declare const useEventListener: <TEventName extends "fullscreenchange" | "fullscreenerror" | "abort" | "animationcancel" | "animationend" | "animationiteration" | "animationstart" | "auxclick" | "blur" | "cancel" | "canplay" | "canplaythrough" | "change" | "click" | "close" | "contextmenu" | "cuechange" | "dblclick" | "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop" | "durationchange" | "emptied" | "ended" | "error" | "focus" | "gotpointercapture" | "input" | "invalid" | "keydown" | "keypress" | "keyup" | "load" | "loadeddata" | "loadedmetadata" | "loadend" | "loadstart" | "lostpointercapture" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pause" | "play" | "playing" | "pointercancel" | "pointerdown" | "pointerenter" | "pointerleave" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "progress" | "ratechange" | "reset" | "resize" | "scroll" | "securitypolicyviolation" | "seeked" | "seeking" | "select" | "selectionchange" | "selectstart" | "stalled" | "submit" | "suspend" | "timeupdate" | "toggle" | "touchcancel" | "touchend" | "touchmove" | "touchstart" | "transitioncancel" | "transitionend" | "transitionrun" | "transitionstart" | "volumechange" | "waiting" | "wheel" | "copy" | "cut" | "paste">(ref: RefObject<HTMLElement>, eventName: TEventName, handler: EventHandler<TEventName>) => void; | ||
export declare const useEventListener: <TEventName extends "fullscreenchange" | "fullscreenerror" | "abort" | "animationcancel" | "animationend" | "animationiteration" | "animationstart" | "auxclick" | "blur" | "cancel" | "canplay" | "canplaythrough" | "change" | "click" | "close" | "contextmenu" | "cuechange" | "dblclick" | "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop" | "durationchange" | "emptied" | "ended" | "error" | "focus" | "focusin" | "focusout" | "gotpointercapture" | "input" | "invalid" | "keydown" | "keypress" | "keyup" | "load" | "loadeddata" | "loadedmetadata" | "loadend" | "loadstart" | "lostpointercapture" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pause" | "play" | "playing" | "pointercancel" | "pointerdown" | "pointerenter" | "pointerleave" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "progress" | "ratechange" | "reset" | "resize" | "scroll" | "securitypolicyviolation" | "seeked" | "seeking" | "select" | "selectionchange" | "selectstart" | "stalled" | "submit" | "suspend" | "timeupdate" | "toggle" | "touchcancel" | "touchend" | "touchmove" | "touchstart" | "transitioncancel" | "transitionend" | "transitionrun" | "transitionstart" | "volumechange" | "waiting" | "wheel" | "copy" | "cut" | "paste">(ref: RefObject<HTMLElement>, eventName: TEventName, handler: EventHandler<TEventName>) => void; | ||
export {}; |
@@ -33,3 +33,2 @@ export * from "./theme/hooks/UseTheme"; | ||
export * from "./theme/variations/internalTheme"; | ||
export * from "./theme/DefaultTheme"; | ||
export * from "./theme/Theme"; | ||
@@ -36,0 +35,0 @@ export * from "./types/ElementProps"; |
@@ -114,7 +114,16 @@ import { createContext, useContext, useMemo, createElement, Fragment, useCallback, useState, useEffect, useRef } from 'react'; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
function __spreadArrays() { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
} | ||
function __makeTemplateObject(cooked, raw) { | ||
@@ -156,3 +165,3 @@ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
var fieldValue = partFields[fieldName]; | ||
return __assign({}, sum, (_a = {}, _a[fieldName] = (fieldValue && themePart[fieldValue]) || fieldValue, _a)); | ||
return __assign(__assign({}, sum), (_a = {}, _a[fieldName] = (fieldValue && themePart[fieldValue]) || fieldValue, _a)); | ||
}, {}); | ||
@@ -519,3 +528,3 @@ }; | ||
})(Colors || (Colors = {})); | ||
var externalTheme = __assign({}, defaultTheme, { colors: __assign({}, defaultTheme.colors, { primaryText: Colors.UI2, primaryTextLight: Colors.UI3, primaryBg: Colors.UI5, primaryBgLight: Colors.UI6, primaryBgDark: Colors.UI4, navBarBg: "#2e4662", navBarBgButtonText: "#ffffff", navBarBgButtonTextFaded: "#b1bbc0", interactionBgPrimary: Colors.Freight2, disabledText: Colors.UI3, disabledTextLight: Colors.UI4, disabledBackground: Colors.UI5, white: Colors.UI8, separator: Colors.UI4, separatorLight: Colors.UI5, separatorHighlighted: Colors.UI3, successGreen: Colors.Lush2, successGreenLight: Colors.Lush3, errorText: Colors.Sos2, errorTextLight: Colors.Sos3, errorBgLight: Colors.Sos3, errorBgDark: Colors.Sos1, badgeBg: "#af4b4d", alertText: Colors.Alert2, alertTextLight: Colors.Alert2, info: Colors.Freight2, infoLight: Colors.Freight3, inputBorder: Colors.UI4, inputBorderFocused: Colors.Freight2, inputBorderFocusedAlt: Colors.Freight2Alt, inputBorderFocusedLight: Colors.Freight3, highlightBoxBg: "#E8F4FA", highlightBoxBorder: "#7498AD" }), metrics: { | ||
var externalTheme = __assign(__assign({}, defaultTheme), { colors: __assign(__assign({}, defaultTheme.colors), { primaryText: Colors.UI2, primaryTextLight: Colors.UI3, primaryBg: Colors.UI5, primaryBgLight: Colors.UI6, primaryBgDark: Colors.UI4, navBarBg: "#2e4662", navBarBgButtonText: "#ffffff", navBarBgButtonTextFaded: "#b1bbc0", interactionBgPrimary: Colors.Freight2, disabledText: Colors.UI3, disabledTextLight: Colors.UI4, disabledBackground: Colors.UI5, white: Colors.UI8, separator: Colors.UI4, separatorLight: Colors.UI5, separatorHighlighted: Colors.UI3, successGreen: Colors.Lush2, successGreenLight: Colors.Lush3, errorText: Colors.Sos2, errorTextLight: Colors.Sos3, errorBgLight: Colors.Sos3, errorBgDark: Colors.Sos1, badgeBg: "#af4b4d", alertText: Colors.Alert2, alertTextLight: Colors.Alert2, info: Colors.Freight2, infoLight: Colors.Freight3, inputBorder: Colors.UI4, inputBorderFocused: Colors.Freight2, inputBorderFocusedAlt: Colors.Freight2Alt, inputBorderFocusedLight: Colors.Freight3, highlightBoxBg: "#E8F4FA", highlightBoxBorder: "#7498AD" }), metrics: { | ||
indent: 10, | ||
@@ -598,3 +607,3 @@ spacing: 10, | ||
if (list.indexOf(item) < 0) { | ||
setList(list.concat([item])); | ||
setList(__spreadArrays(list, [item])); | ||
} | ||
@@ -768,3 +777,3 @@ }, [list, setList]); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, refs.slice()); | ||
}, __spreadArrays(refs)); | ||
}; | ||
@@ -771,0 +780,0 @@ |
@@ -120,7 +120,16 @@ 'use strict'; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
function __spreadArrays() { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
} | ||
function __makeTemplateObject(cooked, raw) { | ||
@@ -162,3 +171,3 @@ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
var fieldValue = partFields[fieldName]; | ||
return __assign({}, sum, (_a = {}, _a[fieldName] = (fieldValue && themePart[fieldValue]) || fieldValue, _a)); | ||
return __assign(__assign({}, sum), (_a = {}, _a[fieldName] = (fieldValue && themePart[fieldValue]) || fieldValue, _a)); | ||
}, {}); | ||
@@ -524,3 +533,3 @@ }; | ||
})(exports.Colors || (exports.Colors = {})); | ||
var externalTheme = __assign({}, defaultTheme, { colors: __assign({}, defaultTheme.colors, { primaryText: exports.Colors.UI2, primaryTextLight: exports.Colors.UI3, primaryBg: exports.Colors.UI5, primaryBgLight: exports.Colors.UI6, primaryBgDark: exports.Colors.UI4, navBarBg: "#2e4662", navBarBgButtonText: "#ffffff", navBarBgButtonTextFaded: "#b1bbc0", interactionBgPrimary: exports.Colors.Freight2, disabledText: exports.Colors.UI3, disabledTextLight: exports.Colors.UI4, disabledBackground: exports.Colors.UI5, white: exports.Colors.UI8, separator: exports.Colors.UI4, separatorLight: exports.Colors.UI5, separatorHighlighted: exports.Colors.UI3, successGreen: exports.Colors.Lush2, successGreenLight: exports.Colors.Lush3, errorText: exports.Colors.Sos2, errorTextLight: exports.Colors.Sos3, errorBgLight: exports.Colors.Sos3, errorBgDark: exports.Colors.Sos1, badgeBg: "#af4b4d", alertText: exports.Colors.Alert2, alertTextLight: exports.Colors.Alert2, info: exports.Colors.Freight2, infoLight: exports.Colors.Freight3, inputBorder: exports.Colors.UI4, inputBorderFocused: exports.Colors.Freight2, inputBorderFocusedAlt: exports.Colors.Freight2Alt, inputBorderFocusedLight: exports.Colors.Freight3, highlightBoxBg: "#E8F4FA", highlightBoxBorder: "#7498AD" }), metrics: { | ||
var externalTheme = __assign(__assign({}, defaultTheme), { colors: __assign(__assign({}, defaultTheme.colors), { primaryText: exports.Colors.UI2, primaryTextLight: exports.Colors.UI3, primaryBg: exports.Colors.UI5, primaryBgLight: exports.Colors.UI6, primaryBgDark: exports.Colors.UI4, navBarBg: "#2e4662", navBarBgButtonText: "#ffffff", navBarBgButtonTextFaded: "#b1bbc0", interactionBgPrimary: exports.Colors.Freight2, disabledText: exports.Colors.UI3, disabledTextLight: exports.Colors.UI4, disabledBackground: exports.Colors.UI5, white: exports.Colors.UI8, separator: exports.Colors.UI4, separatorLight: exports.Colors.UI5, separatorHighlighted: exports.Colors.UI3, successGreen: exports.Colors.Lush2, successGreenLight: exports.Colors.Lush3, errorText: exports.Colors.Sos2, errorTextLight: exports.Colors.Sos3, errorBgLight: exports.Colors.Sos3, errorBgDark: exports.Colors.Sos1, badgeBg: "#af4b4d", alertText: exports.Colors.Alert2, alertTextLight: exports.Colors.Alert2, info: exports.Colors.Freight2, infoLight: exports.Colors.Freight3, inputBorder: exports.Colors.UI4, inputBorderFocused: exports.Colors.Freight2, inputBorderFocusedAlt: exports.Colors.Freight2Alt, inputBorderFocusedLight: exports.Colors.Freight3, highlightBoxBg: "#E8F4FA", highlightBoxBorder: "#7498AD" }), metrics: { | ||
indent: 10, | ||
@@ -603,3 +612,3 @@ spacing: 10, | ||
if (list.indexOf(item) < 0) { | ||
setList(list.concat([item])); | ||
setList(__spreadArrays(list, [item])); | ||
} | ||
@@ -773,3 +782,3 @@ }, [list, setList]); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, refs.slice()); | ||
}, __spreadArrays(refs)); | ||
}; | ||
@@ -776,0 +785,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { DependencyList } from "react"; | ||
import { Theme } from "../Theme"; | ||
@@ -7,3 +8,3 @@ import { ThemeColorField } from "../theme-types/ThemeColors"; | ||
declare type ThemeSelectorFunction<T> = (theme: Theme) => T; | ||
export declare const useThemeSelector: <T>(fn: ThemeSelectorFunction<T>, deps: readonly any[] | undefined) => T; | ||
export declare const useThemeSelector: <T>(fn: ThemeSelectorFunction<T>, deps: DependencyList | undefined) => T; | ||
declare type ThemeFieldRecord<T> = Record<string, T | string | undefined>; | ||
@@ -20,3 +21,3 @@ declare type ColorFields = ThemeFieldRecord<ThemeColorField>; | ||
}; | ||
export declare const useThemeFields: <TFields extends ThemeSelectorFields>(themeFields: TFields, deps: readonly any[]) => TFields; | ||
export declare const useThemeFields: <TFields extends ThemeSelectorFields>(themeFields: TFields, deps: DependencyList) => TFields; | ||
export {}; |
{ | ||
"name": "@stenajs-webui/core", | ||
"version": "0.0.45", | ||
"version": "0.0.46", | ||
"description": "", | ||
@@ -63,3 +63,3 @@ "author": "mattias800", | ||
], | ||
"gitHead": "201cd68281ab0a317ec7ab6eeca8d6d3750b3cba", | ||
"gitHead": "5e0bf3d8de0e5a9651c00aadf947fd279fa16697", | ||
"dependencies": { | ||
@@ -66,0 +66,0 @@ "@emotion/is-prop-valid": "^0.8.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
234528
2168