@iyotsuba/schedule-react 0.3.0 → 0.6.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/dist/index.cjs CHANGED
@@ -31,8 +31,16 @@ var import_react2 = require("react");
31
31
 
32
32
  // src/useElement.ts
33
33
  var import_react = require("react");
34
- function useElementBridge(properties, events) {
34
+ function useElementBridge(properties, events, forwardedRef) {
35
35
  const ref = (0, import_react.useRef)(null);
36
+ const setRef = (0, import_react.useCallback)((node) => {
37
+ ref.current = node;
38
+ if (typeof forwardedRef === "function") {
39
+ forwardedRef(node);
40
+ } else if (forwardedRef) {
41
+ forwardedRef.current = node;
42
+ }
43
+ }, [forwardedRef]);
36
44
  (0, import_react.useLayoutEffect)(() => {
37
45
  const el = ref.current;
38
46
  if (!el) {
@@ -68,12 +76,12 @@ function useElementBridge(properties, events) {
68
76
  }
69
77
  return () => disposers.forEach((dispose) => dispose());
70
78
  });
71
- return ref;
79
+ return setRef;
72
80
  }
73
81
 
74
82
  // src/YsSchedule.tsx
75
83
  (0, import_schedule_elements.register)();
76
- function YsSchedule(props) {
84
+ var YsSchedule = (0, import_react2.forwardRef)(function YsSchedule2(props, forwardedRef) {
77
85
  const {
78
86
  className,
79
87
  style,
@@ -83,8 +91,21 @@ function YsSchedule(props) {
83
91
  onDayTap,
84
92
  onSwipe,
85
93
  onWeekPickerOpen,
94
+ onTransitionStart,
95
+ onTransitionEnd,
86
96
  onGuideStep,
87
97
  onGuideFinish,
98
+ onCourseAdd,
99
+ onCourseUpdate,
100
+ onCourseRemove,
101
+ onCellSelect,
102
+ onCourseFormRequest,
103
+ onPlanAdd,
104
+ onPlanToggle,
105
+ onPlanRemove,
106
+ onBackgroundChange,
107
+ onCourseShare,
108
+ onDetailLayoutChange,
88
109
  ...properties
89
110
  } = props;
90
111
  const ref = useElementBridge(properties, {
@@ -94,24 +115,53 @@ function YsSchedule(props) {
94
115
  "dayTap": onDayTap,
95
116
  "swipe": onSwipe,
96
117
  "weekPickerOpen": onWeekPickerOpen,
118
+ "transitionStart": onTransitionStart,
119
+ "transitionEnd": onTransitionEnd,
97
120
  "guideStep": onGuideStep,
98
- "guideFinish": onGuideFinish
99
- });
121
+ "guideFinish": onGuideFinish,
122
+ "courseAdd": onCourseAdd,
123
+ "courseUpdate": onCourseUpdate,
124
+ "courseRemove": onCourseRemove,
125
+ "cellSelect": onCellSelect,
126
+ "courseFormRequest": onCourseFormRequest,
127
+ "planAdd": onPlanAdd,
128
+ "planToggle": onPlanToggle,
129
+ "planRemove": onPlanRemove,
130
+ "backgroundChange": onBackgroundChange,
131
+ "courseShare": onCourseShare,
132
+ "detailLayoutChange": onDetailLayoutChange
133
+ }, forwardedRef);
100
134
  return (0, import_react2.createElement)("ys-schedule", { "ref": ref, "class": className, style });
101
- }
135
+ });
102
136
 
103
137
  // src/YsToday.tsx
104
138
  var import_schedule_elements2 = require("@iyotsuba/schedule-elements");
105
139
  var import_react3 = require("react");
106
140
  (0, import_schedule_elements2.register)();
107
- function YsToday(props) {
108
- const { className, style, onCourseTap, onWidgetTap, ...properties } = props;
141
+ var YsToday = (0, import_react3.forwardRef)(function YsToday2(props, forwardedRef) {
142
+ const {
143
+ className,
144
+ style,
145
+ onCourseTap,
146
+ onWidgetTap,
147
+ onWidgetsChange,
148
+ onLayoutChange,
149
+ onLayoutEditing,
150
+ onWidgetMove,
151
+ onWidgetResize,
152
+ ...properties
153
+ } = props;
109
154
  const ref = useElementBridge(properties, {
110
155
  courseTap: onCourseTap,
111
- widgetTap: onWidgetTap
112
- });
156
+ widgetTap: onWidgetTap,
157
+ "update:widgets": onWidgetsChange,
158
+ layoutChange: onLayoutChange,
159
+ layoutEditing: onLayoutEditing,
160
+ widgetMove: onWidgetMove,
161
+ widgetResize: onWidgetResize
162
+ }, forwardedRef);
113
163
  return (0, import_react3.createElement)("ys-today", { "ref": ref, "class": className, style });
114
- }
164
+ });
115
165
  // Annotate the CommonJS export names for ESM import in node:
116
166
  0 && (module.exports = {
117
167
  YsSchedule,
package/dist/index.d.cts CHANGED
@@ -1,8 +1,22 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties } from 'react';
3
- import { Course, DayOverride, CourseTime, BuiltinTransitionName, TransitionSpec, ThemeTokens, WeatherSnapshot, GuideConfig, DisplayCourse, GuideStep } from '@iyotsuba/schedule-core';
4
- export { BuiltinTransitionName, Course, CourseTime, DayOverride, DisplayCourse, GuideConfig, GuideStep, ThemeTokens, TransitionSpec, WeatherProvider, WeatherSnapshot } from '@iyotsuba/schedule-core';
3
+ import { DetailHero, DetailLayout, DetailField, DetailAction, Course, DayOverride, CourseTime, BuiltinTransitionName, TransitionSpec, ThemeTokens, WeatherSnapshot, GuideConfig, DayPlanMap, ScheduleDensity, PaletteName, CardEffect, WeatherCardConfig, WeekdayWeatherMode, SheetConfig, DisplayCourse, GuideStep } from '@iyotsuba/schedule-core';
4
+ export { BuiltinTransitionName, CardEffect, Course, CourseTime, DayOverride, DayPlan, DayPlanMap, DetailAction, DetailField, DetailHero, DetailLayout, DisplayCourse, GuideConfig, GuideMode, GuideStep, PaletteName, ScheduleDensity, SheetConfig, SheetKind, SheetPlacement, ThemeTokens, TransitionSpec, WeatherCardConfig, WeatherProvider, WeatherSnapshot, WeekModel, WeekdayWeatherMode } from '@iyotsuba/schedule-core';
5
5
 
6
+ interface ScheduleBackground {
7
+ image?: string;
8
+ opacity?: number;
9
+ blur?: number;
10
+ }
11
+ interface ScheduleDetailConfig {
12
+ hero?: DetailHero;
13
+ layout?: DetailLayout;
14
+ fields?: DetailField[];
15
+ actions?: DetailAction[];
16
+ adjustable?: boolean;
17
+ emptyText?: string;
18
+ emptyTexts?: Partial<Record<DetailField, string>>;
19
+ }
6
20
  interface YsScheduleProps {
7
21
  courses: Course[];
8
22
  week?: number;
@@ -24,6 +38,20 @@ interface YsScheduleProps {
24
38
  weekPicker?: 'builtin' | 'none';
25
39
  courseDetail?: 'builtin' | 'none';
26
40
  guide?: GuideConfig | false;
41
+ editable?: boolean;
42
+ courseForm?: 'builtin' | 'none';
43
+ dayPlans?: DayPlanMap;
44
+ dayPlanner?: 'builtin' | 'none';
45
+ background?: ScheduleBackground | null;
46
+ backgroundPicker?: 'builtin' | 'none';
47
+ density?: ScheduleDensity;
48
+ palette?: PaletteName | string[];
49
+ cardEffect?: CardEffect;
50
+ weatherCard?: WeatherCardConfig | false;
51
+ weekdayWeather?: WeekdayWeatherMode;
52
+ weatherScene?: boolean;
53
+ sheets?: SheetConfig;
54
+ detail?: ScheduleDetailConfig;
27
55
  locale?: Record<string, unknown>;
28
56
  onWeekChange?: (week: number, previous: number) => void;
29
57
  /** 受控用法:配合 week 使用 */
@@ -32,40 +60,81 @@ interface YsScheduleProps {
32
60
  onDayTap?: (weekday: number, date: Date | null) => void;
33
61
  onSwipe?: (direction: 1 | -1) => void;
34
62
  onWeekPickerOpen?: () => void;
63
+ onTransitionStart?: (spec: TransitionSpec) => void;
64
+ onTransitionEnd?: (spec: TransitionSpec) => void;
35
65
  onGuideStep?: (step: GuideStep, index: number) => void;
36
66
  onGuideFinish?: () => void;
67
+ onCourseAdd?: (course: Course) => void;
68
+ onCourseUpdate?: (course: Course, previousId: string) => void;
69
+ onCourseRemove?: (course: DisplayCourse) => void;
70
+ onCellSelect?: (weekday: number, startSection: number, endSection: number) => void;
71
+ onCourseFormRequest?: (prefill: Partial<Course>) => void;
72
+ onPlanAdd?: (dateKey: string, text: string) => void;
73
+ onPlanToggle?: (dateKey: string, id: string) => void;
74
+ onPlanRemove?: (dateKey: string, id: string) => void;
75
+ onBackgroundChange?: (dataUrl: string | null) => void;
76
+ onCourseShare?: (course: DisplayCourse) => void;
77
+ onDetailLayoutChange?: (layout: DetailLayout) => void;
37
78
  className?: string;
38
79
  style?: CSSProperties;
39
80
  }
40
- declare function YsSchedule(props: YsScheduleProps): react.ReactElement<{
41
- ref: react.RefObject<HTMLElement | null>;
42
- class: string | undefined;
43
- style: CSSProperties | undefined;
44
- }, string | react.JSXElementConstructor<any>>;
81
+ interface YsScheduleElement extends HTMLElement {
82
+ setWeek: (week: number) => void;
83
+ getWeek: () => number;
84
+ next: () => void;
85
+ previous: () => void;
86
+ openCourse: (courseId: string) => void;
87
+ openWeekPicker: () => void;
88
+ openCourseForm: (prefill?: Partial<Course>) => void;
89
+ openDayPlanner: (date?: Date) => void;
90
+ openBackgroundPicker: () => void;
91
+ closeSheets: () => void;
92
+ startGuide: () => void;
93
+ }
94
+ declare const YsSchedule: react.ForwardRefExoticComponent<YsScheduleProps & react.RefAttributes<YsScheduleElement>>;
45
95
 
96
+ type TodayWidgetSize = 'compact' | 'standard' | 'large' | '1x1' | '1x2' | '2x1' | '2x2';
97
+ type TodayResizeCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
98
+ interface TodayWidgetConfig {
99
+ id: string;
100
+ enabled?: boolean;
101
+ size?: TodayWidgetSize;
102
+ }
46
103
  interface YsTodayProps {
47
104
  courses: Course[];
48
105
  termStart: Date;
49
106
  totalWeeks?: number;
50
107
  overrides?: DayOverride[];
51
108
  courseTimes?: CourseTime[] | 'standard';
52
- widgets?: Array<{
53
- id: string;
54
- enabled?: boolean;
55
- }>;
109
+ widgets?: TodayWidgetConfig[];
56
110
  theme?: 'light' | 'dark' | Partial<ThemeTokens>;
57
111
  weather?: WeatherSnapshot | null;
58
112
  now?: Date;
59
113
  title?: string;
114
+ dayPlans?: DayPlanMap;
115
+ arrangeable?: boolean;
116
+ weatherScene?: boolean;
117
+ reduceMotion?: boolean;
118
+ emptyText?: string;
119
+ emptyTexts?: Record<string, string>;
60
120
  onCourseTap?: (course: DisplayCourse) => void;
61
121
  onWidgetTap?: (id: string) => void;
122
+ onWidgetsChange?: (widgets: TodayWidgetConfig[]) => void;
123
+ onLayoutChange?: (widgets: TodayWidgetConfig[]) => void;
124
+ onLayoutEditing?: (editing: boolean) => void;
125
+ onWidgetMove?: (id: string, from: number, to: number) => void;
126
+ onWidgetResize?: (id: string, size: TodayWidgetSize, corner: TodayResizeCorner) => void;
62
127
  className?: string;
63
128
  style?: CSSProperties;
64
129
  }
65
- declare function YsToday(props: YsTodayProps): react.ReactElement<{
66
- ref: react.RefObject<HTMLElement | null>;
67
- class: string | undefined;
68
- style: CSSProperties | undefined;
69
- }, string | react.JSXElementConstructor<any>>;
130
+ interface YsTodayElement extends HTMLElement {
131
+ setWidgets: (widgets: TodayWidgetConfig[]) => void;
132
+ setArranging: (value: boolean, widgetId?: string | null) => void;
133
+ moveWidget: (id: string, offset: -1 | 1) => void;
134
+ resizeWidget: (id: string) => void;
135
+ toggleWidget: (id: string, enabled: boolean) => void;
136
+ layoutReset: () => void;
137
+ }
138
+ declare const YsToday: react.ForwardRefExoticComponent<YsTodayProps & react.RefAttributes<YsTodayElement>>;
70
139
 
71
- export { YsSchedule, type YsScheduleProps, YsToday, type YsTodayProps };
140
+ export { type ScheduleBackground, type ScheduleDetailConfig, type TodayResizeCorner, type TodayWidgetConfig, type TodayWidgetSize, YsSchedule, type YsScheduleElement, type YsScheduleProps, YsToday, type YsTodayElement, type YsTodayProps };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,22 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties } from 'react';
3
- import { Course, DayOverride, CourseTime, BuiltinTransitionName, TransitionSpec, ThemeTokens, WeatherSnapshot, GuideConfig, DisplayCourse, GuideStep } from '@iyotsuba/schedule-core';
4
- export { BuiltinTransitionName, Course, CourseTime, DayOverride, DisplayCourse, GuideConfig, GuideStep, ThemeTokens, TransitionSpec, WeatherProvider, WeatherSnapshot } from '@iyotsuba/schedule-core';
3
+ import { DetailHero, DetailLayout, DetailField, DetailAction, Course, DayOverride, CourseTime, BuiltinTransitionName, TransitionSpec, ThemeTokens, WeatherSnapshot, GuideConfig, DayPlanMap, ScheduleDensity, PaletteName, CardEffect, WeatherCardConfig, WeekdayWeatherMode, SheetConfig, DisplayCourse, GuideStep } from '@iyotsuba/schedule-core';
4
+ export { BuiltinTransitionName, CardEffect, Course, CourseTime, DayOverride, DayPlan, DayPlanMap, DetailAction, DetailField, DetailHero, DetailLayout, DisplayCourse, GuideConfig, GuideMode, GuideStep, PaletteName, ScheduleDensity, SheetConfig, SheetKind, SheetPlacement, ThemeTokens, TransitionSpec, WeatherCardConfig, WeatherProvider, WeatherSnapshot, WeekModel, WeekdayWeatherMode } from '@iyotsuba/schedule-core';
5
5
 
6
+ interface ScheduleBackground {
7
+ image?: string;
8
+ opacity?: number;
9
+ blur?: number;
10
+ }
11
+ interface ScheduleDetailConfig {
12
+ hero?: DetailHero;
13
+ layout?: DetailLayout;
14
+ fields?: DetailField[];
15
+ actions?: DetailAction[];
16
+ adjustable?: boolean;
17
+ emptyText?: string;
18
+ emptyTexts?: Partial<Record<DetailField, string>>;
19
+ }
6
20
  interface YsScheduleProps {
7
21
  courses: Course[];
8
22
  week?: number;
@@ -24,6 +38,20 @@ interface YsScheduleProps {
24
38
  weekPicker?: 'builtin' | 'none';
25
39
  courseDetail?: 'builtin' | 'none';
26
40
  guide?: GuideConfig | false;
41
+ editable?: boolean;
42
+ courseForm?: 'builtin' | 'none';
43
+ dayPlans?: DayPlanMap;
44
+ dayPlanner?: 'builtin' | 'none';
45
+ background?: ScheduleBackground | null;
46
+ backgroundPicker?: 'builtin' | 'none';
47
+ density?: ScheduleDensity;
48
+ palette?: PaletteName | string[];
49
+ cardEffect?: CardEffect;
50
+ weatherCard?: WeatherCardConfig | false;
51
+ weekdayWeather?: WeekdayWeatherMode;
52
+ weatherScene?: boolean;
53
+ sheets?: SheetConfig;
54
+ detail?: ScheduleDetailConfig;
27
55
  locale?: Record<string, unknown>;
28
56
  onWeekChange?: (week: number, previous: number) => void;
29
57
  /** 受控用法:配合 week 使用 */
@@ -32,40 +60,81 @@ interface YsScheduleProps {
32
60
  onDayTap?: (weekday: number, date: Date | null) => void;
33
61
  onSwipe?: (direction: 1 | -1) => void;
34
62
  onWeekPickerOpen?: () => void;
63
+ onTransitionStart?: (spec: TransitionSpec) => void;
64
+ onTransitionEnd?: (spec: TransitionSpec) => void;
35
65
  onGuideStep?: (step: GuideStep, index: number) => void;
36
66
  onGuideFinish?: () => void;
67
+ onCourseAdd?: (course: Course) => void;
68
+ onCourseUpdate?: (course: Course, previousId: string) => void;
69
+ onCourseRemove?: (course: DisplayCourse) => void;
70
+ onCellSelect?: (weekday: number, startSection: number, endSection: number) => void;
71
+ onCourseFormRequest?: (prefill: Partial<Course>) => void;
72
+ onPlanAdd?: (dateKey: string, text: string) => void;
73
+ onPlanToggle?: (dateKey: string, id: string) => void;
74
+ onPlanRemove?: (dateKey: string, id: string) => void;
75
+ onBackgroundChange?: (dataUrl: string | null) => void;
76
+ onCourseShare?: (course: DisplayCourse) => void;
77
+ onDetailLayoutChange?: (layout: DetailLayout) => void;
37
78
  className?: string;
38
79
  style?: CSSProperties;
39
80
  }
40
- declare function YsSchedule(props: YsScheduleProps): react.ReactElement<{
41
- ref: react.RefObject<HTMLElement | null>;
42
- class: string | undefined;
43
- style: CSSProperties | undefined;
44
- }, string | react.JSXElementConstructor<any>>;
81
+ interface YsScheduleElement extends HTMLElement {
82
+ setWeek: (week: number) => void;
83
+ getWeek: () => number;
84
+ next: () => void;
85
+ previous: () => void;
86
+ openCourse: (courseId: string) => void;
87
+ openWeekPicker: () => void;
88
+ openCourseForm: (prefill?: Partial<Course>) => void;
89
+ openDayPlanner: (date?: Date) => void;
90
+ openBackgroundPicker: () => void;
91
+ closeSheets: () => void;
92
+ startGuide: () => void;
93
+ }
94
+ declare const YsSchedule: react.ForwardRefExoticComponent<YsScheduleProps & react.RefAttributes<YsScheduleElement>>;
45
95
 
96
+ type TodayWidgetSize = 'compact' | 'standard' | 'large' | '1x1' | '1x2' | '2x1' | '2x2';
97
+ type TodayResizeCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
98
+ interface TodayWidgetConfig {
99
+ id: string;
100
+ enabled?: boolean;
101
+ size?: TodayWidgetSize;
102
+ }
46
103
  interface YsTodayProps {
47
104
  courses: Course[];
48
105
  termStart: Date;
49
106
  totalWeeks?: number;
50
107
  overrides?: DayOverride[];
51
108
  courseTimes?: CourseTime[] | 'standard';
52
- widgets?: Array<{
53
- id: string;
54
- enabled?: boolean;
55
- }>;
109
+ widgets?: TodayWidgetConfig[];
56
110
  theme?: 'light' | 'dark' | Partial<ThemeTokens>;
57
111
  weather?: WeatherSnapshot | null;
58
112
  now?: Date;
59
113
  title?: string;
114
+ dayPlans?: DayPlanMap;
115
+ arrangeable?: boolean;
116
+ weatherScene?: boolean;
117
+ reduceMotion?: boolean;
118
+ emptyText?: string;
119
+ emptyTexts?: Record<string, string>;
60
120
  onCourseTap?: (course: DisplayCourse) => void;
61
121
  onWidgetTap?: (id: string) => void;
122
+ onWidgetsChange?: (widgets: TodayWidgetConfig[]) => void;
123
+ onLayoutChange?: (widgets: TodayWidgetConfig[]) => void;
124
+ onLayoutEditing?: (editing: boolean) => void;
125
+ onWidgetMove?: (id: string, from: number, to: number) => void;
126
+ onWidgetResize?: (id: string, size: TodayWidgetSize, corner: TodayResizeCorner) => void;
62
127
  className?: string;
63
128
  style?: CSSProperties;
64
129
  }
65
- declare function YsToday(props: YsTodayProps): react.ReactElement<{
66
- ref: react.RefObject<HTMLElement | null>;
67
- class: string | undefined;
68
- style: CSSProperties | undefined;
69
- }, string | react.JSXElementConstructor<any>>;
130
+ interface YsTodayElement extends HTMLElement {
131
+ setWidgets: (widgets: TodayWidgetConfig[]) => void;
132
+ setArranging: (value: boolean, widgetId?: string | null) => void;
133
+ moveWidget: (id: string, offset: -1 | 1) => void;
134
+ resizeWidget: (id: string) => void;
135
+ toggleWidget: (id: string, enabled: boolean) => void;
136
+ layoutReset: () => void;
137
+ }
138
+ declare const YsToday: react.ForwardRefExoticComponent<YsTodayProps & react.RefAttributes<YsTodayElement>>;
70
139
 
71
- export { YsSchedule, type YsScheduleProps, YsToday, type YsTodayProps };
140
+ export { type ScheduleBackground, type ScheduleDetailConfig, type TodayResizeCorner, type TodayWidgetConfig, type TodayWidgetSize, YsSchedule, type YsScheduleElement, type YsScheduleProps, YsToday, type YsTodayElement, type YsTodayProps };
package/dist/index.js CHANGED
@@ -1,11 +1,19 @@
1
1
  // src/YsSchedule.tsx
2
2
  import { register } from "@iyotsuba/schedule-elements";
3
- import { createElement } from "react";
3
+ import { createElement, forwardRef } from "react";
4
4
 
5
5
  // src/useElement.ts
6
- import { useLayoutEffect, useRef } from "react";
7
- function useElementBridge(properties, events) {
6
+ import { useCallback, useLayoutEffect, useRef } from "react";
7
+ function useElementBridge(properties, events, forwardedRef) {
8
8
  const ref = useRef(null);
9
+ const setRef = useCallback((node) => {
10
+ ref.current = node;
11
+ if (typeof forwardedRef === "function") {
12
+ forwardedRef(node);
13
+ } else if (forwardedRef) {
14
+ forwardedRef.current = node;
15
+ }
16
+ }, [forwardedRef]);
9
17
  useLayoutEffect(() => {
10
18
  const el = ref.current;
11
19
  if (!el) {
@@ -41,12 +49,12 @@ function useElementBridge(properties, events) {
41
49
  }
42
50
  return () => disposers.forEach((dispose) => dispose());
43
51
  });
44
- return ref;
52
+ return setRef;
45
53
  }
46
54
 
47
55
  // src/YsSchedule.tsx
48
56
  register();
49
- function YsSchedule(props) {
57
+ var YsSchedule = forwardRef(function YsSchedule2(props, forwardedRef) {
50
58
  const {
51
59
  className,
52
60
  style,
@@ -56,8 +64,21 @@ function YsSchedule(props) {
56
64
  onDayTap,
57
65
  onSwipe,
58
66
  onWeekPickerOpen,
67
+ onTransitionStart,
68
+ onTransitionEnd,
59
69
  onGuideStep,
60
70
  onGuideFinish,
71
+ onCourseAdd,
72
+ onCourseUpdate,
73
+ onCourseRemove,
74
+ onCellSelect,
75
+ onCourseFormRequest,
76
+ onPlanAdd,
77
+ onPlanToggle,
78
+ onPlanRemove,
79
+ onBackgroundChange,
80
+ onCourseShare,
81
+ onDetailLayoutChange,
61
82
  ...properties
62
83
  } = props;
63
84
  const ref = useElementBridge(properties, {
@@ -67,24 +88,53 @@ function YsSchedule(props) {
67
88
  "dayTap": onDayTap,
68
89
  "swipe": onSwipe,
69
90
  "weekPickerOpen": onWeekPickerOpen,
91
+ "transitionStart": onTransitionStart,
92
+ "transitionEnd": onTransitionEnd,
70
93
  "guideStep": onGuideStep,
71
- "guideFinish": onGuideFinish
72
- });
94
+ "guideFinish": onGuideFinish,
95
+ "courseAdd": onCourseAdd,
96
+ "courseUpdate": onCourseUpdate,
97
+ "courseRemove": onCourseRemove,
98
+ "cellSelect": onCellSelect,
99
+ "courseFormRequest": onCourseFormRequest,
100
+ "planAdd": onPlanAdd,
101
+ "planToggle": onPlanToggle,
102
+ "planRemove": onPlanRemove,
103
+ "backgroundChange": onBackgroundChange,
104
+ "courseShare": onCourseShare,
105
+ "detailLayoutChange": onDetailLayoutChange
106
+ }, forwardedRef);
73
107
  return createElement("ys-schedule", { "ref": ref, "class": className, style });
74
- }
108
+ });
75
109
 
76
110
  // src/YsToday.tsx
77
111
  import { register as register2 } from "@iyotsuba/schedule-elements";
78
- import { createElement as createElement2 } from "react";
112
+ import { createElement as createElement2, forwardRef as forwardRef2 } from "react";
79
113
  register2();
80
- function YsToday(props) {
81
- const { className, style, onCourseTap, onWidgetTap, ...properties } = props;
114
+ var YsToday = forwardRef2(function YsToday2(props, forwardedRef) {
115
+ const {
116
+ className,
117
+ style,
118
+ onCourseTap,
119
+ onWidgetTap,
120
+ onWidgetsChange,
121
+ onLayoutChange,
122
+ onLayoutEditing,
123
+ onWidgetMove,
124
+ onWidgetResize,
125
+ ...properties
126
+ } = props;
82
127
  const ref = useElementBridge(properties, {
83
128
  courseTap: onCourseTap,
84
- widgetTap: onWidgetTap
85
- });
129
+ widgetTap: onWidgetTap,
130
+ "update:widgets": onWidgetsChange,
131
+ layoutChange: onLayoutChange,
132
+ layoutEditing: onLayoutEditing,
133
+ widgetMove: onWidgetMove,
134
+ widgetResize: onWidgetResize
135
+ }, forwardedRef);
86
136
  return createElement2("ys-today", { "ref": ref, "class": className, style });
87
- }
137
+ });
88
138
  export {
89
139
  YsSchedule,
90
140
  YsToday
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyotsuba/schedule-react",
3
- "version": "0.3.0",
4
- "description": "Typed React bindings for the yotsuba schedule kit (<YsSchedule> / <YsToday> over custom elements).",
3
+ "version": "0.6.0",
4
+ "description": "Typed React bindings for the complete Yotsuba schedule and Today experience over custom elements.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
@@ -18,12 +18,17 @@
18
18
  "files": [
19
19
  "dist"
20
20
  ],
21
+ "scripts": {
22
+ "build": "tsup",
23
+ "test": "vitest run",
24
+ "typecheck": "tsc --noEmit"
25
+ },
21
26
  "peerDependencies": {
22
27
  "react": ">=18"
23
28
  },
24
29
  "dependencies": {
25
- "@iyotsuba/schedule-core": "0.3.0",
26
- "@iyotsuba/schedule-elements": "0.3.0"
30
+ "@iyotsuba/schedule-core": "workspace:^",
31
+ "@iyotsuba/schedule-elements": "workspace:^"
27
32
  },
28
33
  "devDependencies": {
29
34
  "@testing-library/react": "^16.1.0",
@@ -41,10 +46,5 @@
41
46
  },
42
47
  "publishConfig": {
43
48
  "access": "public"
44
- },
45
- "scripts": {
46
- "build": "tsup",
47
- "test": "vitest run",
48
- "typecheck": "tsc --noEmit"
49
49
  }
50
- }
50
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 yotsuba-kit contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.