@colletdev/core 0.1.3 → 0.1.4
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/custom-elements.json
CHANGED
|
@@ -2903,6 +2903,14 @@
|
|
|
2903
2903
|
"default": "false",
|
|
2904
2904
|
"fieldName": "show_prev_next"
|
|
2905
2905
|
},
|
|
2906
|
+
{
|
|
2907
|
+
"name": "variant",
|
|
2908
|
+
"type": {
|
|
2909
|
+
"text": "string"
|
|
2910
|
+
},
|
|
2911
|
+
"default": "\"\"",
|
|
2912
|
+
"fieldName": "variant"
|
|
2913
|
+
},
|
|
2906
2914
|
{
|
|
2907
2915
|
"name": "prev-label",
|
|
2908
2916
|
"type": {
|
|
@@ -2919,6 +2927,14 @@
|
|
|
2919
2927
|
"default": "\"\"",
|
|
2920
2928
|
"fieldName": "next_label"
|
|
2921
2929
|
},
|
|
2930
|
+
{
|
|
2931
|
+
"name": "load-more-label",
|
|
2932
|
+
"type": {
|
|
2933
|
+
"text": "string"
|
|
2934
|
+
},
|
|
2935
|
+
"default": "\"\"",
|
|
2936
|
+
"fieldName": "load_more_label"
|
|
2937
|
+
},
|
|
2922
2938
|
{
|
|
2923
2939
|
"name": "page-size-options",
|
|
2924
2940
|
"type": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colletdev/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Rust/WASM Custom Elements — 48 production-grade UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "generated/index.js",
|
|
@@ -41,7 +41,14 @@
|
|
|
41
41
|
"custom-elements.json"
|
|
42
42
|
],
|
|
43
43
|
"customElements": "custom-elements.json",
|
|
44
|
-
"keywords": [
|
|
44
|
+
"keywords": [
|
|
45
|
+
"web-components",
|
|
46
|
+
"custom-elements",
|
|
47
|
+
"rust",
|
|
48
|
+
"wasm",
|
|
49
|
+
"ui",
|
|
50
|
+
"design-system"
|
|
51
|
+
],
|
|
45
52
|
"author": "Dan",
|
|
46
53
|
"license": "MIT",
|
|
47
54
|
"sideEffects": false,
|
|
@@ -20,10 +20,11 @@ export function defineCxChatInput(wasmFn, baseClass) {
|
|
|
20
20
|
if (!this._isInitialized) {
|
|
21
21
|
this._markInitialized();
|
|
22
22
|
|
|
23
|
-
// Input event delegation for cx-input
|
|
23
|
+
// Input event delegation for cx-input + multiline detection
|
|
24
24
|
this._shadow.addEventListener('input', (e) => {
|
|
25
25
|
if (e.target.tagName === 'TEXTAREA') {
|
|
26
26
|
this._emit('cx-input', { value: e.target.value });
|
|
27
|
+
this.#detectMultiline(e.target);
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
|
|
@@ -56,6 +57,33 @@ export function defineCxChatInput(wasmFn, baseClass) {
|
|
|
56
57
|
super.connectedCallback();
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
// ── Multiline Detection ──
|
|
61
|
+
// Toggles `data-multiline` on the container when textarea exceeds one row.
|
|
62
|
+
// CSS drives the pill→rounded morph via `data-[multiline]:rounded-2xl` and
|
|
63
|
+
// `group-data-[multiline]:` selectors on child elements.
|
|
64
|
+
#detectMultiline(textarea) {
|
|
65
|
+
const container = textarea.closest('[data-chat-input]');
|
|
66
|
+
if (!container) return;
|
|
67
|
+
|
|
68
|
+
// Store baseline height on first measure (single-line height).
|
|
69
|
+
if (!textarea._baseH) {
|
|
70
|
+
textarea._baseH = textarea.scrollHeight;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const hasNewline = textarea.value.includes('\n');
|
|
74
|
+
const hasOverflow = textarea._baseH ? textarea.scrollHeight > textarea._baseH + 2 : false;
|
|
75
|
+
const isMulti = hasNewline || hasOverflow;
|
|
76
|
+
const current = container.hasAttribute('data-multiline');
|
|
77
|
+
|
|
78
|
+
if (isMulti !== current) {
|
|
79
|
+
if (isMulti) {
|
|
80
|
+
container.setAttribute('data-multiline', '');
|
|
81
|
+
} else {
|
|
82
|
+
container.removeAttribute('data-multiline');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
59
87
|
// ── Public imperative API ──
|
|
60
88
|
focus() {
|
|
61
89
|
const el = this._shadow.querySelector('textarea');
|
|
@@ -64,9 +92,25 @@ export function defineCxChatInput(wasmFn, baseClass) {
|
|
|
64
92
|
|
|
65
93
|
_doRender() {
|
|
66
94
|
try {
|
|
95
|
+
// Preserve textarea value across re-renders (innerHTML replacement).
|
|
96
|
+
const prevTextarea = this._shadow.querySelector('textarea');
|
|
97
|
+
const savedValue = prevTextarea?.value || '';
|
|
98
|
+
|
|
67
99
|
this._props.slotted = true;
|
|
68
100
|
const result = wasmFn(this._props);
|
|
69
101
|
this._injectHtml(result);
|
|
102
|
+
|
|
103
|
+
// Restore textarea value and re-measure multiline state.
|
|
104
|
+
const textarea = this._shadow.querySelector('textarea');
|
|
105
|
+
if (textarea && savedValue) {
|
|
106
|
+
textarea.value = savedValue;
|
|
107
|
+
requestAnimationFrame(() => this.#detectMultiline(textarea));
|
|
108
|
+
} else if (textarea) {
|
|
109
|
+
// First render: measure baseline height.
|
|
110
|
+
requestAnimationFrame(() => {
|
|
111
|
+
textarea._baseH = textarea.scrollHeight;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
70
114
|
} catch (e) {
|
|
71
115
|
console.error('[cx-chat-input]', e);
|
|
72
116
|
}
|
|
@@ -10,8 +10,10 @@ export interface CxPaginationAttributes {
|
|
|
10
10
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
11
|
showInfo?: boolean;
|
|
12
12
|
showPrevNext?: boolean;
|
|
13
|
+
variant?: string;
|
|
13
14
|
prevLabel?: string;
|
|
14
15
|
nextLabel?: string;
|
|
16
|
+
loadMoreLabel?: string;
|
|
15
17
|
pageSizeOptions?: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
export function defineCxPagination(wasmFn, baseClass) {
|
|
5
5
|
class CxPagination extends baseClass {
|
|
6
|
-
static observedAttributes = ['id', 'current-page', 'page-size', 'total-items', 'label', 'size', 'show-info', 'show-prev-next', 'prev-label', 'next-label', 'page-size-options'];
|
|
6
|
+
static observedAttributes = ['id', 'current-page', 'page-size', 'total-items', 'label', 'size', 'show-info', 'show-prev-next', 'variant', 'prev-label', 'next-label', 'load-more-label', 'page-size-options'];
|
|
7
7
|
static _booleanAttrs = new Set(['show-info', 'show-prev-next']);
|
|
8
8
|
static _numericAttrs = new Set(['current-page', 'page-size', 'total-items']);
|
|
9
9
|
static _hostDisplay = 'block';
|
package/src/runtime.js
CHANGED
|
@@ -231,6 +231,12 @@ const compatSheet = createSyncSheet([
|
|
|
231
231
|
// Scoped to [data-check] so it doesn't break "hidden data-[open]:block" on dropdowns.
|
|
232
232
|
'[data-check].hidden { display: none !important; }',
|
|
233
233
|
'',
|
|
234
|
+
// Tailwind v4 press/scale compat: MicroInteraction::press() generates
|
|
235
|
+
// `transition-transform active:scale-[0.97]`. TW4 uses the individual CSS
|
|
236
|
+
// `scale` property (not `transform: scale(...)`). `transition: transform`
|
|
237
|
+
// won't animate it. This rule overrides the transition to target `scale`.
|
|
238
|
+
'.transition-transform { transition-property: scale !important; }',
|
|
239
|
+
'',
|
|
234
240
|
// Ensure border-box in shadow DOM (Tailwind preflight may not load first)
|
|
235
241
|
'*, *::before, *::after { box-sizing: border-box; }',
|
|
236
242
|
'',
|
package/wasm/wasm_api_bg.wasm
CHANGED
|
Binary file
|