@molecule/app-inbox-row-vue 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/InboxRow.d.ts +154 -0
- package/dist/InboxRow.d.ts.map +1 -0
- package/dist/InboxRow.js +184 -0
- package/dist/InboxRow.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @molecule/app-inbox-row-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Email / notification inbox row — sender + subject + preview + time + unread dot
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @molecule/app-inbox-row-vue
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
|
|
10
|
+
|
|
11
|
+
License: Apache-2.0
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue inbox / message-list row: selection slot + star toggle + avatar +
|
|
3
|
+
* sender/labels + subject/preview + attachment/unread/timestamp.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-inbox-row-react`'s `InboxRow` — the same
|
|
6
|
+
* props (React names), the same DOM for the same input, and the same i18n keys.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { type PropType, type VNode } from 'vue';
|
|
11
|
+
/**
|
|
12
|
+
* Inbox / email message list row — sender + subject + preview + timestamp +
|
|
13
|
+
* unread/star indicators. Generalizes beyond email to any "message list" UI
|
|
14
|
+
* (chat lists, notification archives, ticket queues).
|
|
15
|
+
*
|
|
16
|
+
* @param props - Component props (see {@link InboxRowProps}).
|
|
17
|
+
* @returns The inbox row component.
|
|
18
|
+
*/
|
|
19
|
+
export declare const InboxRow: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
20
|
+
sender: {
|
|
21
|
+
type: null;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
senderAvatarSrc: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
subject: {
|
|
29
|
+
type: null;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
preview: {
|
|
33
|
+
type: null;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
timestamp: {
|
|
37
|
+
type: null;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
unread: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
starred: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
hasAttachment: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
labels: {
|
|
53
|
+
type: null;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
selectionSlot: {
|
|
57
|
+
type: null;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Click handler — typically opens the message. While it is set, the whole
|
|
62
|
+
* row is clickable through a transparent native button laid over it, named
|
|
63
|
+
* by the sender and the subject (two ids, `aria-labelledby="<senderId>
|
|
64
|
+
* <subjectId>"`); the inner controls — the star toggle, the selection slot
|
|
65
|
+
* and the labels slot — sit above that button and keep their own clicks.
|
|
66
|
+
*/
|
|
67
|
+
onClick: {
|
|
68
|
+
type: PropType<() => void>;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
onToggleStar: {
|
|
72
|
+
type: PropType<() => void>;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
className: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
80
|
+
sender: {
|
|
81
|
+
type: null;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
senderAvatarSrc: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
88
|
+
subject: {
|
|
89
|
+
type: null;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
preview: {
|
|
93
|
+
type: null;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
timestamp: {
|
|
97
|
+
type: null;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
unread: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
starred: {
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
default: undefined;
|
|
107
|
+
};
|
|
108
|
+
hasAttachment: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: undefined;
|
|
111
|
+
};
|
|
112
|
+
labels: {
|
|
113
|
+
type: null;
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
selectionSlot: {
|
|
117
|
+
type: null;
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Click handler — typically opens the message. While it is set, the whole
|
|
122
|
+
* row is clickable through a transparent native button laid over it, named
|
|
123
|
+
* by the sender and the subject (two ids, `aria-labelledby="<senderId>
|
|
124
|
+
* <subjectId>"`); the inner controls — the star toggle, the selection slot
|
|
125
|
+
* and the labels slot — sit above that button and keep their own clicks.
|
|
126
|
+
*/
|
|
127
|
+
onClick: {
|
|
128
|
+
type: PropType<() => void>;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
onToggleStar: {
|
|
132
|
+
type: PropType<() => void>;
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
135
|
+
className: {
|
|
136
|
+
type: StringConstructor;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
}>> & Readonly<{}>, {
|
|
140
|
+
sender: any;
|
|
141
|
+
senderAvatarSrc: string;
|
|
142
|
+
subject: any;
|
|
143
|
+
preview: any;
|
|
144
|
+
timestamp: any;
|
|
145
|
+
unread: boolean;
|
|
146
|
+
starred: boolean;
|
|
147
|
+
hasAttachment: boolean;
|
|
148
|
+
labels: any;
|
|
149
|
+
selectionSlot: any;
|
|
150
|
+
onClick: () => void;
|
|
151
|
+
onToggleStar: () => void;
|
|
152
|
+
className: string;
|
|
153
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
154
|
+
//# sourceMappingURL=InboxRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InboxRow.d.ts","sourceRoot":"","sources":["../src/InboxRow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAS,KAAK,KAAK,EAAmB,MAAM,KAAK,CAAA;AAiC3F;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAajB;;;;;;OAMG;;cAC0B,QAAQ,CAAC,MAAM,IAAI,CAAC;;;;cACf,QAAQ,CAAC,MAAM,IAAI,CAAC;;;;;;;UAS3C,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjBhB;;;;;;OAMG;;cAC0B,QAAQ,CAAC,MAAM,IAAI,CAAC;;;;cACf,QAAQ,CAAC,MAAM,IAAI,CAAC;;;;;;;;;;;;;;;;;;mBADV,IAAI;wBACC,IAAI;;4EAoMvD,CAAA"}
|
package/dist/InboxRow.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue inbox / message-list row: selection slot + star toggle + avatar +
|
|
3
|
+
* sender/labels + subject/preview + attachment/unread/timestamp.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-inbox-row-react`'s `InboxRow` — the same
|
|
6
|
+
* props (React names), the same DOM for the same input, and the same i18n keys.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { defineComponent, h, useId } from 'vue';
|
|
11
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
12
|
+
import { Avatar } from '@molecule/app-ui-vue';
|
|
13
|
+
import { useTranslation } from '@molecule/app-vue';
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a node-valued prop that may also arrive as a same-named slot: a
|
|
16
|
+
* prop that was given wins (React's single source of truth — a later `null`
|
|
17
|
+
* removes the node, as React does), and the slot is used only while the prop
|
|
18
|
+
* is absent. An absent pair contributes nothing.
|
|
19
|
+
*
|
|
20
|
+
* @param prop - The prop value, when the caller passed the prop.
|
|
21
|
+
* @param slot - The slot render function, when the caller passed the slot.
|
|
22
|
+
* @returns The children to render.
|
|
23
|
+
*/
|
|
24
|
+
const nodeValue = (prop, slot) => {
|
|
25
|
+
if (prop !== undefined)
|
|
26
|
+
return prop === null ? [] : [prop];
|
|
27
|
+
if (slot)
|
|
28
|
+
return slot();
|
|
29
|
+
return [];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Whether React's `value && …` renders for this pair: a given prop is judged
|
|
33
|
+
* by its own truthiness, and an absent prop falls back to the slot's presence.
|
|
34
|
+
*
|
|
35
|
+
* @param prop - The prop value.
|
|
36
|
+
* @param slot - The slot render function.
|
|
37
|
+
* @returns True when the branch renders.
|
|
38
|
+
*/
|
|
39
|
+
const isPresent = (prop, slot) => prop !== undefined ? Boolean(prop) : slot !== undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Inbox / email message list row — sender + subject + preview + timestamp +
|
|
42
|
+
* unread/star indicators. Generalizes beyond email to any "message list" UI
|
|
43
|
+
* (chat lists, notification archives, ticket queues).
|
|
44
|
+
*
|
|
45
|
+
* @param props - Component props (see {@link InboxRowProps}).
|
|
46
|
+
* @returns The inbox row component.
|
|
47
|
+
*/
|
|
48
|
+
export const InboxRow = defineComponent({
|
|
49
|
+
name: 'InboxRow',
|
|
50
|
+
props: {
|
|
51
|
+
sender: { type: null, default: undefined },
|
|
52
|
+
senderAvatarSrc: { type: String, default: undefined },
|
|
53
|
+
subject: { type: null, default: undefined },
|
|
54
|
+
preview: { type: null, default: undefined },
|
|
55
|
+
timestamp: { type: null, default: undefined },
|
|
56
|
+
unread: { type: Boolean, default: undefined },
|
|
57
|
+
starred: { type: Boolean, default: undefined },
|
|
58
|
+
hasAttachment: { type: Boolean, default: undefined },
|
|
59
|
+
labels: { type: null, default: undefined },
|
|
60
|
+
selectionSlot: { type: null, default: undefined },
|
|
61
|
+
/**
|
|
62
|
+
* Click handler — typically opens the message. While it is set, the whole
|
|
63
|
+
* row is clickable through a transparent native button laid over it, named
|
|
64
|
+
* by the sender and the subject (two ids, `aria-labelledby="<senderId>
|
|
65
|
+
* <subjectId>"`); the inner controls — the star toggle, the selection slot
|
|
66
|
+
* and the labels slot — sit above that button and keep their own clicks.
|
|
67
|
+
*/
|
|
68
|
+
onClick: { type: Function, default: undefined },
|
|
69
|
+
onToggleStar: { type: Function, default: undefined },
|
|
70
|
+
className: { type: String, default: undefined },
|
|
71
|
+
},
|
|
72
|
+
setup(props, { slots }) {
|
|
73
|
+
const cm = getClassMap();
|
|
74
|
+
const { t } = useTranslation();
|
|
75
|
+
/** Base of the two ids that name the open button (Vue's `useId`). */
|
|
76
|
+
const nameId = useId();
|
|
77
|
+
return () => {
|
|
78
|
+
const senderId = props.onClick ? `${nameId}-sender` : undefined;
|
|
79
|
+
const subjectId = props.onClick ? `${nameId}-subject` : undefined;
|
|
80
|
+
const openLabelledBy = props.onClick ? `${nameId}-sender ${nameId}-subject` : undefined;
|
|
81
|
+
const senderName = typeof props.sender === 'string'
|
|
82
|
+
? props.sender
|
|
83
|
+
: t('inboxRow.sender', undefined, { defaultValue: 'Sender' });
|
|
84
|
+
/** The star button's fixed inline style (React's object, in CSS terms). */
|
|
85
|
+
const starStyle = {
|
|
86
|
+
background: 'none',
|
|
87
|
+
border: 'none',
|
|
88
|
+
fontSize: '16px',
|
|
89
|
+
};
|
|
90
|
+
const children = [];
|
|
91
|
+
// The row's open action: an empty, transparent native button covering
|
|
92
|
+
// the whole row (Enter / Space activate it natively), named by the
|
|
93
|
+
// sender and the subject. A sibling of the row's other controls, not
|
|
94
|
+
// their wrapper, so a button may carry it.
|
|
95
|
+
if (props.onClick) {
|
|
96
|
+
children.push(h('button', {
|
|
97
|
+
type: 'button',
|
|
98
|
+
'aria-labelledby': openLabelledBy,
|
|
99
|
+
'data-mol-id': 'inbox-row-open',
|
|
100
|
+
onClick: () => props.onClick?.(),
|
|
101
|
+
class: cm.cn(cm.position('absolute'), cm.inset0, cm.cursorPointer),
|
|
102
|
+
style: { background: 'transparent', border: 'none', padding: '0px' },
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
// The selection slot: inside a positioned wrapper while the open button
|
|
106
|
+
// exists (the wrapper paints above it, so a click lands on the slot and
|
|
107
|
+
// never reaches the open button), bare otherwise.
|
|
108
|
+
const selection = [...nodeValue(props.selectionSlot, slots.selectionSlot)];
|
|
109
|
+
children.push(props.onClick && selection.length
|
|
110
|
+
? h('span', { class: cm.cn(cm.position('relative')) }, selection)
|
|
111
|
+
: selection);
|
|
112
|
+
if (props.onToggleStar !== undefined) {
|
|
113
|
+
const star = h('button', {
|
|
114
|
+
type: 'button',
|
|
115
|
+
// Raised above the open button in its positioned wrapper (see the
|
|
116
|
+
// selection slot), so its click cannot reach the row's open action.
|
|
117
|
+
onClick: () => props.onToggleStar?.(),
|
|
118
|
+
'aria-pressed': props.starred,
|
|
119
|
+
'data-mol-id': 'inbox-row-star',
|
|
120
|
+
'aria-label': props.starred
|
|
121
|
+
? t('inboxRow.unstar', undefined, { defaultValue: 'Unstar' })
|
|
122
|
+
: t('inboxRow.star', undefined, { defaultValue: 'Star' }),
|
|
123
|
+
class: cm.cn(cm.cursorPointer, cm.touchTarget, props.starred ? cm.textTone('warning') : cm.textMuted),
|
|
124
|
+
style: starStyle,
|
|
125
|
+
}, '★');
|
|
126
|
+
children.push(props.onClick ? h('span', { class: cm.cn(cm.position('relative')) }, [star]) : star);
|
|
127
|
+
}
|
|
128
|
+
children.push(h(Avatar, {
|
|
129
|
+
src: props.senderAvatarSrc,
|
|
130
|
+
alt: senderName,
|
|
131
|
+
name: senderName,
|
|
132
|
+
size: 'sm',
|
|
133
|
+
}));
|
|
134
|
+
const senderRow = [
|
|
135
|
+
// The id names the open button (React's two `aria-labelledby` ids).
|
|
136
|
+
h('span', { id: senderId, class: cm.textSize('sm') }, nodeValue(props.sender, slots.sender)),
|
|
137
|
+
];
|
|
138
|
+
if (isPresent(props.labels, slots.labels)) {
|
|
139
|
+
senderRow.push(h('span', {
|
|
140
|
+
class: cm.cn(cm.flex({ align: 'center', gap: 'xs' }), props.onClick ? cm.position('relative') : undefined),
|
|
141
|
+
}, [...nodeValue(props.labels, slots.labels)]));
|
|
142
|
+
}
|
|
143
|
+
const subjectRow = [
|
|
144
|
+
h('span', { id: subjectId, class: cm.textSize('sm') }, nodeValue(props.subject, slots.subject)),
|
|
145
|
+
];
|
|
146
|
+
if (isPresent(props.preview, slots.preview)) {
|
|
147
|
+
subjectRow.push(h('span', {
|
|
148
|
+
class: cm.cn(cm.textSize('sm'), cm.sp('ml', 2)),
|
|
149
|
+
style: { opacity: '0.6' },
|
|
150
|
+
}, ['— ', ...nodeValue(props.preview, slots.preview)]));
|
|
151
|
+
}
|
|
152
|
+
/** The row's label text: sender + labels, subject + preview. */
|
|
153
|
+
const labelRows = [
|
|
154
|
+
h('div', { class: cm.flex({ align: 'baseline', gap: 'sm' }) }, senderRow),
|
|
155
|
+
h('div', { style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, subjectRow),
|
|
156
|
+
];
|
|
157
|
+
children.push(h('div', { class: cm.cn(cm.flex1, cm.stack(0)), style: { minWidth: '0px' } }, labelRows));
|
|
158
|
+
if (props.hasAttachment) {
|
|
159
|
+
children.push(h('span', {
|
|
160
|
+
'aria-label': t('inboxRow.hasAttachment', undefined, {
|
|
161
|
+
defaultValue: 'Has attachment',
|
|
162
|
+
}),
|
|
163
|
+
}, '📎'));
|
|
164
|
+
}
|
|
165
|
+
if (props.unread) {
|
|
166
|
+
children.push(h('span', {
|
|
167
|
+
'aria-hidden': true,
|
|
168
|
+
class: cm.bgTone('info'),
|
|
169
|
+
style: { width: '8px', height: '8px', borderRadius: '50%' },
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
if (isPresent(props.timestamp, slots.timestamp)) {
|
|
173
|
+
children.push(h('span', { class: cm.cn(cm.textSize('xs'), cm.shrink0) }, [
|
|
174
|
+
...nodeValue(props.timestamp, slots.timestamp),
|
|
175
|
+
]));
|
|
176
|
+
}
|
|
177
|
+
return h('div', {
|
|
178
|
+
class: cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('px', 3), cm.sp('py', 2), props.onClick ? cm.position('relative') : undefined, props.className),
|
|
179
|
+
style: props.unread ? { fontWeight: '600' } : undefined,
|
|
180
|
+
}, children);
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
//# sourceMappingURL=InboxRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InboxRow.js","sourceRoot":"","sources":["../src/InboxRow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,KAAK,EAA+B,MAAM,KAAK,CAAA;AAE3F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,CAAC,IAAgB,EAAE,IAAsC,EAAgB,EAAE;IAC3F,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC1D,IAAI,IAAI;QAAE,OAAO,IAAI,EAAE,CAAA;IACvB,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,CAAC,IAAgB,EAAE,IAAsC,EAAW,EAAE,CACtF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAA;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;IACtC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE;QACL,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,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EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;aACxD,EACD,QAAQ,CACT,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue inbox / email message list row.
|
|
3
|
+
*
|
|
4
|
+
* Exports `<InboxRow>` and the `InboxRowProps` type — the Vue counterpart of
|
|
5
|
+
* `@molecule/app-inbox-row-react`: the same props (React names) and the same
|
|
6
|
+
* DOM for the same input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createApp, defineComponent, h } from 'vue'
|
|
11
|
+
* import { InboxRow } from '@molecule/app-inbox-row-vue'
|
|
12
|
+
*
|
|
13
|
+
* const App = defineComponent({
|
|
14
|
+
* setup() {
|
|
15
|
+
* return () =>
|
|
16
|
+
* h(InboxRow, {
|
|
17
|
+
* sender: 'Alice Johnson',
|
|
18
|
+
* senderAvatarSrc: 'https://example.com/alice.jpg',
|
|
19
|
+
* subject: 'Q3 report is ready',
|
|
20
|
+
* preview: "Hi, I've attached the final numbers for review...",
|
|
21
|
+
* timestamp: '10:42 AM',
|
|
22
|
+
* unread: true,
|
|
23
|
+
* starred: false,
|
|
24
|
+
* hasAttachment: true,
|
|
25
|
+
* onClick: () => openMessage(msg.id),
|
|
26
|
+
* onToggleStar: () => toggleStar(msg.id),
|
|
27
|
+
* })
|
|
28
|
+
* },
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* createApp(App).mount('#app')
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* - With `onClick` set, the whole row is clickable through a transparent
|
|
36
|
+
* native button laid over it, named by the sender and the subject (two ids,
|
|
37
|
+
* `aria-labelledby="<senderId> <subjectId>"`); the inner controls (the star
|
|
38
|
+
* toggle, the selection slot, the labels slot) sit above it and keep their
|
|
39
|
+
* own clicks. A native button turns Enter and Space into a click itself, so
|
|
40
|
+
* the row's open action needs no key handler.
|
|
41
|
+
* - Star/attachment indicators use fixed colors and emoji. Their aria-labels
|
|
42
|
+
* ("Star"/"Unstar"/"Has attachment") route through `t()` under `inboxRow.*`,
|
|
43
|
+
* translated by the `@molecule/app-locales-inbox-row` companion bond; they
|
|
44
|
+
* are read through `useTranslation()`, so a locale switch re-renders them.
|
|
45
|
+
* - When `sender` is not a plain string, the avatar's accessible name falls
|
|
46
|
+
* back to the translated "Sender" (`inboxRow.sender`) — pass a string
|
|
47
|
+
* `sender` (or your own `selectionSlot`) when screen-reader naming matters.
|
|
48
|
+
* - `unread` bolds the row via an inline `fontWeight: 600` and renders a fixed
|
|
49
|
+
* blue dot — the dot color does not follow the theme.
|
|
50
|
+
* - `getClassMap()` requires a bonded ClassMap; `<Avatar>` comes from
|
|
51
|
+
* `@molecule/app-ui-vue`.
|
|
52
|
+
* - Node-valued props (`sender`, `subject`, `preview`, `timestamp`, `labels`,
|
|
53
|
+
* `selectionSlot`) accept a prop or a same-named slot; a given prop wins.
|
|
54
|
+
*
|
|
55
|
+
* @module
|
|
56
|
+
*/
|
|
57
|
+
export * from './InboxRow.js';
|
|
58
|
+
export * from './types.js';
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue inbox / email message list row.
|
|
3
|
+
*
|
|
4
|
+
* Exports `<InboxRow>` and the `InboxRowProps` type — the Vue counterpart of
|
|
5
|
+
* `@molecule/app-inbox-row-react`: the same props (React names) and the same
|
|
6
|
+
* DOM for the same input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createApp, defineComponent, h } from 'vue'
|
|
11
|
+
* import { InboxRow } from '@molecule/app-inbox-row-vue'
|
|
12
|
+
*
|
|
13
|
+
* const App = defineComponent({
|
|
14
|
+
* setup() {
|
|
15
|
+
* return () =>
|
|
16
|
+
* h(InboxRow, {
|
|
17
|
+
* sender: 'Alice Johnson',
|
|
18
|
+
* senderAvatarSrc: 'https://example.com/alice.jpg',
|
|
19
|
+
* subject: 'Q3 report is ready',
|
|
20
|
+
* preview: "Hi, I've attached the final numbers for review...",
|
|
21
|
+
* timestamp: '10:42 AM',
|
|
22
|
+
* unread: true,
|
|
23
|
+
* starred: false,
|
|
24
|
+
* hasAttachment: true,
|
|
25
|
+
* onClick: () => openMessage(msg.id),
|
|
26
|
+
* onToggleStar: () => toggleStar(msg.id),
|
|
27
|
+
* })
|
|
28
|
+
* },
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* createApp(App).mount('#app')
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* - With `onClick` set, the whole row is clickable through a transparent
|
|
36
|
+
* native button laid over it, named by the sender and the subject (two ids,
|
|
37
|
+
* `aria-labelledby="<senderId> <subjectId>"`); the inner controls (the star
|
|
38
|
+
* toggle, the selection slot, the labels slot) sit above it and keep their
|
|
39
|
+
* own clicks. A native button turns Enter and Space into a click itself, so
|
|
40
|
+
* the row's open action needs no key handler.
|
|
41
|
+
* - Star/attachment indicators use fixed colors and emoji. Their aria-labels
|
|
42
|
+
* ("Star"/"Unstar"/"Has attachment") route through `t()` under `inboxRow.*`,
|
|
43
|
+
* translated by the `@molecule/app-locales-inbox-row` companion bond; they
|
|
44
|
+
* are read through `useTranslation()`, so a locale switch re-renders them.
|
|
45
|
+
* - When `sender` is not a plain string, the avatar's accessible name falls
|
|
46
|
+
* back to the translated "Sender" (`inboxRow.sender`) — pass a string
|
|
47
|
+
* `sender` (or your own `selectionSlot`) when screen-reader naming matters.
|
|
48
|
+
* - `unread` bolds the row via an inline `fontWeight: 600` and renders a fixed
|
|
49
|
+
* blue dot — the dot color does not follow the theme.
|
|
50
|
+
* - `getClassMap()` requires a bonded ClassMap; `<Avatar>` comes from
|
|
51
|
+
* `@molecule/app-ui-vue`.
|
|
52
|
+
* - Node-valued props (`sender`, `subject`, `preview`, `timestamp`, `labels`,
|
|
53
|
+
* `selectionSlot`) accept a prop or a same-named slot; a given prop wins.
|
|
54
|
+
*
|
|
55
|
+
* @module
|
|
56
|
+
*/
|
|
57
|
+
export * from './InboxRow.js';
|
|
58
|
+
export * from './types.js';
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Vue inbox / message-list row.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { VNodeChild } from 'vue';
|
|
7
|
+
/** Props accepted by the {@link InboxRow} component. */
|
|
8
|
+
export interface InboxRowProps {
|
|
9
|
+
/**
|
|
10
|
+
* Sender display. Passed as a prop or as the same-named slot — both work;
|
|
11
|
+
* a plain string also names the avatar's image.
|
|
12
|
+
*/
|
|
13
|
+
sender: VNodeChild;
|
|
14
|
+
/** Avatar URL fallback for sender. */
|
|
15
|
+
senderAvatarSrc?: string;
|
|
16
|
+
/** Subject / headline. Passed as a prop or as the same-named slot. */
|
|
17
|
+
subject: VNodeChild;
|
|
18
|
+
/** Preview / first line of body (a prop or the `preview` slot). */
|
|
19
|
+
preview?: VNodeChild;
|
|
20
|
+
/** Display timestamp (a prop or the `timestamp` slot). */
|
|
21
|
+
timestamp?: VNodeChild;
|
|
22
|
+
/** Whether the message is unread (drives bold + dot). */
|
|
23
|
+
unread?: boolean;
|
|
24
|
+
/** Whether the message is starred / flagged. */
|
|
25
|
+
starred?: boolean;
|
|
26
|
+
/** Optional attachment indicator. */
|
|
27
|
+
hasAttachment?: boolean;
|
|
28
|
+
/** Optional labels / tags chip row (a prop or the `labels` slot). */
|
|
29
|
+
labels?: VNodeChild;
|
|
30
|
+
/** Right-side selection slot (checkbox) — a prop or the `selectionSlot` slot. */
|
|
31
|
+
selectionSlot?: VNodeChild;
|
|
32
|
+
/**
|
|
33
|
+
* Click handler — typically opens the message. While it is set, the whole
|
|
34
|
+
* row is clickable through a transparent native button laid over it, named
|
|
35
|
+
* by the sender and the subject (two ids, `aria-labelledby="<senderId>
|
|
36
|
+
* <subjectId>"`); the inner controls — the star toggle, the selection slot
|
|
37
|
+
* and the labels slot — sit above that button and keep their own clicks.
|
|
38
|
+
*/
|
|
39
|
+
onClick?: () => void;
|
|
40
|
+
/** Star toggle. */
|
|
41
|
+
onToggleStar?: () => void;
|
|
42
|
+
/** Extra classes. */
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,MAAM,EAAE,UAAU,CAAA;IAClB,sCAAsC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sEAAsE;IACtE,OAAO,EAAE,UAAU,CAAA;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qCAAqC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,qEAAqE;IACrE,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,iFAAiF;IACjF,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,mBAAmB;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-inbox-row-vue",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "Email / notification inbox row — sender + subject + preview + time + unread dot",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-inbox-row-vue",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "vue-tsc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"inbox-row",
|
|
28
|
+
"vue"
|
|
29
|
+
],
|
|
30
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/inbox-row-vue"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@molecule/app-i18n": "^1.0.1",
|
|
46
|
+
"@molecule/app-ui": "^1.4.0",
|
|
47
|
+
"@molecule/app-ui-vue": "^1.1.0",
|
|
48
|
+
"@molecule/app-vue": "^3.5.0",
|
|
49
|
+
"vue": "^3.4.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
53
|
+
"@molecule/app-i18n": "1.2.2",
|
|
54
|
+
"@molecule/app-icons": "1.0.4",
|
|
55
|
+
"@molecule/app-ui": "1.4.0",
|
|
56
|
+
"@molecule/app-ui-vue": "1.1.5",
|
|
57
|
+
"@molecule/app-vue": "3.7.2",
|
|
58
|
+
"@types/node": "26.6.5",
|
|
59
|
+
"jsdom": "30.1.3",
|
|
60
|
+
"typescript": "6.0.3",
|
|
61
|
+
"vite": "8.3.5",
|
|
62
|
+
"vitest": "4.1.12",
|
|
63
|
+
"vue": "3.5.44",
|
|
64
|
+
"vue-tsc": "3.3.13"
|
|
65
|
+
}
|
|
66
|
+
}
|