@typespec/playground 0.6.0-dev.3 → 0.6.0

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 (2) hide show
  1. package/dist/react/index.js +31 -5
  2. package/package.json +13 -14
@@ -1583,15 +1583,20 @@ const Sash = ({
1583
1583
  ...others
1584
1584
  }) => {
1585
1585
  const [draging, setDrag] = useState(false);
1586
- const handleMouseMove = (e) => {
1587
- onDragging(e);
1588
- };
1586
+ const handleMouseMove = (e) => onDragging(createDraggingEventFromMouseEvent(e));
1589
1587
  const handleMouseUp = (e) => {
1590
1588
  setDrag(false);
1591
- onDragEnd(e);
1589
+ onDragEnd(createDraggingEventFromMouseEvent(e));
1592
1590
  window.removeEventListener("mousemove", handleMouseMove);
1593
1591
  window.removeEventListener("mouseup", handleMouseUp);
1594
1592
  };
1593
+ const handleTouchMove = (e) => onDragging(createDraggingEventFromTouchEvent(e));
1594
+ const handleTouchUp = (e) => {
1595
+ setDrag(false);
1596
+ onDragEnd(createDraggingEventFromTouchEvent(e));
1597
+ window.removeEventListener("touchmove", handleTouchMove);
1598
+ window.removeEventListener("touchend", handleTouchUp);
1599
+ };
1595
1600
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1596
1601
  "div",
1597
1602
  {
@@ -1599,16 +1604,37 @@ const Sash = ({
1599
1604
  className: mergeClasses(style$1$1["sash"], className),
1600
1605
  onMouseDown: (e) => {
1601
1606
  setDrag(true);
1602
- onDragStart(e);
1607
+ onDragStart(createDraggingEventFromMouseEvent(e));
1603
1608
  window.addEventListener("mousemove", handleMouseMove);
1604
1609
  window.addEventListener("mouseup", handleMouseUp);
1605
1610
  },
1611
+ onTouchStart: (e) => {
1612
+ setDrag(true);
1613
+ onDragStart(createDraggingEventFromTouchEvent(e));
1614
+ window.addEventListener("touchmove", handleTouchMove);
1615
+ window.addEventListener("touchend", handleTouchUp);
1616
+ },
1606
1617
  onDoubleClick: onReset,
1607
1618
  ...others,
1608
1619
  children: render(draging)
1609
1620
  }
1610
1621
  );
1611
1622
  };
1623
+ function createDraggingEventFromMouseEvent(originalEvent) {
1624
+ return {
1625
+ originalEvent,
1626
+ pageX: originalEvent.pageX,
1627
+ pageY: originalEvent.pageY
1628
+ };
1629
+ }
1630
+ function createDraggingEventFromTouchEvent(originalEvent) {
1631
+ const lastTouch = originalEvent.touches[originalEvent.touches.length - 1];
1632
+ return {
1633
+ originalEvent,
1634
+ pageX: lastTouch.clientX,
1635
+ pageY: lastTouch.clientY
1636
+ };
1637
+ }
1612
1638
 
1613
1639
  const defaultDimensions = { width: 0, height: 0 };
1614
1640
  function useElDimensions(ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/playground",
3
- "version": "0.6.0-dev.3",
3
+ "version": "0.6.0",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec playground UI components.",
6
6
  "homepage": "https://typespec.io",
@@ -61,15 +61,6 @@
61
61
  "dependencies": {
62
62
  "@fluentui/react-components": "~9.55.0",
63
63
  "@fluentui/react-icons": "^2.0.260",
64
- "@typespec/bundler": "~0.1.8 || >=0.2.0-dev <0.2.0",
65
- "@typespec/compiler": "~0.61.2 || >=0.62.0-dev <0.62.0",
66
- "@typespec/html-program-viewer": "~0.61.0 || >=0.62.0-dev <0.62.0",
67
- "@typespec/http": "~0.61.0 || >=0.62.0-dev <0.62.0",
68
- "@typespec/openapi": "~0.61.0 || >=0.62.0-dev <0.62.0",
69
- "@typespec/openapi3": "~0.61.0 || >=0.62.0-dev <0.62.0",
70
- "@typespec/protobuf": "~0.61.0 || >=0.62.0-dev <0.62.0",
71
- "@typespec/rest": "~0.61.0 || >=0.62.0-dev <0.62.0",
72
- "@typespec/versioning": "~0.61.0 || >=0.62.0-dev <0.62.0",
73
64
  "clsx": "^2.1.1",
74
65
  "debounce": "~2.1.1",
75
66
  "lzutf8": "0.6.3",
@@ -79,7 +70,16 @@
79
70
  "react-error-boundary": "^4.0.13",
80
71
  "swagger-ui-dist": "^5.17.14",
81
72
  "vscode-languageserver": "~9.0.1",
82
- "vscode-languageserver-textdocument": "~1.0.12"
73
+ "vscode-languageserver-textdocument": "~1.0.12",
74
+ "@typespec/bundler": "~0.1.9",
75
+ "@typespec/compiler": "~0.62.0",
76
+ "@typespec/http": "~0.62.0",
77
+ "@typespec/html-program-viewer": "~0.62.0",
78
+ "@typespec/openapi": "~0.62.0",
79
+ "@typespec/openapi3": "~0.62.0",
80
+ "@typespec/protobuf": "~0.62.0",
81
+ "@typespec/rest": "~0.62.0",
82
+ "@typespec/versioning": "~0.62.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@babel/core": "^7.25.2",
@@ -95,7 +95,6 @@
95
95
  "@types/react": "~18.3.11",
96
96
  "@types/react-dom": "~18.3.0",
97
97
  "@types/swagger-ui-dist": "~3.30.5",
98
- "@typespec/bundler": "~0.1.8 || >=0.2.0-dev <0.2.0",
99
98
  "@vitejs/plugin-react": "~4.3.2",
100
99
  "c8": "^10.1.2",
101
100
  "cross-env": "~7.0.3",
@@ -105,9 +104,9 @@
105
104
  "vite": "^5.4.8",
106
105
  "vite-plugin-checker": "^0.8.0",
107
106
  "vite-plugin-dts": "4.2.3",
108
- "@typespec/react-components": "~0.57.0"
107
+ "@typespec/react-components": "~0.57.0",
108
+ "@typespec/bundler": "~0.1.9"
109
109
  },
110
- "peerDependencies": {},
111
110
  "scripts": {
112
111
  "clean": "rimraf ./dist ./dist-dev ./temp ./typespecContents.json",
113
112
  "build": "vite build",