@snowcone-app/sdk 0.31.4 → 0.31.5
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 +6 -0
- package/dist/{chunk-KCIDK2T7.js → chunk-KCOLSFYH.js} +6 -3
- package/dist/{chunk-2MNYYJHG.js → chunk-N5WOD5X2.js} +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/react.cjs +4 -2
- package/dist/react.js +2 -2
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.31.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5693](https://github.com/snowcone-app/snowcone-monorepo/pull/5693) [`23dee39`](https://github.com/snowcone-app/snowcone-monorepo/commit/23dee39f7dbc3d2f922ac8dd308f8ec93facc94c) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Export `MOCKUP_VIEW_WHOLE_STRIP` (`"2.7@0.25"`): the `view=` value for a plate's whole 8:3 strip at its own pixels, for a window wider than 2.6 (where `mockupViewFor` returns null).
|
|
8
|
+
|
|
3
9
|
## 0.31.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -80,20 +80,22 @@ var PARAMS = {
|
|
|
80
80
|
};
|
|
81
81
|
var BG_TRANSPARENT = "transparent";
|
|
82
82
|
var viewGrid = (from, to, step) => Array.from({ length: Math.round((to - from) / step) + 1 }, (_, i) => Math.round((from + i * step) * 1e3) / 1e3);
|
|
83
|
-
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.
|
|
83
|
+
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.7, 0.1);
|
|
84
|
+
var MOCKUP_VIEW_WHOLE_STRIP = "2.7@0.25";
|
|
84
85
|
var MOCKUP_VIEW_PLACES = [...viewGrid(0.25, 0.475, 0.025), ...viewGrid(0.525, 0.75, 0.025)];
|
|
85
86
|
function canonicalMockupView(raw) {
|
|
86
87
|
const m = /^\s*(\d+(?:\.\d+)?)@(\d+(?:\.\d+)?)\s*$/.exec(String(raw));
|
|
87
88
|
if (!m) return null;
|
|
88
89
|
const r = MOCKUP_VIEW_SHAPES.find((x) => Math.abs(x - Number(m[1])) < 1e-9);
|
|
89
90
|
const f = MOCKUP_VIEW_PLACES.find((x) => Math.abs(x - Number(m[2])) < 1e-9);
|
|
90
|
-
|
|
91
|
+
if (r === void 0 || f === void 0) return null;
|
|
92
|
+
return r === 2.7 ? MOCKUP_VIEW_WHOLE_STRIP : `${r.toFixed(1)}@${String(f)}`;
|
|
91
93
|
}
|
|
92
94
|
function mockupViewFor(windowWidth, windowHeight, productCentreX) {
|
|
93
95
|
if (!(windowWidth > 0 && windowHeight > 0)) return null;
|
|
94
96
|
const rawR = windowWidth / windowHeight;
|
|
95
97
|
const r = MOCKUP_VIEW_SHAPES.find((x) => x >= rawR - 1e-9);
|
|
96
|
-
if (r === void 0) return null;
|
|
98
|
+
if (r === void 0 || r === 2.7) return null;
|
|
97
99
|
const rawF = productCentreX / windowWidth;
|
|
98
100
|
const f = MOCKUP_VIEW_PLACES.reduce((best, x) => Math.abs(x - rawF) < Math.abs(best - rawF) ? x : best, MOCKUP_VIEW_PLACES[0]);
|
|
99
101
|
return `${r.toFixed(1)}@${String(f)}`;
|
|
@@ -409,6 +411,7 @@ export {
|
|
|
409
411
|
SNOWCONE_HOSTS,
|
|
410
412
|
SNOWCONE_REALTIME_WS_URL,
|
|
411
413
|
MOCKUP_VIEW_SHAPES,
|
|
414
|
+
MOCKUP_VIEW_WHOLE_STRIP,
|
|
412
415
|
MOCKUP_VIEW_PLACES,
|
|
413
416
|
canonicalMockupView,
|
|
414
417
|
mockupViewFor,
|
package/dist/index.cjs
CHANGED
|
@@ -51,6 +51,7 @@ __export(src_exports, {
|
|
|
51
51
|
LitAdapter: () => LitAdapter,
|
|
52
52
|
MOCKUP_VIEW_PLACES: () => MOCKUP_VIEW_PLACES,
|
|
53
53
|
MOCKUP_VIEW_SHAPES: () => MOCKUP_VIEW_SHAPES,
|
|
54
|
+
MOCKUP_VIEW_WHOLE_STRIP: () => MOCKUP_VIEW_WHOLE_STRIP,
|
|
54
55
|
PDP_GALLERY_LIMIT: () => PDP_GALLERY_LIMIT,
|
|
55
56
|
ProductContextManager: () => ProductContextManager,
|
|
56
57
|
ProductLoader: () => ProductLoader,
|
|
@@ -349,20 +350,22 @@ var PARAMS = {
|
|
|
349
350
|
};
|
|
350
351
|
var BG_TRANSPARENT = "transparent";
|
|
351
352
|
var viewGrid = (from, to, step) => Array.from({ length: Math.round((to - from) / step) + 1 }, (_, i) => Math.round((from + i * step) * 1e3) / 1e3);
|
|
352
|
-
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.
|
|
353
|
+
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.7, 0.1);
|
|
354
|
+
var MOCKUP_VIEW_WHOLE_STRIP = "2.7@0.25";
|
|
353
355
|
var MOCKUP_VIEW_PLACES = [...viewGrid(0.25, 0.475, 0.025), ...viewGrid(0.525, 0.75, 0.025)];
|
|
354
356
|
function canonicalMockupView(raw) {
|
|
355
357
|
const m = /^\s*(\d+(?:\.\d+)?)@(\d+(?:\.\d+)?)\s*$/.exec(String(raw));
|
|
356
358
|
if (!m) return null;
|
|
357
359
|
const r = MOCKUP_VIEW_SHAPES.find((x) => Math.abs(x - Number(m[1])) < 1e-9);
|
|
358
360
|
const f = MOCKUP_VIEW_PLACES.find((x) => Math.abs(x - Number(m[2])) < 1e-9);
|
|
359
|
-
|
|
361
|
+
if (r === void 0 || f === void 0) return null;
|
|
362
|
+
return r === 2.7 ? MOCKUP_VIEW_WHOLE_STRIP : `${r.toFixed(1)}@${String(f)}`;
|
|
360
363
|
}
|
|
361
364
|
function mockupViewFor(windowWidth, windowHeight, productCentreX) {
|
|
362
365
|
if (!(windowWidth > 0 && windowHeight > 0)) return null;
|
|
363
366
|
const rawR = windowWidth / windowHeight;
|
|
364
367
|
const r = MOCKUP_VIEW_SHAPES.find((x) => x >= rawR - 1e-9);
|
|
365
|
-
if (r === void 0) return null;
|
|
368
|
+
if (r === void 0 || r === 2.7) return null;
|
|
366
369
|
const rawF = productCentreX / windowWidth;
|
|
367
370
|
const f = MOCKUP_VIEW_PLACES.reduce((best, x) => Math.abs(x - rawF) < Math.abs(best - rawF) ? x : best, MOCKUP_VIEW_PLACES[0]);
|
|
368
371
|
return `${r.toFixed(1)}@${String(f)}`;
|
|
@@ -6826,6 +6829,7 @@ function createClient(config) {
|
|
|
6826
6829
|
LitAdapter,
|
|
6827
6830
|
MOCKUP_VIEW_PLACES,
|
|
6828
6831
|
MOCKUP_VIEW_SHAPES,
|
|
6832
|
+
MOCKUP_VIEW_WHOLE_STRIP,
|
|
6829
6833
|
PDP_GALLERY_LIMIT,
|
|
6830
6834
|
ProductContextManager,
|
|
6831
6835
|
ProductLoader,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createDevFetcher } from './dev-fetcher.cjs';
|
|
2
2
|
import { PublicDesign, PublicFill, PublicOptions, MockupView, MockupAspect, MockupPreset } from '@snowcone-app/mockup-url';
|
|
3
|
-
export { MOCKUP_VIEW_PLACES, MOCKUP_VIEW_SHAPES, MockupView, SNOWCONE_HOSTS, SNOWCONE_REALTIME_WS_URL, SnowconeHostRole, canonicalMockupView, mockupViewFor } from '@snowcone-app/mockup-url';
|
|
3
|
+
export { MOCKUP_VIEW_PLACES, MOCKUP_VIEW_SHAPES, MOCKUP_VIEW_WHOLE_STRIP, MockupView, SNOWCONE_HOSTS, SNOWCONE_REALTIME_WS_URL, SnowconeHostRole, canonicalMockupView, mockupViewFor } from '@snowcone-app/mockup-url';
|
|
4
4
|
export { GalleryReason, GalleryStanding, MockupRole, OrdinaryMockups, PDP_GALLERY_LIMIT, SIZE_PICTURE, gallerySizePicture, galleryStanding, mockupRole, ordinaryMockups, pictureForVariant, primaryMockup } from './mockup-role.cjs';
|
|
5
5
|
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 RealtimeRenderError, h as RealtimeMockupService } from './websocket-CSJT_g8j.cjs';
|
|
6
6
|
export { A as AdapterRegistry, i as ProductComponentContext, j as RealtimeMockupCallbacks, k as RealtimeMockupState, l as RenderResult, W as WebSocketConfig, m as WebSocketMessage, n as adapterRegistry, o as computeDisabledChoices, p as createComponent, q as defineComponent, r as deriveDefaultSelection, s as findBestCombination, t as getPricePreview, u as isOptionAvailable, v as resolveBestCombination, w as sessionViews } from './websocket-CSJT_g8j.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createDevFetcher } from './dev-fetcher.js';
|
|
2
2
|
import { PublicDesign, PublicFill, PublicOptions, MockupView, MockupAspect, MockupPreset } from '@snowcone-app/mockup-url';
|
|
3
|
-
export { MOCKUP_VIEW_PLACES, MOCKUP_VIEW_SHAPES, MockupView, SNOWCONE_HOSTS, SNOWCONE_REALTIME_WS_URL, SnowconeHostRole, canonicalMockupView, mockupViewFor } from '@snowcone-app/mockup-url';
|
|
3
|
+
export { MOCKUP_VIEW_PLACES, MOCKUP_VIEW_SHAPES, MOCKUP_VIEW_WHOLE_STRIP, MockupView, SNOWCONE_HOSTS, SNOWCONE_REALTIME_WS_URL, SnowconeHostRole, canonicalMockupView, mockupViewFor } from '@snowcone-app/mockup-url';
|
|
4
4
|
export { GalleryReason, GalleryStanding, MockupRole, OrdinaryMockups, PDP_GALLERY_LIMIT, SIZE_PICTURE, gallerySizePicture, galleryStanding, mockupRole, ordinaryMockups, pictureForVariant, primaryMockup } from './mockup-role.js';
|
|
5
5
|
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 RealtimeRenderError, h as RealtimeMockupService } from './websocket-CSJT_g8j.js';
|
|
6
6
|
export { A as AdapterRegistry, i as ProductComponentContext, j as RealtimeMockupCallbacks, k as RealtimeMockupState, l as RenderResult, W as WebSocketConfig, m as WebSocketMessage, n as adapterRegistry, o as computeDisabledChoices, p as createComponent, q as defineComponent, r as deriveDefaultSelection, s as findBestCombination, t as getPricePreview, u as isOptionAvailable, v as resolveBestCombination, w as sessionViews } from './websocket-CSJT_g8j.js';
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
REALTIME_WS_URL,
|
|
3
3
|
RealtimeMockupService,
|
|
4
4
|
sessionViews
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N5WOD5X2.js";
|
|
6
6
|
import {
|
|
7
7
|
createDevFetcher
|
|
8
8
|
} from "./chunk-7VO4EL2V.js";
|
|
9
9
|
import {
|
|
10
10
|
MOCKUP_VIEW_PLACES,
|
|
11
11
|
MOCKUP_VIEW_SHAPES,
|
|
12
|
+
MOCKUP_VIEW_WHOLE_STRIP,
|
|
12
13
|
SNOWCONE_HOSTS,
|
|
13
14
|
SNOWCONE_REALTIME_WS_URL,
|
|
14
15
|
buildMockupUrl,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
mockupViewFor,
|
|
19
20
|
normalizeDesignElements,
|
|
20
21
|
normalizeWidth
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-KCOLSFYH.js";
|
|
22
23
|
import {
|
|
23
24
|
PDP_GALLERY_LIMIT,
|
|
24
25
|
SIZE_PICTURE,
|
|
@@ -5229,6 +5230,7 @@ export {
|
|
|
5229
5230
|
LitAdapter,
|
|
5230
5231
|
MOCKUP_VIEW_PLACES,
|
|
5231
5232
|
MOCKUP_VIEW_SHAPES,
|
|
5233
|
+
MOCKUP_VIEW_WHOLE_STRIP,
|
|
5232
5234
|
PDP_GALLERY_LIMIT,
|
|
5233
5235
|
ProductContextManager,
|
|
5234
5236
|
ProductLoader,
|
package/dist/react.cjs
CHANGED
|
@@ -113,14 +113,16 @@ var PARAMS = {
|
|
|
113
113
|
seal: "seal"
|
|
114
114
|
};
|
|
115
115
|
var viewGrid = (from, to, step) => Array.from({ length: Math.round((to - from) / step) + 1 }, (_, i) => Math.round((from + i * step) * 1e3) / 1e3);
|
|
116
|
-
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.
|
|
116
|
+
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.7, 0.1);
|
|
117
|
+
var MOCKUP_VIEW_WHOLE_STRIP = "2.7@0.25";
|
|
117
118
|
var MOCKUP_VIEW_PLACES = [...viewGrid(0.25, 0.475, 0.025), ...viewGrid(0.525, 0.75, 0.025)];
|
|
118
119
|
function canonicalMockupView(raw) {
|
|
119
120
|
const m = /^\s*(\d+(?:\.\d+)?)@(\d+(?:\.\d+)?)\s*$/.exec(String(raw));
|
|
120
121
|
if (!m) return null;
|
|
121
122
|
const r = MOCKUP_VIEW_SHAPES.find((x) => Math.abs(x - Number(m[1])) < 1e-9);
|
|
122
123
|
const f = MOCKUP_VIEW_PLACES.find((x) => Math.abs(x - Number(m[2])) < 1e-9);
|
|
123
|
-
|
|
124
|
+
if (r === void 0 || f === void 0) return null;
|
|
125
|
+
return r === 2.7 ? MOCKUP_VIEW_WHOLE_STRIP : `${r.toFixed(1)}@${String(f)}`;
|
|
124
126
|
}
|
|
125
127
|
var MOCKUP_PRESETS = {
|
|
126
128
|
tiktok: { aspect: "9:16", width: 1200 },
|
package/dist/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REALTIME_WS_URL,
|
|
3
3
|
RealtimeMockupService
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-N5WOD5X2.js";
|
|
5
|
+
import "./chunk-KCOLSFYH.js";
|
|
6
6
|
|
|
7
7
|
// src/realtime/react.ts
|
|
8
8
|
import { useCallback, useEffect, useRef, useState } from "react";
|
package/dist/server.cjs
CHANGED
|
@@ -112,7 +112,7 @@ var PARAMS = {
|
|
|
112
112
|
seal: "seal"
|
|
113
113
|
};
|
|
114
114
|
var viewGrid = (from, to, step) => Array.from({ length: Math.round((to - from) / step) + 1 }, (_, i) => Math.round((from + i * step) * 1e3) / 1e3);
|
|
115
|
-
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.
|
|
115
|
+
var MOCKUP_VIEW_SHAPES = viewGrid(1.3, 2.7, 0.1);
|
|
116
116
|
var MOCKUP_VIEW_PLACES = [...viewGrid(0.25, 0.475, 0.025), ...viewGrid(0.525, 0.75, 0.025)];
|
|
117
117
|
var MOCKUP_PRESETS = {
|
|
118
118
|
tiktok: { aspect: "9:16", width: 1200 },
|
package/dist/server.js
CHANGED