@snowcone-app/sdk 0.12.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#620](https://github.com/snowcone-app/snowcone-monorepo/pull/620) [`8fee313`](https://github.com/snowcone-app/snowcone-monorepo/commit/8fee31335d0d315834e9b7f6602404a94eeda5b7) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Composable `Editor.*` primitives — the ADR-0085 vertical slice (experimental).
8
+
9
+ New on `@snowcone-app/canvas/embed`: `Editor.Root` / `Editor.Canvas` /
10
+ `Editor.Preview` / `Editor.TextField` / `Editor.Buy` — compound parts over one
11
+ Root; the host owns all layout. Includes the typed layer-token API
12
+ (`design.layer("name")` — compile-checked against the design's layer names,
13
+ runtime-validated for JSON-loaded designs), the one live design-state store
14
+ (seeded from the design, updated by canvas edits AND TextField writes,
15
+ last-write-wins), smart Buy (completeness rules + payload assembled from
16
+ design state), structured `EditorError` codes, and Root's built-in error
17
+ boundary. **All `Editor.*` exports are `@experimental`** — the API may change
18
+ in minors until the default editor is rebuilt from these public parts.
19
+
20
+ Existing turnkey API unchanged in meaning: `RealtimeEmbed` is now a thin
21
+ wrapper over `Editor.Root` (same behavior, advisory validation),
22
+ `RealtimeMockup` over `Editor.Preview`. One behavior note: `RealtimeCanvas`'s
23
+ implementation moved into the shared lazy renderer chunk — the embed entry's
24
+ static import graph is now renderer-free (a no-canvas page never downloads
25
+ the rendering engine; CI-enforced), and the canvas mounts one chunk-fetch
26
+ after first paint. The floating contextual toolbar now tracks page/container
27
+ scroll (it previously drifted on scrolling host pages).
28
+
29
+ sdk: internal dead-code cleanup (no API change).
30
+
3
31
  ## 0.12.0
4
32
 
5
33
  ### Minor Changes
@@ -26,7 +26,6 @@ var RealtimeMockupService = class {
26
26
  logs = [];
27
27
  lastError = null;
28
28
  callbacks = {};
29
- lastBlobSentAt = 0;
30
29
  // Per-request send timestamps keyed by requestId, for client-observed
31
30
  // round-trip timing in the mockup_rendered log. Pruned to a small cap so an
32
31
  // in-flight burst can't grow it unbounded.
@@ -556,7 +555,6 @@ var RealtimeMockupService = class {
556
555
  });
557
556
  this.ws.send(message);
558
557
  this.recordRequestSent(requestId);
559
- this.lastBlobSentAt = Date.now();
560
558
  console.log(`[WS] canvas_state(ref) SENT: placement="${placement}" v${this.lastSentVersion} req=${requestId} stateId=${stateId} at ${Date.now()}`);
561
559
  this.addLog(`Sent canvas stateId "${stateId}" for "${placement}" (v${this.lastSentVersion}, req ${requestId})`, "sent");
562
560
  this.callbacks.onBlobSent?.(placement);
@@ -594,7 +592,6 @@ var RealtimeMockupService = class {
594
592
  this.ws.send(message);
595
593
  this.recordRequestSent(requestId);
596
594
  this.lastSentStateJson[placement] = stateJson;
597
- this.lastBlobSentAt = Date.now();
598
595
  console.log(`[WS] canvas_state SENT: placement="${placement}" v${this.lastSentVersion} req=${requestId} (${(message.length / 1024).toFixed(1)}KB) at ${Date.now()}`);
599
596
  this.addLog(`Sent canvas state for "${placement}" (${(message.length / 1024).toFixed(1)}KB, v${this.lastSentVersion}, req ${requestId})`, "sent");
600
597
  this.callbacks.onBlobSent?.(placement);
@@ -624,7 +621,6 @@ ${versionToSend}
624
621
  combined.set(imageBytes, headerBytes.length);
625
622
  }
626
623
  this.ws.send(combined.buffer);
627
- this.lastBlobSentAt = Date.now();
628
624
  this.addLog(`Sent canvas blob for placement "${placement}" (${imageBytes.length} bytes, v${versionToSend})`, "sent");
629
625
  if (notifyCallback) {
630
626
  this.callbacks.onBlobSent?.(placement);
package/dist/index.cjs CHANGED
@@ -410,59 +410,6 @@ var MockupServiceImpl = class {
410
410
  }
411
411
  return url;
412
412
  }
413
- buildMockupUrl(options) {
414
- const { design, product, effects } = options;
415
- const pathSegments = ["m"];
416
- pathSegments.push(product.productId);
417
- pathSegments.push(product.mockupId);
418
- pathSegments.push(product.variantId);
419
- pathSegments.push(String(product.width));
420
- const designParts = [];
421
- for (const element of design) {
422
- const part = this.encodeDesignElement(element);
423
- designParts.push(part);
424
- }
425
- if (designParts.length > 0) {
426
- pathSegments.push(designParts.join("_"));
427
- } else {
428
- pathSegments.push("");
429
- }
430
- if (effects?.grain) {
431
- pathSegments.push(`g${effects.grain}`);
432
- }
433
- return "/" + pathSegments.join("/");
434
- }
435
- encodeDesignElement(element) {
436
- const parts = [];
437
- if (element.type === "image") {
438
- const encodedUrl = this.encodeImageUrl(element.imageUrl);
439
- parts.push(encodedUrl);
440
- parts.push(element.placement);
441
- parts.push(String(element.width));
442
- parts.push(String(element.height));
443
- parts.push(element.alignment);
444
- if (element.tiles && element.tiles > 1) {
445
- parts.push(`t${element.tiles}`);
446
- }
447
- } else if (element.type === "color") {
448
- const colorCode = element.hex.replace("#", "");
449
- parts.push(colorCode);
450
- parts.push(element.placement);
451
- parts.push(String(element.width));
452
- parts.push(String(element.height));
453
- parts.push(element.alignment);
454
- }
455
- return parts.join(",");
456
- }
457
- encodeImageUrl(url) {
458
- if (typeof window !== "undefined" && window.btoa) {
459
- const base64 = window.btoa(url);
460
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
461
- } else {
462
- const base64 = Buffer.from(url).toString("base64");
463
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
464
- }
465
- }
466
413
  async getSignedUrl(relativeUrl) {
467
414
  const urlWithAccountId = relativeUrl + (relativeUrl.includes("?") ? "&" : "?") + `shop=${encodeURIComponent(this.config.shop)}`;
468
415
  const cacheKey = urlWithAccountId;
@@ -1163,7 +1110,7 @@ var StateManager = class {
1163
1110
  if (options.debug) {
1164
1111
  this.middleware.push({
1165
1112
  name: "debug",
1166
- afterUpdate: (state, prevState) => {
1113
+ afterUpdate: (_state, _prevState) => {
1167
1114
  }
1168
1115
  });
1169
1116
  }
@@ -1285,15 +1232,6 @@ var StateManager = class {
1285
1232
  hasStateChanged(prev, next) {
1286
1233
  return JSON.stringify(prev) !== JSON.stringify(next);
1287
1234
  }
1288
- getStateDiff(prev, next) {
1289
- const diff = {};
1290
- for (const key in next) {
1291
- if (prev[key] !== next[key]) {
1292
- diff[key] = next[key];
1293
- }
1294
- }
1295
- return diff;
1296
- }
1297
1235
  persistState() {
1298
1236
  if (this.options.persist) {
1299
1237
  const storage = this.options.persist.storage || localStorage;
@@ -1594,7 +1532,7 @@ function handleOptionChange(optionKey, newValue, currentSelection, attributes) {
1594
1532
  );
1595
1533
  return clearedSelection;
1596
1534
  }
1597
- function clearDependentSelections(changedKey, selection, attributes) {
1535
+ function clearDependentSelections(_changedKey, selection, _attributes) {
1598
1536
  return selection;
1599
1537
  }
1600
1538
  function validateRequiredOptions(selection, attributes) {
@@ -3196,7 +3134,7 @@ var ContextInjector = class {
3196
3134
  setContext(key) {
3197
3135
  return { key, provider };
3198
3136
  },
3199
- getContext(key) {
3137
+ getContext(_key) {
3200
3138
  return provider;
3201
3139
  }
3202
3140
  };
@@ -3254,7 +3192,7 @@ function withContext(Base) {
3254
3192
  onContextError(error) {
3255
3193
  console.error("Context error:", error);
3256
3194
  }
3257
- onContextLoading(loading) {
3195
+ onContextLoading(_loading) {
3258
3196
  }
3259
3197
  findProvider() {
3260
3198
  return void 0;
@@ -4355,7 +4293,7 @@ var ComponentFactory = class {
4355
4293
  * Create a React component
4356
4294
  */
4357
4295
  static forReact(definition, React) {
4358
- const { metadata, descriptor } = definition;
4296
+ const { metadata } = definition;
4359
4297
  const Component = (props) => {
4360
4298
  return React.createElement("div", props);
4361
4299
  };
@@ -4366,12 +4304,12 @@ var ComponentFactory = class {
4366
4304
  * Create a Vue component
4367
4305
  */
4368
4306
  static forVue(definition) {
4369
- const { metadata, descriptor } = definition;
4307
+ const { metadata } = definition;
4370
4308
  return {
4371
4309
  name: metadata.name,
4372
4310
  props: metadata.props,
4373
4311
  emits: metadata.events?.map((e) => e.name),
4374
- setup(props, context) {
4312
+ setup(_props, _context) {
4375
4313
  return () => null;
4376
4314
  }
4377
4315
  };
@@ -4389,7 +4327,7 @@ var ComponentFactory = class {
4389
4327
  * Create a Web Component
4390
4328
  */
4391
4329
  static forWebComponent(definition, LitElement) {
4392
- const { metadata, descriptor } = definition;
4330
+ const { metadata } = definition;
4393
4331
  class Component extends LitElement {
4394
4332
  static properties = metadata.props;
4395
4333
  render() {
@@ -4538,7 +4476,7 @@ var LitAdapter = class {
4538
4476
  /**
4539
4477
  * Render a component
4540
4478
  */
4541
- render(component, props) {
4479
+ render(component, _props) {
4542
4480
  return component.render(this);
4543
4481
  }
4544
4482
  /**
@@ -4559,10 +4497,10 @@ var LitAdapter = class {
4559
4497
  Promise.resolve().then(callback);
4560
4498
  }
4561
4499
  },
4562
- computed: (deps, compute) => {
4500
+ computed: (_deps, compute) => {
4563
4501
  return compute();
4564
4502
  },
4565
- memo: (value, deps) => {
4503
+ memo: (value, _deps) => {
4566
4504
  return value;
4567
4505
  }
4568
4506
  };
@@ -4574,7 +4512,7 @@ var LitAdapter = class {
4574
4512
  this.element = element;
4575
4513
  }
4576
4514
  };
4577
- function createLitComponent(descriptor, LitElement, html) {
4515
+ function createLitComponent(descriptor, LitElement, _html) {
4578
4516
  return class extends LitElement {
4579
4517
  adapter = new LitAdapter(this);
4580
4518
  connectedCallback() {
@@ -4710,7 +4648,7 @@ var VueAdapter = class {
4710
4648
  * Get Vue-specific utilities
4711
4649
  */
4712
4650
  getUtilities() {
4713
- const { nextTick, computed, watchEffect } = this.vue;
4651
+ const { nextTick, computed } = this.vue;
4714
4652
  return {
4715
4653
  batchUpdates: (callback) => {
4716
4654
  callback();
@@ -4718,17 +4656,17 @@ var VueAdapter = class {
4718
4656
  nextTick: (callback) => {
4719
4657
  nextTick(callback);
4720
4658
  },
4721
- computed: (deps, compute) => {
4659
+ computed: (_deps, compute) => {
4722
4660
  return computed(compute).value;
4723
4661
  },
4724
- memo: (value, deps) => {
4662
+ memo: (value, _deps) => {
4725
4663
  return value;
4726
4664
  }
4727
4665
  };
4728
4666
  }
4729
4667
  };
4730
4668
  function createVueComponent(descriptor, vue) {
4731
- const { defineComponent: defineComponent2, h } = vue;
4669
+ const { defineComponent: defineComponent2 } = vue;
4732
4670
  return defineComponent2({
4733
4671
  name: descriptor.name,
4734
4672
  props: descriptor.props || {},
@@ -4750,11 +4688,8 @@ var SvelteAdapter = class {
4750
4688
  name = "svelte";
4751
4689
  svelte;
4752
4690
  // Svelte imports
4753
- component;
4754
- // Component instance
4755
- constructor(svelte, component) {
4691
+ constructor(svelte, _component) {
4756
4692
  this.svelte = svelte;
4757
- this.component = component;
4758
4693
  }
4759
4694
  /**
4760
4695
  * Create a stateful value using Svelte stores
@@ -4845,7 +4780,7 @@ var SvelteAdapter = class {
4845
4780
  /**
4846
4781
  * Render a component
4847
4782
  */
4848
- render(component, props) {
4783
+ render(component, _props) {
4849
4784
  return component.render(this);
4850
4785
  }
4851
4786
  /**
@@ -4865,7 +4800,7 @@ var SvelteAdapter = class {
4865
4800
  const derivedStore = derived(deps, compute);
4866
4801
  return get(derivedStore);
4867
4802
  },
4868
- memo: (value, deps) => {
4803
+ memo: (value, _deps) => {
4869
4804
  return value;
4870
4805
  }
4871
4806
  };
@@ -4913,7 +4848,6 @@ var RealtimeMockupService = class {
4913
4848
  logs = [];
4914
4849
  lastError = null;
4915
4850
  callbacks = {};
4916
- lastBlobSentAt = 0;
4917
4851
  // Per-request send timestamps keyed by requestId, for client-observed
4918
4852
  // round-trip timing in the mockup_rendered log. Pruned to a small cap so an
4919
4853
  // in-flight burst can't grow it unbounded.
@@ -5443,7 +5377,6 @@ var RealtimeMockupService = class {
5443
5377
  });
5444
5378
  this.ws.send(message);
5445
5379
  this.recordRequestSent(requestId);
5446
- this.lastBlobSentAt = Date.now();
5447
5380
  console.log(`[WS] canvas_state(ref) SENT: placement="${placement}" v${this.lastSentVersion} req=${requestId} stateId=${stateId} at ${Date.now()}`);
5448
5381
  this.addLog(`Sent canvas stateId "${stateId}" for "${placement}" (v${this.lastSentVersion}, req ${requestId})`, "sent");
5449
5382
  this.callbacks.onBlobSent?.(placement);
@@ -5481,7 +5414,6 @@ var RealtimeMockupService = class {
5481
5414
  this.ws.send(message);
5482
5415
  this.recordRequestSent(requestId);
5483
5416
  this.lastSentStateJson[placement] = stateJson;
5484
- this.lastBlobSentAt = Date.now();
5485
5417
  console.log(`[WS] canvas_state SENT: placement="${placement}" v${this.lastSentVersion} req=${requestId} (${(message.length / 1024).toFixed(1)}KB) at ${Date.now()}`);
5486
5418
  this.addLog(`Sent canvas state for "${placement}" (${(message.length / 1024).toFixed(1)}KB, v${this.lastSentVersion}, req ${requestId})`, "sent");
5487
5419
  this.callbacks.onBlobSent?.(placement);
@@ -5511,7 +5443,6 @@ ${versionToSend}
5511
5443
  combined.set(imageBytes, headerBytes.length);
5512
5444
  }
5513
5445
  this.ws.send(combined.buffer);
5514
- this.lastBlobSentAt = Date.now();
5515
5446
  this.addLog(`Sent canvas blob for placement "${placement}" (${imageBytes.length} bytes, v${versionToSend})`, "sent");
5516
5447
  if (notifyCallback) {
5517
5448
  this.callbacks.onBlobSent?.(placement);
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createDevFetcher } from './dev-fetcher.cjs';
2
2
  import { PublicDesign, PublicFill, PublicOptions } from '@snowcone-app/mockup-url';
3
- import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeMockupService } from './websocket-X4tcUm78.cjs';
4
- export { A as AdapterRegistry, h as ProductComponentContext, i as RealtimeMockupCallbacks, j as RealtimeMockupState, k as RenderResult, W as WebSocketConfig, l as WebSocketMessage, m as adapterRegistry, n as computeDisabledChoices, o as createComponent, p as defineComponent, q as deriveDefaultSelection, r as findBestCombination, s as getPricePreview, t as isOptionAvailable, u as resolveBestCombination } from './websocket-X4tcUm78.cjs';
3
+ import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeMockupService } from './websocket-Bfc3nsyG.cjs';
4
+ export { A as AdapterRegistry, h as ProductComponentContext, i as RealtimeMockupCallbacks, j as RealtimeMockupState, k as RenderResult, W as WebSocketConfig, l as WebSocketMessage, m as adapterRegistry, n as computeDisabledChoices, o as createComponent, p as defineComponent, q as deriveDefaultSelection, r as findBestCombination, s as getPricePreview, t as isOptionAvailable, u as resolveBestCombination } from './websocket-Bfc3nsyG.cjs';
5
5
 
6
6
  interface CatalogProduct {
7
7
  id: string;
@@ -396,7 +396,6 @@ declare class StateManager<T extends Record<string, any>> {
396
396
  private processUpdateQueue;
397
397
  private notifySubscribers;
398
398
  private hasStateChanged;
399
- private getStateDiff;
400
399
  private persistState;
401
400
  private loadPersistedState;
402
401
  }
@@ -1674,7 +1673,7 @@ declare function withContext<T extends new (...args: any[]) => any>(Base: T): {
1674
1673
  disconnectedCallback(): void;
1675
1674
  onContextUpdate(context: ProductContext): void;
1676
1675
  onContextError(error: any): void;
1677
- onContextLoading(loading: boolean): void;
1676
+ onContextLoading(_loading: boolean): void;
1678
1677
  findProvider(): UniversalContextProvider | undefined;
1679
1678
  };
1680
1679
  } & T;
@@ -2441,7 +2440,7 @@ declare class LitAdapter implements FrameworkAdapter<ComponentProps> {
2441
2440
  /**
2442
2441
  * Render a component
2443
2442
  */
2444
- render(component: ComponentDescriptor, props: ComponentProps): any;
2443
+ render(component: ComponentDescriptor, _props: ComponentProps): any;
2445
2444
  /**
2446
2445
  * Get Lit-specific utilities
2447
2446
  */
@@ -2454,7 +2453,7 @@ declare class LitAdapter implements FrameworkAdapter<ComponentProps> {
2454
2453
  /**
2455
2454
  * Create a Lit component from a descriptor
2456
2455
  */
2457
- declare function createLitComponent(descriptor: ComponentDescriptor, LitElement: any, html: any): any;
2456
+ declare function createLitComponent(descriptor: ComponentDescriptor, LitElement: any, _html: any): any;
2458
2457
 
2459
2458
  /**
2460
2459
  * Vue 3 framework adapter implementation
@@ -2518,8 +2517,7 @@ declare function useFrameworkAdapter(vue: any): VueAdapter;
2518
2517
  declare class SvelteAdapter implements FrameworkAdapter<ComponentProps> {
2519
2518
  name: "svelte";
2520
2519
  private svelte;
2521
- private component;
2522
- constructor(svelte: any, component?: any);
2520
+ constructor(svelte: any, _component?: any);
2523
2521
  /**
2524
2522
  * Create a stateful value using Svelte stores
2525
2523
  */
@@ -2545,7 +2543,7 @@ declare class SvelteAdapter implements FrameworkAdapter<ComponentProps> {
2545
2543
  /**
2546
2544
  * Render a component
2547
2545
  */
2548
- render(component: ComponentDescriptor, props: ComponentProps): any;
2546
+ render(component: ComponentDescriptor, _props: ComponentProps): any;
2549
2547
  /**
2550
2548
  * Get Svelte-specific utilities
2551
2549
  */
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createDevFetcher } from './dev-fetcher.js';
2
2
  import { PublicDesign, PublicFill, PublicOptions } from '@snowcone-app/mockup-url';
3
- import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeMockupService } from './websocket-X4tcUm78.js';
4
- export { A as AdapterRegistry, h as ProductComponentContext, i as RealtimeMockupCallbacks, j as RealtimeMockupState, k as RenderResult, W as WebSocketConfig, l as WebSocketMessage, m as adapterRegistry, n as computeDisabledChoices, o as createComponent, p as defineComponent, q as deriveDefaultSelection, r as findBestCombination, s as getPricePreview, t as isOptionAvailable, u as resolveBestCombination } from './websocket-X4tcUm78.js';
3
+ import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeMockupService } from './websocket-Bfc3nsyG.js';
4
+ export { A as AdapterRegistry, h as ProductComponentContext, i as RealtimeMockupCallbacks, j as RealtimeMockupState, k as RenderResult, W as WebSocketConfig, l as WebSocketMessage, m as adapterRegistry, n as computeDisabledChoices, o as createComponent, p as defineComponent, q as deriveDefaultSelection, r as findBestCombination, s as getPricePreview, t as isOptionAvailable, u as resolveBestCombination } from './websocket-Bfc3nsyG.js';
5
5
 
6
6
  interface CatalogProduct {
7
7
  id: string;
@@ -396,7 +396,6 @@ declare class StateManager<T extends Record<string, any>> {
396
396
  private processUpdateQueue;
397
397
  private notifySubscribers;
398
398
  private hasStateChanged;
399
- private getStateDiff;
400
399
  private persistState;
401
400
  private loadPersistedState;
402
401
  }
@@ -1674,7 +1673,7 @@ declare function withContext<T extends new (...args: any[]) => any>(Base: T): {
1674
1673
  disconnectedCallback(): void;
1675
1674
  onContextUpdate(context: ProductContext): void;
1676
1675
  onContextError(error: any): void;
1677
- onContextLoading(loading: boolean): void;
1676
+ onContextLoading(_loading: boolean): void;
1678
1677
  findProvider(): UniversalContextProvider | undefined;
1679
1678
  };
1680
1679
  } & T;
@@ -2441,7 +2440,7 @@ declare class LitAdapter implements FrameworkAdapter<ComponentProps> {
2441
2440
  /**
2442
2441
  * Render a component
2443
2442
  */
2444
- render(component: ComponentDescriptor, props: ComponentProps): any;
2443
+ render(component: ComponentDescriptor, _props: ComponentProps): any;
2445
2444
  /**
2446
2445
  * Get Lit-specific utilities
2447
2446
  */
@@ -2454,7 +2453,7 @@ declare class LitAdapter implements FrameworkAdapter<ComponentProps> {
2454
2453
  /**
2455
2454
  * Create a Lit component from a descriptor
2456
2455
  */
2457
- declare function createLitComponent(descriptor: ComponentDescriptor, LitElement: any, html: any): any;
2456
+ declare function createLitComponent(descriptor: ComponentDescriptor, LitElement: any, _html: any): any;
2458
2457
 
2459
2458
  /**
2460
2459
  * Vue 3 framework adapter implementation
@@ -2518,8 +2517,7 @@ declare function useFrameworkAdapter(vue: any): VueAdapter;
2518
2517
  declare class SvelteAdapter implements FrameworkAdapter<ComponentProps> {
2519
2518
  name: "svelte";
2520
2519
  private svelte;
2521
- private component;
2522
- constructor(svelte: any, component?: any);
2520
+ constructor(svelte: any, _component?: any);
2523
2521
  /**
2524
2522
  * Create a stateful value using Svelte stores
2525
2523
  */
@@ -2545,7 +2543,7 @@ declare class SvelteAdapter implements FrameworkAdapter<ComponentProps> {
2545
2543
  /**
2546
2544
  * Render a component
2547
2545
  */
2548
- render(component: ComponentDescriptor, props: ComponentProps): any;
2546
+ render(component: ComponentDescriptor, _props: ComponentProps): any;
2549
2547
  /**
2550
2548
  * Get Svelte-specific utilities
2551
2549
  */
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  REALTIME_WS_URL,
6
6
  RealtimeMockupService
7
- } from "./chunk-LYLIDU6G.js";
7
+ } from "./chunk-QHRQ3VJD.js";
8
8
  import {
9
9
  buildMockupUrl,
10
10
  buildPublicMockupUrl,
@@ -267,59 +267,6 @@ var MockupServiceImpl = class {
267
267
  }
268
268
  return url;
269
269
  }
270
- buildMockupUrl(options) {
271
- const { design, product, effects } = options;
272
- const pathSegments = ["m"];
273
- pathSegments.push(product.productId);
274
- pathSegments.push(product.mockupId);
275
- pathSegments.push(product.variantId);
276
- pathSegments.push(String(product.width));
277
- const designParts = [];
278
- for (const element of design) {
279
- const part = this.encodeDesignElement(element);
280
- designParts.push(part);
281
- }
282
- if (designParts.length > 0) {
283
- pathSegments.push(designParts.join("_"));
284
- } else {
285
- pathSegments.push("");
286
- }
287
- if (effects?.grain) {
288
- pathSegments.push(`g${effects.grain}`);
289
- }
290
- return "/" + pathSegments.join("/");
291
- }
292
- encodeDesignElement(element) {
293
- const parts = [];
294
- if (element.type === "image") {
295
- const encodedUrl = this.encodeImageUrl(element.imageUrl);
296
- parts.push(encodedUrl);
297
- parts.push(element.placement);
298
- parts.push(String(element.width));
299
- parts.push(String(element.height));
300
- parts.push(element.alignment);
301
- if (element.tiles && element.tiles > 1) {
302
- parts.push(`t${element.tiles}`);
303
- }
304
- } else if (element.type === "color") {
305
- const colorCode = element.hex.replace("#", "");
306
- parts.push(colorCode);
307
- parts.push(element.placement);
308
- parts.push(String(element.width));
309
- parts.push(String(element.height));
310
- parts.push(element.alignment);
311
- }
312
- return parts.join(",");
313
- }
314
- encodeImageUrl(url) {
315
- if (typeof window !== "undefined" && window.btoa) {
316
- const base64 = window.btoa(url);
317
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
318
- } else {
319
- const base64 = Buffer.from(url).toString("base64");
320
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
321
- }
322
- }
323
270
  async getSignedUrl(relativeUrl) {
324
271
  const urlWithAccountId = relativeUrl + (relativeUrl.includes("?") ? "&" : "?") + `shop=${encodeURIComponent(this.config.shop)}`;
325
272
  const cacheKey = urlWithAccountId;
@@ -797,7 +744,7 @@ var StateManager = class {
797
744
  if (options.debug) {
798
745
  this.middleware.push({
799
746
  name: "debug",
800
- afterUpdate: (state, prevState) => {
747
+ afterUpdate: (_state, _prevState) => {
801
748
  }
802
749
  });
803
750
  }
@@ -919,15 +866,6 @@ var StateManager = class {
919
866
  hasStateChanged(prev, next) {
920
867
  return JSON.stringify(prev) !== JSON.stringify(next);
921
868
  }
922
- getStateDiff(prev, next) {
923
- const diff = {};
924
- for (const key in next) {
925
- if (prev[key] !== next[key]) {
926
- diff[key] = next[key];
927
- }
928
- }
929
- return diff;
930
- }
931
869
  persistState() {
932
870
  if (this.options.persist) {
933
871
  const storage = this.options.persist.storage || localStorage;
@@ -1228,7 +1166,7 @@ function handleOptionChange(optionKey, newValue, currentSelection, attributes) {
1228
1166
  );
1229
1167
  return clearedSelection;
1230
1168
  }
1231
- function clearDependentSelections(changedKey, selection, attributes) {
1169
+ function clearDependentSelections(_changedKey, selection, _attributes) {
1232
1170
  return selection;
1233
1171
  }
1234
1172
  function validateRequiredOptions(selection, attributes) {
@@ -2830,7 +2768,7 @@ var ContextInjector = class {
2830
2768
  setContext(key) {
2831
2769
  return { key, provider };
2832
2770
  },
2833
- getContext(key) {
2771
+ getContext(_key) {
2834
2772
  return provider;
2835
2773
  }
2836
2774
  };
@@ -2888,7 +2826,7 @@ function withContext(Base) {
2888
2826
  onContextError(error) {
2889
2827
  console.error("Context error:", error);
2890
2828
  }
2891
- onContextLoading(loading) {
2829
+ onContextLoading(_loading) {
2892
2830
  }
2893
2831
  findProvider() {
2894
2832
  return void 0;
@@ -3989,7 +3927,7 @@ var ComponentFactory = class {
3989
3927
  * Create a React component
3990
3928
  */
3991
3929
  static forReact(definition, React) {
3992
- const { metadata, descriptor } = definition;
3930
+ const { metadata } = definition;
3993
3931
  const Component = (props) => {
3994
3932
  return React.createElement("div", props);
3995
3933
  };
@@ -4000,12 +3938,12 @@ var ComponentFactory = class {
4000
3938
  * Create a Vue component
4001
3939
  */
4002
3940
  static forVue(definition) {
4003
- const { metadata, descriptor } = definition;
3941
+ const { metadata } = definition;
4004
3942
  return {
4005
3943
  name: metadata.name,
4006
3944
  props: metadata.props,
4007
3945
  emits: metadata.events?.map((e) => e.name),
4008
- setup(props, context) {
3946
+ setup(_props, _context) {
4009
3947
  return () => null;
4010
3948
  }
4011
3949
  };
@@ -4023,7 +3961,7 @@ var ComponentFactory = class {
4023
3961
  * Create a Web Component
4024
3962
  */
4025
3963
  static forWebComponent(definition, LitElement) {
4026
- const { metadata, descriptor } = definition;
3964
+ const { metadata } = definition;
4027
3965
  class Component extends LitElement {
4028
3966
  static properties = metadata.props;
4029
3967
  render() {
@@ -4172,7 +4110,7 @@ var LitAdapter = class {
4172
4110
  /**
4173
4111
  * Render a component
4174
4112
  */
4175
- render(component, props) {
4113
+ render(component, _props) {
4176
4114
  return component.render(this);
4177
4115
  }
4178
4116
  /**
@@ -4193,10 +4131,10 @@ var LitAdapter = class {
4193
4131
  Promise.resolve().then(callback);
4194
4132
  }
4195
4133
  },
4196
- computed: (deps, compute) => {
4134
+ computed: (_deps, compute) => {
4197
4135
  return compute();
4198
4136
  },
4199
- memo: (value, deps) => {
4137
+ memo: (value, _deps) => {
4200
4138
  return value;
4201
4139
  }
4202
4140
  };
@@ -4208,7 +4146,7 @@ var LitAdapter = class {
4208
4146
  this.element = element;
4209
4147
  }
4210
4148
  };
4211
- function createLitComponent(descriptor, LitElement, html) {
4149
+ function createLitComponent(descriptor, LitElement, _html) {
4212
4150
  return class extends LitElement {
4213
4151
  adapter = new LitAdapter(this);
4214
4152
  connectedCallback() {
@@ -4344,7 +4282,7 @@ var VueAdapter = class {
4344
4282
  * Get Vue-specific utilities
4345
4283
  */
4346
4284
  getUtilities() {
4347
- const { nextTick, computed, watchEffect } = this.vue;
4285
+ const { nextTick, computed } = this.vue;
4348
4286
  return {
4349
4287
  batchUpdates: (callback) => {
4350
4288
  callback();
@@ -4352,17 +4290,17 @@ var VueAdapter = class {
4352
4290
  nextTick: (callback) => {
4353
4291
  nextTick(callback);
4354
4292
  },
4355
- computed: (deps, compute) => {
4293
+ computed: (_deps, compute) => {
4356
4294
  return computed(compute).value;
4357
4295
  },
4358
- memo: (value, deps) => {
4296
+ memo: (value, _deps) => {
4359
4297
  return value;
4360
4298
  }
4361
4299
  };
4362
4300
  }
4363
4301
  };
4364
4302
  function createVueComponent(descriptor, vue) {
4365
- const { defineComponent: defineComponent2, h } = vue;
4303
+ const { defineComponent: defineComponent2 } = vue;
4366
4304
  return defineComponent2({
4367
4305
  name: descriptor.name,
4368
4306
  props: descriptor.props || {},
@@ -4384,11 +4322,8 @@ var SvelteAdapter = class {
4384
4322
  name = "svelte";
4385
4323
  svelte;
4386
4324
  // Svelte imports
4387
- component;
4388
- // Component instance
4389
- constructor(svelte, component) {
4325
+ constructor(svelte, _component) {
4390
4326
  this.svelte = svelte;
4391
- this.component = component;
4392
4327
  }
4393
4328
  /**
4394
4329
  * Create a stateful value using Svelte stores
@@ -4479,7 +4414,7 @@ var SvelteAdapter = class {
4479
4414
  /**
4480
4415
  * Render a component
4481
4416
  */
4482
- render(component, props) {
4417
+ render(component, _props) {
4483
4418
  return component.render(this);
4484
4419
  }
4485
4420
  /**
@@ -4499,7 +4434,7 @@ var SvelteAdapter = class {
4499
4434
  const derivedStore = derived(deps, compute);
4500
4435
  return get(derivedStore);
4501
4436
  },
4502
- memo: (value, deps) => {
4437
+ memo: (value, _deps) => {
4503
4438
  return value;
4504
4439
  }
4505
4440
  };
package/dist/react.cjs CHANGED
@@ -58,7 +58,6 @@ var RealtimeMockupService = class {
58
58
  logs = [];
59
59
  lastError = null;
60
60
  callbacks = {};
61
- lastBlobSentAt = 0;
62
61
  // Per-request send timestamps keyed by requestId, for client-observed
63
62
  // round-trip timing in the mockup_rendered log. Pruned to a small cap so an
64
63
  // in-flight burst can't grow it unbounded.
@@ -588,7 +587,6 @@ var RealtimeMockupService = class {
588
587
  });
589
588
  this.ws.send(message);
590
589
  this.recordRequestSent(requestId);
591
- this.lastBlobSentAt = Date.now();
592
590
  console.log(`[WS] canvas_state(ref) SENT: placement="${placement}" v${this.lastSentVersion} req=${requestId} stateId=${stateId} at ${Date.now()}`);
593
591
  this.addLog(`Sent canvas stateId "${stateId}" for "${placement}" (v${this.lastSentVersion}, req ${requestId})`, "sent");
594
592
  this.callbacks.onBlobSent?.(placement);
@@ -626,7 +624,6 @@ var RealtimeMockupService = class {
626
624
  this.ws.send(message);
627
625
  this.recordRequestSent(requestId);
628
626
  this.lastSentStateJson[placement] = stateJson;
629
- this.lastBlobSentAt = Date.now();
630
627
  console.log(`[WS] canvas_state SENT: placement="${placement}" v${this.lastSentVersion} req=${requestId} (${(message.length / 1024).toFixed(1)}KB) at ${Date.now()}`);
631
628
  this.addLog(`Sent canvas state for "${placement}" (${(message.length / 1024).toFixed(1)}KB, v${this.lastSentVersion}, req ${requestId})`, "sent");
632
629
  this.callbacks.onBlobSent?.(placement);
@@ -656,7 +653,6 @@ ${versionToSend}
656
653
  combined.set(imageBytes, headerBytes.length);
657
654
  }
658
655
  this.ws.send(combined.buffer);
659
- this.lastBlobSentAt = Date.now();
660
656
  this.addLog(`Sent canvas blob for placement "${placement}" (${imageBytes.length} bytes, v${versionToSend})`, "sent");
661
657
  if (notifyCallback) {
662
658
  this.callbacks.onBlobSent?.(placement);
package/dist/react.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { M as MockupResult, W as WebSocketConfig, P as PlacementSettings, F as FrameworkAdapter, b as ComponentProps, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, c as ComponentDescriptor, g as FrameworkUtilities } from './websocket-X4tcUm78.cjs';
1
+ import { M as MockupResult, W as WebSocketConfig, P as PlacementSettings, F as FrameworkAdapter, b as ComponentProps, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, c as ComponentDescriptor, g as FrameworkUtilities } from './websocket-Bfc3nsyG.cjs';
2
2
 
3
3
  interface UseRealtimeMockupOptions {
4
4
  wsUrl?: string;
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { M as MockupResult, W as WebSocketConfig, P as PlacementSettings, F as FrameworkAdapter, b as ComponentProps, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, c as ComponentDescriptor, g as FrameworkUtilities } from './websocket-X4tcUm78.js';
1
+ import { M as MockupResult, W as WebSocketConfig, P as PlacementSettings, F as FrameworkAdapter, b as ComponentProps, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, c as ComponentDescriptor, g as FrameworkUtilities } from './websocket-Bfc3nsyG.js';
2
2
 
3
3
  interface UseRealtimeMockupOptions {
4
4
  wsUrl?: string;
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RealtimeMockupService
3
- } from "./chunk-LYLIDU6G.js";
3
+ } from "./chunk-QHRQ3VJD.js";
4
4
 
5
5
  // src/realtime/react.ts
6
6
  import { useCallback, useEffect, useRef, useState } from "react";
@@ -316,7 +316,6 @@ declare class RealtimeMockupService {
316
316
  private logs;
317
317
  private lastError;
318
318
  private callbacks;
319
- private lastBlobSentAt;
320
319
  private requestSendTimes;
321
320
  private canvasBlobs;
322
321
  private canvasStates;
@@ -316,7 +316,6 @@ declare class RealtimeMockupService {
316
316
  private logs;
317
317
  private lastError;
318
318
  private callbacks;
319
- private lastBlobSentAt;
320
319
  private requestSendTimes;
321
320
  private canvasBlobs;
322
321
  private canvasStates;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowcone-app/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Snowcone SDK for product mockups and print-on-demand",
5
5
  "keywords": [
6
6
  "merch",