(#1) - WebPack bundling of JS and CSS (#1)

This work was done with Claude.

Added bundling of CSS & JS with WebPack. This also means minimization.

---------

Co-authored-by: Martin Slachta <martin.slachta@outlook.com>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2026-06-12 10:57:23 +00:00
parent 0d829845c4
commit 1294a177ae
23 changed files with 115 additions and 70 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
* Utilities for calling the API
*/
function get_rest_url(resource) {
export function get_rest_url(resource) {
return ReservairServiceAPI.restUrl + '/' + resource;
}
+1 -1
View File
@@ -1,4 +1,4 @@
const RsvDataSource = {
export const RsvDataSource = {
create_rsv_resource(base_url, { nonce } = {}) {
function request(url, method, body) {
const headers = { 'Content-Type': 'application/json' };
@@ -1,2 +1,4 @@
const RsvFormDefinitionResource = () =>
import { RsvDataSource } from './RsvDataSource.js';
export const RsvFormDefinitionResource = () =>
RsvDataSource.create_rsv_resource(ReservairServiceAPI.restUrl + '/form-definition');
+1 -1
View File
@@ -1,4 +1,4 @@
const RsvReservationClient = {
export const RsvReservationClient = {
accept(reservation_id) {
return this._post(reservation_id, 'accept');
},
@@ -1,2 +1,4 @@
const RsvReservationResource = () =>
import { RsvDataSource } from './RsvDataSource.js';
export const RsvReservationResource = () =>
RsvDataSource.create_rsv_resource(ReservairServiceAPI.restUrl + '/reservation');
@@ -1,2 +1,4 @@
const RsvTimetableCapacityResource = (id) =>
import { RsvDataSource } from './RsvDataSource.js';
export const RsvTimetableCapacityResource = (id) =>
RsvDataSource.create_rsv_resource(ReservairServiceAPI.restUrl + `/timetable/${id}/capacity`);
@@ -1,2 +1,4 @@
const RsvTimetableReservationResource = (id) =>
import { RsvDataSource } from './RsvDataSource.js';
export const RsvTimetableReservationResource = (id) =>
RsvDataSource.create_rsv_resource(ReservairServiceAPI.restUrl + `/timetable/${id}/reservation`);
+3 -1
View File
@@ -1,2 +1,4 @@
const RsvTimetableResource = () =>
import { RsvDataSource } from './RsvDataSource.js';
export const RsvTimetableResource = () =>
RsvDataSource.create_rsv_resource(ReservairServiceAPI.restUrl + '/timetable');
+1 -1
View File
@@ -1,4 +1,4 @@
const RsvCalendarPicker = (() => {
export const RsvCalendarPicker = (() => {
function get_first_day_of_month(date) {
const day = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
+4 -2
View File
@@ -2,7 +2,7 @@
* RSV Dynamic datagrid
* Allows fetching with JS instead of page reload.
*/
window.RsvDataGrid = window.RsvDataGrid || {
const RsvDataGrid = {
create_header(self, columns, has_actions) {
let thead = document.createElement('thead');
@@ -419,4 +419,6 @@ window.RsvDataGrid = window.RsvDataGrid || {
return state;
}
}
};
export { RsvDataGrid };
@@ -1,3 +1,5 @@
import { RsvCalendarPicker } from './RsvCalendar.js';
class RsvReservationSelector extends HTMLElement {
static get observedAttributes() {
return ['timetable-id', 'name', 'price-per-block'];
+2
View File
@@ -1,3 +1,5 @@
import { RsvTimetableService } from '../services/RsvTimetableService.js';
class RsvTimeline extends HTMLElement {
static get observedAttributes() {
return ['timetable-id', 'date'];
+4 -1
View File
@@ -1,3 +1,6 @@
import { RsvFormEncoder } from './RsvFormEncoder.js';
import { show_notice } from '../../../src/components/admin.js';
/*
* RsvAdminForm — shared submit handler for wp-admin forms.
*
@@ -13,7 +16,7 @@
* refresh: () => my_datagrid.refresh(),
* });
*/
const RsvAdminForm = {
export const RsvAdminForm = {
// Attach a submit listener that sends the form as JSON.
bind(form, options = {}) {
if (!form) return;
+1 -1
View File
@@ -1,4 +1,4 @@
const RsvFormEncoder = {
export const RsvFormEncoder = {
// Serialize form element into a plain JS object supporting arrays.
// - Nested keys supported with dot notation: 'meta.email'
// - Array notation supported with trailing [] (e.g. 'times[]') or multiple inputs with same name
+1 -1
View File
@@ -1,4 +1,4 @@
const RsvFormSender = {
export const RsvFormSender = {
get_form_url(form_id) {
return ReservairServiceAPI.restUrl + '/form/' + form_id;
},
+1 -1
View File
@@ -1,4 +1,4 @@
const RsvInlineFormBuilder = {
export const RsvInlineFormBuilder = {
match_p(name, value) {
return (form) => String(form[name]) === String(value);
},
+3 -1
View File
@@ -1,4 +1,6 @@
const RsvTimetableService = {
import { get_rest_url } from '../RsvApi.js';
export const RsvTimetableService = {
get_all() {
return fetch(get_rest_url('timetable'), { method: 'GET' })
.then(r => {