@builder.io/sdk-qwik 0.0.17 → 0.0.18

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.
@@ -2,6 +2,24 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const qwik = require("@builder.io/qwik");
4
4
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule)
7
+ return e;
8
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
+ if (e) {
10
+ for (const k in e) {
11
+ if (k !== "default") {
12
+ const d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: () => e[k]
16
+ });
17
+ }
18
+ }
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
5
23
  const TARGET = "qwik";
6
24
  function isBrowser() {
7
25
  return typeof window !== "undefined" && typeof document !== "undefined";
@@ -821,7 +839,7 @@ left: 0;
821
839
  width: 100%;
822
840
  height: 100%; }`;
823
841
  const Text = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
824
- return /* @__PURE__ */ jsxRuntime.jsx("div", {
842
+ return /* @__PURE__ */ jsxRuntime.jsx("span", {
825
843
  class: "builder-text",
826
844
  dangerouslySetInnerHTML: props.text
827
845
  });
@@ -1779,10 +1797,11 @@ function getGlobalThis() {
1779
1797
  return self;
1780
1798
  return null;
1781
1799
  }
1800
+ const NODE_FETCH_URL = () => "node-fetch";
1782
1801
  async function getFetch() {
1783
1802
  const globalFetch = getGlobalThis().fetch;
1784
1803
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1785
- const nodeFetch = Promise.resolve().then(() => require("./index.d8c1e37f.cjs")).then((d) => d.default);
1804
+ const nodeFetch = Promise.resolve().then(() => /* @__PURE__ */ _interopNamespace(require(NODE_FETCH_URL()))).then((d) => d.default);
1786
1805
  return nodeFetch.default || nodeFetch;
1787
1806
  }
1788
1807
  return globalFetch.default || globalFetch;
@@ -2225,17 +2244,15 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
2225
2244
  }));
2226
2245
  };
2227
2246
  const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
2228
- const fetchAndSetState = async () => {
2229
- const fetch2 = await getFetch();
2230
- const response = await fetch2(url);
2231
- const json = await response.json();
2247
+ getFetch().then((fetch2) => fetch2(url)).then((response) => response.json()).then((json) => {
2232
2248
  const newOverrideState = {
2233
2249
  ...state.overrideState,
2234
2250
  [key]: json
2235
2251
  };
2236
2252
  state.overrideState = newOverrideState;
2237
- };
2238
- fetchAndSetState();
2253
+ }).catch((err) => {
2254
+ console.log("error fetching dynamic data", url, err);
2255
+ });
2239
2256
  };
2240
2257
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
2241
2258
  const requests = useContent(props, state)?.data?.httpRequests ?? {};
@@ -2293,7 +2310,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
2293
2310
  if (isBrowser()) {
2294
2311
  if (isEditing()) {
2295
2312
  state2.forceReRenderCount = state2.forceReRenderCount + 1;
2296
- qwik._useMutableProps(elementRef2.current, true);
2313
+ elementRef2.current && qwik._useMutableProps(elementRef2.current, true);
2297
2314
  registerInsertMenu();
2298
2315
  setupBrowserForEditing();
2299
2316
  Object.values(allRegisteredComponents(props2)).forEach((registeredComponent) => {
@@ -819,7 +819,7 @@ left: 0;
819
819
  width: 100%;
820
820
  height: 100%; }`;
821
821
  const Text = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
822
- return /* @__PURE__ */ jsx("div", {
822
+ return /* @__PURE__ */ jsx("span", {
823
823
  class: "builder-text",
824
824
  dangerouslySetInnerHTML: props.text
825
825
  });
@@ -1777,10 +1777,11 @@ function getGlobalThis() {
1777
1777
  return self;
1778
1778
  return null;
1779
1779
  }
1780
+ const NODE_FETCH_URL = () => "node-fetch";
1780
1781
  async function getFetch() {
1781
1782
  const globalFetch = getGlobalThis().fetch;
1782
1783
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1783
- const nodeFetch = import("./index.97024df8.js").then((d) => d.default);
1784
+ const nodeFetch = import(NODE_FETCH_URL()).then((d) => d.default);
1784
1785
  return nodeFetch.default || nodeFetch;
1785
1786
  }
1786
1787
  return globalFetch.default || globalFetch;
@@ -2223,17 +2224,15 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
2223
2224
  }));
2224
2225
  };
2225
2226
  const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
2226
- const fetchAndSetState = async () => {
2227
- const fetch2 = await getFetch();
2228
- const response = await fetch2(url);
2229
- const json = await response.json();
2227
+ getFetch().then((fetch2) => fetch2(url)).then((response) => response.json()).then((json) => {
2230
2228
  const newOverrideState = {
2231
2229
  ...state.overrideState,
2232
2230
  [key]: json
2233
2231
  };
2234
2232
  state.overrideState = newOverrideState;
2235
- };
2236
- fetchAndSetState();
2233
+ }).catch((err) => {
2234
+ console.log("error fetching dynamic data", url, err);
2235
+ });
2237
2236
  };
2238
2237
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
2239
2238
  const requests = useContent(props, state)?.data?.httpRequests ?? {};
@@ -2291,7 +2290,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2291
2290
  if (isBrowser()) {
2292
2291
  if (isEditing()) {
2293
2292
  state2.forceReRenderCount = state2.forceReRenderCount + 1;
2294
- _useMutableProps(elementRef2.current, true);
2293
+ elementRef2.current && _useMutableProps(elementRef2.current, true);
2295
2294
  registerInsertMenu();
2296
2295
  setupBrowserForEditing();
2297
2296
  Object.values(allRegisteredComponents(props2)).forEach((registeredComponent) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -19,7 +19,7 @@
19
19
  "release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag latest --access public"
20
20
  },
21
21
  "devDependencies": {
22
- "@builder.io/qwik": "0.0.108",
22
+ "@builder.io/qwik": "BuilderIO/qwik-build#commit=08a6883d163f8eea8dc1710357b63b7ac01b2bef",
23
23
  "@types/node": "latest",
24
24
  "typescript": "4.7.4",
25
25
  "vite": "3.0.2"
@@ -0,0 +1,5 @@
1
+ export function submissionState(props: any, state: any, formRef: any, builderContext: any): any;
2
+ export function onSubmit(props: any, state: any, formRef: any, builderContext: any, event: any): void;
3
+ export const FormComponent: import("@builder.io/qwik").Component<{}>;
4
+ export default FormComponent;
5
+ export const STYLES: ".pre-FormComponent { \npadding: 10px;\ncolor: red;\ntext-align: center; }";
package/types-hacks.d.ts CHANGED
@@ -10,10 +10,4 @@ declare const set: (obj: any, key: string, value: any) => void;
10
10
  interface CSSProperties {
11
11
  flexDirection: any;
12
12
  }
13
- interface HTMLAttributes {
14
- style?: Record<string, string | number | undefined> | string | undefined;
15
- }
16
- interface ImgHTMLAttributes {
17
- srcset: any;
18
- }
19
13
  declare const BuilderBlocks: (props: any) => any;