Skip to content

Commit

Permalink
feat: v3 release 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
saade committed Sep 26, 2023
1 parent 5a02224 commit af25349
Show file tree
Hide file tree
Showing 35 changed files with 31,648 additions and 1,308 deletions.
8 changes: 1 addition & 7 deletions bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,11 @@ const defaultOptions = {
}
})
}
},
{
name: 'empty-css-imports',
setup(build) {
build.onLoad({ filter: /\.css$/ }, () => ({ contents: '' }))
},
}],
}

compile({
...defaultOptions,
entryPoints: ['./resources/js/filament-fullcalendar.js'],
outfile: './dist/filament-fullcalendar.js',
})
})
39 changes: 0 additions & 39 deletions config/filament-fullcalendar.php

This file was deleted.

28 changes: 27 additions & 1 deletion dist/filament-fullcalendar.css

Large diffs are not rendered by default.

29,133 changes: 29,025 additions & 108 deletions dist/filament-fullcalendar.js

Large diffs are not rendered by default.

2,115 changes: 1,702 additions & 413 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,38 @@
"scripts": {
"dev:styles": "npx tailwindcss -i resources/css/filament-fullcalendar.css -o dist/filament-fullcalendar.css --postcss --watch",
"dev:scripts": "node bin/build.js --dev",
"build:styles": "npx tailwindcss -i resources/css/filament-fullcalendar.css -o dist/filament-fullcalendar.css --postcss --minify",
"build:styles": "npx tailwindcss -i resources/css/filament-fullcalendar.css -o dist/filament-fullcalendar.css --postcss --minify && npm run purge",
"build:scripts": "node bin/build.js",
"purge": "filament-purge -i dist/filament-fullcalendar.css -o dist/filament-fullcalendar.css -v 3.x",
"dev": "npm run dev:styles & npm run dev:scripts",
"build": "npm run build:styles && npm run build:scripts"
"dev": "npm-run-all --parallel dev:*",
"build": "npm-run-all build:*"
},
"devDependencies": {
"@awcodes/filament-plugin-purge": "^1.1.1",
"@fullcalendar/core": "^5.11.5",
"@fullcalendar/daygrid": "^5.11.5",
"@fullcalendar/interaction": "^5.11.5",
"@fullcalendar/list": "^5.11.5",
"@fullcalendar/moment": "^5.11.5",
"@fullcalendar/moment-timezone": "^5.11.5",
"@fullcalendar/resource-timeline": "^5.11.3",
"@fullcalendar/rrule": "^5.11.5",
"@fullcalendar/timegrid": "^5.11.5",
"@fullcalendar/adaptive": "^6.1.9",
"@fullcalendar/common": "^5.11.5",
"@fullcalendar/core": "^6.1.9",
"@fullcalendar/daygrid": "^6.1.9",
"@fullcalendar/interaction": "^6.1.9",
"@fullcalendar/list": "^6.1.9",
"@fullcalendar/moment": "^6.1.9",
"@fullcalendar/moment-timezone": "^6.1.9",
"@fullcalendar/multimonth": "^6.1.9",
"@fullcalendar/resource": "^6.1.9",
"@fullcalendar/resource-timegrid": "^6.1.9",
"@fullcalendar/resource-timeline": "^6.1.9",
"@fullcalendar/rrule": "^6.1.9",
"@fullcalendar/scrollgrid": "^6.1.9",
"@fullcalendar/timegrid": "^6.1.9",
"@fullcalendar/timeline": "^6.1.9",
"@shufo/prettier-plugin-blade": "^1.10.1",
"@tailwindcss/forms": "^0.5.4",
"@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.14",
"esbuild": "^0.19.0",
"moment": "^2.29.4",
"moment-timezone": "^0.5.43",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.24",
"postcss-import": "^15.1.0",
"prettier": "^3.0.0",
Expand Down
58 changes: 0 additions & 58 deletions resources/css/filament-fullcalendar.css
Original file line number Diff line number Diff line change
@@ -1,59 +1 @@
@import '@fullcalendar/common/main.css';
@import '@fullcalendar/daygrid/main.css';
@import '@fullcalendar/timegrid/main.css';
@import '@fullcalendar/list/main.css';
@import '@fullcalendar/resource-timeline/main.css';

@tailwind utilities;

html.dark {
--fc-border-color: theme(colors.white / 5%);
}

.fc-toolbar-chunk {
@apply space-y-1;
}

.fc-toolbar-title {
@apply !text-lg leading-5 md:!text-3xl;
}

.filament-fullcalendar--calendar.fc .fc-button {
@apply min-h-[2.25rem] rounded-lg px-[6px] py-1 text-sm font-medium text-white shadow outline-none transition-colors md:px-4;
}

.filament-fullcalendar--calendar.fc .fc-button-primary {
@apply border-[color:rgba(var(--primary-600))] bg-[color:rgba(var(--primary-600))];
}

.filament-fullcalendar--calendar.fc .fc-button-primary:hover {
@apply border-[color:rgba(var(--primary-600))] bg-[color:rgba(var(--primary-500))];
}

.filament-fullcalendar--calendar.fc .fc-button-primary:disabled {
@apply border-[color:rgba(var(--primary-600))] bg-[color:rgba(var(--primary-600))] opacity-70;
}

.filament-fullcalendar--calendar.fc
.fc-button-primary:not(:disabled).fc-button-active,
.filament-fullcalendar--calendar.fc .fc-button-primary:not(:disabled):active {
@apply border-[color:rgba(var(--primary-600))] bg-[color:rgba(var(--primary-500))] shadow-none;
}

.filament-fullcalendar--calendar.fc .fc-button-primary:focus,
.filament-fullcalendar--calendar.fc .fc-button-primary:not(:disabled):focus,
.filament-fullcalendar--calendar.fc
.fc-button-primary:not(:disabled).fc-button-active:focus,
.filament-fullcalendar--calendar.fc
.fc-button-primary:not(:disabled):active:focus {
@apply bg-[color:rgba(var(--primary-700))] shadow-none outline-none ring-2 ring-inset ring-white ring-offset-2 ring-offset-[color:rgba(var(--primary-700))];
}

.filament-fullcalendar--calendar.fc .fc-daygrid-day.fc-day-today,
.filament-fullcalendar--calendar.fc .fc-highlight {
@apply bg-[color:rgba(var(--primary-500))];
}

.dark .filament-fullcalendar--calendar.fc .fc-daygrid-day.fc-day-today {
@apply bg-[color:rgba(var(--primary-900))];
}
146 changes: 84 additions & 62 deletions resources/js/filament-fullcalendar.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,104 @@
import { Calendar } from '@fullcalendar/core'
import rrulePlugin from '@fullcalendar/rrule'
import interactionPlugin from '@fullcalendar/interaction'
import dayGridPlugin from '@fullcalendar/daygrid'
import timeGridPlugin from '@fullcalendar/timegrid'
import listPlugin from '@fullcalendar/list'
import multiMonthPlugin from '@fullcalendar/multimonth'
import scrollGridPlugin from '@fullcalendar/scrollgrid'
import timelinePlugin from '@fullcalendar/timeline'
import adaptivePlugin from '@fullcalendar/adaptive'
import resourcePlugin from '@fullcalendar/resource'
import resourceDayGridPlugin from '@fullcalendar/resource-daygrid'
import resourceTimelinePlugin from '@fullcalendar/resource-timeline'
import interactionPlugin from '@fullcalendar/interaction'
import rrulePlugin from '@fullcalendar/rrule'
import momentPlugin from '@fullcalendar/moment'
import momentTimezonePlugin from '@fullcalendar/moment-timezone'
import locales from '@fullcalendar/core/locales-all'

export default function fullcalendar({
key,
config,
locale,
events,
initialView,
initialDate,
shouldSaveState,
handleEventClickUsing,
handleEventDropUsing,
handleEventResizeUsing,
handleDateClickUsing,
handleSelectUsing,
fetchEventsUsing,
plugins,
schedulerLicenseKey,
timeZone,
config,
editable,
selectable,
}) {
return {
calendar: null,

cachedEvents: new Object(),

init () {
this.calendar = new Calendar(this.$refs.calendar, {
init() {
/** @type Calendar */
const calendar = new Calendar(this.$el, {
headerToolbar: {
'left': 'prev,next today',
'center': 'title',
'right': 'dayGridMonth,dayGridWeek,dayGridDay',
},
plugins: plugins.map(plugin => availablePlugins[plugin]),
locale,
schedulerLicenseKey,
timeZone,
editable,
selectable,
...config,
plugins: [
...(config.plugins.dayGrid ? [dayGridPlugin] : []),
...(config.plugins.timeGrid ? [timeGridPlugin] : []),
...(config.plugins.interaction ? [interactionPlugin] : []),
...(config.plugins.list ? [listPlugin] : []),
...(config.plugins.rrule ? [rrulePlugin] : []),
...(config.plugins.resourceTimeline ? [resourceTimelinePlugin] : []),
momentPlugin,
momentTimezonePlugin,
],
locales,
locale,
eventClick: handleEventClickUsing,
eventDrop: handleEventDropUsing,
eventResize: handleEventResizeUsing,
dateClick: handleDateClickUsing,
select: handleSelectUsing,
eventSources: [{ events }, fetchEventsUsing],
...(shouldSaveState && {
initialView:
localStorage.getItem(
'fullcalendar.view.' + key,
) ??
initialView ??
undefined,
initialDate:
localStorage.getItem(
'fullcalendar.date.' + key,
) ??
initialDate ??
undefined,
datesSet: function ({ start, view }) {
localStorage.setItem(
'fullcalendar.view.' + key,
view.type,
)
localStorage.setItem(
'fullcalendar.date.' + key,
start.toISOString(),
)
},
}),
events: (info, successCallback, failureCallback) => {
this.$wire.fetchEvents({ start: info.startStr, end: info.endStr, timezone: info.timeZone })
.then(successCallback)
.catch(failureCallback)
},
eventClick: ({ event, jsEvent }) => {
jsEvent.preventDefault()

if (event.url) {
return window.open(event.url, event.extendedProps.shouldOpenInNewTab ? '_blank' : '_self')
}

this.$wire.onEventClick(event)
},
eventDrop: async ({ event, oldEvent, relatedEvents, delta, revert }) => {
const shouldRevert = await this.$wire.onEventDrop(event, oldEvent, relatedEvents, delta)

if (typeof shouldRevert === 'boolean' && shouldRevert) {
revert()
}
},
eventResize: async ({ event, oldEvent, relatedEvents, startDelta, endDelta, revert }) => {
const shouldRevert = await this.$wire.onEventResize(event, oldEvent, relatedEvents, startDelta, endDelta)

if (typeof shouldRevert === 'boolean' && shouldRevert) {
revert()
}
},
dateClick: ({ dateStr, allDay }) => {
if (!selectable) return;
this.$wire.onDateSelect(dateStr, null, allDay)
},
select: ({ startStr, endStr, allDay }) => {
if (!selectable) return;
this.$wire.onDateSelect(startStr, endStr, allDay)
},
})

this.calendar.render()
calendar.render()

window.addEventListener('filament-fullcalendar--refresh', () => calendar.refetchEvents())
},
}
}

const availablePlugins = {
'interaction': interactionPlugin,
'dayGrid': dayGridPlugin,
'timeGrid': timeGridPlugin,
'list': listPlugin,
'multiMonth': multiMonthPlugin,
'scrollGrid': scrollGridPlugin,
'timeline': timelinePlugin,
'adaptive': adaptivePlugin,
'resource': resourcePlugin,
'resourceDayGrid': resourceDayGridPlugin,
'resourceTimeline': resourceTimelinePlugin,
'rrule': rrulePlugin,
'moment': momentPlugin,
'momentTimezone': momentTimezonePlugin,
}
23 changes: 0 additions & 23 deletions resources/views/components/create-event-modal.blade.php

This file was deleted.

25 changes: 0 additions & 25 deletions resources/views/components/edit-event-modal.blade.php

This file was deleted.

Loading

0 comments on commit af25349

Please sign in to comment.