@qwik-custom-elements/adapter-stencil 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +2 -3
  2. package/dist/bundle-graph.json +1 -1
  3. package/dist/client/client-setup.d.ts +1 -1
  4. package/dist/client/index.qwik.mjs +178 -0
  5. package/dist/client/stencil-csr.d.ts +2 -2
  6. package/dist/index.qwik.mjs +224 -191
  7. package/dist/q-manifest.json +24 -336
  8. package/dist/qwikloader-BOWbeQFD.js +101 -0
  9. package/dist/ssr/index.qwik.mjs +346 -0
  10. package/dist/ssr/stencil-ssr.d.ts +40 -7
  11. package/dist/ssr/stencil-ssr.d.ts.map +1 -1
  12. package/dist/ssr/styles-core.d.ts +2 -2
  13. package/package.json +15 -14
  14. package/dist/client/client-setup.test.d.ts +0 -2
  15. package/dist/client/client-setup.test.d.ts.map +0 -1
  16. package/dist/client/index.cjs +0 -1
  17. package/dist/client/index.js +0 -6
  18. package/dist/client/stencil-csr-props.test.d.ts +0 -2
  19. package/dist/client/stencil-csr-props.test.d.ts.map +0 -1
  20. package/dist/client-setup-C_qW_ZSR.cjs +0 -1
  21. package/dist/client-setup-D-ffVtNL.js +0 -53
  22. package/dist/client-setup.ts_createStencilClientSetup_runSetup_6wDTmOSdSbc-CPKK-h2J.js +0 -11
  23. package/dist/client-setup.ts_createStencilClientSetup_runSetup_6wDTmOSdSbc-Dz0z3zer.cjs +0 -1
  24. package/dist/core.min-Qm7Mxv6F.js +0 -1846
  25. package/dist/core.min-vJ4M2jcU.cjs +0 -2
  26. package/dist/index.qwik.cjs +0 -8
  27. package/dist/index.test.d.ts +0 -2
  28. package/dist/index.test.d.ts.map +0 -1
  29. package/dist/preloader-Bietv0BS.js +0 -118
  30. package/dist/preloader-Cqc--uBU.cjs +0 -1
  31. package/dist/qwikloader-C01zMTOC.js +0 -102
  32. package/dist/qwikloader-vFGnpgvG.cjs +0 -2
  33. package/dist/ssr/element-props-utils.test.d.ts +0 -2
  34. package/dist/ssr/element-props-utils.test.d.ts.map +0 -1
  35. package/dist/ssr/index.cjs +0 -1
  36. package/dist/ssr/index.js +0 -29
  37. package/dist/ssr/styles-core.test.d.ts +0 -2
  38. package/dist/ssr/styles-core.test.d.ts.map +0 -1
  39. package/dist/stencil-csr-B1U9s3VQ.js +0 -24
  40. package/dist/stencil-csr-D6zt1Am9.cjs +0 -1
  41. package/dist/stencil-csr.tsx_createStencilCSRComponent_component_pD3ekIZcUT0-ChAZ0hL3.js +0 -37
  42. package/dist/stencil-csr.tsx_createStencilCSRComponent_component_pD3ekIZcUT0-cGN__hqm.cjs +0 -1
  43. package/dist/stencil-csr.tsx_createStencilCSRComponent_component_useVisibleTask_1_dqWPXf9eNnk-BYiBxXW-.js +0 -34
  44. package/dist/stencil-csr.tsx_createStencilCSRComponent_component_useVisibleTask_1_dqWPXf9eNnk-sFN0uMI_.cjs +0 -1
  45. package/dist/stencil-csr.tsx_createStencilCSRComponent_component_useVisibleTask_y00qkhhKua8-BSsN2V78.cjs +0 -1
  46. package/dist/stencil-csr.tsx_createStencilCSRComponent_component_useVisibleTask_y00qkhhKua8-CF00O7hf.js +0 -19
  47. package/dist/stencil-ssr-BHjT94rd.js +0 -118
  48. package/dist/stencil-ssr-UlYtcG0-.cjs +0 -1
  49. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_IlVdOHKZfN0-46y8eTjO.cjs +0 -1
  50. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_IlVdOHKZfN0-BfqXBofh.js +0 -42
  51. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useOnDocument_bvALMlewx7Q-DA73DRke.cjs +0 -1
  52. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useOnDocument_bvALMlewx7Q-DdcskN1z.js +0 -10
  53. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useTask_1_aXg7AuatGTc-61dSP-JG.cjs +0 -1
  54. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useTask_1_aXg7AuatGTc-Byrz3fUp.js +0 -34
  55. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useTask_IH8I3eLdwI0-BtIygb8E.js +0 -12
  56. package/dist/stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useTask_IH8I3eLdwI0-DNQBT8Vc.cjs +0 -1
package/README.md CHANGED
@@ -95,8 +95,7 @@ import {
95
95
  import { defineCustomElements } from '@acme/stencil-lib/loader';
96
96
 
97
97
  const renderToString: StencilRenderToString = async (input, options) => {
98
- const hydrateModuleId = '@acme/stencil-lib/hydrate';
99
- const { renderToString } = await import(/* @vite-ignore */ hydrateModuleId);
98
+ const { renderToString } = await import('@acme/stencil-lib/hydrate');
100
99
  return renderToString(input, options);
101
100
  };
102
101
 
@@ -289,7 +288,7 @@ The generated client module (`runtime-csr.generated.ts`) provides:
289
288
  - `useStencilClientSetup`
290
289
  - `GeneratedStencilCSRComponent` — the client-only rendering bridge created by `createStencilCSRComponent()`
291
290
 
292
- When a resolved hydrate import is also available, generation additionally emits `runtime-ssr.generated.ts` with a typed `renderToString` export that loads the resolved hydrate runtime through the same Vite-ignored dynamic import boundary used for SSR-safe demo integration.
291
+ When a resolved hydrate import is also available, generation additionally emits `runtime-ssr.generated.ts` with a typed `renderToString` export that loads the resolved hydrate runtime through a direct dynamic import so SSR bundlers can include the hydrate runtime reliably.
293
292
 
294
293
  For `PACKAGE_NAME`, those runtime imports may come from package-aware defaults or explicit overrides. For `CEM`, they come from the explicit `adapterOptions.runtime` contract. This keeps generated runtime modules aligned with the same resolved runtime import contract already used for validation and SSR probing.
295
294
 
@@ -1 +1 @@
1
- ["../client-setup-C_qW_ZSR.cjs",9,-9,4,"../client-setup.ts_createStencilClientSetup_runSetup_6wDTmOSdSbc-Dz0z3zer.cjs",0,"../client/index.cjs",0,12,"../core.min-vJ4M2jcU.cjs","../ssr/index.cjs",25,"../stencil-csr-D6zt1Am9.cjs",9,-9,16,"../stencil-csr.tsx_createStencilCSRComponent_component_pD3ekIZcUT0-cGN__hqm.cjs",9,-8,21,23,"../stencil-csr.tsx_createStencilCSRComponent_component_useVisibleTask_1_dqWPXf9eNnk-sFN0uMI_.cjs",12,"../stencil-csr.tsx_createStencilCSRComponent_component_useVisibleTask_y00qkhhKua8-BSsN2V78.cjs",9,"../stencil-ssr-UlYtcG0-.cjs",9,-9,29,"../stencil-ssr.tsx_createStencilSSRBridgeComponent_component_IlVdOHKZfN0-46y8eTjO.cjs",9,-8,38,40,-6,36,"../stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useOnDocument_bvALMlewx7Q-DA73DRke.cjs",9,"../stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useTask_1_aXg7AuatGTc-61dSP-JG.cjs",25,"../stencil-ssr.tsx_createStencilSSRBridgeComponent_component_useTask_IH8I3eLdwI0-DNQBT8Vc.cjs",10,"IH8I3eLdwI0",-8,40,"aXg7AuatGTc",-8,38,"dqWPXf9eNnk",-8,21,"y00qkhhKua8",-8,23,"IlVdOHKZfN0",-7,29,"pD3ekIZcUT0",-7,16,"6wDTmOSdSbc",-6,4,"bvALMlewx7Q",-6,36]
1
+ []
@@ -1,4 +1,4 @@
1
- import { type QRL } from '@builder.io/qwik';
1
+ import { QRL } from '@builder.io/qwik';
2
2
  type DefineCustomElementsInput = QRL<() => Promise<void>> | (() => Promise<void>);
3
3
  /**
4
4
  * Creates a client-side setup hook for Stencil components.
@@ -0,0 +1,178 @@
1
+ import { useOnDocument, inlinedQrl, useLexicalScope, componentQrl, _restProps, useSignal, useVisibleTaskQrl, _jsxC, _IMMUTABLE, Slot, _jsxQ } from "@builder.io/qwik";
2
+ const STENCIL_CLIENT_SETUP_DONE = "__qce_stencil_client_setup_done__";
3
+ const DEFINE_CUSTOM_ELEMENTS_INPUTS = /* @__PURE__ */ new Map();
4
+ let defineCustomElementsInputIdCounter = 0;
5
+ function registerDefineCustomElementsInput(input) {
6
+ if (!input) return void 0;
7
+ const inputId = `stencil-client-setup-${++defineCustomElementsInputIdCounter}`;
8
+ DEFINE_CUSTOM_ELEMENTS_INPUTS.set(inputId, input);
9
+ return inputId;
10
+ }
11
+ async function resolveDefineCustomElements(input) {
12
+ if (!input) return void 0;
13
+ if (typeof input === "object" && input !== null && "resolve" in input && typeof input.resolve === "function") {
14
+ const qrlInput = input;
15
+ return qrlInput.resolve();
16
+ }
17
+ return input;
18
+ }
19
+ async function runStencilClientSetup(defineCustomElements) {
20
+ const inlineBodyStyles = document.querySelectorAll("style[sty-id]");
21
+ const seenContent = /* @__PURE__ */ new Set();
22
+ for (const styleEl of inlineBodyStyles) if (styleEl.parentElement !== document.head) {
23
+ const content = styleEl.textContent ?? "";
24
+ if (!seenContent.has(content)) {
25
+ document.head.appendChild(styleEl);
26
+ seenContent.add(content);
27
+ } else
28
+ styleEl.remove();
29
+ }
30
+ if (defineCustomElements) await defineCustomElements();
31
+ }
32
+ function ensureStencilClientSetup(defineCustomElementsInput) {
33
+ const markerTarget = globalThis;
34
+ const existingMarker = markerTarget[STENCIL_CLIENT_SETUP_DONE];
35
+ if (existingMarker === true) return Promise.resolve();
36
+ if (typeof existingMarker === "object" && existingMarker !== null && "then" in existingMarker && typeof existingMarker.then === "function") return existingMarker;
37
+ const setupPromise = (async () => {
38
+ const defineCustomElements = await resolveDefineCustomElements(defineCustomElementsInput);
39
+ await runStencilClientSetup(defineCustomElements);
40
+ })();
41
+ markerTarget[STENCIL_CLIENT_SETUP_DONE] = setupPromise;
42
+ return setupPromise.then(() => {
43
+ markerTarget[STENCIL_CLIENT_SETUP_DONE] = true;
44
+ }).catch((error) => {
45
+ delete markerTarget[STENCIL_CLIENT_SETUP_DONE];
46
+ throw error;
47
+ });
48
+ }
49
+ async function executeStencilClientSetup(defineCustomElementsInputId, fallbackInput) {
50
+ const registeredInput = defineCustomElementsInputId == null ? void 0 : DEFINE_CUSTOM_ELEMENTS_INPUTS.get(defineCustomElementsInputId);
51
+ const resolvedInput = registeredInput ?? fallbackInput;
52
+ await ensureStencilClientSetup(resolvedInput).catch((error) => {
53
+ console.error(error);
54
+ });
55
+ }
56
+ function createStencilClientSetup(defineCustomElementsInput) {
57
+ const defineCustomElementsInputId = registerDefineCustomElementsInput(defineCustomElementsInput);
58
+ const qrlFallbackInput = defineCustomElementsInput != null && "$symbol$" in Object(defineCustomElementsInput) ? defineCustomElementsInput : void 0;
59
+ const runSetup$ = /* @__PURE__ */ inlinedQrl(async () => {
60
+ const [defineCustomElementsInputId2, qrlFallbackInput2] = useLexicalScope();
61
+ await executeStencilClientSetup(defineCustomElementsInputId2, qrlFallbackInput2);
62
+ }, "s_6wDTmOSdSbc", [
63
+ defineCustomElementsInputId,
64
+ qrlFallbackInput
65
+ ]);
66
+ const useStencilClientSetup = () => {
67
+ useOnDocument("readystatechange", runSetup$);
68
+ if (typeof document !== "undefined" && document.readyState !== "loading") executeStencilClientSetup(defineCustomElementsInputId, qrlFallbackInput);
69
+ };
70
+ return useStencilClientSetup;
71
+ }
72
+ const EVENT_PROP_PREFIX = "on";
73
+ const QRL_PRIVATE_PREFIX = "$";
74
+ function isEventLikeProp(propName) {
75
+ return propName.startsWith(EVENT_PROP_PREFIX) || propName.startsWith(QRL_PRIVATE_PREFIX);
76
+ }
77
+ function updateStencilCSRHostProps(host, props) {
78
+ if (!host || !props) return;
79
+ for (const [propName, propValue] of Object.entries(props)) {
80
+ if (isEventLikeProp(propName)) continue;
81
+ host[propName] = propValue;
82
+ }
83
+ }
84
+ const EVENT_QRL_IDS = /* @__PURE__ */ new WeakMap();
85
+ let eventQrlIdCounter = 0;
86
+ function getEventQrlId(qrl) {
87
+ if (!qrl || typeof qrl !== "object" && typeof qrl !== "function") return -1;
88
+ const qrlObject = qrl;
89
+ const existing = EVENT_QRL_IDS.get(qrlObject);
90
+ if (existing) return existing;
91
+ const next = ++eventQrlIdCounter;
92
+ EVENT_QRL_IDS.set(qrlObject, next);
93
+ return next;
94
+ }
95
+ function getEventEntries(events) {
96
+ return Object.entries(events ?? {}).filter(([eventName, eventQrl]) => eventName.trim().length > 0 && Boolean(eventQrl));
97
+ }
98
+ function getEventsDependencyKey(events) {
99
+ return getEventEntries(events).map(([eventName, eventQrl]) => `${eventName}:${getEventQrlId(eventQrl)}`).sort().join("|");
100
+ }
101
+ function createStencilCSRComponent() {
102
+ return /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
103
+ const restProps = _restProps(props, [
104
+ "tagName",
105
+ "props",
106
+ "events",
107
+ "slots"
108
+ ]);
109
+ const hostRef = useSignal();
110
+ const namedSlots = props.slots ?? [];
111
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
112
+ const [hostRef2, props2] = useLexicalScope();
113
+ const host = track(() => hostRef2.value);
114
+ const latestProps = track(() => props2.props);
115
+ updateStencilCSRHostProps(host, latestProps);
116
+ }, "s_y00qkhhKua8", [
117
+ hostRef,
118
+ props
119
+ ]));
120
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(({ track, cleanup }) => {
121
+ const [hostRef2, props2] = useLexicalScope();
122
+ const host = track(() => hostRef2.value);
123
+ const eventsDependencyKey = track(() => getEventsDependencyKey(props2.events));
124
+ if (!host) return;
125
+ const eventEntries = getEventEntries(props2.events);
126
+ if (eventEntries.length === 0 || eventsDependencyKey.length === 0) return;
127
+ let disposed = false;
128
+ const listeners = [];
129
+ cleanup(() => {
130
+ disposed = true;
131
+ for (const { eventName, listener } of listeners) host.removeEventListener(eventName, listener);
132
+ });
133
+ for (const [eventName, eventQrl] of eventEntries) {
134
+ const listener = (event) => {
135
+ const qrl = eventQrl;
136
+ const containerEl = host.closest("[q\\:container]");
137
+ if (containerEl) qrl.$setContainer$?.(containerEl);
138
+ const result = eventQrl(event, host);
139
+ Promise.resolve(result).catch((error) => {
140
+ console.error(error);
141
+ });
142
+ };
143
+ if (disposed) return;
144
+ host.addEventListener(eventName, listener);
145
+ listeners.push({
146
+ eventName,
147
+ listener
148
+ });
149
+ }
150
+ }, "s_dqWPXf9eNnk", [
151
+ hostRef,
152
+ props
153
+ ]));
154
+ return /* @__PURE__ */ _jsxC(props.tagName, {
155
+ ref: hostRef,
156
+ ...restProps,
157
+ children: [
158
+ /* @__PURE__ */ _jsxC(Slot, null, 3, "fM_0"),
159
+ namedSlots.map((name) => /* @__PURE__ */ _jsxQ("span", {
160
+ slot: name
161
+ }, {
162
+ style: {
163
+ display: "contents"
164
+ }
165
+ }, /* @__PURE__ */ _jsxC(Slot, {
166
+ name
167
+ }, 3, "fM_1"), 1, name))
168
+ ],
169
+ [_IMMUTABLE]: {
170
+ ref: _IMMUTABLE
171
+ }
172
+ }, 0, "fM_2");
173
+ }, "s_pD3ekIZcUT0"));
174
+ }
175
+ export {
176
+ createStencilCSRComponent,
177
+ createStencilClientSetup
178
+ };
@@ -1,4 +1,4 @@
1
- import { type QRL } from '@builder.io/qwik';
1
+ import { QRL } from '@builder.io/qwik';
2
2
  export interface StencilCSRProps {
3
3
  tagName: string;
4
4
  props?: Record<string, unknown>;
@@ -6,5 +6,5 @@ export interface StencilCSRProps {
6
6
  slots?: string[];
7
7
  [key: string]: unknown;
8
8
  }
9
- export declare function createStencilCSRComponent(): import("@builder.io/qwik").Component<StencilCSRProps>;
9
+ export declare function createStencilCSRComponent(): import('@builder.io/qwik').Component<StencilCSRProps>;
10
10
  //# sourceMappingURL=stencil-csr.d.ts.map