@allyhub/sdk 0.9.0 → 0.11.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 (148) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  3. package/dist/node_modules/@allyhub/chart/dist/chart-xml.d.ts +3 -0
  4. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
  5. package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +22 -0
  6. package/dist/node_modules/@allyhub/chart/dist/chart.js +1 -1
  7. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  8. package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +7 -0
  9. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  10. package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
  11. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +87 -1
  12. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  13. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +89 -0
  14. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  15. package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +20 -0
  16. package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
  17. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +50 -0
  18. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  19. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  20. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  21. package/dist/node_modules/@allyhub/image-sdk/dist/index.d.ts +1 -1
  22. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  23. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  24. package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
  25. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  26. package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +2 -0
  27. package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +16 -0
  28. package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -1
  29. package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
  30. package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +14 -1
  31. package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
  32. package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +18 -0
  33. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  34. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +140 -0
  35. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  36. package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
  37. package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
  38. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +157 -0
  39. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  40. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +10 -2
  41. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  42. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +101 -186
  43. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  44. package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +1 -0
  45. package/dist/node_modules/@allyhub/protocol/dist/mail.js +1 -1
  46. package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +92 -94
  47. package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
  48. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +17 -0
  49. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  50. package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +7 -0
  51. package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
  52. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +15 -3
  53. package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
  54. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  55. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  56. package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
  57. package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
  58. package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
  59. package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
  60. package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
  61. package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
  62. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  63. package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
  64. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.d.ts +70 -0
  65. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
  66. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.d.ts +6 -0
  67. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
  68. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.d.ts +3 -1
  70. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.js +1 -1
  71. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
  72. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/kernels.js +1 -1
  73. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
  74. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/maths.js +1 -1
  75. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
  76. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.d.ts +9 -0
  77. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
  78. package/dist/node_modules/@allyhub/sheet/dist/calc/types.d.ts +6 -0
  79. package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
  80. package/dist/node_modules/@allyhub/sheet/dist/chart.d.ts +9 -0
  81. package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/export.d.ts +0 -8
  83. package/dist/node_modules/@allyhub/sheet/dist/export.js +2 -4
  84. package/dist/node_modules/@allyhub/sheet/dist/formula/ast.d.ts +12 -1
  85. package/dist/node_modules/@allyhub/sheet/dist/formula/move.d.ts +5 -1
  86. package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
  87. package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
  88. package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
  89. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +3 -2
  90. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  91. package/dist/node_modules/@allyhub/sheet/dist/inspect.d.ts +12 -2
  92. package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
  93. package/dist/node_modules/@allyhub/sheet/dist/printed.d.ts +19 -0
  94. package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
  95. package/dist/node_modules/@allyhub/sheet/dist/values.d.ts +2 -0
  96. package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +2 -0
  98. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  99. package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.d.ts +6 -2
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.d.ts +0 -1
  104. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  105. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +3 -1
  106. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  107. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.d.ts +7 -1
  108. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.js +3 -1
  109. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  110. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  111. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.d.ts +1 -1
  112. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  113. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.d.ts +12 -1
  114. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.js +3 -2
  115. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  116. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +57 -7
  117. package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
  118. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  119. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +24 -0
  120. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  121. package/dist/node_modules/@allyhub/slides-core/dist/fact.d.ts +15 -0
  122. package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
  123. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +6 -2
  124. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +3 -1
  125. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  126. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  127. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  128. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  129. package/dist/node_modules/@allyhub/video-core/dist/piece.d.ts +2 -2
  130. package/dist/node_modules/@allyhub/video-core/dist/schema.d.ts +2 -2
  131. package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
  132. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  133. package/dist/node_modules/@allyhub/video-sdk/dist/phone.d.ts +12 -5
  134. package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +1 -1
  135. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  136. package/docs/README.md +4 -0
  137. package/docs/canvas.md +28 -0
  138. package/docs/defaults.md +30 -4
  139. package/docs/docs.md +10 -10
  140. package/docs/image.md +3 -3
  141. package/docs/linkedin.md +96 -0
  142. package/docs/reports.md +89 -0
  143. package/docs/scenery.md +3 -4
  144. package/docs/sheets.md +23 -6
  145. package/docs/slides.md +50 -4
  146. package/docs/speech.md +1 -1
  147. package/docs/x.md +73 -0
  148. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{z as o}from"zod";import{SCRIPT_NAME as g}from"./script.js";const s=o.string().regex(g,"A name is letters, digits, _ and -.");export const THEME_COLORS=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],TEXT_ALIGNS=["l","ctr","r","just"],SHAPE_GEOMETRIES=["line","lineInv","triangle","rtTriangle","rect","diamond","parallelogram","trapezoid","nonIsoscelesTrapezoid","pentagon","hexagon","heptagon","octagon","decagon","dodecagon","star4","star5","star6","star7","star8","star10","star12","star16","star24","star32","roundRect","round1Rect","round2SameRect","round2DiagRect","snipRoundRect","snip1Rect","snip2SameRect","snip2DiagRect","plaque","ellipse","teardrop","homePlate","chevron","pieWedge","pie","blockArc","donut","noSmoking","rightArrow","leftArrow","upArrow","downArrow","stripedRightArrow","notchedRightArrow","bentUpArrow","leftRightArrow","upDownArrow","leftUpArrow","leftRightUpArrow","quadArrow","leftArrowCallout","rightArrowCallout","upArrowCallout","downArrowCallout","leftRightArrowCallout","upDownArrowCallout","quadArrowCallout","bentArrow","uturnArrow","circularArrow","leftCircularArrow","leftRightCircularArrow","curvedRightArrow","curvedLeftArrow","curvedUpArrow","curvedDownArrow","swooshArrow","cube","can","lightningBolt","heart","sun","moon","smileyFace","irregularSeal1","irregularSeal2","foldedCorner","bevel","frame","halfFrame","corner","diagStripe","chord","arc","leftBracket","rightBracket","leftBrace","rightBrace","bracketPair","bracePair","straightConnector1","bentConnector2","bentConnector3","bentConnector4","bentConnector5","curvedConnector2","curvedConnector3","curvedConnector4","curvedConnector5","callout1","callout2","callout3","accentCallout1","accentCallout2","accentCallout3","borderCallout1","borderCallout2","borderCallout3","accentBorderCallout1","accentBorderCallout2","accentBorderCallout3","wedgeRectCallout","wedgeRoundRectCallout","wedgeEllipseCallout","cloudCallout","cloud","ribbon","ribbon2","ellipseRibbon","ellipseRibbon2","leftRightRibbon","verticalScroll","horizontalScroll","wave","doubleWave","plus","flowChartProcess","flowChartDecision","flowChartInputOutput","flowChartPredefinedProcess","flowChartInternalStorage","flowChartDocument","flowChartMultidocument","flowChartTerminator","flowChartPreparation","flowChartManualInput","flowChartManualOperation","flowChartConnector","flowChartPunchedCard","flowChartPunchedTape","flowChartSummingJunction","flowChartOr","flowChartCollate","flowChartSort","flowChartExtract","flowChartMerge","flowChartOfflineStorage","flowChartOnlineStorage","flowChartMagneticTape","flowChartMagneticDisk","flowChartMagneticDrum","flowChartDisplay","flowChartDelay","flowChartAlternateProcess","flowChartOffpageConnector","actionButtonBlank","actionButtonHome","actionButtonHelp","actionButtonInformation","actionButtonForwardNext","actionButtonBackPrevious","actionButtonEnd","actionButtonBeginning","actionButtonReturn","actionButtonDocument","actionButtonSound","actionButtonMovie","gear6","gear9","funnel","mathPlus","mathMinus","mathMultiply","mathDivide","mathEqual","mathNotEqual","cornerTabs","squareTabs","plaqueTabs","chartX","chartStar","chartPlus"],ANIMATION_EFFECTS=["appear","fade","wipe","fly-in","zoom","disappear","fade-out","wipe-out","fly-out","zoom-out","pulse","path"],ANIMATION_STARTS=["on-click","with-previous","after-previous"],ANIMATION_DIRECTIONS=["from-bottom","from-top","from-left","from-right"],LINE_DASHES=["solid","sysDash","sysDot","dash","dashDot","lgDash","lgDashDot","lgDashDotDot"],LINE_ENDS=["none","triangle","arrow","stealth","diamond","oval"],FrameSchema=o.strictObject({x:o.number(),y:o.number(),w:o.number().nonnegative(),h:o.number().nonnegative()});const b=new RegExp(`^(${THEME_COLORS.join("|")}) (lighter|darker) (100(?:\\.0{1,3})?|[1-9]?\\d(?:\\.\\d{1,3})?)%$`,"u"),f=/^#[0-9A-Fa-f]{6}$/u,w=t=>THEME_COLORS.includes(t);export function colorOfFile(t){if(w(t))return t;if(f.test(t))return{rgb:t.toUpperCase()};const n=b.exec(t),[,i="",e,a=""]=n??[],l=Math.round(Number(a)*1e3);if(!(!n||!w(i)||l<=0||l>1e5))return{theme_color:i,brightness:(e==="lighter"?l:-l)/1e5}}export function colorFile(t){if(typeof t=="string")return t;if("rgb"in t)return t.rgb;const n=Math.round(Math.abs(t.brightness)*1e5)/1e3;return n===0?t.theme_color:`${t.theme_color} ${t.brightness>0?"lighter":"darker"} ${String(n)}%`}const m=`A colour is one of the theme's (${THEME_COLORS.join(", ")}), one of them lighter or darker by a share over 0 up to 100% ("accent1 lighter 40%", "dk1 darker 25%"), or #RRGGBB.`;export const ColorFileSchema=o.union([o.enum(THEME_COLORS),o.string().regex(b,m),o.string().regex(f,m)]).refine(t=>colorOfFile(t)!==void 0,m),NUMBERINGS=["arabicPeriod","arabicParenR","alphaLcPeriod","alphaUcPeriod","romanLcPeriod","romanUcPeriod"],TEXT_ANCHORS=["t","ctr","b"],TextStyleSchema=o.strictObject({size:o.number().positive().max(4e3).optional(),bold:o.boolean().optional(),italic:o.boolean().optional(),underline:o.boolean().optional(),strike:o.boolean().optional(),color:ColorFileSchema.optional(),font:o.string().min(1).optional(),align:o.enum(TEXT_ALIGNS).optional(),line_spacing:o.number().positive().max(10).optional(),space_before:o.number().min(0).max(1584).optional(),space_after:o.number().min(0).max(1584).optional(),anchor:o.enum(TEXT_ANCHORS).optional(),bullet:o.union([o.literal(!1),o.string().min(1).max(2)]).optional(),numbered:o.enum(NUMBERINGS).optional()});const A=o.strictObject({left:o.number().lt(1).optional(),top:o.number().lt(1).optional(),right:o.number().lt(1).optional(),bottom:o.number().lt(1).optional()}).refine(t=>(t.left??0)+(t.right??0)<1,{message:"left and right together cut the whole picture away"}).refine(t=>(t.top??0)+(t.bottom??0)<1,{message:"top and bottom together cut the whole picture away"}),d=o.lazy(()=>o.union([o.string(),o.number(),o.boolean(),o.null(),o.array(d),o.record(o.string(),d)]));export const CHART_TYPES=["column-clustered","column-stacked","column-stacked-100","bar-clustered","bar-stacked","bar-stacked-100","line","line-markers","area","area-stacked","area-stacked-100","pie","doughnut"],SHEET_CHART_TYPES=[...CHART_TYPES,"scatter","scatter-lines","scatter-smooth"],CHART_LEGEND_POSITIONS=["bottom","top","left","right"];const C=o.strictObject({min:o.number().optional(),max:o.number().optional(),major:o.number().positive().optional(),gridlines:o.boolean().optional(),visible:o.boolean().optional(),format:o.string().min(1).optional(),reverse:o.boolean().optional(),gridline_color:ColorFileSchema.optional(),line_color:ColorFileSchema.optional()});export const ChartSchema=o.strictObject({type:o.enum(SHEET_CHART_TYPES),data:o.string().min(1).optional(),categories:o.union([o.string().min(1),o.array(o.string())]).optional(),series:o.array(o.union([o.string().min(1),o.strictObject({name:o.string().min(1),values:o.array(o.number().nullable()).optional(),x:o.array(o.number().nullable()).optional(),color:ColorFileSchema.optional(),format:o.string().min(1).optional(),smooth:o.boolean().optional(),line_width:o.number().positive().optional(),marker_size:o.number().int().min(2).max(72).optional()})])).min(1),legend:o.enum(CHART_LEGEND_POSITIONS).optional(),labels:o.union([o.boolean(),o.strictObject({value:o.boolean().optional(),percentage:o.boolean().optional(),category:o.boolean().optional(),series:o.boolean().optional(),format:o.string().min(1).optional(),position:o.enum(["outEnd","inEnd","ctr","inBase","t","b","l","r","bestFit"]).optional(),size:o.number().positive().optional(),color:ColorFileSchema.optional()})]).optional(),gap_width:o.number().min(0).max(500).optional(),overlap:o.number().min(-100).max(100).optional(),vary_by_categories:o.boolean().optional(),category_colors:o.array(ColorFileSchema).min(1).optional(),hole_size:o.number().min(10).max(90).optional(),value_axis:C.optional(),category_axis:C.optional(),size:o.number().positive().optional(),title_size:o.number().positive().optional(),color:ColorFileSchema.optional()});const c=o.number().min(0).max(1);export const GradientSchema=o.strictObject({angle:o.number().min(0).max(360).optional(),stops:o.array(o.strictObject({at:c,color:ColorFileSchema,transparency:c.optional()})).min(2).max(10)}),BackgroundSchema=o.strictObject({fill:ColorFileSchema.optional(),gradient:GradientSchema.optional(),picture:o.string().min(1).optional()}).refine(t=>[t.fill,t.gradient,t.picture].filter(n=>n!==void 0).length===1,{message:"A background is a fill, a gradient or a picture: one of them."}),ShadowSchema=o.strictObject({color:ColorFileSchema.optional(),blur:o.number().min(0).max(100).optional(),distance:o.number().min(0).max(200).optional(),angle:o.number().min(0).max(360).optional(),transparency:c.optional()});const S=o.union([o.strictObject({shape:o.string().min(1),site:o.int().min(0)}),o.literal("none")]);export const ShapeSchema=o.strictObject({frame:FrameSchema.optional(),rotation:o.number().min(0).lt(360).optional(),flip_h:o.literal(!0).optional(),flip_v:o.literal(!0).optional(),connect:o.strictObject({begin:S.optional(),end:S.optional()}).optional(),z:o.int().optional(),fill:o.union([ColorFileSchema,o.literal("none")]).optional(),fill_transparency:c.optional(),gradient:GradientSchema.optional(),shadow:ShadowSchema.optional(),line:o.union([ColorFileSchema,o.literal("none")]).optional(),line_width:o.number().positive().max(1584).optional(),line_dash:o.enum(LINE_DASHES).optional(),line_begin:o.enum(LINE_ENDS).optional(),line_end:o.enum(LINE_ENDS).optional(),text:TextStyleSchema.optional(),textbox:o.literal(!0).optional(),picture:o.string().min(1).optional(),crop:A.optional(),movie:o.string().min(1).optional(),poster:o.number().min(0).optional(),geometry:o.enum(SHAPE_GEOMETRIES).optional(),adjustments:o.array(o.number()).max(8).optional(),path:o.strictObject({w:o.number().positive(),h:o.number().positive(),d:o.string().min(1)}).optional(),table:o.strictObject({columns:o.array(o.number().positive()).min(1),rows:o.array(o.strictObject({height:o.number().positive(),fill:ColorFileSchema.optional(),text:TextStyleSchema.optional(),line:ColorFileSchema.optional()})).min(1)}).optional(),chart:ChartSchema.optional(),group:s.optional(),locked:o.literal(!0).optional(),component:o.union([s,o.string().regex(/^[^#\s]+\.[cm]?[jt]sx?(?:#[A-Za-z_$][\w$]*)?$/u,"A component is a name the deck's module registers, or a module's path and export: ../ui.ts#Dialog.")]).optional(),props:o.record(o.string(),d).optional(),dur:o.number().positive().optional()}),SHAPE_KINDS=["textbox","picture","movie","geometry","path","table","chart","component"],SLIDE_TRANSITIONS=["fade","push","wipe","morph"],TransitionSchema=o.strictObject({type:o.enum(SLIDE_TRANSITIONS),direction:o.enum(ANIMATION_DIRECTIONS).optional(),duration:o.number().positive().optional()}),AnimationSchema=o.strictObject({shape:o.string().min(1),paragraph:o.int().min(0).optional(),effect:o.enum(ANIMATION_EFFECTS),direction:o.enum(ANIMATION_DIRECTIONS).optional(),start:o.enum(ANIMATION_STARTS).optional(),duration:o.number().min(0).optional(),delay:o.number().min(0).optional(),path:o.string().min(1).optional()}),SlideSchema=o.strictObject({id:s,layout:o.string().min(1).optional(),generate:s.optional(),hidden:o.union([o.literal(!0),o.array(o.string())]).optional(),shapes:o.record(o.string().min(1),ShapeSchema).optional(),animations:o.array(AnimationSchema).optional(),transition:TransitionSchema.optional(),advance_after:o.number().min(0).max(86400).optional(),background:BackgroundSchema.optional()}),SlidesFileSchema=o.strictObject({slides:o.array(SlideSchema).default([])}).superRefine((t,n)=>{const i=new Set;t.slides.forEach((e,a)=>{i.has(e.id)&&n.addIssue({code:"custom",path:["slides",a,"id"],message:`Two slides are "${e.id}".`}),i.add(e.id),(e.layout===void 0?0:1)+(e.generate===void 0?0:1)!==1&&n.addIssue({code:"custom",path:["slides",a],message:`Slide ${e.id} has a layout or a generator: one of them.`}),e.hidden!==void 0&&e.generate===void 0&&e.hidden!==!0&&n.addIssue({code:"custom",path:["slides",a,"hidden"],message:`Slide ${e.id} is hidden (true); a list of ids is a generated block's.`});for(const[r,x]of Object.entries(e.shapes??{})){const h=SHAPE_KINDS.filter(u=>x[u]!==void 0);h.length>1&&n.addIssue({code:"custom",path:["slides",a,"shapes",r],message:`Shape ${r} is one kind of shape, not ${h.join(" and ")}.`});const p=r.includes("/")?r.split("/"):[r];(!(p.length<=2&&p.every(u=>g.test(u)))||p.length===2&&e.generate===void 0)&&n.addIssue({code:"custom",path:["slides",a,"shapes",r],message:"A shape's name is letters, digits, _ and -; <slide>/<shape> only in a generated block."})}})});
2
+ import{z as o}from"zod";import{SCRIPT_NAME as g}from"./script.js";const s=o.string().regex(g,"A name is letters, digits, _ and -.");export const THEME_COLORS=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],TEXT_ALIGNS=["l","ctr","r","just"],SHAPE_GEOMETRIES=["line","lineInv","triangle","rtTriangle","rect","diamond","parallelogram","trapezoid","nonIsoscelesTrapezoid","pentagon","hexagon","heptagon","octagon","decagon","dodecagon","star4","star5","star6","star7","star8","star10","star12","star16","star24","star32","roundRect","round1Rect","round2SameRect","round2DiagRect","snipRoundRect","snip1Rect","snip2SameRect","snip2DiagRect","plaque","ellipse","teardrop","homePlate","chevron","pieWedge","pie","blockArc","donut","noSmoking","rightArrow","leftArrow","upArrow","downArrow","stripedRightArrow","notchedRightArrow","bentUpArrow","leftRightArrow","upDownArrow","leftUpArrow","leftRightUpArrow","quadArrow","leftArrowCallout","rightArrowCallout","upArrowCallout","downArrowCallout","leftRightArrowCallout","upDownArrowCallout","quadArrowCallout","bentArrow","uturnArrow","circularArrow","leftCircularArrow","leftRightCircularArrow","curvedRightArrow","curvedLeftArrow","curvedUpArrow","curvedDownArrow","swooshArrow","cube","can","lightningBolt","heart","sun","moon","smileyFace","irregularSeal1","irregularSeal2","foldedCorner","bevel","frame","halfFrame","corner","diagStripe","chord","arc","leftBracket","rightBracket","leftBrace","rightBrace","bracketPair","bracePair","straightConnector1","bentConnector2","bentConnector3","bentConnector4","bentConnector5","curvedConnector2","curvedConnector3","curvedConnector4","curvedConnector5","callout1","callout2","callout3","accentCallout1","accentCallout2","accentCallout3","borderCallout1","borderCallout2","borderCallout3","accentBorderCallout1","accentBorderCallout2","accentBorderCallout3","wedgeRectCallout","wedgeRoundRectCallout","wedgeEllipseCallout","cloudCallout","cloud","ribbon","ribbon2","ellipseRibbon","ellipseRibbon2","leftRightRibbon","verticalScroll","horizontalScroll","wave","doubleWave","plus","flowChartProcess","flowChartDecision","flowChartInputOutput","flowChartPredefinedProcess","flowChartInternalStorage","flowChartDocument","flowChartMultidocument","flowChartTerminator","flowChartPreparation","flowChartManualInput","flowChartManualOperation","flowChartConnector","flowChartPunchedCard","flowChartPunchedTape","flowChartSummingJunction","flowChartOr","flowChartCollate","flowChartSort","flowChartExtract","flowChartMerge","flowChartOfflineStorage","flowChartOnlineStorage","flowChartMagneticTape","flowChartMagneticDisk","flowChartMagneticDrum","flowChartDisplay","flowChartDelay","flowChartAlternateProcess","flowChartOffpageConnector","actionButtonBlank","actionButtonHome","actionButtonHelp","actionButtonInformation","actionButtonForwardNext","actionButtonBackPrevious","actionButtonEnd","actionButtonBeginning","actionButtonReturn","actionButtonDocument","actionButtonSound","actionButtonMovie","gear6","gear9","funnel","mathPlus","mathMinus","mathMultiply","mathDivide","mathEqual","mathNotEqual","cornerTabs","squareTabs","plaqueTabs","chartX","chartStar","chartPlus"],ANIMATION_EFFECTS=["appear","fade","wipe","fly-in","zoom","disappear","fade-out","wipe-out","fly-out","zoom-out","pulse","path"],ANIMATION_STARTS=["on-click","with-previous","after-previous"],ANIMATION_DIRECTIONS=["from-bottom","from-top","from-left","from-right"],LINE_DASHES=["solid","sysDash","sysDot","dash","dashDot","lgDash","lgDashDot","lgDashDotDot"],LINE_ENDS=["none","triangle","arrow","stealth","diamond","oval"],ARROW_SIZES=["sm","med","lg"],LineEndSizeSchema=o.strictObject({w:o.enum(ARROW_SIZES).optional(),len:o.enum(ARROW_SIZES).optional()}),FrameSchema=o.strictObject({x:o.number(),y:o.number(),w:o.number().nonnegative(),h:o.number().nonnegative()});const b=new RegExp(`^(${THEME_COLORS.join("|")}) (lighter|darker) (100(?:\\.0{1,3})?|[1-9]?\\d(?:\\.\\d{1,3})?)%$`,"u"),f=/^#[0-9A-Fa-f]{6}$/u,w=t=>THEME_COLORS.includes(t);export function colorOfFile(t){if(w(t))return t;if(f.test(t))return{rgb:t.toUpperCase()};const n=b.exec(t),[,i="",e,a=""]=n??[],l=Math.round(Number(a)*1e3);if(!(!n||!w(i)||l<=0||l>1e5))return{theme_color:i,brightness:(e==="lighter"?l:-l)/1e5}}export function colorFile(t){if(typeof t=="string")return t;if("rgb"in t)return t.rgb;const n=Math.round(Math.abs(t.brightness)*1e5)/1e3;return n===0?t.theme_color:`${t.theme_color} ${t.brightness>0?"lighter":"darker"} ${String(n)}%`}const m=`A colour is one of the theme's (${THEME_COLORS.join(", ")}), one of them lighter or darker by a share over 0 up to 100% ("accent1 lighter 40%", "dk1 darker 25%"), or #RRGGBB.`;export const ColorFileSchema=o.union([o.enum(THEME_COLORS),o.string().regex(b,m),o.string().regex(f,m)]).refine(t=>colorOfFile(t)!==void 0,m),NUMBERINGS=["arabicPeriod","arabicParenR","alphaLcPeriod","alphaUcPeriod","romanLcPeriod","romanUcPeriod"],TEXT_ANCHORS=["t","ctr","b"],TextStyleSchema=o.strictObject({size:o.number().positive().max(4e3).optional(),bold:o.boolean().optional(),italic:o.boolean().optional(),underline:o.boolean().optional(),strike:o.boolean().optional(),color:ColorFileSchema.optional(),font:o.string().min(1).optional(),align:o.enum(TEXT_ALIGNS).optional(),line_spacing:o.number().positive().max(10).optional(),space_before:o.number().min(0).max(1584).optional(),space_after:o.number().min(0).max(1584).optional(),anchor:o.enum(TEXT_ANCHORS).optional(),bullet:o.union([o.literal(!1),o.string().min(1).max(2)]).optional(),numbered:o.enum(NUMBERINGS).optional()});const A=o.strictObject({left:o.number().lt(1).optional(),top:o.number().lt(1).optional(),right:o.number().lt(1).optional(),bottom:o.number().lt(1).optional()}).refine(t=>(t.left??0)+(t.right??0)<1,{message:"left and right together cut the whole picture away"}).refine(t=>(t.top??0)+(t.bottom??0)<1,{message:"top and bottom together cut the whole picture away"}),d=o.lazy(()=>o.union([o.string(),o.number(),o.boolean(),o.null(),o.array(d),o.record(o.string(),d)]));export const CHART_TYPES=["column-clustered","column-stacked","column-stacked-100","bar-clustered","bar-stacked","bar-stacked-100","line","line-markers","area","area-stacked","area-stacked-100","pie","doughnut"],SHEET_CHART_TYPES=[...CHART_TYPES,"scatter","scatter-lines","scatter-smooth"],CHART_LEGEND_POSITIONS=["bottom","top","left","right"];const C=o.strictObject({min:o.number().optional(),max:o.number().optional(),major:o.number().positive().optional(),gridlines:o.boolean().optional(),visible:o.boolean().optional(),format:o.string().min(1).optional(),reverse:o.boolean().optional(),gridline_color:ColorFileSchema.optional(),line_color:ColorFileSchema.optional()});export const ChartSchema=o.strictObject({type:o.enum(SHEET_CHART_TYPES),data:o.string().min(1).optional(),categories:o.union([o.string().min(1),o.array(o.string())]).optional(),series:o.array(o.union([o.string().min(1),o.strictObject({name:o.string().min(1),values:o.array(o.number().nullable()).optional(),x:o.array(o.number().nullable()).optional(),color:ColorFileSchema.optional(),format:o.string().min(1).optional(),smooth:o.boolean().optional(),line_width:o.number().positive().optional(),marker_size:o.number().int().min(2).max(72).optional()})])).min(1),legend:o.enum(CHART_LEGEND_POSITIONS).optional(),labels:o.union([o.boolean(),o.strictObject({value:o.boolean().optional(),percentage:o.boolean().optional(),category:o.boolean().optional(),series:o.boolean().optional(),format:o.string().min(1).optional(),position:o.enum(["outEnd","inEnd","ctr","inBase","t","b","l","r","bestFit"]).optional(),size:o.number().positive().optional(),color:ColorFileSchema.optional()})]).optional(),gap_width:o.number().min(0).max(500).optional(),overlap:o.number().min(-100).max(100).optional(),vary_by_categories:o.boolean().optional(),category_colors:o.array(ColorFileSchema).min(1).optional(),hole_size:o.number().min(10).max(90).optional(),value_axis:C.optional(),category_axis:C.optional(),size:o.number().positive().optional(),title_size:o.number().positive().optional(),color:ColorFileSchema.optional()});const c=o.number().min(0).max(1);export const GradientSchema=o.strictObject({angle:o.number().min(0).max(360).optional(),stops:o.array(o.strictObject({at:c,color:ColorFileSchema,transparency:c.optional()})).min(2).max(10)}),BackgroundSchema=o.strictObject({fill:ColorFileSchema.optional(),gradient:GradientSchema.optional(),picture:o.string().min(1).optional()}).refine(t=>[t.fill,t.gradient,t.picture].filter(n=>n!==void 0).length===1,{message:"A background is a fill, a gradient or a picture: one of them."}),ShadowSchema=o.strictObject({color:ColorFileSchema.optional(),blur:o.number().min(0).max(100).optional(),distance:o.number().min(0).max(200).optional(),angle:o.number().min(0).max(360).optional(),transparency:c.optional()});const S=o.union([o.strictObject({shape:o.string().min(1),site:o.int().min(0)}),o.literal("none")]);export const ShapeSchema=o.strictObject({frame:FrameSchema.optional(),rotation:o.number().min(0).lt(360).optional(),flip_h:o.literal(!0).optional(),flip_v:o.literal(!0).optional(),connect:o.strictObject({begin:S.optional(),end:S.optional()}).optional(),z:o.int().optional(),fill:o.union([ColorFileSchema,o.literal("none")]).optional(),fill_transparency:c.optional(),gradient:GradientSchema.optional(),shadow:ShadowSchema.optional(),line:o.union([ColorFileSchema,o.literal("none")]).optional(),line_width:o.number().positive().max(1584).optional(),line_dash:o.enum(LINE_DASHES).optional(),line_begin:o.enum(LINE_ENDS).optional(),line_end:o.enum(LINE_ENDS).optional(),line_begin_size:LineEndSizeSchema.optional(),line_end_size:LineEndSizeSchema.optional(),text:TextStyleSchema.optional(),textbox:o.literal(!0).optional(),picture:o.string().min(1).optional(),crop:A.optional(),movie:o.string().min(1).optional(),poster:o.number().min(0).optional(),geometry:o.enum(SHAPE_GEOMETRIES).optional(),adjustments:o.array(o.number()).max(8).optional(),path:o.strictObject({w:o.number().positive(),h:o.number().positive(),d:o.string().min(1)}).optional(),table:o.strictObject({columns:o.array(o.number().positive()).min(1),rows:o.array(o.strictObject({height:o.number().positive(),fill:ColorFileSchema.optional(),text:TextStyleSchema.optional(),line:ColorFileSchema.optional()})).min(1)}).optional(),chart:ChartSchema.optional(),group:s.optional(),locked:o.literal(!0).optional(),component:o.union([s,o.string().regex(/^[^#\s]+\.[cm]?[jt]sx?(?:#[A-Za-z_$][\w$]*)?$/u,"A component is a name the deck's module registers, or a module's path and export: ../ui.ts#Dialog.")]).optional(),props:o.record(o.string(),d).optional(),dur:o.number().positive().optional()}),SHAPE_KINDS=["textbox","picture","movie","geometry","path","table","chart","component"],SLIDE_TRANSITIONS=["fade","push","wipe","morph"],TransitionSchema=o.strictObject({type:o.enum(SLIDE_TRANSITIONS),direction:o.enum(ANIMATION_DIRECTIONS).optional(),duration:o.number().positive().optional()}),AnimationSchema=o.strictObject({shape:o.string().min(1),paragraph:o.int().min(0).optional(),effect:o.enum(ANIMATION_EFFECTS),direction:o.enum(ANIMATION_DIRECTIONS).optional(),start:o.enum(ANIMATION_STARTS).optional(),duration:o.number().min(0).optional(),delay:o.number().min(0).optional(),path:o.string().min(1).optional()}),SlideSchema=o.strictObject({id:s,layout:o.string().min(1).optional(),generate:s.optional(),hidden:o.union([o.literal(!0),o.array(o.string())]).optional(),shapes:o.record(o.string().min(1),ShapeSchema).optional(),animations:o.array(AnimationSchema).optional(),transition:TransitionSchema.optional(),advance_after:o.number().min(0).max(86400).optional(),background:BackgroundSchema.optional()}),SlidesFileSchema=o.strictObject({slides:o.array(SlideSchema).default([])}).superRefine((t,n)=>{const i=new Set;t.slides.forEach((e,a)=>{i.has(e.id)&&n.addIssue({code:"custom",path:["slides",a,"id"],message:`Two slides are "${e.id}".`}),i.add(e.id),(e.layout===void 0?0:1)+(e.generate===void 0?0:1)!==1&&n.addIssue({code:"custom",path:["slides",a],message:`Slide ${e.id} has a layout or a generator: one of them.`}),e.hidden!==void 0&&e.generate===void 0&&e.hidden!==!0&&n.addIssue({code:"custom",path:["slides",a,"hidden"],message:`Slide ${e.id} is hidden (true); a list of ids is a generated block's.`});for(const[r,x]of Object.entries(e.shapes??{})){const h=SHAPE_KINDS.filter(u=>x[u]!==void 0);h.length>1&&n.addIssue({code:"custom",path:["slides",a,"shapes",r],message:`Shape ${r} is one kind of shape, not ${h.join(" and ")}.`});const p=r.includes("/")?r.split("/"):[r];(!(p.length<=2&&p.every(u=>g.test(u)))||p.length===2&&e.generate===void 0)&&n.addIssue({code:"custom",path:["slides",a,"shapes",r],message:"A shape's name is letters, digits, _ and -; <slide>/<shape> only in a generated block."})}})});
@@ -36,4 +36,24 @@ export declare function touches(shape: NoteShape, box: NoteBox): boolean;
36
36
  export declare function pointsOf(shape: NoteShape): NotePoint[];
37
37
  /** A shape moved into another frame, as a stage's own. */
38
38
  export declare function mapShape(shape: NoteShape, map: (p: NotePoint) => NotePoint): NoteShape;
39
+ /**
40
+ * An element's edge as it is drawn, for a person who picks it rather than
41
+ * drawing round it (docs/design/notes.md, "Select"): closed outlines, each a
42
+ * ring of points in the surface's pixels. A box is one ring of four, a box
43
+ * turned its four corners turned, words a ring a line, a round shape its
44
+ * edge in steps.
45
+ */
46
+ export type NoteOutline = NotePoint[][];
47
+ /** A box's outline. */
48
+ export declare function rectOutline(box: NoteBox): NoteOutline;
49
+ /** A box turned about its middle, degrees clockwise: its four corners where they are drawn. */
50
+ export declare function turnedOutline(box: NoteBox, degrees: number): NoteOutline;
51
+ /** The round in a box: its edge in steps. */
52
+ export declare function roundOutline(box: NoteBox): NoteOutline;
53
+ /** An outline moved into another frame. */
54
+ export declare function mapOutline(outline: readonly (readonly NotePoint[])[], map: (p: NotePoint) => NotePoint): NoteOutline;
55
+ /** The box round an outline. */
56
+ export declare function outlineBox(outline: readonly (readonly NotePoint[])[]): NoteBox;
57
+ /** Whether a point is inside an outline: inside one of its rings (the even-odd rule a ring). */
58
+ export declare function insideOutline(outline: readonly (readonly NotePoint[])[], p: NotePoint): boolean;
39
59
  //# sourceMappingURL=note-shape.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- const T=6,P=.85,I=.25,O=40,S=12,x=(t,n,r)=>Math.min(r,Math.max(n,t));function f(t){const n=t.map(e=>e.x),r=t.map(e=>e.y),c=Math.min(...n),o=Math.min(...r);return{x:c,y:o,width:Math.max(...n)-c,height:Math.max(...r)-o}}function l(t){const[n]=t,r=t.at(-1);if(!n||!r)return!1;const{width:c,height:o}=f(t),e=Math.hypot(c,o);return e>0&&Math.hypot(r.x-n.x,r.y-n.y)<=e*.25}const m=(t,n)=>t.x<n.x+Math.max(n.width,1)&&t.x+Math.max(t.width,1)>n.x&&t.y<n.y+Math.max(n.height,1)&&t.y+Math.max(t.height,1)>n.y;function M(t,n){const r=t.width/2||1,c=t.height/2||1,o=t.x+r,e=t.y+c,i=(x(o,n.x,n.x+n.width)-o)/r,s=(x(e,n.y,n.y+n.height)-e)/c;return Math.hypot(i,s)<=.85}function w(t,n,r){const c=n.x-t.x,o=n.y-t.y;let e=0,i=1;for(const[s,h]of[[-c,t.x-r.x],[c,r.x+r.width-t.x],[-o,t.y-r.y],[o,r.y+r.height-t.y]]){if(s===0){if(h<0)return!1}else s<0?e=Math.max(e,h/s):i=Math.min(i,h/s);if(e>i)return!1}return!0}export function touches(t,n){switch(t.kind){case"box":return m(t.rect,n);case"round":return M(t.rect,n);case"arrow":return m({x:t.to.x-6,y:t.to.y-6,width:12,height:12},n);case"line":return l(t.points)?M(f(t.points),n):t.points.some((r,c)=>w(t.points[c-1]??r,r,n))}}function d(t,n){return n.flatMap(r=>n.map(c=>({x:t.x+t.width*c,y:t.y+t.height*r})))}function g(t){const n=t.map((o,e)=>{const i=t[e-1]??o;return Math.hypot(o.x-i.x,o.y-i.y)}),r=n.reduce((o,e)=>o+e,0),c=x(Math.ceil(r/40)+1,2,12);return Array.from({length:c},(o,e)=>{let i=r*e/(c-1);for(const[s,h]of t.entries()){const u=n[s]??0,y=t[s-1];if(y&&i<=u){const a=u===0?0:i/u;return{x:y.x+(h.x-y.x)*a,y:y.y+(h.y-y.y)*a}}i-=u}return t.at(-1)??{x:0,y:0}})}export function pointsOf(t){switch(t.kind){case"box":return d(t.rect,[.5,.2,.8]);case"round":return d(t.rect,[.5,.3,.7]);case"arrow":return[t.to];case"line":return l(t.points)?d(f(t.points),[.5,.3,.7]):g(t.points)}}export function mapShape(t,n){switch(t.kind){case"box":case"round":{const r=n(t.rect),c=n({x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height});return{kind:t.kind,rect:{...r,width:c.x-r.x,height:c.y-r.y}}}case"arrow":return{kind:"arrow",from:n(t.from),to:n(t.to)};case"line":return{kind:"line",points:t.points.map(n)}}}
2
+ const O=6,P=.85,I=.25,S=40,k=12,x=(t,n,r)=>Math.min(r,Math.max(n,t));function f(t){const n=t.map(e=>e.x),r=t.map(e=>e.y),c=Math.min(...n),i=Math.min(...r);return{x:c,y:i,width:Math.max(...n)-c,height:Math.max(...r)-i}}function d(t){const[n]=t,r=t.at(-1);if(!n||!r)return!1;const{width:c,height:i}=f(t),e=Math.hypot(c,i);return e>0&&Math.hypot(r.x-n.x,r.y-n.y)<=e*.25}const m=(t,n)=>t.x<n.x+Math.max(n.width,1)&&t.x+Math.max(t.width,1)>n.x&&t.y<n.y+Math.max(n.height,1)&&t.y+Math.max(t.height,1)>n.y;function M(t,n){const r=t.width/2||1,c=t.height/2||1,i=t.x+r,e=t.y+c,o=(x(i,n.x,n.x+n.width)-i)/r,s=(x(e,n.y,n.y+n.height)-e)/c;return Math.hypot(o,s)<=.85}function g(t,n,r){const c=n.x-t.x,i=n.y-t.y;let e=0,o=1;for(const[s,y]of[[-c,t.x-r.x],[c,r.x+r.width-t.x],[-i,t.y-r.y],[i,r.y+r.height-t.y]]){if(s===0){if(y<0)return!1}else s<0?e=Math.max(e,y/s):o=Math.min(o,y/s);if(e>o)return!1}return!0}export function touches(t,n){switch(t.kind){case"box":return m(t.rect,n);case"round":return M(t.rect,n);case"arrow":return m({x:t.to.x-6,y:t.to.y-6,width:12,height:12},n);case"line":return d(t.points)?M(f(t.points),n):t.points.some((r,c)=>g(t.points[c-1]??r,r,n))}}function a(t,n){return n.flatMap(r=>n.map(c=>({x:t.x+t.width*c,y:t.y+t.height*r})))}function T(t){const n=t.map((i,e)=>{const o=t[e-1]??i;return Math.hypot(i.x-o.x,i.y-o.y)}),r=n.reduce((i,e)=>i+e,0),c=x(Math.ceil(r/40)+1,2,12);return Array.from({length:c},(i,e)=>{let o=r*e/(c-1);for(const[s,y]of t.entries()){const h=n[s]??0,u=t[s-1];if(u&&o<=h){const l=h===0?0:o/h;return{x:u.x+(y.x-u.x)*l,y:u.y+(y.y-u.y)*l}}o-=h}return t.at(-1)??{x:0,y:0}})}export function pointsOf(t){switch(t.kind){case"box":return a(t.rect,[.5,.2,.8]);case"round":return a(t.rect,[.5,.3,.7]);case"arrow":return[t.to];case"line":return d(t.points)?a(f(t.points),[.5,.3,.7]):T(t.points)}}export function mapShape(t,n){switch(t.kind){case"box":case"round":{const r=n(t.rect),c=n({x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height});return{kind:t.kind,rect:{...r,width:c.x-r.x,height:c.y-r.y}}}case"arrow":return{kind:"arrow",from:n(t.from),to:n(t.to)};case"line":return{kind:"line",points:t.points.map(n)}}}export function rectOutline(t){return[[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}]]}export function turnedOutline(t,n){if(n%360===0)return rectOutline(t);const r=n*Math.PI/180,c=Math.cos(r),i=Math.sin(r),e=t.x+t.width/2,o=t.y+t.height/2;return rectOutline(t).map(s=>s.map(y=>({x:e+(y.x-e)*c-(y.y-o)*i,y:o+(y.x-e)*i+(y.y-o)*c})))}const w=48;export function roundOutline(t){const n=t.width/2,r=t.height/2;return[Array.from({length:w},(c,i)=>{const e=2*Math.PI*i/w;return{x:t.x+n+n*Math.cos(e),y:t.y+r+r*Math.sin(e)}})]}export function mapOutline(t,n){return t.map(r=>r.map(n))}export function outlineBox(t){return f(t.flat())}export function insideOutline(t,n){return t.some(r=>{let c=!1;for(let i=0,e=r.length-1;i<r.length;e=i++){const o=r[i],s=r[e];!o||!s||o.y>n.y!=s.y>n.y&&n.x<(s.x-o.x)*(n.y-o.y)/(s.y-o.y)+o.x&&(c=!c)}return c})}
@@ -719,6 +719,7 @@ export declare const DATA_FILES: {
719
719
  value: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean, z.ZodString, z.ZodNull]>>;
720
720
  formula: z.ZodOptional<z.ZodString>;
721
721
  name: z.ZodOptional<z.ZodString>;
722
+ start: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean, z.ZodString, z.ZodNull]>>;
722
723
  }, z.core.$strict>]>>>;
723
724
  format: z.ZodOptional<z.ZodArray<z.ZodObject<{
724
725
  format: z.ZodOptional<z.ZodString>;
@@ -1585,6 +1586,17 @@ export declare const DATA_FILES: {
1585
1586
  smooth: z.ZodOptional<z.ZodBoolean>;
1586
1587
  line_width: z.ZodOptional<z.ZodNumber>;
1587
1588
  marker_size: z.ZodOptional<z.ZodNumber>;
1589
+ type: z.ZodOptional<z.ZodEnum<{
1590
+ line: "line";
1591
+ "column-clustered": "column-clustered";
1592
+ "column-stacked": "column-stacked";
1593
+ "column-stacked-100": "column-stacked-100";
1594
+ "line-markers": "line-markers";
1595
+ area: "area";
1596
+ "area-stacked": "area-stacked";
1597
+ "area-stacked-100": "area-stacked-100";
1598
+ }>>;
1599
+ secondary: z.ZodOptional<z.ZodBoolean>;
1588
1600
  }, z.core.$strict>>;
1589
1601
  legend: z.ZodOptional<z.ZodEnum<{
1590
1602
  left: "left";
@@ -1649,6 +1661,16 @@ export declare const DATA_FILES: {
1649
1661
  format: z.ZodOptional<z.ZodString>;
1650
1662
  reverse: z.ZodOptional<z.ZodBoolean>;
1651
1663
  }, z.core.$strict>>;
1664
+ secondary_axis: z.ZodOptional<z.ZodObject<{
1665
+ title: z.ZodOptional<z.ZodString>;
1666
+ min: z.ZodOptional<z.ZodNumber>;
1667
+ max: z.ZodOptional<z.ZodNumber>;
1668
+ major: z.ZodOptional<z.ZodNumber>;
1669
+ gridlines: z.ZodOptional<z.ZodBoolean>;
1670
+ visible: z.ZodOptional<z.ZodBoolean>;
1671
+ format: z.ZodOptional<z.ZodString>;
1672
+ reverse: z.ZodOptional<z.ZodBoolean>;
1673
+ }, z.core.$strict>>;
1652
1674
  size: z.ZodOptional<z.ZodNumber>;
1653
1675
  title_size: z.ZodOptional<z.ZodNumber>;
1654
1676
  color: z.ZodOptional<z.ZodString>;
@@ -1723,6 +1745,10 @@ export declare const DATA_FILES: {
1723
1745
  formula: z.ZodString;
1724
1746
  }, z.core.$strict>>>;
1725
1747
  scenarios: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean, z.ZodString, z.ZodNull]>>>>;
1748
+ iteration: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
1749
+ max_iterations: z.ZodOptional<z.ZodNumber>;
1750
+ max_change: z.ZodOptional<z.ZodNumber>;
1751
+ }, z.core.$strict>]>>;
1726
1752
  }, z.core.$strict>;
1727
1753
  readonly files: readonly [];
1728
1754
  readonly about: "A workbook: its sheets, cells, formulas, formats, names, checks and scenarios.";
@@ -1852,6 +1878,30 @@ export declare const DATA_FILES: {
1852
1878
  stealth: "stealth";
1853
1879
  oval: "oval";
1854
1880
  }>>;
1881
+ line_begin_size: z.ZodOptional<z.ZodObject<{
1882
+ w: z.ZodOptional<z.ZodEnum<{
1883
+ sm: "sm";
1884
+ med: "med";
1885
+ lg: "lg";
1886
+ }>>;
1887
+ len: z.ZodOptional<z.ZodEnum<{
1888
+ sm: "sm";
1889
+ med: "med";
1890
+ lg: "lg";
1891
+ }>>;
1892
+ }, z.core.$strict>>;
1893
+ line_end_size: z.ZodOptional<z.ZodObject<{
1894
+ w: z.ZodOptional<z.ZodEnum<{
1895
+ sm: "sm";
1896
+ med: "med";
1897
+ lg: "lg";
1898
+ }>>;
1899
+ len: z.ZodOptional<z.ZodEnum<{
1900
+ sm: "sm";
1901
+ med: "med";
1902
+ lg: "lg";
1903
+ }>>;
1904
+ }, z.core.$strict>>;
1855
1905
  text: z.ZodOptional<z.ZodObject<{
1856
1906
  size: z.ZodOptional<z.ZodNumber>;
1857
1907
  bold: z.ZodOptional<z.ZodBoolean>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/formats",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/image-draw",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./*": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/image-measure",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./*": {
@@ -123,7 +123,7 @@ export interface ImageOptions {
123
123
  * no words of its own.
124
124
  */
125
125
  script?: string;
126
- /** Its boards have no background: their files keep the alpha channel (PNG, WebP, AVIF). */
126
+ /** Its boards have no background: their files keep the alpha channel (PNG, WebP). */
127
127
  transparent?: boolean;
128
128
  /** Its boards, in order. */
129
129
  boards(ctx: ImageContext): Board[] | Promise<Board[]>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/image-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/measure",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{PRESETS as I}from"../generated/presets.js";export const PRESET_NAMES=Object.keys(I);export function presetAdjustments(s){return(I[s]?.av??[]).map(([a,o])=>({name:a,value:Number(o.split(/\s+/u)[1]??0)}))}const L=6e4,q=s=>s/L*(Math.PI/180);function z(s,a){const o=Math.min(s,a),c=new Map([["w",s],["h",a],["l",0],["t",0],["r",s],["b",a],["hc",s/2],["vc",a/2],["ls",Math.max(s,a)],["ss",o],["cd2",108e5],["cd4",54e5],["cd8",27e5],["3cd4",162e5],["3cd8",81e5],["5cd8",135e5],["7cd8",189e5]]);for(const t of[2,3,4,5,6,8,10,12,32])c.set(`wd${String(t)}`,s/t),c.set(`hd${String(t)}`,a/t);for(const t of[2,4,6,8,16,32])c.set(`ssd${String(t)}`,o/t);return c}function T(s,a){const[o="",...c]=s.trim().split(/\s+/u),[t=0,n=0,e=0]=c.map(r=>a.get(r)??Number(r));switch(o){case"*/":return e===0?0:t*n/e;case"+-":return t+n-e;case"+/":return e===0?0:(t+n)/e;case"?:":return t>0?n:e;case"abs":return Math.abs(t);case"at2":return Math.atan2(n,t)*180*L/Math.PI;case"cat2":return t*Math.cos(Math.atan2(e,n));case"cos":return t*Math.cos(q(n));case"max":return Math.max(t,n);case"min":return Math.min(t,n);case"mod":return Math.sqrt(t*t+n*n+e*e);case"pin":return n<t?t:n>e?e:n;case"sat2":return t*Math.sin(Math.atan2(e,n));case"sin":return t*Math.sin(q(n));case"sqrt":return Math.sqrt(t);case"tan":return t*Math.tan(q(n));case"val":return t;default:return 0}}const b=s=>String(Math.round(s*1e3)/1e3);function A(s,a,o,c,t,n){const e=d=>Math.atan2(o*Math.sin(q(d)),c*Math.cos(q(d))),r=e(t),p=n<0?-1:1,h=Math.floor(Math.abs(n)/216e5),g=Math.abs(n)-h*216e5;let l=e(t+p*g)-r;for(;p*l<0;)l+=p*2*Math.PI;g===0&&(l=0);const m=r+l+p*h*2*Math.PI,f=s-o*Math.cos(r),i=a-c*Math.sin(r),x=Math.max(1,Math.ceil(Math.abs(m-r)/(Math.PI/2)-1e-9)),_=(m-r)/x,M=4/3*Math.tan(_/4),P=[];let v=r;for(let d=0;d<x;d++){const u=v+_,[y,k,$,S]=[Math.cos(v),Math.sin(v),Math.cos(u),Math.sin(u)];P.push(`C ${b(f+o*(y-M*k))} ${b(i+c*(k+M*y))} ${b(f+o*($+M*S))} ${b(i+c*(S-M*$))} ${b(f+o*$)} ${b(i+c*S)}`),v=u}return{d:P,x:f+o*Math.cos(m),y:i+c*Math.sin(m)}}function O(s,a,o,c){const t=z(a,o);for(const[n,e]of s.av??[])t.set(n,c[n]??T(e,t));for(const[n,e]of s.gd??[])t.set(n,T(e,t));return t}const E=(s,a)=>a.get(s)??Number(s);export function evaluate(s,a,o,c={}){const t=O(s,a,o,c),n=l=>E(l,t),e=s.paths.map(l=>{const m=l.w?a/l.w:1,f=l.h?o/l.h:1,i=l.d.split(" "),x=[];let _=0,M=0,P={x:0,y:0};for(let v=0;v<i.length;){const d=i[v++],u=()=>n(i[v++]??"0");if(d==="M"||d==="L")_=u()*m,M=u()*f,d==="M"&&(P={x:_,y:M}),x.push(`${d} ${b(_)} ${b(M)}`);else if(d==="Q"){const[y,k]=[u()*m,u()*f],[$,S]=[u()*m,u()*f];x.push(`C ${b(_+2/3*(y-_))} ${b(M+2/3*(k-M))} ${b($+2/3*(y-$))} ${b(S+2/3*(k-S))} ${b($)} ${b(S)}`),[_,M]=[$,S]}else if(d==="C"){const y=[u()*m,u()*f,u()*m,u()*f,u()*m,u()*f];x.push(`C ${y.map(b).join(" ")}`),[_,M]=[y[4]??0,y[5]??0]}else if(d==="A"){const[y,k,$,S]=[u()*m,u()*f,u(),u()],j=A(_,M,y,k,$,S);x.push(...j.d),[_,M]=[j.x,j.y]}else d==="Z"&&(x.push("Z"),[_,M]=[P.x,P.y])}return{d:x.join(" "),fill:l.fill??"norm",stroke:l.stroke!==!1}}),[r="l",p="t",h="r",g="b"]=s.text??[];return{paths:e,text:{left:n(r),top:n(p),right:n(h),bottom:n(g)}}}export function presetOutline(s,a,o,c=[]){const t=I[s];if(t)return evaluate(t,a,o,C(t,c))}function C(s,a){const o={};return(s.av??[]).forEach(([c],t)=>{const n=a[t];n!==void 0&&(o[c]=n*1e5)}),o}const Z=(s,a)=>({x:E(s.pos[0],a),y:E(s.pos[1],a)});export function presetHandles(s,a,o,c=[]){const t=I[s];if(!t?.ah)return[];const n=O(t,a,o,C(t,c));return t.ah.map((e,r)=>({index:r,...Z(e,n)}))}export function presetSites(s,a,o,c=[]){const t=I[s];if(!t?.cxn)return[];const n=O(t,a,o,C(t,c));return t.cxn.map(([e,r,p],h)=>({index:h,x:E(e,n),y:E(r,n),angle:E(p,n)/6e4}))}const H=64,N=(Math.sqrt(5)-1)/2;function B(s,a,o){if(o<=a)return a;const c=(o-a)/H;let t=0,n=1/0;for(let f=0;f<=H;f++){const i=s(a+f*c);i<n&&([t,n]=[f,i])}let e=a+Math.max(0,t-1)*c,r=a+Math.min(H,t+1)*c,p=r-N*(r-e),h=e+N*(r-e),g=s(p),l=s(h);for(let f=0;f<80&&r-e>1e-6;f++)g<l?([r,h,l]=[h,p,g],p=r-N*(r-e),g=s(p)):([e,p,g]=[p,h,l],h=e+N*(r-e),l=s(h));const m=(e+r)/2;return s(m)<=n?m:a+t*c}export function adjustedBy(s,a,o,c,t,n){const e=I[s],r=e?.ah?.[t];if(!e||!r)return[...c];const p=O(e,a,o,C(e,c)),h={};for(const[i]of e.av??[])h[i]=p.get(i)??0;const g=[r.x??r.r,r.y??r.ang].filter(i=>i!==void 0),l=i=>{const x=Z(r,O(e,a,o,i));return Math.hypot(x.x-n.x,x.y-n.y)},m=1e-9*(Math.abs(a)+Math.abs(o)+1),f=new Set;for(const[i,x,_]of g.length>1?[...g,...g]:g){const M=O(e,a,o,h),[P,v]=[E(x,M),E(_,M)].sort(($,S)=>$-S);if(P===void 0||v===void 0)continue;const d=$=>l({...h,[i]:$}),u=h[i]??0,y=Math.min(v,Math.max(P,Math.round(B(d,P,v))));u>=P&&u<=v&&d(u)<=d(y)+m||(h[i]=y,f.add(i))}return(e.av??[]).map(([i],x)=>f.has(i)?(h[i]??0)/1e5:c[x]??(h[i]??0)/1e5)}
2
+ import{PRESETS as O}from"../generated/presets.js";export const PRESET_NAMES=Object.keys(O);export function presetAdjustments(s){return(O[s]?.av??[]).map(([e,o])=>({name:e,value:Number(o.split(/\s+/u)[1]??0)}))}const T=6e4,C=s=>s/T*(Math.PI/180);function A(s,e){const o=Math.min(s,e),c=new Map([["w",s],["h",e],["l",0],["t",0],["r",s],["b",e],["hc",s/2],["vc",e/2],["ls",Math.max(s,e)],["ss",o],["cd2",108e5],["cd4",54e5],["cd8",27e5],["3cd4",162e5],["3cd8",81e5],["5cd8",135e5],["7cd8",189e5]]);for(const t of[2,3,4,5,6,8,10,12,32])c.set(`wd${String(t)}`,s/t),c.set(`hd${String(t)}`,e/t);for(const t of[2,4,6,8,16,32])c.set(`ssd${String(t)}`,o/t);return c}function Z(s,e){const[o="",...c]=s.trim().split(/\s+/u),[t=0,n=0,a=0]=c.map(r=>e.get(r)??Number(r));switch(o){case"*/":return a===0?0:t*n/a;case"+-":return t+n-a;case"+/":return a===0?0:(t+n)/a;case"?:":return t>0?n:a;case"abs":return Math.abs(t);case"at2":return Math.atan2(n,t)*180*T/Math.PI;case"cat2":return t*Math.cos(Math.atan2(a,n));case"cos":return t*Math.cos(C(n));case"max":return Math.max(t,n);case"min":return Math.min(t,n);case"mod":return Math.sqrt(t*t+n*n+a*a);case"pin":return n<t?t:n>a?a:n;case"sat2":return t*Math.sin(Math.atan2(a,n));case"sin":return t*Math.sin(C(n));case"sqrt":return Math.sqrt(t);case"tan":return t*Math.tan(C(n));case"val":return t;default:return 0}}const y=s=>String(Math.round(s*1e3)/1e3);function B(s,e,o,c,t,n,a=o,r=c){const _=d=>Math.atan2(a*Math.sin(C(d)),r*Math.cos(C(d))),u=_(t),m=n<0?-1:1,l=Math.floor(Math.abs(n)/216e5),b=Math.abs(n)-l*216e5;let h=_(t+m*b)-u;for(;m*h<0;)h+=m*2*Math.PI;b===0&&(h=0);const i=u+h+m*l*2*Math.PI,M=s-o*Math.cos(u),p=e-c*Math.sin(u),x=Math.max(1,Math.ceil(Math.abs(i-u)/(Math.PI/2)-1e-9)),S=(i-u)/x,$=4/3*Math.tan(S/4),g=[];let f=u;for(let d=0;d<x;d++){const k=f+S,[v,P,I,H]=[Math.cos(f),Math.sin(f),Math.cos(k),Math.sin(k)];g.push(`C ${y(M+o*(v-$*P))} ${y(p+c*(P+$*v))} ${y(M+o*(I+$*H))} ${y(p+c*(H-$*I))} ${y(M+o*I)} ${y(p+c*H)}`),f=k}return{d:g,x:M+o*Math.cos(i),y:p+c*Math.sin(i)}}function q(s,e,o,c){const t=A(e,o);for(const[n,a]of s.av??[])t.set(n,c[n]??Z(a,t));for(const[n,a]of s.gd??[])t.set(n,Z(a,t));return t}const E=(s,e)=>e.get(s)??Number(s);export function evaluate(s,e,o,c={}){const t=q(s,e,o,c),n=l=>E(l,t),a=s.paths.map(l=>{const b=l.w?e/l.w:1,h=l.h?o/l.h:1,i=l.d.split(" "),M=[];let p=0,x=0,S={x:0,y:0};for(let $=0;$<i.length;){const g=i[$++],f=()=>n(i[$++]??"0");if(g==="M"||g==="L")p=f()*b,x=f()*h,g==="M"&&(S={x:p,y:x}),M.push(`${g} ${y(p)} ${y(x)}`);else if(g==="Q"){const[d,k]=[f()*b,f()*h],[v,P]=[f()*b,f()*h];M.push(`C ${y(p+2/3*(d-p))} ${y(x+2/3*(k-x))} ${y(v+2/3*(d-v))} ${y(P+2/3*(k-P))} ${y(v)} ${y(P)}`),[p,x]=[v,P]}else if(g==="C"){const d=[f()*b,f()*h,f()*b,f()*h,f()*b,f()*h];M.push(`C ${d.map(y).join(" ")}`),[p,x]=[d[4]??0,d[5]??0]}else if(g==="A"){const[d,k,v,P]=[f(),f(),f(),f()],I=B(p,x,d*b,k*h,v,P,d,k);M.push(...I.d),[p,x]=[I.x,I.y]}else g==="Z"&&(M.push("Z"),[p,x]=[S.x,S.y])}return{d:M.join(" "),fill:l.fill??"norm",stroke:l.stroke!==!1}}),[r="l",_="t",u="r",m="b"]=s.text??[];return{paths:a,text:{left:n(r),top:n(_),right:n(u),bottom:n(m)}}}export function presetOutline(s,e,o,c=[]){const t=O[s];if(t)return evaluate(t,e,o,N(t,c))}function N(s,e){const o={};return(s.av??[]).forEach(([c],t)=>{const n=e[t];n!==void 0&&(o[c]=n*1e5)}),o}const z=(s,e)=>({x:E(s.pos[0],e),y:E(s.pos[1],e)});export function presetHandles(s,e,o,c=[]){const t=O[s];if(!t?.ah)return[];const n=q(t,e,o,N(t,c));return t.ah.map((a,r)=>({index:r,...z(a,n)}))}export function presetSites(s,e,o,c=[]){const t=O[s];if(!t?.cxn)return[];const n=q(t,e,o,N(t,c));return t.cxn.map(([a,r,_],u)=>({index:u,x:E(a,n),y:E(r,n),angle:E(_,n)/6e4}))}const L=64,j=(Math.sqrt(5)-1)/2;function D(s,e,o){if(o<=e)return e;const c=(o-e)/L;let t=0,n=1/0;for(let h=0;h<=L;h++){const i=s(e+h*c);i<n&&([t,n]=[h,i])}let a=e+Math.max(0,t-1)*c,r=e+Math.min(L,t+1)*c,_=r-j*(r-a),u=a+j*(r-a),m=s(_),l=s(u);for(let h=0;h<80&&r-a>1e-6;h++)m<l?([r,u,l]=[u,_,m],_=r-j*(r-a),m=s(_)):([a,_,m]=[_,u,l],u=a+j*(r-a),l=s(u));const b=(a+r)/2;return s(b)<=n?b:e+t*c}export function adjustedBy(s,e,o,c,t,n){const a=O[s],r=a?.ah?.[t];if(!a||!r)return[...c];const _=q(a,e,o,N(a,c)),u={};for(const[i]of a.av??[])u[i]=_.get(i)??0;const m=[r.x??r.r,r.y??r.ang].filter(i=>i!==void 0),l=i=>{const M=z(r,q(a,e,o,i));return Math.hypot(M.x-n.x,M.y-n.y)},b=1e-9*(Math.abs(e)+Math.abs(o)+1),h=new Set;for(const[i,M,p]of m.length>1?[...m,...m]:m){const x=q(a,e,o,u),[S,$]=[E(M,x),E(p,x)].sort((v,P)=>v-P);if(S===void 0||$===void 0)continue;const g=v=>l({...u,[i]:v}),f=u[i]??0,d=Math.min($,Math.max(S,Math.round(D(g,S,$))));f>=S&&f<=$&&g(f)<=g(d)+b||(u[i]=d,h.add(i))}return(a.av??[]).map(([i],M)=>h.has(i)?(u[i]??0)/1e5:c[M]??(u[i]??0)/1e5)}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/ooxml",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -110,6 +110,8 @@ export interface StageContext {
110
110
  code: string;
111
111
  message: string;
112
112
  level?: "error" | "warn";
113
+ /** A fact of the page drawing it (its browser), not of the piece (`Problem.ofPage`). */
114
+ ofPage?: true;
113
115
  }): void;
114
116
  /**
115
117
  * The caption cues shown in this part, on its own clock (seconds from
@@ -232,6 +232,12 @@ export interface DeckTextLayout {
232
232
  scale?: number;
233
233
  /** Its first paragraph's alignment: the line it is aligned by. */
234
234
  align?: "l" | "ctr" | "r" | "just";
235
+ /** A turned shape's box, glyphs and lines measured unturned, in its own frame: what its text overflowing is judged by. */
236
+ own?: {
237
+ box: Box;
238
+ glyphs: Box | null;
239
+ lines: Box[];
240
+ };
235
241
  }
236
242
  /** A deck's shape as drawn on its slide. */
237
243
  export interface DeckShapeLayout {
@@ -270,6 +276,16 @@ export interface DeckShapeLayout {
270
276
  /** The part of them shown (its crop). */
271
277
  shown: [width: number, height: number];
272
278
  };
279
+ /** A line's two ends, where it begins and where it ends: a connector's, or a freeform's whose outline is left open. */
280
+ ends?: [DeckLineEnd, DeckLineEnd];
281
+ }
282
+ /** An end of a deck's line, in the slide's pixels. */
283
+ export interface DeckLineEnd {
284
+ at: [x: number, y: number];
285
+ /** What it has: `none`, `triangle`, `arrow`, `stealth`, `diamond`, `oval`. */
286
+ head: string;
287
+ /** The shape it is glued to, by name. */
288
+ glued?: string;
273
289
  }
274
290
  /** A deck's slide as drawn at a still: one of its steps'. */
275
291
  export interface DeckSlideLayout {
@@ -1,3 +1,3 @@
1
1
  export { consoleAt, consoleAtAsync, consoleLog, consoleParts, installConsole, resetConsole, } from "./console.js";
2
- export { locateLayers } from "./locate.js";
2
+ export { locateLayers, pickLayer } from "./locate.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export{consoleAt,consoleAtAsync,consoleLog,consoleParts,installConsole,resetConsole}from"./console.js";export{locateLayers}from"./locate.js";
2
+ export{consoleAt,consoleAtAsync,consoleLog,consoleParts,installConsole,resetConsole}from"./console.js";export{locateLayers,pickLayer}from"./locate.js";
@@ -1,4 +1,17 @@
1
1
  import { type NoteShape } from "@allyhub/formats";
2
- import type { LocatedLayer } from "../stage.js";
2
+ import type { LocatedLayer, PickedLayer } from "../stage.js";
3
3
  export declare function locateLayers(root: ParentNode, mark: NoteShape): LocatedLayer[];
4
+ /**
5
+ * The one thing in front at a point of the stage (px of its window), as a
6
+ * browser's inspector finds the element under the pointer: the first
7
+ * element there, front to back, that shows and draws something of its own,
8
+ * in a layer or a footage. A piece of a run of words (a letter or a word
9
+ * in its own span, for its motion) is its run. Its edge is a box with room
10
+ * round it (`edgeOf`): the element's own, turned with it, where it paints
11
+ * one or is a picture; else the box round its words.
12
+ */
13
+ export declare function pickLayer(doc: Document, at: {
14
+ x: number;
15
+ y: number;
16
+ }): PickedLayer | undefined;
4
17
  //# sourceMappingURL=locate.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{touches as y}from"@allyhub/formats";const f=3,g=120,h=e=>e.width*e.height;function p(e){return[...e.childNodes].filter(n=>n.nodeType===Node.TEXT_NODE).map(n=>n.textContent).join("").trim()}export function locateLayers(e,n){const c=t=>t.width>0&&t.height>0&&y(n,t),s=[],a=[];for(const t of e.querySelectorAll(".ak-layer")){if(!t.checkVisibility({opacityProperty:!0,visibilityProperty:!0})||!c(t.getBoundingClientRect()))continue;const r={part:t.closest(".ak-part")?.dataset.key??"",layer:t.dataset.component??""};let o;for(const i of[t,...t.querySelectorAll("*")]){const d=i.getBoundingClientRect();!c(d)||p(i)===""&&!i.hasAttribute("data-ak")||(!o||h(d)<h(o.getBoundingClientRect()))&&(o=i)}if(!o){a.push(r);continue}const l=o.closest("[data-ak]")?.getAttribute("data-ak"),u=p(o).slice(0,g);s.push({...r,...l?{name:l}:{},...u===""?{}:{text:u}})}return[...s,...a].slice(0,f)}
2
+ import{touches as $}from"@allyhub/formats";import{LAYER_NAME as C}from"../layer.js";const A=3,E=120,T=t=>t.width*t.height;function S(t){if(t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGElement||k(t)!=="")return!0;const e=getComputedStyle(t);return e.backgroundColor!=="transparent"&&!/^rgba\(.*,\s*0\)$/u.test(e.backgroundColor)||e.backgroundImage!=="none"||parseFloat(e.borderTopWidth)+parseFloat(e.borderRightWidth)+parseFloat(e.borderBottomWidth)+parseFloat(e.borderLeftWidth)>0}const m=t=>t.closest("[data-ak-piece]")?.dataset.akPiece;function k(t){return[...t.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join("").trim()}export function locateLayers(t,e){const r=i=>i.width>0&&i.height>0&&$(e,i),d=[],s=[];for(const i of t.querySelectorAll(".ak-layer")){if(!i.checkVisibility({opacityProperty:!0,visibilityProperty:!0})||!r(i.getBoundingClientRect())||![i,...i.querySelectorAll("*")].filter(f=>r(f.getBoundingClientRect())).some(S))continue;const c=i.getAttribute(C)??void 0,a=m(i),l={part:i.closest(".ak-part")?.dataset.key??"",layer:i.dataset.component??"",...c===void 0||c===""?{}:{key:c},...a===void 0?{}:{piece:a}};let y;for(const f of[i,...i.querySelectorAll("*")]){const p=f.getBoundingClientRect();!r(p)||k(f)===""&&!f.hasAttribute("data-ak")||(!y||T(p)<T(y.getBoundingClientRect()))&&(y=f)}if(!y){s.push(l);continue}const x=y.closest("[data-ak]")?.getAttribute("data-ak"),h=k(y).slice(0,E);d.push({...l,...x?{name:x}:{},...h===""?{}:{text:h}})}const o=[];for(const i of t.querySelectorAll(".ak-footage")){const u=i.dataset.akFile,c=(i.querySelector("video")??i).checkVisibility({opacityProperty:!0,visibilityProperty:!0});if(u===void 0||!c||!r(i.getBoundingClientRect()))continue;const a=m(i);o.push({part:i.dataset.akPart??"",layer:"footage",file:u,...a===void 0?{}:{piece:a}})}return[...d,...o,...s].slice(0,A)}const v=t=>t.checkVisibility({opacityProperty:!0,visibilityProperty:!0});function M(t){if(t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGElement)return!0;const e=getComputedStyle(t);return e.backgroundColor!=="transparent"&&!/^rgba\(.*,\s*0\)$/u.test(e.backgroundColor)||e.backgroundImage!=="none"||parseFloat(e.borderTopWidth)+parseFloat(e.borderRightWidth)+parseFloat(e.borderBottomWidth)+parseFloat(e.borderLeftWidth)>0}const R={px:2,share:.02};function L(t){if(!(t instanceof HTMLElement)||!t.parentElement)return;const e=t.getBoundingClientRect(),r=getComputedStyle(t),d=t.ownerDocument,s=d.createElement("div");s.style.cssText=["position:absolute","margin:0","padding:0","border:0","box-sizing:border-box","visibility:hidden","pointer-events:none",`left:${String(t.offsetLeft)}px`,`top:${String(t.offsetTop)}px`,`width:${String(t.offsetWidth)}px`,`height:${String(t.offsetHeight)}px`,`transform:${r.transform}`,`transform-origin:${r.transformOrigin}`,`rotate:${r.rotate}`,`scale:${r.scale}`,`translate:${r.translate}`].join(";");const o=(f,p)=>{const g=d.createElement("div");return g.style.cssText=`position:absolute;width:0;height:0;left:${f};top:${p}`,s.append(g),g},i=[o("0","0"),o("100%","0"),o("0","100%")];t.after(s);let u;try{u=i.map(f=>{const p=f.getBoundingClientRect();return{x:p.x,y:p.y}})}finally{s.remove()}const[n,c,a]=u;if(!n||!c||!a)return;const l={x:c.x+a.x-n.x,y:c.y+a.y-n.y},y=[n.x,c.x,a.x,l.x],x=[n.y,c.y,a.y,l.y],h=(f,p,g)=>Math.abs(f-p)>Math.max(R.px,g*R.share);if(!(h(Math.min(...y),e.left,e.width)||h(Math.max(...y),e.right,e.width)||h(Math.min(...x),e.top,e.height)||h(Math.max(...x),e.bottom,e.height)))return{o:n,a:c,b:a}}const F=t=>Math.abs(t.a.y-t.o.y)<.5&&Math.abs(t.b.x-t.o.x)<.5,b={share:.008,least:3};function B(t){const e=t.ownerDocument.defaultView,r=Math.max(b.least,Math.min(e?.innerWidth??0,e?.innerHeight??0)*b.share);let d,s,o;const i=L(t),u=t instanceof SVGGraphicsElement?t.getScreenCTM():null;if(i)({o:d,a:s,b:o}=i);else if(t instanceof SVGGraphicsElement&&u){const n=t.getBBox(),c=getComputedStyle(t),a=c.stroke==="none"?0:(parseFloat(c.strokeWidth)||0)/2,l=(y,x)=>{const h=new DOMPoint(y,x).matrixTransform(u);return{x:h.x,y:h.y}};d=l(n.x-a,n.y-a),s=l(n.x+n.width+a,n.y-a),o=l(n.x-a,n.y+n.height+a)}else{const n=t.getBoundingClientRect();d={x:n.left,y:n.top},s={x:n.right,y:n.top},o={x:n.left,y:n.bottom}}return[W(d,s,o,r)]}function W(t,e,r,d){const s=(n,c)=>{const a=Math.hypot(c.x-n.x,c.y-n.y)||1;return{x:(c.x-n.x)/a*d,y:(c.y-n.y)/a*d}},o=s(t,e),i=s(t,r),u={x:e.x+r.x-t.x,y:e.y+r.y-t.y};return[{x:t.x-o.x-i.x,y:t.y-o.y-i.y},{x:e.x+o.x-i.x,y:e.y+o.y-i.y},{x:u.x+o.x+i.x,y:u.y+o.y+i.y},{x:r.x-o.x+i.x,y:r.y-o.y+i.y}]}function H(t){const e=t.ownerDocument.createRange();e.selectNodeContents(t);const r=[...e.getClientRects()].filter(o=>o.width>0&&o.height>0);if(r.length===0)return;const d=Math.min(...r.map(o=>o.left)),s=Math.min(...r.map(o=>o.top));return{x:d,y:s,width:Math.max(...r.map(o=>o.right))-d,height:Math.max(...r.map(o=>o.bottom))-s}}export function pickLayer(t,e){const r=t.createElement("style");r.textContent="* { pointer-events: auto !important; }",t.head.append(r);let d;try{d=t.elementsFromPoint(e.x,e.y)}finally{r.remove()}for(const s of d){const o=s.closest(".ak-footage"),i=o?.dataset.akFile;if(o&&i!==void 0){if(!v(o.querySelector("video")??o))continue;const w=m(o);return{part:o.dataset.akPart??"",layer:"footage",file:i,...w===void 0?{}:{piece:w},outline:B(o)}}const u=s.closest(".ak-layer");if(!u||!v(s)||!S(s))continue;let n=s;for(;n!==u&&n.parentElement&&getComputedStyle(n).display.startsWith("inline")&&!M(n);)n=n.parentElement;const c=M(n)?void 0:L(n),a=c!==void 0&&!F(c),l=M(n)||a?void 0:H(n),y=t.defaultView,x=l?[W({x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x,y:l.y+l.height},Math.max(b.least,Math.min(y?.innerWidth??0,y?.innerHeight??0)*b.share))]:B(n),h=u.getAttribute(C)??void 0,f=m(u),p=n.closest("[data-ak]")?.getAttribute("data-ak"),g=(n instanceof HTMLElement?n.innerText:n.textContent).trim().replace(/\s+/gu," ");return{part:u.closest(".ak-part")?.dataset.key??"",layer:u.dataset.component??"",...h===void 0||h===""?{}:{key:h},...f===void 0?{}:{piece:f},...p?{name:p}:{},...g===""?{}:{text:g.slice(0,E)},outline:x}}}
@@ -219,9 +219,22 @@ export interface LocatedLayer {
219
219
  part: string;
220
220
  /** Its component. */
221
221
  layer: string;
222
+ /** Its key in its part, where it has one (`data-ak-layer`). */
223
+ key?: string;
222
224
  /** Its `data-ak` name, when what is under the place has one. */
223
225
  name?: string;
224
226
  text?: string;
227
+ /** The file it shows (a footage's video), project-relative. */
228
+ file?: string;
229
+ /** The module it is written in, where another item's (a video drawn inside this one), project-relative. */
230
+ piece?: string;
231
+ }
232
+ /** The one layer a person picked at a point (docs/design/notes.md, "Select"): what it is, and its edge, closed rings of points. */
233
+ export interface PickedLayer extends LocatedLayer {
234
+ outline: {
235
+ x: number;
236
+ y: number;
237
+ }[][];
225
238
  }
226
239
  /** Where a player starts: a moment, or a part and how far into it (the same share of it when its length is no longer `dur`). */
227
240
  export interface PlayAt {
@@ -263,6 +276,11 @@ export interface StageBridge {
263
276
  play(options: PlayOptions): Promise<PlayControl>;
264
277
  /** What a person's mark is on, in shares of the stage. */
265
278
  locate(mark: NoteShape): LocatedLayer[];
279
+ /** The one thing in front at a point, with its edge, both in shares of the stage; none where nothing is drawn there. */
280
+ pick(at: {
281
+ x: number;
282
+ y: number;
283
+ }): PickedLayer | undefined;
266
284
  /**
267
285
  * An item's code as data, its module run and nothing drawn, as the
268
286
  * message its editor hears (a deck's DeckCode and theme), from the
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/piece",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {