forge-select 0.1.0 → 0.3.0

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
@@ -1,4 +1,4 @@
1
- # ForgeSelect
1
+ # Forge Select
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/forge-select.svg)](https://www.npmjs.com/package/forge-select)
4
4
  [![CI](https://github.com/cmm-cmm/ForgeSelect/actions/workflows/ci.yml/badge.svg)](https://github.com/cmm-cmm/ForgeSelect/actions/workflows/ci.yml)
@@ -6,13 +6,13 @@
6
6
 
7
7
  «A modern, lightweight, highly customizable replacement for Select2.»
8
8
 
9
- ForgeSelect is a next-generation JavaScript select component built for modern web applications. It provides a clean API, powerful customization options, excellent performance, and accessibility while remaining framework-agnostic.
9
+ Forge Select is a next-generation JavaScript select component built for modern web applications. It provides a clean API, powerful customization options, excellent performance, and accessibility while remaining framework-agnostic.
10
10
 
11
- ## Why ForgeSelect?
11
+ ## Why Forge Select?
12
12
 
13
13
  Select2 has served the community well for many years, but modern web development has evolved.
14
14
 
15
- ForgeSelect is designed to provide:
15
+ Forge Select is designed to provide:
16
16
 
17
17
  - 🚀 High performance
18
18
  - 🎨 Fully customizable UI
@@ -29,13 +29,13 @@ ForgeSelect is designed to provide:
29
29
 
30
30
  ## Documentation
31
31
 
32
- Browse the documentation website at **<https://cmm-cmm.github.io/ForgeSelect/docs/>**, or read the sources in [`docs/`](./docs/README.md):
32
+ Browse the documentation website at **<https://forgeselect.konexforge.com/docs/>**, or read the sources in [`docs/`](./docs/README.md):
33
33
 
34
34
  - [API Reference](./docs/api-reference.md) — constructor, options, methods, events
35
35
  - [Examples](./docs/examples.md) — copy-pasteable snippets for every feature and framework
36
- - [Playground](./docs/playground.md) — [live demo](https://cmm-cmm.github.io/ForgeSelect/demo/) on GitHub Pages
36
+ - [Playground](./docs/playground.md) — [live demo](https://forgeselect.konexforge.com/demo/)
37
37
  - [Migration from Select2](./docs/migration-from-select2.md) — option/event/method mapping and a migration checklist
38
- - [Benchmarks](./docs/benchmarks.md) — performance methodology and results (planned)
38
+ - [Benchmarks](./docs/benchmarks.md) — reproducible bundle, initialization, search, and scrolling baseline
39
39
  - [Plugin Development Guide](./docs/plugin-development.md) — write and register your own plugins
40
40
 
41
41
  ## Features
@@ -43,7 +43,7 @@ Browse the documentation website at **<https://cmm-cmm.github.io/ForgeSelect/doc
43
43
  - Single Select
44
44
  - Multiple Select
45
45
  - Searchable Dropdown
46
- - Async Data Source (AJAX with debounce)
46
+ - Async Data Source (AJAX with debounce, optional infinite-scroll pagination)
47
47
  - Rich Item Rendering (avatar + label + description, XSS-safe built-in fields)
48
48
  - Virtual Scrolling (automatic for large lists, with per-option render caching)
49
49
  - Custom Templates
@@ -51,6 +51,8 @@ Browse the documentation website at **<https://cmm-cmm.github.io/ForgeSelect/doc
51
51
  - Keyboard Navigation
52
52
  - Disabled Options
53
53
  - Option Groups
54
+ - Tree Select (nested options with expand/collapse and cascading multi-select)
55
+ - Drag & Drop Tag Ordering (reorder a multi-select's selected tags by mouse/touch/pen, or Alt+Left/Alt+Right on keyboard)
54
56
  - Clear Selection
55
57
  - Placeholder
56
58
  - Custom Themes (CSS variables, dark mode included)
@@ -59,7 +61,7 @@ Browse the documentation website at **<https://cmm-cmm.github.io/ForgeSelect/doc
59
61
  - Internationalization (en/vi built in, custom string tables)
60
62
  - TypeScript Support (written in strict TypeScript, ships `.d.ts`)
61
63
 
62
- > Planned/in-progress capabilities — Tree Select, Async Pagination, Drag & Drop Ordering, and React/Vue/Angular/Svelte wrappers — are tracked in the [Roadmap](#roadmap) below and intentionally not listed above as shipped features.
64
+ > Planned/in-progress capabilities — Angular/Svelte wrappers — are tracked in the [Roadmap](#roadmap) below and intentionally not listed above as shipped features.
63
65
 
64
66
  ## Installation
65
67
 
@@ -75,9 +77,9 @@ pnpm add forge-select
75
77
 
76
78
  ```html
77
79
  <select id="country">
78
- <option value="vn">Vietnam</option>
79
- <option value="jp">Japan</option>
80
- <option value="us">United States</option>
80
+ <option value="vn">Vietnam</option>
81
+ <option value="jp">Japan</option>
82
+ <option value="us">United States</option>
81
83
  </select>
82
84
  ```
83
85
 
@@ -92,12 +94,12 @@ new ForgeSelect("#country");
92
94
 
93
95
  ```js
94
96
  const select = new ForgeSelect("#country", {
95
- placeholder: "Select a country",
96
- searchable: true,
97
- multiple: false,
98
- clearable: true,
99
- allowCreate: false,
100
- theme: "default"
97
+ placeholder: "Select a country",
98
+ searchable: true,
99
+ multiple: false,
100
+ clearable: true,
101
+ allowCreate: false,
102
+ theme: "default",
101
103
  });
102
104
  ```
103
105
 
@@ -106,24 +108,27 @@ See the [API Reference](./docs/api-reference.md) for all options, including `dat
106
108
  ## Events
107
109
 
108
110
  ```js
109
- select.on("change", value => console.log(value));
111
+ select.on("change", (value) => console.log(value));
110
112
  select.on("open", () => {});
111
113
  select.on("close", () => {});
112
- select.on("search", query => console.log("searching:", query));
114
+ select.on("search", (query) => console.log("searching:", query));
113
115
  select.on("clear", () => {});
116
+ select.on("error", (error) => console.error(error));
114
117
  ```
115
118
 
116
119
  Unsubscribe with `select.off(event, handler)`.
117
120
 
121
+ Use `select.setValue(value, { emitChange: false })` to synchronize external controlled state without emitting `change`.
122
+
118
123
  ## Examples
119
124
 
120
125
  ```js
121
126
  new ForgeSelect("#users", {
122
- ajax: {
123
- url: query => `/api/users?q=${encodeURIComponent(query)}`,
124
- debounce: 300,
125
- transform: response => response.items.map(u => ({ value: u.id, label: u.name }))
126
- }
127
+ ajax: {
128
+ url: (query) => `/api/users?q=${encodeURIComponent(query)}`,
129
+ debounce: 300,
130
+ transform: (response) => response.items.map((u) => ({ value: u.id, label: u.name })),
131
+ },
127
132
  });
128
133
  ```
129
134
 
@@ -131,16 +136,25 @@ More copy-pasteable snippets (multi-select, tags, custom templates, virtual scro
131
136
 
132
137
  ## Playground
133
138
 
134
- Write and run ForgeSelect code in the browser at **<https://cmm-cmm.github.io/ForgeSelect/playground/>** — with presets for every major feature. A curated feature showcase also lives at **<https://cmm-cmm.github.io/ForgeSelect/demo/>**. See [`docs/playground.md`](./docs/playground.md) for details and local setup.
139
+ Write and run Forge Select code in the browser at **<https://forgeselect.konexforge.com/playground/>** — with presets for every major feature. A curated feature showcase also lives at **<https://forgeselect.konexforge.com/demo/>**. See [`docs/playground.md`](./docs/playground.md) for details and local setup.
135
140
 
136
141
  ## API Reference
137
142
 
138
- | Option | Type | Default | Description |
139
- |---|---|---|---|
140
- | `placeholder` | `string` | `""` | Text shown when nothing is selected |
141
- | `searchable` | `boolean` | `true` | Show a search input in the dropdown |
142
- | `multiple` | `boolean` | `false` | Allow selecting more than one option |
143
- | `theme` | `string` | `"default"` | Named theme applied to the control |
143
+ | Option | Type | Default | Description |
144
+ | --------------- | ---------------------------------- | ----------- | --------------------------------------------------- |
145
+ | `placeholder` | `string` | `""` | Text shown when nothing is selected |
146
+ | `searchable` | `boolean` | `true` | Show a search input in the dropdown |
147
+ | `multiple` | `boolean` | `false` | Allow selecting more than one option |
148
+ | `clearable` | `boolean` | `false` | Show a button to clear the current selection |
149
+ | `allowCreate` | `boolean` | `false` | Let the user create a new option from free text |
150
+ | `sortable` | `boolean` | `false` | Multi-select: let the user reorder selected tags |
151
+ | `theme` | `string` | `"default"` | Named theme applied to the control |
152
+ | `data` | `Array<Option \| OptionGroup>` | `undefined` | Static options, used instead of `<option>` children |
153
+ | `ajax` | `AjaxConfig` | `undefined` | Remote data source config |
154
+ | `virtualScroll` | `boolean` | _(auto)_ | Virtualize the list once it exceeds ~100 rows |
155
+ | `itemHeight` | `number` | `36` | Row height in px used by the virtual scroller |
156
+ | `language` | `string \| Record<string, string>` | `"en"` | Locale code or a custom string table for i18n |
157
+ | `plugins` | `Array<ForgeSelectPlugin>` | `[]` | Plugins to register on this instance |
144
158
 
145
159
  Full constructor signature, all options, instance methods, and events are documented in [`docs/api-reference.md`](./docs/api-reference.md).
146
160
 
@@ -154,18 +168,20 @@ new ForgeSelect("#country", { theme: "dark" });
154
168
 
155
169
  ```css
156
170
  .forge-select {
157
- --fs-border-focus: #e11d48;
158
- --fs-radius: 4px;
171
+ --fs-border-focus: #e11d48;
172
+ --fs-radius: 4px;
159
173
  }
160
174
  ```
161
175
 
162
176
  ## Framework Support
163
177
 
178
+ Forge Select is vanilla TypeScript/JavaScript, so it can be mounted inside any framework today. Official wrapper packages exist for a couple of them:
179
+
164
180
  - Vanilla JavaScript
165
- - React
166
- - Vue
167
- - Angular
168
- - Svelte
181
+ - React — via [`forge-select-react`](./packages/react/README.md) (`ForgeSelectReact` component, controlled `value`/`onChange`)
182
+ - Vue — via [`forge-select-vue`](./packages/vue/README.md) (`ForgeSelectVue` component, `v-model` support)
183
+ - Angular — mount manually for now; a dedicated wrapper is on the [Roadmap](#roadmap)
184
+ - Svelte — mount manually for now; a dedicated wrapper is on the [Roadmap](#roadmap)
169
185
  - Next.js
170
186
  - Nuxt
171
187
  - Astro
@@ -180,28 +196,28 @@ new ForgeSelect("#country", { theme: "dark" });
180
196
 
181
197
  ## Migration from Select2
182
198
 
183
- ForgeSelect is designed as a drop-in-concept replacement for Select2: no jQuery dependency, native accessibility, and a smaller API surface. A full option/event/method mapping table and a step-by-step migration checklist are available in [`docs/migration-from-select2.md`](./docs/migration-from-select2.md).
199
+ Forge Select is designed as a drop-in-concept replacement for Select2: no jQuery dependency, native accessibility, and a smaller API surface. A full option/event/method mapping table and a step-by-step migration checklist are available in [`docs/migration-from-select2.md`](./docs/migration-from-select2.md).
184
200
 
185
201
  ## Benchmarks
186
202
 
187
- Performance benchmarking (bundle size, init time, search latency, virtual scroll performance) against Select2 is planned once the first release ships. Methodology and the results format are documented in [`docs/benchmarks.md`](./docs/benchmarks.md).
203
+ Run `npm run bench` for a reproducible JSON baseline covering bundle size, initialization, 10,000-option search latency, and virtual-scroll performance. The methodology and result fields are documented in [`docs/benchmarks.md`](./docs/benchmarks.md).
188
204
 
189
205
  ## Roadmap
190
206
 
191
- - [ ] Tree Select
207
+ - [x] Tree Select
192
208
  - [x] Virtualized List
193
- - [ ] Async Pagination
194
- - [ ] Drag & Drop Ordering
209
+ - [x] Async Pagination
210
+ - [x] Drag & Drop Ordering
195
211
  - [x] Theme Builder
196
212
  - [x] CSS Variables
197
- - [ ] React Component
198
- - [ ] Vue Component
213
+ - [x] React Component
214
+ - [x] Vue Component
199
215
  - [ ] Angular Component
200
216
  - [ ] Svelte Component
201
217
 
202
218
  ## Plugin Development Guide
203
219
 
204
- ForgeSelect uses a small plugin architecture (`onInit`, `onOpen`, `onClose`, `onDestroy` lifecycle hooks) so behavior can be extended without forking the core. See [`docs/plugin-development.md`](./docs/plugin-development.md) for the plugin interface and a complete example plugin.
220
+ Forge Select uses a small plugin architecture (`onInit`, `onOpen`, `onClose`, `onDestroy` lifecycle hooks) so behavior can be extended without forking the core. See [`docs/plugin-development.md`](./docs/plugin-development.md) for the plugin interface and a complete example plugin.
205
221
 
206
222
  ## Development
207
223