@builder.io/sdk-qwik 0.0.20 → 0.0.21
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.
package/lib/index.qwik.cjs
CHANGED
|
@@ -281,7 +281,21 @@ const BlockStyles$1 = BlockStyles;
|
|
|
281
281
|
function capitalizeFirstLetter(string) {
|
|
282
282
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
283
283
|
}
|
|
284
|
-
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}
|
|
284
|
+
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}$`;
|
|
285
|
+
function crateEventHandler(value, options) {
|
|
286
|
+
return qwik.inlinedQrl((event) => {
|
|
287
|
+
const [options2, value2] = qwik.useLexicalScope();
|
|
288
|
+
return evaluate({
|
|
289
|
+
code: value2,
|
|
290
|
+
context: options2.context,
|
|
291
|
+
state: options2.state,
|
|
292
|
+
event
|
|
293
|
+
});
|
|
294
|
+
}, "crateEventHandler_wgxT8Hlq4s8", [
|
|
295
|
+
options,
|
|
296
|
+
value
|
|
297
|
+
]);
|
|
298
|
+
}
|
|
285
299
|
function getBlockActions(options) {
|
|
286
300
|
const obj = {};
|
|
287
301
|
const optionActions = options.block.actions ?? {};
|
|
@@ -289,12 +303,7 @@ function getBlockActions(options) {
|
|
|
289
303
|
if (!optionActions.hasOwnProperty(key))
|
|
290
304
|
continue;
|
|
291
305
|
const value = optionActions[key];
|
|
292
|
-
obj[getEventHandlerName(key)] = (
|
|
293
|
-
code: value,
|
|
294
|
-
context: options.context,
|
|
295
|
-
state: options.state,
|
|
296
|
-
event
|
|
297
|
-
});
|
|
306
|
+
obj[getEventHandlerName(key)] = crateEventHandler(value, options);
|
|
298
307
|
}
|
|
299
308
|
return obj;
|
|
300
309
|
}
|
|
@@ -1610,7 +1619,7 @@ const SCRIPT_MIME_TYPES = [
|
|
|
1610
1619
|
];
|
|
1611
1620
|
const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
1612
1621
|
const findAndRunScripts$1 = function findAndRunScripts(props, state, elem) {
|
|
1613
|
-
if (!elem)
|
|
1622
|
+
if (!elem || !elem.getElementsByTagName)
|
|
1614
1623
|
return;
|
|
1615
1624
|
const scripts = elem.getElementsByTagName("script");
|
|
1616
1625
|
for (let i = 0; i < scripts.length; i++) {
|
|
@@ -1691,7 +1700,7 @@ const componentInfo$1 = {
|
|
|
1691
1700
|
static: true
|
|
1692
1701
|
};
|
|
1693
1702
|
const findAndRunScripts2 = function findAndRunScripts3(props, state, elem) {
|
|
1694
|
-
if (elem && typeof window !== "undefined") {
|
|
1703
|
+
if (elem && elem.getElementsByTagName && typeof window !== "undefined") {
|
|
1695
1704
|
const scripts = elem.getElementsByTagName("script");
|
|
1696
1705
|
for (let i = 0; i < scripts.length; i++) {
|
|
1697
1706
|
const script = scripts[i];
|
|
@@ -2466,7 +2475,6 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2466
2475
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2467
2476
|
children: useContent(props, state) ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
2468
2477
|
ref: elementRef,
|
|
2469
|
-
"builder-content-id": useContent(props, state)?.id,
|
|
2470
2478
|
onClick$: qwik.inlinedQrl((event) => {
|
|
2471
2479
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2472
2480
|
return onClick2(props2, state2);
|
|
@@ -2475,6 +2483,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2475
2483
|
props,
|
|
2476
2484
|
state
|
|
2477
2485
|
]),
|
|
2486
|
+
"builder-content-id": useContent(props, state)?.id,
|
|
2478
2487
|
children: [
|
|
2479
2488
|
shouldRenderContentStyles(props, state) ? /* @__PURE__ */ jsxRuntime.jsx(RenderContentStyles$1, {
|
|
2480
2489
|
cssCode: useContent(props, state)?.data?.cssCode,
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, mutable, componentQrl,
|
|
1
|
+
import { createContext, inlinedQrl, useLexicalScope, mutable, componentQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, Slot, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
|
|
2
2
|
import { jsx, Fragment as Fragment$1, jsxs } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const TARGET = "qwik";
|
|
4
4
|
function isBrowser() {
|
|
@@ -261,7 +261,21 @@ const BlockStyles$1 = BlockStyles;
|
|
|
261
261
|
function capitalizeFirstLetter(string) {
|
|
262
262
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
263
263
|
}
|
|
264
|
-
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}
|
|
264
|
+
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}$`;
|
|
265
|
+
function crateEventHandler(value, options) {
|
|
266
|
+
return inlinedQrl((event) => {
|
|
267
|
+
const [options2, value2] = useLexicalScope();
|
|
268
|
+
return evaluate({
|
|
269
|
+
code: value2,
|
|
270
|
+
context: options2.context,
|
|
271
|
+
state: options2.state,
|
|
272
|
+
event
|
|
273
|
+
});
|
|
274
|
+
}, "crateEventHandler_wgxT8Hlq4s8", [
|
|
275
|
+
options,
|
|
276
|
+
value
|
|
277
|
+
]);
|
|
278
|
+
}
|
|
265
279
|
function getBlockActions(options) {
|
|
266
280
|
const obj = {};
|
|
267
281
|
const optionActions = options.block.actions ?? {};
|
|
@@ -269,12 +283,7 @@ function getBlockActions(options) {
|
|
|
269
283
|
if (!optionActions.hasOwnProperty(key))
|
|
270
284
|
continue;
|
|
271
285
|
const value = optionActions[key];
|
|
272
|
-
obj[getEventHandlerName(key)] = (
|
|
273
|
-
code: value,
|
|
274
|
-
context: options.context,
|
|
275
|
-
state: options.state,
|
|
276
|
-
event
|
|
277
|
-
});
|
|
286
|
+
obj[getEventHandlerName(key)] = crateEventHandler(value, options);
|
|
278
287
|
}
|
|
279
288
|
return obj;
|
|
280
289
|
}
|
|
@@ -1590,7 +1599,7 @@ const SCRIPT_MIME_TYPES = [
|
|
|
1590
1599
|
];
|
|
1591
1600
|
const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
1592
1601
|
const findAndRunScripts$1 = function findAndRunScripts(props, state, elem) {
|
|
1593
|
-
if (!elem)
|
|
1602
|
+
if (!elem || !elem.getElementsByTagName)
|
|
1594
1603
|
return;
|
|
1595
1604
|
const scripts = elem.getElementsByTagName("script");
|
|
1596
1605
|
for (let i = 0; i < scripts.length; i++) {
|
|
@@ -1671,7 +1680,7 @@ const componentInfo$1 = {
|
|
|
1671
1680
|
static: true
|
|
1672
1681
|
};
|
|
1673
1682
|
const findAndRunScripts2 = function findAndRunScripts3(props, state, elem) {
|
|
1674
|
-
if (elem && typeof window !== "undefined") {
|
|
1683
|
+
if (elem && elem.getElementsByTagName && typeof window !== "undefined") {
|
|
1675
1684
|
const scripts = elem.getElementsByTagName("script");
|
|
1676
1685
|
for (let i = 0; i < scripts.length; i++) {
|
|
1677
1686
|
const script = scripts[i];
|
|
@@ -2446,7 +2455,6 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2446
2455
|
return /* @__PURE__ */ jsx(Fragment$1, {
|
|
2447
2456
|
children: useContent(props, state) ? /* @__PURE__ */ jsxs("div", {
|
|
2448
2457
|
ref: elementRef,
|
|
2449
|
-
"builder-content-id": useContent(props, state)?.id,
|
|
2450
2458
|
onClick$: inlinedQrl((event) => {
|
|
2451
2459
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
2452
2460
|
return onClick2(props2, state2);
|
|
@@ -2455,6 +2463,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2455
2463
|
props,
|
|
2456
2464
|
state
|
|
2457
2465
|
]),
|
|
2466
|
+
"builder-content-id": useContent(props, state)?.id,
|
|
2458
2467
|
children: [
|
|
2459
2468
|
shouldRenderContentStyles(props, state) ? /* @__PURE__ */ jsx(RenderContentStyles$1, {
|
|
2460
2469
|
cssCode: useContent(props, state)?.data?.cssCode,
|
package/package.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BuilderContextInterface } from '../context/types.js';
|
|
2
|
+
import { BuilderBlock } from '../types/builder-block.js';
|
|
3
|
+
export declare function crateEventHandler(value: string, options: {
|
|
4
|
+
block: BuilderBlock;
|
|
5
|
+
} & Pick<BuilderContextInterface, 'state' | 'context'>): (event: Event) => any;
|