katalyst-koi 5.0.3 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,75 +43,6 @@ class FlashController extends Controller {
43
43
  }
44
44
  }
45
45
 
46
- /**
47
- A stimulus controller to request form submissions.
48
- This controller should be attached to a form element.
49
- */
50
- class FormRequestSubmitController extends Controller {
51
- requestSubmit() {
52
- this.element.requestSubmit();
53
- }
54
- }
55
-
56
- class IndexActionsController extends Controller {
57
- static targets = ["create", "search", "sort"];
58
-
59
- initialize() {
60
- // debounce search
61
- this.update = debounce(this, this.update);
62
- }
63
-
64
- disconnect() {
65
- clearTimeout(this.timer);
66
- }
67
-
68
- create() {
69
- this.createTarget.click();
70
- }
71
-
72
- search() {
73
- this.searchTarget.focus();
74
- }
75
-
76
- clear() {
77
- this.searchTarget.value = "";
78
- this.searchTarget.closest("form").requestSubmit();
79
- }
80
-
81
- update() {
82
- this.searchTarget.closest("form").requestSubmit();
83
- }
84
-
85
- submit() {
86
- const shouldFocus = document.activeElement === this.searchTarget;
87
-
88
- if (this.searchTarget.value === "") {
89
- this.searchTarget.disabled = true;
90
- }
91
- if (this.sortTarget.value === "") {
92
- this.sortTarget.disabled = true;
93
- }
94
-
95
- // restore state and focus after submit
96
- Promise.resolve().then(() => {
97
- this.searchTarget.disabled = false;
98
- this.sortTarget.disabled = false;
99
- if (shouldFocus) {
100
- this.searchTarget.focus();
101
- }
102
- });
103
- }
104
- }
105
-
106
- function debounce(self, f) {
107
- return (...args) => {
108
- clearTimeout(self.timer);
109
- self.timer = setTimeout(() => {
110
- f.apply(self, ...args);
111
- }, 300);
112
- };
113
- }
114
-
115
46
  class KeyboardController extends Controller {
116
47
  static values = {
117
48
  mapping: String,
@@ -423,248 +354,6 @@ class PagyNavController extends Controller {
423
354
  };
424
355
  }
425
356
 
426
- const DEFAULT_DELAY = 250;
427
-
428
- /**
429
- * A utility class for managing CSS transition animations.
430
- *
431
- * Transition uses Javascript timers to track state instead of relying on
432
- * CSS transition events, which is a more complicated API. Please call `cancel`
433
- * when the node being animated is detached from the DOM to avoid unexpected
434
- * errors or animation glitches.
435
- *
436
- * Transition assumes that CSS already specifies styles to achieve the expected
437
- * start and end states. Transition adds temporary overrides and then animates
438
- * between those values using CSS transitions. For example, to use the collapse
439
- * transition:
440
- *
441
- * @example
442
- * // CSS:
443
- * target {
444
- * max-height: unset;
445
- * overflow: 0;
446
- * }
447
- * target.hidden {
448
- * max-height: 0;
449
- * }
450
- *
451
- * @example
452
- * // Javascript
453
- * target.addClass("hidden");
454
- * new Transition(target).collapse().start();
455
- */
456
- class Transition {
457
- constructor(target, options) {
458
- const { delay } = this._setDefaults(options);
459
-
460
- this.target = target;
461
- this.runner = new Runner(this, delay);
462
- this.properties = [];
463
-
464
- this.startingCallbacks = [];
465
- this.startedCallbacks = [];
466
- this.completeCallbacks = [];
467
- }
468
-
469
- add(property) {
470
- this.properties.push(property);
471
- return this;
472
- }
473
-
474
- /** Adds callback for transition events */
475
- addCallback(type, callback) {
476
- switch (type) {
477
- case "starting":
478
- this.startingCallbacks.push(callback);
479
- break;
480
- case "started":
481
- this.startedCallbacks.push(callback);
482
- break;
483
- case "complete":
484
- this.completeCallbacks.push(callback);
485
- break;
486
- }
487
- return this;
488
- }
489
-
490
- /** Collapse an element in place, assumes overflow is set appropriately, margin is not collapsed */
491
- collapse() {
492
- return this.add(
493
- new PropertyTransition(
494
- "max-height",
495
- `${this.target.scrollHeight}px`,
496
- "0px",
497
- ),
498
- );
499
- }
500
-
501
- /** Restore a collapsed element */
502
- expand() {
503
- return this.add(
504
- new PropertyTransition(
505
- "max-height",
506
- "0px",
507
- `${this.target.scrollHeight}px`,
508
- ),
509
- );
510
- }
511
-
512
- /** Slide an element left or right by its scroll width, assumes position relative */
513
- slideOut(direction) {
514
- return this.add(
515
- new PropertyTransition(direction, "0px", `-${this.target.scrollWidth}px`),
516
- );
517
- }
518
-
519
- /** Restore an element that has been slid */
520
- slideIn(direction) {
521
- return this.add(
522
- new PropertyTransition(direction, `-${this.target.scrollWidth}px`, "0px"),
523
- );
524
- }
525
-
526
- /** Cause an element to become transparent by transforming opacity */
527
- fadeOut() {
528
- return this.add(new PropertyTransition("opacity", "100%", "0%"));
529
- }
530
-
531
- /** Cause a transparent element to become visible again */
532
- fadeIn() {
533
- return this.add(new PropertyTransition("opacity", "0%", "100%"));
534
- }
535
-
536
- start(callback = null) {
537
- // start the runner on next tick so that any side-effects of the current execution can occur first
538
- requestAnimationFrame(() => {
539
- this.runner.start(this.target);
540
- if (callback) callback();
541
- });
542
- return this;
543
- }
544
-
545
- cancel() {
546
- this.runner.stop(this.target);
547
- return this;
548
- }
549
-
550
- _starting() {
551
- const event = new Event("transition:starting");
552
- this.startingCallbacks.forEach((cb) => cb(event));
553
- this.target.dispatchEvent(event);
554
- }
555
-
556
- _started() {
557
- const event = new Event("transition:started");
558
- this.startedCallbacks.forEach((cb) => cb(event));
559
- this.target.dispatchEvent(event);
560
- }
561
-
562
- _complete() {
563
- const event = new Event("transition:complete");
564
- this.completeCallbacks.forEach((cb) => cb(event));
565
- this.target.dispatchEvent(event);
566
- }
567
-
568
- _setDefaults(options) {
569
- return Object.assign({ delay: DEFAULT_DELAY }, options);
570
- }
571
- }
572
-
573
- /**
574
- * Encapsulates internal execution and timing functionality for `Transition`
575
- */
576
- class Runner {
577
- constructor(transition, delay) {
578
- this.transition = transition;
579
- this.running = null;
580
- this.delay = delay;
581
- }
582
-
583
- start(target) {
584
- // 1. Set the initial state(s)
585
- this.transition.properties.forEach((t) => t.onStarting(target));
586
-
587
- // 2. On next update, set transition and final state(s)
588
- requestAnimationFrame(() => this.onStarted(target));
589
-
590
- // 3. After transition has finished, clean up
591
- this.running = setTimeout(() => this.stop(target, true), this.delay);
592
-
593
- this.transition._starting();
594
- }
595
-
596
- onStarted(target) {
597
- target.style.transitionProperty = this.transition.properties
598
- .map((t) => t.property)
599
- .join(",");
600
- target.style.transitionDuration = `${this.delay}ms`;
601
- this.transition.properties.forEach((t) => t.onStarted(target));
602
-
603
- this.transition._started();
604
- }
605
-
606
- stop(target, timeout = false) {
607
- if (!this.running) return;
608
- if (!timeout) clearTimeout(this.running);
609
-
610
- this.running = null;
611
-
612
- target.style.removeProperty("transition-property");
613
- target.style.removeProperty("transition-duration");
614
- this.transition.properties.forEach((t) => t.onComplete(target));
615
-
616
- this.transition._complete();
617
- }
618
- }
619
-
620
- /**
621
- * Represents animation of a single CSS property. Currently only CSS animations
622
- * are supported, but this could be a natural extension point for Javascript
623
- * animations in the future.
624
- */
625
- class PropertyTransition {
626
- constructor(property, from, to) {
627
- this.property = property;
628
- this.from = from;
629
- this.to = to;
630
- }
631
-
632
- onStarting(target) {
633
- target.style.setProperty(this.property, this.from);
634
- }
635
-
636
- onStarted(target) {
637
- target.style.setProperty(this.property, this.to);
638
- }
639
-
640
- onComplete(target) {
641
- target.style.removeProperty(this.property);
642
- }
643
- }
644
-
645
- class ShowHideController extends Controller {
646
- static targets = ["content"];
647
-
648
- toggle() {
649
- const element = this.contentTarget;
650
- const hide = element.toggleAttribute("data-collapsed");
651
-
652
- // cancel previous animation, if any
653
- if (this.transition) this.transition.cancel();
654
-
655
- const transition = (this.transition = new Transition(element)
656
- .addCallback("starting", function () {
657
- element.setAttribute("data-collapsed-transitioning", "true");
658
- })
659
- .addCallback("complete", function () {
660
- element.removeAttribute("data-collapsed-transitioning");
661
- }));
662
- hide ? transition.collapse() : transition.expand();
663
-
664
- transition.start();
665
- }
666
- }
667
-
668
357
  /**
669
358
  * Connect an input (e.g. title) to slug.
670
359
  */
@@ -760,14 +449,6 @@ const Definitions = [
760
449
  identifier: "flash",
761
450
  controllerConstructor: FlashController,
762
451
  },
763
- {
764
- identifier: "form-request-submit",
765
- controllerConstructor: FormRequestSubmitController,
766
- },
767
- {
768
- identifier: "index-actions",
769
- controllerConstructor: IndexActionsController,
770
- },
771
452
  {
772
453
  identifier: "keyboard",
773
454
  controllerConstructor: KeyboardController,
@@ -788,10 +469,6 @@ const Definitions = [
788
469
  identifier: "pagy-nav",
789
470
  controllerConstructor: PagyNavController,
790
471
  },
791
- {
792
- identifier: "show-hide",
793
- controllerConstructor: ShowHideController,
794
- },
795
472
  {
796
473
  identifier: "sluggable",
797
474
  controllerConstructor: SluggableController,
@@ -1,2 +1,2 @@
1
- import"@hotwired/turbo-rails";import t,{initAll as e}from"@katalyst/govuk-formbuilder";import"@rails/actiontext";import"trix";import{Application as s,Controller as r}from"@hotwired/stimulus";import i from"@katalyst/content";import a from"@katalyst/navigation";import o from"@katalyst/tables";import{get as n,parseRequestOptionsFromJSON as l,create as c,parseCreationOptionsFromJSON as h}from"@github/webauthn-json/browser-ponyfill";const u=s.start();class d{constructor(t,e){const{delay:s}=this._setDefaults(e);this.target=t,this.runner=new g(this,s),this.properties=[],this.startingCallbacks=[],this.startedCallbacks=[],this.completeCallbacks=[]}add(t){return this.properties.push(t),this}addCallback(t,e){switch(t){case"starting":this.startingCallbacks.push(e);break;case"started":this.startedCallbacks.push(e);break;case"complete":this.completeCallbacks.push(e)}return this}collapse(){return this.add(new p("max-height",`${this.target.scrollHeight}px`,"0px"))}expand(){return this.add(new p("max-height","0px",`${this.target.scrollHeight}px`))}slideOut(t){return this.add(new p(t,"0px",`-${this.target.scrollWidth}px`))}slideIn(t){return this.add(new p(t,`-${this.target.scrollWidth}px`,"0px"))}fadeOut(){return this.add(new p("opacity","100%","0%"))}fadeIn(){return this.add(new p("opacity","0%","100%"))}start(t=null){return requestAnimationFrame(()=>{this.runner.start(this.target),t&&t()}),this}cancel(){return this.runner.stop(this.target),this}_starting(){const t=new Event("transition:starting");this.startingCallbacks.forEach(e=>e(t)),this.target.dispatchEvent(t)}_started(){const t=new Event("transition:started");this.startedCallbacks.forEach(e=>e(t)),this.target.dispatchEvent(t)}_complete(){const t=new Event("transition:complete");this.completeCallbacks.forEach(e=>e(t)),this.target.dispatchEvent(t)}_setDefaults(t){return Object.assign({delay:250},t)}}class g{constructor(t,e){this.transition=t,this.running=null,this.delay=e}start(t){this.transition.properties.forEach(e=>e.onStarting(t)),requestAnimationFrame(()=>this.onStarted(t)),this.running=setTimeout(()=>this.stop(t,!0),this.delay),this.transition._starting()}onStarted(t){t.style.transitionProperty=this.transition.properties.map(t=>t.property).join(","),t.style.transitionDuration=`${this.delay}ms`,this.transition.properties.forEach(e=>e.onStarted(t)),this.transition._started()}stop(t,e=!1){this.running&&(e||clearTimeout(this.running),this.running=null,t.style.removeProperty("transition-property"),t.style.removeProperty("transition-duration"),this.transition.properties.forEach(e=>e.onComplete(t)),this.transition._complete())}}class p{constructor(t,e,s){this.property=t,this.from=e,this.to=s}onStarting(t){t.style.setProperty(this.property,this.from)}onStarted(t){t.style.setProperty(this.property,this.to)}onComplete(t){t.style.removeProperty(this.property)}}u.load(i),u.load(t),u.load(a),u.load(o);const m=[{identifier:"clipboard",controllerConstructor:class extends r{static targets=["source"];static classes=["supported"];connect(){"clipboard"in navigator&&this.element.classList.add(this.supportedClass)}copy(t){t.preventDefault(),navigator.clipboard.writeText(this.sourceTarget.value),this.element.classList.add("copied"),setTimeout(()=>{this.element.classList.remove("copied")},2e3)}}},{identifier:"flash",controllerConstructor:class extends r{close(t){t.target.closest("li").remove(),0===this.element.children.length&&this.element.remove()}}},{identifier:"form-request-submit",controllerConstructor:class extends r{requestSubmit(){this.element.requestSubmit()}}},{identifier:"index-actions",controllerConstructor:class extends r{static targets=["create","search","sort"];initialize(){var t,e;this.update=(t=this,e=this.update,(...s)=>{clearTimeout(t.timer),t.timer=setTimeout(()=>{e.apply(t,...s)},300)})}disconnect(){clearTimeout(this.timer)}create(){this.createTarget.click()}search(){this.searchTarget.focus()}clear(){this.searchTarget.value="",this.searchTarget.closest("form").requestSubmit()}update(){this.searchTarget.closest("form").requestSubmit()}submit(){const t=document.activeElement===this.searchTarget;""===this.searchTarget.value&&(this.searchTarget.disabled=!0),""===this.sortTarget.value&&(this.sortTarget.disabled=!0),Promise.resolve().then(()=>{this.searchTarget.disabled=!1,this.sortTarget.disabled=!1,t&&this.searchTarget.focus()})}}},{identifier:"keyboard",controllerConstructor:class extends r{static values={mapping:String,depth:{type:Number,default:2}};event(t){if(function(t){if(!(t instanceof HTMLElement))return!1;const e=t.nodeName.toLowerCase(),s=(t.getAttribute("type")||"").toLowerCase();return"select"===e||"textarea"===e||"trix-editor"===e||"input"===e&&"submit"!==s&&"reset"!==s&&"checkbox"!==s&&"radio"!==s&&"file"!==s||t.isContentEditable}(t.target)||this.#t(t))return;const e=this.describeEvent(t);this.buffer=[...this.buffer||[],e].slice(0-this.depthValue);const s=this.buffer.reduceRight((t,e)=>"string"==typeof t||void 0===t?t:t[e],this.mappings);if("string"!=typeof s)return;this.buffer=[],t.preventDefault();const r=new CustomEvent(s,{detail:{cause:t},bubbles:!0});t.target.dispatchEvent(r)}describeEvent(t){return[t.ctrlKey&&"C",t.metaKey&&"M",t.altKey&&"A",t.shiftKey&&"S",t.code].filter(t=>t).join("-")}get mappings(){const t=this.mappingValue.replaceAll(/\s+/g," ").split(" ").filter(t=>t.length>0),e={};return t.forEach(t=>this.#e(e,t)),Object.defineProperty(this,"mappings",{value:e,writable:!1}),e}#e(t,e){const[s,r]=e.split("->"),i=s.split("+"),a=i.shift();(t=i.reduceRight((t,e)=>t[e]||={},t))[a]=r}#t(t){switch(t.code){case"ControlLeft":case"ControlRight":case"MetaLeft":case"MetaRight":case"ShiftLeft":case"ShiftRight":case"AltLeft":case"AltRight":return!0;default:return!1}}}},{identifier:"modal",controllerConstructor:class extends r{static targets=["dialog"];connect(){this.element.addEventListener("turbo:submit-end",this.onSubmit)}disconnect(){this.element.removeEventListener("turbo:submit-end",this.onSubmit)}outside(t){"DIALOG"===t.target.tagName&&this.dismiss()}dismiss(){this.dialogTarget&&(this.dialogTarget.open||this.dialogTarget.close(),this.element.removeAttribute("src"),this.dialogTarget.remove())}dialogTargetConnected(t){t.showModal()}onSubmit=t=>{t.detail.success&&"closeDialog"in t.detail.formSubmission?.submitter?.dataset&&(this.dialogTarget.close(),this.element.removeAttribute("src"),this.dialogTarget.remove())}}},{identifier:"navigation",controllerConstructor:class extends r{static targets=["filter"];filter(){const t=this.filterTarget.value;this.clearFilter(t),t.length>0&&this.applyFilter(t)}go(){this.element.querySelector("li:not([hidden]) > a").click()}clear(){0===this.filterTarget.value.length&&this.filterTarget.blur()}applyFilter(t){this.links.filter(e=>!this.prefixSearch(t.toLowerCase(),e.innerText.toLowerCase())).forEach(t=>{t.toggleAttribute("hidden",!0)}),this.menus.filter(t=>!t.matches("li:has(li:not([hidden]) > a)")).forEach(t=>{t.toggleAttribute("hidden",!0)})}clearFilter(t){this.element.querySelectorAll("li").forEach(t=>{t.toggleAttribute("hidden",!1)})}prefixSearch(t,e){const s=e.length,r=t.length;if(r>s)return!1;if(r===s)return t===e;t:for(let i=0,a=0;i<r;i++){const r=t.charCodeAt(i);if(32!==r){for(;a<s;){if(e.charCodeAt(a++)===r)continue t;for(;a<s&&32!==e.charCodeAt(a++););}return!1}for(;a<s&&32!==e.charCodeAt(a++););}return!0}toggle(){this.element.open?this.close():this.open()}open(){this.element.open||this.element.showModal()}close(){this.element.open&&this.element.close()}click(t){t.target===this.element&&this.close()}onMorphAttribute=t=>{if(t.target===this.element&&"open"===t.detail.attributeName)t.preventDefault()};get links(){return Array.from(this.element.querySelectorAll("li:has(> a)"))}get menus(){return Array.from(this.element.querySelectorAll("li:has(> ul)"))}}},{identifier:"navigation-toggle",controllerConstructor:class extends r{trigger(){this.dispatch("toggle",{prefix:"navigation",bubbles:!0})}}},{identifier:"pagy-nav",controllerConstructor:class extends r{connect(){document.addEventListener("shortcut:page-prev",this.prevPage),document.addEventListener("shortcut:page-next",this.nextPage)}disconnect(){document.removeEventListener("shortcut:page-prev",this.prevPage),document.removeEventListener("shortcut:page-next",this.nextPage)}nextPage=()=>{this.element.querySelector("a:last-child").click()};prevPage=()=>{this.element.querySelector("a:first-child").click()}}},{identifier:"show-hide",controllerConstructor:class extends r{static targets=["content"];toggle(){const t=this.contentTarget,e=t.toggleAttribute("data-collapsed");this.transition&&this.transition.cancel();const s=this.transition=new d(t).addCallback("starting",function(){t.setAttribute("data-collapsed-transitioning","true")}).addCallback("complete",function(){t.removeAttribute("data-collapsed-transitioning")});e?s.collapse():s.expand(),s.start()}}},{identifier:"sluggable",controllerConstructor:class extends r{static targets=["source","slug"];static values={slug:String};sourceChanged(t){""===this.slugValue&&(this.slugTarget.value=this.sourceTarget.value.toLowerCase().replace(/'/g,"-").replace(/[^-\w\s]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))}slugChanged(t){this.slugValue=this.slugTarget.value}}},{identifier:"webauthn-authentication",controllerConstructor:class extends r{static targets=["response"];static values={options:Object};authenticate(){n(this.options).then(t=>{this.responseTarget.value=JSON.stringify(t),this.element.requestSubmit()})}get options(){return l(this.optionsValue)}}},{identifier:"webauthn-registration",controllerConstructor:class extends r{static values={options:Object,response:String};static targets=["intro","nickname","response"];submit(t){""===this.responseTarget.value&&"dialog"!==t.submitter.formMethod&&(t.preventDefault(),this.createCredential())}async createCredential(){const t=await c(this.options);this.responseValue=JSON.stringify(t),this.responseTarget.value=JSON.stringify(t)}responseValueChanged(t){const e=""!==t;this.introTarget.toggleAttribute("hidden",e),this.nicknameTarget.toggleAttribute("hidden",!e)}get options(){return h(this.optionsValue)}}}];await import("controllers/hw_combobox_controller").then(({default:t})=>{m.push({identifier:"hw-combobox",controllerConstructor:t})}).catch(()=>null),u.load(m);class f extends HTMLElement{constructor(){super(),this.setAttribute("role","toolbar")}}function b(){document.body.classList.toggle("js-enabled",!0),document.body.classList.toggle("govuk-frontend-supported","noModule"in HTMLScriptElement.prototype),e()}customElements.define("koi-toolbar",f),window.addEventListener("turbo:load",b),window.Turbo&&b();
1
+ import"@hotwired/turbo-rails";import e,{initAll as t}from"@katalyst/govuk-formbuilder";import"@rails/actiontext";import"trix";import{Application as i,Controller as r}from"@hotwired/stimulus";import s from"@katalyst/content";import o from"@katalyst/navigation";import n from"@katalyst/tables";import{get as a,parseRequestOptionsFromJSON as l,create as c,parseCreationOptionsFromJSON as u}from"@github/webauthn-json/browser-ponyfill";const h=i.start();h.load(s),h.load(e),h.load(o),h.load(n);const d=[{identifier:"clipboard",controllerConstructor:class extends r{static targets=["source"];static classes=["supported"];connect(){"clipboard"in navigator&&this.element.classList.add(this.supportedClass)}copy(e){e.preventDefault(),navigator.clipboard.writeText(this.sourceTarget.value),this.element.classList.add("copied"),setTimeout(()=>{this.element.classList.remove("copied")},2e3)}}},{identifier:"flash",controllerConstructor:class extends r{close(e){e.target.closest("li").remove(),0===this.element.children.length&&this.element.remove()}}},{identifier:"keyboard",controllerConstructor:class extends r{static values={mapping:String,depth:{type:Number,default:2}};event(e){if(function(e){if(!(e instanceof HTMLElement))return!1;const t=e.nodeName.toLowerCase(),i=(e.getAttribute("type")||"").toLowerCase();return"select"===t||"textarea"===t||"trix-editor"===t||"input"===t&&"submit"!==i&&"reset"!==i&&"checkbox"!==i&&"radio"!==i&&"file"!==i||e.isContentEditable}(e.target)||this.#e(e))return;const t=this.describeEvent(e);this.buffer=[...this.buffer||[],t].slice(0-this.depthValue);const i=this.buffer.reduceRight((e,t)=>"string"==typeof e||void 0===e?e:e[t],this.mappings);if("string"!=typeof i)return;this.buffer=[],e.preventDefault();const r=new CustomEvent(i,{detail:{cause:e},bubbles:!0});e.target.dispatchEvent(r)}describeEvent(e){return[e.ctrlKey&&"C",e.metaKey&&"M",e.altKey&&"A",e.shiftKey&&"S",e.code].filter(e=>e).join("-")}get mappings(){const e=this.mappingValue.replaceAll(/\s+/g," ").split(" ").filter(e=>e.length>0),t={};return e.forEach(e=>this.#t(t,e)),Object.defineProperty(this,"mappings",{value:t,writable:!1}),t}#t(e,t){const[i,r]=t.split("->"),s=i.split("+"),o=s.shift();(e=s.reduceRight((e,t)=>e[t]||={},e))[o]=r}#e(e){switch(e.code){case"ControlLeft":case"ControlRight":case"MetaLeft":case"MetaRight":case"ShiftLeft":case"ShiftRight":case"AltLeft":case"AltRight":return!0;default:return!1}}}},{identifier:"modal",controllerConstructor:class extends r{static targets=["dialog"];connect(){this.element.addEventListener("turbo:submit-end",this.onSubmit)}disconnect(){this.element.removeEventListener("turbo:submit-end",this.onSubmit)}outside(e){"DIALOG"===e.target.tagName&&this.dismiss()}dismiss(){this.dialogTarget&&(this.dialogTarget.open||this.dialogTarget.close(),this.element.removeAttribute("src"),this.dialogTarget.remove())}dialogTargetConnected(e){e.showModal()}onSubmit=e=>{e.detail.success&&"closeDialog"in e.detail.formSubmission?.submitter?.dataset&&(this.dialogTarget.close(),this.element.removeAttribute("src"),this.dialogTarget.remove())}}},{identifier:"navigation",controllerConstructor:class extends r{static targets=["filter"];filter(){const e=this.filterTarget.value;this.clearFilter(e),e.length>0&&this.applyFilter(e)}go(){this.element.querySelector("li:not([hidden]) > a").click()}clear(){0===this.filterTarget.value.length&&this.filterTarget.blur()}applyFilter(e){this.links.filter(t=>!this.prefixSearch(e.toLowerCase(),t.innerText.toLowerCase())).forEach(e=>{e.toggleAttribute("hidden",!0)}),this.menus.filter(e=>!e.matches("li:has(li:not([hidden]) > a)")).forEach(e=>{e.toggleAttribute("hidden",!0)})}clearFilter(e){this.element.querySelectorAll("li").forEach(e=>{e.toggleAttribute("hidden",!1)})}prefixSearch(e,t){const i=t.length,r=e.length;if(r>i)return!1;if(r===i)return e===t;e:for(let s=0,o=0;s<r;s++){const r=e.charCodeAt(s);if(32!==r){for(;o<i;){if(t.charCodeAt(o++)===r)continue e;for(;o<i&&32!==t.charCodeAt(o++););}return!1}for(;o<i&&32!==t.charCodeAt(o++););}return!0}toggle(){this.element.open?this.close():this.open()}open(){this.element.open||this.element.showModal()}close(){this.element.open&&this.element.close()}click(e){e.target===this.element&&this.close()}onMorphAttribute=e=>{if(e.target===this.element&&"open"===e.detail.attributeName)e.preventDefault()};get links(){return Array.from(this.element.querySelectorAll("li:has(> a)"))}get menus(){return Array.from(this.element.querySelectorAll("li:has(> ul)"))}}},{identifier:"navigation-toggle",controllerConstructor:class extends r{trigger(){this.dispatch("toggle",{prefix:"navigation",bubbles:!0})}}},{identifier:"pagy-nav",controllerConstructor:class extends r{connect(){document.addEventListener("shortcut:page-prev",this.prevPage),document.addEventListener("shortcut:page-next",this.nextPage)}disconnect(){document.removeEventListener("shortcut:page-prev",this.prevPage),document.removeEventListener("shortcut:page-next",this.nextPage)}nextPage=()=>{this.element.querySelector("a:last-child").click()};prevPage=()=>{this.element.querySelector("a:first-child").click()}}},{identifier:"sluggable",controllerConstructor:class extends r{static targets=["source","slug"];static values={slug:String};sourceChanged(e){""===this.slugValue&&(this.slugTarget.value=this.sourceTarget.value.toLowerCase().replace(/'/g,"-").replace(/[^-\w\s]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))}slugChanged(e){this.slugValue=this.slugTarget.value}}},{identifier:"webauthn-authentication",controllerConstructor:class extends r{static targets=["response"];static values={options:Object};authenticate(){a(this.options).then(e=>{this.responseTarget.value=JSON.stringify(e),this.element.requestSubmit()})}get options(){return l(this.optionsValue)}}},{identifier:"webauthn-registration",controllerConstructor:class extends r{static values={options:Object,response:String};static targets=["intro","nickname","response"];submit(e){""===this.responseTarget.value&&"dialog"!==e.submitter.formMethod&&(e.preventDefault(),this.createCredential())}async createCredential(){const e=await c(this.options);this.responseValue=JSON.stringify(e),this.responseTarget.value=JSON.stringify(e)}responseValueChanged(e){const t=""!==e;this.introTarget.toggleAttribute("hidden",t),this.nicknameTarget.toggleAttribute("hidden",!t)}get options(){return u(this.optionsValue)}}}];await import("controllers/hw_combobox_controller").then(({default:e})=>{d.push({identifier:"hw-combobox",controllerConstructor:e})}).catch(()=>null),h.load(d);class g extends HTMLElement{constructor(){super(),this.setAttribute("role","toolbar")}}function p(){document.body.classList.toggle("js-enabled",!0),document.body.classList.toggle("govuk-frontend-supported","noModule"in HTMLScriptElement.prototype),t()}customElements.define("koi-toolbar",g),window.addEventListener("turbo:load",p),window.Turbo&&p();
2
2
  //# sourceMappingURL=koi.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"koi.min.js","sources":["../../../javascript/koi/controllers/application.js","../../../javascript/koi/utils/transition.js","../../../javascript/koi/controllers/index.js","../../../javascript/koi/controllers/clipboard_controller.js","../../../javascript/koi/controllers/flash_controller.js","../../../javascript/koi/controllers/form_request_submit_controller.js","../../../javascript/koi/controllers/index_actions_controller.js","../../../javascript/koi/controllers/keyboard_controller.js","../../../javascript/koi/controllers/modal_controller.js","../../../javascript/koi/controllers/navigation_controller.js","../../../javascript/koi/controllers/navigation_toggle_controller.js","../../../javascript/koi/controllers/pagy_nav_controller.js","../../../javascript/koi/controllers/show_hide_controller.js","../../../javascript/koi/controllers/sluggable_controller.js","../../../javascript/koi/controllers/webauthn_authentication_controller.js","../../../javascript/koi/controllers/webauthn_registration_controller.js","../../../javascript/koi/elements/toolbar.js","../../../javascript/koi/application.js"],"sourcesContent":["import { Application } from \"@hotwired/stimulus\";\n\nconst application = Application.start();\n\nexport { application };\n","const DEFAULT_DELAY = 250;\n\n/**\n * A utility class for managing CSS transition animations.\n *\n * Transition uses Javascript timers to track state instead of relying on\n * CSS transition events, which is a more complicated API. Please call `cancel`\n * when the node being animated is detached from the DOM to avoid unexpected\n * errors or animation glitches.\n *\n * Transition assumes that CSS already specifies styles to achieve the expected\n * start and end states. Transition adds temporary overrides and then animates\n * between those values using CSS transitions. For example, to use the collapse\n * transition:\n *\n * @example\n * // CSS:\n * target {\n * max-height: unset;\n * overflow: 0;\n * }\n * target.hidden {\n * max-height: 0;\n * }\n *\n * @example\n * // Javascript\n * target.addClass(\"hidden\");\n * new Transition(target).collapse().start();\n */\nclass Transition {\n constructor(target, options) {\n const { delay } = this._setDefaults(options);\n\n this.target = target;\n this.runner = new Runner(this, delay);\n this.properties = [];\n\n this.startingCallbacks = [];\n this.startedCallbacks = [];\n this.completeCallbacks = [];\n }\n\n add(property) {\n this.properties.push(property);\n return this;\n }\n\n /** Adds callback for transition events */\n addCallback(type, callback) {\n switch (type) {\n case \"starting\":\n this.startingCallbacks.push(callback);\n break;\n case \"started\":\n this.startedCallbacks.push(callback);\n break;\n case \"complete\":\n this.completeCallbacks.push(callback);\n break;\n }\n return this;\n }\n\n /** Collapse an element in place, assumes overflow is set appropriately, margin is not collapsed */\n collapse() {\n return this.add(\n new PropertyTransition(\n \"max-height\",\n `${this.target.scrollHeight}px`,\n \"0px\",\n ),\n );\n }\n\n /** Restore a collapsed element */\n expand() {\n return this.add(\n new PropertyTransition(\n \"max-height\",\n \"0px\",\n `${this.target.scrollHeight}px`,\n ),\n );\n }\n\n /** Slide an element left or right by its scroll width, assumes position relative */\n slideOut(direction) {\n return this.add(\n new PropertyTransition(direction, \"0px\", `-${this.target.scrollWidth}px`),\n );\n }\n\n /** Restore an element that has been slid */\n slideIn(direction) {\n return this.add(\n new PropertyTransition(direction, `-${this.target.scrollWidth}px`, \"0px\"),\n );\n }\n\n /** Cause an element to become transparent by transforming opacity */\n fadeOut() {\n return this.add(new PropertyTransition(\"opacity\", \"100%\", \"0%\"));\n }\n\n /** Cause a transparent element to become visible again */\n fadeIn() {\n return this.add(new PropertyTransition(\"opacity\", \"0%\", \"100%\"));\n }\n\n start(callback = null) {\n // start the runner on next tick so that any side-effects of the current execution can occur first\n requestAnimationFrame(() => {\n this.runner.start(this.target);\n if (callback) callback();\n });\n return this;\n }\n\n cancel() {\n this.runner.stop(this.target);\n return this;\n }\n\n _starting() {\n const event = new Event(\"transition:starting\");\n this.startingCallbacks.forEach((cb) => cb(event));\n this.target.dispatchEvent(event);\n }\n\n _started() {\n const event = new Event(\"transition:started\");\n this.startedCallbacks.forEach((cb) => cb(event));\n this.target.dispatchEvent(event);\n }\n\n _complete() {\n const event = new Event(\"transition:complete\");\n this.completeCallbacks.forEach((cb) => cb(event));\n this.target.dispatchEvent(event);\n }\n\n _setDefaults(options) {\n return Object.assign({ delay: DEFAULT_DELAY }, options);\n }\n}\n\n/**\n * Encapsulates internal execution and timing functionality for `Transition`\n */\nclass Runner {\n constructor(transition, delay) {\n this.transition = transition;\n this.running = null;\n this.delay = delay;\n }\n\n start(target) {\n // 1. Set the initial state(s)\n this.transition.properties.forEach((t) => t.onStarting(target));\n\n // 2. On next update, set transition and final state(s)\n requestAnimationFrame(() => this.onStarted(target));\n\n // 3. After transition has finished, clean up\n this.running = setTimeout(() => this.stop(target, true), this.delay);\n\n this.transition._starting();\n }\n\n onStarted(target) {\n target.style.transitionProperty = this.transition.properties\n .map((t) => t.property)\n .join(\",\");\n target.style.transitionDuration = `${this.delay}ms`;\n this.transition.properties.forEach((t) => t.onStarted(target));\n\n this.transition._started();\n }\n\n stop(target, timeout = false) {\n if (!this.running) return;\n if (!timeout) clearTimeout(this.running);\n\n this.running = null;\n\n target.style.removeProperty(\"transition-property\");\n target.style.removeProperty(\"transition-duration\");\n this.transition.properties.forEach((t) => t.onComplete(target));\n\n this.transition._complete();\n }\n}\n\n/**\n * Represents animation of a single CSS property. Currently only CSS animations\n * are supported, but this could be a natural extension point for Javascript\n * animations in the future.\n */\nclass PropertyTransition {\n constructor(property, from, to) {\n this.property = property;\n this.from = from;\n this.to = to;\n }\n\n onStarting(target) {\n target.style.setProperty(this.property, this.from);\n }\n\n onStarted(target) {\n target.style.setProperty(this.property, this.to);\n }\n\n onComplete(target) {\n target.style.removeProperty(this.property);\n }\n}\n\nexport { Transition };\n","import { application } from \"./application\";\n\nimport content from \"@katalyst/content\";\napplication.load(content);\n\nimport govuk from \"@katalyst/govuk-formbuilder\";\napplication.load(govuk);\n\nimport navigation from \"@katalyst/navigation\";\napplication.load(navigation);\n\nimport tables from \"@katalyst/tables\";\napplication.load(tables);\n\nimport ClipboardController from \"./clipboard_controller\";\nimport FlashController from \"./flash_controller\";\nimport FormRequestSubmitController from \"./form_request_submit_controller\";\nimport IndexActionsController from \"./index_actions_controller\";\nimport KeyboardController from \"./keyboard_controller\";\nimport ModalController from \"./modal_controller\";\nimport NavigationController from \"./navigation_controller\";\nimport NavigationToggleController from \"./navigation_toggle_controller\";\nimport PagyNavController from \"./pagy_nav_controller\";\nimport ShowHideController from \"./show_hide_controller\";\nimport SluggableController from \"./sluggable_controller\";\nimport WebauthnAuthenticationController from \"./webauthn_authentication_controller\";\nimport WebauthnRegistrationController from \"./webauthn_registration_controller\";\n\nconst Definitions = [\n {\n identifier: \"clipboard\",\n controllerConstructor: ClipboardController,\n },\n {\n identifier: \"flash\",\n controllerConstructor: FlashController,\n },\n {\n identifier: \"form-request-submit\",\n controllerConstructor: FormRequestSubmitController,\n },\n {\n identifier: \"index-actions\",\n controllerConstructor: IndexActionsController,\n },\n {\n identifier: \"keyboard\",\n controllerConstructor: KeyboardController,\n },\n {\n identifier: \"modal\",\n controllerConstructor: ModalController,\n },\n {\n identifier: \"navigation\",\n controllerConstructor: NavigationController,\n },\n {\n identifier: \"navigation-toggle\",\n controllerConstructor: NavigationToggleController,\n },\n {\n identifier: \"pagy-nav\",\n controllerConstructor: PagyNavController,\n },\n {\n identifier: \"show-hide\",\n controllerConstructor: ShowHideController,\n },\n {\n identifier: \"sluggable\",\n controllerConstructor: SluggableController,\n },\n {\n identifier: \"webauthn-authentication\",\n controllerConstructor: WebauthnAuthenticationController,\n },\n {\n identifier: \"webauthn-registration\",\n controllerConstructor: WebauthnRegistrationController,\n },\n];\n\n// dynamically attempt to load hw_combobox_controller, this is an optional dependency\nawait import(\"controllers/hw_combobox_controller\")\n .then(({ default: HwComboboxController }) => {\n Definitions.push({\n identifier: \"hw-combobox\",\n controllerConstructor: HwComboboxController,\n });\n })\n .catch(() => null);\n\napplication.load(Definitions);\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class ClipboardController extends Controller {\n static targets = [\"source\"];\n\n static classes = [\"supported\"];\n\n connect() {\n if (\"clipboard\" in navigator) {\n this.element.classList.add(this.supportedClass);\n }\n }\n\n copy(event) {\n event.preventDefault();\n navigator.clipboard.writeText(this.sourceTarget.value);\n\n this.element.classList.add(\"copied\");\n setTimeout(() => {\n this.element.classList.remove(\"copied\");\n }, 2000);\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class FlashController extends Controller {\n close(e) {\n e.target.closest(\"li\").remove();\n\n // remove the flash container if there are no more flashes\n if (this.element.children.length === 0) {\n this.element.remove();\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\n/**\n A stimulus controller to request form submissions.\n This controller should be attached to a form element.\n */\nexport default class FormRequestSubmitController extends Controller {\n requestSubmit() {\n this.element.requestSubmit();\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class IndexActionsController extends Controller {\n static targets = [\"create\", \"search\", \"sort\"];\n\n initialize() {\n // debounce search\n this.update = debounce(this, this.update);\n }\n\n disconnect() {\n clearTimeout(this.timer);\n }\n\n create() {\n this.createTarget.click();\n }\n\n search() {\n this.searchTarget.focus();\n }\n\n clear() {\n this.searchTarget.value = \"\";\n this.searchTarget.closest(\"form\").requestSubmit();\n }\n\n update() {\n this.searchTarget.closest(\"form\").requestSubmit();\n }\n\n submit() {\n const shouldFocus = document.activeElement === this.searchTarget;\n\n if (this.searchTarget.value === \"\") {\n this.searchTarget.disabled = true;\n }\n if (this.sortTarget.value === \"\") {\n this.sortTarget.disabled = true;\n }\n\n // restore state and focus after submit\n Promise.resolve().then(() => {\n this.searchTarget.disabled = false;\n this.sortTarget.disabled = false;\n if (shouldFocus) {\n this.searchTarget.focus();\n }\n });\n }\n}\n\nfunction debounce(self, f) {\n return (...args) => {\n clearTimeout(self.timer);\n self.timer = setTimeout(() => {\n f.apply(self, ...args);\n }, 300);\n };\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nconst DEBUG = false;\n\nexport default class KeyboardController extends Controller {\n static values = {\n mapping: String,\n depth: { type: Number, default: 2 },\n };\n\n event(cause) {\n if (isFormField(cause.target) || this.#ignore(cause)) return;\n\n const key = this.describeEvent(cause);\n\n this.buffer = [...(this.buffer || []), key].slice(0 - this.depthValue);\n\n if (DEBUG) console.debug(\"[keyboard] buffer:\", ...this.buffer);\n\n // test whether the tail of the buffer matches any of the configured chords\n const action = this.buffer.reduceRight((mapping, key) => {\n if (typeof mapping === \"string\" || typeof mapping === \"undefined\") {\n return mapping;\n } else {\n return mapping[key];\n }\n }, this.mappings);\n\n // if we don't have a string we may have a miss or an incomplete chord\n if (typeof action !== \"string\") return;\n\n // clear the buffer and prevent the key from being consumed elsewhere\n this.buffer = [];\n cause.preventDefault();\n\n if (DEBUG) console.debug(\"[keyboard] event: %s\", action);\n\n // fire the configured event\n const event = new CustomEvent(action, {\n detail: { cause: cause },\n bubbles: true,\n });\n cause.target.dispatchEvent(event);\n }\n\n /**\n * @param event KeyboardEvent input event to describe\n * @return String description of keyboard event, e.g. 'C-KeyV' (CTRL+V)\n */\n describeEvent(event) {\n return [\n event.ctrlKey && \"C\",\n event.metaKey && \"M\",\n event.altKey && \"A\",\n event.shiftKey && \"S\",\n event.code,\n ]\n .filter((w) => w)\n .join(\"-\");\n }\n\n /**\n * Build a tree for efficiently looking up key chords, where the last key in the sequence\n * is the first key in tree.\n */\n get mappings() {\n const inputs = this.mappingValue\n .replaceAll(/\\s+/g, \" \")\n .split(\" \")\n .filter((f) => f.length > 0);\n const mappings = {};\n\n inputs.forEach((mapping) => this.#parse(mappings, mapping));\n\n // memoize the result\n Object.defineProperty(this, \"mappings\", {\n value: mappings,\n writable: false,\n });\n\n return mappings;\n }\n\n /**\n * Parse a key chord pattern and an event and store it in the inverted tree lookup structure.\n *\n * @param mappings inverted tree lookup for key chords\n * @param mapping input definition, e.g. \"C-KeyC+C-KeyV->paste\"\n */\n #parse(mappings, mapping) {\n const [pattern, event] = mapping.split(\"->\");\n const keys = pattern.split(\"+\");\n const first = keys.shift();\n\n mappings = keys.reduceRight(\n (mappings, key) => (mappings[key] ||= {}),\n mappings,\n );\n mappings[first] = event;\n }\n\n /**\n * Ignore modifier keys, as they will be captured in normal key presses.\n *\n * @param event KeyboardEvent\n * @returns {boolean} true if key event should be ignored\n */\n #ignore(event) {\n switch (event.code) {\n case \"ControlLeft\":\n case \"ControlRight\":\n case \"MetaLeft\":\n case \"MetaRight\":\n case \"ShiftLeft\":\n case \"ShiftRight\":\n case \"AltLeft\":\n case \"AltRight\":\n return true;\n default:\n return false;\n }\n }\n}\n\n/**\n * Detect input nodes where we should not listen for events.\n *\n * Credit: github.com\n */\nfunction isFormField(element) {\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n\n const name = element.nodeName.toLowerCase();\n const type = (element.getAttribute(\"type\") || \"\").toLowerCase();\n return (\n name === \"select\" ||\n name === \"textarea\" ||\n name === \"trix-editor\" ||\n (name === \"input\" &&\n type !== \"submit\" &&\n type !== \"reset\" &&\n type !== \"checkbox\" &&\n type !== \"radio\" &&\n type !== \"file\") ||\n element.isContentEditable\n );\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class ModalController extends Controller {\n static targets = [\"dialog\"];\n\n connect() {\n this.element.addEventListener(\"turbo:submit-end\", this.onSubmit);\n }\n\n disconnect() {\n this.element.removeEventListener(\"turbo:submit-end\", this.onSubmit);\n }\n\n outside(e) {\n if (e.target.tagName === \"DIALOG\") this.dismiss();\n }\n\n dismiss() {\n if (!this.dialogTarget) return;\n if (!this.dialogTarget.open) this.dialogTarget.close();\n\n this.element.removeAttribute(\"src\");\n this.dialogTarget.remove();\n }\n\n dialogTargetConnected(dialog) {\n dialog.showModal();\n }\n\n onSubmit = (event) => {\n if (\n event.detail.success &&\n \"closeDialog\" in event.detail.formSubmission?.submitter?.dataset\n ) {\n this.dialogTarget.close();\n this.element.removeAttribute(\"src\");\n this.dialogTarget.remove();\n }\n };\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class NavigationController extends Controller {\n static targets = [\"filter\"];\n\n filter() {\n const filter = this.filterTarget.value;\n this.clearFilter(filter);\n\n if (filter.length > 0) {\n this.applyFilter(filter);\n }\n }\n\n go() {\n this.element.querySelector(\"li:not([hidden]) > a\").click();\n }\n\n clear() {\n if (this.filterTarget.value.length === 0) this.filterTarget.blur();\n }\n\n applyFilter(filter) {\n // hide items that don't match the search filter\n this.links\n .filter(\n (li) =>\n !this.prefixSearch(filter.toLowerCase(), li.innerText.toLowerCase()),\n )\n .forEach((li) => {\n li.toggleAttribute(\"hidden\", true);\n });\n\n this.menus\n .filter((li) => !li.matches(\"li:has(li:not([hidden]) > a)\"))\n .forEach((li) => {\n li.toggleAttribute(\"hidden\", true);\n });\n }\n\n clearFilter(filter) {\n this.element.querySelectorAll(\"li\").forEach((li) => {\n li.toggleAttribute(\"hidden\", false);\n });\n }\n\n prefixSearch(needle, haystack) {\n const haystackLength = haystack.length;\n const needleLength = needle.length;\n if (needleLength > haystackLength) {\n return false;\n }\n if (needleLength === haystackLength) {\n return needle === haystack;\n }\n outer: for (let i = 0, j = 0; i < needleLength; i++) {\n const needleChar = needle.charCodeAt(i);\n if (needleChar === 32) {\n // skip ahead to next space in the haystack\n while (j < haystackLength && haystack.charCodeAt(j++) !== 32) {}\n continue;\n }\n while (j < haystackLength) {\n if (haystack.charCodeAt(j++) === needleChar) continue outer;\n // skip ahead to the next space in the haystack\n while (j < haystackLength && haystack.charCodeAt(j++) !== 32) {}\n }\n return false;\n }\n return true;\n }\n\n toggle() {\n this.element.open ? this.close() : this.open();\n }\n\n open() {\n if (!this.element.open) this.element.showModal();\n }\n\n close() {\n if (this.element.open) this.element.close();\n }\n\n click(e) {\n if (e.target === this.element) this.close();\n }\n\n onMorphAttribute = (e) => {\n if (e.target !== this.element) return;\n\n switch (e.detail.attributeName) {\n case \"open\":\n e.preventDefault();\n }\n };\n\n get links() {\n return Array.from(this.element.querySelectorAll(\"li:has(> a)\"));\n }\n\n get menus() {\n return Array.from(this.element.querySelectorAll(\"li:has(> ul)\"));\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class NavigationToggleController extends Controller {\n trigger() {\n this.dispatch(\"toggle\", { prefix: \"navigation\", bubbles: true });\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class PagyNavController extends Controller {\n connect() {\n document.addEventListener(\"shortcut:page-prev\", this.prevPage);\n document.addEventListener(\"shortcut:page-next\", this.nextPage);\n }\n\n disconnect() {\n document.removeEventListener(\"shortcut:page-prev\", this.prevPage);\n document.removeEventListener(\"shortcut:page-next\", this.nextPage);\n }\n\n nextPage = () => {\n this.element.querySelector(\"a:last-child\").click();\n };\n\n prevPage = () => {\n this.element.querySelector(\"a:first-child\").click();\n };\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { Transition } from \"../utils/transition\";\n\nexport default class ShowHideController extends Controller {\n static targets = [\"content\"];\n\n toggle() {\n const element = this.contentTarget;\n const hide = element.toggleAttribute(\"data-collapsed\");\n\n // cancel previous animation, if any\n if (this.transition) this.transition.cancel();\n\n const transition = (this.transition = new Transition(element)\n .addCallback(\"starting\", function () {\n element.setAttribute(\"data-collapsed-transitioning\", \"true\");\n })\n .addCallback(\"complete\", function () {\n element.removeAttribute(\"data-collapsed-transitioning\");\n }));\n hide ? transition.collapse() : transition.expand();\n\n transition.start();\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\n/**\n * Connect an input (e.g. title) to slug.\n */\nexport default class SluggableController extends Controller {\n static targets = [\"source\", \"slug\"];\n static values = {\n slug: String,\n };\n\n sourceChanged(e) {\n if (this.slugValue === \"\") {\n this.slugTarget.value = parameterize(this.sourceTarget.value);\n }\n }\n\n slugChanged(e) {\n this.slugValue = this.slugTarget.value;\n }\n}\n\nfunction parameterize(input) {\n return input\n .toLowerCase()\n .replace(/'/g, \"-\")\n .replace(/[^-\\w\\s]/g, \"\")\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/(^-|-$)/g, \"\");\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nimport {\n get,\n parseRequestOptionsFromJSON,\n} from \"@github/webauthn-json/browser-ponyfill\";\n\nexport default class WebauthnAuthenticationController extends Controller {\n static targets = [\"response\"];\n static values = { options: Object };\n\n authenticate() {\n get(this.options).then((response) => {\n this.responseTarget.value = JSON.stringify(response);\n\n this.element.requestSubmit();\n });\n }\n\n get options() {\n return parseRequestOptionsFromJSON(this.optionsValue);\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nimport {\n create,\n parseCreationOptionsFromJSON,\n} from \"@github/webauthn-json/browser-ponyfill\";\n\nexport default class WebauthnRegistrationController extends Controller {\n static values = {\n options: Object,\n response: String,\n };\n static targets = [\"intro\", \"nickname\", \"response\"];\n\n submit(e) {\n if (\n this.responseTarget.value === \"\" &&\n e.submitter.formMethod !== \"dialog\"\n ) {\n e.preventDefault();\n this.createCredential();\n }\n }\n\n async createCredential() {\n const response = await create(this.options);\n\n this.responseValue = JSON.stringify(response);\n this.responseTarget.value = JSON.stringify(response);\n }\n\n responseValueChanged(response) {\n const responsePresent = response !== \"\";\n this.introTarget.toggleAttribute(\"hidden\", responsePresent);\n this.nicknameTarget.toggleAttribute(\"hidden\", !responsePresent);\n }\n\n get options() {\n return parseCreationOptionsFromJSON(this.optionsValue);\n }\n}\n","class KoiToolbarElement extends HTMLElement {\n constructor() {\n super();\n\n this.setAttribute(\"role\", \"toolbar\");\n }\n}\n\ncustomElements.define(\"koi-toolbar\", KoiToolbarElement);\n","import \"@hotwired/turbo-rails\";\nimport { initAll } from \"@katalyst/govuk-formbuilder\";\nimport \"@rails/actiontext\";\nimport \"trix\";\n\nimport \"./controllers\";\nimport \"./elements\";\n\n/** Initialize GOVUK */\nfunction initGOVUK() {\n document.body.classList.toggle(\"js-enabled\", true);\n document.body.classList.toggle(\n \"govuk-frontend-supported\",\n \"noModule\" in HTMLScriptElement.prototype,\n );\n initAll();\n}\n\nwindow.addEventListener(\"turbo:load\", initGOVUK);\nif (window.Turbo) initGOVUK();\n"],"names":["application","Application","start","Transition","constructor","target","options","delay","this","_setDefaults","runner","Runner","properties","startingCallbacks","startedCallbacks","completeCallbacks","add","property","push","addCallback","type","callback","collapse","PropertyTransition","scrollHeight","expand","slideOut","direction","scrollWidth","slideIn","fadeOut","fadeIn","requestAnimationFrame","cancel","stop","_starting","event","Event","forEach","cb","dispatchEvent","_started","_complete","Object","assign","transition","running","t","onStarting","onStarted","setTimeout","style","transitionProperty","map","join","transitionDuration","timeout","clearTimeout","removeProperty","onComplete","from","to","setProperty","load","content","govuk","navigation","tables","Definitions","identifier","controllerConstructor","Controller","static","connect","navigator","element","classList","supportedClass","copy","preventDefault","clipboard","writeText","sourceTarget","value","remove","close","e","closest","children","length","requestSubmit","initialize","self","f","update","args","timer","apply","disconnect","create","createTarget","click","search","searchTarget","focus","clear","submit","shouldFocus","document","activeElement","disabled","sortTarget","Promise","resolve","then","mapping","String","depth","Number","default","cause","HTMLElement","name","nodeName","toLowerCase","getAttribute","isContentEditable","isFormField","ignore","key","describeEvent","buffer","slice","depthValue","action","reduceRight","mappings","CustomEvent","detail","bubbles","ctrlKey","metaKey","altKey","shiftKey","code","filter","w","inputs","mappingValue","replaceAll","split","parse","defineProperty","writable","pattern","keys","first","shift","addEventListener","onSubmit","removeEventListener","outside","tagName","dismiss","dialogTarget","open","removeAttribute","dialogTargetConnected","dialog","showModal","success","formSubmission","submitter","dataset","filterTarget","clearFilter","applyFilter","go","querySelector","blur","links","li","prefixSearch","innerText","toggleAttribute","menus","matches","querySelectorAll","needle","haystack","haystackLength","needleLength","outer","i","j","needleChar","charCodeAt","toggle","onMorphAttribute","attributeName","Array","trigger","dispatch","prefix","prevPage","nextPage","contentTarget","hide","setAttribute","slug","sourceChanged","slugValue","slugTarget","replace","slugChanged","authenticate","get","response","responseTarget","JSON","stringify","parseRequestOptionsFromJSON","optionsValue","formMethod","createCredential","responseValue","responseValueChanged","responsePresent","introTarget","nicknameTarget","parseCreationOptionsFromJSON","import","HwComboboxController","catch","KoiToolbarElement","super","initGOVUK","body","HTMLScriptElement","prototype","initAll","customElements","define","window","Turbo"],"mappings":"gbAEA,MAAMA,EAAcC,EAAYC,QC4BhC,MAAMC,EACJ,WAAAC,CAAYC,EAAQC,GAClB,MAAMC,MAAEA,GAAUC,KAAKC,aAAaH,GAEpCE,KAAKH,OAASA,EACdG,KAAK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ElCC,GACF,CDRAC,eAAeC,OAAO,cAAeR,GCUrCS,OAAOrF,iBAAiB,aAAc8E,GAClCO,OAAOC,OAAOR"}
1
+ {"version":3,"file":"koi.min.js","sources":["../../../javascript/koi/controllers/application.js","../../../javascript/koi/controllers/index.js","../../../javascript/koi/controllers/clipboard_controller.js","../../../javascript/koi/controllers/flash_controller.js","../../../javascript/koi/controllers/keyboard_controller.js","../../../javascript/koi/controllers/modal_controller.js","../../../javascript/koi/controllers/navigation_controller.js","../../../javascript/koi/controllers/navigation_toggle_controller.js","../../../javascript/koi/controllers/pagy_nav_controller.js","../../../javascript/koi/controllers/sluggable_controller.js","../../../javascript/koi/controllers/webauthn_authentication_controller.js","../../../javascript/koi/controllers/webauthn_registration_controller.js","../../../javascript/koi/elements/toolbar.js","../../../javascript/koi/application.js"],"sourcesContent":["import { Application } from \"@hotwired/stimulus\";\n\nconst application = Application.start();\n\nexport { application };\n","import { application } from \"./application\";\n\nimport content from \"@katalyst/content\";\napplication.load(content);\n\nimport govuk from \"@katalyst/govuk-formbuilder\";\napplication.load(govuk);\n\nimport navigation from \"@katalyst/navigation\";\napplication.load(navigation);\n\nimport tables from \"@katalyst/tables\";\napplication.load(tables);\n\nimport ClipboardController from \"./clipboard_controller\";\nimport FlashController from \"./flash_controller\";\nimport KeyboardController from \"./keyboard_controller\";\nimport ModalController from \"./modal_controller\";\nimport NavigationController from \"./navigation_controller\";\nimport NavigationToggleController from \"./navigation_toggle_controller\";\nimport PagyNavController from \"./pagy_nav_controller\";\nimport SluggableController from \"./sluggable_controller\";\nimport WebauthnAuthenticationController from \"./webauthn_authentication_controller\";\nimport WebauthnRegistrationController from \"./webauthn_registration_controller\";\n\nconst Definitions = [\n {\n identifier: \"clipboard\",\n controllerConstructor: ClipboardController,\n },\n {\n identifier: \"flash\",\n controllerConstructor: FlashController,\n },\n {\n identifier: \"keyboard\",\n controllerConstructor: KeyboardController,\n },\n {\n identifier: \"modal\",\n controllerConstructor: ModalController,\n },\n {\n identifier: \"navigation\",\n controllerConstructor: NavigationController,\n },\n {\n identifier: \"navigation-toggle\",\n controllerConstructor: NavigationToggleController,\n },\n {\n identifier: \"pagy-nav\",\n controllerConstructor: PagyNavController,\n },\n {\n identifier: \"sluggable\",\n controllerConstructor: SluggableController,\n },\n {\n identifier: \"webauthn-authentication\",\n controllerConstructor: WebauthnAuthenticationController,\n },\n {\n identifier: \"webauthn-registration\",\n controllerConstructor: WebauthnRegistrationController,\n },\n];\n\n// dynamically attempt to load hw_combobox_controller, this is an optional dependency\nawait import(\"controllers/hw_combobox_controller\")\n .then(({ default: HwComboboxController }) => {\n Definitions.push({\n identifier: \"hw-combobox\",\n controllerConstructor: HwComboboxController,\n });\n })\n .catch(() => null);\n\napplication.load(Definitions);\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class ClipboardController extends Controller {\n static targets = [\"source\"];\n\n static classes = [\"supported\"];\n\n connect() {\n if (\"clipboard\" in navigator) {\n this.element.classList.add(this.supportedClass);\n }\n }\n\n copy(event) {\n event.preventDefault();\n navigator.clipboard.writeText(this.sourceTarget.value);\n\n this.element.classList.add(\"copied\");\n setTimeout(() => {\n this.element.classList.remove(\"copied\");\n }, 2000);\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class FlashController extends Controller {\n close(e) {\n e.target.closest(\"li\").remove();\n\n // remove the flash container if there are no more flashes\n if (this.element.children.length === 0) {\n this.element.remove();\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nconst DEBUG = false;\n\nexport default class KeyboardController extends Controller {\n static values = {\n mapping: String,\n depth: { type: Number, default: 2 },\n };\n\n event(cause) {\n if (isFormField(cause.target) || this.#ignore(cause)) return;\n\n const key = this.describeEvent(cause);\n\n this.buffer = [...(this.buffer || []), key].slice(0 - this.depthValue);\n\n if (DEBUG) console.debug(\"[keyboard] buffer:\", ...this.buffer);\n\n // test whether the tail of the buffer matches any of the configured chords\n const action = this.buffer.reduceRight((mapping, key) => {\n if (typeof mapping === \"string\" || typeof mapping === \"undefined\") {\n return mapping;\n } else {\n return mapping[key];\n }\n }, this.mappings);\n\n // if we don't have a string we may have a miss or an incomplete chord\n if (typeof action !== \"string\") return;\n\n // clear the buffer and prevent the key from being consumed elsewhere\n this.buffer = [];\n cause.preventDefault();\n\n if (DEBUG) console.debug(\"[keyboard] event: %s\", action);\n\n // fire the configured event\n const event = new CustomEvent(action, {\n detail: { cause: cause },\n bubbles: true,\n });\n cause.target.dispatchEvent(event);\n }\n\n /**\n * @param event KeyboardEvent input event to describe\n * @return String description of keyboard event, e.g. 'C-KeyV' (CTRL+V)\n */\n describeEvent(event) {\n return [\n event.ctrlKey && \"C\",\n event.metaKey && \"M\",\n event.altKey && \"A\",\n event.shiftKey && \"S\",\n event.code,\n ]\n .filter((w) => w)\n .join(\"-\");\n }\n\n /**\n * Build a tree for efficiently looking up key chords, where the last key in the sequence\n * is the first key in tree.\n */\n get mappings() {\n const inputs = this.mappingValue\n .replaceAll(/\\s+/g, \" \")\n .split(\" \")\n .filter((f) => f.length > 0);\n const mappings = {};\n\n inputs.forEach((mapping) => this.#parse(mappings, mapping));\n\n // memoize the result\n Object.defineProperty(this, \"mappings\", {\n value: mappings,\n writable: false,\n });\n\n return mappings;\n }\n\n /**\n * Parse a key chord pattern and an event and store it in the inverted tree lookup structure.\n *\n * @param mappings inverted tree lookup for key chords\n * @param mapping input definition, e.g. \"C-KeyC+C-KeyV->paste\"\n */\n #parse(mappings, mapping) {\n const [pattern, event] = mapping.split(\"->\");\n const keys = pattern.split(\"+\");\n const first = keys.shift();\n\n mappings = keys.reduceRight(\n (mappings, key) => (mappings[key] ||= {}),\n mappings,\n );\n mappings[first] = event;\n }\n\n /**\n * Ignore modifier keys, as they will be captured in normal key presses.\n *\n * @param event KeyboardEvent\n * @returns {boolean} true if key event should be ignored\n */\n #ignore(event) {\n switch (event.code) {\n case \"ControlLeft\":\n case \"ControlRight\":\n case \"MetaLeft\":\n case \"MetaRight\":\n case \"ShiftLeft\":\n case \"ShiftRight\":\n case \"AltLeft\":\n case \"AltRight\":\n return true;\n default:\n return false;\n }\n }\n}\n\n/**\n * Detect input nodes where we should not listen for events.\n *\n * Credit: github.com\n */\nfunction isFormField(element) {\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n\n const name = element.nodeName.toLowerCase();\n const type = (element.getAttribute(\"type\") || \"\").toLowerCase();\n return (\n name === \"select\" ||\n name === \"textarea\" ||\n name === \"trix-editor\" ||\n (name === \"input\" &&\n type !== \"submit\" &&\n type !== \"reset\" &&\n type !== \"checkbox\" &&\n type !== \"radio\" &&\n type !== \"file\") ||\n element.isContentEditable\n );\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class ModalController extends Controller {\n static targets = [\"dialog\"];\n\n connect() {\n this.element.addEventListener(\"turbo:submit-end\", this.onSubmit);\n }\n\n disconnect() {\n this.element.removeEventListener(\"turbo:submit-end\", this.onSubmit);\n }\n\n outside(e) {\n if (e.target.tagName === \"DIALOG\") this.dismiss();\n }\n\n dismiss() {\n if (!this.dialogTarget) return;\n if (!this.dialogTarget.open) this.dialogTarget.close();\n\n this.element.removeAttribute(\"src\");\n this.dialogTarget.remove();\n }\n\n dialogTargetConnected(dialog) {\n dialog.showModal();\n }\n\n onSubmit = (event) => {\n if (\n event.detail.success &&\n \"closeDialog\" in event.detail.formSubmission?.submitter?.dataset\n ) {\n this.dialogTarget.close();\n this.element.removeAttribute(\"src\");\n this.dialogTarget.remove();\n }\n };\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class NavigationController extends Controller {\n static targets = [\"filter\"];\n\n filter() {\n const filter = this.filterTarget.value;\n this.clearFilter(filter);\n\n if (filter.length > 0) {\n this.applyFilter(filter);\n }\n }\n\n go() {\n this.element.querySelector(\"li:not([hidden]) > a\").click();\n }\n\n clear() {\n if (this.filterTarget.value.length === 0) this.filterTarget.blur();\n }\n\n applyFilter(filter) {\n // hide items that don't match the search filter\n this.links\n .filter(\n (li) =>\n !this.prefixSearch(filter.toLowerCase(), li.innerText.toLowerCase()),\n )\n .forEach((li) => {\n li.toggleAttribute(\"hidden\", true);\n });\n\n this.menus\n .filter((li) => !li.matches(\"li:has(li:not([hidden]) > a)\"))\n .forEach((li) => {\n li.toggleAttribute(\"hidden\", true);\n });\n }\n\n clearFilter(filter) {\n this.element.querySelectorAll(\"li\").forEach((li) => {\n li.toggleAttribute(\"hidden\", false);\n });\n }\n\n prefixSearch(needle, haystack) {\n const haystackLength = haystack.length;\n const needleLength = needle.length;\n if (needleLength > haystackLength) {\n return false;\n }\n if (needleLength === haystackLength) {\n return needle === haystack;\n }\n outer: for (let i = 0, j = 0; i < needleLength; i++) {\n const needleChar = needle.charCodeAt(i);\n if (needleChar === 32) {\n // skip ahead to next space in the haystack\n while (j < haystackLength && haystack.charCodeAt(j++) !== 32) {}\n continue;\n }\n while (j < haystackLength) {\n if (haystack.charCodeAt(j++) === needleChar) continue outer;\n // skip ahead to the next space in the haystack\n while (j < haystackLength && haystack.charCodeAt(j++) !== 32) {}\n }\n return false;\n }\n return true;\n }\n\n toggle() {\n this.element.open ? this.close() : this.open();\n }\n\n open() {\n if (!this.element.open) this.element.showModal();\n }\n\n close() {\n if (this.element.open) this.element.close();\n }\n\n click(e) {\n if (e.target === this.element) this.close();\n }\n\n onMorphAttribute = (e) => {\n if (e.target !== this.element) return;\n\n switch (e.detail.attributeName) {\n case \"open\":\n e.preventDefault();\n }\n };\n\n get links() {\n return Array.from(this.element.querySelectorAll(\"li:has(> a)\"));\n }\n\n get menus() {\n return Array.from(this.element.querySelectorAll(\"li:has(> ul)\"));\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class NavigationToggleController extends Controller {\n trigger() {\n this.dispatch(\"toggle\", { prefix: \"navigation\", bubbles: true });\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class PagyNavController extends Controller {\n connect() {\n document.addEventListener(\"shortcut:page-prev\", this.prevPage);\n document.addEventListener(\"shortcut:page-next\", this.nextPage);\n }\n\n disconnect() {\n document.removeEventListener(\"shortcut:page-prev\", this.prevPage);\n document.removeEventListener(\"shortcut:page-next\", this.nextPage);\n }\n\n nextPage = () => {\n this.element.querySelector(\"a:last-child\").click();\n };\n\n prevPage = () => {\n this.element.querySelector(\"a:first-child\").click();\n };\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\n/**\n * Connect an input (e.g. title) to slug.\n */\nexport default class SluggableController extends Controller {\n static targets = [\"source\", \"slug\"];\n static values = {\n slug: String,\n };\n\n sourceChanged(e) {\n if (this.slugValue === \"\") {\n this.slugTarget.value = parameterize(this.sourceTarget.value);\n }\n }\n\n slugChanged(e) {\n this.slugValue = this.slugTarget.value;\n }\n}\n\nfunction parameterize(input) {\n return input\n .toLowerCase()\n .replace(/'/g, \"-\")\n .replace(/[^-\\w\\s]/g, \"\")\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/(^-|-$)/g, \"\");\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nimport {\n get,\n parseRequestOptionsFromJSON,\n} from \"@github/webauthn-json/browser-ponyfill\";\n\nexport default class WebauthnAuthenticationController extends Controller {\n static targets = [\"response\"];\n static values = { options: Object };\n\n authenticate() {\n get(this.options).then((response) => {\n this.responseTarget.value = JSON.stringify(response);\n\n this.element.requestSubmit();\n });\n }\n\n get options() {\n return parseRequestOptionsFromJSON(this.optionsValue);\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nimport {\n create,\n parseCreationOptionsFromJSON,\n} from \"@github/webauthn-json/browser-ponyfill\";\n\nexport default class WebauthnRegistrationController extends Controller {\n static values = {\n options: Object,\n response: String,\n };\n static targets = [\"intro\", \"nickname\", \"response\"];\n\n submit(e) {\n if (\n this.responseTarget.value === \"\" &&\n e.submitter.formMethod !== \"dialog\"\n ) {\n e.preventDefault();\n this.createCredential();\n }\n }\n\n async createCredential() {\n const response = await create(this.options);\n\n this.responseValue = JSON.stringify(response);\n this.responseTarget.value = JSON.stringify(response);\n }\n\n responseValueChanged(response) {\n const responsePresent = response !== \"\";\n this.introTarget.toggleAttribute(\"hidden\", responsePresent);\n this.nicknameTarget.toggleAttribute(\"hidden\", !responsePresent);\n }\n\n get options() {\n return parseCreationOptionsFromJSON(this.optionsValue);\n }\n}\n","class KoiToolbarElement extends HTMLElement {\n constructor() {\n super();\n\n this.setAttribute(\"role\", \"toolbar\");\n }\n}\n\ncustomElements.define(\"koi-toolbar\", KoiToolbarElement);\n","import \"@hotwired/turbo-rails\";\nimport { initAll } from \"@katalyst/govuk-formbuilder\";\nimport \"@rails/actiontext\";\nimport \"trix\";\n\nimport \"./controllers\";\nimport \"./elements\";\n\n/** Initialize GOVUK */\nfunction initGOVUK() {\n document.body.classList.toggle(\"js-enabled\", true);\n document.body.classList.toggle(\n \"govuk-frontend-supported\",\n \"noModule\" in HTMLScriptElement.prototype,\n );\n initAll();\n}\n\nwindow.addEventListener(\"turbo:load\", initGOVUK);\nif (window.Turbo) initGOVUK();\n"],"names":["application","Application","start","load","content","govuk","navigation","tables","Definitions","identifier","controllerConstructor","Controller","static","connect","navigator","this","element","classList","add","supportedClass","copy","event","preventDefault","clipboard","writeText","sourceTarget","value","setTimeout","remove","close","e","target","closest","children","length","mapping","String","depth","type","Number","default","cause","HTMLElement","name","nodeName","toLowerCase","getAttribute","isContentEditable","isFormField","ignore","key","describeEvent","buffer","slice","depthValue","action","reduceRight","mappings","CustomEvent","detail","bubbles","dispatchEvent","ctrlKey","metaKey","altKey","shiftKey","code","filter","w","join","inputs","mappingValue","replaceAll","split","f","forEach","parse","Object","defineProperty","writable","pattern","keys","first","shift","addEventListener","onSubmit","disconnect","removeEventListener","outside","tagName","dismiss","dialogTarget","open","removeAttribute","dialogTargetConnected","dialog","showModal","success","formSubmission","submitter","dataset","filterTarget","clearFilter","applyFilter","go","querySelector","click","clear","blur","links","li","prefixSearch","innerText","toggleAttribute","menus","matches","querySelectorAll","needle","haystack","haystackLength","needleLength","outer","i","j","needleChar","charCodeAt","toggle","onMorphAttribute","attributeName","Array","from","trigger","dispatch","prefix","document","prevPage","nextPage","slug","sourceChanged","slugValue","slugTarget","replace","slugChanged","options","authenticate","get","then","response","responseTarget","JSON","stringify","requestSubmit","parseRequestOptionsFromJSON","optionsValue","submit","formMethod","createCredential","create","responseValue","responseValueChanged","responsePresent","introTarget","nicknameTarget","parseCreationOptionsFromJSON","import","HwComboboxController","push","catch","KoiToolbarElement","constructor","super","setAttribute","initGOVUK","body","HTMLScriptElement","prototype","initAll","customElements","define","window","Turbo"],"mappings":"gbAEA,MAAMA,EAAcC,EAAYC,QCChCF,EAAYG,KAAKC,GAGjBJ,EAAYG,KAAKE,GAGjBL,EAAYG,KAAKG,GAGjBN,EAAYG,KAAKI,GAajB,MAAMC,EAAc,CAClB,CACEC,WAAY,YACZC,sBC1BW,cAAkCC,EAC/CC,eAAiB,CAAC,UAElBA,eAAiB,CAAC,aAElB,OAAAC,GACM,cAAeC,WACjBC,KAAKC,QAAQC,UAAUC,IAAIH,KAAKI,eAEpC,CAEA,IAAAC,CAAKC,GACHA,EAAMC,iBACNR,UAAUS,UAAUC,UAAUT,KAAKU,aAAaC,OAEhDX,KAAKC,QAAQC,UAAUC,IAAI,UAC3BS,WAAW,KACTZ,KAAKC,QAAQC,UAAUW,OAAO,WAC7B,IACL,IDSA,CACEnB,WAAY,QACZC,sBE9BW,cAA8BC,EAC3C,KAAAkB,CAAMC,GACJA,EAAEC,OAAOC,QAAQ,MAAMJ,SAGc,IAAjCb,KAAKC,QAAQiB,SAASC,QACxBnB,KAAKC,QAAQY,QAEjB,IFwBA,CACEnB,WAAY,WACZC,sBGhCW,cAAiCC,EAC9CC,cAAgB,CACduB,QAASC,OACTC,MAAO,CAAEC,KAAMC,OAAQC,QAAS,IAGlC,KAAAnB,CAAMoB,GACJ,GAsHJ,SAAqBzB,GACnB,KAAMA,aAAmB0B,aACvB,OAAO,EAGT,MAAMC,EAAO3B,EAAQ4B,SAASC,cACxBP,GAAQtB,EAAQ8B,aAAa,SAAW,IAAID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@@
9
9
  width: 1px;
10
10
  white-space: nowrap;
11
11
  }
12
-
13
- /* data-controller="show-hide" */
14
- [data-collapsed] {
15
- max-height: 0;
16
- overflow: hidden;
17
- margin-bottom: 0 !important;
18
- }
@@ -53,13 +53,13 @@ module Admin
53
53
  def archive
54
54
  Admin::User.where(id: params[:id]).where.not(id: current_admin.id).each(&:archive!)
55
55
 
56
- redirect_back(fallback_location: admin_admin_users_path, status: :see_other)
56
+ redirect_back_or_to(admin_admin_users_path, status: :see_other)
57
57
  end
58
58
 
59
59
  def restore
60
60
  Admin::User.archived.where(id: params[:id]).each(&:restore!)
61
61
 
62
- redirect_back(fallback_location: admin_admin_users_path, status: :see_other)
62
+ redirect_back_or_to(admin_admin_users_path, status: :see_other)
63
63
  end
64
64
 
65
65
  def destroy
@@ -5,7 +5,7 @@ module Admin
5
5
  def destroy
6
6
  Rails.logger.warn("[CACHE CLEAR] - Cleaning entire cache manually by #{current_admin} request")
7
7
  Rails.cache.clear
8
- redirect_back(fallback_location: admin_dashboard_path)
8
+ redirect_back_or_to(admin_dashboard_path)
9
9
  end
10
10
  end
11
11
  end
@@ -24,7 +24,7 @@ module Admin
24
24
 
25
25
  respond_to do |format|
26
26
  format.html { redirect_to admin_admin_user_path(admin_user), status: :see_other }
27
- format.turbo_stream { render locals: { admin_user: }, status: :unprocessable_entity }
27
+ format.turbo_stream { render locals: { admin_user: }, status: :unprocessable_content }
28
28
  end
29
29
  end
30
30
  end
@@ -8,7 +8,15 @@ module Koi
8
8
  include HasAdminUsers
9
9
  include HasAttachments
10
10
  include Katalyst::Tables::Backend
11
- include ::Pagy::Backend
11
+
12
+ if (pagy = "Pagy::Method".safe_constantize)
13
+ include pagy
14
+ elsif (pagy = "Pagy::Backend".safe_constantize)
15
+ # @deprecated Pagy <43
16
+ include pagy
17
+
18
+ helper "::Pagy::Frontend".safe_constantize
19
+ end
12
20
 
13
21
  default_form_builder "Koi::FormBuilder"
14
22
  default_table_component "Koi::TableComponent"
@@ -20,7 +28,6 @@ module Koi
20
28
  helper Katalyst::GOVUK::Formbuilder::Frontend
21
29
  helper Katalyst::Navigation::FrontendHelper
22
30
  helper Katalyst::Tables::Frontend
23
- helper ::Pagy::Frontend
24
31
 
25
32
  # Koi Helpers
26
33
  helper FormHelper
@@ -28,9 +35,6 @@ module Koi
28
35
  helper ModalHelper
29
36
  helper Pagy::Frontend
30
37
 
31
- # @deprecated to be removed in Koi 5
32
- helper IndexActionsHelper
33
-
34
38
  layout -> { turbo_frame_request? ? "koi/frame" : "koi/application" }
35
39
 
36
40
  protect_from_forgery with: :exception