@molecule/app-day-timeline-solid 0.0.0-stage → 1.1.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/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,183 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-18T23:41:43.377Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-day-timeline-solid
10
+
11
+ Solid vertical 24h day-of-events timeline — itinerary planner, daily agenda,
12
+ schedule view. Events are absolutely positioned by start/end hour and
13
+ scaled by `pxPerHour` (total height = (endHour - startHour) * pxPerHour).
14
+
15
+ Exports `DayTimeline` and `formatHour` — the Solid counterpart of
16
+ `@molecule/app-day-timeline-react`, with the same props (React names) and
17
+ the same DOM for the same input.
18
+
19
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
20
+ > It is written to be read by coding agents as much as by people, and is generated from this
21
+ > package's source — edit `src/index.ts` JSDoc, not this file.
22
+
23
+ ## Quick Start
24
+
25
+ ```tsx
26
+ import { DayTimeline } from '@molecule/app-day-timeline-solid'
27
+
28
+ ;<DayTimeline
29
+ startHour={7}
30
+ endHour={22}
31
+ events={[
32
+ { id: 'flight', title: 'Flight to LAX', startHour: 13, endHour: 16 },
33
+ { id: 'dinner', title: 'Dinner', startHour: 19, endHour: 20.5 },
34
+ ]}
35
+ />
36
+ ```
37
+
38
+ ## Type
39
+
40
+ `feature`
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ npm install @molecule/app-day-timeline-solid @molecule/app-i18n @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
46
+ ```
47
+
48
+ ## API
49
+
50
+ ### Interfaces
51
+
52
+ #### `DayTimelineEvent`
53
+
54
+ A single event positioned on the day axis.
55
+
56
+ ```typescript
57
+ interface DayTimelineEvent {
58
+ /** Stable id (used as the render key + `data-event-id`). */
59
+ id: string
60
+ /** Event title (a JSX value, or plain text). */
61
+ title: JSX.Element
62
+ /** Optional secondary line (location, type, etc.: a JSX value, or plain text). */
63
+ subtitle?: JSX.Element
64
+ /** Start hour in fractional 24h (e.g. `9.5` = 9:30 AM). */
65
+ startHour: number
66
+ /** End hour in fractional 24h. Must be > `startHour`. */
67
+ endHour: number
68
+ /** Optional accent color (CSS color value). */
69
+ accentColor?: string
70
+ /** Optional click handler. */
71
+ onClick?: () => void
72
+ }
73
+ ```
74
+
75
+ #### `DayTimelineProps`
76
+
77
+ Props for {@link DayTimeline}.
78
+
79
+ ```typescript
80
+ interface DayTimelineProps {
81
+ /** Events to render on the timeline. */
82
+ events: DayTimelineEvent[]
83
+ /** First hour rendered (inclusive). Defaults to `0`. */
84
+ startHour?: number
85
+ /** Last hour rendered (exclusive). Defaults to `24`. */
86
+ endHour?: number
87
+ /**
88
+ * Pixel height per hour. Drives the overall axis size: total height =
89
+ * `(endHour - startHour) * pxPerHour`. Defaults to `60`.
90
+ */
91
+ pxPerHour?: number
92
+ /**
93
+ * Whether to render the axis tick labels (e.g. "9 AM"). Defaults to
94
+ * `true`.
95
+ */
96
+ showAxisLabels?: boolean
97
+ /** `data-mol-id` attribute for AI-agent selectors. */
98
+ dataMolId?: string
99
+ /** Extra classes appended via the ClassMap `cn()` helper. */
100
+ className?: string
101
+ }
102
+ ```
103
+
104
+ ### Functions
105
+
106
+ #### `formatHour(hour)`
107
+
108
+ Format a fractional 24h hour as `H AM/PM` (e.g. `9.5` → `9:30 AM`).
109
+
110
+ ```typescript
111
+ function formatHour(hour: number): string
112
+ ```
113
+
114
+ - `hour` — Fractional 24h hour value.
115
+
116
+ **Returns:** A short clock-style label.
117
+
118
+ #### `DayTimeline(props)`
119
+
120
+ Vertical 24h day-of-events timeline. Events are absolutely positioned over a
121
+ 1-hour-tick axis; their height reflects duration. Designed for itinerary
122
+ planners, daily agendas, and schedule views.
123
+
124
+ React keys each event by its `id`, so a re-passed or re-ordered event list
125
+ keeps the rendered cards per id. Solid's `For` keys by reference, so the
126
+ rows are keyed through stable per-id records: the record for an id is created
127
+ once and reused, while the card's content reads the CURRENT event for that
128
+ id reactively.
129
+
130
+ ```typescript
131
+ function DayTimeline(props: DayTimelineProps): JSX.Element
132
+ ```
133
+
134
+ - `props` — Component props (see {@link DayTimelineProps}).
135
+
136
+ **Returns:** The rendered timeline.
137
+
138
+ ## Injection Notes
139
+
140
+ ### Requirements
141
+
142
+ Peer dependencies:
143
+
144
+ - `@molecule/app-i18n` ^1.0.1
145
+ - `@molecule/app-solid` ^3.5.0
146
+ - `@molecule/app-ui` ^1.3.11
147
+ - `@molecule/app-ui-solid` ^1.1.0
148
+ - `solid-js` ^1.8.0
149
+
150
+ ### Runtime Dependencies
151
+
152
+ - `@molecule/app-i18n`
153
+ - `@molecule/app-solid`
154
+ - `@molecule/app-ui`
155
+ - `@molecule/app-ui-solid`
156
+ - `solid-js`
157
+
158
+ - **No overlap/lane layout.** Events are absolutely positioned across the
159
+ full rail width, so events with overlapping time ranges render stacked
160
+ on top of each other. If your data can contain concurrent events,
161
+ partition them into separate `<DayTimeline>` columns (one per lane or
162
+ resource) before rendering — the component does not de-conflict.
163
+ - Bounds are clamped: `startHour` to [0, 24], `endHour` to at least
164
+ `startHour + 1`; an event shorter than 15 minutes still renders at a
165
+ 20px minimum height so it stays clickable.
166
+ - Axis tick labels are formatted by the exported `formatHour()`, which
167
+ uses English 12-hour "AM/PM" notation. There is currently no prop to
168
+ localize tick formatting — hide them with `showAxisLabels={false}` and
169
+ render your own axis if you need 24h or localized labels.
170
+ - Aria labels resolve through `t()` with English fallbacks; the companion
171
+ locale bond is `@molecule/app-locales-day-timeline`. Requires the app's
172
+ i18n provider (`useTranslation()` throws without one) and a wired
173
+ ClassMap bond (standard molecule app setup).
174
+ - Events with an `onClick` render their content inside a native `<button>`
175
+ (Enter and Space activate it); events without one are not focusable.
176
+ - Titles and subtitles are JSX values, as React's `ReactNode` fields are.
177
+ - Events are keyed by `id` through stable per-id records (Solid's `For`
178
+ keys by reference), so a re-passed or re-ordered list keeps each card's
179
+ DOM the way React's `key` does.
180
+
181
+ ## Translations
182
+
183
+ Translation strings are provided by `@molecule/app-locales-day-timeline`.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Solid vertical 24h day-of-events timeline — itinerary planner, daily agenda,
3
+ * schedule view.
4
+ *
5
+ * Solid counterpart of `@molecule/app-day-timeline-react`'s `DayTimeline` —
6
+ * the same props (React names), the same ClassMap tokens, the same inline
7
+ * styles, and the same DOM for the same input.
8
+ *
9
+ * @module
10
+ */
11
+ import { type Component } from 'solid-js';
12
+ import type { DayTimelineProps } from './types.js';
13
+ /**
14
+ * Format a fractional 24h hour as `H AM/PM` (e.g. `9.5` → `9:30 AM`).
15
+ *
16
+ * @param hour - Fractional 24h hour value.
17
+ * @returns A short clock-style label.
18
+ */
19
+ export declare function formatHour(hour: number): string;
20
+ /**
21
+ * Vertical 24h day-of-events timeline. Events are absolutely positioned over a
22
+ * 1-hour-tick axis; their height reflects duration. Designed for itinerary
23
+ * planners, daily agendas, and schedule views.
24
+ *
25
+ * React keys each event by its `id`, so a re-passed or re-ordered event list
26
+ * keeps the rendered cards per id. Solid's `For` keys by reference, so the
27
+ * rows are keyed through stable per-id records: the record for an id is created
28
+ * once and reused, while the card's content reads the CURRENT event for that
29
+ * id reactively.
30
+ *
31
+ * @param props - Component props (see {@link DayTimelineProps}).
32
+ * @returns The rendered timeline.
33
+ */
34
+ export declare const DayTimeline: Component<DayTimelineProps>;
35
+ //# sourceMappingURL=DayTimeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayTimeline.d.ts","sourceRoot":"","sources":["../src/DayTimeline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,UAAU,CAAA;AAKxD,OAAO,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEpE;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAmHD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,gBAAgB,CAmHnD,CAAA"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Solid vertical 24h day-of-events timeline — itinerary planner, daily agenda,
3
+ * schedule view.
4
+ *
5
+ * Solid counterpart of `@molecule/app-day-timeline-react`'s `DayTimeline` —
6
+ * the same props (React names), the same ClassMap tokens, the same inline
7
+ * styles, and the same DOM for the same input.
8
+ *
9
+ * @module
10
+ */
11
+ import { For } from 'solid-js';
12
+ import { useTranslation } from '@molecule/app-solid';
13
+ import { getClassMap } from '@molecule/app-ui';
14
+ /**
15
+ * Format a fractional 24h hour as `H AM/PM` (e.g. `9.5` → `9:30 AM`).
16
+ *
17
+ * @param hour - Fractional 24h hour value.
18
+ * @returns A short clock-style label.
19
+ */
20
+ export function formatHour(hour) {
21
+ const hh = Math.floor(hour);
22
+ const mm = Math.round((hour - hh) * 60);
23
+ const period = hh >= 12 ? 'PM' : 'AM';
24
+ const display = ((hh + 11) % 12) + 1;
25
+ return mm === 0 ? `${display} ${period}` : `${display}:${String(mm).padStart(2, '0')} ${period}`;
26
+ }
27
+ /**
28
+ * One absolutely-positioned event card, as React's internal `DayEvent`
29
+ * renders it: the listitem carries the geometry and the card look, and the
30
+ * interaction lives on an inner native button (or a plain block when the event
31
+ * has no `onClick`).
32
+ *
33
+ * @param props - The event, the viewport's start hour and the hour height.
34
+ * @returns The rendered event card.
35
+ */
36
+ const DayEvent = (props) => {
37
+ const cm = getClassMap();
38
+ const { t } = useTranslation();
39
+ const safeEnd = () => Math.max(props.event.endHour, props.event.startHour + 0.25);
40
+ const top = () => (props.event.startHour - props.startHour) * props.pxPerHour;
41
+ const height = () => Math.max(20, (safeEnd() - props.event.startHour) * props.pxPerHour);
42
+ /** The event's accessible label, built from React's i18n key and default message. */
43
+ const ariaLabel = () => t('dayTimeline.event', {
44
+ title: typeof props.event.title === 'string' ? props.event.title : '',
45
+ start: formatHour(props.event.startHour),
46
+ end: formatHour(safeEnd()),
47
+ }, { defaultValue: '{{title}} from {{start}} to {{end}}' });
48
+ /** The card's inline style — geometry only; its colors are ClassMap classes. */
49
+ const cardStyle = () => ({
50
+ position: 'absolute',
51
+ top: `${top()}px`,
52
+ left: '6px',
53
+ right: '6px',
54
+ height: `${height()}px`,
55
+ 'border-radius': '6px',
56
+ overflow: 'hidden',
57
+ // The event's accent color drives an inset bar, not a border-left. Without
58
+ // it the bar is the brand primary, through the recipe's `primary` tone.
59
+ ...(props.event.accentColor ? { '--mol-accent': props.event.accentColor } : {}),
60
+ });
61
+ /**
62
+ * The content block: it fills the card so the whole surface is the click
63
+ * target, and its 30px left padding keeps the text clear of the accent bar.
64
+ */
65
+ const contentStyle = () => ({
66
+ position: 'absolute',
67
+ inset: '0px',
68
+ padding: '0.4rem 0.6rem 0.4rem 30px',
69
+ font: 'inherit',
70
+ color: 'inherit',
71
+ 'text-align': 'left',
72
+ });
73
+ /** The interactive surface's style: the block, plus a pointer cursor when clickable. */
74
+ const actionStyle = () => ({
75
+ ...contentStyle(),
76
+ cursor: 'pointer',
77
+ background: 'transparent',
78
+ });
79
+ // The card's paper is the theme's secondary surface; the accent bar reads
80
+ // the event's own `accentColor` when it has one, and is the brand primary
81
+ // otherwise (the recipe's `primary` tone).
82
+ const tone = () => (props.event.accentColor ? 'custom' : 'primary');
83
+ const content = () => (<>
84
+ <div class={cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'))}>{props.event.title}</div>
85
+ {props.event.subtitle ? (<div class={cm.accentCardLabel({ tone: tone() })}>{props.event.subtitle}</div>) : null}
86
+ </>);
87
+ return (<div role="listitem" data-event-id={props.event.id} data-mol-id="day-timeline-event" aria-label={ariaLabel()} class={cm.cn(cm.accentCard({ tone: tone() }), cm.surfaceSecondary)} style={cardStyle()}>
88
+ {props.event.onClick ? (<button type="button" data-mol-id="day-timeline-event-action" aria-label={ariaLabel()} onClick={props.event.onClick} style={actionStyle()}>
89
+ {content()}
90
+ </button>) : (<div style={contentStyle()}>{content()}</div>)}
91
+ </div>);
92
+ };
93
+ /**
94
+ * Vertical 24h day-of-events timeline. Events are absolutely positioned over a
95
+ * 1-hour-tick axis; their height reflects duration. Designed for itinerary
96
+ * planners, daily agendas, and schedule views.
97
+ *
98
+ * React keys each event by its `id`, so a re-passed or re-ordered event list
99
+ * keeps the rendered cards per id. Solid's `For` keys by reference, so the
100
+ * rows are keyed through stable per-id records: the record for an id is created
101
+ * once and reused, while the card's content reads the CURRENT event for that
102
+ * id reactively.
103
+ *
104
+ * @param props - Component props (see {@link DayTimelineProps}).
105
+ * @returns The rendered timeline.
106
+ */
107
+ export const DayTimeline = (props) => {
108
+ const cm = getClassMap();
109
+ const { t } = useTranslation();
110
+ const safeStart = () => Math.max(0, Math.min(24, props.startHour ?? 0));
111
+ const safeEnd = () => Math.max(safeStart() + 1, Math.min(24, props.endHour ?? 24));
112
+ const pxPerHour = () => props.pxPerHour ?? 60;
113
+ const showAxis = () => props.showAxisLabels ?? true;
114
+ const totalHeight = () => (safeEnd() - safeStart()) * pxPerHour();
115
+ /** The hour ticks in the visible window, pre-built as React builds them. */
116
+ const ticks = () => {
117
+ const hours = [];
118
+ for (let hour = Math.ceil(safeStart()); hour < safeEnd(); hour += 1)
119
+ hours.push(hour);
120
+ return hours;
121
+ };
122
+ const records = new Map();
123
+ const keyedRows = () => {
124
+ const seen = new Set();
125
+ const rows = props.events.map((event) => {
126
+ seen.add(event.id);
127
+ let row = records.get(event.id);
128
+ if (!row) {
129
+ row = { id: event.id };
130
+ records.set(event.id, row);
131
+ }
132
+ return row;
133
+ });
134
+ for (const id of [...records.keys()])
135
+ if (!seen.has(id))
136
+ records.delete(id);
137
+ return rows;
138
+ };
139
+ const eventFor = (id) => props.events.find((event) => event.id === id);
140
+ /** The wrapper's inline style — the axis grid has no ClassMap resolver. */
141
+ const wrapperStyle = () => ({
142
+ position: 'relative',
143
+ display: 'grid',
144
+ 'grid-template-columns': showAxis() ? '64px 1fr' : '1fr',
145
+ 'min-height': `${totalHeight()}px`,
146
+ });
147
+ /** The axis column's inline style. */
148
+ const axisStyle = () => ({
149
+ position: 'relative',
150
+ height: `${totalHeight()}px`,
151
+ });
152
+ /** The rail's inline style; its divider from the axis labels is a class. */
153
+ const railStyle = () => ({
154
+ position: 'relative',
155
+ height: `${totalHeight()}px`,
156
+ });
157
+ /** One tick label's inline style. */
158
+ const tickStyle = (hour) => ({
159
+ position: 'absolute',
160
+ top: `${(hour - safeStart()) * pxPerHour()}px`,
161
+ right: '8px',
162
+ transform: 'translateY(-50%)',
163
+ });
164
+ /** One gridline's inline style. */
165
+ const gridlineStyle = (hour) => ({
166
+ position: 'absolute',
167
+ top: `${(hour - safeStart()) * pxPerHour()}px`,
168
+ left: '0px',
169
+ right: '0px',
170
+ height: '1px',
171
+ });
172
+ return (<div class={cm.cn(props.className)} data-mol-id={props.dataMolId ?? 'day-timeline'} role="list" aria-label={t('dayTimeline.group', {}, { defaultValue: 'Day timeline' })} style={wrapperStyle()}>
173
+ {showAxis() ? (<div style={axisStyle()} aria-hidden="true">
174
+ <For each={ticks()}>
175
+ {(hour) => (<div data-axis-tick={hour} class={cm.cn(cm.textSize('xs'), cm.textMuted)} style={tickStyle(hour)}>
176
+ {formatHour(hour)}
177
+ </div>)}
178
+ </For>
179
+ </div>) : null}
180
+ <div class={showAxis() ? cm.borderL : undefined} style={railStyle()} data-mol-id="day-timeline-rail">
181
+ <For each={ticks()}>
182
+ {(hour) => <div aria-hidden="true" class={cm.bgBorder} style={gridlineStyle(hour)}/>}
183
+ </For>
184
+ <For each={keyedRows()}>
185
+ {(row) => (<DayEvent event={eventFor(row.id)} startHour={safeStart()} pxPerHour={pxPerHour()}/>)}
186
+ </For>
187
+ </div>
188
+ </div>);
189
+ };
190
+ //# sourceMappingURL=DayTimeline.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayTimeline.jsx","sourceRoot":"","sources":["../src/DayTimeline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAkB,GAAG,EAAY,MAAM,UAAU,CAAA;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;IACvC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IACrC,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;IACpC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAAA;AAClG,CAAC;AAYD;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAA6B,CAAC,KAAK,EAAE,EAAE;IACnD,MAAM,EAAE,GAAG,WAAW,EAAE,CA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C,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAEvB;gBAAA,CAAC,UAAU,CAAC,IAAI,CAAC,CACnB;cAAA,EAAE,GAAG,CAAC,CACP,CACH;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACR;MAAA,CAAC,GAAG,CACF,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAC3C,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC,CACnB,WAAW,CAAC,mBAAmB,CAE/B;QAAA,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CACjB;UAAA,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAG,CACvF;QAAA,EAAE,GAAG,CACL;QAAA,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CACrB;UAAA,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACR,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC,EAAG,CACtF,CACH;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Solid vertical 24h day-of-events timeline — itinerary planner, daily agenda,
3
+ * schedule view. Events are absolutely positioned by start/end hour and
4
+ * scaled by `pxPerHour` (total height = (endHour - startHour) * pxPerHour).
5
+ *
6
+ * Exports `DayTimeline` and `formatHour` — the Solid counterpart of
7
+ * `@molecule/app-day-timeline-react`, with the same props (React names) and
8
+ * the same DOM for the same input.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { DayTimeline } from '@molecule/app-day-timeline-solid'
13
+ *
14
+ * <DayTimeline
15
+ * startHour={7}
16
+ * endHour={22}
17
+ * events={[
18
+ * { id: 'flight', title: 'Flight to LAX', startHour: 13, endHour: 16 },
19
+ * { id: 'dinner', title: 'Dinner', startHour: 19, endHour: 20.5 },
20
+ * ]}
21
+ * />
22
+ * ```
23
+ *
24
+ * @remarks
25
+ * - **No overlap/lane layout.** Events are absolutely positioned across the
26
+ * full rail width, so events with overlapping time ranges render stacked
27
+ * on top of each other. If your data can contain concurrent events,
28
+ * partition them into separate `<DayTimeline>` columns (one per lane or
29
+ * resource) before rendering — the component does not de-conflict.
30
+ * - Bounds are clamped: `startHour` to [0, 24], `endHour` to at least
31
+ * `startHour + 1`; an event shorter than 15 minutes still renders at a
32
+ * 20px minimum height so it stays clickable.
33
+ * - Axis tick labels are formatted by the exported `formatHour()`, which
34
+ * uses English 12-hour "AM/PM" notation. There is currently no prop to
35
+ * localize tick formatting — hide them with `showAxisLabels={false}` and
36
+ * render your own axis if you need 24h or localized labels.
37
+ * - Aria labels resolve through `t()` with English fallbacks; the companion
38
+ * locale bond is `@molecule/app-locales-day-timeline`. Requires the app's
39
+ * i18n provider (`useTranslation()` throws without one) and a wired
40
+ * ClassMap bond (standard molecule app setup).
41
+ * - Events with an `onClick` render their content inside a native `<button>`
42
+ * (Enter and Space activate it); events without one are not focusable.
43
+ * - Titles and subtitles are JSX values, as React's `ReactNode` fields are.
44
+ * - Events are keyed by `id` through stable per-id records (Solid's `For`
45
+ * keys by reference), so a re-passed or re-ordered list keeps each card's
46
+ * DOM the way React's `key` does.
47
+ *
48
+ * @module
49
+ */
50
+ export * from './DayTimeline.jsx';
51
+ export * from './types.js';
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Solid vertical 24h day-of-events timeline — itinerary planner, daily agenda,
3
+ * schedule view. Events are absolutely positioned by start/end hour and
4
+ * scaled by `pxPerHour` (total height = (endHour - startHour) * pxPerHour).
5
+ *
6
+ * Exports `DayTimeline` and `formatHour` — the Solid counterpart of
7
+ * `@molecule/app-day-timeline-react`, with the same props (React names) and
8
+ * the same DOM for the same input.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { DayTimeline } from '@molecule/app-day-timeline-solid'
13
+ *
14
+ * <DayTimeline
15
+ * startHour={7}
16
+ * endHour={22}
17
+ * events={[
18
+ * { id: 'flight', title: 'Flight to LAX', startHour: 13, endHour: 16 },
19
+ * { id: 'dinner', title: 'Dinner', startHour: 19, endHour: 20.5 },
20
+ * ]}
21
+ * />
22
+ * ```
23
+ *
24
+ * @remarks
25
+ * - **No overlap/lane layout.** Events are absolutely positioned across the
26
+ * full rail width, so events with overlapping time ranges render stacked
27
+ * on top of each other. If your data can contain concurrent events,
28
+ * partition them into separate `<DayTimeline>` columns (one per lane or
29
+ * resource) before rendering — the component does not de-conflict.
30
+ * - Bounds are clamped: `startHour` to [0, 24], `endHour` to at least
31
+ * `startHour + 1`; an event shorter than 15 minutes still renders at a
32
+ * 20px minimum height so it stays clickable.
33
+ * - Axis tick labels are formatted by the exported `formatHour()`, which
34
+ * uses English 12-hour "AM/PM" notation. There is currently no prop to
35
+ * localize tick formatting — hide them with `showAxisLabels={false}` and
36
+ * render your own axis if you need 24h or localized labels.
37
+ * - Aria labels resolve through `t()` with English fallbacks; the companion
38
+ * locale bond is `@molecule/app-locales-day-timeline`. Requires the app's
39
+ * i18n provider (`useTranslation()` throws without one) and a wired
40
+ * ClassMap bond (standard molecule app setup).
41
+ * - Events with an `onClick` render their content inside a native `<button>`
42
+ * (Enter and Space activate it); events without one are not focusable.
43
+ * - Titles and subtitles are JSX values, as React's `ReactNode` fields are.
44
+ * - Events are keyed by `id` through stable per-id records (Solid's `For`
45
+ * keys by reference), so a re-passed or re-ordered list keeps each card's
46
+ * DOM the way React's `key` does.
47
+ *
48
+ * @module
49
+ */
50
+ export * from './DayTimeline.jsx';
51
+ export * from './types.js';
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Types for the Solid day-of-events timeline — the Solid counterpart of
3
+ * `@molecule/app-day-timeline-react`'s public types, with Solid JSX values
4
+ * where React has `ReactNode`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { JSX } from 'solid-js';
9
+ /** A single event positioned on the day axis. */
10
+ export interface DayTimelineEvent {
11
+ /** Stable id (used as the render key + `data-event-id`). */
12
+ id: string;
13
+ /** Event title (a JSX value, or plain text). */
14
+ title: JSX.Element;
15
+ /** Optional secondary line (location, type, etc.: a JSX value, or plain text). */
16
+ subtitle?: JSX.Element;
17
+ /** Start hour in fractional 24h (e.g. `9.5` = 9:30 AM). */
18
+ startHour: number;
19
+ /** End hour in fractional 24h. Must be > `startHour`. */
20
+ endHour: number;
21
+ /** Optional accent color (CSS color value). */
22
+ accentColor?: string;
23
+ /** Optional click handler. */
24
+ onClick?: () => void;
25
+ }
26
+ /** Props for {@link DayTimeline}. */
27
+ export interface DayTimelineProps {
28
+ /** Events to render on the timeline. */
29
+ events: DayTimelineEvent[];
30
+ /** First hour rendered (inclusive). Defaults to `0`. */
31
+ startHour?: number;
32
+ /** Last hour rendered (exclusive). Defaults to `24`. */
33
+ endHour?: number;
34
+ /**
35
+ * Pixel height per hour. Drives the overall axis size: total height =
36
+ * `(endHour - startHour) * pxPerHour`. Defaults to `60`.
37
+ */
38
+ pxPerHour?: number;
39
+ /**
40
+ * Whether to render the axis tick labels (e.g. "9 AM"). Defaults to
41
+ * `true`.
42
+ */
43
+ showAxisLabels?: boolean;
44
+ /** `data-mol-id` attribute for AI-agent selectors. */
45
+ dataMolId?: string;
46
+ /** Extra classes appended via the ClassMap `cn()` helper. */
47
+ className?: string;
48
+ }
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,gDAAgD;IAChD,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Types for the Solid day-of-events timeline — the Solid counterpart of
3
+ * `@molecule/app-day-timeline-react`'s public types, with Solid JSX values
4
+ * where React has `ReactNode`.
5
+ *
6
+ * @module
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "@molecule/app-day-timeline-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Vertical 24h day-of-events timeline — itinerary planner, daily agenda, schedule view",
5
+ "homepage": "https://www.molecule.dev/packages/app-day-timeline-solid",
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": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "day-timeline",
28
+ "itinerary",
29
+ "schedule",
30
+ "solid"
31
+ ],
32
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
33
+ "license": "Apache-2.0",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/molecule-dev/molecule.git",
37
+ "directory": "packages/app/features/day-timeline-solid"
38
+ },
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "peerDependencies": {
47
+ "@molecule/app-i18n": "^1.0.1",
48
+ "@molecule/app-solid": "^3.5.0",
49
+ "@molecule/app-ui": "^1.3.11",
50
+ "@molecule/app-ui-solid": "^1.1.0",
51
+ "solid-js": "^1.8.0"
52
+ },
53
+ "devDependencies": {
54
+ "@molecule/app-framework-conformance": "0.0.0",
55
+ "@molecule/app-i18n": "1.2.2",
56
+ "@molecule/app-icons": "1.0.4",
57
+ "@molecule/app-solid": "3.7.2",
58
+ "@molecule/app-ui": "1.4.0",
59
+ "@molecule/app-ui-solid": "1.1.5",
60
+ "@molecule/app-ui-tailwind": "1.3.0",
61
+ "@testing-library/dom": "10.4.2",
62
+ "@types/node": "26.6.5",
63
+ "jsdom": "30.1.3",
64
+ "solid-js": "1.9.17",
65
+ "typescript": "6.0.3",
66
+ "vite-plugin-solid": "2.11.15",
67
+ "vitest": "4.1.12"
68
+ }
69
+ }