@smilodon/vanilla 1.10.0 → 1.10.1

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/README.md CHANGED
@@ -8,6 +8,10 @@ Vanilla JavaScript/TypeScript helpers for Smilodon Select. Part of the [Smilodon
8
8
  >
9
9
  > **Registration prerequisite:** import `@smilodon/core` before calling `createSelect()` or `initSelect()`. The Vanilla helper creates an `enhanced-select` element and immediately calls its imperative methods; it does not wait for custom-element registration/upgrade. For an existing host, await `customElements.whenDefined('enhanced-select')` before `initSelect()`.
10
10
 
11
+ ## Acknowledged data-loading adapter status
12
+
13
+ The Phase 2F-D development candidate currently integrates acknowledged data loading through the core API and React adapter only. The `@smilodon/vanilla` helper does not publish a typed helper contract for request identity, completion, cancellation, and projection lifecycle. Passing `dataLoading` through casts or relying on the underlying element is undocumented and unsupported through these helpers. Vanilla adapter parity remains a separate, pending work package; the legacy helper API remains supported.
14
+
11
15
  ## Features
12
16
 
13
17
  - ✨ **Simple API** - Easy-to-use helper functions for vanilla JS
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Smilodon Vanilla - Simple helpers for using Smilodon Select with vanilla JavaScript/TypeScript
3
+ *
4
+ * This package provides convenience functions and utilities for working with
5
+ * the Smilodon Select web component in vanilla JavaScript applications.
6
+ */
7
+ import type { GlobalSelectConfig, SelectionConfig, MultiSelectDisplayConfig, ScrollToSelectedConfig, StyleConfig } from '@smilodon/core';
8
+ export { configureSelect, resetSelectConfig, selectConfig } from '@smilodon/core';
9
+ /**
10
+ * Select item interface
11
+ */
12
+ export interface SelectItem {
13
+ value: string | number;
14
+ label: string;
15
+ disabled?: boolean;
16
+ group?: string;
17
+ [key: string]: any;
18
+ }
19
+ /**
20
+ * Grouped items interface
21
+ */
22
+ export interface GroupedItem {
23
+ group: string;
24
+ items: SelectItem[];
25
+ }
26
+ /**
27
+ * Create a select element with options
28
+ */
29
+ export declare function createSelect(options: {
30
+ items?: SelectItem[];
31
+ groupedItems?: GroupedItem[];
32
+ value?: string | number | (string | number)[];
33
+ multiple?: boolean;
34
+ searchable?: boolean;
35
+ placeholder?: string;
36
+ disabled?: boolean;
37
+ required?: boolean;
38
+ error?: boolean;
39
+ infiniteScroll?: boolean;
40
+ pageSize?: number;
41
+ virtualized?: boolean;
42
+ maxSelections?: number;
43
+ selectionConfig?: Partial<SelectionConfig>;
44
+ multiSelectDisplay?: Partial<MultiSelectDisplayConfig>;
45
+ scrollToSelected?: Partial<ScrollToSelectedConfig>;
46
+ styles?: StyleConfig;
47
+ config?: Partial<GlobalSelectConfig>;
48
+ removeButtonIcon?: string;
49
+ disabledOptionBehavior?: {
50
+ selectable?: boolean;
51
+ hoverable?: boolean;
52
+ focusable?: boolean;
53
+ };
54
+ showSelectedIndicator?: boolean;
55
+ direction?: 'ltr' | 'rtl';
56
+ placement?: 'bottom' | 'top' | 'auto';
57
+ clearable?: boolean;
58
+ clearSelectionOnClear?: boolean;
59
+ clearSearchOnClear?: boolean;
60
+ clearAriaLabel?: string;
61
+ clearIcon?: string;
62
+ className?: string;
63
+ style?: Partial<CSSStyleDeclaration>;
64
+ onChange?: (value: any, items: any[]) => void;
65
+ onSelect?: (item: any, index: number) => void;
66
+ onOpen?: () => void;
67
+ onClose?: () => void;
68
+ onSearch?: (query: string) => void;
69
+ onLoadMore?: (page: number) => void;
70
+ onCreate?: (value: string) => void;
71
+ onClear?: (detail: {
72
+ clearedSelection: boolean;
73
+ clearedSearch: boolean;
74
+ }) => void;
75
+ onDiagnostic?: (detail: any) => void;
76
+ trackingEnabled?: boolean;
77
+ trackEvents?: boolean;
78
+ trackStyling?: boolean;
79
+ trackLimitations?: boolean;
80
+ emitDiagnostics?: boolean;
81
+ trackingMaxEntries?: number;
82
+ limitationPolicies?: Record<string, {
83
+ mode: 'default' | 'suppress' | 'strict';
84
+ note?: string;
85
+ }>;
86
+ autoMitigateRuntimeModeSwitch?: boolean;
87
+ }): HTMLElement;
88
+ /**
89
+ * Initialize a select element that already exists in the DOM
90
+ */
91
+ export declare function initSelect(element: HTMLElement, options: {
92
+ items?: SelectItem[];
93
+ groupedItems?: GroupedItem[];
94
+ value?: string | number | (string | number)[];
95
+ multiple?: boolean;
96
+ searchable?: boolean;
97
+ placeholder?: string;
98
+ disabled?: boolean;
99
+ infiniteScroll?: boolean;
100
+ pageSize?: number;
101
+ virtualized?: boolean;
102
+ maxSelections?: number;
103
+ selectionConfig?: Partial<SelectionConfig>;
104
+ multiSelectDisplay?: Partial<MultiSelectDisplayConfig>;
105
+ scrollToSelected?: Partial<ScrollToSelectedConfig>;
106
+ styles?: StyleConfig;
107
+ config?: Partial<GlobalSelectConfig>;
108
+ clearable?: boolean;
109
+ clearSelectionOnClear?: boolean;
110
+ clearSearchOnClear?: boolean;
111
+ clearAriaLabel?: string;
112
+ clearIcon?: string;
113
+ }): void;
114
+ /**
115
+ * Get the selected value(s) from a select element
116
+ */
117
+ export declare function getValue(element: HTMLElement): any;
118
+ /**
119
+ * Set the selected value(s) for a select element
120
+ */
121
+ export declare function setValue(element: HTMLElement, value: string | number | (string | number)[]): void;
122
+ /**
123
+ * Clear the selection
124
+ */
125
+ export declare function clear(element: HTMLElement): void;
126
+ /**
127
+ * Clear the current search query
128
+ */
129
+ export declare function clearSearch(element: HTMLElement): void;
130
+ /**
131
+ * Open the dropdown
132
+ */
133
+ export declare function open(element: HTMLElement): void;
134
+ /**
135
+ * Close the dropdown
136
+ */
137
+ export declare function close(element: HTMLElement): void;
138
+ /**
139
+ * Update items
140
+ */
141
+ export declare function setItems(element: HTMLElement, items: SelectItem[]): void;
142
+ /**
143
+ * Update grouped items
144
+ */
145
+ export declare function setGroupedItems(element: HTMLElement, groups: GroupedItem[]): void;
146
+ export declare function getSelectedItems(element: HTMLElement): any[];
147
+ export declare function updateConfig(element: HTMLElement, config: Partial<GlobalSelectConfig>): void;
148
+ export declare function setError(element: HTMLElement, message: string): void;
149
+ export declare function clearError(element: HTMLElement): void;
150
+ export declare function setRequired(element: HTMLElement, required: boolean): void;
151
+ export declare function validate(element: HTMLElement): boolean;
152
+ export declare function getCapabilities(element: HTMLElement): any;
153
+ export declare function getKnownLimitations(element: HTMLElement): any[];
154
+ export declare function getTrackingSnapshot(element: HTMLElement): any;
155
+ export declare function clearTracking(element: HTMLElement, source?: 'event' | 'style' | 'limitation' | 'all'): void;
156
+ export declare function setLimitationPolicies(element: HTMLElement, policies: Record<string, {
157
+ mode: 'default' | 'suppress' | 'strict';
158
+ note?: string;
159
+ }>): void;
160
+ export type { SelectEventDetail, ChangeEventDetail, SearchEventDetail, LoadMoreEventDetail, ErrorEventDetail, DiagnosticEventDetail, LimitationPolicyMap, TrackingSnapshot, SelectCapabilitiesReport, LimitationState, GlobalSelectConfig, SelectionConfig, MultiSelectDisplayConfig, ScrollToSelectedConfig, StyleConfig, ClearControlConfig, ExpandableConfig, InfiniteScrollConfig, LoadMoreConfig, BusyBucketConfig, ServerSideConfig, TrackingConfig, LimitationsConfig, } from '@smilodon/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smilodon/vanilla",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "Vanilla JavaScript helpers for Smilodon Select - part of the Smilodon UI toolkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -19,7 +19,7 @@
19
19
  "COMPLETE-GUIDE.md"
20
20
  ],
21
21
  "scripts": {
22
- "build": "tsc --emitDeclarationOnly --outDir dist/types && vite build",
22
+ "build": "vite build && tsc --emitDeclarationOnly --outDir dist/types && node scripts/cleanup-types.js",
23
23
  "size": "gzip -c dist/index.mjs | wc -c",
24
24
  "prepublishOnly": "npm run build"
25
25
  },
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "typescript": "^5.6.2",
31
- "vite": "^5.4.11"
31
+ "vite": "6.4.6"
32
32
  },
33
33
  "keywords": [
34
34
  "vanilla",