@telperion/elements 3.0.1 → 4.0.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/.build-manifest.json +12 -1
- package/README.md +45 -0
- package/_chunks/signal-watcher-lit-element-B9xodkLt.d.cts +29 -0
- package/_chunks/signal-watcher-lit-element-B9xodkLt.d.ts +29 -0
- package/drag-drop/drag-handle-element.cjs +1 -1
- package/drag-drop/drag-handle-element.js +1 -1
- package/fesm/elements.mjs +548 -31
- package/fesm/elements.mjs.map +1 -1
- package/iife/elements.js +187 -21
- package/iife/elements.js.map +1 -1
- package/iife/popover/index.js +44 -6
- package/iife/popover/index.js.map +1 -1
- package/iife/router/index.js.map +1 -1
- package/iife/select/index.js +273 -0
- package/iife/select/index.js.map +1 -0
- package/index.cjs +15 -0
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/package.json +32 -5
- package/popover/index.d.cts +2 -2
- package/popover/index.d.ts +2 -2
- package/popover/popover-element.cjs +29 -19
- package/popover/popover-element.cjs.map +1 -1
- package/popover/popover-element.js +30 -20
- package/popover/popover-element.js.map +1 -1
- package/router/index.d.cts +2 -26
- package/router/index.d.ts +2 -26
- package/router/tha-router-config.cjs +2 -2
- package/router/tha-router-config.cjs.map +1 -1
- package/router/tha-router-config.js +2 -2
- package/router/tha-router-config.js.map +1 -1
- package/router/tha-router-link.cjs +1 -1
- package/router/tha-router-link.js +1 -1
- package/router/tha-router-outlet.cjs +1 -1
- package/router/tha-router-outlet.js +1 -1
- package/router/tha-router-param.cjs +1 -1
- package/router/tha-router-param.js +1 -1
- package/router/tha-router.cjs +1 -1
- package/router/tha-router.js +1 -1
- package/select/index.cjs +21 -0
- package/select/index.cjs.map +1 -0
- package/select/index.d.cts +219 -0
- package/select/index.d.ts +219 -0
- package/select/index.js +4 -0
- package/select/index.js.map +1 -0
- package/select/internal-props.cjs +10 -0
- package/select/internal-props.cjs.map +1 -0
- package/select/internal-props.js +6 -0
- package/select/internal-props.js.map +1 -0
- package/select/option.element.cjs +88 -0
- package/select/option.element.cjs.map +1 -0
- package/select/option.element.js +88 -0
- package/select/option.element.js.map +1 -0
- package/select/select-context.cjs +14 -0
- package/select/select-context.cjs.map +1 -0
- package/select/select-context.js +12 -0
- package/select/select-context.js.map +1 -0
- package/select/select.element.cjs +376 -0
- package/select/select.element.cjs.map +1 -0
- package/select/select.element.js +376 -0
- package/select/select.element.js.map +1 -0
- package/select/selected-content.element.cjs +65 -0
- package/select/selected-content.element.cjs.map +1 -0
- package/select/selected-content.element.js +65 -0
- package/select/selected-content.element.js.map +1 -0
- package/utils/signal-watcher-lit-element.cjs.map +1 -0
- package/utils/signal-watcher-lit-element.js.map +1 -0
- package/router/signal-watcher-lit-element.cjs.map +0 -1
- package/router/signal-watcher-lit-element.js.map +0 -1
- /package/{router → utils}/signal-watcher-lit-element.cjs +0 -0
- /package/{router → utils}/signal-watcher-lit-element.js +0 -0
package/.build-manifest.json
CHANGED
|
@@ -77,7 +77,18 @@
|
|
|
77
77
|
"dts": "popover/index.d.ts",
|
|
78
78
|
"dcts": "popover/index.d.cts"
|
|
79
79
|
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "select/index",
|
|
83
|
+
"sourcePath": "src/select/index.ts",
|
|
84
|
+
"outputs": {
|
|
85
|
+
"esm": "select/index.js",
|
|
86
|
+
"cjs": "select/index.cjs",
|
|
87
|
+
"iife": "iife/select/index.js",
|
|
88
|
+
"dts": "select/index.d.ts",
|
|
89
|
+
"dcts": "select/index.d.cts"
|
|
90
|
+
}
|
|
80
91
|
}
|
|
81
92
|
],
|
|
82
|
-
"generatedAt": "2026-05-
|
|
93
|
+
"generatedAt": "2026-05-04T10:07:05.797Z"
|
|
83
94
|
}
|
package/README.md
CHANGED
|
@@ -62,6 +62,9 @@ Use the **explicit `/iife/...` path** so the CDN serves the standalone bundle (s
|
|
|
62
62
|
|
|
63
63
|
<!-- Or just the popover module (TelperionElements.Popover) -->
|
|
64
64
|
<script src="https://unpkg.com/@telperion/elements/iife/popover/index.js"></script>
|
|
65
|
+
|
|
66
|
+
<!-- Or just the select module (TelperionElements.Select) -->
|
|
67
|
+
<script src="https://unpkg.com/@telperion/elements/iife/select/index.js"></script>
|
|
65
68
|
```
|
|
66
69
|
|
|
67
70
|
Each per-module bundle is fully self-contained: side-effect imports register the custom elements as soon as the script is evaluated. jsDelivr (`https://cdn.jsdelivr.net/npm/@telperion/elements/iife/...`) and other npm CDNs work the same way.
|
|
@@ -205,6 +208,48 @@ import "@telperion/elements/popover";
|
|
|
205
208
|
|
|
206
209
|
---
|
|
207
210
|
|
|
211
|
+
### Select
|
|
212
|
+
|
|
213
|
+
Form-associated, framework-agnostic selectbox built on `<tp-popover>`. Single-select by default; switches to multi-select with FIFO eviction via `max`. Selection state is signal-backed and discoverable across nested shadow DOM boundaries via `@lit/context`.
|
|
214
|
+
|
|
215
|
+
**Includes:**
|
|
216
|
+
- `<tp-select>` — the selectbox itself
|
|
217
|
+
- `<tp-option>` — a single selectable item
|
|
218
|
+
- `<tp-selected-content>` — live mirror of the current selection (used as the trigger label by default)
|
|
219
|
+
|
|
220
|
+
**Features:**
|
|
221
|
+
- Form-associated custom element with full `<form>` integration via `ElementInternals` (`name`, `disabled`, `required`, reset/restore callbacks, `validity`)
|
|
222
|
+
- `max` attribute — `1` for single-select, any positive integer for multi-select with FIFO eviction at the cap, or `infinite` for unbounded selection
|
|
223
|
+
- Single-select submits a string; multi-select submits a `FormData` with one entry per value (matching native `<select multiple>`)
|
|
224
|
+
- Auto-closes the popover when a selection fills the quota; stays open while accumulating in multi-select
|
|
225
|
+
- Three slots: `slot="button"` (replace trigger), `slot="popover"` (replace panel content while keeping `<tp-option>` children registered for selection / validation / submission), and the default slot (option list)
|
|
226
|
+
- `<tp-selected-content>` works anywhere in the descendant composed tree — including across shadow DOM boundaries
|
|
227
|
+
- Signal-driven re-rendering via the `SignalWatcher` mixin — no manual change listeners
|
|
228
|
+
|
|
229
|
+
#### JS/TS
|
|
230
|
+
```ts
|
|
231
|
+
import "@telperion/elements/select";
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### HTML
|
|
235
|
+
```html
|
|
236
|
+
<tp-select name="fruit" required placeholder="Pick a fruit">
|
|
237
|
+
<tp-option value="apple">Apple</tp-option>
|
|
238
|
+
<tp-option value="banana">Banana</tp-option>
|
|
239
|
+
<tp-option value="cherry">Cherry</tp-option>
|
|
240
|
+
</tp-select>
|
|
241
|
+
|
|
242
|
+
<!-- Multi-select with FIFO cap of 3 -->
|
|
243
|
+
<tp-select name="tags" max="3">…</tp-select>
|
|
244
|
+
|
|
245
|
+
<!-- Unbounded multi-select -->
|
|
246
|
+
<tp-select name="tags" max="infinite">…</tp-select>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
[Select Documentation →](./src/select/README.md)
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
208
253
|
This library is actively being developed. More components will be added over time.
|
|
209
254
|
|
|
210
255
|
## 🤝 Contributing
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
interface EffectOptions {
|
|
4
|
+
/**
|
|
5
|
+
* By default effects run after the element has updated. If `beforeUpdate`
|
|
6
|
+
* is set to `true`, the effect will run before the element updates.
|
|
7
|
+
*/
|
|
8
|
+
beforeUpdate?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* By default, effects are automatically disposed when the element is
|
|
11
|
+
* disconnected. If `manualDispose` is set to `true`, the effect will not
|
|
12
|
+
* be automatically disposed, and you must call the returned function to
|
|
13
|
+
* dispose of the effect manually.
|
|
14
|
+
*/
|
|
15
|
+
manualDispose?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A LitElement base class extended with SignalWatcher capabilities.
|
|
19
|
+
*
|
|
20
|
+
* This class allows LitElement components to reactively watch for changes
|
|
21
|
+
*/
|
|
22
|
+
declare const SignalWatcherLitElement: ({
|
|
23
|
+
new (): LitElement & {
|
|
24
|
+
updateEffect(fn: () => void, options?: EffectOptions): () => void;
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { SignalWatcherLitElement as S };
|
|
29
|
+
export type { EffectOptions as E };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
interface EffectOptions {
|
|
4
|
+
/**
|
|
5
|
+
* By default effects run after the element has updated. If `beforeUpdate`
|
|
6
|
+
* is set to `true`, the effect will run before the element updates.
|
|
7
|
+
*/
|
|
8
|
+
beforeUpdate?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* By default, effects are automatically disposed when the element is
|
|
11
|
+
* disconnected. If `manualDispose` is set to `true`, the effect will not
|
|
12
|
+
* be automatically disposed, and you must call the returned function to
|
|
13
|
+
* dispose of the effect manually.
|
|
14
|
+
*/
|
|
15
|
+
manualDispose?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A LitElement base class extended with SignalWatcher capabilities.
|
|
19
|
+
*
|
|
20
|
+
* This class allows LitElement components to reactively watch for changes
|
|
21
|
+
*/
|
|
22
|
+
declare const SignalWatcherLitElement: ({
|
|
23
|
+
new (): LitElement & {
|
|
24
|
+
updateEffect(fn: () => void, options?: EffectOptions): () => void;
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { SignalWatcherLitElement as S };
|
|
29
|
+
export type { EffectOptions as E };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
|
-
var getParents = require('@
|
|
4
|
+
var getParents = require('@telperion/dom-utils/get-parents');
|
|
5
5
|
var lit = require('lit');
|
|
6
6
|
var decorators_js = require('lit/decorators.js');
|
|
7
7
|
var dragElement = require('./drag-element.cjs');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
-
import { getParents } from '@
|
|
2
|
+
import { getParents } from '@telperion/dom-utils/get-parents';
|
|
3
3
|
import { LitElement, html } from 'lit';
|
|
4
4
|
import { customElement } from 'lit/decorators.js';
|
|
5
5
|
import { DragElement } from './drag-element.js';
|