@yoamigo.com/core 1.0.1 → 1.1.1

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.
@@ -1,5 +1,5 @@
1
1
  export { A as AssetResolverFn, C as ContentRegistry, c as contentRegistry, a as getAllContent, g as getContent, h as hasContent, r as registerContent, b as resolveAssetUrl, s as setAssetResolver } from './asset-resolver-BnIvDkVv.js';
2
- export { C as ContactFormData, S as SiteMetadata, g as getSiteMetadata, a as submitContactForm, s as subscribeToNewsletter } from './api-client-D8FkeBAI.js';
2
+ export { C as ContactFormData, S as SiteMetadata, g as getSiteMetadata, a as submitContactForm, s as subscribeToNewsletter } from './api-client-BaZ_K5a6.js';
3
3
 
4
4
  /**
5
5
  * YoAmigo Library Utilities - Production Barrel
package/dist/lib.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { A as AssetResolverFn, C as ContentRegistry, c as contentRegistry, a as getAllContent, g as getContent, h as hasContent, r as registerContent, b as resolveAssetUrl, s as setAssetResolver } from './asset-resolver-BnIvDkVv.js';
2
2
  import { C as ChangeSource } from './cart-storage-DFdGPcwm.js';
3
3
  export { o as CartItem, a as CollectionClient, d as CollectionClientConfig, b as CollectionRecord, L as ListOptions, c as ListResponse, Q as QueryFilter, S as SingleResponse, l as addLocalCartItem, j as clearLocalCart, f as clearSessionId, g as getCollectionClient, h as getLocalCart, n as getLocalCartItemCount, k as getLocalCartItems, e as getSessionId, i as initBuilderSelection, m as removeLocalCartItem, r as resetCollectionClient, s as saveLocalCart, u as updateLocalCartItem } from './cart-storage-DFdGPcwm.js';
4
- export { C as ContactFormData, S as SiteMetadata, g as getSiteMetadata, a as submitContactForm, s as subscribeToNewsletter } from './api-client-D8FkeBAI.js';
4
+ export { C as ContactFormData, S as SiteMetadata, g as getSiteMetadata, a as submitContactForm, s as subscribeToNewsletter } from './api-client-BaZ_K5a6.js';
5
5
  import 'react/jsx-runtime';
6
6
  import 'react';
7
7
 
package/dist/lib.js CHANGED
@@ -193,6 +193,9 @@ var BuilderSelectionManager = class {
193
193
  case "GET_CURRENT_PAGE":
194
194
  this.sendToParent({ type: "CURRENT_PAGE", pagePath: window.location.pathname });
195
195
  break;
196
+ case "CHECK_BLANK_STATE":
197
+ this.checkBlankState();
198
+ break;
196
199
  }
197
200
  });
198
201
  }
@@ -1041,6 +1044,66 @@ var BuilderSelectionManager = class {
1041
1044
  return null;
1042
1045
  }
1043
1046
  }
1047
+ /**
1048
+ * Check if the page is visually blank (all white/uniform color)
1049
+ * Uses canvas pixel sampling for accuracy.
1050
+ * Triggered after AI edits to detect if preview went white and needs refresh.
1051
+ */
1052
+ async checkBlankState() {
1053
+ try {
1054
+ const html2canvas = (await import("html2canvas-pro")).default;
1055
+ const canvas = await html2canvas(document.body, {
1056
+ scale: 0.1,
1057
+ // Small scale for speed
1058
+ logging: false,
1059
+ width: window.innerWidth,
1060
+ height: window.innerHeight,
1061
+ backgroundColor: null
1062
+ // Preserve actual background
1063
+ });
1064
+ const sampleCanvas = document.createElement("canvas");
1065
+ const size = 100;
1066
+ sampleCanvas.width = size;
1067
+ sampleCanvas.height = size;
1068
+ const ctx = sampleCanvas.getContext("2d");
1069
+ if (!ctx) {
1070
+ this.sendToParent({ type: "BLANK_STATE_RESULT", isBlank: false });
1071
+ return;
1072
+ }
1073
+ ctx.drawImage(canvas, 0, 0, size, size);
1074
+ const samplePoints = [
1075
+ [25, 25],
1076
+ [75, 25],
1077
+ [50, 50],
1078
+ [25, 75],
1079
+ [75, 75],
1080
+ [10, 10],
1081
+ [90, 90],
1082
+ [50, 25],
1083
+ [50, 75],
1084
+ [25, 50]
1085
+ ];
1086
+ const pixels = samplePoints.map(([x, y]) => {
1087
+ const data = ctx.getImageData(x, y, 1, 1).data;
1088
+ return { r: data[0], g: data[1], b: data[2] };
1089
+ });
1090
+ const firstPixel = pixels[0];
1091
+ const tolerance = 10;
1092
+ const allSame = pixels.every(
1093
+ (p) => Math.abs(p.r - firstPixel.r) < tolerance && Math.abs(p.g - firstPixel.g) < tolerance && Math.abs(p.b - firstPixel.b) < tolerance
1094
+ );
1095
+ const isWhitish = firstPixel.r > 240 && firstPixel.g > 240 && firstPixel.b > 240;
1096
+ const isBlank = allSame && isWhitish;
1097
+ this.sendToParent({
1098
+ type: "BLANK_STATE_RESULT",
1099
+ isBlank,
1100
+ sampleColor: `rgb(${firstPixel.r},${firstPixel.g},${firstPixel.b})`
1101
+ });
1102
+ } catch (error) {
1103
+ console.error("[BuilderSelection] Blank check failed:", error);
1104
+ this.sendToParent({ type: "BLANK_STATE_RESULT", isBlank: false });
1105
+ }
1106
+ }
1044
1107
  };
1045
1108
  var instance = null;
1046
1109
  function initBuilderSelection() {
package/dist/prod.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- export { a as ContentStore, E as ContentStoreMode, C as ContentStoreProvider, f as MarkdownText, g as MarkdownTextProps, P as PageInfo, c as StaticImage, d as StaticImageProps, M as StaticText, S as StaticTextProps, c as YaImage, d as YaImageProps, M as YaText, S as YaTextProps, b as background, e as embed, i as image, p as parseEmbedUrl, t as text, u as useContentStore, v as video } from './content-helpers-DOUKazMz.js';
1
+ export { k as ContentStore, E as ContentStoreMode, C as ContentStoreProvider, D as DynamicIcon, a as DynamicIconProps, I as IconComponent, h as IconLoader, o as MarkdownText, q as MarkdownTextProps, P as PageInfo, m as StaticImage, n as StaticImageProps, M as StaticText, S as StaticTextProps, m as YaImage, n as YaImageProps, M as YaText, S as YaTextProps, b as background, e as embed, g as getIcon, j as getIconLabel, i as image, f as isIconLoaded, l as link, d as loadIcon, s as parseEmbedUrl, p as preloadIcons, r as registerIcon, c as registerIcons, t as text, u as useContentStore, v as video } from './icon-metadata-CVUpe16i.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import React, { CSSProperties, ReactNode } from 'react';
4
4
  export { Link, LinkProps, NavigateFunction, RouteDefinition, Router, RouterProps, ScrollRestoration, createRouteDefinition, extractRouteParams, filePathToRoutePath, generatePath, sortRoutesBySpecificity, useNavigate } from './router.js';
5
5
  export { Route, Switch, useLocation, useParams } from 'wouter';
6
6
  export { A as AssetResolverFn, C as ContentRegistry, c as contentRegistry, a as getAllContent, g as getContent, h as hasContent, r as registerContent, b as resolveAssetUrl, s as setAssetResolver } from './asset-resolver-BnIvDkVv.js';
7
+ import '@tabler/icons-react';
7
8
 
8
9
  interface StaticLinkProps {
9
10
  fieldId: string;
@@ -15,8 +16,38 @@ interface StaticLinkProps {
15
16
  children?: React.ReactNode;
16
17
  /** Optional click handler called after navigation */
17
18
  onClick?: () => void;
19
+ /**
20
+ * Icon position relative to text. Uses fieldId.icon for icon name.
21
+ * - 'left': Icon before text (e.g., "🐦 Follow us")
22
+ * - 'right': Icon after text (e.g., "Learn more →")
23
+ * - 'only': Icon only, no text (e.g., social media buttons)
24
+ * - undefined: No icon, text only (default)
25
+ */
26
+ iconPosition?: 'left' | 'right' | 'only';
27
+ /** Icon size in pixels (default: 20 for left/right, 24 for only) */
28
+ iconSize?: number;
18
29
  }
19
- declare function StaticLink({ fieldId, href: defaultHref, className, style, as: Component, children, onClick }: StaticLinkProps): react_jsx_runtime.JSX.Element;
30
+ declare function StaticLink({ fieldId, href: defaultHref, className, style, as: Component, children, onClick, iconPosition, iconSize }: StaticLinkProps): react_jsx_runtime.JSX.Element;
31
+
32
+ /**
33
+ * StaticIcon Component - Production version of YaIcon
34
+ *
35
+ * Minimal icon component for production builds.
36
+ * No IconPicker, no editing UI - just renders the icon.
37
+ */
38
+ interface StaticIconProps {
39
+ /** Field ID for content storage - icon name stored at fieldId.icon */
40
+ fieldId: string;
41
+ /** Default icon name if none set in content store (e.g., "IconHeart") */
42
+ fallback?: string;
43
+ /** Icon size in pixels (default: 24) */
44
+ size?: number;
45
+ /** Icon stroke width (default: 2) */
46
+ stroke?: number;
47
+ /** Additional classes for the icon */
48
+ className?: string;
49
+ }
50
+ declare function StaticIcon({ fieldId, fallback, size, stroke, className, }: StaticIconProps): react_jsx_runtime.JSX.Element | null;
20
51
 
21
52
  /**
22
53
  * SafeHtml (Production) - Renders trusted HTML without sanitization.
@@ -166,4 +197,4 @@ interface StaticEmbedProps {
166
197
  declare function serializeEmbedValue(value: EmbedFieldValue): string;
167
198
  declare function StaticEmbed({ fieldId, className, aspectRatio: propAspectRatio, maxWidth, loading, defaultValue, }: StaticEmbedProps): react_jsx_runtime.JSX.Element;
168
199
 
169
- export { type BackgroundConfig, type BackgroundImageConfig, type EmbedFieldValue, type EmbedType, type OverlayConfig, SafeHtml, type SafeHtmlProps, StaticContainer, type StaticContainerProps, StaticEmbed, type StaticEmbedProps, StaticLink, type StaticLinkProps, StaticVideo, type StaticVideoProps, type VideoFieldValue, StaticContainer as YaContainer, type StaticContainerProps as YaContainerProps, StaticEmbed as YaEmbed, type StaticEmbedProps as YaEmbedProps, StaticLink as YaLink, type StaticLinkProps as YaLinkProps, StaticVideo as YaVideo, type StaticVideoProps as YaVideoProps, parseBackgroundConfig, serializeBackgroundConfig, serializeEmbedValue, serializeVideoValue };
200
+ export { type BackgroundConfig, type BackgroundImageConfig, type EmbedFieldValue, type EmbedType, type OverlayConfig, SafeHtml, type SafeHtmlProps, StaticContainer, type StaticContainerProps, StaticEmbed, type StaticEmbedProps, StaticIcon, type StaticIconProps, StaticLink, type StaticLinkProps, StaticVideo, type StaticVideoProps, type VideoFieldValue, StaticContainer as YaContainer, type StaticContainerProps as YaContainerProps, StaticEmbed as YaEmbed, type StaticEmbedProps as YaEmbedProps, StaticIcon as YaIcon, type StaticIconProps as YaIconProps, StaticLink as YaLink, type StaticLinkProps as YaLinkProps, StaticVideo as YaVideo, type StaticVideoProps as YaVideoProps, parseBackgroundConfig, serializeBackgroundConfig, serializeEmbedValue, serializeVideoValue };