@@ -57877,131 +57877,151 @@
5787757877 // app/javascript/controllers/canvas_controller.js
5787857878 var canvas_controller_default = class extends Controller {
5787957879 connect() {
57880- var c = this.element, ctx = c.getContext("2d"), cw = c.width = window.innerWidth, ch = c.height = window.innerHeight, points = [], tick = 0, opt = {
57881- count: 5,
57882- range: {
57883- x: 40,
57884- y: 80
57885- },
57886- duration: {
57887- min: 40,
57888- max: 100
57889- },
57890- thickness: 0,
57891- strokeColor: "transparent",
57892- level: 0.65,
57893- curved: true
57894- }, rand = function(min2, max2) {
57895- return Math.floor(Math.random() * (max2 - min2 + 1) + min2);
57896- }, ease = function(t, b, c2, d) {
57897- if ((t /= d / 2) < 1)
57898- return c2 / 2 * t * t + b;
57899- return -c2 / 2 * (--t * (t - 2) - 1) + b;
57900- };
57901- ctx.lineJoin = "round";
57902- ctx.lineWidth = opt.thickness;
57903- ctx.strokeStyle = opt.strokeColor;
57904- var Point = function(config) {
57905- this.anchorX = config.x;
57906- this.anchorY = config.y;
57907- this.x = config.x;
57908- this.y = config.y;
57909- this.setTarget();
57910- };
57911- Point.prototype.setTarget = function() {
57912- this.initialX = this.x;
57913- this.initialY = this.y;
57914- this.targetX = this.anchorX + rand(0, opt.range.x * 2) - opt.range.x;
57915- this.targetY = this.anchorY + rand(0, opt.range.y * 2) - opt.range.y;
57916- this.tick = 0;
57917- this.duration = rand(opt.duration.min, opt.duration.max);
57918- };
57919- Point.prototype.update = function() {
57920- var dx = this.targetX - this.x;
57921- var dy = this.targetY - this.y;
57922- var dist = Math.sqrt(dx * dx + dy * dy);
57923- if (Math.abs(dist) <= 0) {
57880+ if (this.element) {
57881+ var c = this.element, ctx = c.getContext("2d"), cw = c.width = window.innerWidth, ch = c.height = window.innerHeight, points = [], tick = 0, opt = {
57882+ count: 5,
57883+ range: {
57884+ x: 40,
57885+ y: 80
57886+ },
57887+ duration: {
57888+ min: 40,
57889+ max: 100
57890+ },
57891+ thickness: 0,
57892+ strokeColor: "transparent",
57893+ level: 0.65,
57894+ curved: true
57895+ }, rand = function(min2, max2) {
57896+ return Math.floor(Math.random() * (max2 - min2 + 1) + min2);
57897+ }, ease = function(t, b, c2, d) {
57898+ if ((t /= d / 2) < 1)
57899+ return c2 / 2 * t * t + b;
57900+ return -c2 / 2 * (--t * (t - 2) - 1) + b;
57901+ };
57902+ ctx.lineJoin = "round";
57903+ ctx.lineWidth = opt.thickness;
57904+ ctx.strokeStyle = opt.strokeColor;
57905+ var Point = function(config) {
57906+ this.anchorX = config.x;
57907+ this.anchorY = config.y;
57908+ this.x = config.x;
57909+ this.y = config.y;
5792457910 this.setTarget();
57925- } else {
57926- var t = this.tick;
57927- var b = this.initialY;
57928- var c2 = this.targetY - this.initialY;
57929- var d = this.duration;
57930- this.y = ease(t, b, c2, d);
57931- b = this.initialX;
57932- c2 = this.targetX - this.initialX;
57933- d = this.duration;
57934- this.x = ease(t, b, c2, d);
57935- this.tick++;
57936- }
57937- };
57938- Point.prototype.render = function() {
57939- ctx.beginPath();
57940- ctx.arc(this.x, this.y, 3, 0, Math.PI * 2, false);
57941- ctx.fillStyle = "#000";
57942- ctx.fill();
57943- };
57944- var updatePoints = function() {
57945- var i2 = points.length;
57946- while (i2--) {
57947- points[i2].update();
57948- }
57949- };
57950- var renderPoints = function() {
57951- var i2 = points.length;
57952- while (i2--) {
57953- points[i2].render();
57954- }
57955- };
57956- var renderShape = function() {
57957- ctx.beginPath();
57958- var pointCount = points.length;
57959- ctx.moveTo(points[0].x, points[0].y);
57960- var i2;
57961- for (i2 = 0; i2 < pointCount - 1; i2++) {
57962- var c2 = (points[i2].x + points[i2 + 1].x) / 2;
57963- var d = (points[i2].y + points[i2 + 1].y) / 2;
57964- ctx.quadraticCurveTo(points[i2].x, points[i2].y, c2, d);
57911+ };
57912+ Point.prototype.setTarget = function() {
57913+ this.initialX = this.x;
57914+ this.initialY = this.y;
57915+ this.targetX = this.anchorX + rand(0, opt.range.x * 2) - opt.range.x;
57916+ this.targetY = this.anchorY + rand(0, opt.range.y * 2) - opt.range.y;
57917+ this.tick = 0;
57918+ this.duration = rand(opt.duration.min, opt.duration.max);
57919+ };
57920+ Point.prototype.update = function() {
57921+ var dx = this.targetX - this.x;
57922+ var dy = this.targetY - this.y;
57923+ var dist = Math.sqrt(dx * dx + dy * dy);
57924+ if (Math.abs(dist) <= 0) {
57925+ this.setTarget();
57926+ } else {
57927+ var t = this.tick;
57928+ var b = this.initialY;
57929+ var c2 = this.targetY - this.initialY;
57930+ var d = this.duration;
57931+ this.y = ease(t, b, c2, d);
57932+ b = this.initialX;
57933+ c2 = this.targetX - this.initialX;
57934+ d = this.duration;
57935+ this.x = ease(t, b, c2, d);
57936+ this.tick++;
57937+ }
57938+ };
57939+ Point.prototype.render = function() {
57940+ ctx.beginPath();
57941+ ctx.arc(this.x, this.y, 3, 0, Math.PI * 2, false);
57942+ ctx.fillStyle = "#000";
57943+ ctx.fill();
57944+ };
57945+ var updatePoints = function() {
57946+ var i2 = points.length;
57947+ while (i2--) {
57948+ points[i2].update();
57949+ }
57950+ };
57951+ var renderPoints = function() {
57952+ var i2 = points.length;
57953+ while (i2--) {
57954+ points[i2].render();
57955+ }
57956+ };
57957+ var renderShape = function() {
57958+ ctx.beginPath();
57959+ var pointCount = points.length;
57960+ ctx.moveTo(points[0].x, points[0].y);
57961+ var i2;
57962+ for (i2 = 0; i2 < pointCount - 1; i2++) {
57963+ var c2 = (points[i2].x + points[i2 + 1].x) / 2;
57964+ var d = (points[i2].y + points[i2 + 1].y) / 2;
57965+ ctx.quadraticCurveTo(points[i2].x, points[i2].y, c2, d);
57966+ }
57967+ ctx.lineTo(-opt.range.x - opt.thickness, ch + opt.thickness);
57968+ ctx.lineTo(cw + opt.range.x + opt.thickness, ch + opt.thickness);
57969+ ctx.closePath();
57970+ var gradient = ctx.createLinearGradient(20, 300, 240, 0);
57971+ gradient.addColorStop(1, "#4338CA");
57972+ gradient.addColorStop(0.05, "salmon");
57973+ ctx.fillStyle = gradient;
57974+ ctx.fill();
57975+ ctx.stroke();
57976+ };
57977+ var clear = function() {
57978+ ctx.clearRect(0, 0, cw, ch);
57979+ };
57980+ var loop = function() {
57981+ window.requestAnimFrame(loop, c);
57982+ tick++;
57983+ clear();
57984+ updatePoints();
57985+ renderShape();
57986+ };
57987+ var i = opt.count + 2;
57988+ var spacing = (cw + opt.range.x * 2) / (opt.count - 1);
57989+ while (i--) {
57990+ points.push(
57991+ new Point({
57992+ x: spacing * (i - 1) - opt.range.x,
57993+ y: ch - ch * opt.level
57994+ })
57995+ );
5796557996 }
57966- ctx.lineTo(-opt.range.x - opt.thickness, ch + opt.thickness);
57967- ctx.lineTo(cw + opt.range.x + opt.thickness, ch + opt.thickness);
57968- ctx.closePath();
57969- var gradient = ctx.createLinearGradient(20, 300, 240, 0);
57970- gradient.addColorStop(1, "#4338CA");
57971- gradient.addColorStop(0.05, "salmon");
57972- ctx.fillStyle = gradient;
57973- ctx.fill();
57974- ctx.stroke();
57975- };
57976- var clear = function() {
57977- ctx.clearRect(0, 0, cw, ch);
57978- };
57979- var loop = function() {
57980- window.requestAnimFrame(loop, c);
57981- tick++;
57982- clear();
57983- updatePoints();
57984- renderShape();
57985- };
57986- var i = opt.count + 2;
57987- var spacing = (cw + opt.range.x * 2) / (opt.count - 1);
57988- while (i--) {
57989- points.push(
57990- new Point({
57991- x: spacing * (i - 1) - opt.range.x,
57992- y: ch - ch * opt.level
57993- })
57994- );
57997+ window.requestAnimFrame = function() {
57998+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(a) {
57999+ window.setTimeout(a, 1e3 / 60);
58000+ };
58001+ }();
58002+ loop();
5799558003 }
57996- window.requestAnimFrame = function() {
57997- return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(a) {
57998- window.setTimeout(a, 1e3 / 60);
57999- };
58000- }();
58001- loop();
5800258004 }
5800358005 };
5800458006
58007+ // app/javascript/controllers/dialog_controller.js
58008+ var dialog_controller_default = class extends Controller {
58009+ launch(event) {
58010+ event.preventDefault();
58011+ this.dialogTarget.showModal();
58012+ }
58013+ cancel(event) {
58014+ event.preventDefault();
58015+ this.dialogTarget.close();
58016+ }
58017+ perform() {
58018+ this.buttonTarget.textContent = "Processing...";
58019+ this.buttonTarget.classList.add("opacity-50", "pointer-events-none");
58020+ this.cancelTarget.classList.add("hidden");
58021+ }
58022+ };
58023+ __publicField(dialog_controller_default, "targets", ["dialog", "button", "cancel"]);
58024+
5800558025 // node_modules/stimulus-use/dist/index.js
5800658026 var composeEventName = (name, controller, eventPrefix) => {
5800758027 let composedName = name;
5847358493 };
5847458494 __publicField(tabs_controller_default, "targets", ["tab", "panel"]);
5847558495
58496+ // app/javascript/controllers/pages_controller.js
58497+ var pages_controller_default = class extends Controller {
58498+ checkAll() {
58499+ const checkAllCheckbox = this.checkboxTargets[0];
58500+ const checkboxes = this.checkboxTargets.slice(1);
58501+ checkboxes.forEach((checkbox) => {
58502+ checkbox.checked = !checkbox.checked;
58503+ });
58504+ checkAllCheckbox.checked = checkboxes.every((checkbox) => checkbox.checked);
58505+ }
58506+ };
58507+ __publicField(pages_controller_default, "targets", ["checkbox"]);
58508+
5847658509 // app/javascript/controllers/toggle_controller.js
5847758510 var toggle_controller_default = class extends Controller {
5847858511 toggle() {
5850858541 application.register("configuration", configuration_controller_default);
5850958542 application.register("code", code_controller_default);
5851058543 application.register("canvas", canvas_controller_default);
58544+ application.register("dialog", dialog_controller_default);
5851158545 application.register("dropdown", dropdown_controller_default);
5851258546 application.register("flash", flash_controller_default);
5851358547 application.register("helper", helper_controller_default);
5851858552 application.register("search", search_controller_default);
5851958553 application.register("smooth", smooth_controller_default);
5852058554 application.register("tabs", tabs_controller_default);
58555+ application.register("pages", pages_controller_default);
5852158556 application.register("toggle", toggle_controller_default);
5852258557 application.register("tooltip", tooltip_controller_default);
5852358558})();
0 commit comments