domma-cms 1.6.60 → 1.7.1
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/CHANGELOG.md +4349 -0
- package/README.md +1 -1
- package/admin/dist/domma/domma-tools.css +3 -3
- package/admin/dist/domma/domma-tools.min.js +3 -3
- package/admin/js/lib/effect-defs.js +1 -1
- package/admin/js/lib/effects-builder.js +2 -2
- package/admin/js/lib/mail-compose.js +1 -0
- package/admin/js/lib/page-editor-reference.js +5 -5
- package/admin/js/lib/shortcode-tags.js +1 -1
- package/admin/js/templates/call-new.html +1 -1
- package/admin/js/templates/docs/usage-shortcodes.html +39 -0
- package/admin/js/views/call-new.js +1 -1
- package/admin/js/views/contacts.js +15 -15
- package/admin/js/views/form-submissions.js +2 -2
- package/docs/DommaFeatures.md +3005 -0
- package/docs/MultiTenant.md +176 -0
- package/docs/api-reference.md +1667 -0
- package/docs/cache.md +96 -0
- package/docs/configuration.md +1811 -0
- package/docs/editions-and-licences.md +190 -0
- package/docs/getting-started.md +201 -0
- package/docs/guides/form-triggers.md +260 -0
- package/docs/guides/mongodb-storage-adapter.md +282 -0
- package/docs/guides/multi-page-forms.md +121 -0
- package/docs/images/scribe-composer.png +0 -0
- package/docs/markdown-shortcodes.md +1738 -0
- package/docs/pentest-report-2026-04-03.md +181 -0
- package/docs/plans/2026-02-28-admin-topbar-login-forms.md +349 -0
- package/docs/plans/2026-02-28-domma-ui-polish.md +286 -0
- package/docs/plans/2026-02-28-reset-seed-fresh-commands.md +520 -0
- package/docs/plans/2026-03-02-cookie-consent-design.md +86 -0
- package/docs/plans/2026-03-02-cookie-consent-plugin.md +453 -0
- package/docs/plans/2026-03-02-tooltip-sweep-and-back-to-top-plugin-design.md +126 -0
- package/docs/plans/2026-03-02-tooltip-sweep-back-to-top.md +427 -0
- package/docs/plans/2026-03-05-cookie-consent-btt-core.md +115 -0
- package/docs/plans/2026-03-05-custom-css-migrate-to-core-design.md +35 -0
- package/docs/plans/2026-03-05-custom-css-migrate-to-core.md +352 -0
- package/docs/plans/2026-03-05-scribe-script-shortcode.md +373 -0
- package/docs/plans/2026-03-05-user-types-design.md +139 -0
- package/docs/plans/2026-03-05-user-types-implementation.md +1035 -0
- package/docs/plans/2026-03-09-page-editor-view-cta-inserts-design.md +78 -0
- package/docs/plans/2026-03-09-page-editor-view-cta-inserts.md +388 -0
- package/docs/plans/2026-03-09-pro-documentation-design.md +80 -0
- package/docs/plans/2026-03-09-pro-documentation.md +1017 -0
- package/docs/plans/2026-06-10-core-project-design.md +240 -0
- package/docs/plugin-development.md +827 -0
- package/docs/recruitment-recipe.md +501 -0
- package/docs/scaffolding.md +312 -0
- package/docs/screenshots/calculator-floating.png +0 -0
- package/docs/screenshots/calculator-standard.png +0 -0
- package/docs/screenshots/email-settings.png +0 -0
- package/docs/screenshots/messages-count.png +0 -0
- package/docs/structure/user-types.md +107 -0
- package/docs/superpowers/plans/2026-05-25-admin-sidebar-via-menus.md +1112 -0
- package/docs/superpowers/plans/2026-06-08-navbar-mobile-drawer-and-menu-enrichment.md +1161 -0
- package/docs/superpowers/plans/2026-06-25-domma-docs-project.md +695 -0
- package/docs/superpowers/plans/2026-06-26-surveys-HANDOFF.md +68 -0
- package/docs/superpowers/plans/2026-06-26-surveys-pro-plugin.md +1902 -0
- package/docs/superpowers/plans/2026-08-19-collection-context-sort-export.md +1577 -0
- package/docs/superpowers/plans/2026-10-09-content-api.md +1192 -0
- package/docs/superpowers/specs/2026-03-12-form-followup-actions-design.md +152 -0
- package/docs/superpowers/specs/2026-03-12-page-editor-form-insert-and-per-page-theme-design.md +115 -0
- package/docs/superpowers/specs/2026-03-17-nav-hidden-items-design.md +85 -0
- package/docs/superpowers/specs/2026-03-19-accordion-insert-design.md +175 -0
- package/docs/superpowers/specs/2026-03-25-static-block-shortcode-design.md +153 -0
- package/docs/superpowers/specs/2026-03-25-text-shortcode-design.md +168 -0
- package/docs/superpowers/specs/2026-04-05-card-builder-design.md +315 -0
- package/docs/superpowers/specs/2026-04-06-insert-builders-design.md +278 -0
- package/docs/superpowers/specs/2026-04-06-layouts-design.md +226 -0
- package/docs/superpowers/specs/2026-04-07-blog-plugin-design.md +300 -0
- package/docs/superpowers/specs/2026-04-07-calendar-plugin-design.md +538 -0
- package/docs/superpowers/specs/2026-04-17-components-area-design.md +368 -0
- package/docs/superpowers/specs/2026-05-02-effects-slideover-overhaul-design.md +193 -0
- package/docs/superpowers/specs/2026-05-06-dashboard-rebuild-design.md +257 -0
- package/docs/superpowers/specs/2026-05-24-menus-design.md +466 -0
- package/docs/superpowers/specs/2026-05-25-admin-sidebar-via-menus-design.md +358 -0
- package/docs/superpowers/specs/2026-05-25-projects-design.md +380 -0
- package/docs/superpowers/specs/2026-06-08-navbar-mobile-drawer-and-menu-enrichment-design.md +292 -0
- package/docs/superpowers/specs/2026-06-08-sidebar-tools-plugins-folders-design.md +59 -0
- package/docs/superpowers/specs/2026-06-25-domma-docs-project-design.md +192 -0
- package/docs/superpowers/specs/2026-06-26-domma-charts-upstream-proposal.md +44 -0
- package/docs/superpowers/specs/2026-06-26-manager-scheduler-upstream-proposal.md +46 -0
- package/docs/superpowers/specs/2026-06-26-surveys-pro-plugin-design.md +206 -0
- package/docs/superpowers/specs/2026-07-02-shortcode-context-menu-design.md +96 -0
- package/docs/superpowers/specs/2026-08-19-collection-context-sort-export-design.md +330 -0
- package/docs/superpowers/specs/2026-09-22-dcms-marketplace-design.md +1150 -0
- package/docs/superpowers/specs/2026-10-09-content-api-design.md +325 -0
- package/docs/superpowers/specs/plans/2026-03-12-form-followup-actions.md +624 -0
- package/docs/superpowers/specs/plans/2026-03-12-page-editor-form-insert-and-per-page-theme.md +125 -0
- package/docs/superpowers/specs/plans/2026-03-17-nav-hidden-items.md +578 -0
- package/docs/superpowers/specs/plans/2026-03-19-accordion-insert.md +635 -0
- package/docs/superpowers/specs/plans/2026-03-25-text-shortcode.md +545 -0
- package/docs/superpowers/specs/plans/2026-04-05-card-builder.md +1970 -0
- package/docs/superpowers/specs/plans/2026-04-06-insert-builders.md +1049 -0
- package/docs/superpowers/specs/plans/2026-04-06-layouts.md +1015 -0
- package/docs/superpowers/specs/plans/2026-04-07-calendar-plugin.md +1526 -0
- package/docs/superpowers/specs/plans/2026-04-08-plugin-monetisation-split.md +242 -0
- package/docs/superpowers/specs/plans/2026-04-17-components-area.md +2038 -0
- package/docs/superpowers/specs/plans/2026-05-02-effects-slideover-overhaul.md +2335 -0
- package/docs/superpowers/specs/plans/2026-05-06-dashboard-rebuild.md +1999 -0
- package/docs/superpowers/specs/plans/2026-05-17-cache-system.md +1436 -0
- package/docs/superpowers/specs/plans/2026-05-24-menus.md +3096 -0
- package/docs/superpowers/specs/plans/2026-05-25-projects.md +2869 -0
- package/docs/superpowers/specs/plans/2026-09-22-marketplace-step2-consolidation.md +505 -0
- package/docs/superpowers/specs/plans/2026-09-22-marketplace-step3-catalogue-and-key.md +154 -0
- package/docs/superpowers/specs/plans/2026-09-22-tools-promotion.md +260 -0
- package/docs/theming.md +320 -0
- package/package.json +2 -2
- package/plugins/_lib/admin/mail/compose-window.js +3 -1
- package/plugins/_lib/admin/mail/identity.js +18 -3
- package/plugins/_lib/admin/mail/reader-view.js +32 -3
- package/plugins/blog/CLAUDE.md +4 -0
- package/plugins/blog/admin/lib/email.js +191 -0
- package/plugins/blog/admin/views/comments.js +3 -1
- package/plugins/blog/plugin.json +2 -2
- package/plugins/blog/plugin.public.js +1 -1
- package/plugins/blog/tests/email.test.js +69 -0
- package/plugins/booking/CLAUDE.md +4 -0
- package/plugins/booking/admin/lib/email.js +191 -0
- package/plugins/booking/admin/views/panels.js +7 -3
- package/plugins/booking/plugin.json +1 -1
- package/plugins/booking/tests/email.test.js +69 -0
- package/plugins/free-tier.lock.json +27 -19
- package/plugins/shopping-cart/CLAUDE.md +4 -0
- package/plugins/shopping-cart/admin/lib/email.js +191 -0
- package/plugins/shopping-cart/admin/views/orders.js +11 -3
- package/plugins/shopping-cart/plugin.json +2 -2
- package/plugins/shopping-cart/tests/email.test.js +69 -0
- package/plugins/support/CLAUDE.md +4 -0
- package/plugins/support/admin/lib/email.js +191 -0
- package/plugins/support/admin/views/desk.js +4 -1
- package/plugins/support/admin/views/inbox.js +6 -2
- package/plugins/support/plugin.json +2 -2
- package/plugins/support/tests/email.test.js +69 -0
- package/public/js/celebrations/core/canvas.js +1 -1
- package/public/js/celebrations/index.js +1 -1
- package/public/js/celebrations/licenses/ABeeZee-Regular-OFL.txt +93 -0
- package/public/js/celebrations/licenses/Allura-Regular-OFL.txt +93 -0
- package/public/js/celebrations/message-attrs.mjs +1 -0
- package/public/js/celebrations/themes/anniversary.js +1 -0
- package/public/js/celebrations/themes/autumn.js +1 -0
- package/public/js/celebrations/themes/birthday.js +1 -0
- package/public/js/celebrations/themes/butterfly-flight.js +1 -0
- package/public/js/celebrations/themes/calendar.js +1 -0
- package/public/js/celebrations/themes/chinese-new-year-dates.js +1 -0
- package/public/js/celebrations/themes/chinese-new-year.js +1 -0
- package/public/js/celebrations/themes/christmas.js +1 -1
- package/public/js/celebrations/themes/easter.js +1 -0
- package/public/js/celebrations/themes/garden-drawing.js +1 -0
- package/public/js/celebrations/themes/garden.js +1 -0
- package/public/js/celebrations/themes/graduation.js +1 -0
- package/public/js/celebrations/themes/greeting.js +1 -0
- package/public/js/celebrations/themes/make-it-rain.js +1 -0
- package/public/js/celebrations/themes/money-rain.js +1 -0
- package/public/js/celebrations/themes/new-year.js +1 -0
- package/public/js/celebrations/themes/occasion-drawing.js +1 -0
- package/public/js/celebrations/themes/occasions.js +1 -0
- package/public/js/celebrations/themes/rain-control.js +1 -0
- package/public/js/celebrations/themes/sparkler-font-data.js +1 -0
- package/public/js/celebrations/themes/sparkler-font.js +1 -0
- package/public/js/celebrations/themes/sparkler-writing.js +1 -0
- package/public/js/celebrations/themes/summer-garden.js +1 -0
- package/public/js/celebrations/themes/winter.js +1 -0
- package/public/js/celebrations/trait-data.mjs +1 -1
- package/public/js/effects.js +1 -1
- package/scripts/build.js +4 -0
- package/server/services/markdown.js +5 -2
- package/server/templates/page.html +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let r=null,n=null;export async function prepareSparklerFont(t){typeof t!="string"||!t.trim()||(n||(n=import("./sparkler-font-data.js").then(e=>{r=e})),await n)}export function sparklerFont(t){return r?.[t==="cursive"?"CURSIVE_FONT":"STROKE_FONT"]||null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sparklerFont as D}from"./sparkler-font.js";const J={B:[["M",.04,1],["L",.04,0],["C",.84,-.08,.83,.53,.04,.48],["C",.93,.4,.93,1.12,.04,1]],F:[["M",.05,1],["L",.05,0],["L",.65,0],["M",.05,.48],["L",.52,.48]],O:[["M",.35,0],["C",-.13,0,-.13,1,.35,1],["C",.83,1,.83,0,.35,0]],A:[["M",0,1],["L",.34,0],["L",.68,1],["M",.15,.6],["L",.53,.6]],C:[["M",.65,.15],["C",.12,-.3,-.17,.5,.15,.9],["C",.3,1.08,.54,1.02,.67,.85]],E:[["M",.62,0],["L",.05,0],["L",.05,1],["L",.65,1],["M",.05,.48],["L",.52,.48]],H:[["M",.04,0],["L",.04,1],["M",.66,0],["L",.66,1],["M",.04,.5],["L",.66,.5]],I:[["M",.12,0],["L",.58,0],["M",.35,0],["L",.35,1],["M",.1,1],["L",.6,1]],M:[["M",.03,1],["L",.03,0],["L",.35,.65],["L",.67,0],["L",.67,1]],N:[["M",.04,1],["L",.04,0],["L",.66,1],["L",.66,0]],P:[["M",.05,1],["L",.05,0],["C",.9,-.1,.9,.65,.05,.53]],R:[["M",.05,1],["L",.05,0],["C",.9,-.1,.9,.65,.05,.53],["M",.36,.54],["L",.71,1]],S:[["M",.65,.13],["C",.17,-.22,-.15,.26,.3,.48],["C",1.02,.78,.54,1.3,.02,.88]],T:[["M",0,0],["L",.7,0],["M",.35,0],["L",.35,1]],W:[["M",0,0],["L",.15,1],["L",.36,.4],["L",.57,1],["L",.72,0]],Y:[["M",0,0],["L",.35,.52],["L",.7,0],["M",.35,.52],["L",.35,1]],0:[["M",.35,0],["C",-.08,0,-.08,1,.35,1],["C",.78,1,.78,0,.35,0]],1:[["M",.13,.2],["L",.4,0],["L",.4,1],["M",.12,1],["L",.65,1]],2:[["M",.05,.22],["C",.2,-.22,.93,-.03,.56,.43],["L",.03,1],["L",.68,1]],3:[["M",.06,.13],["C",.75,-.25,.86,.48,.29,.48],["C",.94,.39,.82,1.31,.03,.91]],4:[["M",.52,0],["L",.03,.66],["L",.7,.66],["M",.52,0],["L",.52,1]],5:[["M",.66,0],["L",.09,0],["L",.06,.46],["C",.93,.21,.9,1.33,.03,.91]],6:[["M",.6,.05],["C",-.1,-.18,-.2,1.14,.4,1],["C",1,.83,.6,.14,.07,.59]],7:[["M",.02,0],["L",.7,0],["L",.21,1]],8:[["M",.35,.48],["C",-.34,.08,.93,-.31,.65,.29],["C",.46,.62,-.07,.51,.05,.88],["C",.28,1.31,1.14,.81,.35,.48]],9:[["M",.61,.42],["C",-.1,.88,-.17,-.07,.39,.02],["C",.92,.07,.64,1.11,.1,.98]],"!":[["M",.35,0],["L",.32,.72],["M",.31,.96],["L",.31,1]]},V={H:[["M",-.05,.25],["C",.5,-.35,.2,-.02,.07,1],["M",.18,.55],["C",.48,.2,.82,.8,.93,.18],["C",.8,.52,.55,1.18,.91,.9]],M:[["M",-.05,.9],["C",.42,-.3,.3,-.17,.12,1],["C",.64,-.18,.69,-.27,.55,.98],["C",1.1,-.18,1.16,-.14,.96,.9]],N:[["M",-.05,.9],["C",.33,-.27,.38,-.14,.19,1],["M",.26,.05],["C",.46,-.08,.53,.96,.7,.95],["C",.86,.82,.95,.12,.95,.04]],Y:[["M",0,.16],["C",.1,-.13,.08,.85,.48,.46],["C",.66,.28,.74,-.21,.75,.08],["C",.73,.52,.41,1.51,.11,1.35],["C",-.13,1.18,.74,.98,.91,.9]],C:[["M",.77,.23],["C",.95,-.31,.24,-.19,.08,.47],["C",-.09,1.19,.56,1.12,.91,.9]],B:[["M",-.04,1],["C",.18,.62,.43,-.22,.26,.07],["C",.96,-.3,1.08,.38,.37,.48],["C",1.1,.26,.97,1.25,.14,.98],["C",.3,1.12,.66,1.04,.91,.9]],a:[["M",0,.9],["C",.23,.8,.44,.24,.51,.48],["C",.07,.16,-.04,1.26,.42,.94],["C",.57,.72,.57,.38,.55,.54],["C",.39,1.09,.54,1.03,.62,.9]],p:[["M",0,.9],["C",.16,.74,.27,.28,.23,.52],["L",.02,1.45],["M",.2,.63],["C",.65,.1,.74,.93,.32,.97],["C",.43,1.04,.53,.99,.62,.9]],y:[["M",0,.9],["C",.2,.69,.22,.38,.2,.5],["C",-.01,1.34,.45,1.01,.56,.49],["C",.37,1.2,.27,1.64,.07,1.43],["C",-.09,1.22,.47,1.06,.62,.9]],e:[["M",0,.9],["C",.69,.61,.39,.3,.18,.55],["C",-.05,.88,.28,1.17,.62,.9]],w:[["M",0,.9],["C",.19,.69,.22,.3,.17,.54],["C",-.06,1.29,.34,1.07,.39,.54],["C",.16,1.34,.64,1.06,.62,.9]],r:[["M",0,.9],["C",.12,.77,.32,.25,.25,.49],["C",.34,.72,.51,.39,.46,.62],["C",.29,1.07,.46,1.06,.62,.9]],h:[["M",0,.9],["C",.44,.29,.52,-.22,.31,.01],["C",.18,.21,.09,.91,.09,1],["C",.67,.02,.52,.68,.45,.91],["C",.44,1.06,.54,1.01,.62,.9]],i:[["M",0,.9],["C",.29,.69,.28,.36,.21,.63],["C",.05,1.11,.37,1.06,.62,.9],["M",.3,.25],["L",.32,.23]],s:[["M",0,.9],["C",.28,.77,.5,.3,.39,.49],["C",.24,.63,.62,.83,.31,1],["C",.18,1.11,.1,.84,.24,.87],["C",.37,1.04,.52,1,.62,.9]],t:[["M",0,.9],["C",.24,.64,.4,.01,.33,.17],["C",.12,.76,.02,1.21,.62,.9],["M",.05,.45],["L",.57,.4]],m:[["M",0,.9],["C",.19,.62,.19,.38,.15,.57],["L",.06,1],["C",.43,.19,.4,.49,.28,1],["C",.65,.2,.62,.56,.51,.9],["C",.49,1.06,.55,1.02,.62,.9]],f:[["M",0,.9],["C",.51,.23,.58,-.25,.36,.03],["C",.16,.36,.02,1.7,.18,1.4],["C",.32,1.16,.35,1.06,.62,.9],["M",.04,.55],["L",.57,.46]],o:[["M",0,.9],["C",.49,.31,.6,.47,.43,.8],["C",.18,1.3,-.06,.75,.22,.49],["C",.49,.27,.37,.95,.62,.9]]},O={\u65B0:[["M",.28,.02],["L",.36,.1],["M",.06,.17],["L",.57,.17],["M",.16,.23],["L",.22,.34],["M",.46,.22],["L",.4,.34],["M",.05,.4],["L",.58,.4],["M",.1,.56],["L",.55,.56],["M",.32,.43],["L",.32,.97],["M",.25,.66],["L",.06,.88],["M",.4,.67],["L",.55,.83],["M",.95,.06],["L",.65,.17],["L",.64,.62],["L",.55,.97],["M",.66,.43],["L",.99,.43],["M",.86,.44],["L",.86,.98]],\u5E74:[["M",.28,.02],["L",.08,.3],["M",.23,.15],["L",.94,.15],["M",.22,.39],["L",.89,.39],["M",.22,.39],["L",.22,.67],["M",.03,.67],["L",.99,.67],["M",.59,.15],["L",.59,1]],\u5FEB:[["M",.22,.03],["L",.22,.99],["M",.1,.3],["L",.04,.51],["M",.32,.28],["L",.4,.43],["M",.44,.24],["L",.85,.24],["L",.85,.56],["M",.39,.56],["L",.99,.56],["M",.65,.04],["C",.65,.49,.72,.78,.37,.99],["M",.66,.57],["C",.72,.79,.86,.94,1,1]],\u4E50:[["M",.84,.04],["L",.25,.17],["M",.25,.17],["L",.18,.55],["L",.94,.55],["M",.56,.23],["L",.56,.98],["L",.42,.92],["M",.34,.69],["L",.06,.94],["M",.76,.68],["L",.99,.92]]},Z={gold:{edge:"#bc6f25",body:"#ffd57b",core:"#fff5d0",glow:"#ffb746",spark:"#efb355",bright:"#fff9df"},silver:{edge:"#73879d",body:"#d3e3f1",core:"#ffffff",glow:"#c1dfff",spark:"#c2d8ee",bright:"#ffffff"}};export const SPARKLER_TIMING=Object.freeze({delay:700,write:6500,hold:2600,fade:1800,rest:4500}),SPARKLER_CYCLE=Object.values(SPARKLER_TIMING).reduce((e,o)=>e+o,0);export function createSparklerMessage(e,o,u,s={}){s=s&&typeof s=="object"?s:{};const h=s.style==="cursive"?"cursive":"stroke",g=s.colour==="silver"||s.color==="silver"?"silver":"gold",i=/^\d{1,4}$/.test(String(s.year))&&Number(s.year)>0?Number(s.year):new Date().getFullYear(),r=typeof s.message=="string"&&s.message.trim();r?e=[...s.message.trim().replace(/\s+/g," ").replaceAll("{year}",String(i))].slice(0,120).join(""):s.greeting==="best-wishes"&&(e=`Best wishes for ${i}!`);const l=r?D(h):null;if(r&&!l)throw new Error("Custom sparkler text needs prepareSparklerFont() before seeding");const y=(h==="stroke"?e.toUpperCase():e).split(" "),I=n=>O[n]?1.2:l?(l.glyphs[n]||l.fallback).advance:n===" "?.52:h==="cursive"?/[A-Z]/.test(n)?1.05:/[a-z]/.test(n)?.7:n==="!"?.45:.82:.88,v=n=>[...n].reduce((C,c)=>C+I(c),0);let d=[y.join(" ")];if(o<600&&y.length>1){let n=1/0;for(let C=1;C<y.length;C++){const c=[y.slice(0,C).join(" "),y.slice(C).join(" ")],P=Math.max(...c.map(v));P<n&&(n=P,d=c)}}const a=Math.max(...d.map(v)),L=[];let t=0;const M=(n,C)=>{const c=Math.hypot(C[0]-n[0],C[1]-n[1]);c!==0&&(L.push({from:n,to:C,start:t,end:t+c}),t+=c)};d.forEach((n,C)=>{const c=(a-v(n))/2;let P=0,F=null;for(const k of n){let A=[0,0];const H=!l&&h==="cursive"&&V[k],$=O[k]||l&&(l.glyphs[k]||l.fallback).commands||H||J[k.toUpperCase()]||[],w=([N,S])=>[c+P+N+(O[k]||l?0:(1-S)*.09),C*(l?2:1.75)+S];let U=0;for(const[N,...S]of $){const Y=S.slice(-2);if(N==="M")U===0&&F&&H?M(F,w(Y)):t+=.12,U++;else if(N==="L")M(w(A),w(Y));else{let G=A;const K=l?6:18;for(let R=1;R<=K;R++){const T=R/K,j=1-T,X=[0,1].map(z=>j**3*A[z]+3*j*j*T*S[z]+3*j*T*T*S[z+2]+T**3*Y[z]);M(w(G),w(X)),G=X}}A=Y}F=H?w([/[A-Z]/.test(k)?.91:.62,.9]):null,P+=I(k)}});const f=L.flatMap(n=>[n.from,n.to]);if(!f.length)return createSparklerMessage("Happy New Year",o,u,{...s,message:void 0});let m=1/0,b=-1/0,p=1/0,B=-1/0;for(const[n,C]of f)m=Math.min(m,n),b=Math.max(b,n),p=Math.min(p,C),B=Math.max(B,C);for(const n of f)n[0]-=m,n[1]-=p;const W=b-m,E=Math.max(l?.1:1,Math.min(52,Math.max(1,o-56)/W,u*.07));return{type:"sparkler-message",message:e,style:h,colour:g,year:i,x:(o-W*E)/2,y:Math.min(90,u*.13),size:E,age:0,opacity:1,active:!0,static:!0,vx:0,vy:0,segments:L,length:t,lines:d.length,layoutWidth:W*E,layoutHeight:(B-p)*E}}export function updateSparklerMessage(e,o){Number.isFinite(o)&&o>0&&(e.age=(e.age+o)%SPARKLER_CYCLE)}export function sparklerPoint(e,o){const u=Math.max(0,Math.min(1,o))*e.length;let s=0,h=e.segments.length;for(;s<h;){const r=s+h>>>1;e.segments[r].end<u?s=r+1:h=r}const g=e.segments[s];if(!g||u<g.start)return null;const i=(u-g.start)/(g.end-g.start);return g.from.map((r,l)=>r+(g.to[l]-r)*i)}const _=e=>{const o=Math.sin(e*127.1+311.7)*43758.5453;return o-Math.floor(o)};export function drawSparklerMessage(e,o){if(![o.x,o.y,o.size,o.age].every(Number.isFinite)||o.size<=0||!o.segments?.length)return;const{delay:u,write:s,hold:h,fade:g}=SPARKLER_TIMING,i=Z[o.colour]||Z.gold,r=o.age-u;if(r<=0||r>=s+h+g)return;const l=Math.min(1,r/s),y=Math.max(0,1-Math.max(0,r-s-h)/g);e.save(),e.translate(o.x,o.y),e.scale(o.size,o.size),e.globalAlpha*=(o.opacity??1)*y,e.lineCap="round",e.lineJoin="round";const I=l*o.length;for(const[a,L,t]of[[i.edge,.065,14],[i.body,.032,7],[i.core,.012,0]]){e.strokeStyle=a,e.lineWidth=L,e.shadowColor=i.glow,e.shadowBlur=t,e.beginPath();for(const M of o.segments){if(M.start>I)break;const f=Math.min(1,(I-M.start)/(M.end-M.start));e.moveTo(...M.from),e.lineTo(...M.from.map((m,b)=>m+(M.to[b]-m)*f))}e.stroke()}e.shadowBlur=0;const v=Math.floor(Math.min(r,s)/18);for(let a=Math.max(0,v-44);a<=v;a++){const L=a*18,t=(r-L)/1e3;if(t<0||t>.8)continue;const M=sparklerPoint(o,L/s);if(!M)continue;const f=_(a+1)*Math.PI*2,m=.25+_(a+99)*1.2,b=M[0]+Math.cos(f)*m*t,p=M[1]+Math.sin(f)*m*t+t*t*.9;e.globalAlpha=(o.opacity??1)*y*(1-t/.8),e.strokeStyle=a%3?i.spark:i.core,e.lineWidth=.018,e.beginPath(),e.moveTo(b,p),e.lineTo(b-Math.cos(f)*.06,p-Math.sin(f)*.06),e.stroke()}for(let a=1;a<=24;a++){const L=a/25;if(L>l)break;const t=sparklerPoint(o,L),M=Math.max(0,Math.sin(r/170+a*2.399))**14;if(!t||M<.08)continue;e.globalAlpha=(o.opacity??1)*y*M,e.strokeStyle=i.core,e.lineWidth=.014,e.shadowColor=i.glow,e.shadowBlur=9;const f=.055+M*.06;e.beginPath(),e.moveTo(t[0]-f,t[1]),e.lineTo(t[0]+f,t[1]),e.moveTo(t[0],t[1]-f),e.lineTo(t[0],t[1]+f),e.stroke()}const d=r<s?sparklerPoint(o,l):null;if(d){e.globalAlpha=o.opacity??1,e.shadowColor=i.glow,e.shadowBlur=18,e.fillStyle=i.bright,e.beginPath(),e.arc(...d,.055,0,Math.PI*2),e.fill(),e.lineWidth=.016,e.strokeStyle=i.core;for(let a=0;a<8;a++){const L=a*Math.PI/4+r/350;e.beginPath(),e.moveTo(...d),e.lineTo(d[0]+Math.cos(L)*.15,d[1]+Math.sin(L)*.15),e.stroke()}}e.restore()}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createGardenTheme as e}from"./garden.js";export default e(!1);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l=(e,i,a,r,n={})=>({type:e,x:i,y:a,size:r,vx:0,vy:0,opacity:.9,static:!0,active:!0,phase:Math.random()*Math.PI*2,...n});function s(e,i){return![i.x,i.y,i.size].every(Number.isFinite)||i.size<=0?!1:(e.save(),e.translate(i.x,i.y),e.scale(i.size,i.size),e.globalAlpha*=i.opacity,e.lineCap="round",e.lineJoin="round",!0)}export default{name:"winter",displayName:"Winter",emoji:"\u2744\uFE0F",colors:{primary:"#e5f4ff"},intensityConfig:{light:{count:35,speedRange:[.3,.8],sizeRange:[1,3],pines:3,icicles:8,stars:8},medium:{count:80,speedRange:[.5,1.2],sizeRange:[1.5,4],pines:5,icicles:14,stars:14},heavy:{count:150,speedRange:[.7,1.8],sizeRange:[2,5],pines:8,icicles:20,stars:22}},particles:["winter-snowflake"],decorations:["frosted-pine","snowdrift","icicle","winter-star"],traits:{snowflake:{label:"Snowflakes",types:["winter-snowflake"],kind:"particle"},pine:{label:"Frosted pines",types:["frosted-pine"],count:"pines"},snowdrift:{label:"Snowdrifts",types:["snowdrift"]},icicle:{label:"Icicles",types:["icicle"],count:"icicles"},star:{label:"Winter stars",types:["winter-star"],count:"stars"}},createFallingParticle(e,i,a){return l("winter-snowflake",Math.random()*e,-20,a.sizeRange[0]+Math.random()*(a.sizeRange[1]-a.sizeRange[0]),{static:!1,speed:a.speedRange[0]+Math.random()*(a.speedRange[1]-a.speedRange[0]),windOffset:Math.random()*6.28,windSpeed:.012,rotation:Math.random()*6.28,rotationSpeed:(Math.random()-.5)*.012})},createInitialDecorations(e,i,a){const r=Math.min(1,e/600),n=[l("snowdrift",e/2,i,e)];for(let o=0;o<a.pines;o++)n.push(l("frosted-pine",(o+.5)*e/a.pines,i-8,(30+Math.random()*16)*r));for(let o=0;o<a.icicles;o++)n.push(l("icicle",(o+.5)*e/a.icicles,0,(14+Math.random()*18)*r));for(let o=0;o<a.stars;o++)n.push(l("winter-star",Math.random()*e,i*Math.random()*.45,1+Math.random()*2));return n},drawWinterSnowflake(e,i){if(s(e,i)){e.rotate(i.rotation||0),e.strokeStyle="#e6f5ff",e.lineWidth=.13;for(let a=0;a<6;a++){e.rotate(Math.PI/3),e.beginPath(),e.moveTo(0,0),e.lineTo(0,-1);for(const r of[-.45,-.72])e.moveTo(-.18,r-.18),e.lineTo(0,r),e.lineTo(.18,r-.18);e.stroke()}e.restore()}},drawFrostedPine(e,i){if(s(e,i)){e.fillStyle="#726d65",e.fillRect(-.08,-.6,.16,.7);for(let a=0;a<4;a++){const r=-2.6+a*.5,n=.32+a*.23;e.beginPath(),e.moveTo(0,r),e.lineTo(n,r+.96),e.quadraticCurveTo(0,r+.8,-n,r+.96),e.closePath(),e.fillStyle=a%2?"#456b66":"#365858",e.fill(),e.beginPath(),e.moveTo(0,r),e.lineTo(n*.55,r+.54),e.quadraticCurveTo(.2,r+.4,0,r+.55),e.quadraticCurveTo(-.2,r+.4,-n*.55,r+.54),e.closePath(),e.fillStyle="#e1edf0",e.fill()}e.restore()}},drawSnowdrift(e,i){s(e,i)&&(e.beginPath(),e.moveTo(-.5,0),e.lineTo(-.5,-.012),e.bezierCurveTo(-.28,-.04,-.19,.002,0,-.018),e.bezierCurveTo(.2,-.04,.38,-.006,.5,-.02),e.lineTo(.5,0),e.closePath(),e.fillStyle="#dbeaf0",e.fill(),e.restore())},drawIcicle(e,i){if(!s(e,i))return;const a=e.createLinearGradient(-.14,0,.14,0);a.addColorStop(0,"#84b3c7aa"),a.addColorStop(.5,"#edfcffe6"),a.addColorStop(1,"#a9d3dfa0"),e.fillStyle=a,e.beginPath(),e.moveTo(-.15,0),e.lineTo(0,1),e.lineTo(.15,0),e.fill(),e.restore()},drawWinterStar(e,i,a){s(e,i)&&(e.globalAlpha*=.45+(Math.sin(a/1500+i.phase)+1)*.25,e.fillStyle="#d6edf8",e.beginPath(),e.moveTo(0,-1),e.lineTo(.2,-.2),e.lineTo(1,0),e.lineTo(.2,.2),e.lineTo(0,1),e.lineTo(-.2,.2),e.lineTo(-1,0),e.lineTo(-.2,-.2),e.closePath(),e.fill(),e.restore())}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CELEBRATION_THEMES={christmas:{label:"Christmas",traits:{snowflake:{label:"Snowflakes",types:["snowflake"],kind:"particle"},tree:{label:"Christmas trees",types:["tree"],count:"trees"},wreath:{label:"Wreaths",types:["wreath"],count:"wreaths"},snowman:{label:"Snowmen",types:["snowman"],count:"snowmen"},northStar:{label:"North star",types:["north-star"],count:"northStars"},sleigh:{label:"Santa's sleigh",types:["sleigh"]},robin:{label:"Robins",types:["robin"]},train:{label:"Steam train",types:["train"]},elf:{label:"Elves",types:["elf"]},peeingElf:{label:"Peeing elf",types:["peeing-elf"],chance:"peeingElfChance",enabled:!1},thievingElf:{label:"Thieving elf",types:["thieving-elf"],chance:"thievingElfChance",enabled:!1},firework:{label:"Fireworks",types:["firework","spark"]},mooningElf:{label:"Mooning elf",types:["mooning-elf"],chance:"mooningElfChance",enabled:!1}}},halloween:{label:"Halloween",traits:{pumpkin:{label:"Falling pumpkins",types:["pumpkin"],kind:"particle"},bat:{label:"Bats",types:["bat"],kind:"particle"},ghost:{label:"Ghosts",types:["ghost"],kind:"particle"},spider:{label:"Spiders",types:["spider","spider-small"],count:"spiders"},gravestone:{label:"Gravestones",types:["gravestone"],count:"gravestones"},jackOLantern:{label:"Jack-o-lanterns",types:["jack-o-lantern"],count:"jackOLanterns"},scarecrow:{label:"Scarecrows",types:["scarecrow"],count:"scarecrows"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},hauntedHouse:{label:"Haunted house",types:["haunted-house"]},moon:{label:"Moon",types:["moon"]},witch:{label:"Witches",types:["witch"]},cauldron:{label:"Cauldron",types:["cauldron"]},floatingPumpkin:{label:"Floating pumpkins",types:["floating-pumpkin"]},lightning:{label:"Lightning",global:!0}}},valentines:{label:"Valentine's Day",traits:{heart:{label:"Hearts",types:["heart"],kind:"particle"},rosePetal:{label:"Rose petals",types:["rose-petal"],kind:"particle"},sparkle:{label:"Sparkles",types:["sparkle"],kind:"particle"},lips:{label:"Kisses",types:["lips"],kind:"particle"},heartGarland:{label:"Heart garlands",types:["heart-garland"],count:"garlands"},butterfly:{label:"Butterflies",types:["butterfly"],count:"butterflies"},envelope:{label:"Envelopes",types:["envelope"],count:"envelopes"},heartMoon:{label:"Heart moon",types:["heart-moon"]},cupid:{label:"Cupid",types:["cupid"],chance:"cupidChance"},loveLetter:{label:"Love letters",types:["love-letter"]},neonSign:{label:"Neon sign",types:["neon-sign"]}}},"guy-fawkes":{label:"Guy Fawkes Night",traits:{ember:{label:"Embers",types:["ember"],kind:"particle"},spark:{label:"Sparks",types:["spark","trail"],kind:"particle"},bonfire:{label:"Bonfires",types:["bonfire"],count:"bonfires"},guyEffigy:{label:"Guy effigies",types:["guy-effigy"]},catherineWheel:{label:"Catherine wheels",types:["catherine-wheel"]},romanCandle:{label:"Roman candles",types:["roman-candle"]},sparklerBundle:{label:"Sparklers",types:["sparkler-bundle"]},firework:{label:"Fireworks",types:["firework"],chance:"fireworkChance"},rocket:{label:"Rockets",types:["rocket"],chance:"rocketChance"},burst:{label:"Bursts",types:["burst"],chance:"burstChance"},moon:{label:"Moon",types:["moon"]},lightning:{label:"Lightning",global:!0}}},"st-patricks":{label:"St Patrick's Day",traits:{cloverPetal:{label:"Clover petals",types:["clover-petal"],kind:"particle"},shamrock:{label:"Shamrocks",types:["shamrock"],kind:"particle"},goldCoin:{label:"Gold coins",types:["gold-coin"],kind:"particle"},sparkle:{label:"Sparkles",types:["sparkle"],kind:"particle"},potOfGold:{label:"Pots of gold",types:["pot-of-gold"],count:"pots"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},leprechaun:{label:"Leprechauns",types:["leprechaun","static-leprechaun"],chance:"leprechaunChance"},rainbow:{label:"Rainbow",types:["rainbow"]},banshee:{label:"Banshee",types:["banshee"]},moon:{label:"Moon",types:["moon"]},mooningLeprechaun:{label:"Mooning leprechaun",types:["mooning-leprechaun"],chance:"mooningLeprechaunChance",enabled:!1}}},"st-davids":{label:"St David's Day",traits:{daffodilPetal:{label:"Daffodil petals",types:["daffodil-petal"],kind:"particle"},daffodil:{label:"Daffodils",types:["daffodil"],kind:"particle"},springSparkle:{label:"Spring sparkles",types:["spring-sparkle"],kind:"particle"},leek:{label:"Leeks",types:["leek"],kind:"particle"},daffodilField:{label:"Daffodil fields",types:["daffodil-field"],count:"daffodilFields"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},welshDragon:{label:"Welsh dragon",types:["welsh-dragon"],chance:"dragonChance"},flag:{label:"Welsh flag",types:["flag"]},harp:{label:"Harp",types:["harp"]},leekBundle:{label:"Leek bundles",types:["leek-bundle"]}}},"st-georges":{label:"St George's Day",traits:{rosePetal:{label:"Rose petals",types:["rose-petal"],kind:"particle"},tudorRose:{label:"Tudor roses",types:["tudor-rose"],kind:"particle"},oakLeaf:{label:"Oak leaves",types:["oak-leaf"],kind:"particle"},sparkle:{label:"Sparkles",types:["sparkle"],kind:"particle"},englishRose:{label:"English roses",types:["english-rose"],count:"roses"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},knight:{label:"Knight",types:["knight"],chance:"knightChance"},dragon:{label:"Dragon",types:["dragon"]},castle:{label:"Castle",types:["castle"]},shield:{label:"Shields",types:["shield"]},stGeorgesCross:{label:"St George's cross",types:["st-georges-cross"]}}},"st-andrews":{label:"St Andrew's Day",traits:{heatherPetal:{label:"Heather petals",types:["heather-petal"],kind:"particle"},heather:{label:"Heather",types:["heather"],kind:"particle"},saltireSparkle:{label:"Saltire sparkles",types:["saltire-sparkle"],kind:"particle"},thistle:{label:"Thistles",types:["thistle"],kind:"particle"},thistlePlant:{label:"Thistle plants",types:["thistle-plant"],count:"thistles"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},bagpiper:{label:"Bagpiper",types:["bagpiper"],chance:"bagpiperChance"},saltireFlag:{label:"Saltire flag",types:["saltire-flag"]},tartanPattern:{label:"Tartan",types:["tartan-pattern"]},highlandScene:{label:"Highland scene",types:["highland-scene"]}}}};const c=a=>String(a).toLowerCase().replace(/[^a-z0-9]/g,"");export const traitAttribute=a=>a.replace(/[A-Z]/g,s=>"-"+s.toLowerCase());export function resolveCelebrationTraits(a,s={}){const n=new Set,r=new Set,i={},o=Object.entries(s).map(([l,e])=>[c(l),String(e).trim().toLowerCase()]),b=o.some(([l,e])=>["fallingonly","snowonly"].includes(l)&&["true","1","yes","on"].includes(e));for(const[l,e]of Object.entries(CELEBRATION_THEMES[a]?.traits||{})){const p=o.find(([t])=>[l,e.count,e.chance].filter(Boolean).some(h=>c(h)===t))?.[1];if(["off","false","0","no"].includes(p)||e.enabled===!1&&!["true","1","yes","on"].includes(p)||b&&e.kind!=="particle"){for(const t of e.types||[])n.add(t);e.global&&r.add(l);for(const t of[e.count,e.chance].filter(Boolean))i[t]=0}}return{disabledTypes:n,disabledGlobals:r,config:i}}
|
|
1
|
+
export const CELEBRATION_THEMES={christmas:{label:"Christmas",traits:{sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]},snowflake:{label:"Snowflakes",types:["snowflake"],kind:"particle"},tree:{label:"Christmas trees",types:["tree"],count:"trees"},wreath:{label:"Wreaths",types:["wreath"],count:"wreaths"},snowman:{label:"Snowmen",types:["snowman"],count:"snowmen"},northStar:{label:"North star",types:["north-star"],count:"northStars"},sleigh:{label:"Santa's sleigh",types:["sleigh"]},robin:{label:"Robins",types:["robin"]},train:{label:"Steam train",types:["train"]},elf:{label:"Elves",types:["elf"]},mooningElf:{label:"Mooning elf",types:["mooning-elf"],chance:"mooningElfChance",enabled:!1},peeingElf:{label:"Peeing elf",types:["peeing-elf"],chance:"peeingElfChance",enabled:!1},thievingElf:{label:"Thieving elf",types:["thieving-elf"],chance:"thievingElfChance",enabled:!1},firework:{label:"Fireworks",types:["firework","spark"]}}},halloween:{label:"Halloween",traits:{pumpkin:{label:"Falling pumpkins",types:["pumpkin"],kind:"particle"},bat:{label:"Bats",types:["bat"],kind:"particle"},ghost:{label:"Ghosts",types:["ghost"],kind:"particle"},spider:{label:"Spiders",types:["spider","spider-small"],count:"spiders"},gravestone:{label:"Gravestones",types:["gravestone"],count:"gravestones"},jackOLantern:{label:"Jack-o-lanterns",types:["jack-o-lantern"],count:"jackOLanterns"},scarecrow:{label:"Scarecrows",types:["scarecrow"],count:"scarecrows"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},hauntedHouse:{label:"Haunted house",types:["haunted-house"]},moon:{label:"Moon",types:["moon"]},witch:{label:"Witches",types:["witch"]},cauldron:{label:"Cauldron",types:["cauldron"]},floatingPumpkin:{label:"Floating pumpkins",types:["floating-pumpkin"]},lightning:{label:"Lightning",global:!0}}},valentines:{label:"Valentine's Day",traits:{heart:{label:"Hearts",types:["heart"],kind:"particle"},rosePetal:{label:"Rose petals",types:["rose-petal"],kind:"particle"},sparkle:{label:"Sparkles",types:["sparkle"],kind:"particle"},lips:{label:"Kisses",types:["lips"],kind:"particle"},heartGarland:{label:"Heart garlands",types:["heart-garland"],count:"garlands"},butterfly:{label:"Butterflies",types:["butterfly"],count:"butterflies"},envelope:{label:"Envelopes",types:["envelope"],count:"envelopes"},heartMoon:{label:"Heart moon",types:["heart-moon"]},cupid:{label:"Cupid",types:["cupid"],chance:"cupidChance"},loveLetter:{label:"Love letters",types:["love-letter"]},neonSign:{label:"Neon sign",types:["neon-sign"]}}},"guy-fawkes":{label:"Guy Fawkes Night",traits:{ember:{label:"Embers",types:["ember"],kind:"particle"},spark:{label:"Sparks",types:["spark","trail"],kind:"particle"},bonfire:{label:"Bonfires",types:["bonfire"],count:"bonfires"},guyEffigy:{label:"Guy effigies",types:["guy-effigy"]},catherineWheel:{label:"Catherine wheels",types:["catherine-wheel"]},romanCandle:{label:"Roman candles",types:["roman-candle"]},sparklerBundle:{label:"Sparklers",types:["sparkler-bundle"]},firework:{label:"Fireworks",types:["firework"],chance:"fireworkChance"},rocket:{label:"Rockets",types:["rocket"],chance:"rocketChance"},burst:{label:"Bursts",types:["burst"],chance:"burstChance"},moon:{label:"Moon",types:["moon"]},lightning:{label:"Lightning",global:!0}}},"st-patricks":{label:"St Patrick's Day",traits:{cloverPetal:{label:"Clover petals",types:["clover-petal"],kind:"particle"},shamrock:{label:"Shamrocks",types:["shamrock"],kind:"particle"},goldCoin:{label:"Gold coins",types:["gold-coin"],kind:"particle"},sparkle:{label:"Sparkles",types:["sparkle"],kind:"particle"},potOfGold:{label:"Pots of gold",types:["pot-of-gold"],count:"pots"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},leprechaun:{label:"Leprechauns",types:["leprechaun","static-leprechaun"],chance:"leprechaunChance"},rainbow:{label:"Rainbow",types:["rainbow"]},banshee:{label:"Banshee",types:["banshee"]},moon:{label:"Moon",types:["moon"]},mooningLeprechaun:{label:"Mooning leprechaun",types:["mooning-leprechaun"],chance:"mooningLeprechaunChance",enabled:!1}}},"st-davids":{label:"St David's Day",traits:{daffodilPetal:{label:"Daffodil petals",types:["daffodil-petal"],kind:"particle"},daffodil:{label:"Daffodils",types:["daffodil"],kind:"particle"},springSparkle:{label:"Spring sparkles",types:["spring-sparkle"],kind:"particle"},leek:{label:"Leeks",types:["leek"],kind:"particle"},daffodilField:{label:"Daffodil fields",types:["daffodil-field"],count:"daffodilFields"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},welshDragon:{label:"Welsh dragon",types:["welsh-dragon"],chance:"dragonChance"},flag:{label:"Welsh flag",types:["flag"]},harp:{label:"Harp",types:["harp"]},leekBundle:{label:"Leek bundles",types:["leek-bundle"]}}},"st-georges":{label:"St George's Day",traits:{rosePetal:{label:"Rose petals",types:["rose-petal"],kind:"particle"},tudorRose:{label:"Tudor roses",types:["tudor-rose"],kind:"particle"},oakLeaf:{label:"Oak leaves",types:["oak-leaf"],kind:"particle"},sparkle:{label:"Sparkles",types:["sparkle"],kind:"particle"},englishRose:{label:"English roses",types:["english-rose"],count:"roses"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},knight:{label:"Knight",types:["knight"],chance:"knightChance"},dragon:{label:"Dragon",types:["dragon"]},castle:{label:"Castle",types:["castle"]},shield:{label:"Shields",types:["shield"]},stGeorgesCross:{label:"St George's cross",types:["st-georges-cross"]}}},"st-andrews":{label:"St Andrew's Day",traits:{heatherPetal:{label:"Heather petals",types:["heather-petal"],kind:"particle"},heather:{label:"Heather",types:["heather"],kind:"particle"},saltireSparkle:{label:"Saltire sparkles",types:["saltire-sparkle"],kind:"particle"},thistle:{label:"Thistles",types:["thistle"],kind:"particle"},thistlePlant:{label:"Thistle plants",types:["thistle-plant"],count:"thistles"},twinklingStar:{label:"Twinkling stars",types:["twinkling-star"],count:"twinklingStars"},bagpiper:{label:"Bagpiper",types:["bagpiper"],chance:"bagpiperChance"},saltireFlag:{label:"Saltire flag",types:["saltire-flag"]},tartanPattern:{label:"Tartan",types:["tartan-pattern"]},highlandScene:{label:"Highland scene",types:["highland-scene"]}}},"new-year":{label:"New Year",traits:{confetti:{label:"Confetti",types:["confetti"],kind:"particle"},streamer:{label:"Streamers",types:["streamer"],kind:"particle"},firework:{label:"Fireworks",types:["new-year-firework"],chance:"fireworkChance"},balloon:{label:"Balloons",types:["balloon"],count:"balloons"},midnightClock:{label:"Midnight clock",types:["midnight-clock"]},sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]}}},easter:{label:"Easter",traits:{blossom:{label:"Falling blossom",types:["blossom"],kind:"particle"},flower:{label:"Flowers",types:["flower"],count:"flowers"},butterfly:{label:"Butterflies",types:["garden-butterfly"],count:"butterflies"},easterEgg:{label:"Decorated eggs",types:["easter-egg"],count:"eggs"},bunny:{label:"Easter bunny",types:["bunny"]}}},"summer-garden":{label:"Summer Garden",traits:{blossom:{label:"Drifting petals",types:["blossom"],kind:"particle"},flower:{label:"Flowers",types:["flower"],count:"flowers"},butterfly:{label:"Butterflies",types:["garden-butterfly"],count:"butterflies"},bee:{label:"Bumblebees",types:["bee"],count:"bees"},ladybird:{label:"Ladybirds",types:["ladybird"],count:"ladybirds"}}},"chinese-new-year":{label:"Chinese New Year",traits:{confetti:{label:"Red and gold confetti",types:["confetti"],kind:"particle"},lantern:{label:"Red lanterns",types:["lantern"],count:"lanterns"},dragon:{label:"Chinese dragon",types:["chinese-dragon"]},firework:{label:"Fireworks",types:["new-year-firework"],chance:"fireworkChance"},sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]}}},winter:{label:"Winter",traits:{snowflake:{label:"Snowflakes",types:["winter-snowflake"],kind:"particle"},pine:{label:"Frosted pines",types:["frosted-pine"],count:"pines"},snowdrift:{label:"Snowdrifts",types:["snowdrift"]},icicle:{label:"Icicles",types:["icicle"],count:"icicles"},star:{label:"Winter stars",types:["winter-star"],count:"stars"}}},"make-it-rain":{label:"Make it rain",traits:{raindrop:{label:"Raindrops",types:["raindrop"],kind:"particle"},splash:{label:"Rain splashes",types:["rain-splash"],count:"splashes",chance:"splashChance"}}},"money-rain":{label:"Money Rain",traits:{banknote:{label:"Banknotes",types:["banknote"],kind:"particle"}}},graduation:{label:"Graduation",traits:{sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]},confetti:{label:"Confetti",types:["confetti"],kind:"particle"},mortarboard:{label:"Tossed mortarboards",types:["mortarboard"],count:"caps"},diploma:{label:"Diplomas",types:["diploma"],count:"diplomas"}}},birthday:{label:"Birthday",traits:{sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]},confetti:{label:"Confetti",types:["confetti"],kind:"particle"},balloon:{label:"Balloons",types:["balloon"],count:"balloons"},cake:{label:"Birthday cake",types:["birthday-cake"]}}},anniversary:{label:"Anniversary",traits:{sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]},heart:{label:"Falling hearts",types:["celebration-heart"],kind:"particle"},rings:{label:"Anniversary rings",types:["anniversary-rings"]},ribbon:{label:"Ribbon bows",types:["ribbon-bow"]}}},greeting:{label:"Sparkler greeting",traits:{sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]}}},autumn:{label:"Autumn",traits:{mapleLeaf:{label:"Maple leaves",types:["maple-leaf"],kind:"particle"},oakLeaf:{label:"Oak leaves",types:["oak-leaf"],kind:"particle"},tree:{label:"Autumn trees",types:["autumn-tree"],count:"trees"},acorn:{label:"Acorns",types:["acorn"],count:"acorns"},mushroom:{label:"Mushrooms",types:["mushroom"],count:"mushrooms"}}}};const b=a=>String(a).toLowerCase().replace(/[^a-z0-9]/g,"");export const traitAttribute=a=>a.replace(/[A-Z]/g,s=>"-"+s.toLowerCase());export function resolveCelebrationTraits(a,s={}){const n=new Set,r=new Set,i={},o=Object.entries(s).map(([l,e])=>[b(l),String(e).trim().toLowerCase()]),c=o.some(([l,e])=>["fallingonly","snowonly"].includes(l)&&["true","1","yes","on"].includes(e));for(const[l,e]of Object.entries(CELEBRATION_THEMES[a]?.traits||{})){const p=o.find(([t])=>[l,e.count,e.chance].filter(Boolean).some(y=>b(y)===t))?.[1];if(["off","false","0","no"].includes(p)||e.enabled===!1&&!["true","1","yes","on"].includes(p)||c&&e.kind!=="particle"){for(const t of e.types||[])n.add(t);e.global&&r.add(l);for(const t of[e.count,e.chance].filter(Boolean))i[t]=0}}return{disabledTypes:n,disabledGlobals:r,config:i}}
|
package/public/js/effects.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";Promise.all([fetch("/api/effects/settings").then(function(g){return g.json()}),import("/public/js/scribe-style.mjs?v=20261013-cms-fonts")]).then(function(g){var w=g[0],F=g[1].buildScribeStyle,q=g[1].loadScribeFont,C=w.respectMotion!==!1,Y=w.defaultDuration||600,N=w.defaultAnimation||"fade",R=w.defaultThreshold!=null?w.defaultThreshold:.1,p=C&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,m=document.querySelector(".page-body");if(!m)return;var A=m.querySelector?m.querySelector(".dm-fx-demo-controls"):null;if(A){A.hidden=!1;var k=A.querySelector("[data-fx-demo-status]"),M=A.querySelector("[data-fx-demo-play]");k.textContent=p?"Animations are disabled by your Reduce motion preference. The demos show static content.":"Animations are enabled. Scroll to each demo to see it, or replay the page.",M.textContent=p?"Enable animations on this site":"Replay demos",M.addEventListener("click",function(){if(p)try{localStorage.setItem("domma:reduced_motion","false")}catch{k.textContent="Your browser blocked saving the motion preference. Use its accessibility settings to allow animations.";return}window.location.reload()})}function r(t,e){return t.getAttribute("data-fx-"+e)}function i(t,e,n){var a=r(t,e),o=a!==null?parseFloat(a):NaN;return Number.isFinite(o)?o:n}function x(t,e,n){var a=r(t,e);return a===null?n:a==="true"||a==="1"}function T(t,e,n){var a=new IntersectionObserver(function(o){o[0].isIntersecting&&(a.unobserve(t),n())},{threshold:e});a.observe(t)}m.querySelectorAll(".dm-fx-reveal").forEach(function(t){var e=r(t,"animation")||N,n=i(t,"duration",Y),a=i(t,"delay",0),o=i(t,"threshold",R),u=x(t,"once",!0);p||(t.style.opacity="0",t.style.transition="none",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"&&(t.style.transform="rotateY(90deg)"),requestAnimationFrame(function(){requestAnimationFrame(function(){t.style.transition="opacity "+n+"ms ease "+a+"ms, transform "+n+"ms ease "+a+"ms";var f=new IntersectionObserver(function(c){c.forEach(function(l){l.isIntersecting?(t.style.opacity="1",t.style.transform="",u&&f.unobserve(t)):u||(t.style.opacity="0",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"?t.style.transform="rotateY(90deg)":t.style.transform="")})},{threshold:o});f.observe(t)})}))}),m.querySelectorAll(".dm-fx-counter").forEach(function(t){var e=i(t,"to",0),n=i(t,"from",0),a=i(t,"duration",2e3),o=r(t,"prefix")||"",u=r(t,"suffix")||"",f=i(t,"decimals",0),c=r(t,"separator")||"";function l(v){var d=v.toFixed(f);if(c){var y=d.split(".");y[0]=y[0].replace(/\B(?=(\d{3})+(?!\d))/g,c),d=y.join(".")}return o+d+u}if(p){t.textContent=l(e);return}T(t,.5,function(){var v=null;requestAnimationFrame(function d(y){v||(v=y);var S=Math.min((y-v)/a,1),E=1-Math.pow(1-S,3);t.textContent=l(n+(e-n)*E),S<1&&requestAnimationFrame(d)})})}),p||m.querySelectorAll(".dm-fx-scramble").forEach(function(t){var e=i(t,"speed",50),n=t.textContent,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&",o=0;T(t,.3,function(){var u=setInterval(function(){for(var f="",c=0;c<n.length;c++)c<o||n[c]===" "?f+=n[c]:f+=a[Math.floor(Math.random()*a.length)];t.textContent=f,o<n.length?o++:clearInterval(u)},e)})}),p||m.querySelectorAll(".dm-fx-shake").forEach(function(t){var e=i(t,"intensity",5),n=i(t,"duration",500),a=r(t,"direction")||"horizontal",o=a==="vertical"?"translateY":"translateX";t.animate([{transform:o+"(0)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(0)"}],{duration:n,easing:"ease-in-out"})}),m.querySelectorAll(".dm-fx-ripple").forEach(function(t){t.style.position="relative",t.style.overflow="hidden",t.addEventListener("click",function(e){var n=r(t,"colour")||"rgba(255,255,255,0.3)",a=i(t,"duration",600),o=t.getBoundingClientRect(),u=Math.max(o.width,o.height)*2,f=document.createElement("span");f.style.cssText="position:absolute;border-radius:50%;pointer-events:none;width:"+u+"px;height:"+u+"px;left:"+(e.clientX-o.left-u/2)+"px;top:"+(e.clientY-o.top-u/2)+"px;background:"+n+";transform:scale(0);opacity:1;transition:transform "+a+"ms ease,opacity "+a+"ms ease;",t.appendChild(f),requestAnimationFrame(function(){f.style.transform="scale(1)",f.style.opacity="0"}),setTimeout(function(){f.remove()},a)})});var h=window.Domma&&window.Domma.effects;h&&(m.querySelectorAll(".dm-fx-breathe").forEach(function(t){if(!p){var e={};r(t,"amplitude")&&(e.amplitude=i(t,"amplitude",6)),r(t,"duration")&&(e.duration=i(t,"duration",3e3)),r(t,"easing")&&(e.easing=r(t,"easing")),r(t,"stagger")&&(e.stagger=i(t,"stagger",0)),h.breathe(t,e)}}),m.querySelectorAll(".dm-fx-pulse").forEach(function(t){if(!p){var e={};r(t,"scale")&&(e.scale=i(t,"scale",1.05)),r(t,"duration")&&(e.duration=i(t,"duration",2e3)),r(t,"easing")&&(e.easing=r(t,"easing")),h.pulse(t,e)}}),m.querySelectorAll(".dm-fx-scribe").forEach(function(t){var e={};["font","size","font-size","weight","colour","color","italic","align","line-height","spacing"].forEach(function(s){var b=r(t,s);b!==null&&(e[s]=b)}),typeof q=="function"&&q(e.font);var n=F(e);n&&(t.style.cssText+=";"+n);var a={respectMotionPreference:C};[["speed","speed",50],["delete-speed","deleteSpeed",30],["loop-delay","loopDelay",1e3]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=Math.max(0,i(t,s[0],s[2])))}),[["cursor","cursor",!0],["cursor-blink","cursorBlink",!0],["pause-on-hover","pauseOnHover",!1],["auto-start","autoStart",!0],["respect-motion-preference","respectMotionPreference",C]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=x(t,s[0],s[2]))}),r(t,"cursor-char")!==null&&(a.cursorChar=r(t,"cursor-char"));var o=r(t,"mode");["typewriter","word","sentence"].includes(o)&&(a.mode=o);var u=r(t,"cursor-type");["caret","block","underline"].includes(u)&&(a.cursorType=u);var f=r(t,"loop");if(f!==null){var c=Number(f);a.loop=f==="true"?!0:Number.isInteger(c)&&c>=1?c:!1}var l=r(t,"effect");["none","fade","bounce","glow"].includes(l)||(l="none");var v=r(t,"actions");if(v){try{a.actions=JSON.parse(v)}catch{return}if(!Array.isArray(a.actions)||a.actions.some(function(s){return!s||typeof s!="object"}))return;a.actions=a.actions.map(function(s){return s.render!==void 0&&s.effect===void 0?Object.assign({},s,{effect:l}):s})}else{var d=t.textContent.trim();if(!d)return;a.actions=[{render:d,effect:l}]}var y=a.respectMotionPreference&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(y){var S=a.actions.find(function(s){return s.render!=null});S&&(t.textContent=String(S.render));return}v||(t.textContent=""),[["onStart","start"],["onComplete","complete"],["onCharacter","character"],["onRender","render"],["onUndoRender","undo"],["onLoop","loop"]].forEach(function(s){a[s[0]]=function(b,O){t.dispatchEvent(new CustomEvent("scribe:"+s[1],{bubbles:!0,detail:{value:b,index:O}}))}});var E=h.scribe(t,a);if(E&&(x(t,"controls",!1)||a.autoStart===!1)){var z=document.createElement("span");z.className="dm-scribe-controls",z.setAttribute("role","group"),z.setAttribute("aria-label","Text animation playback"),[["Play","resume"],["Pause","pause"],["Replay","restart"]].forEach(function(s){var b=document.createElement("button");b.type="button",b.className="btn btn-ghost btn-sm",b.textContent=s[0],b.addEventListener("click",function(){E[s[1]]()}),z.appendChild(b)}),t.insertAdjacentElement("afterend",z)}}),m.querySelectorAll(".dm-fx-twinkle").forEach(function(t){var e={};r(t,"count")&&(e.count=i(t,"count",100)),r(t,"shape")&&(e.shape=r(t,"shape")),r(t,"colour")&&(e.colour=r(t,"colour")),r(t,"min-size")&&(e.minSize=i(t,"min-size",1)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",3)),h.twinkle(t,e)}),typeof h.tickerTape=="function"&&m.querySelectorAll(".dm-fx-ticker-tape").forEach(function(t){if(!p){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",50)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"sway")&&(e.sway=i(t,"sway",60)),r(t,"rotation-speed")&&(e.rotationSpeed=i(t,"rotation-speed",6)),r(t,"min-width")&&(e.minWidth=i(t,"min-width",5)),r(t,"max-width")&&(e.maxWidth=i(t,"max-width",9)),r(t,"min-height")&&(e.minHeight=i(t,"min-height",12)),r(t,"max-height")&&(e.maxHeight=i(t,"max-height",22)),r(t,"fade-start")&&(e.fadeStart=i(t,"fade-start",.55)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",150)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?h.tickerTape(null,e):h.tickerTape(t,e)}}),typeof h.butterflies=="function"&&m.querySelectorAll(".dm-fx-butterflies").forEach(function(t){if(!p){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",18)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"wander")&&(e.wander=i(t,"wander",1)),r(t,"rise-speed")&&(e.riseSpeed=i(t,"rise-speed",.4)),r(t,"flap-speed")&&(e.flapSpeed=i(t,"flap-speed",1)),r(t,"min-size")&&(e.minSize=i(t,"min-size",14)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",26)),r(t,"two-tone")&&(e.twoTone=x(t,"two-tone",!0)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",40)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?h.butterflies(null,e):h.butterflies(t,e)}}),typeof h.strobe=="function"&&m.querySelectorAll(".dm-fx-strobe").forEach(function(t){if(p)return;function e(f){var c=r(t,f);if(!c)return null;var l=c.split(",").map(function(v){return v.trim()}).filter(Boolean);return l.length?l:null}var n={};r(t,"preset")&&(n.preset=r(t,"preset")),r(t,"motion")&&(n.motion=r(t,"motion")),r(t,"speed")&&(n.speed=i(t,"speed",1)),r(t,"sweep-arc")&&(n.sweepArc=i(t,"sweep-arc",100)),r(t,"beam-width")&&(n.beamWidth=i(t,"beam-width",16)),r(t,"intensity")&&(n.intensity=i(t,"intensity",.7)),r(t,"flicker")&&(n.flicker=x(t,"flicker",!0)),r(t,"hz")&&(n.hz=i(t,"hz",10));var a=e("origins");a&&(n.origins=a);var o=e("colours");o&&(n.colours=o),r(t,"duration")&&(n.duration=i(t,"duration",null)),r(t,"z-index")&&(n.zIndex=i(t,"z-index",9999));var u=r(t,"mode");u==="page"?h.strobe(null,n):h.strobe(t,n)}));var I=m.querySelectorAll(".dm-fx-celebrate");I.length&&import("/public/js/celebrations/index.js?v=20261003-characters").then(function(t){var e=t.CelebrationsEffect;I.forEach(function(n){var a=r(n,"character");if(a){if(n.querySelector("canvas"))return;t.mountCharacter(n,{character:a,size:r(n,"size")||"medium",facing:r(n,"facing")||"right",animate:!p&&x(n,"animate",!0)}).then(function(d){var y=new MutationObserver(function(){n.isConnected||(d.destroy(),y.disconnect())});n.isConnected?y.observe(document.body,{childList:!0,subtree:!0}):d.destroy()}).catch(function(d){console.error("[celebrate]",d)});return}if(!p){var o=n.getAttribute("data-fx-theme")||"auto",u=n.getAttribute("data-fx-intensity")||"medium",f=n.getAttribute("data-fx-z-index")?parseInt(n.getAttribute("data-fx-z-index"),10):999;if(!(o==="auto"&&(o=e.getCurrentTheme(),!o))){var c={},l=["data-fx-theme","data-fx-intensity","data-fx-z-index"];Array.from(n.attributes).forEach(function(d){d.name.startsWith("data-fx-")&&!l.includes(d.name)&&(c[d.name.slice(8)]=d.value)});var v=new e({theme:o,intensity:u,enabled:!0,zIndex:f,overrides:c});v.init().then(function(){v.start()})}}})}).catch(function(){})}).catch(function(){})})();
|
|
1
|
+
(function(){"use strict";Promise.all([fetch("/api/effects/settings").then(function(g){return g.json()}),import("/public/js/scribe-style.mjs?v=20261013-cms-fonts")]).then(function(g){var w=g[0],F=g[1].buildScribeStyle,q=g[1].loadScribeFont,C=w.respectMotion!==!1,R=w.defaultDuration||600,Y=w.defaultAnimation||"fade",N=w.defaultThreshold!=null?w.defaultThreshold:.1,p=C&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,m=document.querySelector(".page-body");if(!m)return;var A=m.querySelector?m.querySelector(".dm-fx-demo-controls"):null;if(A){A.hidden=!1;var k=A.querySelector("[data-fx-demo-status]"),M=A.querySelector("[data-fx-demo-play]");k.textContent=p?"Animations are disabled by your Reduce motion preference. The demos show static content.":"Animations are enabled. Scroll to each demo to see it, or replay the page.",M.textContent=p?"Enable animations on this site":"Replay demos",M.addEventListener("click",function(){if(p)try{localStorage.setItem("domma:reduced_motion","false")}catch{k.textContent="Your browser blocked saving the motion preference. Use its accessibility settings to allow animations.";return}window.location.reload()})}function r(t,e){return t.getAttribute("data-fx-"+e)}function i(t,e,n){var a=r(t,e),o=a!==null?parseFloat(a):NaN;return Number.isFinite(o)?o:n}function x(t,e,n){var a=r(t,e);return a===null?n:a==="true"||a==="1"}function I(t,e,n){var a=new IntersectionObserver(function(o){o[0].isIntersecting&&(a.unobserve(t),n())},{threshold:e});a.observe(t)}m.querySelectorAll(".dm-fx-reveal").forEach(function(t){var e=r(t,"animation")||Y,n=i(t,"duration",R),a=i(t,"delay",0),o=i(t,"threshold",N),d=x(t,"once",!0);p||(t.style.opacity="0",t.style.transition="none",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"&&(t.style.transform="rotateY(90deg)"),requestAnimationFrame(function(){requestAnimationFrame(function(){t.style.transition="opacity "+n+"ms ease "+a+"ms, transform "+n+"ms ease "+a+"ms";var f=new IntersectionObserver(function(c){c.forEach(function(l){l.isIntersecting?(t.style.opacity="1",t.style.transform="",d&&f.unobserve(t)):d||(t.style.opacity="0",e==="slide-up"?t.style.transform="translateY(30px)":e==="slide-down"?t.style.transform="translateY(-30px)":e==="zoom"?t.style.transform="scale(0.85)":e==="flip"?t.style.transform="rotateY(90deg)":t.style.transform="")})},{threshold:o});f.observe(t)})}))}),m.querySelectorAll(".dm-fx-counter").forEach(function(t){var e=i(t,"to",0),n=i(t,"from",0),a=i(t,"duration",2e3),o=r(t,"prefix")||"",d=r(t,"suffix")||"",f=i(t,"decimals",0),c=r(t,"separator")||"";function l(v){var u=v.toFixed(f);if(c){var y=u.split(".");y[0]=y[0].replace(/\B(?=(\d{3})+(?!\d))/g,c),u=y.join(".")}return o+u+d}if(p){t.textContent=l(e);return}I(t,.5,function(){var v=null;requestAnimationFrame(function u(y){v||(v=y);var S=Math.min((y-v)/a,1),E=1-Math.pow(1-S,3);t.textContent=l(n+(e-n)*E),S<1&&requestAnimationFrame(u)})})}),p||m.querySelectorAll(".dm-fx-scramble").forEach(function(t){var e=i(t,"speed",50),n=t.textContent,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&",o=0;I(t,.3,function(){var d=setInterval(function(){for(var f="",c=0;c<n.length;c++)c<o||n[c]===" "?f+=n[c]:f+=a[Math.floor(Math.random()*a.length)];t.textContent=f,o<n.length?o++:clearInterval(d)},e)})}),p||m.querySelectorAll(".dm-fx-shake").forEach(function(t){var e=i(t,"intensity",5),n=i(t,"duration",500),a=r(t,"direction")||"horizontal",o=a==="vertical"?"translateY":"translateX";t.animate([{transform:o+"(0)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(-"+e+"px)"},{transform:o+"("+e+"px)"},{transform:o+"(0)"}],{duration:n,easing:"ease-in-out"})}),m.querySelectorAll(".dm-fx-ripple").forEach(function(t){t.style.position="relative",t.style.overflow="hidden",t.addEventListener("click",function(e){var n=r(t,"colour")||"rgba(255,255,255,0.3)",a=i(t,"duration",600),o=t.getBoundingClientRect(),d=Math.max(o.width,o.height)*2,f=document.createElement("span");f.style.cssText="position:absolute;border-radius:50%;pointer-events:none;width:"+d+"px;height:"+d+"px;left:"+(e.clientX-o.left-d/2)+"px;top:"+(e.clientY-o.top-d/2)+"px;background:"+n+";transform:scale(0);opacity:1;transition:transform "+a+"ms ease,opacity "+a+"ms ease;",t.appendChild(f),requestAnimationFrame(function(){f.style.transform="scale(1)",f.style.opacity="0"}),setTimeout(function(){f.remove()},a)})});var h=window.Domma&&window.Domma.effects;h&&(m.querySelectorAll(".dm-fx-breathe").forEach(function(t){if(!p){var e={};r(t,"amplitude")&&(e.amplitude=i(t,"amplitude",6)),r(t,"duration")&&(e.duration=i(t,"duration",3e3)),r(t,"easing")&&(e.easing=r(t,"easing")),r(t,"stagger")&&(e.stagger=i(t,"stagger",0)),h.breathe(t,e)}}),m.querySelectorAll(".dm-fx-pulse").forEach(function(t){if(!p){var e={};r(t,"scale")&&(e.scale=i(t,"scale",1.05)),r(t,"duration")&&(e.duration=i(t,"duration",2e3)),r(t,"easing")&&(e.easing=r(t,"easing")),h.pulse(t,e)}}),m.querySelectorAll(".dm-fx-scribe").forEach(function(t){var e={};["font","size","font-size","weight","colour","color","italic","align","line-height","spacing"].forEach(function(s){var b=r(t,s);b!==null&&(e[s]=b)}),typeof q=="function"&&q(e.font);var n=F(e);n&&(t.style.cssText+=";"+n);var a={respectMotionPreference:C};[["speed","speed",50],["delete-speed","deleteSpeed",30],["loop-delay","loopDelay",1e3]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=Math.max(0,i(t,s[0],s[2])))}),[["cursor","cursor",!0],["cursor-blink","cursorBlink",!0],["pause-on-hover","pauseOnHover",!1],["auto-start","autoStart",!0],["respect-motion-preference","respectMotionPreference",C]].forEach(function(s){r(t,s[0])!==null&&(a[s[1]]=x(t,s[0],s[2]))}),r(t,"cursor-char")!==null&&(a.cursorChar=r(t,"cursor-char"));var o=r(t,"mode");["typewriter","word","sentence"].includes(o)&&(a.mode=o);var d=r(t,"cursor-type");["caret","block","underline"].includes(d)&&(a.cursorType=d);var f=r(t,"loop");if(f!==null){var c=Number(f);a.loop=f==="true"?!0:Number.isInteger(c)&&c>=1?c:!1}var l=r(t,"effect");["none","fade","bounce","glow"].includes(l)||(l="none");var v=r(t,"actions");if(v){try{a.actions=JSON.parse(v)}catch{return}if(!Array.isArray(a.actions)||a.actions.some(function(s){return!s||typeof s!="object"}))return;a.actions=a.actions.map(function(s){return s.render!==void 0&&s.effect===void 0?Object.assign({},s,{effect:l}):s})}else{var u=t.textContent.trim();if(!u)return;a.actions=[{render:u,effect:l}]}var y=a.respectMotionPreference&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(y){var S=a.actions.find(function(s){return s.render!=null});S&&(t.textContent=String(S.render));return}v||(t.textContent=""),[["onStart","start"],["onComplete","complete"],["onCharacter","character"],["onRender","render"],["onUndoRender","undo"],["onLoop","loop"]].forEach(function(s){a[s[0]]=function(b,O){t.dispatchEvent(new CustomEvent("scribe:"+s[1],{bubbles:!0,detail:{value:b,index:O}}))}});var E=h.scribe(t,a);if(E&&(x(t,"controls",!1)||a.autoStart===!1)){var z=document.createElement("span");z.className="dm-scribe-controls",z.setAttribute("role","group"),z.setAttribute("aria-label","Text animation playback"),[["Play","resume"],["Pause","pause"],["Replay","restart"]].forEach(function(s){var b=document.createElement("button");b.type="button",b.className="btn btn-ghost btn-sm",b.textContent=s[0],b.addEventListener("click",function(){E[s[1]]()}),z.appendChild(b)}),t.insertAdjacentElement("afterend",z)}}),m.querySelectorAll(".dm-fx-twinkle").forEach(function(t){var e={};r(t,"count")&&(e.count=i(t,"count",100)),r(t,"shape")&&(e.shape=r(t,"shape")),r(t,"colour")&&(e.colour=r(t,"colour")),r(t,"min-size")&&(e.minSize=i(t,"min-size",1)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",3)),h.twinkle(t,e)}),typeof h.tickerTape=="function"&&m.querySelectorAll(".dm-fx-ticker-tape").forEach(function(t){if(!p){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",50)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"sway")&&(e.sway=i(t,"sway",60)),r(t,"rotation-speed")&&(e.rotationSpeed=i(t,"rotation-speed",6)),r(t,"min-width")&&(e.minWidth=i(t,"min-width",5)),r(t,"max-width")&&(e.maxWidth=i(t,"max-width",9)),r(t,"min-height")&&(e.minHeight=i(t,"min-height",12)),r(t,"max-height")&&(e.maxHeight=i(t,"max-height",22)),r(t,"fade-start")&&(e.fadeStart=i(t,"fade-start",.55)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",150)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?h.tickerTape(null,e):h.tickerTape(t,e)}}),typeof h.butterflies=="function"&&m.querySelectorAll(".dm-fx-butterflies").forEach(function(t){if(!p){var e={};r(t,"palette")&&(e.palette=r(t,"palette")),r(t,"density")&&(e.density=i(t,"density",18)),r(t,"speed")&&(e.speed=i(t,"speed",1)),r(t,"wander")&&(e.wander=i(t,"wander",1)),r(t,"rise-speed")&&(e.riseSpeed=i(t,"rise-speed",.4)),r(t,"flap-speed")&&(e.flapSpeed=i(t,"flap-speed",1)),r(t,"min-size")&&(e.minSize=i(t,"min-size",14)),r(t,"max-size")&&(e.maxSize=i(t,"max-size",26)),r(t,"two-tone")&&(e.twoTone=x(t,"two-tone",!0)),r(t,"burst")&&(e.burst=x(t,"burst",!1)),r(t,"burst-count")&&(e.burstCount=i(t,"burst-count",40)),r(t,"z-index")&&(e.zIndex=i(t,"z-index",1));var n=r(t,"mode");n==="page"?h.butterflies(null,e):h.butterflies(t,e)}}),typeof h.strobe=="function"&&m.querySelectorAll(".dm-fx-strobe").forEach(function(t){if(p)return;function e(f){var c=r(t,f);if(!c)return null;var l=c.split(",").map(function(v){return v.trim()}).filter(Boolean);return l.length?l:null}var n={};r(t,"preset")&&(n.preset=r(t,"preset")),r(t,"motion")&&(n.motion=r(t,"motion")),r(t,"speed")&&(n.speed=i(t,"speed",1)),r(t,"sweep-arc")&&(n.sweepArc=i(t,"sweep-arc",100)),r(t,"beam-width")&&(n.beamWidth=i(t,"beam-width",16)),r(t,"intensity")&&(n.intensity=i(t,"intensity",.7)),r(t,"flicker")&&(n.flicker=x(t,"flicker",!0)),r(t,"hz")&&(n.hz=i(t,"hz",10));var a=e("origins");a&&(n.origins=a);var o=e("colours");o&&(n.colours=o),r(t,"duration")&&(n.duration=i(t,"duration",null)),r(t,"z-index")&&(n.zIndex=i(t,"z-index",9999));var d=r(t,"mode");d==="page"?h.strobe(null,n):h.strobe(t,n)}));var T=m.querySelectorAll(".dm-fx-celebrate");T.length&&import("/public/js/celebrations/index.js?v=20261015-occasions").then(function(t){var e=t.CelebrationsEffect;T.forEach(function(n){var a=r(n,"character");if(a){if(n.querySelector("canvas"))return;t.mountCharacter(n,{character:a,size:r(n,"size")||"medium",facing:r(n,"facing")||"right",animate:!p&&x(n,"animate",!0)}).then(function(u){var y=new MutationObserver(function(){n.isConnected||(u.destroy(),y.disconnect())});n.isConnected?y.observe(document.body,{childList:!0,subtree:!0}):u.destroy()}).catch(function(u){console.error("[celebrate]",u)});return}if(!p){var o=n.getAttribute("data-fx-theme")||"auto";o==="auto"&&r(n,"message")&&(o="greeting");var d=n.getAttribute("data-fx-intensity")||"medium",f=n.getAttribute("data-fx-z-index")?parseInt(n.getAttribute("data-fx-z-index"),10):999;if(!(o==="auto"&&(o=e.getCurrentTheme(),!o))){var c={},l=["data-fx-theme","data-fx-intensity","data-fx-z-index"];if(Array.from(n.attributes).forEach(function(u){u.name.startsWith("data-fx-")&&!l.includes(u.name)&&(c[u.name.slice(8)]=u.value)}),o==="make-it-rain"||o==="money-rain"){t[o==="money-rain"?"moneyRain":"makeItRain"]({intensity:d,zIndex:f,overrides:c,duration:i(n,"duration",8e3)}).catch(function(u){console.error("[make-it-rain]",u)});return}var v=new e({theme:o,intensity:d,enabled:!0,zIndex:f,overrides:c});v.init().then(function(){v.start()})}}})}).catch(function(){})}).catch(function(){})})();
|
package/scripts/build.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {decodeMessageAttribute} from '../../public/js/celebrations/message-attrs.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Markdown Service
|
|
3
4
|
* Parses frontmatter with gray-matter and renders Markdown to HTML with marked.
|
|
@@ -43,7 +44,7 @@ export const BUILTIN_SHORTCODES = new Set([
|
|
|
43
44
|
'ticker-tape', 'butterflies', 'strobe', 'animate', 'ambient',
|
|
44
45
|
// named celebrations - sugar for [celebrate theme="…"]
|
|
45
46
|
'christmas', 'halloween', 'st-patricks', 'valentines', 'guy-fawkes',
|
|
46
|
-
'st-andrews', 'st-davids', 'st-georges',
|
|
47
|
+
'st-andrews', 'st-davids', 'st-georges', 'new-year', 'easter', 'summer-garden', 'chinese-new-year', 'winter', 'make-it-rain', 'money-rain', 'graduation', 'birthday', 'anniversary', 'greeting', 'autumn',
|
|
47
48
|
]);
|
|
48
49
|
|
|
49
50
|
// Configure marked for safe output
|
|
@@ -1796,6 +1797,7 @@ function processEffectsBlocks(markdown) {
|
|
|
1796
1797
|
|
|
1797
1798
|
function renderCelebration(attrStr) {
|
|
1798
1799
|
const attrs = parseShortcodeAttrs(attrStr);
|
|
1800
|
+
if (typeof attrs.message === 'string') attrs.message = decodeMessageAttribute(attrs.message);
|
|
1799
1801
|
if (attrs.character) {
|
|
1800
1802
|
if (!Object.hasOwn(CHARACTERS, attrs.character)) {
|
|
1801
1803
|
return `<span class="dm-fx-character-error">Unknown celebration character: ${escapeHtmlText(attrs.character)}</span>`;
|
|
@@ -1817,9 +1819,10 @@ function processEffectsBlocks(markdown) {
|
|
|
1817
1819
|
|
|
1818
1820
|
// Named celebration shortcodes - sugar for [celebrate theme="..."] with override support
|
|
1819
1821
|
['christmas', 'halloween', 'st-patricks', 'valentines', 'guy-fawkes',
|
|
1820
|
-
'st-andrews', 'st-davids', 'st-georges'].forEach(themeName => {
|
|
1822
|
+
'st-andrews', 'st-davids', 'st-georges', 'new-year', 'easter', 'summer-garden', 'chinese-new-year', 'winter', 'make-it-rain', 'money-rain', 'graduation', 'birthday', 'anniversary', 'greeting', 'autumn'].forEach(themeName => {
|
|
1821
1823
|
apply(themeName, (attrStr) => {
|
|
1822
1824
|
const attrs = parseShortcodeAttrs(attrStr);
|
|
1825
|
+
if (typeof attrs.message === 'string') attrs.message = decodeMessageAttribute(attrs.message);
|
|
1823
1826
|
delete attrs.theme;
|
|
1824
1827
|
const dataAttrs = Object.entries(attrs).map(([k, v]) => ` data-fx-${k}="${escapeAttr(String(v))}"`).join('');
|
|
1825
1828
|
return `<div class="dm-fx-celebrate" data-fx-theme="${themeName}"${dataAttrs}></div>`;
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
<script src="/public/js/forms.js?v=20261009-form-classes" type="module"></script>
|
|
192
192
|
|
|
193
193
|
<!-- Core effects runtime -->
|
|
194
|
-
<script src="/public/js/effects.js?v=
|
|
194
|
+
<script src="/public/js/effects.js?v=20261015-occasions"></script>
|
|
195
195
|
|
|
196
196
|
<!-- Plugin body-end injection -->
|
|
197
197
|
{{bodyEndInject}}
|