@vinena/knobs 0.5.2 → 0.5.3

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 (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/early.global.js +5 -5
  3. package/dist/{elementsview-qn8qyksa.js → elementsview-1wsxcdtj.js} +4 -4
  4. package/dist/{elementsview-2z4pkrdz.js → elementsview-3kv34jfx.js} +4 -4
  5. package/dist/engine/browserdraw.d.ts +5 -0
  6. package/dist/engine/browserkit.d.ts +2 -0
  7. package/dist/engine/devices.d.ts +3 -2
  8. package/dist/engine/frames.d.ts +1 -0
  9. package/dist/engine/identity.d.ts +5 -1
  10. package/dist/engine/index.d.ts +2 -0
  11. package/dist/engine/mock.d.ts +0 -2
  12. package/dist/engine/mockdata.d.ts +4 -3
  13. package/dist/engine/mockdraw.d.ts +2 -14
  14. package/dist/engine/morphrun.d.ts +4 -0
  15. package/dist/engine/native.d.ts +31 -3
  16. package/dist/engine/notice.d.ts +1 -2
  17. package/dist/engine/width.d.ts +3 -0
  18. package/dist/{framekit-w0v516w5.js → framekit-cjz0e4y8.js} +213 -61
  19. package/dist/{framekit-te90cjs0.js → framekit-yk1jxjv7.js} +213 -61
  20. package/dist/{index-sxe5079a.js → index-6wbgqkdz.js} +24 -5
  21. package/dist/{index-dan2kpsd.js → index-9jhatmky.js} +4 -4
  22. package/dist/{index-30fc6php.js → index-begsqdm0.js} +1 -1
  23. package/dist/{index-pewcdh28.js → index-j1h13ahg.js} +1 -1
  24. package/dist/{index-xjhwp5cj.js → index-p57fdttx.js} +38 -23
  25. package/dist/{index-9re7sv56.js → index-prjpx67p.js} +5 -5
  26. package/dist/{index-r72tz2vn.js → index-q73py563.js} +1 -1
  27. package/dist/{index-hv02xka3.js → index-sn2y6j09.js} +5 -5
  28. package/dist/{index-agwr37gw.js → index-vgfn2n1h.js} +1 -1
  29. package/dist/{index-trx7bxdk.js → index-zt3rheck.js} +4 -4
  30. package/dist/index.global.js +183 -154
  31. package/dist/index.js +39 -13
  32. package/dist/{react-ayg1bgw3.js → react-3rhdj2k1.js} +24 -5
  33. package/dist/{react-fm9y8dbn.js → react-6tss0r9f.js} +38 -23
  34. package/dist/{react-sw8d8c94.js → react-7vjfsh40.js} +4 -4
  35. package/dist/{react-zy1mmhgz.js → react-806qmkyz.js} +4 -4
  36. package/dist/{react-4pvp6amm.js → react-gefkdkdz.js} +1 -1
  37. package/dist/{react-16spgn0h.js → react-mmq2zya3.js} +1 -1
  38. package/dist/{react-exjcpxma.js → react-qfpg79hs.js} +1 -1
  39. package/dist/{react-05jh9jv5.js → react-qgz9afa2.js} +1 -1
  40. package/dist/react.js +39 -13
  41. package/dist/{storageview-s7heg93p.js → storageview-7cv0vpdm.js} +4 -4
  42. package/dist/{storageview-r595qpt9.js → storageview-dyhpgt8f.js} +4 -4
  43. package/dist/types.d.ts +7 -0
  44. package/dist/ui/settings.d.ts +8 -0
  45. package/package.json +1 -1
@@ -8,7 +8,7 @@ import {
8
8
  subscribe,
9
9
  typesInField,
10
10
  withShift
11
- } from "./index-sxe5079a.js";
11
+ } from "./index-6wbgqkdz.js";
12
12
  import {
13
13
  __require,
14
14
  addStyle,
@@ -17,7 +17,7 @@ import {
17
17
  post,
18
18
  readMessage,
19
19
  systemMedia
20
- } from "./index-xjhwp5cj.js";
20
+ } from "./index-p57fdttx.js";
21
21
 
22
22
  // src/grab/keys.ts
23
23
  var HOLD = 100;
@@ -159,7 +159,7 @@ function systemScheme() {
159
159
  host.remove();
160
160
  return dark ? "dark" : "light";
161
161
  }
162
- function createGrab(options = {}, loadMode = () => import("./index-9re7sv56.js")) {
162
+ function createGrab(options = {}, loadMode = () => import("./index-prjpx67p.js")) {
163
163
  const keyNow = options.key ?? defaultGrabKey;
164
164
  const { purpose } = options;
165
165
  const channel = purpose?.channel ?? "grab";
@@ -368,7 +368,7 @@ function held(view) {
368
368
  return null;
369
369
  }
370
370
  }
371
- function createInspect(options = {}, load = () => import("./index-9re7sv56.js"), frameOf = frameWindow) {
371
+ function createInspect(options = {}, load = () => import("./index-prjpx67p.js"), frameOf = frameWindow) {
372
372
  const inFrame = isDevknobsFrame();
373
373
  const listeners = new Set;
374
374
  let outliner = null;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  icon,
3
3
  radioMove
4
- } from "./index-sxe5079a.js";
4
+ } from "./index-6wbgqkdz.js";
5
5
 
6
6
  // src/ui/dom.ts
7
7
  function el(tag, className, text) {
@@ -2,7 +2,7 @@ import {
2
2
  deviceOf,
3
3
  formOf,
4
4
  needsFrame
5
- } from "./index-xjhwp5cj.js";
5
+ } from "./index-p57fdttx.js";
6
6
 
7
7
  // src/engine/morph.ts
8
8
  var MORPH_TIME = {
@@ -376,7 +376,7 @@ function hold(state, patch) {
376
376
  }
377
377
  return next;
378
378
  }
379
- function settle(state) {
379
+ function settle(state, dropUa = true) {
380
380
  const { width, height } = state;
381
381
  const sized = typeof width === "number" && typeof height === "number";
382
382
  const orientation = sized && width > height ? "landscape" : "portrait";
@@ -387,7 +387,9 @@ function settle(state) {
387
387
  const same = orientation === state.orientation && posture === state.posture;
388
388
  if (same && id === state.device)
389
389
  return state;
390
- return { ...state, orientation, posture, device: id };
390
+ const dropped = dropUa && id !== state.device && device !== undefined && state.ua.preset === device.ua;
391
+ const ua = dropped ? { ...state.ua, preset: "system" } : state.ua;
392
+ return { ...state, orientation, posture, device: id, ua };
391
393
  }
392
394
 
393
395
  // src/engine/clock.ts
@@ -1339,6 +1341,7 @@ var DEFAULT_STATE = {
1339
1341
  docked: false,
1340
1342
  handle: true,
1341
1343
  devIcon: "auto",
1344
+ realPhone: false,
1342
1345
  pinned: [...DEFAULT_PINNED]
1343
1346
  }
1344
1347
  };
@@ -1511,6 +1514,7 @@ function parse(json, place) {
1511
1514
  ...placeOf(panel, home),
1512
1515
  handle: bool(panel.handle, DEFAULT_STATE.panel.handle),
1513
1516
  devIcon: oneOf(panel.devIcon, DEV_ICONS, DEFAULT_STATE.panel.devIcon),
1517
+ realPhone: bool(panel.realPhone, DEFAULT_STATE.panel.realPhone),
1514
1518
  pinned: state.panel === undefined ? [...DEFAULT_PINNED] : rowIds(panel.pinned)
1515
1519
  }
1516
1520
  };
@@ -1529,7 +1533,7 @@ function merge(state, patch) {
1529
1533
  network: { ...state.network, ...held.network },
1530
1534
  ua: { ...state.ua, ...held.ua },
1531
1535
  panel: { ...state.panel, ...held.panel }
1532
- });
1536
+ }, patch.ua === undefined);
1533
1537
  }
1534
1538
  function item(kind, key) {
1535
1539
  try {
@@ -1539,11 +1543,13 @@ function item(kind, key) {
1539
1543
  }
1540
1544
  }
1541
1545
  function load() {
1542
- return parse(item("session", STORAGE_KEY), item("local", PLACE_KEY));
1546
+ const state = parse(item("session", STORAGE_KEY), item("local", PLACE_KEY));
1547
+ return { ...state, panel: { ...state.panel, realPhone: DEFAULT_STATE.panel.realPhone } };
1543
1548
  }
1544
1549
  function save(state) {
1545
1550
  try {
1546
- webStorage("session")?.setItem(STORAGE_KEY, JSON.stringify(stamped(state, STATE_VERSION)));
1551
+ const { realPhone: _, ...panel } = state.panel;
1552
+ webStorage("session")?.setItem(STORAGE_KEY, JSON.stringify(stamped({ ...state, panel }, STATE_VERSION)));
1547
1553
  } catch {}
1548
1554
  }
1549
1555
  function keepPlace(state) {
@@ -3079,7 +3085,7 @@ function iphoneRight(control) {
3079
3085
  }
3080
3086
  var BODIES = {
3081
3087
  "iphone-18-pro": {
3082
- bezel: sides2(15.7, 16, 15.7, 15.7),
3088
+ bezel: sides2(15.7, 15.7, 15.7, 15.7),
3083
3089
  screenRadius: 62,
3084
3090
  bodyRadius: 77.7,
3085
3091
  out: 3,
@@ -3087,7 +3093,7 @@ var BODIES = {
3087
3093
  buttons: [left(186, 41.7), left(258.3, 67.7), left(344, 68), right(281.7, 107, 2.7)]
3088
3094
  },
3089
3095
  "iphone-18-pro-max": {
3090
- bezel: sides2(15.3, 15.3, 15, 15.3),
3096
+ bezel: sides2(15.3, 15.3, 15.3, 15.3),
3091
3097
  screenRadius: 62,
3092
3098
  bodyRadius: 77.3,
3093
3099
  out: 2.7,
@@ -3112,14 +3118,14 @@ var BODIES = {
3112
3118
  },
3113
3119
  "iphone-air": {
3114
3120
  bezel: sides2(15.3, 15.3, 15.3, 15.3),
3115
- screenRadius: 65,
3121
+ screenRadius: 62,
3116
3122
  bodyRadius: 77.3,
3117
3123
  out: 2.7,
3118
3124
  front: [pill("sensor", 147.33, 20, 125.33, 36.67)],
3119
3125
  buttons: [left(185, 41.7), left(257.3, 67.7), left(343, 67.7), right(280.7, 106.7, 3)]
3120
3126
  },
3121
3127
  "iphone-17": {
3122
- bezel: sides2(14.3, 14.7, 14.3, 14.7),
3128
+ bezel: sides2(14.7, 14.7, 14.7, 14.7),
3123
3129
  screenRadius: 62,
3124
3130
  bodyRadius: 76.7,
3125
3131
  out: 3,
@@ -3127,7 +3133,7 @@ var BODIES = {
3127
3133
  buttons: [left(185, 41.7), left(257.3, 67.7), left(342.7, 68), right(280.3, 107, 2.7)]
3128
3134
  },
3129
3135
  "iphone-17-pro": {
3130
- bezel: sides2(15.7, 16, 15.7, 15.7),
3136
+ bezel: sides2(15.7, 15.7, 15.7, 15.7),
3131
3137
  screenRadius: 62,
3132
3138
  bodyRadius: 77.7,
3133
3139
  out: 3,
@@ -3135,7 +3141,7 @@ var BODIES = {
3135
3141
  buttons: [left(186, 41.7), left(258.3, 67.7), left(344, 67.7), right(281.7, 107, 2.7)]
3136
3142
  },
3137
3143
  "iphone-17-pro-max": {
3138
- bezel: sides2(15.3, 15.3, 15, 15.3),
3144
+ bezel: sides2(15.3, 15.3, 15.3, 15.3),
3139
3145
  screenRadius: 62,
3140
3146
  bodyRadius: 77.3,
3141
3147
  out: 2.7,
@@ -3143,8 +3149,8 @@ var BODIES = {
3143
3149
  buttons: [left(186.3, 41.7), left(258.7, 67.7), left(344.3, 67.7), right(282, 106.7)]
3144
3150
  },
3145
3151
  "iphone-16": {
3146
- bezel: sides2(19.7, 19.7, 19.8, 19.7),
3147
- screenRadius: 55,
3152
+ bezel: sides2(19.7, 19.7, 19.7, 19.7),
3153
+ screenRadius: 55.8,
3148
3154
  bodyRadius: 75.5,
3149
3155
  out: 2.7,
3150
3156
  front: [pill("sensor", 134, 11.3, 124.9, 36.7)],
@@ -3152,15 +3158,15 @@ var BODIES = {
3152
3158
  },
3153
3159
  "iphone-16-plus": {
3154
3160
  bezel: sides2(19.7, 19.7, 19.7, 19.7),
3155
- screenRadius: 55,
3161
+ screenRadius: 55.8,
3156
3162
  bodyRadius: 75.5,
3157
3163
  out: 2.7,
3158
3164
  front: [pill("sensor", 152.3, 11.3, 125.4, 36.7)],
3159
3165
  buttons: [...IPHONE_LEFT, ...iphoneRight(608.5)]
3160
3166
  },
3161
3167
  "iphone-16-pro": {
3162
- bezel: sides2(14.7, 14.7, 14.4, 14.7),
3163
- screenRadius: 62,
3168
+ bezel: sides2(14.7, 14.7, 14.7, 14.7),
3169
+ screenRadius: 63.2,
3164
3170
  bodyRadius: 77.9,
3165
3171
  out: 2.7,
3166
3172
  front: [pill("sensor", 138.33, 14, 125.33, 36.67)],
@@ -3168,7 +3174,7 @@ var BODIES = {
3168
3174
  },
3169
3175
  "iphone-16-pro-max": {
3170
3176
  bezel: sides2(14.3, 14.3, 14.3, 14.3),
3171
- screenRadius: 62,
3177
+ screenRadius: 63.6,
3172
3178
  bodyRadius: 77.9,
3173
3179
  out: 2.7,
3174
3180
  front: [pill("sensor", 157.3, 14, 125.4, 36.7)],
@@ -3851,8 +3857,7 @@ function mockOf(id, orientation) {
3851
3857
  return key ? [shown, round("key", at(key))] : [shown];
3852
3858
  })
3853
3859
  ];
3854
- const continuous = islandOf(id) !== null;
3855
- const upright = { width, height, inset: inset2, body, screenRadius, continuous, bodyRadius, parts };
3860
+ const upright = { width, height, inset: inset2, body, screenRadius, bodyRadius, parts };
3856
3861
  if (orientation === "portrait")
3857
3862
  return upright;
3858
3863
  const clockwise = device.clockwise === true;
@@ -3972,11 +3977,18 @@ function drive(driver, state) {
3972
3977
  hand(driver, "media", { scheme, motion, contrast: contrast2, transparency });
3973
3978
  if (driver.viewport)
3974
3979
  hand(driver, "viewport", nativeViewport(state));
3975
- driveUa(driver, state);
3980
+ driveUa(driver, state, driver.viewport !== undefined && nativeViewport(state) !== null);
3976
3981
  }
3977
- function driveUa(driver, state) {
3982
+ function hostUa(state, sized) {
3983
+ const brought = [deviceOf(state.device)?.ua, formOf(state.device, state.posture)?.ua];
3984
+ if (sized || !brought.includes(state.ua.preset))
3985
+ return nativeUa(state.ua);
3986
+ const ua = state.panel.realPhone ? nativeUa(state.ua) : null;
3987
+ return ua && { ...ua, frame: true };
3988
+ }
3989
+ function driveUa(driver, state, sized = false) {
3978
3990
  if (driver.ua)
3979
- hand(driver, "ua", nativeUa(state.ua));
3991
+ hand(driver, "ua", hostUa(state, sized));
3980
3992
  }
3981
3993
  function release(driver, ua = true) {
3982
3994
  if (sent.size === 0)
@@ -4408,7 +4420,10 @@ function lookOf(value) {
4408
4420
  };
4409
4421
  const top2 = color("top");
4410
4422
  const bottom = color("bottom");
4411
- return { background, top: top2, bottom, footer: read2("footer") === true, under: [], dark, scheme, host, canBack, canForward };
4423
+ const header = read2("header");
4424
+ if (typeof header !== "boolean")
4425
+ return null;
4426
+ return { background, top: top2, bottom, header, footer: read2("footer") === true, under: [], dark, scheme, host, canBack, canForward };
4412
4427
  }
4413
4428
  function readSnapshot(knobs, view) {
4414
4429
  try {
@@ -6,16 +6,16 @@ import {
6
6
  grabColor,
7
7
  isCLike,
8
8
  isElement
9
- } from "./index-dan2kpsd.js";
9
+ } from "./index-9jhatmky.js";
10
10
  import {
11
11
  quietFetch
12
- } from "./index-r72tz2vn.js";
12
+ } from "./index-q73py563.js";
13
13
  import {
14
14
  middle,
15
15
  shorthand,
16
16
  sizeText,
17
17
  tidy
18
- } from "./index-agwr37gw.js";
18
+ } from "./index-vgfn2n1h.js";
19
19
  import"./index-78r0f8pw.js";
20
20
  import {
21
21
  HOST_RESET,
@@ -29,7 +29,7 @@ import {
29
29
  isGrabbable,
30
30
  pause,
31
31
  subscribe
32
- } from "./index-sxe5079a.js";
32
+ } from "./index-6wbgqkdz.js";
33
33
  import {
34
34
  RINGS,
35
35
  addStyle,
@@ -49,7 +49,7 @@ import {
49
49
  ringQuads,
50
50
  systemMedia,
51
51
  watchSystemMedia
52
- } from "./index-xjhwp5cj.js";
52
+ } from "./index-p57fdttx.js";
53
53
 
54
54
  // src/grab/preview.ts
55
55
  var ELEMENT_NODE = 1;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  QUIET,
3
3
  shared
4
- } from "./index-xjhwp5cj.js";
4
+ } from "./index-p57fdttx.js";
5
5
 
6
6
  // src/requests/quiet.ts
7
7
  function quietFetch(url, init) {
@@ -7,16 +7,16 @@ import {
7
7
  grabColor,
8
8
  isCLike,
9
9
  isElement
10
- } from "./react-zy1mmhgz.js";
10
+ } from "./react-806qmkyz.js";
11
11
  import {
12
12
  quietFetch
13
- } from "./react-4pvp6amm.js";
13
+ } from "./react-gefkdkdz.js";
14
14
  import {
15
15
  middle,
16
16
  shorthand,
17
17
  sizeText,
18
18
  tidy
19
- } from "./react-05jh9jv5.js";
19
+ } from "./react-qgz9afa2.js";
20
20
  import"./react-adky72h9.js";
21
21
  import {
22
22
  HOST_RESET,
@@ -30,7 +30,7 @@ import {
30
30
  isGrabbable,
31
31
  pause,
32
32
  subscribe
33
- } from "./react-ayg1bgw3.js";
33
+ } from "./react-3rhdj2k1.js";
34
34
  import {
35
35
  RINGS,
36
36
  addStyle,
@@ -50,7 +50,7 @@ import {
50
50
  ringQuads,
51
51
  systemMedia,
52
52
  watchSystemMedia
53
- } from "./react-fm9y8dbn.js";
53
+ } from "./react-6tss0r9f.js";
54
54
 
55
55
  // src/grab/preview.ts
56
56
  var ELEMENT_NODE = 1;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SIDES,
3
3
  pxOf
4
- } from "./index-xjhwp5cj.js";
4
+ } from "./index-p57fdttx.js";
5
5
 
6
6
  // src/styles/varrefs.ts
7
7
  var SPACE = /\s/;
@@ -4,17 +4,17 @@ import {
4
4
  lay,
5
5
  rowBox,
6
6
  rowButton
7
- } from "./index-30fc6php.js";
7
+ } from "./index-begsqdm0.js";
8
8
  import {
9
9
  getState,
10
10
  icon
11
- } from "./index-sxe5079a.js";
11
+ } from "./index-6wbgqkdz.js";
12
12
  import {
13
13
  __require,
14
14
  isDevknobsFrame,
15
15
  newer,
16
16
  webStorage
17
- } from "./index-xjhwp5cj.js";
17
+ } from "./index-p57fdttx.js";
18
18
 
19
19
  // src/storage/onload.ts
20
20
  var PRESETS_KEY = "devknobs:storage-presets";
@@ -321,7 +321,7 @@ function createPane(context) {
321
321
  // src/ui/storageaction.ts
322
322
  var STORAGE_VIEW = "storage";
323
323
  function load() {
324
- return import("./storageview-r595qpt9.js").then((loaded) => loaded.storageView({
324
+ return import("./storageview-dyhpgt8f.js").then((loaded) => loaded.storageView({
325
325
  visible: () => getState().panel.open && !document.hidden
326
326
  }));
327
327
  }