-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
unverified bugBug yet to be verifiedBug yet to be verifiedwebcomponentsrelated to solid-element, custom elements, shadow dom, or other web component related featuresrelated to solid-element, custom elements, shadow dom, or other web component related features
Description
Describe the bug
WaitingListForm-ydmxd16g.js:1044 Uncaught TypeError: ComponentType is not a function
at WaitingListForm-ydmxd16g.js:1044:20
at updateFn (WaitingListForm-ydmxd16g.js:12:38)
at runUpdates (WaitingListForm-ydmxd16g.js:321:17)
at createRoot (WaitingListForm-ydmxd16g.js:16:12)
at WaitingListForm-ydmxd16g.js:1037:12
at CustomElement.connectedCallback (WaitingListForm-ydmxd16g.js:682:11)
at WaitingListForm-ydmxd16g.js:747:20
at customElement (WaitingListForm-ydmxd16g.js:1054:30)
at WaitingListForm.js:50:1Your Example Website or App
https://github.com/solidjs/solid/issues/new?assignees=&labels=&projects=&template=bug_report.yml
Steps to Reproduce the Bug or Issue
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Waiting List Form Example</title>
<script
type="module"
src="/public/web-components/WaitingListForm.js"
></script>
</head>
<body>
<h1>Join Our Waiting List</h1>
<waiting-list-form></waiting-list-form>
</body>
</html>From
import { createSignal } from "solid-js";
import { customElement } from "solid-element";
export function WaitingListForm() {
const [email, setEmail] = createSignal("");
const [submitted, setSubmitted] = createSignal(false);
const handleSubmit = (e) => {
e.preventDefault();
console.log("Submitted email:", email());
setSubmitted(true);
};
return (
<div>
{!submitted() ? (
<form onSubmit={handleSubmit} class="space-y-4">
<input
type="email"
value={email()}
onInput={(e) => setEmail(e.currentTarget.value)}
placeholder="Enter your email"
required
class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500"
/>
<button
type="submit"
class="w-full px-5 py-2.5 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
Join Waiting List
</button>
</form>
) : (
<p class="text-green-600">Thank you for joining our waiting list!</p>
)}
</div>
);
}
if (import.meta.env.WEB_COMPONENTS) {
customElement("waiting-list-form", WaitingListForm, {});
}Using
tsc --project tsconfig.json && bun build src/web-components/*.jsx --outdir=public/web-components --splitting --target browser --chunks && rm -rf public/web-components-tempbunx serve .{
"extends": "astro/tsconfigs/base",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js"
}
}To
WaitingListForm.js
import {
createSignal,
customElement
} from "./WaitingListForm-ydmxd16g.js";
// src/web-components/WaitingListForm.jsx
function WaitingListForm() {
const [email, setEmail] = createSignal("");
const [submitted, setSubmitted] = createSignal(false);
const handleSubmit = (e) => {
e.preventDefault();
console.log("Submitted email:", email());
setSubmitted(true);
};
return /* @__PURE__ */ React.createElement("div", null, !submitted() ? /* @__PURE__ */ React.createElement("form", {
onSubmit: handleSubmit,
class: "space-y-4"
}, /* @__PURE__ */ React.createElement("input", {
type: "email",
value: email(),
onInput: (e) => setEmail(e.currentTarget.value),
placeholder: "Enter your email",
required: true,
class: "w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500"
}), /* @__PURE__ */ React.createElement("button", {
type: "submit",
class: "w-full px-5 py-2.5 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
}, "Join Waiting List")) : /* @__PURE__ */ React.createElement("p", {
class: "text-green-600"
}, "Thank you for joining our waiting list!"));
}
customElement("waiting-list-form", WaitingListForm, {});
export {
WaitingListForm
};WaitingListForm-ydmxd16g.js
// node_modules/solid-js/dist/solid.js
function getContextId(count) {
const num = String(count), len = num.length - 1;
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
}
function createRoot(fn, detachedOwner) {
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === undefined ? owner : detachedOwner, root = unowned ? UNOWNED : {
owned: null,
cleanups: null,
context: current ? current.context : null,
owner: current
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
Owner = root;
Listener = null;
try {
return runUpdates(updateFn, true);
} finally {
Listener = listener;
Owner = owner;
}
}
function createSignal(value, options) {
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
const s = {
value,
observers: null,
observerSlots: null,
comparator: options.equals || undefined
};
const setter = (value2) => {
if (typeof value2 === "function") {
if (Transition && Transition.running && Transition.sources.has(s))
value2 = value2(s.tValue);
else
value2 = value2(s.value);
}
return writeSignal(s, value2);
};
return [readSignal.bind(s), setter];
}
function createRenderEffect(fn, value, options) {
const c = createComputation(fn, value, false, STALE);
if (Scheduler && Transition && Transition.running)
Updates.push(c);
else
updateComputation(c);
}
function untrack(fn) {
if (!ExternalSourceConfig && Listener === null)
return fn();
const listener = Listener;
Listener = null;
try {
if (ExternalSourceConfig)
return ExternalSourceConfig.untrack(fn);
return fn();
} finally {
Listener = listener;
}
}
function onCleanup(fn) {
if (Owner === null)
;
else if (Owner.cleanups === null)
Owner.cleanups = [fn];
else
Owner.cleanups.push(fn);
return fn;
}
function startTransition(fn) {
if (Transition && Transition.running) {
fn();
return Transition.done;
}
const l = Listener;
const o = Owner;
return Promise.resolve().then(() => {
Listener = l;
Owner = o;
let t;
if (Scheduler || SuspenseContext) {
t = Transition || (Transition = {
sources: new Set,
effects: [],
promises: new Set,
disposed: new Set,
queue: new Set,
running: true
});
t.done || (t.done = new Promise((res) => t.resolve = res));
t.running = true;
}
runUpdates(fn, false);
Listener = Owner = null;
return t ? t.done : undefined;
});
}
function readSignal() {
const runningTransition = Transition && Transition.running;
if (this.sources && (runningTransition ? this.tState : this.state)) {
if ((runningTransition ? this.tState : this.state) === STALE)
updateComputation(this);
else {
const updates = Updates;
Updates = null;
runUpdates(() => lookUpstream(this), false);
Updates = updates;
}
}
if (Listener) {
const sSlot = this.observers ? this.observers.length : 0;
if (!Listener.sources) {
Listener.sources = [this];
Listener.sourceSlots = [sSlot];
} else {
Listener.sources.push(this);
Listener.sourceSlots.push(sSlot);
}
if (!this.observers) {
this.observers = [Listener];
this.observerSlots = [Listener.sources.length - 1];
} else {
this.observers.push(Listener);
this.observerSlots.push(Listener.sources.length - 1);
}
}
if (runningTransition && Transition.sources.has(this))
return this.tValue;
return this.value;
}
function writeSignal(node, value, isComp) {
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
if (!node.comparator || !node.comparator(current, value)) {
if (Transition) {
const TransitionRunning = Transition.running;
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
Transition.sources.add(node);
node.tValue = value;
}
if (!TransitionRunning)
node.value = value;
} else
node.value = value;
if (node.observers && node.observers.length) {
runUpdates(() => {
for (let i = 0;i < node.observers.length; i += 1) {
const o = node.observers[i];
const TransitionRunning = Transition && Transition.running;
if (TransitionRunning && Transition.disposed.has(o))
continue;
if (TransitionRunning ? !o.tState : !o.state) {
if (o.pure)
Updates.push(o);
else
Effects.push(o);
if (o.observers)
markDownstream(o);
}
if (!TransitionRunning)
o.state = STALE;
else
o.tState = STALE;
}
if (Updates.length > 1e6) {
Updates = [];
if (false)
;
throw new Error;
}
}, false);
}
}
return value;
}
function updateComputation(node) {
if (!node.fn)
return;
cleanNode(node);
const time = ExecCount;
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
if (Transition && !Transition.running && Transition.sources.has(node)) {
queueMicrotask(() => {
runUpdates(() => {
Transition && (Transition.running = true);
Listener = Owner = node;
runComputation(node, node.tValue, time);
Listener = Owner = null;
}, false);
});
}
}
function runComputation(node, value, time) {
let nextValue;
const owner = Owner, listener = Listener;
Listener = Owner = node;
try {
nextValue = node.fn(value);
} catch (err) {
if (node.pure) {
if (Transition && Transition.running) {
node.tState = STALE;
node.tOwned && node.tOwned.forEach(cleanNode);
node.tOwned = undefined;
} else {
node.state = STALE;
node.owned && node.owned.forEach(cleanNode);
node.owned = null;
}
}
node.updatedAt = time + 1;
return handleError(err);
} finally {
Listener = listener;
Owner = owner;
}
if (!node.updatedAt || node.updatedAt <= time) {
if (node.updatedAt != null && "observers" in node) {
writeSignal(node, nextValue, true);
} else if (Transition && Transition.running && node.pure) {
Transition.sources.add(node);
node.tValue = nextValue;
} else
node.value = nextValue;
node.updatedAt = time;
}
}
function createComputation(fn, init, pure, state = STALE, options) {
const c = {
fn,
state,
updatedAt: null,
owned: null,
sources: null,
sourceSlots: null,
cleanups: null,
value: init,
owner: Owner,
context: Owner ? Owner.context : null,
pure
};
if (Transition && Transition.running) {
c.state = 0;
c.tState = state;
}
if (Owner === null)
;
else if (Owner !== UNOWNED) {
if (Transition && Transition.running && Owner.pure) {
if (!Owner.tOwned)
Owner.tOwned = [c];
else
Owner.tOwned.push(c);
} else {
if (!Owner.owned)
Owner.owned = [c];
else
Owner.owned.push(c);
}
}
if (ExternalSourceConfig && c.fn) {
const [track, trigger] = createSignal(undefined, {
equals: false
});
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
onCleanup(() => ordinary.dispose());
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
c.fn = (x) => {
track();
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
};
}
return c;
}
function runTop(node) {
const runningTransition = Transition && Transition.running;
if ((runningTransition ? node.tState : node.state) === 0)
return;
if ((runningTransition ? node.tState : node.state) === PENDING)
return lookUpstream(node);
if (node.suspense && untrack(node.suspense.inFallback))
return node.suspense.effects.push(node);
const ancestors = [node];
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
if (runningTransition && Transition.disposed.has(node))
return;
if (runningTransition ? node.tState : node.state)
ancestors.push(node);
}
for (let i = ancestors.length - 1;i >= 0; i--) {
node = ancestors[i];
if (runningTransition) {
let top = node, prev = ancestors[i + 1];
while ((top = top.owner) && top !== prev) {
if (Transition.disposed.has(top))
return;
}
}
if ((runningTransition ? node.tState : node.state) === STALE) {
updateComputation(node);
} else if ((runningTransition ? node.tState : node.state) === PENDING) {
const updates = Updates;
Updates = null;
runUpdates(() => lookUpstream(node, ancestors[0]), false);
Updates = updates;
}
}
}
function runUpdates(fn, init) {
if (Updates)
return fn();
let wait = false;
if (!init)
Updates = [];
if (Effects)
wait = true;
else
Effects = [];
ExecCount++;
try {
const res = fn();
completeUpdates(wait);
return res;
} catch (err) {
if (!wait)
Effects = null;
Updates = null;
handleError(err);
}
}
function completeUpdates(wait) {
if (Updates) {
if (Scheduler && Transition && Transition.running)
scheduleQueue(Updates);
else
runQueue(Updates);
Updates = null;
}
if (wait)
return;
let res;
if (Transition) {
if (!Transition.promises.size && !Transition.queue.size) {
const sources = Transition.sources;
const disposed = Transition.disposed;
Effects.push.apply(Effects, Transition.effects);
res = Transition.resolve;
for (const e2 of Effects) {
"tState" in e2 && (e2.state = e2.tState);
delete e2.tState;
}
Transition = null;
runUpdates(() => {
for (const d of disposed)
cleanNode(d);
for (const v of sources) {
v.value = v.tValue;
if (v.owned) {
for (let i = 0, len = v.owned.length;i < len; i++)
cleanNode(v.owned[i]);
}
if (v.tOwned)
v.owned = v.tOwned;
delete v.tValue;
delete v.tOwned;
v.tState = 0;
}
setTransPending(false);
}, false);
} else if (Transition.running) {
Transition.running = false;
Transition.effects.push.apply(Transition.effects, Effects);
Effects = null;
setTransPending(true);
return;
}
}
const e = Effects;
Effects = null;
if (e.length)
runUpdates(() => runEffects(e), false);
if (res)
res();
}
function runQueue(queue) {
for (let i = 0;i < queue.length; i++)
runTop(queue[i]);
}
function scheduleQueue(queue) {
for (let i = 0;i < queue.length; i++) {
const item = queue[i];
const tasks = Transition.queue;
if (!tasks.has(item)) {
tasks.add(item);
Scheduler(() => {
tasks.delete(item);
runUpdates(() => {
Transition.running = true;
runTop(item);
}, false);
Transition && (Transition.running = false);
});
}
}
}
function lookUpstream(node, ignore) {
const runningTransition = Transition && Transition.running;
if (runningTransition)
node.tState = 0;
else
node.state = 0;
for (let i = 0;i < node.sources.length; i += 1) {
const source = node.sources[i];
if (source.sources) {
const state = runningTransition ? source.tState : source.state;
if (state === STALE) {
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
runTop(source);
} else if (state === PENDING)
lookUpstream(source, ignore);
}
}
}
function markDownstream(node) {
const runningTransition = Transition && Transition.running;
for (let i = 0;i < node.observers.length; i += 1) {
const o = node.observers[i];
if (runningTransition ? !o.tState : !o.state) {
if (runningTransition)
o.tState = PENDING;
else
o.state = PENDING;
if (o.pure)
Updates.push(o);
else
Effects.push(o);
o.observers && markDownstream(o);
}
}
}
function cleanNode(node) {
let i;
if (node.sources) {
while (node.sources.length) {
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
if (obs && obs.length) {
const n = obs.pop(), s = source.observerSlots.pop();
if (index < obs.length) {
n.sourceSlots[s] = index;
obs[index] = n;
source.observerSlots[index] = s;
}
}
}
}
if (Transition && Transition.running && node.pure) {
if (node.tOwned) {
for (i = node.tOwned.length - 1;i >= 0; i--)
cleanNode(node.tOwned[i]);
delete node.tOwned;
}
reset(node, true);
} else if (node.owned) {
for (i = node.owned.length - 1;i >= 0; i--)
cleanNode(node.owned[i]);
node.owned = null;
}
if (node.cleanups) {
for (i = node.cleanups.length - 1;i >= 0; i--)
node.cleanups[i]();
node.cleanups = null;
}
if (Transition && Transition.running)
node.tState = 0;
else
node.state = 0;
}
function reset(node, top) {
if (!top) {
node.tState = 0;
Transition.disposed.add(node);
}
if (node.owned) {
for (let i = 0;i < node.owned.length; i++)
reset(node.owned[i]);
}
}
function castError(err) {
if (err instanceof Error)
return err;
return new Error(typeof err === "string" ? err : "Unknown error", {
cause: err
});
}
function runErrors(err, fns, owner) {
try {
for (const f of fns)
f(err);
} catch (e) {
handleError(e, owner && owner.owner || null);
}
}
function handleError(err, owner = Owner) {
const fns = ERROR && owner && owner.context && owner.context[ERROR];
const error = castError(err);
if (!fns)
throw error;
if (Effects)
Effects.push({
fn() {
runErrors(error, fns, owner);
},
state: STALE
});
else
runErrors(error, fns, owner);
}
var sharedConfig = {
context: undefined,
registry: undefined,
effects: undefined,
done: false,
getContextId() {
return getContextId(this.context.count);
},
getNextContextId() {
return getContextId(this.context.count++);
}
};
var equalFn = (a, b) => a === b;
var $PROXY = Symbol("solid-proxy");
var $TRACK = Symbol("solid-track");
var $DEVCOMP = Symbol("solid-dev-component");
var signalOptions = {
equals: equalFn
};
var ERROR = null;
var runEffects = runQueue;
var STALE = 1;
var PENDING = 2;
var UNOWNED = {
owned: null,
cleanups: null,
context: null,
owner: null
};
var Owner = null;
var Transition = null;
var Scheduler = null;
var ExternalSourceConfig = null;
var Listener = null;
var Updates = null;
var Effects = null;
var ExecCount = 0;
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
var SuspenseContext;
var FALLBACK = Symbol("fallback");
// node_modules/component-register/dist/component-register.js
function cloneProps(props) {
const propKeys = Object.keys(props);
return propKeys.reduce((memo, k) => {
const prop = props[k];
memo[k] = Object.assign({}, prop);
if (isObject(prop.value) && !isFunction(prop.value) && !Array.isArray(prop.value))
memo[k].value = Object.assign({}, prop.value);
if (Array.isArray(prop.value))
memo[k].value = prop.value.slice(0);
return memo;
}, {});
}
function normalizePropDefs(props) {
if (!props)
return {};
const propKeys = Object.keys(props);
return propKeys.reduce((memo, k) => {
const v = props[k];
memo[k] = !(isObject(v) && ("value" in v)) ? {
value: v
} : v;
memo[k].attribute || (memo[k].attribute = toAttribute(k));
memo[k].parse = "parse" in memo[k] ? memo[k].parse : typeof memo[k].value !== "string";
return memo;
}, {});
}
function propValues(props) {
const propKeys = Object.keys(props);
return propKeys.reduce((memo, k) => {
memo[k] = props[k].value;
return memo;
}, {});
}
function initializeProps(element, propDefinition) {
const props = cloneProps(propDefinition), propKeys = Object.keys(propDefinition);
propKeys.forEach((key) => {
const prop = props[key], attr = element.getAttribute(prop.attribute), value = element[key];
if (attr)
prop.value = prop.parse ? parseAttributeValue(attr) : attr;
if (value != null)
prop.value = Array.isArray(value) ? value.slice(0) : value;
prop.reflect && reflect(element, prop.attribute, prop.value, !!prop.parse);
Object.defineProperty(element, key, {
get() {
return prop.value;
},
set(val) {
const oldValue = prop.value;
prop.value = val;
prop.reflect && reflect(this, prop.attribute, prop.value, !!prop.parse);
for (let i = 0, l = this.__propertyChangedCallbacks.length;i < l; i++) {
this.__propertyChangedCallbacks[i](key, val, oldValue);
}
},
enumerable: true,
configurable: true
});
});
return props;
}
function parseAttributeValue(value) {
if (!value)
return;
try {
return JSON.parse(value);
} catch (err) {
return value;
}
}
function reflect(node, attribute, value, parse) {
if (value == null || value === false)
return node.removeAttribute(attribute);
let reflect2 = parse ? JSON.stringify(value) : value;
node.__updating[attribute] = true;
if (reflect2 === "true")
reflect2 = "";
node.setAttribute(attribute, reflect2);
Promise.resolve().then(() => delete node.__updating[attribute]);
}
function toAttribute(propName) {
return propName.replace(/\.?([A-Z]+)/g, (x, y) => "-" + y.toLowerCase()).replace("_", "-").replace(/^-/, "");
}
function isObject(obj) {
return obj != null && (typeof obj === "object" || typeof obj === "function");
}
function isFunction(val) {
return Object.prototype.toString.call(val) === "[object Function]";
}
function isConstructor(f) {
return typeof f === "function" && f.toString().indexOf("class") === 0;
}
function createElementType(BaseElement, propDefinition) {
const propKeys = Object.keys(propDefinition);
return class CustomElement extends BaseElement {
static get observedAttributes() {
return propKeys.map((k) => propDefinition[k].attribute);
}
constructor() {
super();
this.__initialized = false;
this.__released = false;
this.__releaseCallbacks = [];
this.__propertyChangedCallbacks = [];
this.__updating = {};
this.props = {};
}
connectedCallback() {
if (this.__initialized)
return;
this.__releaseCallbacks = [];
this.__propertyChangedCallbacks = [];
this.__updating = {};
this.props = initializeProps(this, propDefinition);
const props = propValues(this.props), ComponentType = this.Component, outerElement = currentElement;
try {
currentElement = this;
this.__initialized = true;
if (isConstructor(ComponentType))
new ComponentType(props, {
element: this
});
else
ComponentType(props, {
element: this
});
} finally {
currentElement = outerElement;
}
}
async disconnectedCallback() {
await Promise.resolve();
if (this.isConnected)
return;
this.__propertyChangedCallbacks.length = 0;
let callback = null;
while (callback = this.__releaseCallbacks.pop())
callback(this);
delete this.__initialized;
this.__released = true;
}
attributeChangedCallback(name, oldVal, newVal) {
if (!this.__initialized)
return;
if (this.__updating[name])
return;
name = this.lookupProp(name);
if (name in propDefinition) {
if (newVal == null && !this[name])
return;
this[name] = propDefinition[name].parse ? parseAttributeValue(newVal) : newVal;
}
}
lookupProp(attrName) {
if (!propDefinition)
return;
return propKeys.find((k) => attrName === k || attrName === propDefinition[k].attribute);
}
get renderRoot() {
return this.shadowRoot || this.attachShadow({
mode: "open"
});
}
addReleaseCallback(fn) {
this.__releaseCallbacks.push(fn);
}
addPropertyChangedCallback(fn) {
this.__propertyChangedCallbacks.push(fn);
}
};
}
function register(tag, props = {}, options = {}) {
const {
BaseElement = HTMLElement,
extension,
customElements = window.customElements
} = options;
return (ComponentType) => {
if (!tag)
throw new Error("tag is required to register a Component");
let ElementType = customElements.get(tag);
if (ElementType) {
ElementType.prototype.Component = ComponentType;
return ElementType;
}
ElementType = createElementType(BaseElement, normalizePropDefs(props));
ElementType.prototype.Component = ComponentType;
ElementType.prototype.registeredTag = tag;
customElements.define(tag, ElementType, extension);
return ElementType;
};
}
var currentElement;
var EC = Symbol("element-context");
// node_modules/solid-js/web/dist/web.js
function reconcileArrays(parentNode, a, b) {
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
while (aStart < aEnd || bStart < bEnd) {
if (a[aStart] === b[bStart]) {
aStart++;
bStart++;
continue;
}
while (a[aEnd - 1] === b[bEnd - 1]) {
aEnd--;
bEnd--;
}
if (aEnd === aStart) {
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
while (bStart < bEnd)
parentNode.insertBefore(b[bStart++], node);
} else if (bEnd === bStart) {
while (aStart < aEnd) {
if (!map || !map.has(a[aStart]))
a[aStart].remove();
aStart++;
}
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
const node = a[--aEnd].nextSibling;
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
parentNode.insertBefore(b[--bEnd], node);
a[aEnd] = b[bEnd];
} else {
if (!map) {
map = new Map;
let i = bStart;
while (i < bEnd)
map.set(b[i], i++);
}
const index = map.get(a[aStart]);
if (index != null) {
if (bStart < index && index < bEnd) {
let i = aStart, sequence = 1, t;
while (++i < aEnd && i < bEnd) {
if ((t = map.get(a[i])) == null || t !== index + sequence)
break;
sequence++;
}
if (sequence > index - bStart) {
const node = a[aStart];
while (bStart < index)
parentNode.insertBefore(b[bStart++], node);
} else
parentNode.replaceChild(b[bStart++], a[aStart++]);
} else
aStart++;
} else
a[aStart++].remove();
}
}
}
function insert(parent, accessor, marker, initial) {
if (marker !== undefined && !initial)
initial = [];
if (typeof accessor !== "function")
return insertExpression(parent, accessor, initial, marker);
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
}
function isHydrating(node) {
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
}
function insertExpression(parent, value, current, marker, unwrapArray) {
const hydrating = isHydrating(parent);
if (hydrating) {
!current && (current = [...parent.childNodes]);
let cleaned = [];
for (let i = 0;i < current.length; i++) {
const node = current[i];
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$")
node.remove();
else
cleaned.push(node);
}
current = cleaned;
}
while (typeof current === "function")
current = current();
if (value === current)
return current;
const t = typeof value, multi = marker !== undefined;
parent = multi && current[0] && current[0].parentNode || parent;
if (t === "string" || t === "number") {
if (hydrating)
return current;
if (t === "number") {
value = value.toString();
if (value === current)
return current;
}
if (multi) {
let node = current[0];
if (node && node.nodeType === 3) {
node.data !== value && (node.data = value);
} else
node = document.createTextNode(value);
current = cleanChildren(parent, current, marker, node);
} else {
if (current !== "" && typeof current === "string") {
current = parent.firstChild.data = value;
} else
current = parent.textContent = value;
}
} else if (value == null || t === "boolean") {
if (hydrating)
return current;
current = cleanChildren(parent, current, marker);
} else if (t === "function") {
createRenderEffect(() => {
let v = value();
while (typeof v === "function")
v = v();
current = insertExpression(parent, v, current, marker);
});
return () => current;
} else if (Array.isArray(value)) {
const array = [];
const currentArray = current && Array.isArray(current);
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
return () => current;
}
if (hydrating) {
if (!array.length)
return current;
if (marker === undefined)
return current = [...parent.childNodes];
let node = array[0];
if (node.parentNode !== parent)
return current;
const nodes = [node];
while ((node = node.nextSibling) !== marker)
nodes.push(node);
return current = nodes;
}
if (array.length === 0) {
current = cleanChildren(parent, current, marker);
if (multi)
return current;
} else if (currentArray) {
if (current.length === 0) {
appendNodes(parent, array, marker);
} else
reconcileArrays(parent, current, array);
} else {
current && cleanChildren(parent);
appendNodes(parent, array);
}
current = array;
} else if (value.nodeType) {
if (hydrating && value.parentNode)
return current = multi ? [value] : value;
if (Array.isArray(current)) {
if (multi)
return current = cleanChildren(parent, current, marker, value);
cleanChildren(parent, current, null, value);
} else if (current == null || current === "" || !parent.firstChild) {
parent.appendChild(value);
} else
parent.replaceChild(value, parent.firstChild);
current = value;
} else
;
return current;
}
function normalizeIncomingArray(normalized, array, current, unwrap) {
let dynamic = false;
for (let i = 0, len = array.length;i < len; i++) {
let item = array[i], prev = current && current[normalized.length], t;
if (item == null || item === true || item === false)
;
else if ((t = typeof item) === "object" && item.nodeType) {
normalized.push(item);
} else if (Array.isArray(item)) {
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
} else if (t === "function") {
if (unwrap) {
while (typeof item === "function")
item = item();
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
} else {
normalized.push(item);
dynamic = true;
}
} else {
const value = String(item);
if (prev && prev.nodeType === 3 && prev.data === value)
normalized.push(prev);
else
normalized.push(document.createTextNode(value));
}
}
return dynamic;
}
function appendNodes(parent, array, marker = null) {
for (let i = 0, len = array.length;i < len; i++)
parent.insertBefore(array[i], marker);
}
function cleanChildren(parent, current, marker, replacement) {
if (marker === undefined)
return parent.textContent = "";
const node = replacement || document.createTextNode("");
if (current.length) {
let inserted = false;
for (let i = current.length - 1;i >= 0; i--) {
const el = current[i];
if (node !== el) {
const isParent = el.parentNode === parent;
if (!inserted && !i)
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
else
isParent && el.remove();
} else
inserted = true;
}
} else
parent.insertBefore(node, marker);
return [node];
}
var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
var Aliases = /* @__PURE__ */ Object.assign(Object.create(null), {
className: "class",
htmlFor: "for"
});
var PropAliases = /* @__PURE__ */ Object.assign(Object.create(null), {
class: "className",
formnovalidate: {
$: "formNoValidate",
BUTTON: 1,
INPUT: 1
},
ismap: {
$: "isMap",
IMG: 1
},
nomodule: {
$: "noModule",
SCRIPT: 1
},
playsinline: {
$: "playsInline",
VIDEO: 1
},
readonly: {
$: "readOnly",
INPUT: 1,
TEXTAREA: 1
}
});
var RequestContext = Symbol();
// node_modules/solid-element/dist/index.js
function createProps(raw) {
const keys = Object.keys(raw);
const props = {};
for (let i = 0;i < keys.length; i++) {
const [get, set] = createSignal(raw[keys[i]]);
Object.defineProperty(props, keys[i], {
get,
set(v) {
set(() => v);
}
});
}
return props;
}
function lookupContext(el) {
if (el.assignedSlot && el.assignedSlot._$owner)
return el.assignedSlot._$owner;
let next = el.parentNode;
while (next && !next._$owner && !(next.assignedSlot && next.assignedSlot._$owner))
next = next.parentNode;
return next && next.assignedSlot ? next.assignedSlot._$owner : el._$owner;
}
function withSolid(ComponentType) {
return (rawProps, options) => {
const { element } = options;
return createRoot((dispose) => {
const props = createProps(rawProps);
element.addPropertyChangedCallback((key, val) => props[key] = val);
element.addReleaseCallback(() => {
element.renderRoot.textContent = "";
dispose();
});
const comp = ComponentType(props, options);
return insert(element.renderRoot, comp);
}, lookupContext(element));
};
}
function customElement(tag, props, ComponentType) {
if (arguments.length === 2) {
ComponentType = props;
props = {};
}
return register(tag, props)(withSolid(ComponentType));
}
export { createSignal, customElement };Expected behavior
It must work
Screenshots or Videos
No response
Platform
- OS: Linux Jeferson 5.15.146.1-microsoft-standard-WSL2 JSXFragment / jsx-dom-expressions #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux
- Browser: Brave
- Version: 1.71.66
Additional context
package.json
{
"name": "xyz",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro",
"build:web-components": "tsc --project tsconfig.json && bun build src/web-components/*.jsx --outdir=public/web-components --splitting --target browser --chunks && rm -rf public/web-components-temp"
},
"dependencies": {
"@astrojs/check": "^0.4.1",
"@astrojs/lit": "^4.3.0",
"@astrojs/solid-js": "^4.4.1",
"@astrojs/tailwind": "^5.1.0",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^4.15.4",
"astro-compressor": "^0.4.1",
"astro-purgecss": "^4.6.0",
"astrojs-service-worker": "^2.0.0",
"caniuse-lite": "^1.0.30001658",
"flowbite": "^2.5.1",
"lit": "^3.2.0",
"purgecss": "^5.0.0",
"solid-element": "^1.8.1",
"solid-js": "^1.8.22",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"workbox-precaching": "^7.1.0",
"workbox-routing": "^7.1.0"
},
"devDependencies": {
"@types/bun": "^1.1.8",
"prettier": "^3.3.3"
}
}astro.config.mjs
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import solidJs from "@astrojs/solid-js";
import compressor from "astro-compressor";
import purgecss from "astro-purgecss";
import { createRequire } from "module";
import lit from "@astrojs/lit";
const require = createRequire(import.meta.url);
// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), solidJs(), compressor(), // serviceWorker({
// enableInDevelopment: true,
// workbox: {
// // Path to your service worker file
// swSrc: require.resolve("./src/service-worker.js"),
// },
// }),
purgecss(), lit()],
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
unverified bugBug yet to be verifiedBug yet to be verifiedwebcomponentsrelated to solid-element, custom elements, shadow dom, or other web component related featuresrelated to solid-element, custom elements, shadow dom, or other web component related features