# Dayweave 1.0

An original jQuery event calendar and date picker, with a local event studio, editable projects and self-contained HTML export. The reusable calendar and input-attached picker are real components; the studio is a convenient configuration surface.

## Start

Extract the ZIP without changing its structure. No npm install, build, account or paid API is required to use the product. Serve the extracted folder, for example:

```sh
python3 -m http.server 8790 --bind 127.0.0.1 --directory /path/to/dayweave
```

Open `http://127.0.0.1:8790/app/index.html`. Local HTTP allows the studio to read the sample and bundled runtime for exports. File-origin studio startup is not supported. The downloaded standalone HTML has all runtime code, CSS, event data and jQuery embedded; no runtime network service is required. Event links navigate only when the reader chooses them.

## Build and edit a calendar

1. Start with the fictional Makers Week sample. Previous/next month, Today, month/agenda, search and category filters work independently of the editor form. A multi-day span appears on every included calendar date. Select a date to see its details.
2. In the event form, enter title, start date, inclusive end date and category. Time, location, description and HTTP(S) event link are optional. Blank time means all day. Click Add event.
3. Click an event title in the detail/agenda list to edit it. Update event replaces that event by its stable ID. Delete selected event removes it; Undo restores it. Clear form starts a new event. Undo/Redo holds up to 30 applied project edits. Pending event-form text is not committed until Add/Update.
4. Use Selected date and Choose date to test the reusable popup picker. Selecting a date updates the bound input and the calendar. While creating an event, selecting a day prefills its start/end. An already selected event is not silently moved by choosing another calendar day.
5. Save project downloads all events, title and calendar view/filter settings. Ctrl/Command+S also includes a pending calendar-title edit, but does not add an unsubmitted event form. Open project uses a file chooser. Save a project before restoring the example or importing another project.
6. Export standalone HTML downloads a complete interactive calendar and date picker. Open and use that output, or host it and embed it in an iframe. For existing jQuery pages, use the plugin integration below instead of pasting a complete HTML document into a CMS field.

Applied project data and the latest calendar view are kept as a local browser draft when storage is available. Draft storage can be cleared, disabled or exceed quota; the studio tells you to save a project when storage fails. A downloaded JSON is the portable backup. Invalid import/edit leaves the current calendar data intact. Importing or restoring a sample resets edit history. Data stays local; there is no server sync.

## Dates and times

Dates are strict Gregorian YYYY-MM-DD from 1900 through 2100. Start/end dates are inclusive; a one-day event uses the same date twice. An optional HH:MM is a local wall-clock start time on the first day; later span days display “Continues”. Dayweave does not convert timezones or DST, or imply a specific attendee timezone. Date arithmetic uses UTC day math internally to avoid skipping a calendar day at DST boundaries, while displayed values preserve the entered calendar dates. Today uses the browser's local calendar date.

Maximum 500 events. Titles have 100 characters, categories 40, locations 120 and descriptions 2,000. Category `all` is reserved for the filter. IDs contain 1–64 letters/numbers/underscores/hyphens and must be unique. Links must be complete HTTP(S) URLs without embedded credentials. No recurrence rules, meeting invitations, reminders, bookings, ticket sales, payments or external calendar synchronization are included.

## Keyboard and accessibility

Each month grid has one day in the Tab order. ArrowLeft/Right move one day; ArrowUp/Down one week; Home/End move to Sunday/Saturday of the same week; PageUp/PageDown preserve the day where possible in the prior/next month. Movement changes focus; Enter/Space selects. Escape closes the popup picker and returns focus to its input. The popup can also close by clicking outside. Month controls, filters and event buttons are labeled, with visible focus and selected date state. On narrow screens the grid keeps date/event counts while full event details remain below; agenda is an alternative reading view. Popup is a nonmodal date chooser.

A desktop narrow viewport does not certify physical touch, mobile screen readers or all browser engines. Verify those in the integration's actual supported audience. Date-selection workflows do not by themselves create registrations or bookings.

## jQuery integration

Load `app/dayweave.css`, your existing compatible jQuery instance (the example uses bundled 3.7.1), `app/core.js`, then `app/dayweave.js`. Avoid loading a second jQuery copy. A valid event has every property below, using empty strings for optional text:

```js
const events = [{
  id: 'workshop_1', title: 'Open workshop',
  start: '2026-10-16', end: '2026-10-16', time: '14:30',
  category: 'Workshop', location: 'Studio A',
  description: 'A fictional example.', url: ''
}];
const state = {
  month: '2026-10', selected: '2026-10-16', view: 'month',
  query: '', category: 'all'
};
jQuery('#events').dayweave({ events, state });
jQuery('#date').dayweavePicker();
```

The picker attaches to a text input and makes it read-only while active. Its value is a YYYY-MM-DD string. Bind the native/jQuery `change` event to use a selection. Initializing or opening does not submit a date choice; selecting a day emits a change. Optional calendar `state` defaults to the browser's Today and month view. `events` defaults to empty.

| Method | Behavior |
|---|---|
| `.dayweave(options)` | Initialize each host once; chainable |
| `.dayweave('getState')` | Defensive copy of first instance's month/selection/view/query/category |
| `.dayweave('getEvents')` | Defensive copies of first instance's normalized events |
| `.dayweave('setState', state)` | Validate and restore all view fields |
| `.dayweave('setEvents', events)` | Validate whole list before replacement; stale category resets to all |
| `.dayweave('selectDate', date)` | Select date, navigate its month, emit selection/change |
| `.dayweave('goToMonth', 'YYYY-MM')` | Navigate month without silently selecting another date |
| `.dayweave('destroy')` | Remove listeners and restore original nodes/host attributes |
| `.dayweavePicker()` | Initialize input-attached popup once |
| `.dayweavePicker('open'/'close'/'destroy')` | Show/hide, or remove popup and restore input attributes |

`dayweave:select` supplies selected date, `dayweave:event` supplies an event copy, and `dayweave:change` supplies view state as the second jQuery handler argument. Hosts are independent. `samples/integration.html` demonstrates two calendars, one separate picker and destroy/reinitialize. `samples/makers-week.html` is the populated self-contained output.

## Source and verification

Runtime is original plain JavaScript/CSS plus bundled jQuery. The delivery ZIP contains the usable offline product and examples, without internal QA files or hosted analytics. In the separate producer source workspace, optional development checks use Node 18+ and jsdom 26.1.0:

```sh
npm ci
npm test
node scripts/build_sample.cjs
python3 scripts/package.py
```

Run sample generation after runtime changes. DOM tests verify logic and lifecycle and remain separate from actual browser evidence. Product QA receipts state precisely which supported browser, downloads, chooser, screenshots and clean installation were tested. Aggregate QA state/report is excluded from the ZIP to avoid a package/hash cycle. No deployment, physical device coverage or revenue is implied by local test success.

The free product and output rights follow LICENSE.txt. Keep the separate jQuery MIT notice. Optional integration is a separately agreed scope; no paid support, checkout or subscription is included.
