@kustomizer/visual-editor 0.1.0 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kustomizer/visual-editor",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Angular visual page builder for Shopify storefronts — drag & drop editor with component registry, NgRx state, SSR support, and iframe preview",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "keywords": [
@@ -894,8 +894,17 @@ interface ResolvedPreset {
894
894
  */
895
895
  declare class ComponentRegistryService {
896
896
  private readonly definitions;
897
+ private readonly _version;
897
898
  private readonly injectedDefinitions;
898
899
  constructor();
900
+ /**
901
+ * Clear all registered definitions
902
+ */
903
+ clear(): void;
904
+ /**
905
+ * Unregister a single component definition by type
906
+ */
907
+ unregister(type: string): boolean;
899
908
  /**
900
909
  * Register a component definition
901
910
  */
@@ -1027,8 +1036,7 @@ declare class DynamicRendererComponent {
1027
1036
  /** Additional context (sectionId, index, etc.) */
1028
1037
  readonly context: _angular_core.InputSignal<Record<string, unknown>>;
1029
1038
  /** Error state signal */
1030
- private _error;
1031
- error: () => boolean;
1039
+ readonly error: _angular_core.WritableSignal<boolean>;
1032
1040
  private componentRef;
1033
1041
  private currentType;
1034
1042
  private currentAvailableInputs;
@@ -1448,7 +1456,7 @@ declare class VisualEditorComponent implements OnInit, OnDestroy {
1448
1456
  private readonly config;
1449
1457
  private readonly dndService;
1450
1458
  private readonly iframeBridge;
1451
- private readonly storefrontUrl;
1459
+ private readonly storefrontUrlService;
1452
1460
  private readonly sanitizer;
1453
1461
  private readonly destroy$;
1454
1462
  readonly showBackButton: _angular_core.Signal<boolean>;
@@ -1926,18 +1934,28 @@ interface ComponentManifestEntry {
1926
1934
  * the entries in the ComponentRegistryService as "virtual" definitions
1927
1935
  * (no Angular component class — only metadata for palette and property panel).
1928
1936
  */
1929
- declare class ManifestLoaderService {
1937
+ declare class ManifestLoaderService implements OnDestroy {
1930
1938
  private readonly http;
1931
1939
  private readonly registry;
1940
+ private watchInterval;
1941
+ private lastManifestHash;
1942
+ private manifestTypes;
1932
1943
  /**
1933
1944
  * Fetch the manifest from the given URL and register all components.
1934
1945
  */
1935
1946
  loadManifest(url: string): Observable<ComponentManifest>;
1947
+ /**
1948
+ * Poll the manifest URL for changes and re-register components when the
1949
+ * content hash differs. Only active in dev mode. No-op in production.
1950
+ */
1951
+ startWatching(manifestUrl: string, intervalMs?: number): void;
1952
+ ngOnDestroy(): void;
1936
1953
  /**
1937
1954
  * Register manifest entries in the ComponentRegistryService.
1938
1955
  * Each entry becomes a ComponentDefinition without a `component` field.
1939
1956
  */
1940
1957
  registerManifestComponents(manifest: ComponentManifest): void;
1958
+ private hashManifest;
1941
1959
  private manifestEntryToDefinition;
1942
1960
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ManifestLoaderService, never>;
1943
1961
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ManifestLoaderService>;
@@ -2014,6 +2032,31 @@ declare class IframeBridgeService implements OnDestroy {
2014
2032
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<IframeBridgeService>;
2015
2033
  }
2016
2034
 
2035
+ /**
2036
+ * Service that holds and dynamically loads the per-merchant storefront URL.
2037
+ *
2038
+ * Resolution order:
2039
+ * 1. Metafield value loaded from GET /api/storefront-url (per-shop)
2040
+ * 2. Static STOREFRONT_URL injection token (env var / window global fallback)
2041
+ * 3. Empty string (editor works with local components only)
2042
+ */
2043
+ declare class StorefrontUrlService {
2044
+ private readonly http;
2045
+ private readonly staticUrl;
2046
+ /** Current storefront URL — reactive signal used by the editor and iframe. */
2047
+ readonly url: _angular_core.WritableSignal<string>;
2048
+ /**
2049
+ * Load the storefront URL from the backend metafield.
2050
+ * Falls back to the static STOREFRONT_URL token if the endpoint
2051
+ * returns no value or fails.
2052
+ *
2053
+ * Called during APP_INITIALIZER.
2054
+ */
2055
+ load(): Promise<void>;
2056
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StorefrontUrlService, never>;
2057
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<StorefrontUrlService>;
2058
+ }
2059
+
2017
2060
  declare class DragDropService {
2018
2061
  private readonly store;
2019
2062
  private readonly registry;
@@ -2044,5 +2087,5 @@ declare class VisualEditor {
2044
2087
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<VisualEditor, "lib-visual-editor", never, {}, {}, never, never, true, never>;
2045
2088
  }
2046
2089
 
2047
- export { BlockTreeItemComponent, CREATE_METAFIELD_DEFINITION_MUTATION, ComponentRegistryService, DEFAULT_ROUTER_NAVIGATION_CONFIG, DEFAULT_VISUAL_EDITOR_CONFIG, DELETE_METAFIELDS_MUTATION, DELETE_METAFIELD_DEFINITION_MUTATION, DefaultRouterNavigationService, DragDropService, DynamicRendererComponent, EDITOR_COMPONENT_DEFINITIONS, FILES_QUERY, GET_METAFIELD_DEFINITION_QUERY, GET_SHOP_ID_QUERY, GET_SHOP_METAFIELD_QUERY, INDEX_KEY, IframeBridgeService, InputPageLoadingStrategy, MAX_METAFIELD_SIZE, ManifestLoaderService, NAMESPACE, PageLoadingStrategy, PageManagerComponent, PageService, PageShopifyRepository, PageStorefrontRepository, ROUTER_NAVIGATION_CONFIG, RoutePageLoadingStrategy, SET_METAFIELD_MUTATION, SHOPIFY_CONFIG, STOREFRONT_CONFIG, STOREFRONT_URL, ShopifyFilePickerComponent, ShopifyFilesService, ShopifyGraphQLClient, ShopifyMetafieldRepository, SlotRendererComponent, StorefrontGraphQLClient, StorefrontMetafieldRepository, USE_IN_MEMORY_PAGES, VISUAL_EDITOR_CONFIG, VISUAL_EDITOR_FEATURE_KEY, VisualEditor, VisualEditorActions, VisualEditorComponent, VisualEditorFacade, VisualEditorNavigation, initialVisualEditorState, provideEditorComponents, provideVisualEditor, provideVisualEditorStore, selectBlocksForSection, selectBlocksForSlot, selectCanRedo, selectCanUndo, selectCurrentPage, selectCurrentPageId, selectCurrentPageSlug, selectCurrentPageStatus, selectCurrentPageTitle, selectCurrentPageVersion, selectDraggedElementId, selectElementById, selectHistory, selectHistoryIndex, selectHistoryLength, selectIsDirty, selectIsDragging, selectIsPageLoaded, selectLastAction, selectSectionById, selectSections, selectSelectedBlock, selectSelectedBlockSlotName, selectSelectedElement, selectSelectedElementId, selectSelectedElementType, selectSelectedSection, selectSelectedSectionId, selectSelectedSectionType, selectVisualEditorState, visualEditorReducer };
2090
+ export { BlockTreeItemComponent, CREATE_METAFIELD_DEFINITION_MUTATION, ComponentRegistryService, DEFAULT_ROUTER_NAVIGATION_CONFIG, DEFAULT_VISUAL_EDITOR_CONFIG, DELETE_METAFIELDS_MUTATION, DELETE_METAFIELD_DEFINITION_MUTATION, DefaultRouterNavigationService, DragDropService, DynamicRendererComponent, EDITOR_COMPONENT_DEFINITIONS, FILES_QUERY, GET_METAFIELD_DEFINITION_QUERY, GET_SHOP_ID_QUERY, GET_SHOP_METAFIELD_QUERY, INDEX_KEY, IframeBridgeService, InputPageLoadingStrategy, MAX_METAFIELD_SIZE, ManifestLoaderService, NAMESPACE, PageLoadingStrategy, PageManagerComponent, PageService, PageShopifyRepository, PageStorefrontRepository, ROUTER_NAVIGATION_CONFIG, RoutePageLoadingStrategy, SET_METAFIELD_MUTATION, SHOPIFY_CONFIG, STOREFRONT_CONFIG, STOREFRONT_URL, ShopifyFilePickerComponent, ShopifyFilesService, ShopifyGraphQLClient, ShopifyMetafieldRepository, SlotRendererComponent, StorefrontGraphQLClient, StorefrontMetafieldRepository, StorefrontUrlService, USE_IN_MEMORY_PAGES, VISUAL_EDITOR_CONFIG, VISUAL_EDITOR_FEATURE_KEY, VisualEditor, VisualEditorActions, VisualEditorComponent, VisualEditorFacade, VisualEditorNavigation, initialVisualEditorState, provideEditorComponents, provideVisualEditor, provideVisualEditorStore, selectBlocksForSection, selectBlocksForSlot, selectCanRedo, selectCanUndo, selectCurrentPage, selectCurrentPageId, selectCurrentPageSlug, selectCurrentPageStatus, selectCurrentPageTitle, selectCurrentPageVersion, selectDraggedElementId, selectElementById, selectHistory, selectHistoryIndex, selectHistoryLength, selectIsDirty, selectIsDragging, selectIsPageLoaded, selectLastAction, selectSectionById, selectSections, selectSelectedBlock, selectSelectedBlockSlotName, selectSelectedElement, selectSelectedElementId, selectSelectedElementType, selectSelectedSection, selectSelectedSectionId, selectSelectedSectionType, selectVisualEditorState, visualEditorReducer };
2048
2091
  export type { BlockPickerTarget, BlockTreeContext, ComponentCategory, ComponentDefinition, ComponentManifest, ComponentManifestEntry, ComponentPreset, ConfirmDialogOptions, CreatePageRequest, DeselectMessage, DragItem, DragItemKind, DropTarget, DropZone, EditorElement, EditorSection, ElementClickedMessage, ElementHoverMessage, ElementMovedMessage, HistoryEntry, Metafield, Page, PageContext, PageIndexEntry, PageStatus, PageSummary, PageUpdateMessage, PagesIndex, PresetBlockConfig, PropCondition, PropSchema, PropSchemaMap, PropType, PropValidation, PublishPageRequest, ReadyMessage, ResolvedPreset, RouterNavigationConfig, SelectElementMessage, SelectOption, ShopifyConfig, ShopifyFile, ShopifyFilesPage, SlotConstraints, SlotDefinition, StorefrontConfig, UpdatePageRequest, VisualEditorConfig, VisualEditorNavigationTarget, VisualEditorState };