svseeds 0.4.7 → 0.4.9
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/_svseeds/Accordion.svelte +14 -14
- package/_svseeds/Accordion.svelte.d.ts +8 -8
- package/_svseeds/DarkToggle.svelte +12 -12
- package/_svseeds/DarkToggle.svelte.d.ts +4 -4
- package/_svseeds/TagsInputField.svelte +51 -41
- package/_svseeds/TagsInputField.svelte.d.ts +15 -13
- package/_svseeds/ToggleGroupField.svelte +38 -36
- package/_svseeds/ToggleGroupField.svelte.d.ts +13 -13
- package/_svseeds/_Button.svelte +20 -19
- package/_svseeds/_Button.svelte.d.ts +11 -11
- package/_svseeds/_CheckField.svelte +27 -27
- package/_svseeds/_CheckField.svelte.d.ts +9 -9
- package/_svseeds/_ColorPicker.svelte +14 -13
- package/_svseeds/_ColorPicker.svelte.d.ts +9 -8
- package/_svseeds/_ComboBox.svelte +63 -44
- package/_svseeds/_ComboBox.svelte.d.ts +12 -7
- package/_svseeds/_ContextMenu.svelte +13 -13
- package/_svseeds/_ContextMenu.svelte.d.ts +9 -9
- package/_svseeds/_Disclosure.svelte +26 -24
- package/_svseeds/_Disclosure.svelte.d.ts +10 -10
- package/_svseeds/_HotkeyCapture.svelte +14 -14
- package/_svseeds/_HotkeyCapture.svelte.d.ts +7 -7
- package/_svseeds/_Modal.svelte +17 -15
- package/_svseeds/_Modal.svelte.d.ts +9 -9
- package/_svseeds/_ProgressTracker.svelte +42 -35
- package/_svseeds/_ProgressTracker.svelte.d.ts +13 -13
- package/_svseeds/_SelectField.svelte +33 -33
- package/_svseeds/_SelectField.svelte.d.ts +10 -10
- package/_svseeds/_Slider.svelte +21 -20
- package/_svseeds/_Slider.svelte.d.ts +12 -12
- package/_svseeds/_Sortable.svelte +18 -18
- package/_svseeds/_Sortable.svelte.d.ts +9 -9
- package/_svseeds/_Tabs.svelte +20 -20
- package/_svseeds/_Tabs.svelte.d.ts +8 -8
- package/_svseeds/_TagsInput.svelte +22 -22
- package/_svseeds/_TagsInput.svelte.d.ts +10 -10
- package/_svseeds/_TextField.svelte +33 -33
- package/_svseeds/_TextField.svelte.d.ts +10 -10
- package/_svseeds/_Toggle.svelte +25 -29
- package/_svseeds/_Toggle.svelte.d.ts +13 -15
- package/_svseeds/_ToggleGroup.svelte +13 -13
- package/_svseeds/_ToggleGroup.svelte.d.ts +8 -8
- package/_svseeds/_Tooltip.svelte +14 -14
- package/_svseeds/_Tooltip.svelte.d.ts +9 -9
- package/_svseeds/core.d.ts +33 -16
- package/_svseeds/core.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/_svseeds/core.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type SVSClass, BASE, VARIANT, PARTS, elemId, fnClass, isNeutral, isUnsignedInteger, omit, debounce, throttle, UniqueId, };
|
|
2
2
|
type ClassDictionary = Record<string, unknown>;
|
|
3
3
|
type ClassArray = (ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined)[];
|
|
4
4
|
type ClassPartialValue = string | ClassArray;
|
|
5
5
|
type ClassValue = ClassPartialValue | ClassDictionary;
|
|
6
6
|
type ClassRule = Record<string, ClassValue> | ClassPartialValue;
|
|
7
|
-
type
|
|
8
|
-
type ClassFn = (part: string,
|
|
7
|
+
type SVSClass = Record<string, ClassRule> | string;
|
|
8
|
+
type ClassFn = (part: string, variant: string) => ClassValue | undefined;
|
|
9
9
|
declare const BASE = "base";
|
|
10
|
-
declare const
|
|
10
|
+
declare const VARIANT: Readonly<{
|
|
11
11
|
NEUTRAL: "neutral";
|
|
12
12
|
ACTIVE: "active";
|
|
13
13
|
INACTIVE: "inactive";
|
|
@@ -25,16 +25,16 @@ declare const PARTS: Readonly<{
|
|
|
25
25
|
EXTRA: "extra";
|
|
26
26
|
}>;
|
|
27
27
|
/**
|
|
28
|
-
* Creates a function that dynamically generates CSS classes based on component parts and
|
|
28
|
+
* Creates a function that dynamically generates CSS classes based on component parts and variant.
|
|
29
29
|
*
|
|
30
30
|
* Compatible with ClassValue type available in Svelte 5.16+ class attributes,
|
|
31
31
|
* this function generates a ClassFn that returns appropriate CSS classes
|
|
32
|
-
* based on the combination of component parts and their
|
|
32
|
+
* based on the combination of component parts and their variants.
|
|
33
33
|
*
|
|
34
34
|
* @param preset - Preset style definition. Can be a string or style rule object
|
|
35
35
|
* @param style - Optional style definition. Takes precedence over preset when provided
|
|
36
36
|
*
|
|
37
|
-
* @returns Function that takes part and
|
|
37
|
+
* @returns Function that takes part and variant parameters and returns ClassValue
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
40
|
* // String preset case
|
|
@@ -70,7 +70,7 @@ declare const PARTS: Readonly<{
|
|
|
70
70
|
* const classFn = fnClass(preset, customStyle);
|
|
71
71
|
* classFn("button", "active"); // ["btn", "btn-active"]
|
|
72
72
|
*/
|
|
73
|
-
declare function fnClass(preset:
|
|
73
|
+
declare function fnClass(preset: SVSClass, style?: SVSClass): ClassFn;
|
|
74
74
|
/**
|
|
75
75
|
* Generates unique random alphabetic ID strings with collision detection.
|
|
76
76
|
* Uses a carefully selected character set of 50 letters (A-Y, a-y) to ensure
|
|
@@ -141,20 +141,37 @@ declare class UniqueId {
|
|
|
141
141
|
}
|
|
142
142
|
declare const elemId: UniqueId;
|
|
143
143
|
/**
|
|
144
|
-
* Determines whether a
|
|
144
|
+
* Determines whether a variant is in a neutral variant (neither ACTIVE nor INACTIVE).
|
|
145
145
|
*
|
|
146
|
-
* @param
|
|
147
|
-
* @returns false if the
|
|
146
|
+
* @param variant - The variant string to check
|
|
147
|
+
* @returns false if the variant is ACTIVE or INACTIVE, true otherwise
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```typescript
|
|
151
|
-
* isNeutral(
|
|
152
|
-
* isNeutral("custom
|
|
153
|
-
* isNeutral(
|
|
154
|
-
* isNeutral(
|
|
151
|
+
* isNeutral(VARIANT.NEUTRAL); // true
|
|
152
|
+
* isNeutral("custom variant"); // true
|
|
153
|
+
* isNeutral(VARIANT.ACTIVE); // false
|
|
154
|
+
* isNeutral(VARIANT.INACTIVE); // false
|
|
155
155
|
* ```
|
|
156
156
|
*/
|
|
157
|
-
declare function isNeutral(
|
|
157
|
+
declare function isNeutral(variant: string): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Checks if a given number is an unsigned integer (non-negative integer).
|
|
160
|
+
*
|
|
161
|
+
* @param num - The number to check
|
|
162
|
+
* @returns True if the number is an integer and greater than or equal to zero, false otherwise
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* isUnsignedInteger(5); // true
|
|
167
|
+
* isUnsignedInteger(0); // true
|
|
168
|
+
* isUnsignedInteger(-1); // false
|
|
169
|
+
* isUnsignedInteger(3.14); // false
|
|
170
|
+
* isUnsignedInteger(NaN); // false
|
|
171
|
+
* isUnsignedInteger(Infinity); // false
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare function isUnsignedInteger(num: number): boolean;
|
|
158
175
|
/**
|
|
159
176
|
* Creates a new object with specified keys omitted from the original object.
|
|
160
177
|
* Returns an empty object if the input object is undefined or null.
|
package/_svseeds/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as BASE,e as
|
|
1
|
+
export{t as BASE,e as VARIANT,r as PARTS,s as elemId,n as fnClass,u as isNeutral,a as isUnsignedInteger,c as omit,l as debounce,h as throttle,o as UniqueId};const t="base",e=Object.freeze({NEUTRAL:"neutral",ACTIVE:"active",INACTIVE:"inactive"}),r=Object.freeze({WHOLE:"whole",MIDDLE:"middle",MAIN:"main",TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",LABEL:"label",AUX:"aux",EXTRA:"extra"});function n(r,n){const o=i(n)??i(r);return null==o?(t,e)=>{}:"string"==typeof o?(t,e)=>`${o} ${t} ${e}`:(r,n)=>function(r,n,i){const o=r[n]?.[t]??"",s=r[n]?.[i]??r[n]?.[e.NEUTRAL]??"";if(!o&&!s)return;return o&&s?[o,s]:o||s}(o,r,n)}function i(t){if(null==t)return;if("string"==typeof t)return t.trim()?t:void 0;const e=Object.entries(t);return e.length?Object.fromEntries(e.map((([t,e])=>null===e||"object"!=typeof e||Array.isArray(e)?[t,{base:e}]:[t,e]))):void 0}class o{static#t=[...Array.from(Array(25).keys(),(t=>t+65)),...Array.from(Array(25).keys(),(t=>t+97))];#e=new Set;#r=3;#n=1e5;get id(){return this.get(!0)}constructor(t=3,e=1e5){t>2&&(this.#r=t),(e=Math.trunc(e))>0&&e<Math.min(Math.pow(50,this.#r),Number.MAX_SAFE_INTEGER)&&(this.#n=e)}get(t){if(t)return this.#e.size>this.#n&&this.#e.clear(),this.#i()}#o(){return o.#t[Math.trunc(Math.random()*o.#t.length)]}#s(){return String.fromCharCode(...Array(this.#r).fill(null).map((()=>this.#o())))}#i(){let t=this.#s();for(;this.#e.has(t);)t=this.#s();return this.#e.add(t),t}}const s=new o;function u(t){return t!==e.ACTIVE&&t!==e.INACTIVE}function a(t){return Number.isInteger(t)&&t>=0}function c(t,...e){if(!t)return{};const r={...t};return e.forEach((t=>delete r[t])),r}function l(t,e){let r;return(...n)=>{r&&clearTimeout(r),r=setTimeout((()=>{e.call(null,...n)}),t)}}function h(t,e){let r,n=0;const i=()=>Date.now()-n,o=t=>{e.call(null,...t),n=Date.now()};return(...e)=>{if(!n)return o(e);clearTimeout(r),r=setTimeout((()=>{i()>=t&&o(e)}),t-i())}}
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type SVSClass, BASE, VARIANT, PARTS, elemId, fnClass, isNeutral, isUnsignedInteger, omit, debounce, throttle, UniqueId } from "./_svseeds/core";
|
|
2
2
|
export { default as Button, type ButtonProps, type ButtonReqdProps, type ButtonBindProps } from "./_svseeds/_Button.svelte";
|
|
3
3
|
export { default as CheckField, type CheckFieldProps, type CheckFieldReqdProps, type CheckFieldBindProps, type CheckFieldValidation } from "./_svseeds/_CheckField.svelte";
|
|
4
4
|
export { default as ColorPicker, type ColorPickerProps, type ColorPickerReqdProps, type ColorPickerBindProps, getHex } from "./_svseeds/_ColorPicker.svelte";
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BASE,
|
|
1
|
+
export { BASE, VARIANT, PARTS, elemId, fnClass, isNeutral, isUnsignedInteger, omit, debounce, throttle, UniqueId } from "./_svseeds/core";
|
|
2
2
|
export { default as Button } from "./_svseeds/_Button.svelte";
|
|
3
3
|
export { default as CheckField } from "./_svseeds/_CheckField.svelte";
|
|
4
4
|
export { default as ColorPicker, getHex } from "./_svseeds/_ColorPicker.svelte";
|