@builder.io/sdk-svelte 1.0.33 → 1.0.35

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 (26) hide show
  1. package/lib/browser/blocks/embed/component-info.js +1 -2
  2. package/lib/browser/blocks/image/component-info.js +1 -1
  3. package/lib/browser/constants/sdk-version.d.ts +1 -1
  4. package/lib/browser/constants/sdk-version.js +1 -1
  5. package/lib/browser/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +2 -0
  6. package/lib/browser/functions/extract-css-var-default-value.d.ts +1 -0
  7. package/lib/browser/functions/extract-css-var-default-value.js +11 -0
  8. package/lib/edge/blocks/embed/component-info.js +1 -2
  9. package/lib/edge/blocks/image/component-info.js +1 -1
  10. package/lib/edge/constants/sdk-version.d.ts +1 -1
  11. package/lib/edge/constants/sdk-version.js +1 -1
  12. package/lib/edge/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +2 -0
  13. package/lib/edge/functions/extract-css-var-default-value.d.ts +1 -0
  14. package/lib/edge/functions/extract-css-var-default-value.js +11 -0
  15. package/lib/node/blocks/embed/component-info.js +1 -2
  16. package/lib/node/blocks/image/component-info.js +1 -1
  17. package/lib/node/constants/sdk-version.d.ts +1 -1
  18. package/lib/node/constants/sdk-version.js +1 -1
  19. package/lib/node/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +2 -0
  20. package/lib/node/functions/extract-css-var-default-value.d.ts +1 -0
  21. package/lib/node/functions/extract-css-var-default-value.js +11 -0
  22. package/package.json +1 -1
  23. package/src/blocks/embed/component-info.ts +4 -2
  24. package/src/blocks/image/component-info.ts +1 -1
  25. package/src/constants/sdk-version.ts +1 -1
  26. package/src/functions/extract-css-var-default-value.ts +12 -0
@@ -11,8 +11,7 @@ export const componentInfo = {
11
11
  const url = options.get('url');
12
12
  if (url) {
13
13
  options.set('content', 'Loading...');
14
- // TODO: get this out of here!
15
- const apiKey = 'ae0e60e78201a3f2b0de4b';
14
+ const apiKey = _iframelyApiKey;
16
15
  return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
17
16
  if (options.get('url') === url) {
18
17
  if (data.html) {
@@ -13,7 +13,7 @@ export const componentInfo = {
13
13
  name: 'image',
14
14
  type: 'file',
15
15
  bubble: true,
16
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
16
+ allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp'],
17
17
  required: true,
18
18
  defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
19
19
  onChange: (options) => {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.33";
1
+ export declare const SDK_VERSION = "1.0.35";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.33";
1
+ export const SDK_VERSION = "1.0.35";
@@ -1 +1,3 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="react-native" />
1
3
  export declare let safeDynamicRequire: typeof require;
@@ -0,0 +1 @@
1
+ export declare function extractCssVarDefaultValue(value: string): string;
@@ -0,0 +1,11 @@
1
+ export function extractCssVarDefaultValue(value) {
2
+ // Regular expression to find var() expressions
3
+ const varRegex = /var\(--[^,]+?,\s*([^)]+)\)/;
4
+ // Function to replace var() with its fallback
5
+ let newValue = value;
6
+ let match;
7
+ while (match = newValue.match(varRegex)) {
8
+ newValue = newValue.replace(match[0], match[1].trim());
9
+ }
10
+ return newValue;
11
+ }
@@ -11,8 +11,7 @@ export const componentInfo = {
11
11
  const url = options.get('url');
12
12
  if (url) {
13
13
  options.set('content', 'Loading...');
14
- // TODO: get this out of here!
15
- const apiKey = 'ae0e60e78201a3f2b0de4b';
14
+ const apiKey = _iframelyApiKey;
16
15
  return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
17
16
  if (options.get('url') === url) {
18
17
  if (data.html) {
@@ -13,7 +13,7 @@ export const componentInfo = {
13
13
  name: 'image',
14
14
  type: 'file',
15
15
  bubble: true,
16
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
16
+ allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp'],
17
17
  required: true,
18
18
  defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
19
19
  onChange: (options) => {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.33";
1
+ export declare const SDK_VERSION = "1.0.35";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.33";
1
+ export const SDK_VERSION = "1.0.35";
@@ -1 +1,3 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="react-native" />
1
3
  export declare let safeDynamicRequire: typeof require;
@@ -0,0 +1 @@
1
+ export declare function extractCssVarDefaultValue(value: string): string;
@@ -0,0 +1,11 @@
1
+ export function extractCssVarDefaultValue(value) {
2
+ // Regular expression to find var() expressions
3
+ const varRegex = /var\(--[^,]+?,\s*([^)]+)\)/;
4
+ // Function to replace var() with its fallback
5
+ let newValue = value;
6
+ let match;
7
+ while (match = newValue.match(varRegex)) {
8
+ newValue = newValue.replace(match[0], match[1].trim());
9
+ }
10
+ return newValue;
11
+ }
@@ -11,8 +11,7 @@ export const componentInfo = {
11
11
  const url = options.get('url');
12
12
  if (url) {
13
13
  options.set('content', 'Loading...');
14
- // TODO: get this out of here!
15
- const apiKey = 'ae0e60e78201a3f2b0de4b';
14
+ const apiKey = _iframelyApiKey;
16
15
  return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
17
16
  if (options.get('url') === url) {
18
17
  if (data.html) {
@@ -13,7 +13,7 @@ export const componentInfo = {
13
13
  name: 'image',
14
14
  type: 'file',
15
15
  bubble: true,
16
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
16
+ allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp'],
17
17
  required: true,
18
18
  defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
19
19
  onChange: (options) => {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.33";
1
+ export declare const SDK_VERSION = "1.0.35";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.33";
1
+ export const SDK_VERSION = "1.0.35";
@@ -1 +1,3 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="react-native" />
1
3
  export declare let safeDynamicRequire: typeof require;
@@ -0,0 +1 @@
1
+ export declare function extractCssVarDefaultValue(value: string): string;
@@ -0,0 +1,11 @@
1
+ export function extractCssVarDefaultValue(value) {
2
+ // Regular expression to find var() expressions
3
+ const varRegex = /var\(--[^,]+?,\s*([^)]+)\)/;
4
+ // Function to replace var() with its fallback
5
+ let newValue = value;
6
+ let match;
7
+ while (match = newValue.match(varRegex)) {
8
+ newValue = newValue.replace(match[0], match[1].trim());
9
+ }
10
+ return newValue;
11
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "1.0.33",
4
+ "version": "1.0.35",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -1,4 +1,7 @@
1
1
  import type { ComponentInfo } from '../../types/components';
2
+
3
+ // Provided by the web app as a local variable in onChange functions
4
+ declare const _iframelyApiKey: string;
2
5
  export const componentInfo: ComponentInfo = {
3
6
  name: 'Embed',
4
7
  static: true,
@@ -12,8 +15,7 @@ export const componentInfo: ComponentInfo = {
12
15
  const url = options.get('url');
13
16
  if (url) {
14
17
  options.set('content', 'Loading...');
15
- // TODO: get this out of here!
16
- const apiKey = 'ae0e60e78201a3f2b0de4b';
18
+ const apiKey = _iframelyApiKey;
17
19
  return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
18
20
  if (options.get('url') === url) {
19
21
  if (data.html) {
@@ -14,7 +14,7 @@ export const componentInfo: ComponentInfo = {
14
14
  name: 'image',
15
15
  type: 'file',
16
16
  bubble: true,
17
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
17
+ allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp'],
18
18
  required: true,
19
19
  defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
20
20
  onChange: (options: Map<string, any>): void | Promise<void> => {
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.33"
1
+ export const SDK_VERSION = "1.0.35"
@@ -0,0 +1,12 @@
1
+ export function extractCssVarDefaultValue(value: string): string {
2
+ // Regular expression to find var() expressions
3
+ const varRegex = /var\(--[^,]+?,\s*([^)]+)\)/;
4
+
5
+ // Function to replace var() with its fallback
6
+ let newValue = value;
7
+ let match: string[] | null;
8
+ while (match = newValue.match(varRegex)) {
9
+ newValue = newValue.replace(match[0], match[1].trim());
10
+ }
11
+ return newValue;
12
+ }