Comparing version 1.9.2-types.0 to 1.10.0
@@ -46,3 +46,3 @@ var __defProp = Object.defineProperty; | ||
}; | ||
var _a, _value, _reactions, _b, _value2, _reactions2, _f, _depth, _derivatives, _settersQueue, _derivativesQueue, _reactionsQueue, _applyUpdate, applyUpdate_fn, _c, _d, _e, _f2; | ||
var _a, _value, _reactions, _b, _value2, _reactions2, _f, _depth, _derivatives, _settersQueue, _derivativesQueue, _reactionsQueue, _applyUpdate, applyUpdate_fn; | ||
class LiveFragment { | ||
@@ -103,3 +103,3 @@ constructor() { | ||
}); | ||
const isReactive$1 = Symbol.for("bruh reactive"); | ||
const isReactive = Symbol.for("bruh reactive"); | ||
class SimpleReactive { | ||
@@ -127,3 +127,3 @@ constructor(value) { | ||
} | ||
_a = isReactive$1; | ||
_a = isReactive; | ||
_value = new WeakMap(); | ||
@@ -166,3 +166,3 @@ _reactions = new WeakMap(); | ||
static applyUpdates() { | ||
var _a2, _b2, _c2; | ||
var _a2, _b2, _c; | ||
if (!__privateGet(_FunctionalReactive, _settersQueue).size) | ||
@@ -176,3 +176,3 @@ return; | ||
for (const derivative of depthSet) | ||
__privateMethod(_c2 = derivative, _applyUpdate, applyUpdate_fn).call(_c2, __privateGet(_b2 = derivative, _f).call(_b2)); | ||
__privateMethod(_c = derivative, _applyUpdate, applyUpdate_fn).call(_c, __privateGet(_b2 = derivative, _f).call(_b2)); | ||
__privateGet(_FunctionalReactive, _derivativesQueue).length = 0; | ||
@@ -185,3 +185,3 @@ for (const reaction of __privateGet(_FunctionalReactive, _reactionsQueue)) | ||
let FunctionalReactive = _FunctionalReactive; | ||
_b = isReactive$1; | ||
_b = isReactive; | ||
_value2 = new WeakMap(); | ||
@@ -214,3 +214,3 @@ _reactions2 = new WeakMap(); | ||
const reactiveDo = (x, f) => { | ||
if (x == null ? void 0 : x[isReactive$1]) { | ||
if (x == null ? void 0 : x[isReactive]) { | ||
f(x.value); | ||
@@ -224,2 +224,3 @@ return x.addReaction(() => f(x.value)); | ||
[Symbol.toStringTag]: "Module", | ||
isReactive, | ||
SimpleReactive, | ||
@@ -230,51 +231,5 @@ FunctionalReactive, | ||
}); | ||
const pipe = (x, ...fs) => fs.reduce((y, f) => f(y), x); | ||
const dispatch = (target, type, options) => target.dispatchEvent(new CustomEvent(type, __spreadValues({ | ||
bubbles: true, | ||
cancelable: true, | ||
composed: true | ||
}, options))); | ||
const createDestructable = (object, iterable) => { | ||
const destructable = __spreadProps(__spreadValues({}, object), { | ||
[Symbol.iterator]: () => iterable[Symbol.iterator]() | ||
}); | ||
Object.defineProperty(destructable, Symbol.iterator, { | ||
enumerable: false | ||
}); | ||
return destructable; | ||
}; | ||
const maybeDo = (existsThen, emptyThen) => (x) => { | ||
if (Array.isArray(x)) { | ||
if (x.length) | ||
existsThen(x[0]); | ||
else | ||
emptyThen(); | ||
} else | ||
existsThen(x); | ||
}; | ||
const functionAsObject = (f) => new Proxy({}, { | ||
get: (_, property) => f(property) | ||
}); | ||
var index = /* @__PURE__ */ Object.freeze({ | ||
__proto__: null, | ||
[Symbol.toStringTag]: "Module", | ||
pipe, | ||
dispatch, | ||
createDestructable, | ||
maybeDo, | ||
functionAsObject | ||
}); | ||
const isReactive = Symbol.for("bruh reactive"); | ||
const isMetaNode = Symbol.for("bruh meta node"); | ||
const isMetaTextNode = Symbol.for("bruh meta text node"); | ||
const isMetaElement = Symbol.for("bruh meta element"); | ||
const isMetaNodeChild = (x) => (x == null ? void 0 : x[isMetaNode]) || (x == null ? void 0 : x[isReactive]) || x instanceof Node || Array.isArray(x) || x == null || !(typeof x === "function" || typeof x === "object"); | ||
const toNode = (x) => { | ||
if (x[isMetaNode]) | ||
return x.node; | ||
if (x instanceof Node) | ||
return x; | ||
return document.createTextNode(x); | ||
}; | ||
const childrenToNodes = (children) => children.flat(Infinity).flatMap((child) => { | ||
const isBruhChild = (x) => (x == null ? void 0 : x[isReactive]) || x instanceof Node || Array.isArray(x) || x == null || !(typeof x === "function" || typeof x === "object"); | ||
const toNode = (x) => x instanceof Node ? x : document.createTextNode(x); | ||
const bruhChildrenToNodes = (...children) => children.flat(Infinity).flatMap((child) => { | ||
if (!child[isReactive]) | ||
@@ -285,5 +240,5 @@ return [toNode(child)]; | ||
child.addReaction(() => { | ||
liveFragment2.replaceChildren(...childrenToNodes(child.value)); | ||
liveFragment2.replaceChildren(...bruhChildrenToNodes(...child.value)); | ||
}); | ||
return [liveFragment2.startMarker, ...childrenToNodes(child.value), liveFragment2.endMarker]; | ||
return [liveFragment2.startMarker, ...bruhChildrenToNodes(...child.value), liveFragment2.endMarker]; | ||
} | ||
@@ -298,78 +253,66 @@ let node = toNode(child.value); | ||
}); | ||
class MetaTextNode { | ||
constructor(textContent) { | ||
__publicField(this, _c, true); | ||
__publicField(this, _d, true); | ||
__publicField(this, "node"); | ||
if (!textContent[isReactive]) { | ||
this.node = document.createTextNode(textContent); | ||
return; | ||
} | ||
this.node = document.createTextNode(textContent.value); | ||
textContent.addReaction(() => { | ||
this.node.textContent = textContent.value; | ||
const applyStyles = (element, styles) => { | ||
for (const property in styles) | ||
reactiveDo(styles[property], (value) => { | ||
if (value !== void 0) | ||
element.style.setProperty(property, value); | ||
else | ||
element.style.removeProperty(property); | ||
}); | ||
}; | ||
const applyClasses = (element, classes) => { | ||
for (const name in classes) | ||
reactiveDo(classes[name], (value) => { | ||
element.classList.toggle(name, value); | ||
}); | ||
}; | ||
const applyAttributes = (element, attributes) => { | ||
for (const name in attributes) | ||
reactiveDo(attributes[name], (value) => { | ||
if (value !== void 0) | ||
element.setAttribute(name, value); | ||
else | ||
element.removeAttribute(name); | ||
}); | ||
}; | ||
const t = (textContent) => { | ||
if (!textContent[isReactive]) | ||
return document.createTextNode(textContent); | ||
const node = document.createTextNode(textContent.value); | ||
textContent.addReaction(() => { | ||
node.textContent = textContent.value; | ||
}); | ||
return node; | ||
}; | ||
const e = (name) => (...variadic) => { | ||
var _a2; | ||
if (isBruhChild(variadic[0])) { | ||
const element2 = document.createElement(name); | ||
element2.append(...bruhChildrenToNodes(...variadic)); | ||
return element2; | ||
} | ||
addProperties(properties = {}) { | ||
Object.assign(this.node, properties); | ||
return this; | ||
const [props, ...children] = variadic; | ||
const { namespace } = (_a2 = props.bruh) != null ? _a2 : {}; | ||
delete props.bruh; | ||
const element = namespace ? document.createElementNS(namespace, name) : document.createElement(name); | ||
if (typeof props.style === "object") { | ||
applyStyles(element, props.style); | ||
delete props.style; | ||
} | ||
} | ||
_c = isMetaNode, _d = isMetaTextNode; | ||
class MetaElement { | ||
constructor(name, namespace) { | ||
__publicField(this, _e, true); | ||
__publicField(this, _f2, true); | ||
__publicField(this, "node"); | ||
this.node = namespace ? document.createElementNS(namespace, name) : document.createElement(name); | ||
if (typeof props.class === "object") { | ||
applyClasses(element, props.class); | ||
delete props.class; | ||
} | ||
static from(element) { | ||
const result = new this("div"); | ||
result.node = element; | ||
return result; | ||
applyAttributes(element, props); | ||
element.append(...bruhChildrenToNodes(...children)); | ||
return element; | ||
}; | ||
const h = (nameOrComponent, props, ...children) => { | ||
if (typeof nameOrComponent === "string") { | ||
const makeElement = e(nameOrComponent); | ||
return props ? makeElement(props, ...children) : makeElement(...children); | ||
} | ||
addProperties(properties = {}) { | ||
Object.assign(this.node, properties); | ||
return this; | ||
} | ||
addAttributes(attributes = {}) { | ||
for (const name in attributes) | ||
reactiveDo(attributes[name], maybeDo((value) => this.node.setAttribute(name, value), () => this.node.removeAttribute(name))); | ||
return this; | ||
} | ||
addDataAttributes(dataAttributes = {}) { | ||
for (const name in dataAttributes) | ||
reactiveDo(dataAttributes[name], maybeDo((value) => this.node.dataset[name] = value, () => delete this.node.dataset[name])); | ||
return this; | ||
} | ||
addStyles(styles = {}) { | ||
for (const property in styles) | ||
reactiveDo(styles[property], maybeDo((value) => this.node.style.setProperty(property, value), () => this.node.style.removeProperty(property))); | ||
return this; | ||
} | ||
toggleClasses(classes = {}) { | ||
for (const name in classes) | ||
reactiveDo(classes[name], (value) => this.node.classList.toggle(name, value)); | ||
return this; | ||
} | ||
before(...xs) { | ||
this.node.before(...childrenToNodes(xs)); | ||
} | ||
prepend(...xs) { | ||
this.node.prepend(...childrenToNodes(xs)); | ||
} | ||
append(...xs) { | ||
this.node.append(...childrenToNodes(xs)); | ||
} | ||
after(...xs) { | ||
this.node.after(...childrenToNodes(xs)); | ||
} | ||
replaceChildren(...xs) { | ||
this.node.replaceChildren(...childrenToNodes(xs)); | ||
} | ||
replaceWith(...xs) { | ||
this.node.replaceWith(...childrenToNodes(xs)); | ||
} | ||
} | ||
_e = isMetaNode, _f2 = isMetaElement; | ||
return nameOrComponent(__spreadProps(__spreadValues({}, props), { children })); | ||
}; | ||
const JSXFragment = ({ children }) => children; | ||
const hydrateTextNodes = () => { | ||
@@ -380,4 +323,5 @@ const tagged = {}; | ||
const textNode = document.createTextNode(bruhTextNode.textContent); | ||
if (bruhTextNode.dataset.tag) | ||
tagged[bruhTextNode.dataset.tag] = textNode; | ||
const tag = bruhTextNode.getAttribute("tag"); | ||
if (tag) | ||
tagged[tag] = textNode; | ||
bruhTextNode.replaceWith(textNode); | ||
@@ -387,37 +331,42 @@ } | ||
}; | ||
const createMetaTextNode = (textContent) => new MetaTextNode(textContent); | ||
const createMetaElement = (name, namespace) => (...variadic) => { | ||
const meta = new MetaElement(name, namespace); | ||
if (!isMetaNodeChild(variadic[0])) { | ||
const [attributes, ...children] = variadic; | ||
meta.addAttributes(attributes); | ||
meta.append(children); | ||
} else { | ||
meta.append(variadic); | ||
} | ||
return meta; | ||
}; | ||
const createMetaElementJSX = (nameOrComponent, attributesOrProps, ...children) => { | ||
if (typeof nameOrComponent == "string") { | ||
const meta = new MetaElement(nameOrComponent); | ||
meta.addAttributes(attributesOrProps || {}); | ||
meta.append(children); | ||
return meta; | ||
} | ||
return nameOrComponent(Object.assign({}, attributesOrProps, { children })); | ||
}; | ||
const JSXFragment = ({ children }) => children; | ||
var index_browser = /* @__PURE__ */ Object.freeze({ | ||
__proto__: null, | ||
[Symbol.toStringTag]: "Module", | ||
childrenToNodes, | ||
MetaTextNode, | ||
MetaElement, | ||
hydrateTextNodes, | ||
t: createMetaTextNode, | ||
e: createMetaElement, | ||
h: createMetaElementJSX, | ||
JSXFragment | ||
bruhChildrenToNodes, | ||
applyStyles, | ||
applyClasses, | ||
applyAttributes, | ||
t, | ||
e, | ||
h, | ||
JSXFragment, | ||
hydrateTextNodes | ||
}); | ||
const pipe = (x, ...fs) => fs.reduce((y, f) => f(y), x); | ||
const dispatch = (target, type, options) => target.dispatchEvent(new CustomEvent(type, __spreadValues({ | ||
bubbles: true, | ||
cancelable: true, | ||
composed: true | ||
}, options))); | ||
const createDestructable = (object, iterable) => { | ||
const destructable = __spreadProps(__spreadValues({}, object), { | ||
[Symbol.iterator]: () => iterable[Symbol.iterator]() | ||
}); | ||
Object.defineProperty(destructable, Symbol.iterator, { | ||
enumerable: false | ||
}); | ||
return destructable; | ||
}; | ||
const functionAsObject = (f) => new Proxy({}, { | ||
get: (_, property) => f(property) | ||
}); | ||
var index = /* @__PURE__ */ Object.freeze({ | ||
__proto__: null, | ||
[Symbol.toStringTag]: "Module", | ||
pipe, | ||
dispatch, | ||
createDestructable, | ||
functionAsObject | ||
}); | ||
export { index_browser as dom, liveFragment, index$1 as reactive, index as util }; | ||
//# sourceMappingURL=bruh.es.js.map |
@@ -1,2 +0,2 @@ | ||
var se=Object.defineProperty,ae=Object.defineProperties;var ie=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var P=(o,s,i)=>s in o?se(o,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[s]=i,_=(o,s)=>{for(var i in s||(s={}))de.call(s,i)&&P(o,i,s[i]);if(U)for(var i of U(s))ce.call(s,i)&&P(o,i,s[i]);return o},B=(o,s)=>ae(o,ie(s));var l=(o,s,i)=>(P(o,typeof s!="symbol"?s+"":s,i),i),C=(o,s,i)=>{if(!s.has(o))throw TypeError("Cannot "+i)};var a=(o,s,i)=>(C(o,s,"read from private field"),i?i.call(o):s.get(o)),u=(o,s,i)=>{if(s.has(o))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(o):s.set(o,i)},m=(o,s,i,v)=>(C(o,s,"write to private field"),v?v.call(o,i):s.set(o,i),i);var W=(o,s,i)=>(C(o,s,"access private method"),i);(function(o,s){typeof exports=="object"&&typeof module!="undefined"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis!="undefined"?globalThis:o||self,s(o.bruh={}))})(this,function(o){var ue,b,M,le,p,S,w,g,E,f,N,T,j,J,he,fe,pe,me;"use strict";class s{constructor(){l(this,"startMarker",document.createTextNode(""));l(this,"endMarker",document.createTextNode(""))}static from(e,t){const n=new this;return e.before(n.startMarker),t.after(n.endMarker),n}before(...e){this.startMarker.before(...e)}prepend(...e){this.startMarker.after(...e)}append(...e){this.endMarker.before(...e)}after(...e){this.endMarker.after(...e)}remove(){const e=document.createRange();e.setStartBefore(this.startMarker),e.setEndAfter(this.endMarker),e.deleteContents()}replaceChildren(...e){const t=document.createRange();t.setStartAfter(this.startMarker),t.setEndBefore(this.endMarker),t.deleteContents(),this.startMarker.after(...e)}replaceWith(...e){this.endMarker.after(...e),this.remove()}get childNodes(){const e=[];for(let t=this.startMarker.nextSibling;t!=this.endMarker&&t;t=t.nextSibling)e.push(t);return e}get children(){return this.childNodes.filter(e=>e instanceof HTMLElement)}}var i=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",LiveFragment:s});const v=Symbol.for("bruh reactive");class Q{constructor(e){l(this,ue,!0);u(this,b,void 0);u(this,M,new Set);m(this,b,e)}get value(){return a(this,b)}set value(e){if(e!==a(this,b)){m(this,b,e);for(const t of a(this,M))t()}}addReaction(e){return a(this,M).add(e),()=>a(this,M).delete(e)}}ue=v,b=new WeakMap,M=new WeakMap;const d=class{constructor(e,t){u(this,j);l(this,le,!0);u(this,p,void 0);u(this,S,new Set);u(this,w,void 0);u(this,g,0);u(this,E,new Set);if(!t){m(this,p,e);return}m(this,p,t()),m(this,w,t),m(this,g,Math.max(...e.map(n=>a(n,g)))+1),e.forEach(n=>a(n,E).add(this))}get value(){return a(d,f).size&&d.applyUpdates(),a(this,p)}set value(e){a(this,g)===0&&(a(d,f).size||queueMicrotask(d.applyUpdates),a(d,f).set(this,e))}addReaction(e){return a(this,S).add(e),()=>a(this,S).delete(e)}static applyUpdates(){var e,t,n;if(!!a(d,f).size){for(const[c,k]of a(d,f).entries())W(e=c,j,J).call(e,k);a(d,f).clear();for(const c of a(d,N))if(c)for(const k of c)W(n=k,j,J).call(n,a(t=k,w).call(t));a(d,N).length=0;for(const c of a(d,T))c();a(d,T).length=0}}};let y=d;le=v,p=new WeakMap,S=new WeakMap,w=new WeakMap,g=new WeakMap,E=new WeakMap,f=new WeakMap,N=new WeakMap,T=new WeakMap,j=new WeakSet,J=function(e){if(e===a(this,p))return;m(this,p,e),a(d,T).push(...a(this,S));const t=a(d,N);for(const n of a(this,E)){const c=a(n,g);t[c]||(t[c]=new Set),t[c].add(n)}},u(y,f,new Map),u(y,N,[]),u(y,T,[]);const X=(r,e)=>new y(r,e),A=(r,e)=>{if(r==null?void 0:r[v])return e(r.value),r.addReaction(()=>e(r.value));e(r)};var q=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",SimpleReactive:Q,FunctionalReactive:y,r:X,reactiveDo:A});const $=(r,...e)=>e.reduce((t,n)=>n(t),r),H=(r,e,t)=>r.dispatchEvent(new CustomEvent(e,_({bubbles:!0,cancelable:!0,composed:!0},t))),I=(r,e)=>{const t=B(_({},r),{[Symbol.iterator]:()=>e[Symbol.iterator]()});return Object.defineProperty(t,Symbol.iterator,{enumerable:!1}),t},R=(r,e)=>t=>{Array.isArray(t)?t.length?r(t[0]):e():r(t)},G=r=>new Proxy({},{get:(e,t)=>r(t)});var K=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",pipe:$,dispatch:H,createDestructable:I,maybeDo:R,functionAsObject:G});const z=Symbol.for("bruh reactive"),O=Symbol.for("bruh meta node"),Y=Symbol.for("bruh meta text node"),Z=Symbol.for("bruh meta element"),V=r=>(r==null?void 0:r[O])||(r==null?void 0:r[z])||r instanceof Node||Array.isArray(r)||r==null||!(typeof r=="function"||typeof r=="object"),D=r=>r[O]?r.node:r instanceof Node?r:document.createTextNode(r),h=r=>r.flat(1/0).flatMap(e=>{if(!e[z])return[D(e)];if(Array.isArray(e.value)){const n=new s;return e.addReaction(()=>{n.replaceChildren(...h(e.value))}),[n.startMarker,...h(e.value),n.endMarker]}let t=D(e.value);return e.addReaction(()=>{const n=t;t=D(e.value),n.replaceWith(t)}),[t]});class L{constructor(e){l(this,he,!0);l(this,fe,!0);l(this,"node");if(!e[z]){this.node=document.createTextNode(e);return}this.node=document.createTextNode(e.value),e.addReaction(()=>{this.node.textContent=e.value})}addProperties(e={}){return Object.assign(this.node,e),this}}he=O,fe=Y;class F{constructor(e,t){l(this,pe,!0);l(this,me,!0);l(this,"node");this.node=t?document.createElementNS(t,e):document.createElement(e)}static from(e){const t=new this("div");return t.node=e,t}addProperties(e={}){return Object.assign(this.node,e),this}addAttributes(e={}){for(const t in e)A(e[t],R(n=>this.node.setAttribute(t,n),()=>this.node.removeAttribute(t)));return this}addDataAttributes(e={}){for(const t in e)A(e[t],R(n=>this.node.dataset[t]=n,()=>delete this.node.dataset[t]));return this}addStyles(e={}){for(const t in e)A(e[t],R(n=>this.node.style.setProperty(t,n),()=>this.node.style.removeProperty(t)));return this}toggleClasses(e={}){for(const t in e)A(e[t],n=>this.node.classList.toggle(t,n));return this}before(...e){this.node.before(...h(e))}prepend(...e){this.node.prepend(...h(e))}append(...e){this.node.append(...h(e))}after(...e){this.node.after(...h(e))}replaceChildren(...e){this.node.replaceChildren(...h(e))}replaceWith(...e){this.node.replaceWith(...h(e))}}pe=O,me=Z;const x=()=>{const r={},e=document.getElementsByTagName("bruh-textnode");for(const t of e){const n=document.createTextNode(t.textContent);t.dataset.tag&&(r[t.dataset.tag]=n),t.replaceWith(n)}return r},ee=r=>new L(r),te=(r,e)=>(...t)=>{const n=new F(r,e);if(V(t[0]))n.append(t);else{const[c,...k]=t;n.addAttributes(c),n.append(k)}return n},re=(r,e,...t)=>{if(typeof r=="string"){const n=new F(r);return n.addAttributes(e||{}),n.append(t),n}return r(Object.assign({},e,{children:t}))},ne=({children:r})=>r;var oe=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",childrenToNodes:h,MetaTextNode:L,MetaElement:F,hydrateTextNodes:x,t:ee,e:te,h:re,JSXFragment:ne});o.dom=oe,o.liveFragment=i,o.reactive=q,o.util=K,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"}); | ||
var ne=Object.defineProperty,oe=Object.defineProperties;var se=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var C=(n,o,i)=>o in n?ne(n,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[o]=i,R=(n,o)=>{for(var i in o||(o={}))ae.call(o,i)&&C(n,i,o[i]);if(W)for(var i of W(o))ie.call(o,i)&&C(n,i,o[i]);return n},F=(n,o)=>oe(n,se(o));var E=(n,o,i)=>(C(n,typeof o!="symbol"?o+"":o,i),i),O=(n,o,i)=>{if(!o.has(n))throw TypeError("Cannot "+i)};var a=(n,o,i)=>(O(n,o,"read from private field"),i?i.call(n):o.get(n)),u=(n,o,i)=>{if(o.has(n))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(n):o.set(n,i)},b=(n,o,i,l)=>(O(n,o,"write to private field"),l?l.call(n,i):o.set(n,i),i);var _=(n,o,i)=>(O(n,o,"access private method"),i);(function(n,o){typeof exports=="object"&&typeof module!="undefined"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis!="undefined"?globalThis:n||self,o(n.bruh={}))})(this,function(n){var ce,m,g,de,h,S,k,y,A,p,M,N,j,q;"use strict";class o{constructor(){E(this,"startMarker",document.createTextNode(""));E(this,"endMarker",document.createTextNode(""))}static from(e,t){const s=new this;return e.before(s.startMarker),t.after(s.endMarker),s}before(...e){this.startMarker.before(...e)}prepend(...e){this.startMarker.after(...e)}append(...e){this.endMarker.before(...e)}after(...e){this.endMarker.after(...e)}remove(){const e=document.createRange();e.setStartBefore(this.startMarker),e.setEndAfter(this.endMarker),e.deleteContents()}replaceChildren(...e){const t=document.createRange();t.setStartAfter(this.startMarker),t.setEndBefore(this.endMarker),t.deleteContents(),this.startMarker.after(...e)}replaceWith(...e){this.endMarker.after(...e),this.remove()}get childNodes(){const e=[];for(let t=this.startMarker.nextSibling;t!=this.endMarker&&t;t=t.nextSibling)e.push(t);return e}get children(){return this.childNodes.filter(e=>e instanceof HTMLElement)}}var i=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",LiveFragment:o});const l=Symbol.for("bruh reactive");class J{constructor(e){E(this,ce,!0);u(this,m,void 0);u(this,g,new Set);b(this,m,e)}get value(){return a(this,m)}set value(e){if(e!==a(this,m)){b(this,m,e);for(const t of a(this,g))t()}}addReaction(e){return a(this,g).add(e),()=>a(this,g).delete(e)}}ce=l,m=new WeakMap,g=new WeakMap;const c=class{constructor(e,t){u(this,j);E(this,de,!0);u(this,h,void 0);u(this,S,new Set);u(this,k,void 0);u(this,y,0);u(this,A,new Set);if(!t){b(this,h,e);return}b(this,h,t()),b(this,k,t),b(this,y,Math.max(...e.map(s=>a(s,y)))+1),e.forEach(s=>a(s,A).add(this))}get value(){return a(c,p).size&&c.applyUpdates(),a(this,h)}set value(e){a(this,y)===0&&(a(c,p).size||queueMicrotask(c.applyUpdates),a(c,p).set(this,e))}addReaction(e){return a(this,S).add(e),()=>a(this,S).delete(e)}static applyUpdates(){var e,t,s;if(!!a(c,p).size){for(const[d,f]of a(c,p).entries())_(e=d,j,q).call(e,f);a(c,p).clear();for(const d of a(c,M))if(d)for(const f of d)_(s=f,j,q).call(s,a(t=f,k).call(t));a(c,M).length=0;for(const d of a(c,N))d();a(c,N).length=0}}};let v=c;de=l,h=new WeakMap,S=new WeakMap,k=new WeakMap,y=new WeakMap,A=new WeakMap,p=new WeakMap,M=new WeakMap,N=new WeakMap,j=new WeakSet,q=function(e){if(e===a(this,h))return;b(this,h,e),a(c,N).push(...a(this,S));const t=a(c,M);for(const s of a(this,A)){const d=a(s,y);t[d]||(t[d]=new Set),t[d].add(s)}},u(v,p,new Map),u(v,M,[]),u(v,N,[]);const X=(r,e)=>new v(r,e),w=(r,e)=>{if(r==null?void 0:r[l])return e(r.value),r.addReaction(()=>e(r.value));e(r)};var H=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",isReactive:l,SimpleReactive:J,FunctionalReactive:v,r:X,reactiveDo:w});const I=r=>(r==null?void 0:r[l])||r instanceof Node||Array.isArray(r)||r==null||!(typeof r=="function"||typeof r=="object"),z=r=>r instanceof Node?r:document.createTextNode(r),T=(...r)=>r.flat(1/0).flatMap(e=>{if(!e[l])return[z(e)];if(Array.isArray(e.value)){const s=new o;return e.addReaction(()=>{s.replaceChildren(...T(...e.value))}),[s.startMarker,...T(...e.value),s.endMarker]}let t=z(e.value);return e.addReaction(()=>{const s=t;t=z(e.value),s.replaceWith(t)}),[t]}),P=(r,e)=>{for(const t in e)w(e[t],s=>{s!==void 0?r.style.setProperty(t,s):r.style.removeProperty(t)})},B=(r,e)=>{for(const t in e)w(e[t],s=>{r.classList.toggle(t,s)})},D=(r,e)=>{for(const t in e)w(e[t],s=>{s!==void 0?r.setAttribute(t,s):r.removeAttribute(t)})},$=r=>{if(!r[l])return document.createTextNode(r);const e=document.createTextNode(r.value);return r.addReaction(()=>{e.textContent=r.value}),e},L=r=>(...e)=>{var U;if(I(e[0])){const Q=document.createElement(r);return Q.append(...T(...e)),Q}const[t,...s]=e,{namespace:d}=(U=t.bruh)!=null?U:{};delete t.bruh;const f=d?document.createElementNS(d,r):document.createElement(r);return typeof t.style=="object"&&(P(f,t.style),delete t.style),typeof t.class=="object"&&(B(f,t.class),delete t.class),D(f,t),f.append(...T(...s)),f},G=(r,e,...t)=>{if(typeof r=="string"){const s=L(r);return e?s(e,...t):s(...t)}return r(F(R({},e),{children:t}))},K=({children:r})=>r,Y=()=>{const r={},e=document.getElementsByTagName("bruh-textnode");for(const t of e){const s=document.createTextNode(t.textContent),d=t.getAttribute("tag");d&&(r[d]=s),t.replaceWith(s)}return r};var Z=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",bruhChildrenToNodes:T,applyStyles:P,applyClasses:B,applyAttributes:D,t:$,e:L,h:G,JSXFragment:K,hydrateTextNodes:Y});const V=(r,...e)=>e.reduce((t,s)=>s(t),r),x=(r,e,t)=>r.dispatchEvent(new CustomEvent(e,R({bubbles:!0,cancelable:!0,composed:!0},t))),ee=(r,e)=>{const t=F(R({},r),{[Symbol.iterator]:()=>e[Symbol.iterator]()});return Object.defineProperty(t,Symbol.iterator,{enumerable:!1}),t},te=r=>new Proxy({},{get:(e,t)=>r(t)});var re=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",pipe:V,dispatch:x,createDestructable:ee,functionAsObject:te});n.dom=Z,n.liveFragment=i,n.reactive=H,n.util=re,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"}); | ||
//# sourceMappingURL=bruh.umd.js.map |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "1.9.2-types.0", | ||
"version": "1.10.0", | ||
"license": "MIT", | ||
@@ -54,16 +54,8 @@ "author": { | ||
"optionalDependencies": { | ||
"cac": "^6.7.3", | ||
"sharp": "^0.28.3" | ||
"cac": "^6.7.11", | ||
"sharp": "^0.29.2" | ||
}, | ||
"devDependencies": { | ||
"vite": "^2.5.10" | ||
}, | ||
"browserslist": [ | ||
"ios_saf >= 12.4", | ||
"and_chr >= 88", | ||
"chrome >= 87", | ||
"safari >= 13.1", | ||
"edge >= 87", | ||
"firefox >= 84" | ||
] | ||
"vite": "^2.6.10" | ||
} | ||
} |
@@ -47,3 +47,1 @@ <header> | ||
[Right here](https://technicalsource.dev/bruh) | ||
https://codesandbox.io/s/github/Technical-Source/bruh/tree/main/packages/create-bruh/vite |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
85002
18
1105
47