accomadesc 0.3.31 → 0.3.32

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.
@@ -5,9 +5,9 @@
5
5
  import Notes from './basic/Notes.svelte';
6
6
  import Spinner from './basic/Spinner.svelte';
7
7
  import TextInput from './basic/TextInput.svelte';
8
- import { OCCUPATION_STATE, OccupationState } from './occuplan/state.svelte.js';
8
+ import { getOccupationState, OccupationState } from './occuplan/state.svelte.js';
9
9
  import OccuPlanPicker from './occuplan/OccuPlanPicker.svelte';
10
- import { slide } from 'svelte/transition';
10
+ import { fade } from 'svelte/transition';
11
11
  import type { DateTime } from 'luxon';
12
12
  import { randomID } from './names/gen.js';
13
13
 
@@ -55,9 +55,7 @@
55
55
  let sending = $state(false);
56
56
  let disabled = $derived(preview || errored || successfullySent);
57
57
 
58
- const url = calUrl;
59
- const oStateID = `i-${url}-${OCCUPATION_STATE}`;
60
- let occupationState: OccupationState = $state(getContext(oStateID));
58
+ let occupationState: OccupationState = getOccupationState(calUrl);
61
59
  let invalid = $derived(
62
60
  occupationState && arrival && leave ? occupationState.validRequest(arrival, leave) : false,
63
61
  );
@@ -161,8 +159,8 @@
161
159
  </label>
162
160
  <div class="input-wrapper" class:disabled>
163
161
  {#if inputDatesEngaged}
164
- <div transition:slide style="min-width: 32rem;" class="picker-wrapper">
165
- <OccuPlanPicker {arrival} {leave} {url} aborted={abortDateInput} {dateSelected} />
162
+ <div transition:fade style="min-width: 32rem;" class="picker-wrapper">
163
+ <OccuPlanPicker {arrival} {leave} url={calUrl} aborted={abortDateInput} {dateSelected} />
166
164
  </div>
167
165
  {/if}
168
166
  <div class="date-input-wrapper" id="engage-date-buttons">
@@ -243,9 +241,10 @@
243
241
  }
244
242
  }
245
243
  form {
244
+ position: relative;
246
245
  display: grid;
247
246
  grid-template-columns: [start] 1fr [gap-start] 0.5fr [gap-end] 3fr [end];
248
- row-gap: 0.5rem;
247
+ row-gap: 1rem;
249
248
 
250
249
  label {
251
250
  align-content: center;
@@ -272,6 +271,8 @@
272
271
  justify-content: flex-start;
273
272
  }
274
273
  div.picker-wrapper {
274
+ bottom: 2rem;
275
+ right: -3rem;
275
276
  position: absolute;
276
277
  z-index: 9999;
277
278
  background-color: var(--main-bg-color);
@@ -40,7 +40,7 @@
40
40
 
41
41
  width: 100%;
42
42
  max-width: 800px;
43
- min-height: 5rem;
43
+ min-height: 8rem;
44
44
  height: 100%;
45
45
 
46
46
  border: none;
@@ -62,7 +62,9 @@
62
62
  };
63
63
 
64
64
  let page: number = $state(0);
65
- let rfMonth: DateTime = $derived(realFirstMonth(firstMonth, numberOfMonth, page));
65
+ let rfMonth: DateTime = $derived(
66
+ realFirstMonth(firstMonth, DateTime.utc().get('year'), numberOfMonth, page),
67
+ );
66
68
 
67
69
  let currentMaxDate = $derived(rfMonth.plus({ month: numberOfMonth }));
68
70
 
@@ -74,6 +74,7 @@
74
74
  let rfMonth: DateTime = $derived(
75
75
  realFirstMonth(
76
76
  (arrival?.month ? arrival.month : minDate.month) as MonthNumbers,
77
+ arrival?.year ? arrival.year : minDate.year,
77
78
  numberOfMonth,
78
79
  page,
79
80
  ),
@@ -204,6 +205,7 @@
204
205
  <div class="wrapper">
205
206
  <section class="occuplan-wrapper" style="max-width: {maxWidth}; width: 100%;">
206
207
  <header class="occupation-plan-header">
208
+ {rfMonth}
207
209
  <div class="header-controls">
208
210
  {#if rfMonth >= minDate}
209
211
  <Button text={prevPage} clicked={prevClicked} preventDefault={true} />
@@ -50,7 +50,9 @@
50
50
  let occupationState: OccupationState = getOccupationState(url, debug);
51
51
 
52
52
  let page: number = $state(0);
53
- let rfMonth: number | DateTime = $derived(realFirstMonth(firstMonth, numberOfMonth, page));
53
+ let rfMonth: number | DateTime = $derived(
54
+ realFirstMonth(firstMonth, DateTime.utc().get('year'), numberOfMonth, page),
55
+ );
54
56
 
55
57
  let currentMaxDate = $derived(rfMonth.plus({ month: numberOfMonth }));
56
58
 
@@ -30,7 +30,7 @@ export interface DayHelper {
30
30
  year: number;
31
31
  }
32
32
  export declare const firstMonthValid: (value: string | number) => boolean;
33
- export declare const realFirstMonth: (firstMonth: FirstMonth, numberOfMonth: number, page: number) => DateTime;
33
+ export declare const realFirstMonth: (firstMonth: FirstMonth, firstMonthYear: number, numberOfMonth: number, page: number) => DateTime;
34
34
  export interface OccuplanTranslations {
35
35
  arrivalLabel?: string;
36
36
  leaveLabel?: string;
@@ -75,16 +75,20 @@ export const firstMonthValid = (value) => {
75
75
  }
76
76
  return false;
77
77
  };
78
- export const realFirstMonth = (firstMonth, numberOfMonth, page) => {
78
+ export const realFirstMonth = (firstMonth, firstMonthYear, numberOfMonth, page) => {
79
79
  const monthToAdd = page * numberOfMonth;
80
+ console.log(firstMonth, firstMonthYear, numberOfMonth, page);
80
81
  if (typeof firstMonth === 'number') {
81
82
  const intValue = firstMonth;
82
83
  if (intValue >= 1 && intValue <= 12) {
83
84
  const tDate = normalizeDate(DateTime.utc())
84
- .set({ month: intValue })
85
+ .set({ month: intValue, year: firstMonthYear })
85
86
  .plus({ month: monthToAdd });
86
87
  return tDate;
87
88
  }
89
+ else {
90
+ return normalizeDate(DateTime.utc()).plus(monthToAdd);
91
+ }
88
92
  }
89
93
  else if (typeof firstMonth === 'string' && firstMonth.length > 1) {
90
94
  //check + sign
@@ -94,10 +98,14 @@ export const realFirstMonth = (firstMonth, numberOfMonth, page) => {
94
98
  const intValue = parseInt(toParse);
95
99
  if (intValue >= 1 && intValue <= 12) {
96
100
  const tDate = normalizeDate(DateTime.utc())
101
+ .set({ year: firstMonthYear })
97
102
  .plus({ month: intValue })
98
103
  .plus({ month: monthToAdd });
99
104
  return tDate;
100
105
  }
106
+ else {
107
+ return normalizeDate(DateTime.utc()).plus(monthToAdd);
108
+ }
101
109
  }
102
110
  catch (e) {
103
111
  console.log('casting error', e);
@@ -110,10 +118,14 @@ export const realFirstMonth = (firstMonth, numberOfMonth, page) => {
110
118
  const intValue = parseInt(toParse);
111
119
  if (intValue >= 0 && intValue <= 12) {
112
120
  const tDate = normalizeDate(DateTime.utc())
121
+ .set({ year: firstMonthYear })
113
122
  .minus({ month: intValue })
114
123
  .plus({ month: monthToAdd });
115
124
  return tDate;
116
125
  }
126
+ else {
127
+ return normalizeDate(DateTime.utc()).plus(monthToAdd);
128
+ }
117
129
  }
118
130
  catch (e) {
119
131
  console.log('casting error', e);
@@ -125,7 +137,7 @@ export const realFirstMonth = (firstMonth, numberOfMonth, page) => {
125
137
  const intValue = parseInt(firstMonth);
126
138
  //current dynamic month
127
139
  if (intValue == 0) {
128
- return normalizeDate(DateTime.utc()).plus({ month: monthToAdd });
140
+ return normalizeDate(DateTime.utc()).set({ year: firstMonthYear }).plus({ month: monthToAdd });
129
141
  }
130
142
  //static month of current year
131
143
  if (intValue >= 1 && intValue <= 12) {
@@ -134,13 +146,16 @@ export const realFirstMonth = (firstMonth, numberOfMonth, page) => {
134
146
  .plus({ month: monthToAdd });
135
147
  return tDate;
136
148
  }
149
+ else {
150
+ return normalizeDate(DateTime.utc()).set({ year: firstMonthYear }).plus(monthToAdd);
151
+ }
137
152
  }
138
153
  catch (e) {
139
154
  console.log('casting error', e);
140
155
  }
141
156
  }
142
157
  //first month of current year ... default
143
- return normalizeDate(DateTime.utc()).set({ month: 1 }).plus({ month: monthToAdd });
158
+ return normalizeDate(DateTime.utc()).set({ month: 1, year: firstMonthYear }).plus({ month: monthToAdd });
144
159
  };
145
160
  const validDay = (d) => {
146
161
  const today = luxon.utc();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.3.31",
3
+ "version": "0.3.32",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -26,16 +26,16 @@
26
26
  "devDependencies": {
27
27
  "@sveltejs/adapter-auto": "^3.3.1",
28
28
  "@sveltejs/adapter-static": "^3.0.10",
29
- "@sveltejs/kit": "^2.47.3",
30
- "@sveltejs/package": "^2.5.4",
29
+ "@sveltejs/kit": "^2.49.0",
30
+ "@sveltejs/package": "^2.5.6",
31
31
  "@sveltejs/vite-plugin-svelte": "^5.1.1",
32
32
  "@types/luxon": "^3.7.1",
33
33
  "gdpr-cooco-banner": "^0.0.11",
34
34
  "prettier": "^3.6.2",
35
35
  "prettier-plugin-svelte": "^3.4.0",
36
36
  "publint": "^0.3.15",
37
- "svelte": "^5.41.4",
38
- "svelte-check": "^4.3.3",
37
+ "svelte": "^5.43.14",
38
+ "svelte-check": "^4.3.4",
39
39
  "typescript": "^5.9.3",
40
40
  "vite": "^6.4.1"
41
41
  },