fixed color-picker + compiling paths

This commit is contained in:
Tina Hammar
2023-05-02 18:14:01 +02:00
parent c90cd9332c
commit f85291793f
42 changed files with 85174 additions and 337 deletions
+37 -23
View File
@@ -1,7 +1,10 @@
import * as esbuild from 'esbuild'
import postcss from 'esbuild-postcss'
import fs from "fs";
import Path from "path";
//import postcss from 'esbuild-postcss'
const shouldWatch = process.argv.includes('--watch')
let tempPath = null
async function compile(options) {
const ctx = await esbuild.context(options)
@@ -34,7 +37,7 @@ const esm = {
'.woff2': 'file',
},
plugins: [
postcss(), //remove if you don't import css files in your js, else: create a postcss.config.js file
//postcss(), //enable if you importing css in .js, and: create a postcss.config.js file
{
name: 'watchPlugin',
setup(build) {
@@ -73,25 +76,32 @@ const formComponents = [
'text-input',
'textarea',
]
formComponents.forEach((component) => {
esm.entryPoints = `packages/forms/resources/js/components/${component}.js`
esm.outfile = `packages/forms/dist/components/${component}.js`
compile(esm)
formComponents.forEach((cmp) => {
compile({
...esm,
entryPoints: [`./packages/forms/resources/js/components/${cmp}.js`],
outfile: `./packages/forms/dist/components/${cmp}.js`,
})
})
esm.entryPoints = [`packages/support/resources/js/async-alpine.js`]
esm.outfile = `packages/support/dist/async-alpine.js`
compile(esm)
compile({
...esm,
entryPoints: [`./packages/support/resources/js/async-alpine.js`],
outfile: `./packages/support/dist/async-alpine.js`,
})
compile({
...esm,
entryPoints: [`./packages/widgets/resources/js/components/chart.js`],
outfile: `./packages/widgets/dist/components/chart.js`,
})
esm.entryPoints = [`packages/widgets/resources/js/components/chart.js`]
esm.outfile = `packages/widgets/dist/components/chart.js`
compile(esm)
esm.entryPoints = [`packages/widgets/resources/js/components/stats-overview/card/chart.js`]
esm.outfile = `packages/widgets/dist/components/stats-overview/card/chart.js`
compile(esm)
compile({
...esm,
entryPoints: [`./packages/widgets/resources/js/components/stats-overview/card/chart.js`],
outfile: `./packages/widgets/dist/components/stats-overview/card/chart.js`,
})
//--------------------------------------------------------------------------------------------------
//window scripts -----------------------------------------------------------------------------------
@@ -99,13 +109,17 @@ compile(esm)
const pkgs = ['app', 'forms', 'notifications', 'support', 'tables']
//renamed package to pkg, because package is a reserved word in JS
pkgs.forEach((pkg) => {
invoked.entryPoints = [`packages/${pkg}/resources/js/index.js`]
invoked.outfile = `packages/${pkg}/dist/index.js`
compile(invoked)
compile({
...invoked,
entryPoints: [`./packages/${pkg}/resources/js/index.js`],
outfile: `./packages/${pkg}/dist/index.js`,
})
})
invoked.entryPoints = [`packages/app/resources/js/echo.js`]
invoked.outfile = `packages/app/dist/echo.js`
compile(invoked)
compile({
...invoked,
entryPoints: [`./packages/app/resources/js/echo.js`],
outfile: `./packages/app/dist/echo.js`,
})
//--------------------------------------------------------------------------------------------------
+7
View File
File diff suppressed because one or more lines are too long
+7071 -24
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+31 -1
View File
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
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
+65 -1
View File
@@ -1 +1,65 @@
function keyValueFormComponent({state}){return{state,rows:[],shouldUpdateRows:!0,init:function(){this.updateRows(),this.rows.length<=0&&this.addRow(),this.shouldUpdateRows=!0,this.$watch("state",()=>{if(!this.shouldUpdateRows){this.shouldUpdateRows=!0;return}this.updateRows()})},addRow:function(){this.rows.push({key:"",value:""}),this.updateState()},deleteRow:function(index){this.rows.splice(index,1),this.rows.length<=0&&this.addRow(),this.updateState(),this.shouldUpdateRows=!0},reorderRows:function(event){let rows=Alpine.raw(this.rows),reorderedRow=rows.splice(event.oldIndex,1)[0];rows.splice(event.newIndex,0,reorderedRow),this.rows=rows,this.updateState()},updateRows:function(){let rows=[];for(let[key,value]of Object.entries(this.state??{}))rows.push({key,value});this.rows=rows},updateState:function(){let state2={};this.rows.forEach(row=>{row.key===""||row.key===null||(state2[row.key]=row.value)}),this.shouldUpdateRows=!1,this.state=state2}}}export{keyValueFormComponent as default};
// packages/forms/resources/js/components/key-value.js
function keyValueFormComponent({ state }) {
return {
state,
rows: [],
shouldUpdateRows: true,
init: function() {
this.updateRows();
if (this.rows.length <= 0) {
this.addRow();
}
this.shouldUpdateRows = true;
this.$watch("state", () => {
if (!this.shouldUpdateRows) {
this.shouldUpdateRows = true;
return;
}
this.updateRows();
});
},
addRow: function() {
this.rows.push({ key: "", value: "" });
this.updateState();
},
deleteRow: function(index) {
this.rows.splice(index, 1);
if (this.rows.length <= 0) {
this.addRow();
}
this.updateState();
this.shouldUpdateRows = true;
},
reorderRows: function(event) {
const rows = Alpine.raw(this.rows);
const reorderedRow = rows.splice(event.oldIndex, 1)[0];
rows.splice(event.newIndex, 0, reorderedRow);
this.rows = rows;
this.updateState();
},
updateRows: function() {
let rows = [];
for (let [key, value] of Object.entries(this.state ?? {})) {
rows.push({
key,
value
});
}
this.rows = rows;
},
updateState: function() {
let state2 = {};
this.rows.forEach((row) => {
if (row.key === "" || row.key === null) {
return;
}
state2[row.key] = row.value;
});
this.shouldUpdateRows = false;
this.state = state2;
}
};
}
export {
keyValueFormComponent as default
};
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../resources/js/components/key-value.js"],
"sourcesContent": ["export default function keyValueFormComponent({ state }) {\n return {\n state,\n\n rows: [],\n\n shouldUpdateRows: true,\n\n init: function () {\n this.updateRows()\n\n if (this.rows.length <= 0) {\n this.addRow()\n }\n\n this.shouldUpdateRows = true\n\n this.$watch('state', () => {\n if (!this.shouldUpdateRows) {\n this.shouldUpdateRows = true\n\n return\n }\n\n this.updateRows()\n })\n },\n\n addRow: function () {\n this.rows.push({ key: '', value: '' })\n\n this.updateState()\n },\n\n deleteRow: function (index) {\n this.rows.splice(index, 1)\n\n if (this.rows.length <= 0) {\n this.addRow()\n }\n\n this.updateState()\n\n this.shouldUpdateRows = true\n },\n\n reorderRows: function (event) {\n const rows = Alpine.raw(this.rows)\n\n const reorderedRow = rows.splice(event.oldIndex, 1)[0]\n rows.splice(event.newIndex, 0, reorderedRow)\n\n this.rows = rows\n\n this.updateState()\n },\n\n updateRows: function () {\n let rows = []\n\n for (let [key, value] of Object.entries(this.state ?? {})) {\n rows.push({\n key,\n value,\n })\n }\n\n this.rows = rows\n },\n\n updateState: function () {\n let state = {}\n\n this.rows.forEach((row) => {\n if (row.key === '' || row.key === null) {\n return\n }\n\n state[row.key] = row.value\n })\n\n // This is a hack to prevent the component from updating rows again\n // after a state update, which would otherwise be done by the `state`\n // watcher. If rows are updated again, duplicate keys are removed.\n //\n // https://github.com/filamentphp/filament/issues/1107\n this.shouldUpdateRows = false\n\n this.state = state\n },\n }\n}\n"],
"mappings": "AAAe,SAARA,EAAuC,CAAE,MAAAC,CAAM,EAAG,CACrD,MAAO,CACH,MAAAA,EAEA,KAAM,CAAC,EAEP,iBAAkB,GAElB,KAAM,UAAY,CACd,KAAK,WAAW,EAEZ,KAAK,KAAK,QAAU,GACpB,KAAK,OAAO,EAGhB,KAAK,iBAAmB,GAExB,KAAK,OAAO,QAAS,IAAM,CACvB,GAAI,CAAC,KAAK,iBAAkB,CACxB,KAAK,iBAAmB,GAExB,OAGJ,KAAK,WAAW,CACpB,CAAC,CACL,EAEA,OAAQ,UAAY,CAChB,KAAK,KAAK,KAAK,CAAE,IAAK,GAAI,MAAO,EAAG,CAAC,EAErC,KAAK,YAAY,CACrB,EAEA,UAAW,SAAUC,EAAO,CACxB,KAAK,KAAK,OAAOA,EAAO,CAAC,EAErB,KAAK,KAAK,QAAU,GACpB,KAAK,OAAO,EAGhB,KAAK,YAAY,EAEjB,KAAK,iBAAmB,EAC5B,EAEA,YAAa,SAAUC,EAAO,CAC1B,IAAMC,EAAO,OAAO,IAAI,KAAK,IAAI,EAE3BC,EAAeD,EAAK,OAAOD,EAAM,SAAU,CAAC,EAAE,CAAC,EACrDC,EAAK,OAAOD,EAAM,SAAU,EAAGE,CAAY,EAE3C,KAAK,KAAOD,EAEZ,KAAK,YAAY,CACrB,EAEA,WAAY,UAAY,CACpB,IAAIA,EAAO,CAAC,EAEZ,OAAS,CAACE,EAAKC,CAAK,IAAK,OAAO,QAAQ,KAAK,OAAS,CAAC,CAAC,EACpDH,EAAK,KAAK,CACN,IAAAE,EACA,MAAAC,CACJ,CAAC,EAGL,KAAK,KAAOH,CAChB,EAEA,YAAa,UAAY,CACrB,IAAIH,EAAQ,CAAC,EAEb,KAAK,KAAK,QAASO,GAAQ,CACnBA,EAAI,MAAQ,IAAMA,EAAI,MAAQ,OAIlCP,EAAMO,EAAI,GAAG,EAAIA,EAAI,MACzB,CAAC,EAOD,KAAK,iBAAmB,GAExB,KAAK,MAAQP,CACjB,CACJ,CACJ",
"names": ["keyValueFormComponent", "state", "index", "event", "rows", "reorderedRow", "key", "value", "row"]
}
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
File diff suppressed because one or more lines are too long
+25 -1
View File
@@ -1 +1,25 @@
function tagsInputFormComponent({state}){return{newTag:"",state,createTag:function(){if(this.newTag=this.newTag.trim(),this.newTag!==""){if(this.state.includes(this.newTag)){this.newTag="";return}this.state.push(this.newTag),this.newTag=""}},deleteTag:function(tagToDelete){this.state=this.state.filter(tag=>tag!==tagToDelete)}}}export{tagsInputFormComponent as default};
// packages/forms/resources/js/components/tags-input.js
function tagsInputFormComponent({ state }) {
return {
newTag: "",
state,
createTag: function() {
this.newTag = this.newTag.trim();
if (this.newTag === "") {
return;
}
if (this.state.includes(this.newTag)) {
this.newTag = "";
return;
}
this.state.push(this.newTag);
this.newTag = "";
},
deleteTag: function(tagToDelete) {
this.state = this.state.filter((tag) => tag !== tagToDelete);
}
};
}
export {
tagsInputFormComponent as default
};
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../resources/js/components/tags-input.js"],
"sourcesContent": ["export default function tagsInputFormComponent({ state }) {\n return {\n newTag: '',\n\n state,\n\n createTag: function () {\n this.newTag = this.newTag.trim()\n\n if (this.newTag === '') {\n return\n }\n\n if (this.state.includes(this.newTag)) {\n this.newTag = ''\n\n return\n }\n\n this.state.push(this.newTag)\n\n this.newTag = ''\n },\n\n deleteTag: function (tagToDelete) {\n this.state = this.state.filter((tag) => tag !== tagToDelete)\n },\n }\n}\n"],
"mappings": "AAAe,SAARA,EAAwC,CAAE,MAAAC,CAAM,EAAG,CACtD,MAAO,CACH,OAAQ,GAER,MAAAA,EAEA,UAAW,UAAY,CAGnB,GAFA,KAAK,OAAS,KAAK,OAAO,KAAK,EAE3B,KAAK,SAAW,GAIpB,IAAI,KAAK,MAAM,SAAS,KAAK,MAAM,EAAG,CAClC,KAAK,OAAS,GAEd,OAGJ,KAAK,MAAM,KAAK,KAAK,MAAM,EAE3B,KAAK,OAAS,GAClB,EAEA,UAAW,SAAUC,EAAa,CAC9B,KAAK,MAAQ,KAAK,MAAM,OAAQC,GAAQA,IAAQD,CAAW,CAC/D,CACJ,CACJ",
"names": ["tagsInputFormComponent", "state", "tagToDelete", "tag"]
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+19 -1
View File
@@ -1 +1,19 @@
function textareaFormComponent(){return{init:function(){this.$nextTick(()=>{this.render()})},render:function(){this.$el.scrollHeight>0&&(this.$el.style.height="150px",this.$el.style.height=this.$el.scrollHeight+2+"px")}}}export{textareaFormComponent as default};
// packages/forms/resources/js/components/textarea.js
function textareaFormComponent() {
return {
init: function() {
this.$nextTick(() => {
this.render();
});
},
render: function() {
if (this.$el.scrollHeight > 0) {
this.$el.style.height = "150px";
this.$el.style.height = this.$el.scrollHeight + 2 + "px";
}
}
};
}
export {
textareaFormComponent as default
};
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../resources/js/components/textarea.js"],
"sourcesContent": ["export default function textareaFormComponent() {\n return {\n init: function () {\n this.$nextTick(() => {\n this.render()\n })\n },\n\n render: function () {\n if (this.$el.scrollHeight > 0) {\n this.$el.style.height = '150px'\n this.$el.style.height = this.$el.scrollHeight + 2 + 'px'\n }\n },\n }\n}\n"],
"mappings": "AAAe,SAARA,GAAyC,CAC5C,MAAO,CACH,KAAM,UAAY,CACd,KAAK,UAAU,IAAM,CACjB,KAAK,OAAO,CAChB,CAAC,CACL,EAEA,OAAQ,UAAY,CACZ,KAAK,IAAI,aAAe,IACxB,KAAK,IAAI,MAAM,OAAS,QACxB,KAAK,IAAI,MAAM,OAAS,KAAK,IAAI,aAAe,EAAI,KAE5D,CACJ,CACJ",
"names": ["textareaFormComponent"]
}
+2791 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -1 +1,2 @@
(()=>{})();
(() => {
})();
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}
@@ -1,7 +1,7 @@
import 'vanilla-colorful/hex-color-picker'
import 'vanilla-colorful/hsl-string-color-picker'
import 'vanilla-colorful/rgb-string-color-picker'
import 'vanilla-colorful/rgba-string-color-picker'
import 'vanilla-colorful/hex-color-picker.js'
import 'vanilla-colorful/hsl-string-color-picker.js'
import 'vanilla-colorful/rgb-string-color-picker.js'
import 'vanilla-colorful/rgba-string-color-picker.js'
export default function colorPickerFormComponent({
isAutofocused,
@@ -13,6 +13,7 @@ export default function colorPickerFormComponent({
init: function () {
if (!(this.state === null || this.state === '')) {
console.info('ji')
this.setState(this.state)
}
+637 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
var u=t=>new Promise(e=>{window.addEventListener("async-alpine:load",s=>{s.detail.id===t.id&&e()})}),a=u,_=()=>new Promise(t=>{"requestIdleCallback"in window?window.requestIdleCallback(t):setTimeout(t,200)}),l=_,c=t=>new Promise(e=>{let s=t.indexOf("("),i=t.slice(s),n=window.matchMedia(i);n.matches?e():n.addEventListener("change",e,{once:!0})}),d=c,f=(t,e)=>new Promise(s=>{let i="0px 0px 0px 0px";if(e.indexOf("(")!==-1){let o=e.indexOf("(")+1;i=e.slice(o,-1)}let n=new IntersectionObserver(o=>{o[0].isIntersecting&&(n.disconnect(),s())},{rootMargin:i});n.observe(t.el)}),p=f,h="__internal_",r={Alpine:null,_options:{prefix:"ax-",alpinePrefix:"x-",root:"load",inline:"load-src",defaultStrategy:"immediate"},_alias:!1,_data:{},_realIndex:0,get _index(){return this._realIndex++},init(t,e={}){return this.Alpine=t,this._options={...this._options,...e},this},start(){return this._processInline(),this._setupComponents(),this._mutations(),this},data(t,e=!1){return this._data[t]={loaded:!1,download:e},this},url(t,e){!t||!e||(this._data[t]||this.data(t),this._data[t].download=()=>import(this._parseUrl(e)))},alias(t){this._alias=t},_processInline(){let t=document.querySelectorAll(`[${this._options.prefix}${this._options.inline}]`);for(let e of t)this._inlineElement(e)},_inlineElement(t){let e=t.getAttribute(`${this._options.alpinePrefix}data`),s=t.getAttribute(`${this._options.prefix}${this._options.inline}`);if(!e||!s)return;let i=this._parseName(e);this.url(i,s)},_setupComponents(){let t=document.querySelectorAll(`[${this._options.prefix}${this._options.root}]`);for(let e of t)this._setupComponent(e)},_setupComponent(t){let e=t.getAttribute(`${this._options.alpinePrefix}data`);t.setAttribute(`${this._options.alpinePrefix}ignore`,"");let s=this._parseName(e),i=t.getAttribute(`${this._options.prefix}${this._options.root}`)||this._options.defaultStrategy;this._componentStrategy({name:s,strategy:i,el:t,id:t.id||this._index})},async _componentStrategy(t){let e=t.strategy.split("|").map(i=>i.trim()).filter(i=>i!=="immediate").filter(i=>i!=="eager");if(!e.length){await this._download(t.name),this._activate(t);return}let s=[];for(let i of e){if(i==="idle"){s.push(l());continue}if(i.startsWith("visible")){s.push(p(t,i));continue}if(i.startsWith("media")){s.push(d(i));continue}i==="event"&&s.push(a(t))}Promise.all(s).then(async()=>{await this._download(t.name),this._activate(t)})},async _download(t){if(t.startsWith(h)||(this._handleAlias(t),!this._data[t]||this._data[t].loaded))return;let e=await this._getModule(t);this.Alpine.data(t,e),this._data[t].loaded=!0},async _getModule(t){if(!this._data[t])return;let e=await this._data[t].download();return typeof e=="function"?e:e[t]||e.default||Object.values(e)[0]||!1},_activate(t){t.el.removeAttribute(`${this._options.alpinePrefix}ignore`),t.el._x_ignore=!1,this.Alpine.initTree(t.el)},_mutations(){new MutationObserver(e=>{for(let s of e)if(s.addedNodes)for(let i of s.addedNodes)i.nodeType===1&&(i.hasAttribute(`${this._options.prefix}${this._options.root}`)&&this._mutationEl(i),i.querySelectorAll(`[${this._options.prefix}${this._options.root}]`).forEach(o=>this._mutationEl(o)))}).observe(document,{attributes:!0,childList:!0,subtree:!0})},_mutationEl(t){t.hasAttribute(`${this._options.prefix}${this._options.inline}`)&&this._inlineElement(t),this._setupComponent(t)},_handleAlias(t){!this._alias||this._data[t]||this.url(t,this._alias.replace("[name]",t))},_parseName(t){return(t||"").split(/[({]/g)[0]||`${h}${this._index}`},_parseUrl(t){return new RegExp("^(?:[a-z+]+:)?//","i").test(t)?t:new URL(t,document.baseURI).href}};document.addEventListener("alpine:init",()=>{window.AsyncAlpine=r,r.init(Alpine,window.AsyncAlpineOptions||{}),document.dispatchEvent(new CustomEvent("async-alpine:init")),r.start()});
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}
+4919 -16
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+100 -1
View File
@@ -1 +1,100 @@
(()=>{function src_default(Alpine){Alpine.directive("collapse",collapse),collapse.inline=(el,{modifiers})=>{!modifiers.includes("min")||(el._x_doShow=()=>{},el._x_doHide=()=>{})};function collapse(el,{modifiers}){let duration=modifierValue(modifiers,"duration",250)/1e3,floor=modifierValue(modifiers,"min",0),fullyHide=!modifiers.includes("min");el._x_isShown||(el.style.height=`${floor}px`),!el._x_isShown&&fullyHide&&(el.hidden=!0),el._x_isShown||(el.style.overflow="hidden");let setFunction=(el2,styles)=>{let revertFunction=Alpine.setStyles(el2,styles);return styles.height?()=>{}:revertFunction},transitionStyles={transitionProperty:"height",transitionDuration:`${duration}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};el._x_transition={in(before=()=>{},after=()=>{}){fullyHide&&(el.hidden=!1),fullyHide&&(el.style.display=null);let current=el.getBoundingClientRect().height;el.style.height="auto";let full=el.getBoundingClientRect().height;current===full&&(current=floor),Alpine.transition(el,Alpine.setStyles,{during:transitionStyles,start:{height:current+"px"},end:{height:full+"px"}},()=>el._x_isShown=!0,()=>{el.getBoundingClientRect().height==full&&(el.style.overflow=null)})},out(before=()=>{},after=()=>{}){let full=el.getBoundingClientRect().height;Alpine.transition(el,setFunction,{during:transitionStyles,start:{height:full+"px"},end:{height:floor+"px"}},()=>el.style.overflow="hidden",()=>{el._x_isShown=!1,el.style.height==`${floor}px`&&fullyHide&&(el.style.display="none",el.hidden=!0)})}}}}function modifierValue(modifiers,key,fallback){if(modifiers.indexOf(key)===-1)return fallback;let rawValue=modifiers[modifiers.indexOf(key)+1];if(!rawValue)return fallback;if(key==="duration"){let match=rawValue.match(/([0-9]+)ms/);if(match)return match[1]}if(key==="min"){let match=rawValue.match(/([0-9]+)px/);if(match)return match[1]}return rawValue}var module_default=src_default;document.addEventListener("alpine:init",()=>{window.Alpine.plugin(module_default)});})();
(() => {
// node_modules/@alpinejs/collapse/dist/module.esm.js
function src_default(Alpine) {
Alpine.directive("collapse", collapse);
collapse.inline = (el, { modifiers }) => {
if (!modifiers.includes("min"))
return;
el._x_doShow = () => {
};
el._x_doHide = () => {
};
};
function collapse(el, { modifiers }) {
let duration = modifierValue(modifiers, "duration", 250) / 1e3;
let floor = modifierValue(modifiers, "min", 0);
let fullyHide = !modifiers.includes("min");
if (!el._x_isShown)
el.style.height = `${floor}px`;
if (!el._x_isShown && fullyHide)
el.hidden = true;
if (!el._x_isShown)
el.style.overflow = "hidden";
let setFunction = (el2, styles) => {
let revertFunction = Alpine.setStyles(el2, styles);
return styles.height ? () => {
} : revertFunction;
};
let transitionStyles = {
transitionProperty: "height",
transitionDuration: `${duration}s`,
transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)"
};
el._x_transition = {
in(before = () => {
}, after = () => {
}) {
if (fullyHide)
el.hidden = false;
if (fullyHide)
el.style.display = null;
let current = el.getBoundingClientRect().height;
el.style.height = "auto";
let full = el.getBoundingClientRect().height;
if (current === full) {
current = floor;
}
Alpine.transition(el, Alpine.setStyles, {
during: transitionStyles,
start: { height: current + "px" },
end: { height: full + "px" }
}, () => el._x_isShown = true, () => {
if (el.getBoundingClientRect().height == full) {
el.style.overflow = null;
}
});
},
out(before = () => {
}, after = () => {
}) {
let full = el.getBoundingClientRect().height;
Alpine.transition(el, setFunction, {
during: transitionStyles,
start: { height: full + "px" },
end: { height: floor + "px" }
}, () => el.style.overflow = "hidden", () => {
el._x_isShown = false;
if (el.style.height == `${floor}px` && fullyHide) {
el.style.display = "none";
el.hidden = true;
}
});
}
};
}
}
function modifierValue(modifiers, key, fallback) {
if (modifiers.indexOf(key) === -1)
return fallback;
const rawValue = modifiers[modifiers.indexOf(key) + 1];
if (!rawValue)
return fallback;
if (key === "duration") {
let match = rawValue.match(/([0-9]+)ms/);
if (match)
return match[1];
}
if (key === "min") {
let match = rawValue.match(/([0-9]+)px/);
if (match)
return match[1];
}
return rawValue;
}
var module_default = src_default;
// packages/tables/resources/js/index.js
document.addEventListener("alpine:init", () => {
window.Alpine.plugin(module_default);
});
})();
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../node_modules/@alpinejs/collapse/dist/module.esm.js", "../resources/js/index.js"],
"sourcesContent": ["// packages/collapse/src/index.js\nfunction src_default(Alpine) {\n Alpine.directive(\"collapse\", collapse);\n collapse.inline = (el, { modifiers }) => {\n if (!modifiers.includes(\"min\"))\n return;\n el._x_doShow = () => {\n };\n el._x_doHide = () => {\n };\n };\n function collapse(el, { modifiers }) {\n let duration = modifierValue(modifiers, \"duration\", 250) / 1e3;\n let floor = modifierValue(modifiers, \"min\", 0);\n let fullyHide = !modifiers.includes(\"min\");\n if (!el._x_isShown)\n el.style.height = `${floor}px`;\n if (!el._x_isShown && fullyHide)\n el.hidden = true;\n if (!el._x_isShown)\n el.style.overflow = \"hidden\";\n let setFunction = (el2, styles) => {\n let revertFunction = Alpine.setStyles(el2, styles);\n return styles.height ? () => {\n } : revertFunction;\n };\n let transitionStyles = {\n transitionProperty: \"height\",\n transitionDuration: `${duration}s`,\n transitionTimingFunction: \"cubic-bezier(0.4, 0.0, 0.2, 1)\"\n };\n el._x_transition = {\n in(before = () => {\n }, after = () => {\n }) {\n if (fullyHide)\n el.hidden = false;\n if (fullyHide)\n el.style.display = null;\n let current = el.getBoundingClientRect().height;\n el.style.height = \"auto\";\n let full = el.getBoundingClientRect().height;\n if (current === full) {\n current = floor;\n }\n Alpine.transition(el, Alpine.setStyles, {\n during: transitionStyles,\n start: { height: current + \"px\" },\n end: { height: full + \"px\" }\n }, () => el._x_isShown = true, () => {\n if (el.getBoundingClientRect().height == full) {\n el.style.overflow = null;\n }\n });\n },\n out(before = () => {\n }, after = () => {\n }) {\n let full = el.getBoundingClientRect().height;\n Alpine.transition(el, setFunction, {\n during: transitionStyles,\n start: { height: full + \"px\" },\n end: { height: floor + \"px\" }\n }, () => el.style.overflow = \"hidden\", () => {\n el._x_isShown = false;\n if (el.style.height == `${floor}px` && fullyHide) {\n el.style.display = \"none\";\n el.hidden = true;\n }\n });\n }\n };\n }\n}\nfunction modifierValue(modifiers, key, fallback) {\n if (modifiers.indexOf(key) === -1)\n return fallback;\n const rawValue = modifiers[modifiers.indexOf(key) + 1];\n if (!rawValue)\n return fallback;\n if (key === \"duration\") {\n let match = rawValue.match(/([0-9]+)ms/);\n if (match)\n return match[1];\n }\n if (key === \"min\") {\n let match = rawValue.match(/([0-9]+)px/);\n if (match)\n return match[1];\n }\n return rawValue;\n}\n\n// packages/collapse/builds/module.js\nvar module_default = src_default;\nexport {\n module_default as default\n};\n", "import Collapse from '@alpinejs/collapse'\n\ndocument.addEventListener('alpine:init', () => {\n window.Alpine.plugin(Collapse)\n})\n"],
"mappings": "MACA,SAASA,EAAYC,EAAQ,CAC3BA,EAAO,UAAU,WAAYC,CAAQ,EACrCA,EAAS,OAAS,CAACC,EAAI,CAAE,UAAAC,CAAU,IAAM,CAClCA,EAAU,SAAS,KAAK,IAE7BD,EAAG,UAAY,IAAM,CACrB,EACAA,EAAG,UAAY,IAAM,CACrB,EACF,EACA,SAASD,EAASC,EAAI,CAAE,UAAAC,CAAU,EAAG,CACnC,IAAIC,EAAWC,EAAcF,EAAW,WAAY,GAAG,EAAI,IACvDG,EAAQD,EAAcF,EAAW,MAAO,CAAC,EACzCI,EAAY,CAACJ,EAAU,SAAS,KAAK,EACpCD,EAAG,aACNA,EAAG,MAAM,OAAS,GAAGI,OACnB,CAACJ,EAAG,YAAcK,IACpBL,EAAG,OAAS,IACTA,EAAG,aACNA,EAAG,MAAM,SAAW,UACtB,IAAIM,EAAc,CAACC,EAAKC,IAAW,CACjC,IAAIC,EAAiBX,EAAO,UAAUS,EAAKC,CAAM,EACjD,OAAOA,EAAO,OAAS,IAAM,CAC7B,EAAIC,CACN,EACIC,EAAmB,CACrB,mBAAoB,SACpB,mBAAoB,GAAGR,KACvB,yBAA0B,gCAC5B,EACAF,EAAG,cAAgB,CACjB,GAAGW,EAAS,IAAM,CAClB,EAAGC,EAAQ,IAAM,CACjB,EAAG,CACGP,IACFL,EAAG,OAAS,IACVK,IACFL,EAAG,MAAM,QAAU,MACrB,IAAIa,EAAUb,EAAG,sBAAsB,EAAE,OACzCA,EAAG,MAAM,OAAS,OAClB,IAAIc,EAAOd,EAAG,sBAAsB,EAAE,OAClCa,IAAYC,IACdD,EAAUT,GAEZN,EAAO,WAAWE,EAAIF,EAAO,UAAW,CACtC,OAAQY,EACR,MAAO,CAAE,OAAQG,EAAU,IAAK,EAChC,IAAK,CAAE,OAAQC,EAAO,IAAK,CAC7B,EAAG,IAAMd,EAAG,WAAa,GAAM,IAAM,CAC/BA,EAAG,sBAAsB,EAAE,QAAUc,IACvCd,EAAG,MAAM,SAAW,KAExB,CAAC,CACH,EACA,IAAIW,EAAS,IAAM,CACnB,EAAGC,EAAQ,IAAM,CACjB,EAAG,CACD,IAAIE,EAAOd,EAAG,sBAAsB,EAAE,OACtCF,EAAO,WAAWE,EAAIM,EAAa,CACjC,OAAQI,EACR,MAAO,CAAE,OAAQI,EAAO,IAAK,EAC7B,IAAK,CAAE,OAAQV,EAAQ,IAAK,CAC9B,EAAG,IAAMJ,EAAG,MAAM,SAAW,SAAU,IAAM,CAC3CA,EAAG,WAAa,GACZA,EAAG,MAAM,QAAU,GAAGI,OAAaC,IACrCL,EAAG,MAAM,QAAU,OACnBA,EAAG,OAAS,GAEhB,CAAC,CACH,CACF,CACF,CACF,CACA,SAASG,EAAcF,EAAWc,EAAKC,EAAU,CAC/C,GAAIf,EAAU,QAAQc,CAAG,IAAM,GAC7B,OAAOC,EACT,IAAMC,EAAWhB,EAAUA,EAAU,QAAQc,CAAG,EAAI,CAAC,EACrD,GAAI,CAACE,EACH,OAAOD,EACT,GAAID,IAAQ,WAAY,CACtB,IAAIG,EAAQD,EAAS,MAAM,YAAY,EACvC,GAAIC,EACF,OAAOA,EAAM,CAAC,EAElB,GAAIH,IAAQ,MAAO,CACjB,IAAIG,EAAQD,EAAS,MAAM,YAAY,EACvC,GAAIC,EACF,OAAOA,EAAM,CAAC,EAElB,OAAOD,CACT,CAGA,IAAIE,EAAiBtB,EC5FrB,SAAS,iBAAiB,cAAe,IAAM,CAC3C,OAAO,OAAO,OAAOuB,CAAQ,CACjC,CAAC",
"names": ["src_default", "Alpine", "collapse", "el", "modifiers", "duration", "modifierValue", "floor", "fullyHide", "setFunction", "el2", "styles", "revertFunction", "transitionStyles", "before", "after", "current", "full", "key", "fallback", "rawValue", "match", "module_default", "module_default"]
}
+13236 -15
View File
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