@taqwim/solid 0.1.0-beta.5 → 0.1.0-beta.7
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.js +17 -8
- package/dist/source/HijriCalendar.jsx +15 -2
- package/dist/source/types.d.ts +3 -2
- package/dist/source/types.js +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ function v() {
|
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/types.ts
|
|
13
|
-
var y = /* @__PURE__ */ "defaultValue.value.onValueChange.defaultPlaceholder.placeholder.onPlaceholderChange.weekStartsOn.weekdayFormat.calendarLabel.fixedWeeks.numberOfMonths.pagedNavigation.multiple.preventDeselect.disableDaysOutsideCurrentView.disabled.readonly.minValue.maxValue.locale.showGregorian.dateEmphasis.gregorianLocale.dir.isDateDisabled.isDateUnavailable.nextPage.prevPage".split(".");
|
|
13
|
+
var y = /* @__PURE__ */ "calendarSystem.defaultValue.value.onValueChange.defaultPlaceholder.placeholder.onPlaceholderChange.weekStartsOn.weekdayFormat.calendarLabel.fixedWeeks.numberOfMonths.pagedNavigation.multiple.preventDeselect.disableDaysOutsideCurrentView.disabled.readonly.minValue.maxValue.locale.showGregorian.dateEmphasis.gregorianLocale.dir.isDateDisabled.isDateUnavailable.nextPage.prevPage".split(".");
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/useCalendar.ts
|
|
16
16
|
function b(e) {
|
|
@@ -182,18 +182,27 @@ function H(e) {
|
|
|
182
182
|
})();
|
|
183
183
|
}
|
|
184
184
|
function U(e) {
|
|
185
|
-
let { store: i, state: a } = v(), o = "children" in e, [c, l] = h(e, ["day", "children"]), u = () => s(c.day, i.formatter, a().showGregorian, a().dateEmphasis), d = () => (a(), i.getCellTriggerProps(c.day));
|
|
186
|
-
function f() {
|
|
187
|
-
c.day.isDisabled || c.day.isUnavailable || i.select(c.day.date);
|
|
188
|
-
}
|
|
185
|
+
let { store: i, state: a } = v(), o = "children" in e, [c, l] = h(e, ["day", "children"]), u = () => s(c.day, i.formatter, a().showGregorian, a().dateEmphasis), d = () => (a(), i.getCellTriggerProps(c.day)), f = !1;
|
|
189
186
|
function p() {
|
|
190
|
-
|
|
187
|
+
f = !0;
|
|
188
|
+
}
|
|
189
|
+
function m() {
|
|
190
|
+
f = !1;
|
|
191
|
+
}
|
|
192
|
+
function g() {
|
|
193
|
+
c.day.isDisabled || c.day.isUnavailable || (i.focusDate(c.day.date), i.select(c.day.date));
|
|
194
|
+
}
|
|
195
|
+
function _() {
|
|
196
|
+
f || c.day.isDisabled || c.day.isFocused || i.focusDate(c.day.date);
|
|
191
197
|
}
|
|
192
198
|
return (() => {
|
|
193
199
|
var e = w();
|
|
194
200
|
return r(e, n(d, l, {
|
|
195
|
-
onClick:
|
|
196
|
-
onFocus:
|
|
201
|
+
onClick: g,
|
|
202
|
+
onFocus: _,
|
|
203
|
+
onPointerDown: p,
|
|
204
|
+
onPointerUp: m,
|
|
205
|
+
onPointerCancel: m
|
|
197
206
|
}), !1, !0), t(e, () => o ? j(c.children, () => ({
|
|
198
207
|
dayValue: u().dayValue,
|
|
199
208
|
hijriDayValue: u().hijriDayValue,
|
|
@@ -222,21 +222,34 @@ export function HijriCalendarCellTrigger(props) {
|
|
|
222
222
|
void state();
|
|
223
223
|
return store.getCellTriggerProps(local.day);
|
|
224
224
|
};
|
|
225
|
+
// A pointer focuses a button between pointerdown and click. Updating the
|
|
226
|
+
// snapshot during that focus can refresh render-prop children before
|
|
227
|
+
// Solid's delegated click reaches the button. Defer the store's focus move
|
|
228
|
+
// to the click for pointer interactions; keyboard/programmatic focus still
|
|
229
|
+
// updates immediately.
|
|
230
|
+
let pointerIsDown = false;
|
|
231
|
+
function onPointerDown() {
|
|
232
|
+
pointerIsDown = true;
|
|
233
|
+
}
|
|
234
|
+
function onPointerEnd() {
|
|
235
|
+
pointerIsDown = false;
|
|
236
|
+
}
|
|
225
237
|
function onClick() {
|
|
226
238
|
// `select` re-checks these itself; this only avoids the pointless call.
|
|
227
239
|
if (local.day.isDisabled || local.day.isUnavailable)
|
|
228
240
|
return;
|
|
241
|
+
store.focusDate(local.day.date);
|
|
229
242
|
store.select(local.day.date);
|
|
230
243
|
}
|
|
231
244
|
function onFocus() {
|
|
232
245
|
// Tabbing or clicking into a cell makes it the roving-focus target.
|
|
233
246
|
// Re-reporting a date the store already holds would echo its own
|
|
234
247
|
// programmatic `.focus()` back at it, so that case is skipped.
|
|
235
|
-
if (local.day.isDisabled || local.day.isFocused)
|
|
248
|
+
if (pointerIsDown || local.day.isDisabled || local.day.isFocused)
|
|
236
249
|
return;
|
|
237
250
|
store.focusDate(local.day.date);
|
|
238
251
|
}
|
|
239
|
-
return (<button {...triggerProps()} {...rest} onClick={onClick} onFocus={onFocus}>
|
|
252
|
+
return (<button {...triggerProps()} {...rest} onClick={onClick} onFocus={onFocus} onPointerDown={onPointerDown} onPointerUp={onPointerEnd} onPointerCancel={onPointerEnd}>
|
|
240
253
|
{hasChildren
|
|
241
254
|
? renderChildren(local.children, () => ({
|
|
242
255
|
dayValue: display().dayValue,
|
package/dist/source/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CalendarMonth, CalendarState, CalendarStore, Matcher, WeekDayFormat, WeekStartsOn } from '@taqwim/calendar-core';
|
|
2
|
-
import type { HijriDateObject } from '@taqwim/core';
|
|
2
|
+
import type { HijriCalendarSystem, HijriDateObject } from '@taqwim/core';
|
|
3
3
|
import type { JSX } from 'solid-js';
|
|
4
4
|
/**
|
|
5
5
|
* Deliberately the same names as the Vue and React adapters.
|
|
@@ -9,6 +9,7 @@ import type { JSX } from 'solid-js';
|
|
|
9
9
|
* framework forces it.
|
|
10
10
|
*/
|
|
11
11
|
export interface HijriCalendarRootOptions {
|
|
12
|
+
calendarSystem?: HijriCalendarSystem;
|
|
12
13
|
/** Initial selection, for uncontrolled use. */
|
|
13
14
|
defaultValue?: HijriDateObject | HijriDateObject[];
|
|
14
15
|
/** Controlled selection. */
|
|
@@ -57,4 +58,4 @@ export type HijriCalendarRootProps = HijriCalendarRootOptions & Omit<JSX.HTMLAtt
|
|
|
57
58
|
children?: JSX.Element | ((props: HijriCalendarRenderProps) => JSX.Element);
|
|
58
59
|
};
|
|
59
60
|
/** The option names, so the root can tell them from DOM attributes. */
|
|
60
|
-
export declare const OPTION_KEYS: readonly ["defaultValue", "value", "onValueChange", "defaultPlaceholder", "placeholder", "onPlaceholderChange", "weekStartsOn", "weekdayFormat", "calendarLabel", "fixedWeeks", "numberOfMonths", "pagedNavigation", "multiple", "preventDeselect", "disableDaysOutsideCurrentView", "disabled", "readonly", "minValue", "maxValue", "locale", "showGregorian", "dateEmphasis", "gregorianLocale", "dir", "isDateDisabled", "isDateUnavailable", "nextPage", "prevPage"];
|
|
61
|
+
export declare const OPTION_KEYS: readonly ["calendarSystem", "defaultValue", "value", "onValueChange", "defaultPlaceholder", "placeholder", "onPlaceholderChange", "weekStartsOn", "weekdayFormat", "calendarLabel", "fixedWeeks", "numberOfMonths", "pagedNavigation", "multiple", "preventDeselect", "disableDaysOutsideCurrentView", "disabled", "readonly", "minValue", "maxValue", "locale", "showGregorian", "dateEmphasis", "gregorianLocale", "dir", "isDateDisabled", "isDateUnavailable", "nextPage", "prevPage"];
|
package/dist/source/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqwim/solid",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Headless Solid components for Hijri calendars, built on @taqwim/calendar-core",
|
|
6
6
|
"keywords": [
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@taqwim/calendar-core": "0.1.0-beta.
|
|
50
|
-
"@taqwim/core": "0.1.0-beta.
|
|
49
|
+
"@taqwim/calendar-core": "0.1.0-beta.7",
|
|
50
|
+
"@taqwim/core": "0.1.0-beta.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@arethetypeswrong/cli": "^0.18.2",
|