@hyperframes/studio 0.8.191 → 0.8.192

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HyperframesLoader
3
- } from "./chunk-FF5DM7BQ.js";
3
+ } from "./chunk-7HZGKFFU.js";
4
4
  import {
5
5
  buildProjectApiPath,
6
6
  splitTimelineElementKey,
@@ -415,7 +415,12 @@ function MenuSeparator({ className, ...props }) {
415
415
 
416
416
  // src/components/ui/Tooltip.tsx
417
417
  import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
418
- import { cloneElement, useId as useId2, useRef as useRef2, useState } from "react";
418
+ import {
419
+ cloneElement,
420
+ useId as useId2,
421
+ useRef as useRef2,
422
+ useState
423
+ } from "react";
419
424
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
420
425
  var SIDE_OFFSET2 = 6;
421
426
  var VIEWPORT_MARGIN2 = 8;
@@ -424,7 +429,8 @@ function Tooltip({
424
429
  children,
425
430
  delay = 400,
426
431
  side = "top",
427
- disabled = false
432
+ disabled = false,
433
+ lines
428
434
  }) {
429
435
  const [open, setOpen] = useState(false);
430
436
  const boxRef = useRef2(null);
@@ -447,10 +453,18 @@ function Tooltip({
447
453
  id: tooltipId,
448
454
  role: "tooltip",
449
455
  className: cn(
450
- "pointer-events-none rounded-md border border-border-input bg-surface px-2 py-1 text-step-10 font-medium text-text-1 whitespace-nowrap shadow-menu",
456
+ "pointer-events-none rounded-md border border-border-input bg-surface px-2 py-1 text-step-10 font-medium text-text-1 shadow-menu",
457
+ lines ? "max-w-[300px] whitespace-normal break-words" : "whitespace-nowrap",
451
458
  floatingMotion("duration-tooltip")
452
459
  ),
453
- children: label
460
+ children: lines ? /* @__PURE__ */ jsx7(
461
+ "span",
462
+ {
463
+ className: "line-clamp-(--tooltip-lines)",
464
+ style: { "--tooltip-lines": lines },
465
+ children: label
466
+ }
467
+ ) : label
454
468
  }
455
469
  )
456
470
  }
package/dist/index.html CHANGED
@@ -14,8 +14,8 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-D_QqfWhx.js"></script>
18
- <link rel="stylesheet" crossorigin href="/assets/index-CBO8uz7-.css">
17
+ <script type="module" crossorigin src="/assets/index-CHu83hHM.js"></script>
18
+ <link rel="stylesheet" crossorigin href="/assets/index-CYbvOVp-.css">
19
19
  </head>
20
20
  <body>
21
21
  <div data-hf-id="hf-aph5" id="root"></div>
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  usePreviewVariablesStore,
49
49
  whenPreviewBooted,
50
50
  writeStudioUiPreferences
51
- } from "./chunk-IWO4UENE.js";
51
+ } from "./chunk-6SXUUBPD.js";
52
52
  import {
53
53
  Button,
54
54
  ContextMenu,
@@ -80,7 +80,7 @@ import {
80
80
  fieldBase,
81
81
  fieldText,
82
82
  popupSurface
83
- } from "./chunk-FF5DM7BQ.js";
83
+ } from "./chunk-7HZGKFFU.js";
84
84
  import {
85
85
  DOM_EDIT_LAYER_OBSERVER_INIT,
86
86
  buildDefaultDomEditTextField,
@@ -88831,6 +88831,12 @@ function useClipboard({
88831
88831
  // src/hooks/useCaptionDetection.ts
88832
88832
  import { useEffect as useEffect129, useRef as useRef161 } from "react";
88833
88833
 
88834
+ // src/captions/parser.ts
88835
+ import {
88836
+ parseExpressionAt,
88837
+ tokenizer
88838
+ } from "acorn";
88839
+
88834
88840
  // src/captions/types.ts
88835
88841
  var DEFAULT_STYLE = {
88836
88842
  fontFamily: "sans-serif",
@@ -88962,14 +88968,18 @@ function readTranscriptGroups(transcript, groupEls) {
88962
88968
  return offset === transcript.length ? wordGroups : null;
88963
88969
  }
88964
88970
  function extractTranscript(source) {
88965
- const varPattern = /(?:const|let|var)\s+(?:TRANSCRIPT|script)\s*=\s*(\[[\s\S]*?\]);/;
88966
- const match = source.match(varPattern);
88971
+ const varPattern = /\b(?:const|let|var)\s+(?:TRANSCRIPT|script)\s*=\s*(?=\[)/;
88972
+ const match = varPattern.exec(source);
88967
88973
  if (!match) {
88968
88974
  return [];
88969
88975
  }
88970
- const arrayLiteral = match[1];
88971
88976
  try {
88972
- return parseTranscriptArray(arrayLiteral);
88977
+ const options = { ecmaVersion: "latest" };
88978
+ const expression = parseExpressionAt(source, match.index + match[0].length, options);
88979
+ if (expression.type !== "ArrayExpression") return [];
88980
+ const nextToken = tokenizer(source.slice(expression.end), options).getToken();
88981
+ if (nextToken.type.label !== ";") return [];
88982
+ return parseTranscriptArray(readStaticValue(expression));
88973
88983
  } catch {
88974
88984
  return [];
88975
88985
  }
@@ -89053,32 +89063,49 @@ function parseCaptionComposition(iframeDoc, iframeWin, source, compositionWidth,
89053
89063
  }
89054
89064
  return model;
89055
89065
  }
89056
- function parseTranscriptArray(arrayLiteral) {
89057
- let parsed;
89058
- try {
89059
- parsed = JSON.parse(arrayLiteral);
89060
- } catch {
89061
- let normalized = arrayLiteral;
89062
- normalized = normalized.replace(/'((?:[^'\\]|\\.)*)'/g, (_match, inner) => {
89063
- const escaped = inner.replace(/\\'/g, "'").replace(/"/g, '\\"');
89064
- return `"${escaped}"`;
89065
- });
89066
- normalized = normalized.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:/g, '$1"$2":');
89067
- normalized = normalized.replace(/,(\s*[}\]])/g, "$1");
89068
- parsed = JSON.parse(normalized);
89066
+ function readStaticValue(node) {
89067
+ switch (node?.type) {
89068
+ case "Literal":
89069
+ if ("regex" in node || "bigint" in node) break;
89070
+ return node.value;
89071
+ case "UnaryExpression":
89072
+ return readSignedNumber(node);
89073
+ case "ArrayExpression":
89074
+ return node.elements.map(readStaticValue);
89075
+ case "ObjectExpression":
89076
+ return Object.fromEntries(node.properties.map(readStaticProperty));
89069
89077
  }
89078
+ throw new SyntaxError("Transcript values must be static literals");
89079
+ }
89080
+ function readSignedNumber(node) {
89081
+ if (node.operator !== "-" && node.operator !== "+" || node.argument.type !== "Literal" || typeof node.argument.value !== "number") {
89082
+ throw new SyntaxError("Transcript unary expressions must be signed numeric literals");
89083
+ }
89084
+ return node.operator === "-" ? -node.argument.value : node.argument.value;
89085
+ }
89086
+ function readStaticProperty(property) {
89087
+ if (property.type !== "Property" || property.kind !== "init" || property.method || property.shorthand || property.computed) {
89088
+ throw new SyntaxError("Transcript properties must be static data");
89089
+ }
89090
+ const key2 = property.key.type === "Identifier" ? property.key.name : readStaticValue(property.key);
89091
+ if (typeof key2 !== "string" && typeof key2 !== "number") {
89092
+ throw new SyntaxError("Transcript property keys must be names or literals");
89093
+ }
89094
+ return [key2, readStaticValue(property.value)];
89095
+ }
89096
+ function parseTranscriptArray(parsed) {
89070
89097
  if (!Array.isArray(parsed)) {
89071
89098
  return [];
89072
89099
  }
89073
89100
  const words = [];
89074
- for (const item of parsed) {
89075
- if (item !== null && typeof item === "object" && typeof item.text === "string" && typeof item.start === "number" && typeof item.end === "number") {
89076
- const entry2 = item;
89101
+ const items = parsed;
89102
+ for (const item of items) {
89103
+ if (item !== null && typeof item === "object" && "text" in item && typeof item.text === "string" && "start" in item && typeof item.start === "number" && "end" in item && typeof item.end === "number") {
89077
89104
  words.push({
89078
- ...typeof entry2.id === "string" ? { id: entry2.id } : {},
89079
- text: entry2.text,
89080
- start: entry2.start,
89081
- end: entry2.end
89105
+ ..."id" in item && typeof item.id === "string" ? { id: item.id } : {},
89106
+ text: item.text,
89107
+ start: item.start,
89108
+ end: item.end
89082
89109
  });
89083
89110
  }
89084
89111
  }
package/dist/player.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Player
3
- } from "./chunk-IWO4UENE.js";
4
- import "./chunk-FF5DM7BQ.js";
3
+ } from "./chunk-6SXUUBPD.js";
4
+ import "./chunk-7HZGKFFU.js";
5
5
  import "./chunk-T43DM7Q6.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {