Bundled output for commit 3a34136e36d60b7d88c5b55e686579b4521a6f2c

Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
This commit is contained in:
flarum-bot 2024-01-09 21:54:15 +00:00
parent 3a34136e36
commit f784f48906
68 changed files with 514 additions and 159 deletions

2
extensions/emoji/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
extensions/lock/js/dist/admin.js generated vendored
View File

@ -1,2 +1,2 @@
(()=>{var e={n:r=>{var o=r&&r.__esModule?()=>r.default:()=>r;return e.d(o,{a:o}),o},d:(r,o)=>{for(var t in o)e.o(o,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:o[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>l});const o=flarum.reg.get("core","admin/app");var t=e.n(o);const n=flarum.reg.get("core","common/extenders");var a=e.n(n);class s{pattern(){return"is:locked"}toFilter(e,r){return{[(r?"-":"")+"locked"]:!0}}filterKey(){return"locked"}fromFilter(e,r){return"".concat(r?"-":"","is:locked")}}flarum.reg.add("flarum-lock","common/query/discussions/LockedGambit",s);const l=[(new(a().Search)).gambit("discussions",s)];t().initializers.add("lock",(()=>{t().extensionData.for("flarum-lock").registerPermission({icon:"fas fa-lock",label:t().translator.trans("flarum-lock.admin.permissions.lock_discussions_label"),permission:"discussion.lock"},"moderate",95)}))})(),module.exports=r})();
(()=>{var e={n:r=>{var o=r&&r.__esModule?()=>r.default:()=>r;return e.d(o,{a:o}),o},d:(r,o)=>{for(var a in o)e.o(o,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:o[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>m});const o=flarum.reg.get("core","admin/app");var a=e.n(o);const t=flarum.reg.get("core","common/extenders");var s=e.n(t);const n=flarum.reg.get("core","common/query/IGambit"),l=flarum.reg.get("core","common/app");var i=e.n(l);class c extends n.BooleanGambit{key(){return i().translator.trans("flarum-lock.lib.gambits.discussions.locked.key",{},!0)}filterKey(){return"locked"}}flarum.reg.add("flarum-lock","common/query/discussions/LockedGambit",c);const m=[(new(s().Search)).gambit("discussions",c)];a().initializers.add("lock",(()=>{a().extensionData.for("flarum-lock").registerPermission({icon:"fas fa-lock",label:a().translator.trans("flarum-lock.admin.permissions.lock_discussions_label"),permission:"discussion.lock"},"moderate",95)}))})(),module.exports=r})();
//# sourceMappingURL=admin.js.map

View File

@ -1 +1 @@
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA7C,MAAMW,EACnBC,UACE,MAAO,WACT,CACAC,SAASC,EAAUC,GAEjB,MAAO,CACL,EAFWA,EAAS,IAAM,IAAM,WAEzB,EAEX,CACAC,YACE,MAAO,QACT,CACAC,WAAWT,EAAOO,GAChB,MAAO,GAAGG,OAAOH,EAAS,IAAM,GAAI,YACtC,EAEFN,OAAOC,IAAIS,IAAI,cAAe,wCAAyCR,GCfvE,UAAgB,IAAI,aACnBS,OAAO,cAAeT,ICDvB,qBAAqB,QAAQ,KAC3B,sBAAsB,eAAeU,mBAAmB,CACtDC,KAAM,cACNC,MAAO,qBAAqB,wDAC5BC,WAAY,mBACX,WAAY,GAAG,G","sources":["webpack://@flarum/lock/webpack/bootstrap","webpack://@flarum/lock/webpack/runtime/compat get default export","webpack://@flarum/lock/webpack/runtime/define property getters","webpack://@flarum/lock/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/lock/webpack/runtime/make namespace object","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/lock/./src/common/query/discussions/LockedGambit.ts","webpack://@flarum/lock/./src/common/extend.ts","webpack://@flarum/lock/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","export default class LockedGambit {\n pattern() {\n return 'is:locked';\n }\n toFilter(_matches, negate) {\n const key = (negate ? '-' : '') + 'locked';\n return {\n [key]: true\n };\n }\n filterKey() {\n return 'locked';\n }\n fromFilter(value, negate) {\n return \"\".concat(negate ? '-' : '', \"is:locked\");\n }\n}\nflarum.reg.add('flarum-lock', 'common/query/discussions/LockedGambit', LockedGambit);","import Extend from 'flarum/common/extenders';\nimport LockedGambit from './query/discussions/LockedGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', LockedGambit)];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('lock', () => {\n app.extensionData.for('flarum-lock').registerPermission({\n icon: 'fas fa-lock',\n label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'),\n permission: 'discussion.lock'\n }, 'moderate', 95);\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","LockedGambit","pattern","toFilter","_matches","negate","filterKey","fromFilter","concat","add","gambit","registerPermission","icon","label","permission"],"sourceRoot":""}
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,wBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,c,aCE7C,MAAMW,UAAqB,EAAAC,cACxCjB,MACE,OAAO,qBAAqB,iDAAkD,CAAC,GAAG,EACpF,CACAkB,YACE,MAAO,QACT,EAEFJ,OAAOC,IAAII,IAAI,cAAe,wCAAyCH,GCRvE,UAAgB,IAAI,aACnBI,OAAO,cAAeJ,ICDvB,qBAAqB,QAAQ,KAC3B,sBAAsB,eAAeK,mBAAmB,CACtDC,KAAM,cACNC,MAAO,qBAAqB,wDAC5BC,WAAY,mBACX,WAAY,GAAG,G","sources":["webpack://@flarum/lock/webpack/bootstrap","webpack://@flarum/lock/webpack/runtime/compat get default export","webpack://@flarum/lock/webpack/runtime/define property getters","webpack://@flarum/lock/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/lock/webpack/runtime/make namespace object","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/lock/./src/common/query/discussions/LockedGambit.ts","webpack://@flarum/lock/./src/common/extend.ts","webpack://@flarum/lock/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { BooleanGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class LockedGambit extends BooleanGambit {\n key() {\n return app.translator.trans('flarum-lock.lib.gambits.discussions.locked.key', {}, true);\n }\n filterKey() {\n return 'locked';\n }\n}\nflarum.reg.add('flarum-lock', 'common/query/discussions/LockedGambit', LockedGambit);","import Extend from 'flarum/common/extenders';\nimport LockedGambit from './query/discussions/LockedGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', LockedGambit)];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('lock', () => {\n app.extensionData.for('flarum-lock').registerPermission({\n icon: 'fas fa-lock',\n label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'),\n permission: 'discussion.lock'\n }, 'moderate', 95);\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","LockedGambit","BooleanGambit","filterKey","add","gambit","registerPermission","icon","label","permission"],"sourceRoot":""}

2
extensions/lock/js/dist/forum.js generated vendored
View File

@ -1,2 +1,2 @@
(()=>{var o={n:t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},d:(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},t={};(()=>{"use strict";o.r(t),o.d(t,{extend:()=>S});const e=flarum.reg.get("core","common/extend"),n=flarum.reg.get("core","forum/app");var r=o.n(n);const s=flarum.reg.get("core","forum/components/Notification");var c=o.n(s);class a extends(c()){icon(){return"fas fa-lock"}href(){const o=this.attrs.notification;return r().route.discussion(o.subject(),o.content().postNumber)}content(){return r().translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})}excerpt(){return null}}flarum.reg.add("flarum-lock","forum/components/DiscussionLockedNotification",a);const i=flarum.reg.get("core","common/models/Discussion");var l=o.n(i);const u=flarum.reg.get("core","common/components/Badge");var d=o.n(u);const f=flarum.reg.get("core","forum/utils/DiscussionControls");var k=o.n(f);const g=flarum.reg.get("core","forum/components/DiscussionPage");var p=o.n(g);const b=flarum.reg.get("core","common/components/Button");var _=o.n(b);const y=flarum.reg.get("core","common/extenders");var v=o.n(y);const L=flarum.reg.get("core","forum/components/EventPost");var h=o.n(L);class x extends(h()){icon(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"}descriptionKey(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"}}flarum.reg.add("flarum-lock","forum/components/DiscussionLockedPost",x);class P{pattern(){return"is:locked"}toFilter(o,t){return{[(t?"-":"")+"locked"]:!0}}filterKey(){return"locked"}fromFilter(o,t){return"".concat(t?"-":"","is:locked")}}flarum.reg.add("flarum-lock","common/query/discussions/LockedGambit",P);const S=[(new(v().Search)).gambit("discussions",P),(new(v().PostTypes)).add("discussionLocked",x),new(v().Model)(l()).attribute("isLocked").attribute("canLock")];r().initializers.add("flarum-lock",(()=>{r().notificationComponents.discussionLocked=a,(0,e.extend)(l().prototype,"badges",(function(o){this.isLocked()&&o.add("locked",m(d(),{type:"locked",label:r().translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),(0,e.extend)(k(),"moderationControls",(function(o,t){t.canLock()&&o.add("lock",m(_(),{icon:"fas fa-lock",onclick:this.lockAction.bind(t)},r().translator.trans("flarum-lock.forum.discussion_controls.".concat(t.isLocked()?"unlock":"lock","_button"))))})),k().lockAction=function(){this.save({isLocked:!this.isLocked()}).then((()=>{r().current.matches(p())&&r().current.get("stream").update(),m.redraw()}))},(0,e.extend)("flarum/forum/components/NotificationGrid","notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:r().translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))})(),module.exports=t})();
(()=>{var o={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},d:(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(o,e)=>Object.prototype.hasOwnProperty.call(o,e),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},e={};(()=>{"use strict";o.r(e),o.d(e,{extend:()=>D});const t=flarum.reg.get("core","common/extend"),n=flarum.reg.get("core","forum/app");var r=o.n(n);const s=flarum.reg.get("core","forum/components/Notification");var c=o.n(s);class a extends(c()){icon(){return"fas fa-lock"}href(){const o=this.attrs.notification;return r().route.discussion(o.subject(),o.content().postNumber)}content(){return r().translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})}excerpt(){return null}}flarum.reg.add("flarum-lock","forum/components/DiscussionLockedNotification",a);const i=flarum.reg.get("core","common/models/Discussion");var l=o.n(i);const u=flarum.reg.get("core","common/components/Badge");var d=o.n(u);const f=flarum.reg.get("core","forum/utils/DiscussionControls");var k=o.n(f);const g=flarum.reg.get("core","forum/components/DiscussionPage");var p=o.n(g);const b=flarum.reg.get("core","common/components/Button");var y=o.n(b);const _=flarum.reg.get("core","common/extenders");var v=o.n(_);const x=flarum.reg.get("core","forum/components/EventPost");var L=o.n(x);class h extends(L()){icon(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"}descriptionKey(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"}}flarum.reg.add("flarum-lock","forum/components/DiscussionLockedPost",h);const P=flarum.reg.get("core","common/query/IGambit"),S=flarum.reg.get("core","common/app");var j=o.n(S);class w extends P.BooleanGambit{key(){return j().translator.trans("flarum-lock.lib.gambits.discussions.locked.key",{},!0)}filterKey(){return"locked"}}flarum.reg.add("flarum-lock","common/query/discussions/LockedGambit",w);const D=[(new(v().Search)).gambit("discussions",w),(new(v().PostTypes)).add("discussionLocked",h),new(v().Model)(l()).attribute("isLocked").attribute("canLock")];r().initializers.add("flarum-lock",(()=>{r().notificationComponents.discussionLocked=a,(0,t.extend)(l().prototype,"badges",(function(o){this.isLocked()&&o.add("locked",m(d(),{type:"locked",label:r().translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),(0,t.extend)(k(),"moderationControls",(function(o,e){e.canLock()&&o.add("lock",m(y(),{icon:"fas fa-lock",onclick:this.lockAction.bind(e)},r().translator.trans("flarum-lock.forum.discussion_controls.".concat(e.isLocked()?"unlock":"lock","_button"))))})),k().lockAction=function(){this.save({isLocked:!this.isLocked()}).then((()=>{r().current.matches(p())&&r().current.get("stream").update(),m.redraw()}))},(0,t.extend)("flarum/forum/components/NotificationGrid","notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:r().translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))})(),module.exports=e})();
//# sourceMappingURL=forum.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
extensions/sticky/js/dist/admin.js generated vendored
View File

@ -1,2 +1,2 @@
(()=>{var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var s in t)e.o(t,s)&&!e.o(r,s)&&Object.defineProperty(r,s,{enumerable:!0,get:t[s]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>n});const t=flarum.reg.get("core","admin/app");var s=e.n(t);const i=flarum.reg.get("core","common/extenders");var o=e.n(i);class a{pattern(){return"is:sticky"}toFilter(e,r){return{[(r?"-":"")+"sticky"]:!0}}filterKey(){return"sticky"}fromFilter(e,r){return"".concat(r?"-":"","is:sticky")}}flarum.reg.add("flarum-sticky","common/query/discussions/StickyGambit",a);const n=[(new(o().Search)).gambit("discussions",a)];s().initializers.add("flarum-sticky",(()=>{s().extensionData.for("flarum-sticky").registerPermission({icon:"fas fa-thumbtack",label:s().translator.trans("flarum-sticky.admin.permissions.sticky_discussions_label"),permission:"discussion.sticky"},"moderate",95)}))})(),module.exports=r})();
(()=>{var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var s in t)e.o(t,s)&&!e.o(r,s)&&Object.defineProperty(r,s,{enumerable:!0,get:t[s]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>l});const t=flarum.reg.get("core","admin/app");var s=e.n(t);const a=flarum.reg.get("core","common/extenders");var o=e.n(a);const i=flarum.reg.get("core","common/query/IGambit"),n=flarum.reg.get("core","common/app");var c=e.n(n);class m extends i.BooleanGambit{key(){return c().translator.trans("flarum-sticky.lib.gambits.discussions.sticky.key",{},!0)}filterKey(){return"sticky"}}flarum.reg.add("flarum-sticky","common/query/discussions/StickyGambit",m);const l=[(new(o().Search)).gambit("discussions",m)];s().initializers.add("flarum-sticky",(()=>{s().extensionData.for("flarum-sticky").registerPermission({icon:"fas fa-thumbtack",label:s().translator.trans("flarum-sticky.admin.permissions.sticky_discussions_label"),permission:"discussion.sticky"},"moderate",95)}))})(),module.exports=r})();
//# sourceMappingURL=admin.js.map

View File

@ -1 +1 @@
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA7C,MAAMW,EACnBC,UACE,MAAO,WACT,CACAC,SAASC,EAAUC,GAEjB,MAAO,CACL,EAFWA,EAAS,IAAM,IAAM,WAEzB,EAEX,CACAC,YACE,MAAO,QACT,CACAC,WAAWT,EAAOO,GAChB,MAAO,GAAGG,OAAOH,EAAS,IAAM,GAAI,YACtC,EAEFN,OAAOC,IAAIS,IAAI,gBAAiB,wCAAyCR,GCfzE,UAAgB,IAAI,aACnBS,OAAO,cAAeT,ICDvB,qBAAqB,iBAAiB,KACpC,sBAAsB,iBAAiBU,mBAAmB,CACxDC,KAAM,mBACNC,MAAO,qBAAqB,4DAC5BC,WAAY,qBACX,WAAY,GAAG,G","sources":["webpack://@flarum/sticky/webpack/bootstrap","webpack://@flarum/sticky/webpack/runtime/compat get default export","webpack://@flarum/sticky/webpack/runtime/define property getters","webpack://@flarum/sticky/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/sticky/webpack/runtime/make namespace object","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/sticky/./src/common/query/discussions/StickyGambit.ts","webpack://@flarum/sticky/./src/common/extend.ts","webpack://@flarum/sticky/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","export default class StickyGambit {\n pattern() {\n return 'is:sticky';\n }\n toFilter(_matches, negate) {\n const key = (negate ? '-' : '') + 'sticky';\n return {\n [key]: true\n };\n }\n filterKey() {\n return 'sticky';\n }\n fromFilter(value, negate) {\n return \"\".concat(negate ? '-' : '', \"is:sticky\");\n }\n}\nflarum.reg.add('flarum-sticky', 'common/query/discussions/StickyGambit', StickyGambit);","import Extend from 'flarum/common/extenders';\nimport StickyGambit from './query/discussions/StickyGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', StickyGambit)];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-sticky', () => {\n app.extensionData.for('flarum-sticky').registerPermission({\n icon: 'fas fa-thumbtack',\n label: app.translator.trans('flarum-sticky.admin.permissions.sticky_discussions_label'),\n permission: 'discussion.sticky'\n }, 'moderate', 95);\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","StickyGambit","pattern","toFilter","_matches","negate","filterKey","fromFilter","concat","add","gambit","registerPermission","icon","label","permission"],"sourceRoot":""}
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,wBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,c,aCE7C,MAAMW,UAAqB,EAAAC,cACxCjB,MACE,OAAO,qBAAqB,mDAAoD,CAAC,GAAG,EACtF,CACAkB,YACE,MAAO,QACT,EAEFJ,OAAOC,IAAII,IAAI,gBAAiB,wCAAyCH,GCRzE,UAAgB,IAAI,aACnBI,OAAO,cAAeJ,ICDvB,qBAAqB,iBAAiB,KACpC,sBAAsB,iBAAiBK,mBAAmB,CACxDC,KAAM,mBACNC,MAAO,qBAAqB,4DAC5BC,WAAY,qBACX,WAAY,GAAG,G","sources":["webpack://@flarum/sticky/webpack/bootstrap","webpack://@flarum/sticky/webpack/runtime/compat get default export","webpack://@flarum/sticky/webpack/runtime/define property getters","webpack://@flarum/sticky/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/sticky/webpack/runtime/make namespace object","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/sticky/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/sticky/./src/common/query/discussions/StickyGambit.ts","webpack://@flarum/sticky/./src/common/extend.ts","webpack://@flarum/sticky/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { BooleanGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class StickyGambit extends BooleanGambit {\n key() {\n return app.translator.trans('flarum-sticky.lib.gambits.discussions.sticky.key', {}, true);\n }\n filterKey() {\n return 'sticky';\n }\n}\nflarum.reg.add('flarum-sticky', 'common/query/discussions/StickyGambit', StickyGambit);","import Extend from 'flarum/common/extenders';\nimport StickyGambit from './query/discussions/StickyGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', StickyGambit)];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-sticky', () => {\n app.extensionData.for('flarum-sticky').registerPermission({\n icon: 'fas fa-thumbtack',\n label: app.translator.trans('flarum-sticky.admin.permissions.sticky_discussions_label'),\n permission: 'discussion.sticky'\n }, 'moderate', 95);\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","StickyGambit","BooleanGambit","filterKey","add","gambit","registerPermission","icon","label","permission"],"sourceRoot":""}

2
extensions/sticky/js/dist/forum.js generated vendored
View File

@ -1,2 +1,2 @@
(()=>{var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var r in s)t.o(s,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:s[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{extend:()=>M});const s=flarum.reg.get("core","forum/app");var r=t.n(s);const o=flarum.reg.get("core","common/extend"),n=flarum.reg.get("core","common/models/Discussion");var c=t.n(n);const i=flarum.reg.get("core","common/components/Badge");var a=t.n(i);const u=flarum.reg.get("core","forum/utils/DiscussionControls");var l=t.n(u);const d=flarum.reg.get("core","forum/components/DiscussionPage");var f=t.n(d);const y=flarum.reg.get("core","common/components/Button");var g=t.n(y);const k=flarum.reg.get("core","forum/states/DiscussionListState");var p=t.n(k);const b=flarum.reg.get("core","forum/components/DiscussionListItem");var v=t.n(b);const S=flarum.reg.get("core","forum/components/IndexPage");var h=t.n(S);const x=flarum.reg.get("core","common/utils/string"),P=flarum.reg.get("core","common/utils/classList");var _=t.n(P);const D=flarum.reg.get("core","common/extenders");var w=t.n(D);const O=flarum.reg.get("core","forum/components/EventPost");var j=t.n(O);class I extends(j()){icon(){return"fas fa-thumbtack"}descriptionKey(){return this.attrs.post.content().sticky?"flarum-sticky.forum.post_stream.discussion_stickied_text":"flarum-sticky.forum.post_stream.discussion_unstickied_text"}}flarum.reg.add("flarum-sticky","forum/components/DiscussionStickiedPost",I);class L{pattern(){return"is:sticky"}toFilter(t,e){return{[(e?"-":"")+"sticky"]:!0}}filterKey(){return"sticky"}fromFilter(t,e){return"".concat(e?"-":"","is:sticky")}}flarum.reg.add("flarum-sticky","common/query/discussions/StickyGambit",L);const M=[(new(w().Search)).gambit("discussions",L),(new(w().PostTypes)).add("discussionStickied",I),new(w().Model)(c()).attribute("isSticky").attribute("canSticky")];r().initializers.add("flarum-sticky",(()=>{(0,o.extend)(c().prototype,"badges",(function(t){this.isSticky()&&t.add("sticky",m(a(),{type:"sticky",label:r().translator.trans("flarum-sticky.forum.badge.sticky_tooltip"),icon:"fas fa-thumbtack"}),10)})),(0,o.extend)(l(),"moderationControls",(function(t,e){e.canSticky()&&t.add("sticky",m(g(),{icon:"fas fa-thumbtack",onclick:this.stickyAction.bind(e)},r().translator.trans("flarum-sticky.forum.discussion_controls.".concat(e.isSticky()?"unsticky":"sticky","_button"))))})),l().stickyAction=function(){this.save({isSticky:!this.isSticky()}).then((()=>{r().current.matches(f())&&r().current.get("stream").update(),m.redraw()}))},(0,o.extend)(p().prototype,"requestParams",(function(t){(r().current.matches(h())||r().current.matches(f()))&&t.include.push("firstPost")})),(0,o.extend)(v().prototype,"infoItems",(function(t){const e=this.attrs.discussion;if(e.isSticky()&&!this.attrs.params.q&&!e.lastReadPostNumber()){const s=e.firstPost();if(s){const e=(0,x.truncate)(s.contentPlain(),175);t.add("excerpt",m("div",null,e),-100)}}})),(0,o.extend)(v().prototype,"elementAttrs",(function(t){this.attrs.discussion.isSticky()&&(t.className=_()(t.className,"DiscussionListItem--sticky"))}))}))})(),module.exports=e})();
(()=>{var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var o in s)t.o(s,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:s[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{extend:()=>B});const s=flarum.reg.get("core","forum/app");var o=t.n(s);const r=flarum.reg.get("core","common/extend"),n=flarum.reg.get("core","common/models/Discussion");var c=t.n(n);const i=flarum.reg.get("core","common/components/Badge");var a=t.n(i);const u=flarum.reg.get("core","forum/utils/DiscussionControls");var l=t.n(u);const d=flarum.reg.get("core","forum/components/DiscussionPage");var f=t.n(d);const y=flarum.reg.get("core","common/components/Button");var g=t.n(y);const k=flarum.reg.get("core","forum/states/DiscussionListState");var p=t.n(k);const b=flarum.reg.get("core","forum/components/DiscussionListItem");var v=t.n(b);const S=flarum.reg.get("core","forum/components/IndexPage");var h=t.n(S);const x=flarum.reg.get("core","common/utils/string"),P=flarum.reg.get("core","common/utils/classList");var _=t.n(P);const D=flarum.reg.get("core","common/extenders");var w=t.n(D);const I=flarum.reg.get("core","forum/components/EventPost");var O=t.n(I);class j extends(O()){icon(){return"fas fa-thumbtack"}descriptionKey(){return this.attrs.post.content().sticky?"flarum-sticky.forum.post_stream.discussion_stickied_text":"flarum-sticky.forum.post_stream.discussion_unstickied_text"}}flarum.reg.add("flarum-sticky","forum/components/DiscussionStickiedPost",j);const q=flarum.reg.get("core","common/query/IGambit"),L=flarum.reg.get("core","common/app");var M=t.n(L);class A extends q.BooleanGambit{key(){return M().translator.trans("flarum-sticky.lib.gambits.discussions.sticky.key",{},!0)}filterKey(){return"sticky"}}flarum.reg.add("flarum-sticky","common/query/discussions/StickyGambit",A);const B=[(new(w().Search)).gambit("discussions",A),(new(w().PostTypes)).add("discussionStickied",j),new(w().Model)(c()).attribute("isSticky").attribute("canSticky")];o().initializers.add("flarum-sticky",(()=>{(0,r.extend)(c().prototype,"badges",(function(t){this.isSticky()&&t.add("sticky",m(a(),{type:"sticky",label:o().translator.trans("flarum-sticky.forum.badge.sticky_tooltip"),icon:"fas fa-thumbtack"}),10)})),(0,r.extend)(l(),"moderationControls",(function(t,e){e.canSticky()&&t.add("sticky",m(g(),{icon:"fas fa-thumbtack",onclick:this.stickyAction.bind(e)},o().translator.trans("flarum-sticky.forum.discussion_controls.".concat(e.isSticky()?"unsticky":"sticky","_button"))))})),l().stickyAction=function(){this.save({isSticky:!this.isSticky()}).then((()=>{o().current.matches(f())&&o().current.get("stream").update(),m.redraw()}))},(0,r.extend)(p().prototype,"requestParams",(function(t){(o().current.matches(h())||o().current.matches(f()))&&t.include.push("firstPost")})),(0,r.extend)(v().prototype,"infoItems",(function(t){const e=this.attrs.discussion;if(e.isSticky()&&!this.attrs.params.q&&!e.lastReadPostNumber()){const s=e.firstPost();if(s){const e=(0,x.truncate)(s.contentPlain(),175);t.add("excerpt",m("div",null,e),-100)}}})),(0,r.extend)(v().prototype,"elementAttrs",(function(t){this.attrs.discussion.isSticky()&&(t.className=_()(t.className,"DiscussionListItem--sticky"))}))}))})(),module.exports=e})();
//# sourceMappingURL=forum.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
(()=>{var e={n:r=>{var o=r&&r.__esModule?()=>r.default:()=>r;return e.d(o,{a:o}),o},d:(r,o)=>{for(var t in o)e.o(o,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:o[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>i});const o=flarum.reg.get("core","common/extenders");var t=e.n(o);class n{pattern(){return"is:(follow|ignor)(?:ing|ed)"}toFilter(e,r){return{subscription:"follow"===e[1]?"following":"ignoring"}}filterKey(){return"subscription"}fromFilter(e,r){return"".concat(r?"-":"","is:").concat(e)}}flarum.reg.add("flarum-subscriptions","common/query/discussions/SubscriptionGambit",n);const i=[(new(t().Search)).gambit("discussions",n)]})(),module.exports=r})();
(()=>{var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>u});const t=flarum.reg.get("core","common/extenders");var o=e.n(t);const s=flarum.reg.get("core","common/app");var n=e.n(s);const i=flarum.reg.get("core","common/query/IGambit");class a extends i.BooleanGambit{key(){return[n().translator.trans("flarum-subscriptions.lib.gambits.discussions.subscription.following_key",{},!0),n().translator.trans("flarum-subscriptions.lib.gambits.discussions.subscription.ignoring_key",{},!0)]}toFilter(e,r){return{[(r?"-":"")+this.filterKey()]:e[1]}}filterKey(){return"subscription"}fromFilter(e,r){return"".concat(r?"-":"","is:").concat(e)}enabled(){return!!n().session.user}}flarum.reg.add("flarum-subscriptions","common/query/discussions/SubscriptionGambit",a);const u=[(new(o().Search)).gambit("discussions",a)]})(),module.exports=r})();
//# sourceMappingURL=admin.js.map

View File

@ -1 +1 @@
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA7C,MAAMW,EACnBC,UACE,MAAO,6BACT,CACAC,SAASC,EAASC,GAEhB,MAAO,CACLC,aAF0B,WAAfF,EAAQ,GAAkB,YAAc,WAIvD,CACAG,YACE,MAAO,cACT,CACAC,WAAWV,EAAOO,GAChB,MAAO,GAAGI,OAAOJ,EAAS,IAAM,GAAI,OAAOI,OAAOX,EACpD,EAEFC,OAAOC,IAAIU,IAAI,uBAAwB,8CAA+CT,GCftF,UAAgB,IAAI,aACnBU,OAAO,cAAeV,G","sources":["webpack://@flarum/subscriptions/webpack/bootstrap","webpack://@flarum/subscriptions/webpack/runtime/compat get default export","webpack://@flarum/subscriptions/webpack/runtime/define property getters","webpack://@flarum/subscriptions/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/subscriptions/webpack/runtime/make namespace object","webpack://@flarum/subscriptions/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/subscriptions/./src/common/query/discussions/SubscriptionGambit.ts","webpack://@flarum/subscriptions/./src/common/extend.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","export default class SubscriptionGambit {\n pattern() {\n return 'is:(follow|ignor)(?:ing|ed)';\n }\n toFilter(matches, negate) {\n const type = matches[1] === 'follow' ? 'following' : 'ignoring';\n return {\n subscription: type\n };\n }\n filterKey() {\n return 'subscription';\n }\n fromFilter(value, negate) {\n return \"\".concat(negate ? '-' : '', \"is:\").concat(value);\n }\n}\nflarum.reg.add('flarum-subscriptions', 'common/query/discussions/SubscriptionGambit', SubscriptionGambit);","import Extend from 'flarum/common/extenders';\nimport SubscriptionGambit from './query/discussions/SubscriptionGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', SubscriptionGambit)];"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","SubscriptionGambit","pattern","toFilter","matches","negate","subscription","filterKey","fromFilter","concat","add","gambit"],"sourceRoot":""}
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,c,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,wBCE7C,MAAMW,UAA2B,EAAAC,cAC9CjB,MACE,MAAO,CAAC,qBAAqB,0EAA2E,CAAC,GAAG,GAAO,qBAAqB,yEAA0E,CAAC,GAAG,GACxN,CACAkB,SAASC,EAASC,GAEhB,MAAO,CACL,EAFWA,EAAS,IAAM,IAAMC,KAAKC,aAE9BH,EAAQ,GAEnB,CACAG,YACE,MAAO,cACT,CACAC,WAAWV,EAAOO,GAChB,MAAO,GAAGI,OAAOJ,EAAS,IAAM,GAAI,OAAOI,OAAOX,EACpD,CACAY,UACE,QAAS,gBACX,EAEFX,OAAOC,IAAIW,IAAI,uBAAwB,8CAA+CV,GCpBtF,UAAgB,IAAI,aACnBW,OAAO,cAAeX,G","sources":["webpack://@flarum/subscriptions/webpack/bootstrap","webpack://@flarum/subscriptions/webpack/runtime/compat get default export","webpack://@flarum/subscriptions/webpack/runtime/define property getters","webpack://@flarum/subscriptions/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/subscriptions/webpack/runtime/make namespace object","webpack://@flarum/subscriptions/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/subscriptions/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/subscriptions/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/subscriptions/./src/common/query/discussions/SubscriptionGambit.ts","webpack://@flarum/subscriptions/./src/common/extend.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","import app from 'flarum/common/app';\nimport { BooleanGambit } from 'flarum/common/query/IGambit';\nexport default class SubscriptionGambit extends BooleanGambit {\n key() {\n return [app.translator.trans('flarum-subscriptions.lib.gambits.discussions.subscription.following_key', {}, true), app.translator.trans('flarum-subscriptions.lib.gambits.discussions.subscription.ignoring_key', {}, true)];\n }\n toFilter(matches, negate) {\n const key = (negate ? '-' : '') + this.filterKey();\n return {\n [key]: matches[1]\n };\n }\n filterKey() {\n return 'subscription';\n }\n fromFilter(value, negate) {\n return \"\".concat(negate ? '-' : '', \"is:\").concat(value);\n }\n enabled() {\n return !!app.session.user;\n }\n}\nflarum.reg.add('flarum-subscriptions', 'common/query/discussions/SubscriptionGambit', SubscriptionGambit);","import Extend from 'flarum/common/extenders';\nimport SubscriptionGambit from './query/discussions/SubscriptionGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', SubscriptionGambit)];"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","SubscriptionGambit","BooleanGambit","toFilter","matches","negate","this","filterKey","fromFilter","concat","enabled","add","gambit"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
(()=>{var e={n:r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return e.d(s,{a:s}),s},d:(r,s)=>{for(var n in s)e.o(s,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:s[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>d});const s=flarum.reg.get("core","admin/app");var n=e.n(s);const t=flarum.reg.get("core","common/extenders");var a=e.n(t);class o{pattern(){return"is:suspended"}toFilter(e,r){return{[(r?"-":"")+"suspended"]:!0}}filterKey(){return"suspended"}fromFilter(e,r){return"".concat(r?"-":"","is:suspended")}}flarum.reg.add("flarum-suspend","common/query/users/SuspendedGambit",o);const d=[(new(a().Search)).gambit("users",o)];n().initializers.add("flarum-suspend",(()=>{n().extensionData.for("flarum-suspend").registerPermission({icon:"fas fa-ban",label:n().translator.trans("flarum-suspend.admin.permissions.suspend_users_label"),permission:"user.suspend"},"moderate")}))})(),module.exports=r})();
(()=>{var e={n:r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return e.d(s,{a:s}),s},d:(r,s)=>{for(var n in s)e.o(s,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:s[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>c});const s=flarum.reg.get("core","admin/app");var n=e.n(s);const a=flarum.reg.get("core","common/extenders");var t=e.n(a);const o=flarum.reg.get("core","common/app");var u=e.n(o);const d=flarum.reg.get("core","common/query/IGambit");class m extends d.BooleanGambit{key(){return u().translator.trans("flarum-suspend.lib.gambits.users.suspended.key",{},!0)}filterKey(){return"suspended"}enabled(){return!!u().session.user&&u().forum.attribute("canSuspendUsers")}}flarum.reg.add("flarum-suspend","common/query/users/SuspendedGambit",m);const l=flarum.reg.get("core","common/models/User");var i=e.n(l);const c=[(new(t().Search)).gambit("users",m),new(t().Model)(i()).attribute("canSuspend")];n().initializers.add("flarum-suspend",(()=>{n().extensionData.for("flarum-suspend").registerPermission({icon:"fas fa-ban",label:n().translator.trans("flarum-suspend.admin.permissions.suspend_users_label"),permission:"user.suspend"},"moderate")}))})(),module.exports=r})();
//# sourceMappingURL=admin.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,10 @@
import IGambit from 'flarum/common/query/IGambit';
export default class TagGambit implements IGambit {
pattern(): string;
toFilter(matches: string[], negate: boolean): Record<string, any>;
import { KeyValueGambit } from 'flarum/common/query/IGambit';
export default class TagGambit extends KeyValueGambit {
predicates: boolean;
key(): string;
hint(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
gambitValueToFilterValue(value: string): string[];
fromFilter(value: any, negate: boolean): string;
filterValueToGambitValue(value: string): string;
}

2
extensions/tags/js/dist/admin.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
extensions/tags/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ declare module '@askvortsov/rich-icu-message-formatter' {
type IRichHandler = (tag: any, values: IValues, contents: string) => any;
type ValueOrArray<T> = T | ValueOrArray<T>[];
type NestedStringArray = ValueOrArray<string>;
export type NestedStringArray = ValueOrArray<string>;
export class RichMessageFormatter {
locale: string | null;

View File

@ -2,6 +2,8 @@ import { AdminRoutes } from './routes';
import Application, { ApplicationData } from '../common/Application';
import ExtensionData from './utils/ExtensionData';
import IHistory from '../common/IHistory';
import SearchManager from '../common/SearchManager';
import SearchState from '../common/states/SearchState';
export declare type Extension = {
id: string;
name: string;
@ -48,6 +50,7 @@ export default class AdminApplication extends Application {
language: number;
};
history: IHistory;
search: SearchManager<SearchState>;
/**
* Settings are serialized to the admin dashboard as strings.
* Additional encoding/decoding is possible, but must take

View File

@ -15,6 +15,7 @@ import type { ComponentAttrs } from './Component';
import Model, { SavedModelData } from './Model';
import IHistory from './IHistory';
import IExtender from './extenders/IExtender';
import SearchManager from './SearchManager';
export declare type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd';
export declare type FlarumGenericRoute = RouteItem<any, any, any>;
export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.RequestOptions<ResponseType>, 'extract'> {
@ -140,6 +141,7 @@ export default class Application {
* The app's data store.
*/
store: Store;
search: SearchManager;
/**
* A local cache that can be used to store data at the application level, so
* that is persists between different routes.

View File

@ -1,4 +1,4 @@
import IGambit from './query/IGambit';
import type IGambit from './query/IGambit';
/**
* The gambit registry. A map of resource types to gambit classes that
* should be used to filter resources of that type. Gambits are automatically
@ -8,5 +8,7 @@ import IGambit from './query/IGambit';
export default class GambitManager {
gambits: Record<string, Array<new () => IGambit>>;
apply(type: string, filter: Record<string, any>): Record<string, any>;
match(type: string, query: string, onmatch: (gambit: IGambit, matches: string[], negate: boolean, bit: string) => void): string;
from(type: string, q: string, filter: Record<string, any>): string;
for(type: string): Array<IGambit>;
}

View File

@ -0,0 +1,19 @@
import SearchState from './states/SearchState';
import GambitManager from './GambitManager';
export default class SearchManager<State extends SearchState = SearchState> {
/**
* The minimum query length before sources are searched.
*/
static MIN_SEARCH_LEN: number;
/**
* An object which stores previously searched queries and provides convenient
* tools for retrieving and managing search values.
*/
state: State;
/**
* The gambit manager that will convert search query gambits
* into API filters.
*/
gambits: GambitManager;
constructor(state: State);
}

View File

@ -1,6 +1,5 @@
import { FlarumRequestOptions } from './Application';
import Model, { ModelData, SavedModelData } from './Model';
import GambitManager from './GambitManager';
export interface MetaInformation {
[key: string]: any;
}
@ -77,11 +76,6 @@ export default class Store {
models: Record<string, {
new (): Model;
}>;
/**
* The gambit manager that will convert search query gambits
* into API filters.
*/
gambits: GambitManager;
constructor(models: Record<string, {
new (): Model;
}>);

View File

@ -1,5 +1,4 @@
/// <reference path="../@types/translator-icu-rich.d.ts" />
import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter';
import { RichMessageFormatter, NestedStringArray } from '@askvortsov/rich-icu-message-formatter';
import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter';
declare type Translations = Record<string, string>;
declare type TranslatorParameters = Record<string, unknown>;
@ -36,6 +35,9 @@ export default class Translator {
* @internal
*/
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
trans(id: string, parameters?: TranslatorParameters): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
trans(id: string, parameters: TranslatorParameters): NestedStringArray;
trans(id: string, parameters: TranslatorParameters, extract: false): NestedStringArray;
trans(id: string, parameters: TranslatorParameters, extract: true): string;
trans(id: string): NestedStringArray | string;
}
export {};

View File

@ -4,6 +4,9 @@ import './states/PaginatedListState';
import './states/AlertManagerState';
import './states/ModalManagerState';
import './states/PageState';
import './states/SearchState';
import './utils/AutocompleteReader';
import './utils/GambitsAutocomplete';
import './utils/isObject';
import './utils/mixin';
import './utils/insertText';
@ -46,6 +49,7 @@ import './components/LoadingIndicator';
import './components/Placeholder';
import './components/Separator';
import './components/Dropdown';
import './components/InfoTile';
import './components/DetailedDropdownItem';
import './components/SplitDropdown';
import './components/RequestErrorModal';
@ -66,6 +70,8 @@ import './components/GroupBadge';
import './components/TextEditor';
import './components/TextEditorButton';
import './components/Tooltip';
import './components/AutocompleteDropdown';
import './components/GambitsAutocompleteDropdown';
import './helpers/fullTime';
import './components/Avatar';
import './helpers/humanTime';
@ -75,6 +81,7 @@ import './helpers/username';
import './helpers/userOnline';
import './helpers/listItems';
import './helpers/textContrastClass';
import './query/IGambit';
import './resolvers/DefaultResolver';
import './Component';
import './Translator';

View File

@ -0,0 +1,50 @@
import Component, { type ComponentAttrs } from '../Component';
import KeyboardNavigatable from '../utils/KeyboardNavigatable';
import type Mithril from 'mithril';
export interface AutocompleteDropdownAttrs extends ComponentAttrs {
query: string;
onchange: (value: string) => void;
}
/**
* A reusable component that wraps around an input element and displays a list
* of suggestions based on the input's value.
* Must be extended and the `suggestions` method implemented.
*/
export default abstract class AutocompleteDropdown<CustomAttrs extends AutocompleteDropdownAttrs = AutocompleteDropdownAttrs> extends Component<CustomAttrs> {
/**
* The index of the currently-selected <li> in the results list. This can be
* a unique string (to account for the fact that an item's position may jump
* around as new results load), but otherwise it will be numeric (the
* sequential position within the list).
*/
protected index: number;
protected navigator: KeyboardNavigatable;
private updateMaxHeightHandler?;
/**
* Whether the input has focus.
*/
protected hasFocus: boolean;
abstract suggestions(): JSX.Element[];
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
updateMaxHeight(): void;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
selectableItems(): JQuery;
inputElement(): JQuery<HTMLInputElement>;
selectSuggestion(): void;
/**
* Get the position of the currently selected item.
* Returns zero if not found.
*/
getCurrentNumericIndex(): number;
/**
* Get the <li> in the search results with the given index (numeric or named).
*/
getItem(index: number): JQuery;
/**
* Set the currently-selected search result item to the one with the given
* index.
*/
setIndex(index: number, scrollToItem?: boolean): void;
}

View File

@ -0,0 +1,17 @@
import type Mithril from 'mithril';
import AutocompleteDropdown, { type AutocompleteDropdownAttrs } from './AutocompleteDropdown';
import GambitsAutocomplete from '../utils/GambitsAutocomplete';
export interface GambitsAutocompleteDropdownAttrs extends AutocompleteDropdownAttrs {
resource: string;
}
/**
* This is an autocomplete component not related to the SearchModal forum components.
* It is a standalone component that can be reused for search inputs of any other types
* of resources. It will display a dropdown menu under the input with gambit suggestions
* similar to the SearchModal component.
*/
export default class GambitsAutocompleteDropdown<CustomAttrs extends GambitsAutocompleteDropdownAttrs = GambitsAutocompleteDropdownAttrs> extends AutocompleteDropdown<CustomAttrs> {
protected gambitsAutocomplete: GambitsAutocomplete;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
suggestions(): JSX.Element[];
}

View File

@ -0,0 +1,11 @@
import Component from '../Component';
import type { ComponentAttrs } from '../Component';
import type Mithril from 'mithril';
export interface IInfoTileAttrs extends ComponentAttrs {
icon?: string;
iconElement?: Mithril.Children;
}
export default class InfoTile<CustomAttrs extends IInfoTileAttrs = IInfoTileAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
icon(): Mithril.Children;
}

View File

@ -0,0 +1,32 @@
import Component from '../Component';
import Stream from '../utils/Stream';
import type { ComponentAttrs } from '../Component';
import type Mithril from 'mithril';
export interface IInputAttrs extends ComponentAttrs {
className?: string;
prefixIcon?: string;
clearable?: boolean;
clearLabel?: string;
loading?: boolean;
inputClassName?: string;
onchange?: (value: string) => void;
value?: string;
stream?: Stream<string>;
type?: string;
ariaLabel?: string;
placeholder?: string;
readonly?: boolean;
disabled?: boolean;
renderInput?: (attrs: any) => Mithril.Children;
inputAttrs?: {
className?: string;
[key: string]: any;
};
}
export default class Input<CustomAttrs extends IInputAttrs = IInputAttrs> extends Component<CustomAttrs> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
input({ inputClassName, value, inputAttrs }: any): Mithril.Children | JSX.Element;
onchange(value: string): void;
clear(): void;
}

View File

@ -1,6 +1,96 @@
export default interface IGambit {
export default interface IGambit<Type extends GambitType = GambitType> {
type: GambitType;
/**
* This is the regular expression pattern that will be used to match the gambit.
* The pattern language can be localized. for example, the pattern for the
* author gambit is `author:(.+)` in English, but `auteur:(.+)` in
* French.
*/
pattern(): string;
/**
* This is the method to transform a gambit into a filter format.
*/
toFilter(matches: string[], negate: boolean): Record<string, any>;
/**
* This is the server standardised filter key for this gambit.
* The filter key must not be localized.
*/
filterKey(): string;
/**
* This is the method to transform a filter into a gambit format.
* The gambit format can be localized.
*/
fromFilter(value: any, negate: boolean): string;
/**
* This returns information about how the gambit is structured for the UI.
* Use localized values.
*/
suggestion(): Type extends GambitType.KeyValue ? KeyValueGambitSuggestion : GroupedGambitSuggestion;
/**
* Whether this gambit can use logical operators.
* For example, the tag gambit can be used as such:
* `tag:foo,bar tag:baz` which translates to `(foo OR bar) AND baz`.
*
* The info allows generation of the correct filtering format, which would be
* ```
* {
* tag: [
* 'foo,bar', // OR because of the comma.
* 'baz', // AND because it's a separate item.
* ]
* }
* ```
*
* The backend filter must be able to handle this format.
* Checkout the TagGambit and TagFilter classes for an example.
*/
predicates: boolean;
/**
* Whether this gambit can be used by the actor.
*/
enabled(): boolean;
}
export declare enum GambitType {
KeyValue = "key:value",
Grouped = "grouped"
}
export declare type KeyValueGambitSuggestion = {
key: string;
hint: string;
};
export declare type GroupedGambitSuggestion = {
group: 'is' | 'has' | string;
key: string | string[];
};
export declare abstract class BooleanGambit implements IGambit<GambitType.Grouped> {
type: GambitType;
predicates: boolean;
abstract key(): string | string[];
abstract filterKey(): string;
pattern(): string;
toFilter(_matches: string[], negate: boolean): Record<string, any>;
fromFilter(value: string, negate: boolean): string;
suggestion(): {
group: string;
key: string | string[];
};
enabled(): boolean;
}
export declare abstract class KeyValueGambit implements IGambit<GambitType.KeyValue> {
type: GambitType;
predicates: boolean;
abstract key(): string;
abstract hint(): string;
abstract filterKey(): string;
valuePattern(): string;
gambitValueToFilterValue(value: string): string | number | boolean | Array<any>;
filterValueToGambitValue(value: any): string;
pattern(): string;
toFilter(matches: string[], negate: boolean): Record<string, any>;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
fromFilter(value: any, negate: boolean): string;
suggestion(): {
key: string;
hint: string;
};
enabled(): boolean;
}

View File

@ -1,7 +1,6 @@
import IGambit from '../IGambit';
export default class AuthorGambit implements IGambit {
pattern(): string;
toFilter(matches: string[], negate: boolean): Record<string, any>;
import { KeyValueGambit } from '../IGambit';
export default class AuthorGambit extends KeyValueGambit {
key(): string;
hint(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
}

View File

@ -1,7 +1,7 @@
import IGambit from '../IGambit';
export default class CreatedGambit implements IGambit {
pattern(): string;
toFilter(matches: string[], negate: boolean): Record<string, any>;
import { KeyValueGambit } from '../IGambit';
export default class CreatedGambit extends KeyValueGambit {
key(): string;
hint(): string;
valuePattern(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
}

View File

@ -1,7 +1,6 @@
import IGambit from '../IGambit';
export default class HiddenGambit implements IGambit {
pattern(): string;
toFilter(_matches: string[], negate: boolean): Record<string, any>;
import { BooleanGambit } from '../IGambit';
export default class HiddenGambit extends BooleanGambit {
key(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
enabled(): boolean;
}

View File

@ -1,7 +1,6 @@
import IGambit from '../IGambit';
export default class UnreadGambit implements IGambit {
pattern(): string;
toFilter(_matches: string[], negate: boolean): Record<string, any>;
import { BooleanGambit } from '../IGambit';
export default class UnreadGambit extends BooleanGambit {
key(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
enabled(): boolean;
}

View File

@ -1,7 +1,7 @@
import IGambit from '../IGambit';
export default class EmailGambit implements IGambit {
pattern(): string;
toFilter(matches: string[], negate: boolean): Record<string, any>;
import { KeyValueGambit } from '../IGambit';
export default class EmailGambit extends KeyValueGambit {
key(): string;
hint(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
enabled(): boolean;
}

View File

@ -1,7 +1,6 @@
import IGambit from '../IGambit';
export default class GroupGambit implements IGambit {
pattern(): string;
toFilter(matches: string[], negate: boolean): Record<string, any>;
import { KeyValueGambit } from '../IGambit';
export default class GroupGambit extends KeyValueGambit {
key(): string;
hint(): string;
filterKey(): string;
fromFilter(value: string, negate: boolean): string;
}

View File

@ -0,0 +1,13 @@
export default class AutocompleteReader {
readonly symbol: string | ((character: string) => boolean) | null;
relativeStart: number;
absoluteStart: number;
constructor(symbol: string | ((character: string) => boolean) | null);
check(lastChunk: string, cursor: number, validBit?: RegExp | null): AutocompleteCheck | null;
}
export declare type AutocompleteCheck = {
symbol: string | null;
relativeStart: number;
absoluteStart: number;
typed: string;
};

View File

@ -0,0 +1,16 @@
/// <reference types="mithril" />
import { GambitType } from '../query/IGambit';
import type IGambit from '../query/IGambit';
import { type AutocompleteCheck } from '../utils/AutocompleteReader';
export default class GambitsAutocomplete {
resource: string;
jqueryInput: () => JQuery<HTMLInputElement>;
onchange: (value: string) => void;
afterSuggest: (value: string) => void;
protected query: string;
constructor(resource: string, jqueryInput: () => JQuery<HTMLInputElement>, onchange: (value: string) => void, afterSuggest: (value: string) => void);
suggestions(query: string): JSX.Element[];
specificGambitSuggestions(gambitKey: string, gambitQuery: string, uniqueGroups: string[], groupedGambits: IGambit<GambitType.Grouped>[], autocomplete: AutocompleteCheck): JSX.Element[] | null;
gambitSuggestion(key: string, value: string | null, suggest: (negated?: boolean) => void): JSX.Element;
suggest(text: string, fromTyped: string, start: number): void;
}

View File

@ -1,5 +1,16 @@
declare type KeyboardEventHandler = (event: KeyboardEvent) => void;
declare type ShouldHandle = (event: KeyboardEvent) => boolean;
declare enum Keys {
Enter = 13,
Escape = 27,
Space = 32,
ArrowUp = 38,
ArrowDown = 40,
ArrowLeft = 37,
ArrowRight = 39,
Tab = 9,
Backspace = 8
}
/**
* The `KeyboardNavigatable` class manages lists that can be navigated with the
* keyboard, calling callbacks for each actions.
@ -29,6 +40,19 @@ export default class KeyboardNavigatable {
* This will be triggered by the Down key.
*/
onDown(callback: KeyboardEventHandler): KeyboardNavigatable;
/**
* Provide a callback to be executed when navigating leftwards.
*
* This will be triggered by the Left key.
*/
onLeft(callback: KeyboardEventHandler): KeyboardNavigatable;
/**
* Provide a callback to be executed when navigating rightwards.
*
* This will be triggered by the Right key.
*/
onRight(callback: KeyboardEventHandler): KeyboardNavigatable;
onDirection(callback: KeyboardEventHandler, direction: Keys): KeyboardNavigatable;
/**
* Provide a callback to be executed when the current item is selected..
*

View File

@ -11,6 +11,7 @@ import type Post from './components/Post';
import type Discussion from '../common/models/Discussion';
import type NotificationModel from '../common/models/Notification';
import type PostModel from '../common/models/Post';
import SearchManager from '../common/SearchManager';
export interface ForumApplicationData extends ApplicationData {
}
export default class ForumApplication extends Application {
@ -44,10 +45,9 @@ export default class ForumApplication extends Application {
*/
notifications: NotificationListState;
/**
* An object which stores previously searched queries and provides convenient
* tools for retrieving and managing search values.
* An object which stores the global search state and manages search capabilities.
*/
search: GlobalSearchState;
search: SearchManager<GlobalSearchState>;
/**
* An object which controls the state of the composer.
*/

View File

@ -1,12 +1,17 @@
import { SearchSource } from './Search';
import type Mithril from 'mithril';
import Discussion from '../../common/models/Discussion';
import type Discussion from '../../common/models/Discussion';
import type { SearchSource } from './Search';
/**
* The `DiscussionsSearchSource` finds and displays discussion search results in
* the search dropdown.
*/
export default class DiscussionsSearchSource implements SearchSource {
protected results: Map<string, Discussion[]>;
search(query: string): Promise<void>;
resource: string;
title(): string;
isCached(query: string): boolean;
search(query: string, limit: number): Promise<void>;
view(query: string): Array<Mithril.Vnode>;
fullPage(query: string): Mithril.Vnode;
gotoItem(id: string): string | null;
}

View File

@ -0,0 +1,12 @@
import DiscussionListItem, { IDiscussionListItemAttrs } from './DiscussionListItem';
import ItemList from '../../common/utils/ItemList';
import Mithril from 'mithril';
export default class MinimalDiscussionListItem extends DiscussionListItem<IDiscussionListItemAttrs> {
elementAttrs(): {
className: string;
};
viewItems(): ItemList<Mithril.Children>;
contentItems(): ItemList<Mithril.Children>;
authorItems(): ItemList<Mithril.Children>;
mainView(): Mithril.Children;
}

View File

@ -1,8 +1,11 @@
import Component, { ComponentAttrs } from '../../common/Component';
import ItemList from '../../common/utils/ItemList';
import KeyboardNavigatable from '../../common/utils/KeyboardNavigatable';
import SearchState from '../states/SearchState';
import SearchState from '../../common/states/SearchState';
import type Mithril from 'mithril';
import ItemList from '../../common/utils/ItemList';
export interface SearchAttrs extends ComponentAttrs {
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
state: SearchState;
}
/**
* The `SearchSource` interface defines a section of search results in the
* search dropdown.
@ -14,20 +17,36 @@ import type Mithril from 'mithril';
* putting together the output from the `view` method of each source.
*/
export interface SearchSource {
/**
* The resource type that this search source is responsible for.
*/
resource: string;
/**
* Get the title for this search source.
*/
title(): string;
/**
* Check if a query has been cached for this search source.
*/
isCached(query: string): boolean;
/**
* Make a request to get results for the given query.
* The results will be updated internally in the search source, not exposed.
*/
search(query: string): Promise<void>;
search(query: string, limit: number): Promise<void>;
/**
* Get an array of virtual <li>s that list the search results for the given
* query.
*/
view(query: string): Array<Mithril.Vnode>;
}
export interface SearchAttrs extends ComponentAttrs {
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
state: SearchState;
/**
* Get a list item for the full search results page.
*/
fullPage(query: string): Mithril.Vnode | null;
/**
* Get to the result item page. Only called if each list item has a data-id.
*/
gotoItem(id: string): string | null;
}
/**
* The `Search` component displays a menu of as-you-type results from a variety
@ -42,70 +61,14 @@ export interface SearchAttrs extends ComponentAttrs {
* - state: SearchState instance.
*/
export default class Search<T extends SearchAttrs = SearchAttrs> extends Component<T, SearchState> {
/**
* The minimum query length before sources are searched.
*/
protected static MIN_SEARCH_LEN: number;
/**
* The instance of `SearchState` for this component.
*/
protected searchState: SearchState;
/**
* Whether or not the search input has focus.
*/
protected hasFocus: boolean;
/**
* An array of SearchSources.
*/
protected sources?: SearchSource[];
/**
* The number of sources that are still loading results.
*/
protected loadingSources: number;
/**
* The index of the currently-selected <li> in the results list. This can be
* a unique string (to account for the fact that an item's position may jump
* around as new results load), but otherwise it will be numeric (the
* sequential position within the list).
*/
protected index: number;
protected navigator: KeyboardNavigatable;
protected searchTimeout?: number;
private updateMaxHeightHandler?;
oninit(vnode: Mithril.Vnode<T, this>): void;
view(): JSX.Element;
updateMaxHeight(): void;
onupdate(vnode: Mithril.VnodeDOM<T, this>): void;
oncreate(vnode: Mithril.VnodeDOM<T, this>): void;
onremove(vnode: Mithril.VnodeDOM<T, this>): void;
/**
* Navigate to the currently selected search result and close the list.
*/
selectResult(): void;
/**
* Clear the search
*/
clear(): void;
/**
* Build an item list of SearchSources.
* A list of search sources that can be used to query for search results.
*/
sourceItems(): ItemList<SearchSource>;
/**
* Get all of the search result items that are selectable.
*/
selectableItems(): JQuery;
/**
* Get the position of the currently selected search result item.
* Returns zero if not found.
*/
getCurrentNumericIndex(): number;
/**
* Get the <li> in the search results with the given index (numeric or named).
*/
getItem(index: number): JQuery;
/**
* Set the currently-selected search result item to the one with the given
* index.
*/
setIndex(index: number, scrollToItem?: boolean): void;
}

View File

@ -0,0 +1,87 @@
import type { IFormModalAttrs } from '../../common/components/FormModal';
import FormModal from '../../common/components/FormModal';
import type Mithril from 'mithril';
import type SearchState from '../../common/states/SearchState';
import KeyboardNavigatable from '../../common/utils/KeyboardNavigatable';
import Stream from '../../common/utils/Stream';
import type { SearchSource } from './Search';
import ItemList from '../../common/utils/ItemList';
import GambitsAutocomplete from '../../common/utils/GambitsAutocomplete';
export interface ISearchModalAttrs extends IFormModalAttrs {
onchange: (value: string) => void;
searchState: SearchState;
sources: SearchSource[];
}
export default class SearchModal<CustomAttrs extends ISearchModalAttrs = ISearchModalAttrs> extends FormModal<CustomAttrs> {
static LIMIT: number;
protected searchState: SearchState;
protected query: Stream<string>;
/**
* An array of SearchSources.
*/
protected sources: SearchSource[];
/**
* The key of the currently-active search source.
*/
protected activeSource: Stream<SearchSource>;
/**
* The sources that are still loading results.
*/
protected loadingSources: string[];
/**
* The index of the currently-selected <li> in the results list. This can be
* a unique string (to account for the fact that an item's position may jump
* around as new results load), but otherwise it will be numeric (the
* sequential position within the list).
*/
protected index: number;
protected navigator: KeyboardNavigatable;
protected searchTimeout?: number;
protected inputScroll: Stream<number>;
protected gambitsAutocomplete: Record<string, GambitsAutocomplete>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
title(): Mithril.Children;
className(): string;
content(): Mithril.Children;
tabs(): JSX.Element;
tabItems(): ItemList<Mithril.Children>;
activeTabItems(): ItemList<Mithril.Children>;
switchSource(source: SearchSource): void;
gambits(): JSX.Element[];
/**
* Transforms a simple search text to wrap valid gambits in a mark tag.
* @example `lorem ipsum is:unread dolor` => `lorem ipsum <mark>is:unread</mark> dolor`
*/
gambifyInput(): Mithril.Children;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
search(query: string): void;
/**
* Navigate to the currently selected search result and close the list.
*/
selectResult(): void;
/**
* Clear the search
*/
clear(): void;
/**
* Get all of the search result items that are selectable.
*/
selectableItems(): JQuery;
/**
* Get the position of the currently selected search result item.
* Returns zero if not found.
*/
getCurrentNumericIndex(): number;
/**
* Get the <li> in the search results with the given index (numeric or named).
*/
getItem(index: number): JQuery;
/**
* Set the currently-selected search result item to the one with the given
* index.
*/
setIndex(index: number, scrollToItem?: boolean): void;
inputElement(): JQuery<HTMLInputElement>;
}

View File

@ -1,12 +1,17 @@
import type Mithril from 'mithril';
import { SearchSource } from './Search';
import User from '../../common/models/User';
import type User from '../../common/models/User';
import type { SearchSource } from './Search';
/**
* The `UsersSearchSource` finds and displays user search results in the search
* dropdown.
*/
export default class UsersSearchResults implements SearchSource {
protected results: Map<string, User[]>;
search(query: string): Promise<void>;
resource: string;
title(): string;
isCached(query: string): boolean;
search(query: string, limit: number): Promise<void>;
view(query: string): Array<Mithril.Vnode>;
fullPage(query: string): null;
gotoItem(id: string): string | null;
}

View File

@ -11,7 +11,6 @@ import './states/DiscussionListState';
import './states/GlobalSearchState';
import './states/NotificationListState';
import './states/PostStreamState';
import './states/SearchState';
import './components/AffixedSidebar';
import './components/DiscussionPage';
import './components/DiscussionListPane';

View File

@ -1,4 +1,4 @@
import SearchState from './SearchState';
import SearchState from '../../common/states/SearchState';
declare type SearchParams = Record<string, string>;
export default class GlobalSearchState extends SearchState {
private initialValueSet;

2
framework/core/js/dist/admin.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
framework/core/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[460],{5049:(o,r,t)=>{t.r(r),t.d(r,{default:()=>u});var i=t(7905),s=t(6789),a=t(899),e=t(8312),n=t(6403),l=t(1552),d=t(4041),c=t(6458);class u extends a.Z{constructor(){super(...arguments),(0,i.Z)(this,"identification",void 0),(0,i.Z)(this,"password",void 0),(0,i.Z)(this,"remember",void 0)}oninit(o){super.oninit(o),this.identification=(0,c.Z)(this.attrs.identification||""),this.password=(0,c.Z)(this.attrs.password||""),this.remember=(0,c.Z)(!!this.attrs.remember)}className(){return"LogInModal Modal--small"}title(){return s.Z.translator.trans("core.forum.log_in.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}body(){return[m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const o=new d.Z,r=(0,l.Z)(s.Z.translator.trans("core.forum.log_in.username_or_email_placeholder")),t=(0,l.Z)(s.Z.translator.trans("core.forum.log_in.password_placeholder"));return o.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:r,"aria-label":r,bidi:this.identification,disabled:this.loading})),30),o.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"current-password",placeholder:t,"aria-label":t,bidi:this.password,disabled:this.loading})),20),o.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),s.Z.translator.trans("core.forum.log_in.remember_me_label")))),10),o.add("submit",m("div",{className:"Form-group"},m(e.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},s.Z.translator.trans("core.forum.log_in.submit_button"))),-10),o}footer(){return m("[",null,m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},s.Z.translator.trans("core.forum.log_in.forgot_password_link"))),s.Z.forum.attribute("allowSignUp")&&m("p",{className:"LogInModal-signUp"},s.Z.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})))}forgotPassword(){const o=this.identification(),r=o.includes("@")?{email:o}:void 0;s.Z.modal.show((()=>t.e(502).then(t.bind(t,1839))),r)}signUp(){const o=this.identification(),r={[o.includes("@")?"email":"username"]:o};s.Z.modal.show((()=>t.e(395).then(t.bind(t,8686))),r)}onready(){this.$("[name="+(this.identification()?"password":"identification")+"]").trigger("select")}onsubmit(o){o.preventDefault(),this.loading=!0,s.Z.session.login(this.loginParams(),{errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}loginParams(){return{identification:this.identification(),password:this.password(),remember:this.remember()}}onerror(o){401===o.status&&o.alert&&(o.alert.content=s.Z.translator.trans("core.forum.log_in.invalid_login_message"),this.password("")),super.onerror(o)}}flarum.reg.add("core","forum/components/LogInModal",u),flarum.reg.addChunkModule("502","1839","core","forum/components/ForgotPasswordModal"),flarum.reg.addChunkModule("395","8686","core","forum/components/SignUpModal")}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[460],{5049:(o,r,t)=>{t.r(r),t.d(r,{default:()=>u});var s=t(7905),e=t(6789),i=t(899),a=t(8312),n=t(6403),l=t(1552),d=t(4041),c=t(6458);class u extends i.Z{constructor(){super(...arguments),(0,s.Z)(this,"identification",void 0),(0,s.Z)(this,"password",void 0),(0,s.Z)(this,"remember",void 0)}oninit(o){super.oninit(o),this.identification=(0,c.Z)(this.attrs.identification||""),this.password=(0,c.Z)(this.attrs.password||""),this.remember=(0,c.Z)(!!this.attrs.remember)}className(){return"LogInModal Modal--small"}title(){return e.Z.translator.trans("core.forum.log_in.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}body(){return[m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const o=new d.Z,r=(0,l.Z)(e.Z.translator.trans("core.forum.log_in.username_or_email_placeholder")),t=(0,l.Z)(e.Z.translator.trans("core.forum.log_in.password_placeholder"));return o.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:r,"aria-label":r,bidi:this.identification,disabled:this.loading})),30),o.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"current-password",placeholder:t,"aria-label":t,bidi:this.password,disabled:this.loading})),20),o.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),e.Z.translator.trans("core.forum.log_in.remember_me_label")))),10),o.add("submit",m("div",{className:"Form-group"},m(a.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},e.Z.translator.trans("core.forum.log_in.submit_button"))),-10),o}footer(){return m("[",null,m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},e.Z.translator.trans("core.forum.log_in.forgot_password_link"))),e.Z.forum.attribute("allowSignUp")&&m("p",{className:"LogInModal-signUp"},e.Z.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})))}forgotPassword(){const o=this.identification(),r=o.includes("@")?{email:o}:void 0;e.Z.modal.show((()=>t.e(502).then(t.bind(t,1839))),r)}signUp(){const o=this.identification(),r={[o.includes("@")?"email":"username"]:o};e.Z.modal.show((()=>t.e(395).then(t.bind(t,8686))),r)}onready(){this.$("[name="+(this.identification()?"password":"identification")+"]").trigger("select")}onsubmit(o){o.preventDefault(),this.loading=!0,e.Z.session.login(this.loginParams(),{errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}loginParams(){return{identification:this.identification(),password:this.password(),remember:this.remember()}}onerror(o){401===o.status&&o.alert&&(o.alert.content=e.Z.translator.trans("core.forum.log_in.invalid_login_message"),this.password("")),super.onerror(o)}}flarum.reg.add("core","forum/components/LogInModal",u),flarum.reg.addChunkModule("502","1839","core","forum/components/ForgotPasswordModal"),flarum.reg.addChunkModule("395","8686","core","forum/components/SignUpModal")},6403:(o,r,t)=>{t.d(r,{Z:()=>i});var s=t(2190),e=t(4041);class i extends s.Z{view(){return m("div",{className:"LogInButtons"},this.items().toArray())}items(){return new e.Z}}flarum.reg.add("core","forum/components/LogInButtons",i)}}]);
//# sourceMappingURL=LogInModal.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[395],{8686:(s,t,a)=>{a.r(t),a.d(t,{default:()=>h});var e=a(7905),r=a(6789),o=a(899),i=a(8312),n=a(6403),l=a(1552),d=a(4041),u=a(6458);class h extends o.Z{constructor(){super(...arguments),(0,e.Z)(this,"username",void 0),(0,e.Z)(this,"email",void 0),(0,e.Z)(this,"password",void 0)}oninit(s){super.oninit(s),this.username=(0,u.Z)(this.attrs.username||""),this.email=(0,u.Z)(this.attrs.email||""),this.password=(0,u.Z)(this.attrs.password||"")}className(){return"Modal--small SignUpModal"}title(){return r.Z.translator.trans("core.forum.sign_up.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}isProvided(s){var t,a;return null!=(t=null==(a=this.attrs.provided)?void 0:a.includes(s))&&t}body(){return[!this.attrs.token&&m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const s=new d.Z,t=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.username_placeholder")),a=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.email_placeholder")),e=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.password_placeholder"));return s.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:t,"aria-label":t,bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),s.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:a,"aria-label":a,bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||s.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"new-password",placeholder:e,"aria-label":e,bidi:this.password,disabled:this.loading})),10),s.add("submit",m("div",{className:"Form-group"},m(i.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},r.Z.translator.trans("core.forum.sign_up.submit_button"))),-10),s}footer(){return[m("p",{className:"SignUpModal-logIn"},r.Z.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]}logIn(){const s={identification:this.email()||this.username()};r.Z.modal.show((()=>a.e(460).then(a.bind(a,5049))),s)}onready(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()}onsubmit(s){s.preventDefault(),this.loading=!0;const t=this.submitData();r.Z.request({url:r.Z.forum.attribute("baseUrl")+"/register",method:"POST",body:t,errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}submitData(){const s=this.attrs.token?{token:this.attrs.token}:{password:this.password()};return{username:this.username(),email:this.email(),...s}}}flarum.reg.add("core","forum/components/SignUpModal",h),flarum.reg.addChunkModule("460","5049","core","forum/components/LogInModal")}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[395],{8686:(s,t,e)=>{e.r(t),e.d(t,{default:()=>h});var a=e(7905),r=e(6789),o=e(899),i=e(8312),n=e(6403),l=e(1552),d=e(4041),u=e(6458);class h extends o.Z{constructor(){super(...arguments),(0,a.Z)(this,"username",void 0),(0,a.Z)(this,"email",void 0),(0,a.Z)(this,"password",void 0)}oninit(s){super.oninit(s),this.username=(0,u.Z)(this.attrs.username||""),this.email=(0,u.Z)(this.attrs.email||""),this.password=(0,u.Z)(this.attrs.password||"")}className(){return"Modal--small SignUpModal"}title(){return r.Z.translator.trans("core.forum.sign_up.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}isProvided(s){var t,e;return null!=(t=null==(e=this.attrs.provided)?void 0:e.includes(s))&&t}body(){return[!this.attrs.token&&m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const s=new d.Z,t=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.username_placeholder")),e=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.email_placeholder")),a=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.password_placeholder"));return s.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:t,"aria-label":t,bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),s.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:e,"aria-label":e,bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||s.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"new-password",placeholder:a,"aria-label":a,bidi:this.password,disabled:this.loading})),10),s.add("submit",m("div",{className:"Form-group"},m(i.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},r.Z.translator.trans("core.forum.sign_up.submit_button"))),-10),s}footer(){return[m("p",{className:"SignUpModal-logIn"},r.Z.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]}logIn(){const s={identification:this.email()||this.username()};r.Z.modal.show((()=>e.e(460).then(e.bind(e,5049))),s)}onready(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()}onsubmit(s){s.preventDefault(),this.loading=!0;const t=this.submitData();r.Z.request({url:r.Z.forum.attribute("baseUrl")+"/register",method:"POST",body:t,errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}submitData(){const s=this.attrs.token?{token:this.attrs.token}:{password:this.password()};return{username:this.username(),email:this.email(),...s}}}flarum.reg.add("core","forum/components/SignUpModal",h),flarum.reg.addChunkModule("460","5049","core","forum/components/LogInModal")},6403:(s,t,e)=>{e.d(t,{Z:()=>o});var a=e(2190),r=e(4041);class o extends a.Z{view(){return m("div",{className:"LogInButtons"},this.items().toArray())}items(){return new r.Z}}flarum.reg.add("core","forum/components/LogInButtons",o)}}]);
//# sourceMappingURL=SignUpModal.js.map

File diff suppressed because one or more lines are too long