@valbuild/tanstack 0.150.7 → 0.150.8

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,21 @@
1
1
  # @valbuild/tanstack
2
2
 
3
+ ## 0.150.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#960](https://github.com/valbuild/val/pull/960) [`5960071`](https://github.com/valbuild/val/commit/59600711af792f489b050ab47bcdc103d7d8c028) Thanks [@freekh](https://github.com/freekh)! - The design tab can point the assistant at anything on the page. Hold ⌥ (Alt) and click any element in the preview, or press **Select** first: the element under the pointer is outlined and named, and the one picked is shown above the assistant and sent with the next message. A **Pages** menu shows any of the site's pages in the preview, and **Publish** publishes the proposal from the tab, the same way its own Studio does. The checks are now a single quiet status beside the proposal's name, the history is behind a button, and the changed files are listed in the Changes view instead of a panel of their own.
8
+
9
+ The picking runs in the proposal's own page, through the canvas bridge in `@valbuild/next` and `@valbuild/tanstack`, so a site needs those packages at this version for picking to work in its design tab.
10
+
11
+ - Updated dependencies [[`5960071`](https://github.com/valbuild/val/commit/59600711af792f489b050ab47bcdc103d7d8c028), [`2a16ffa`](https://github.com/valbuild/val/commit/2a16ffacd1c77bccaa6ccf5f8754b1f9c574d4f2), [`f7d56ec`](https://github.com/valbuild/val/commit/f7d56ecaed8567c0ea2889bbf1ba64844356cb1a)]:
12
+ - @valbuild/shared@0.150.8
13
+ - @valbuild/ui@0.150.8
14
+ - @valbuild/server@0.150.8
15
+ - @valbuild/language-server@0.150.8
16
+ - @valbuild/mcp@0.150.8
17
+ - @valbuild/react@0.150.8
18
+
3
19
  ## 0.150.7
4
20
 
5
21
  ### Patch Changes
@@ -6,7 +6,7 @@ var asyncToGenerator = require('./asyncToGenerator-c3823d62.cjs.dev.js');
6
6
  var _typeof = require('./typeof-dd0246a1.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
- var version = require('./version-582156af.cjs.dev.js');
9
+ var version = require('./version-102899f9.cjs.dev.js');
10
10
  var internal = require('@valbuild/react/internal');
11
11
  var ui = require('@valbuild/ui');
12
12
  var reactRouter = require('@tanstack/react-router');
@@ -260,6 +260,7 @@ var RESCAN_INTERVAL_MS = 5000;
260
260
  * mounted there at all.
261
261
  */
262
262
  function ValCanvasBridge(_ref) {
263
+ var _elementPicking$modif;
263
264
  var draftMode = _ref.draftMode,
264
265
  isRefreshing = _ref.isRefreshing;
265
266
  var _React$useState = React__default["default"].useState(false),
@@ -287,6 +288,17 @@ function ValCanvasBridge(_ref) {
287
288
  // installed once and would otherwise close over the first value forever.
288
289
  var pickingRef = React__default["default"].useRef(false);
289
290
  pickingRef.current = picking;
291
+ /**
292
+ * Picking ANY element (the design tab's `pickElements`), as the studio last
293
+ * said. `null` until it says, which is every studio but the design tab.
294
+ */
295
+ var _React$useState7 = React__default["default"].useState(null),
296
+ _React$useState8 = _typeof._slicedToArray(_React$useState7, 2),
297
+ elementPicking = _React$useState8[0],
298
+ setElementPicking = _React$useState8[1];
299
+ var elementPickingActive = React__default["default"].useRef(false);
300
+ elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
301
+ var elementPicker = React__default["default"].useRef(null);
290
302
  var post = React__default["default"].useCallback(function (message) {
291
303
  // `*` as the target origin: the studio and the page share an origin today,
292
304
  // but the frame does not know the parent's origin for certain and naming
@@ -503,6 +515,15 @@ function ValCanvasBridge(_ref) {
503
515
  setPicking(message.picking);
504
516
  return;
505
517
  }
518
+ if (message.type === "pickElements") {
519
+ setElementPicking({
520
+ enabled: message.enabled,
521
+ active: message.active,
522
+ modifier: message.modifier,
523
+ keepPicked: message.keepPicked
524
+ });
525
+ return;
526
+ }
506
527
  if (message.type === "theme") {
507
528
  setSelectionColors({
508
529
  selection: message.selection,
@@ -587,6 +608,54 @@ function ValCanvasBridge(_ref) {
587
608
  };
588
609
  }, [post]);
589
610
 
611
+ /**
612
+ * Picking any element, for the design tab: the page's own elements, which
613
+ * only this side of the frame can reach. The listeners and the outlines are
614
+ * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
615
+ * same picker; what crosses back is the element described.
616
+ */
617
+ var selectionColorRef = React__default["default"].useRef(selectionColors.selection);
618
+ selectionColorRef.current = selectionColors.selection;
619
+ var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
620
+ var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
621
+ React__default["default"].useEffect(function () {
622
+ if (!pickingEnabled) return;
623
+ var picker = client.startElementPicking(document.body, {
624
+ modifier: pickModifier,
625
+ active: function active() {
626
+ return elementPickingActive.current;
627
+ },
628
+ color: selectionColorRef.current,
629
+ onPick: function onPick(element) {
630
+ return post({
631
+ val: client.VAL_CANVAS_MESSAGE,
632
+ type: "elementPicked",
633
+ element: element
634
+ });
635
+ },
636
+ onStop: function onStop() {
637
+ return post({
638
+ val: client.VAL_CANVAS_MESSAGE,
639
+ type: "elementPickingStopped"
640
+ });
641
+ }
642
+ });
643
+ elementPicker.current = picker;
644
+ return function () {
645
+ elementPicker.current = null;
646
+ picker.stop();
647
+ };
648
+ }, [pickingEnabled, pickModifier, post]);
649
+ var keepPicked = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.keepPicked) !== false;
650
+ React__default["default"].useEffect(function () {
651
+ var _elementPicker$curren;
652
+ if (!keepPicked) (_elementPicker$curren = elementPicker.current) === null || _elementPicker$curren === void 0 || _elementPicker$curren.clearPicked();
653
+ }, [keepPicked]);
654
+ React__default["default"].useEffect(function () {
655
+ var _elementPicker$curren2;
656
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
657
+ }, [selectionColors.selection]);
658
+
590
659
  /**
591
660
  * Two-finger gestures, handed to the studio.
592
661
  *
@@ -6,7 +6,7 @@ var asyncToGenerator = require('./asyncToGenerator-8e5c36c8.cjs.prod.js');
6
6
  var _typeof = require('./typeof-8998e126.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
- var version = require('./version-a27c7e1b.cjs.prod.js');
9
+ var version = require('./version-395512da.cjs.prod.js');
10
10
  var internal = require('@valbuild/react/internal');
11
11
  var ui = require('@valbuild/ui');
12
12
  var reactRouter = require('@tanstack/react-router');
@@ -260,6 +260,7 @@ var RESCAN_INTERVAL_MS = 5000;
260
260
  * mounted there at all.
261
261
  */
262
262
  function ValCanvasBridge(_ref) {
263
+ var _elementPicking$modif;
263
264
  var draftMode = _ref.draftMode,
264
265
  isRefreshing = _ref.isRefreshing;
265
266
  var _React$useState = React__default["default"].useState(false),
@@ -287,6 +288,17 @@ function ValCanvasBridge(_ref) {
287
288
  // installed once and would otherwise close over the first value forever.
288
289
  var pickingRef = React__default["default"].useRef(false);
289
290
  pickingRef.current = picking;
291
+ /**
292
+ * Picking ANY element (the design tab's `pickElements`), as the studio last
293
+ * said. `null` until it says, which is every studio but the design tab.
294
+ */
295
+ var _React$useState7 = React__default["default"].useState(null),
296
+ _React$useState8 = _typeof._slicedToArray(_React$useState7, 2),
297
+ elementPicking = _React$useState8[0],
298
+ setElementPicking = _React$useState8[1];
299
+ var elementPickingActive = React__default["default"].useRef(false);
300
+ elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
301
+ var elementPicker = React__default["default"].useRef(null);
290
302
  var post = React__default["default"].useCallback(function (message) {
291
303
  // `*` as the target origin: the studio and the page share an origin today,
292
304
  // but the frame does not know the parent's origin for certain and naming
@@ -503,6 +515,15 @@ function ValCanvasBridge(_ref) {
503
515
  setPicking(message.picking);
504
516
  return;
505
517
  }
518
+ if (message.type === "pickElements") {
519
+ setElementPicking({
520
+ enabled: message.enabled,
521
+ active: message.active,
522
+ modifier: message.modifier,
523
+ keepPicked: message.keepPicked
524
+ });
525
+ return;
526
+ }
506
527
  if (message.type === "theme") {
507
528
  setSelectionColors({
508
529
  selection: message.selection,
@@ -587,6 +608,54 @@ function ValCanvasBridge(_ref) {
587
608
  };
588
609
  }, [post]);
589
610
 
611
+ /**
612
+ * Picking any element, for the design tab: the page's own elements, which
613
+ * only this side of the frame can reach. The listeners and the outlines are
614
+ * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
615
+ * same picker; what crosses back is the element described.
616
+ */
617
+ var selectionColorRef = React__default["default"].useRef(selectionColors.selection);
618
+ selectionColorRef.current = selectionColors.selection;
619
+ var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
620
+ var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
621
+ React__default["default"].useEffect(function () {
622
+ if (!pickingEnabled) return;
623
+ var picker = client.startElementPicking(document.body, {
624
+ modifier: pickModifier,
625
+ active: function active() {
626
+ return elementPickingActive.current;
627
+ },
628
+ color: selectionColorRef.current,
629
+ onPick: function onPick(element) {
630
+ return post({
631
+ val: client.VAL_CANVAS_MESSAGE,
632
+ type: "elementPicked",
633
+ element: element
634
+ });
635
+ },
636
+ onStop: function onStop() {
637
+ return post({
638
+ val: client.VAL_CANVAS_MESSAGE,
639
+ type: "elementPickingStopped"
640
+ });
641
+ }
642
+ });
643
+ elementPicker.current = picker;
644
+ return function () {
645
+ elementPicker.current = null;
646
+ picker.stop();
647
+ };
648
+ }, [pickingEnabled, pickModifier, post]);
649
+ var keepPicked = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.keepPicked) !== false;
650
+ React__default["default"].useEffect(function () {
651
+ var _elementPicker$curren;
652
+ if (!keepPicked) (_elementPicker$curren = elementPicker.current) === null || _elementPicker$curren === void 0 || _elementPicker$curren.clearPicked();
653
+ }, [keepPicked]);
654
+ React__default["default"].useEffect(function () {
655
+ var _elementPicker$curren2;
656
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
657
+ }, [selectionColors.selection]);
658
+
590
659
  /**
591
660
  * Two-finger gestures, handed to the studio.
592
661
  *
@@ -5,13 +5,13 @@ import * as core from '@valbuild/core';
5
5
  export { core as expr };
6
6
  export { GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
7
7
  import { stegaEncode, stegaDecodeStrings, attrs, raw, isReactDevelopmentBuild, watchStegaLeaks, stegaLeakMessage, SET_AUTO_TAG_JSX_ENABLED, autoTagJSX } from '@valbuild/react/stega';
8
- import { r as readValEnableCookie, _ as _toConsumableArray, V as VERSION$1 } from './version-46e811d7.esm.js';
8
+ import { r as readValEnableCookie, _ as _toConsumableArray, V as VERSION$1 } from './version-6c0452a2.esm.js';
9
9
  export { ValRichText } from '@valbuild/react/internal';
10
10
  import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID, VAL_APP_ID } from '@valbuild/ui';
11
11
  import { useRouter, useRouterState } from '@tanstack/react-router';
12
12
  import React, { useEffect, useRef, useState } from 'react';
13
13
  import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-6411bbe3.esm.js';
14
- import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, isValCanvasFrame } from '@valbuild/shared/client';
14
+ import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, isValCanvasFrame } from '@valbuild/shared/client';
15
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
16
  import { D as DEMO_CLAIM_MESSAGE, a as DEMO_SERVICE_WORKER_PATH, b as DEMO_RELAY_MESSAGE } from './demoServiceWorker-56fd96cf.esm.js';
17
17
  import '@valbuild/core/patch';
@@ -236,6 +236,7 @@ var RESCAN_INTERVAL_MS = 5000;
236
236
  * mounted there at all.
237
237
  */
238
238
  function ValCanvasBridge(_ref) {
239
+ var _elementPicking$modif;
239
240
  var draftMode = _ref.draftMode,
240
241
  isRefreshing = _ref.isRefreshing;
241
242
  var _React$useState = React.useState(false),
@@ -263,6 +264,17 @@ function ValCanvasBridge(_ref) {
263
264
  // installed once and would otherwise close over the first value forever.
264
265
  var pickingRef = React.useRef(false);
265
266
  pickingRef.current = picking;
267
+ /**
268
+ * Picking ANY element (the design tab's `pickElements`), as the studio last
269
+ * said. `null` until it says, which is every studio but the design tab.
270
+ */
271
+ var _React$useState7 = React.useState(null),
272
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
273
+ elementPicking = _React$useState8[0],
274
+ setElementPicking = _React$useState8[1];
275
+ var elementPickingActive = React.useRef(false);
276
+ elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
277
+ var elementPicker = React.useRef(null);
266
278
  var post = React.useCallback(function (message) {
267
279
  // `*` as the target origin: the studio and the page share an origin today,
268
280
  // but the frame does not know the parent's origin for certain and naming
@@ -479,6 +491,15 @@ function ValCanvasBridge(_ref) {
479
491
  setPicking(message.picking);
480
492
  return;
481
493
  }
494
+ if (message.type === "pickElements") {
495
+ setElementPicking({
496
+ enabled: message.enabled,
497
+ active: message.active,
498
+ modifier: message.modifier,
499
+ keepPicked: message.keepPicked
500
+ });
501
+ return;
502
+ }
482
503
  if (message.type === "theme") {
483
504
  setSelectionColors({
484
505
  selection: message.selection,
@@ -563,6 +584,54 @@ function ValCanvasBridge(_ref) {
563
584
  };
564
585
  }, [post]);
565
586
 
587
+ /**
588
+ * Picking any element, for the design tab: the page's own elements, which
589
+ * only this side of the frame can reach. The listeners and the outlines are
590
+ * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
591
+ * same picker; what crosses back is the element described.
592
+ */
593
+ var selectionColorRef = React.useRef(selectionColors.selection);
594
+ selectionColorRef.current = selectionColors.selection;
595
+ var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
596
+ var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
597
+ React.useEffect(function () {
598
+ if (!pickingEnabled) return;
599
+ var picker = startElementPicking(document.body, {
600
+ modifier: pickModifier,
601
+ active: function active() {
602
+ return elementPickingActive.current;
603
+ },
604
+ color: selectionColorRef.current,
605
+ onPick: function onPick(element) {
606
+ return post({
607
+ val: VAL_CANVAS_MESSAGE,
608
+ type: "elementPicked",
609
+ element: element
610
+ });
611
+ },
612
+ onStop: function onStop() {
613
+ return post({
614
+ val: VAL_CANVAS_MESSAGE,
615
+ type: "elementPickingStopped"
616
+ });
617
+ }
618
+ });
619
+ elementPicker.current = picker;
620
+ return function () {
621
+ elementPicker.current = null;
622
+ picker.stop();
623
+ };
624
+ }, [pickingEnabled, pickModifier, post]);
625
+ var keepPicked = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.keepPicked) !== false;
626
+ React.useEffect(function () {
627
+ var _elementPicker$curren;
628
+ if (!keepPicked) (_elementPicker$curren = elementPicker.current) === null || _elementPicker$curren === void 0 || _elementPicker$curren.clearPicked();
629
+ }, [keepPicked]);
630
+ React.useEffect(function () {
631
+ var _elementPicker$curren2;
632
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
633
+ }, [selectionColors.selection]);
634
+
566
635
  /**
567
636
  * Two-finger gestures, handed to the studio.
568
637
  *
@@ -95,7 +95,7 @@ var packageJson = {
95
95
  "tanstack-router",
96
96
  "react"
97
97
  ],
98
- version: "0.150.7",
98
+ version: "0.150.8",
99
99
  scripts: {
100
100
  typecheck: "tsc --noEmit",
101
101
  test: "jest"
@@ -95,7 +95,7 @@ var packageJson = {
95
95
  "tanstack-router",
96
96
  "react"
97
97
  ],
98
- version: "0.150.7",
98
+ version: "0.150.8",
99
99
  scripts: {
100
100
  typecheck: "tsc --noEmit",
101
101
  test: "jest"
@@ -93,7 +93,7 @@ var packageJson = {
93
93
  "tanstack-router",
94
94
  "react"
95
95
  ],
96
- version: "0.150.7",
96
+ version: "0.150.8",
97
97
  scripts: {
98
98
  typecheck: "tsc --noEmit",
99
99
  test: "jest"
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "tanstack-router",
15
15
  "react"
16
16
  ],
17
- "version": "0.150.7",
17
+ "version": "0.150.8",
18
18
  "main": "dist/valbuild-tanstack.cjs.js",
19
19
  "module": "dist/valbuild-tanstack.esm.js",
20
20
  "exports": {
@@ -52,13 +52,13 @@
52
52
  "exports": true
53
53
  },
54
54
  "dependencies": {
55
+ "@valbuild/language-server": "0.150.8",
56
+ "@valbuild/mcp": "0.150.8",
57
+ "@valbuild/react": "0.150.8",
58
+ "@valbuild/server": "0.150.8",
55
59
  "@valbuild/core": "0.150.3",
56
- "@valbuild/language-server": "0.150.5",
57
- "@valbuild/mcp": "0.150.5",
58
- "@valbuild/react": "0.150.7",
59
- "@valbuild/server": "0.150.5",
60
- "@valbuild/shared": "0.150.3",
61
- "@valbuild/ui": "0.150.5"
60
+ "@valbuild/shared": "0.150.8",
61
+ "@valbuild/ui": "0.150.8"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@tanstack/react-router": "^1.170.41",
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-582156af.cjs.dev.js');
5
+ var version = require('../../dist/version-102899f9.cjs.dev.js');
6
6
  var asyncToGenerator = require('../../dist/asyncToGenerator-c3823d62.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var _typeof = require('../../dist/typeof-dd0246a1.cjs.dev.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-a27c7e1b.cjs.prod.js');
5
+ var version = require('../../dist/version-395512da.cjs.prod.js');
6
6
  var asyncToGenerator = require('../../dist/asyncToGenerator-8e5c36c8.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var _typeof = require('../../dist/typeof-8998e126.cjs.prod.js');
@@ -1,4 +1,4 @@
1
- import { V as VERSION, _ as _toConsumableArray, s as setValEnableCookieReader } from '../../dist/version-46e811d7.esm.js';
1
+ import { V as VERSION, _ as _toConsumableArray, s as setValEnableCookieReader } from '../../dist/version-6c0452a2.esm.js';
2
2
  import { _ as _asyncToGenerator, a as _regenerator } from '../../dist/asyncToGenerator-500f022f.esm.js';
3
3
  import { Internal } from '@valbuild/core';
4
4
  import { _ as _objectSpread2, a as _slicedToArray, b as _createForOfIteratorHelper, g as _defineProperty, c as _typeof } from '../../dist/typeof-66e2d869.esm.js';