@molecule/app-class-schedule-svelte 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,199 @@
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:39.683Z
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-class-schedule-svelte
10
+
11
+ Svelte weekly class-schedule grid.
12
+
13
+ Renders a 7-day × N-hour time grid with absolutely positioned event
14
+ tiles inside each day column. Overlapping events on the same weekday
15
+ are split into side-by-side lanes. Click handlers fire separately for
16
+ event tiles and empty time slots.
17
+
18
+ Designed for school timetables, virtual classroom schedules, gym /
19
+ studio class calendars, conference tracks, and any other weekly
20
+ recurring time-of-day grid.
21
+
22
+ This is the Svelte counterpart of `@molecule/app-class-schedule-react`: the
23
+ same exports (React prop names), the same ClassMap tokens and the same DOM
24
+ for the same input.
25
+
26
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
27
+ > It is written to be read by coding agents as much as by people, and is generated from this
28
+ > package's source — edit `src/index.ts` JSDoc, not this file.
29
+
30
+ ## Quick Start
31
+
32
+ ```svelte
33
+ <script lang="ts">
34
+ import { ClassSchedule } from '@molecule/app-class-schedule-svelte'
35
+
36
+ const events = [
37
+ { id: 'math', weekday: 1, start: 9 * 60, end: 10 * 60, title: 'Math 101', subtitle: 'Room 4B' },
38
+ { id: 'eng', weekday: 3, start: 11 * 60, end: 12 * 60, title: 'English', subtitle: 'Room 12' },
39
+ ]
40
+ </script>
41
+
42
+ <ClassSchedule
43
+ {events}
44
+ onEventClick={(e) => console.log('clicked', e.id)}
45
+ onSlotClick={(s) => console.log('empty slot', s)}
46
+ />
47
+ ```
48
+
49
+ ## Type
50
+
51
+ `feature`
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ npm install @molecule/app-class-schedule-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
57
+ ```
58
+
59
+ ## API
60
+
61
+ ### Interfaces
62
+
63
+ #### `ScheduleEvent`
64
+
65
+ A single event on the weekly schedule grid.
66
+
67
+ `start` and `end` are minute offsets from midnight (`0`–`1440`). For
68
+ example a class running 09:00–10:30 is `{ start: 540, end: 630 }`.
69
+
70
+ ```typescript
71
+ interface ScheduleEvent {
72
+ /** Stable identifier (keyed `{#each}` identity + passed to click handlers). */
73
+ id: string
74
+ /** ISO weekday: `0` = Sunday, `1` = Monday … `6` = Saturday. */
75
+ weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6
76
+ /** Start time in minutes from midnight (e.g. `540` = 09:00). */
77
+ start: number
78
+ /** End time in minutes from midnight (e.g. `630` = 10:30). */
79
+ end: number
80
+ /** Primary label rendered inside the event tile (a snippet, or plain text). */
81
+ title: Snippet | string | number
82
+ /** Secondary line — typically room or location (a snippet, or plain text). */
83
+ subtitle?: Snippet | string | number
84
+ /** Tertiary line — typically teacher or instructor (a snippet, or plain text). */
85
+ meta?: Snippet | string | number
86
+ /** Optional accent color applied as a left border on the tile. */
87
+ accentColor?: string
88
+ }
89
+ ```
90
+
91
+ #### `ScheduleSlot`
92
+
93
+ Empty-slot click payload — `weekday` plus the start of the clicked hour
94
+ (in minutes from midnight, snapped down to the row).
95
+
96
+ ```typescript
97
+ interface ScheduleSlot {
98
+ weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6
99
+ /** Hour-of-day boundary in minutes (e.g. `540` for the 09:00 row). */
100
+ start: number
101
+ }
102
+ ```
103
+
104
+ #### `ClassScheduleProps`
105
+
106
+ Props for the {@link ClassSchedule} weekly timetable component.
107
+
108
+ ```typescript
109
+ interface ClassScheduleProps {
110
+ /** Events to render. */
111
+ events: ScheduleEvent[]
112
+ /** First day-of-week (`0` = Sunday, `1` = Monday). Defaults to `1`. */
113
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6
114
+ /** Visible hour range as `[startHour, endHour]` in 24-hour clock. Defaults to `[8, 18]`. */
115
+ dayHours?: [number, number]
116
+ /** Pixel height of one hour row. Defaults to `60`. */
117
+ cellHeight?: number
118
+ /** Whether to show Saturday + Sunday columns. Defaults to `true`. */
119
+ showWeekendCols?: boolean
120
+ /**
121
+ * Locale for weekday name formatting. Defaults to the app's active locale
122
+ * (`useLocale()`), so the names follow a locale switch; an explicit `locale`
123
+ * still wins.
124
+ */
125
+ locale?: string
126
+ /** Called when an event tile is clicked. */
127
+ onEventClick?: (event: ScheduleEvent) => void
128
+ /** Called when an empty grid cell is clicked. */
129
+ onSlotClick?: (slot: ScheduleSlot) => void
130
+ /** Extra classes for the root container. */
131
+ className?: string
132
+ }
133
+ ```
134
+
135
+ ### Functions
136
+
137
+ #### `formatHourLabel(minutes)`
138
+
139
+ Format a minute-of-day value (0–1440) as `HH:MM` 24-hour clock.
140
+
141
+ ```typescript
142
+ function formatHourLabel(minutes: number): string
143
+ ```
144
+
145
+ - `minutes` — Minutes from midnight.
146
+
147
+ **Returns:** Zero-padded `HH:MM` string.
148
+
149
+ #### `assignLanes(events)`
150
+
151
+ Lay out events that share a weekday into non-overlapping side-by-side
152
+ lanes. Each event gets a `lane` index (0…N) and a `lanes` count for the
153
+ group it belongs to so the caller can compute width/left as
154
+ `width = (1/lanes) * 100%` / `left = (lane/lanes) * 100%`.
155
+
156
+ ```typescript
157
+ function assignLanes<E extends { start: number; end: number }>(
158
+ events: E[],
159
+ ): Array<{ event: E; lane: number; lanes: number }>
160
+ ```
161
+
162
+ - `events` — Events occurring on a single weekday.
163
+
164
+ **Returns:** Array of `{ event, lane, lanes }` records, in input order.
165
+
166
+ ### Constants
167
+
168
+ #### `ClassSchedule`
169
+
170
+ ```typescript
171
+ const ClassSchedule: LegacyComponentType
172
+ ```
173
+
174
+ ## Injection Notes
175
+
176
+ ### Requirements
177
+
178
+ Peer dependencies:
179
+
180
+ - `@molecule/app-svelte` ^3.5.0
181
+ - `@molecule/app-ui` ^1.3.11
182
+ - `@molecule/app-ui-svelte` ^1.1.0
183
+ - `svelte` ^5.0.0
184
+
185
+ ### Runtime Dependencies
186
+
187
+ - `@molecule/app-svelte`
188
+ - `@molecule/app-ui`
189
+ - `@molecule/app-ui-svelte`
190
+ - `svelte`
191
+
192
+ Pair with `@molecule/app-locales-class-schedule` for translations
193
+ in 79 languages. All styling routes through `getClassMap()`; all
194
+ user-facing text routes through `t()`. Node-valued lines (`title`,
195
+ `subtitle`, `meta`) take a snippet or plain text.
196
+
197
+ ## Translations
198
+
199
+ Translation strings are provided by `@molecule/app-locales-class-schedule`.
@@ -0,0 +1,342 @@
1
+ <!--
2
+ ClassSchedule: the Svelte counterpart of `@molecule/app-class-schedule-react`'s
3
+ `ClassSchedule` — a 7-day × N-hour weekly timetable with absolutely
4
+ positioned event tiles inside each day column. Overlapping events on the same
5
+ weekday split into side-by-side lanes, and click handlers fire separately for
6
+ event tiles and empty time slots. Same props (React names), same DOM for the
7
+ same input.
8
+ -->
9
+ <script lang="ts">
10
+ import { SvelteMap } from 'svelte/reactivity'
11
+
12
+ import { useLocale, useTranslation } from '@molecule/app-svelte'
13
+ import { getClassMap } from '@molecule/app-ui'
14
+
15
+ import { assignLanes, formatHourLabel } from './helpers.js'
16
+ import type { ClassScheduleProps, ScheduleEvent } from './types.js'
17
+
18
+ let {
19
+ events,
20
+ weekStartsOn = 1,
21
+ dayHours = [8, 18],
22
+ cellHeight = 60,
23
+ showWeekendCols = true,
24
+ locale,
25
+ onEventClick,
26
+ onSlotClick,
27
+ className,
28
+ }: ClassScheduleProps = $props()
29
+
30
+ // Base of the day headers' ids — the columns' `aria-labelledby` names them
31
+ // (a generated id, never one derived from data); `$props.id()` is this
32
+ // instance's stable id (React's `useId()`).
33
+ const baseId = $props.id()
34
+
35
+ /** Minutes in one hour. */
36
+ const MINUTES_PER_HOUR = 60
37
+ /** Weekday numbers that fall on the weekend (`0` = Sunday, `6` = Saturday). */
38
+ const WEEKEND_DAYS = new Set<number>([0, 6])
39
+ /** The ISO weekday numbers, Sunday first. */
40
+ const ALL_WEEKDAYS: Array<0 | 1 | 2 | 3 | 4 | 5 | 6> = [0, 1, 2, 3, 4, 5, 6]
41
+
42
+ /** One positioned event tile. */
43
+ interface TileModel {
44
+ event: ScheduleEvent
45
+ topPx: number
46
+ heightPx: number
47
+ leftPct: number
48
+ widthPct: number
49
+ label: string
50
+ }
51
+
52
+ const cm = getClassMap()
53
+ const { t } = useTranslation()
54
+ // Read through `$activeLocale` in the derived below, so the weekday headers
55
+ // re-word on a locale switch. An explicit `locale` prop still wins.
56
+ const activeLocale = useLocale()
57
+
58
+ const safeStart = $derived(Math.max(0, Math.min(23, Math.floor(dayHours[0]))))
59
+ const safeEnd = $derived(Math.max(safeStart + 1, Math.min(24, Math.floor(dayHours[1]))))
60
+ const startMinutes = $derived(safeStart * MINUTES_PER_HOUR)
61
+ const endMinutes = $derived(safeEnd * MINUTES_PER_HOUR)
62
+ const totalMinutes = $derived(endMinutes - startMinutes)
63
+ const hourCount = $derived(safeEnd - safeStart)
64
+ const totalHeightPx = $derived(hourCount * cellHeight)
65
+ const hours = $derived(Array.from({ length: hourCount }, (_, i) => i))
66
+
67
+ // Column ordering: rotate weekdays so `weekStartsOn` is first.
68
+ const rotated = $derived([
69
+ ...ALL_WEEKDAYS.slice(weekStartsOn),
70
+ ...ALL_WEEKDAYS.slice(0, weekStartsOn),
71
+ ])
72
+ const visibleWeekdays = $derived(
73
+ showWeekendCols ? rotated : rotated.filter((d) => !WEEKEND_DAYS.has(d)),
74
+ )
75
+
76
+ // Localized weekday header — locale data, not phrases, so it is Intl output
77
+ // in the app's active locale (an explicit `locale` prop still wins), and it
78
+ // follows a locale switch. Use a known reference Sunday (1970-01-04 was a
79
+ // Sunday) so each weekday number maps to a real Date the formatter renders.
80
+ const weekdayFmt = $derived(
81
+ new Intl.DateTimeFormat(locale ?? $activeLocale, { weekday: 'short' }),
82
+ )
83
+
84
+ /**
85
+ * Localized short weekday name for a given ISO weekday number.
86
+ *
87
+ * @param weekday - ISO weekday number (0 = Sunday … 6 = Saturday).
88
+ * @returns Localized short weekday name, e.g. `"Mon"`.
89
+ */
90
+ function weekdayLabel(weekday: number): string {
91
+ return weekdayFmt.format(new Date(Date.UTC(1970, 0, 4 + weekday)))
92
+ }
93
+
94
+ // Group events by weekday + run lane assignment per day.
95
+ const eventsByDay = $derived.by(() => {
96
+ const map = new SvelteMap<number, ScheduleEvent[]>()
97
+ for (const event of events) {
98
+ if (!visibleWeekdays.includes(event.weekday)) continue
99
+ const list = map.get(event.weekday) ?? []
100
+ list.push(event)
101
+ map.set(event.weekday, list)
102
+ }
103
+ return map
104
+ })
105
+
106
+ /**
107
+ * The positioned event tiles of one day column, in input order (events
108
+ * outside the visible hours are dropped, as React returns `null` for them).
109
+ *
110
+ * @param weekday - The day column.
111
+ * @returns The tiles to render.
112
+ */
113
+ function tilesFor(weekday: number): TileModel[] {
114
+ const tiles: TileModel[] = []
115
+ for (const { event, lane, lanes } of assignLanes(eventsByDay.get(weekday) ?? [])) {
116
+ const eventStart = Math.max(event.start, startMinutes)
117
+ const eventEnd = Math.min(event.end, endMinutes)
118
+ if (eventEnd <= eventStart) continue
119
+ tiles.push({
120
+ event,
121
+ topPx: ((eventStart - startMinutes) / totalMinutes) * totalHeightPx,
122
+ heightPx: ((eventEnd - eventStart) / totalMinutes) * totalHeightPx,
123
+ leftPct: (lane / lanes) * 100,
124
+ widthPct: (1 / lanes) * 100,
125
+ label: t(
126
+ 'classSchedule.aria.event',
127
+ {
128
+ weekday: weekdayLabel(weekday),
129
+ start: formatHourLabel(event.start),
130
+ end: formatHourLabel(event.end),
131
+ },
132
+ { defaultValue: '{{weekday}} {{start}} – {{end}}' },
133
+ ),
134
+ })
135
+ }
136
+ return tiles
137
+ }
138
+
139
+ /**
140
+ * The accessible label of one empty-slot hit target.
141
+ *
142
+ * @param weekday - The day column.
143
+ * @param slotStart - The slot's start in minutes from midnight.
144
+ * @returns The translated label.
145
+ */
146
+ function slotLabel(weekday: number, slotStart: number): string {
147
+ return t(
148
+ 'classSchedule.aria.slot',
149
+ { weekday: weekdayLabel(weekday), time: formatHourLabel(slotStart) },
150
+ { defaultValue: 'Empty slot, {{weekday}} {{time}}' },
151
+ )
152
+ }
153
+
154
+ /**
155
+ * Writes the inline style as the element's literal `style` attribute.
156
+ *
157
+ * Svelte's own style handling assigns `node.style.cssText`, and jsdom's CSS
158
+ * parser then discards a `background` shorthand declaration — so the
159
+ * attribute is written directly, which keeps every declaration React emits.
160
+ *
161
+ * @param node - The element to style.
162
+ * @param value - The style declarations.
163
+ * @returns The action's update hook.
164
+ */
165
+ function styleAttribute(node: HTMLElement, value: string): { update(next: string): void } {
166
+ node.setAttribute('style', value)
167
+ return {
168
+ update(next: string): void {
169
+ node.setAttribute('style', next)
170
+ },
171
+ }
172
+ }
173
+
174
+ /**
175
+ * The inline style of one slot hit target (an invisible overlay).
176
+ *
177
+ * @param index - The hour row.
178
+ * @returns The style declarations.
179
+ */
180
+ function slotStyle(index: number): string {
181
+ return `position: absolute; top: ${index * cellHeight}px; left: 0px; right: 0px; height: ${cellHeight}px; background: transparent; border: 0px; padding: 0px; cursor: pointer`
182
+ }
183
+
184
+ /**
185
+ * The inline style of one event tile.
186
+ *
187
+ * @param tile - The tile to style.
188
+ * @returns The style declarations.
189
+ */
190
+ function tileStyle(tile: TileModel): string {
191
+ const style = `position: absolute; top: ${tile.topPx}px; height: ${tile.heightPx}px; left: calc(${tile.leftPct}% + 2px); width: calc(${tile.widthPct}% - 4px); overflow: hidden; text-align: left; cursor: ${onEventClick ? 'pointer' : 'default'}`
192
+ // The caller's accentColor drives an inset bar (DESIGN.md → "Accent
193
+ // bars") through the CSS variable, not a hard border-left.
194
+ return tile.event.accentColor ? `${style}; --mol-accent: ${tile.event.accentColor}` : style
195
+ }
196
+ </script>
197
+
198
+ <!-- A named `group`, not a `grid`: the layout is a CSS grid, not an ARIA
199
+ grid — it has no rows and no grid keyboard model, and `role="grid"`
200
+ would promise one (axe: aria-required-children). -->
201
+ <div
202
+ class={cm.cn(className)}
203
+ data-mol-id="class-schedule"
204
+ role="group"
205
+ aria-label={t('classSchedule.aria.region', {}, { defaultValue: 'Weekly class schedule' })}
206
+ >
207
+ <div
208
+ class={cm.cn(cm.grid({ cols: visibleWeekdays.length + 1, gap: 'none' }))}
209
+ style="grid-template-columns: auto repeat({visibleWeekdays.length}, minmax(0, 1fr))"
210
+ >
211
+ <!-- Header row -->
212
+ <div
213
+ class={cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.sp('p', 2))}
214
+ aria-hidden="true"
215
+ ></div>
216
+ {#each visibleWeekdays as weekday (weekday)}
217
+ <div
218
+ id={`${baseId}-day-${weekday}`}
219
+ data-mol-id="class-schedule-day-header"
220
+ data-weekday={weekday}
221
+ class={cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.textCenter, cm.sp('p', 2))}
222
+ >
223
+ {weekdayLabel(weekday)}
224
+ </div>
225
+ {/each}
226
+
227
+ <!-- Time-axis column -->
228
+ <div
229
+ data-mol-id="class-schedule-time-axis"
230
+ class={cm.cn(cm.position('relative'))}
231
+ style="height: {totalHeightPx}px"
232
+ >
233
+ {#each hours as index (index)}
234
+ <div
235
+ data-mol-id="class-schedule-hour-label"
236
+ class={cm.cn(cm.textSize('xs'), cm.sp('px', 2))}
237
+ style="position: absolute; top: {index *
238
+ cellHeight}px; height: {cellHeight}px; right: 0px; left: 0px; text-align: right;"
239
+ >
240
+ {formatHourLabel(startMinutes + index * MINUTES_PER_HOUR)}
241
+ </div>
242
+ {/each}
243
+ </div>
244
+
245
+ <!-- Day columns — each one a `group` named by its weekday header. -->
246
+ {#each visibleWeekdays as weekday (weekday)}
247
+ <div
248
+ role="group"
249
+ aria-labelledby={`${baseId}-day-${weekday}`}
250
+ data-mol-id="class-schedule-day-column"
251
+ data-weekday={weekday}
252
+ class={cm.cn(cm.position('relative'))}
253
+ style="height: {totalHeightPx}px"
254
+ >
255
+ <!-- Empty-slot click targets — one button per hour row, only while
256
+ `onSlotClick` is set: a focusable button that does nothing would
257
+ be a keyboard trap. -->
258
+ {#if onSlotClick}
259
+ {#each hours as index (index)}
260
+ <button
261
+ type="button"
262
+ data-mol-id="class-schedule-slot"
263
+ data-weekday={weekday}
264
+ data-start={startMinutes + index * MINUTES_PER_HOUR}
265
+ aria-label={slotLabel(weekday, startMinutes + index * MINUTES_PER_HOUR)}
266
+ onclick={() =>
267
+ onSlotClick?.({ weekday, start: startMinutes + index * MINUTES_PER_HOUR })}
268
+ use:styleAttribute={slotStyle(index)}
269
+ ></button>
270
+ {/each}
271
+ {/if}
272
+
273
+ <!-- Event tiles -->
274
+ {#each tilesFor(weekday) as tile (tile.event.id)}
275
+ {#snippet tileInner(event: ScheduleEvent, label: string)}
276
+ <span data-mol-id="class-schedule-event-title"
277
+ >{#if typeof event.title === 'function'}{@render event.title()}{:else}{event.title ??
278
+ ''}{/if}</span
279
+ >
280
+ {#if event.subtitle}
281
+ <span
282
+ data-mol-id="class-schedule-event-subtitle"
283
+ class={cm.cn(cm.textSize('xs'), cm.fontWeight('normal'))}
284
+ >{#if typeof event.subtitle === 'function'}{@render event.subtitle()}{:else}{event.subtitle}{/if}</span
285
+ >
286
+ {/if}
287
+ {#if event.meta}
288
+ <span
289
+ data-mol-id="class-schedule-event-meta"
290
+ class={event.accentColor
291
+ ? cm.accentCardLabel({ tone: 'custom' })
292
+ : cm.cn(cm.textSize('xs'), cm.fontWeight('normal'))}
293
+ >{#if typeof event.meta === 'function'}{@render event.meta()}{:else}{event.meta}{/if}</span
294
+ >
295
+ {/if}
296
+ <!-- The tile's accessible name is its content — title, subtitle,
297
+ meta, then the time, through a visually hidden run (the
298
+ former `aria-label` REPLACED that content as the name, so a
299
+ screen reader never heard the class). -->
300
+ <span class={cm.srOnly}>{label}</span>
301
+ {/snippet}
302
+ <!-- A `<button>` only while `onEventClick` is set: without a
303
+ handler the tile is static content — a focusable button that
304
+ does nothing would be a keyboard trap. -->
305
+ {#if onEventClick}
306
+ <button
307
+ type="button"
308
+ data-mol-id="class-schedule-event"
309
+ data-event-id={tile.event.id}
310
+ onclick={() => onEventClick?.(tile.event)}
311
+ class={cm.cn(
312
+ cm.flex({ direction: 'col', align: 'start' }),
313
+ cm.sp('p', 1),
314
+ cm.textSize('xs'),
315
+ cm.fontWeight('semibold'),
316
+ tile.event.accentColor && cm.accentCard({ tone: 'custom' }),
317
+ )}
318
+ use:styleAttribute={tileStyle(tile)}
319
+ >
320
+ {@render tileInner(tile.event, tile.label)}
321
+ </button>
322
+ {:else}
323
+ <div
324
+ data-mol-id="class-schedule-event"
325
+ data-event-id={tile.event.id}
326
+ class={cm.cn(
327
+ cm.flex({ direction: 'col', align: 'start' }),
328
+ cm.sp('p', 1),
329
+ cm.textSize('xs'),
330
+ cm.fontWeight('semibold'),
331
+ tile.event.accentColor && cm.accentCard({ tone: 'custom' }),
332
+ )}
333
+ use:styleAttribute={tileStyle(tile)}
334
+ >
335
+ {@render tileInner(tile.event, tile.label)}
336
+ </div>
337
+ {/if}
338
+ {/each}
339
+ </div>
340
+ {/each}
341
+ </div>
342
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { ClassScheduleProps } from './types.js';
2
+ declare const ClassSchedule: import("svelte").Component<ClassScheduleProps, {}, "">;
3
+ type ClassSchedule = ReturnType<typeof ClassSchedule>;
4
+ export default ClassSchedule;
5
+ //# sourceMappingURL=ClassSchedule.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassSchedule.svelte.d.ts","sourceRoot":"","sources":["../src/ClassSchedule.svelte"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AA8QpE,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The package's components: one Svelte 5 component per React component in
3
+ * `@molecule/app-class-schedule-react`, under the same React name.
4
+ *
5
+ * @module
6
+ */
7
+ export { default as ClassSchedule } from './ClassSchedule.svelte';
8
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The package's components: one Svelte 5 component per React component in
3
+ * `@molecule/app-class-schedule-react`, under the same React name.
4
+ *
5
+ * @module
6
+ */
7
+ export { default as ClassSchedule } from './ClassSchedule.svelte';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Lane layout and time formatting for the weekly class-schedule grid.
3
+ *
4
+ * Both helpers are plain framework-neutral functions, ported verbatim from
5
+ * `@molecule/app-class-schedule-react` so every framework package exports the
6
+ * same values for the same input.
7
+ *
8
+ * @module
9
+ */
10
+ /**
11
+ * Format a minute-of-day value (0–1440) as `HH:MM` 24-hour clock.
12
+ *
13
+ * @param minutes - Minutes from midnight.
14
+ * @returns Zero-padded `HH:MM` string.
15
+ */
16
+ export declare function formatHourLabel(minutes: number): string;
17
+ /**
18
+ * Lay out events that share a weekday into non-overlapping side-by-side
19
+ * lanes. Each event gets a `lane` index (0…N) and a `lanes` count for the
20
+ * group it belongs to so the caller can compute width/left as
21
+ * `width = (1/lanes) * 100%` / `left = (lane/lanes) * 100%`.
22
+ *
23
+ * @param events - Events occurring on a single weekday.
24
+ * @returns Array of `{ event, lane, lanes }` records, in input order.
25
+ */
26
+ export declare function assignLanes<E extends {
27
+ start: number;
28
+ end: number;
29
+ }>(events: E[]): Array<{
30
+ event: E;
31
+ lane: number;
32
+ lanes: number;
33
+ }>;
34
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAClE,MAAM,EAAE,CAAC,EAAE,GACV,KAAK,CAAC;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAgClD"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Lane layout and time formatting for the weekly class-schedule grid.
3
+ *
4
+ * Both helpers are plain framework-neutral functions, ported verbatim from
5
+ * `@molecule/app-class-schedule-react` so every framework package exports the
6
+ * same values for the same input.
7
+ *
8
+ * @module
9
+ */
10
+ /** Minutes in one hour. */
11
+ const MINUTES_PER_HOUR = 60;
12
+ /**
13
+ * Format a minute-of-day value (0–1440) as `HH:MM` 24-hour clock.
14
+ *
15
+ * @param minutes - Minutes from midnight.
16
+ * @returns Zero-padded `HH:MM` string.
17
+ */
18
+ export function formatHourLabel(minutes) {
19
+ const h = Math.floor(minutes / MINUTES_PER_HOUR);
20
+ const m = minutes % MINUTES_PER_HOUR;
21
+ return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
22
+ }
23
+ /**
24
+ * Lay out events that share a weekday into non-overlapping side-by-side
25
+ * lanes. Each event gets a `lane` index (0…N) and a `lanes` count for the
26
+ * group it belongs to so the caller can compute width/left as
27
+ * `width = (1/lanes) * 100%` / `left = (lane/lanes) * 100%`.
28
+ *
29
+ * @param events - Events occurring on a single weekday.
30
+ * @returns Array of `{ event, lane, lanes }` records, in input order.
31
+ */
32
+ export function assignLanes(events) {
33
+ const sorted = events
34
+ .map((event, originalIndex) => ({ event, originalIndex }))
35
+ .sort((a, b) => a.event.start - b.event.start || a.event.end - b.event.end);
36
+ const groups = [];
37
+ let current = [];
38
+ let currentMaxEnd = -Infinity;
39
+ for (const { event, originalIndex } of sorted) {
40
+ if (event.start >= currentMaxEnd && current.length > 0) {
41
+ groups.push(current);
42
+ current = [];
43
+ currentMaxEnd = -Infinity;
44
+ }
45
+ // Find lowest free lane in `current`.
46
+ const taken = new Set(current.filter((a) => a.event.end > event.start).map((a) => a.lane));
47
+ let lane = 0;
48
+ while (taken.has(lane))
49
+ lane++;
50
+ current.push({ event, lane, originalIndex });
51
+ if (event.end > currentMaxEnd)
52
+ currentMaxEnd = event.end;
53
+ }
54
+ if (current.length > 0)
55
+ groups.push(current);
56
+ const result = [];
57
+ for (const group of groups) {
58
+ const lanes = group.reduce((max, a) => Math.max(max, a.lane + 1), 1);
59
+ for (const a of group)
60
+ result.push({ ...a, lanes });
61
+ }
62
+ result.sort((a, b) => a.originalIndex - b.originalIndex);
63
+ return result.map(({ event, lane, lanes }) => ({ event, lane, lanes }));
64
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Svelte weekly class-schedule grid.
3
+ *
4
+ * Renders a 7-day × N-hour time grid with absolutely positioned event
5
+ * tiles inside each day column. Overlapping events on the same weekday
6
+ * are split into side-by-side lanes. Click handlers fire separately for
7
+ * event tiles and empty time slots.
8
+ *
9
+ * Designed for school timetables, virtual classroom schedules, gym /
10
+ * studio class calendars, conference tracks, and any other weekly
11
+ * recurring time-of-day grid.
12
+ *
13
+ * This is the Svelte counterpart of `@molecule/app-class-schedule-react`: the
14
+ * same exports (React prop names), the same ClassMap tokens and the same DOM
15
+ * for the same input.
16
+ *
17
+ * @example
18
+ * ```svelte
19
+ * <script lang="ts">
20
+ * import { ClassSchedule } from '@molecule/app-class-schedule-svelte'
21
+ *
22
+ * const events = [
23
+ * { id: 'math', weekday: 1, start: 9 * 60, end: 10 * 60, title: 'Math 101', subtitle: 'Room 4B' },
24
+ * { id: 'eng', weekday: 3, start: 11 * 60, end: 12 * 60, title: 'English', subtitle: 'Room 12' },
25
+ * ]
26
+ * </script>
27
+ *
28
+ * <ClassSchedule
29
+ * {events}
30
+ * onEventClick={(e) => console.log('clicked', e.id)}
31
+ * onSlotClick={(s) => console.log('empty slot', s)}
32
+ * />
33
+ * ```
34
+ *
35
+ * @remarks
36
+ * Pair with `@molecule/app-locales-class-schedule` for translations
37
+ * in 79 languages. All styling routes through `getClassMap()`; all
38
+ * user-facing text routes through `t()`. Node-valued lines (`title`,
39
+ * `subtitle`, `meta`) take a snippet or plain text.
40
+ *
41
+ * @module
42
+ */
43
+ export * from './components.js';
44
+ export * from './helpers.js';
45
+ export * from './types.js';
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Svelte weekly class-schedule grid.
3
+ *
4
+ * Renders a 7-day × N-hour time grid with absolutely positioned event
5
+ * tiles inside each day column. Overlapping events on the same weekday
6
+ * are split into side-by-side lanes. Click handlers fire separately for
7
+ * event tiles and empty time slots.
8
+ *
9
+ * Designed for school timetables, virtual classroom schedules, gym /
10
+ * studio class calendars, conference tracks, and any other weekly
11
+ * recurring time-of-day grid.
12
+ *
13
+ * This is the Svelte counterpart of `@molecule/app-class-schedule-react`: the
14
+ * same exports (React prop names), the same ClassMap tokens and the same DOM
15
+ * for the same input.
16
+ *
17
+ * @example
18
+ * ```svelte
19
+ * <script lang="ts">
20
+ * import { ClassSchedule } from '@molecule/app-class-schedule-svelte'
21
+ *
22
+ * const events = [
23
+ * { id: 'math', weekday: 1, start: 9 * 60, end: 10 * 60, title: 'Math 101', subtitle: 'Room 4B' },
24
+ * { id: 'eng', weekday: 3, start: 11 * 60, end: 12 * 60, title: 'English', subtitle: 'Room 12' },
25
+ * ]
26
+ * </script>
27
+ *
28
+ * <ClassSchedule
29
+ * {events}
30
+ * onEventClick={(e) => console.log('clicked', e.id)}
31
+ * onSlotClick={(s) => console.log('empty slot', s)}
32
+ * />
33
+ * ```
34
+ *
35
+ * @remarks
36
+ * Pair with `@molecule/app-locales-class-schedule` for translations
37
+ * in 79 languages. All styling routes through `getClassMap()`; all
38
+ * user-facing text routes through `t()`. Node-valued lines (`title`,
39
+ * `subtitle`, `meta`) take a snippet or plain text.
40
+ *
41
+ * @module
42
+ */
43
+ export * from './components.js';
44
+ export * from './helpers.js';
45
+ export * from './types.js';
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Types for the Svelte weekly class-schedule grid.
3
+ *
4
+ * @module
5
+ */
6
+ import type { Snippet } from 'svelte';
7
+ /**
8
+ * A single event on the weekly schedule grid.
9
+ *
10
+ * `start` and `end` are minute offsets from midnight (`0`–`1440`). For
11
+ * example a class running 09:00–10:30 is `{ start: 540, end: 630 }`.
12
+ */
13
+ export interface ScheduleEvent {
14
+ /** Stable identifier (keyed `{#each}` identity + passed to click handlers). */
15
+ id: string;
16
+ /** ISO weekday: `0` = Sunday, `1` = Monday … `6` = Saturday. */
17
+ weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6;
18
+ /** Start time in minutes from midnight (e.g. `540` = 09:00). */
19
+ start: number;
20
+ /** End time in minutes from midnight (e.g. `630` = 10:30). */
21
+ end: number;
22
+ /** Primary label rendered inside the event tile (a snippet, or plain text). */
23
+ title: Snippet | string | number;
24
+ /** Secondary line — typically room or location (a snippet, or plain text). */
25
+ subtitle?: Snippet | string | number;
26
+ /** Tertiary line — typically teacher or instructor (a snippet, or plain text). */
27
+ meta?: Snippet | string | number;
28
+ /** Optional accent color applied as a left border on the tile. */
29
+ accentColor?: string;
30
+ }
31
+ /**
32
+ * Empty-slot click payload — `weekday` plus the start of the clicked hour
33
+ * (in minutes from midnight, snapped down to the row).
34
+ */
35
+ export interface ScheduleSlot {
36
+ weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6;
37
+ /** Hour-of-day boundary in minutes (e.g. `540` for the 09:00 row). */
38
+ start: number;
39
+ }
40
+ /** Props for the {@link ClassSchedule} weekly timetable component. */
41
+ export interface ClassScheduleProps {
42
+ /** Events to render. */
43
+ events: ScheduleEvent[];
44
+ /** First day-of-week (`0` = Sunday, `1` = Monday). Defaults to `1`. */
45
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
46
+ /** Visible hour range as `[startHour, endHour]` in 24-hour clock. Defaults to `[8, 18]`. */
47
+ dayHours?: [number, number];
48
+ /** Pixel height of one hour row. Defaults to `60`. */
49
+ cellHeight?: number;
50
+ /** Whether to show Saturday + Sunday columns. Defaults to `true`. */
51
+ showWeekendCols?: boolean;
52
+ /**
53
+ * Locale for weekday name formatting. Defaults to the app's active locale
54
+ * (`useLocale()`), so the names follow a locale switch; an explicit `locale`
55
+ * still wins.
56
+ */
57
+ locale?: string;
58
+ /** Called when an event tile is clicked. */
59
+ onEventClick?: (event: ScheduleEvent) => void;
60
+ /** Called when an empty grid cell is clicked. */
61
+ onSlotClick?: (slot: ScheduleSlot) => void;
62
+ /** Extra classes for the root container. */
63
+ className?: string;
64
+ }
65
+ //# 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,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAA;IACV,gEAAgE;IAChE,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClC,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAA;IACX,+EAA+E;IAC/E,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACpC,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qEAAqE;IACrE,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4CAA4C;IAC5C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC7C,iDAAiD;IACjD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IAC1C,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Types for the Svelte weekly class-schedule grid.
3
+ *
4
+ * @module
5
+ */
6
+ export {};
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@molecule/app-class-schedule-svelte",
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": "Weekly class-schedule grid — 7-day × N-hour time grid with absolutely positioned events, click-event vs click-empty-slot dispatch, side-by-side stacking for overlaps",
5
+ "homepage": "https://www.molecule.dev/packages/app-class-schedule-svelte",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "svelte": "./dist/index.js",
18
+ "files": [
19
+ "dist",
20
+ "!dist/**/__tests__",
21
+ "!dist/**/*.test.*",
22
+ "!dist/**/*.spec.*",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && svelte-package --input src --output dist --tsconfig ./tsconfig.json",
27
+ "dev": "svelte-package --input src --output dist --tsconfig ./tsconfig.json --watch",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest"
30
+ },
31
+ "keywords": [
32
+ "molecule",
33
+ "class-schedule",
34
+ "weekly-schedule",
35
+ "timetable",
36
+ "svelte"
37
+ ],
38
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
39
+ "license": "Apache-2.0",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/molecule-dev/molecule.git",
43
+ "directory": "packages/app/features/class-schedule-svelte"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "peerDependencies": {
53
+ "@molecule/app-svelte": "^3.5.0",
54
+ "@molecule/app-ui": "^1.3.11",
55
+ "@molecule/app-ui-svelte": "^1.1.0",
56
+ "svelte": "^5.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-svelte": "3.7.2",
63
+ "@molecule/app-ui": "1.4.0",
64
+ "@molecule/app-ui-svelte": "1.1.7",
65
+ "@sveltejs/package": "3.0.2",
66
+ "@sveltejs/vite-plugin-svelte": "7.1.2",
67
+ "@types/node": "26.6.5",
68
+ "jsdom": "30.1.3",
69
+ "svelte": "5.57.2",
70
+ "svelte-check": "4.7.7",
71
+ "typescript": "6.0.3",
72
+ "vite": "8.3.5",
73
+ "vitest": "4.1.12"
74
+ }
75
+ }