@allyhub/sdk 0.12.0 → 0.14.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.
- package/CHANGELOG.md +13 -0
- package/dist/node_modules/@allyhub/audio/dist/plan.d.ts +3 -0
- package/dist/node_modules/@allyhub/audio/dist/render.js +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-file.d.ts +2 -0
- package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +3 -2
- package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +5 -12
- package/dist/node_modules/@allyhub/chart/dist/chart.js +2 -1
- package/dist/node_modules/@allyhub/chart/dist/color.d.ts +37 -0
- package/dist/node_modules/@allyhub/chart/dist/color.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +130 -0
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/gen.d.ts +3 -1
- package/dist/node_modules/@allyhub/formats/dist/data/gen.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +512 -166
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +2523 -136
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/files.d.ts +9 -2
- package/dist/node_modules/@allyhub/formats/dist/files.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +9 -0
- package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +931 -87
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/color.d.ts +11 -0
- package/dist/node_modules/@allyhub/ooxml/dist/color.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ext.d.ts +43 -0
- package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/index.d.ts +2 -1
- package/dist/node_modules/@allyhub/ooxml/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/transform.d.ts +13 -0
- package/dist/node_modules/@allyhub/ooxml/dist/transform.js +2 -0
- package/dist/node_modules/@allyhub/ooxml/package.json +5 -1
- package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +4 -4
- package/dist/node_modules/@allyhub/piece/dist/media.d.ts +2 -2
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +35 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +19 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +35 -20
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +3 -3
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +28 -2
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +73 -10
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +45 -9
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/annotations.d.ts +14 -0
- package/dist/node_modules/@allyhub/sheet/dist/annotations.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/rules.d.ts +24 -0
- package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/styles.d.ts +12 -0
- package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/arrange.d.ts +28 -1
- package/dist/node_modules/@allyhub/sheet/dist/arrange.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/data-tools.d.ts +42 -0
- package/dist/node_modules/@allyhub/sheet/dist/data-tools.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/edit.d.ts +43 -2
- package/dist/node_modules/@allyhub/sheet/dist/edit.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/fill.d.ts +10 -0
- package/dist/node_modules/@allyhub/sheet/dist/fill.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/filter.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.d.ts +14 -0
- package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
- package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +6 -1
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/outline.d.ts +30 -0
- package/dist/node_modules/@allyhub/sheet/dist/outline.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/rich.d.ts +29 -0
- package/dist/node_modules/@allyhub/sheet/dist/rich.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/rules.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-style.d.ts +6 -0
- package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +5 -1
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +17 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.d.ts +56 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +117 -21
- package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +181 -30
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +28 -2
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +222 -4
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +6 -0
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.d.ts +3 -0
- package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +3 -0
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +98 -10
- package/dist/node_modules/@allyhub/slides-core/dist/numbering.d.ts +6 -0
- package/dist/node_modules/@allyhub/slides-core/dist/numbering.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +53 -0
- package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/patterns.d.ts +8 -0
- package/dist/node_modules/@allyhub/slides-core/dist/patterns.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +36 -6
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/script.d.ts +11 -0
- package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/table-style.d.ts +48 -0
- package/dist/node_modules/@allyhub/slides-core/dist/table-style.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +4 -0
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/docs/defaults.md +78 -4
- package/docs/image.md +1 -1
- package/docs/pictures.md +1 -1
- package/docs/project.md +1 -1
- package/docs/sheets.md +19 -9
- package/docs/slides.md +30 -16
- package/docs/speech.md +1 -1
- 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"],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."})}})});
|
|
2
|
+
import{z as o}from"zod";import{SCRIPT_NAME as _}from"./script.js";const h=o.string().regex(_,"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","fly-in","float-in","split","wipe","zoom","disappear","fade-out","fly-out","float-out","split-out","wipe-out","zoom-out","pulse","grow-shrink","spin","transparency","path"],ANIMATE_TEXT=["word","letter"],ANIMATION_REPEATS=["until-next-click","until-end-of-slide"],ANIMATION_STARTS=["on-click","with-previous","after-previous"],ANIMATION_DIRECTIONS=["from-bottom","from-top","from-left","from-right","from-top-right","from-bottom-right","from-top-left","from-bottom-left","vertical-out","vertical-in","horizontal-out","horizontal-in","in","out","rotate","up","down","clockwise","counterclockwise","both","horizontal","vertical"],LINE_DASHES=["solid","sysDot","sysDash","dash","dashDot","lgDash","lgDashDot","lgDashDotDot","dot","sysDashDot","sysDashDotDot"],LINE_CAPS=["flat","rnd","sq"],LINE_JOINS=["round","bevel","miter"],LINE_COMPOUNDS=["sng","dbl","thickThin","thinThick","tri"],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()}),MAPPED_COLORS=["tx1","bg1","tx2","bg2"],COLOR_NAMES=[...THEME_COLORS,...MAPPED_COLORS],COLOR_TRANSFORMS=["tint","shade","lumMod","lumOff","lum","satMod","satOff","sat","hueMod","hueOff","hue","alpha","alphaMod","alphaOff"];const C=`(?:${COLOR_NAMES.join("|")})`,k=`(?:${COLOR_TRANSFORMS.join("|")}) -?\\d+(?:\\.\\d+)?(?:%|°)`,A=new RegExp(`^(${C}) (lighter|darker) (100(?:\\.0{1,3})?|[1-9]?\\d(?:\\.\\d{1,3})?)%$`,"u"),v=new RegExp(`^(${C}|#[0-9A-Fa-f]{6})((?: ${k})+)$`,"u"),O=/^#[0-9A-Fa-f]{6}$/u,g=t=>COLOR_NAMES.includes(t),E=t=>COLOR_TRANSFORMS.includes(t),y=new Set(["hue","hueOff"]);export function colorOfFile(t){if(g(t))return t;if(O.test(t))return{rgb:t.toUpperCase()};const e=v.exec(t);if(e){const[,l="",p=""]=e,m=[];for(const w of p.matchAll(/ (\w+) (-?[\d.]+)(%|°)/gu)){const[,u="",D="",x]=w;if(!E(u)||x==="°"!==y.has(u))return;const S=Number(D);m.push({name:u,value:x==="%"?Math.round(S*1e3)/1e5:S})}return g(l)?{theme_color:l,transforms:m}:{rgb:l.toUpperCase(),transforms:m}}const r=A.exec(t),[,n="",i,s=""]=r??[],a=Math.round(Number(s)*1e3);if(!(!r||!g(n)||a<=0||a>1e5))return{theme_color:n,brightness:(i==="lighter"?a:-a)/1e5}}const P=t=>y.has(t.name)?`${t.name} ${String(Math.round(t.value*1e3)/1e3)}°`:`${t.name} ${String(Math.round(t.value*1e5)/1e3)}%`;export function colorFile(t){if(typeof t=="string")return t;if("rgb"in t)return t.transforms&&t.transforms.length>0?`${t.rgb} ${t.transforms.map(P).join(" ")}`:t.rgb;if("transforms"in t)return t.transforms.length===0?t.theme_color:`${t.theme_color} ${t.transforms.map(P).join(" ")}`;const e=Math.round(Math.abs(t.brightness)*1e5)/1e3;return e===0?t.theme_color:`${t.theme_color} ${t.brightness>0?"lighter":"darker"} ${String(e)}%`}const d=`A colour is one of the theme's (${THEME_COLORS.join(", ")}) or the colour map's (${MAPPED_COLORS.join(", ")}), one of them lighter or darker by a share over 0 up to 100% ("accent1 lighter 40%", "dk1 darker 25%"), #RRGGBB, or one of them with DrawingML's transforms in order ("accent1 lumMod 75% lumOff 25%", "#4472C4 alpha 50%", "accent2 hueOff 30°": ${COLOR_TRANSFORMS.join(", ")}).`;export const ColorFileSchema=o.union([o.enum(COLOR_NAMES),o.string().regex(A,d),o.string().regex(O,d),o.string().regex(v,d)]).refine(t=>colorOfFile(t)!==void 0,d),NUMBERINGS=["alphaLcParenBoth","alphaUcParenBoth","alphaLcParenR","alphaUcParenR","alphaLcPeriod","alphaUcPeriod","arabicParenBoth","arabicParenR","arabicPeriod","arabicPlain","romanLcParenBoth","romanUcParenBoth","romanLcParenR","romanUcParenR","romanLcPeriod","romanUcPeriod","circleNumDbPlain","circleNumWdBlackPlain","circleNumWdWhitePlain","arabicDbPeriod","arabicDbPlain","ea1ChsPeriod","ea1ChsPlain","ea1ChtPeriod","ea1ChtPlain","ea1JpnChsDbPeriod","ea1JpnKorPlain","ea1JpnKorPeriod","arabic1Minus","arabic2Minus","hebrew2Minus","thaiAlphaPeriod","thaiAlphaParenR","thaiAlphaParenBoth","thaiNumPeriod","thaiNumParenR","thaiNumParenBoth","hindiAlphaPeriod","hindiNumPeriod","hindiNumParenR","hindiAlpha1Period"],UNDERLINES=["sng","dbl","heavy","dotted","dottedHeavy","dash","dashHeavy","dashLong","dashLongHeavy","dotDash","dotDashHeavy","dotDotDash","dotDotDashHeavy","wavy","wavyHeavy","wavyDbl","words"],STRIKES=["sngStrike","dblStrike"],CAPS=["all","small","none"],TEXT_ORIENTATIONS=["horz","vert","vert270","eaVert","wordArtVert","wordArtVertRtl","mongolianVert"],TEXT_ANCHORS=["t","ctr","b"],ParagraphSpaceSchema=o.union([o.number().min(0).max(1584),o.object({lines:o.number().min(0).max(100)})]),TextStyleSchema=o.strictObject({size:o.number().positive().max(4e3).optional(),bold:o.boolean().optional(),italic:o.boolean().optional(),underline:o.union([o.boolean(),o.enum(UNDERLINES)]).optional(),strike:o.union([o.boolean(),o.enum(STRIKES)]).optional(),caps:o.enum(CAPS).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:ParagraphSpaceSchema.optional(),space_after:ParagraphSpaceSchema.optional(),anchor:o.enum(TEXT_ANCHORS).optional(),orientation:o.enum(TEXT_ORIENTATIONS).optional(),bullet:o.union([o.literal(!1),o.string().min(1).max(2)]).optional(),numbered:o.enum(NUMBERINGS).optional(),bullet_color:ColorFileSchema.optional(),bullet_size:o.number().min(.25).max(4).optional(),start_at:o.int().min(1).max(32767).optional()});const T=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"}),b=o.lazy(()=>o.union([o.string(),o.number(),o.boolean(),o.null(),o.array(b),o.record(o.string(),b)]));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"],CHART_COMBINED_TYPES=["column-clustered","column-stacked","column-stacked-100","line","line-markers","area","area-stacked","area-stacked-100"];const f=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(),type:o.enum(CHART_COMBINED_TYPES).optional(),secondary:o.boolean().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:f.optional(),category_axis:f.optional(),secondary_axis:f.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 GRADIENT_PATHS=["circle","rect","shape"],GradientSchema=o.strictObject({angle:o.number().min(0).max(360).optional(),path:o.enum(GRADIENT_PATHS).optional(),focus:o.strictObject({left:o.number().optional(),top:o.number().optional(),right:o.number().optional(),bottom:o.number().optional()}).optional(),stops:o.array(o.strictObject({at:c,color:ColorFileSchema,transparency:c.optional()})).min(2).max(10)}),PATTERNS=["pct5","pct10","pct20","pct25","pct30","pct40","pct50","pct60","pct70","pct75","pct80","pct90","horz","vert","ltHorz","ltVert","dkHorz","dkVert","narHorz","narVert","dashHorz","dashVert","cross","dnDiag","upDiag","ltDnDiag","ltUpDiag","dkDnDiag","dkUpDiag","wdDnDiag","wdUpDiag","dashDnDiag","dashUpDiag","diagCross","smCheck","lgCheck","smGrid","lgGrid","dotGrid","smConfetti","lgConfetti","horzBrick","diagBrick","solidDmnd","openDmnd","dotDmnd","plaid","sphere","weave","divot","shingle","wave","trellis","zigZag"],PatternSchema=o.strictObject({preset:o.enum(PATTERNS),fg:ColorFileSchema.optional(),bg:ColorFileSchema.optional()}),TILE_ALIGNMENTS=["tl","t","tr","l","ctr","r","bl","b","br"],PictureFillSchema=o.strictObject({path:o.string().min(1),tile:o.strictObject({scale_x:o.number().positive().max(100).optional(),scale_y:o.number().positive().max(100).optional(),x:o.number().optional(),y:o.number().optional(),align:o.enum(TILE_ALIGNMENTS).optional()}).optional(),transparency:c.optional()}),BackgroundSchema=o.strictObject({fill:ColorFileSchema.optional(),gradient:GradientSchema.optional(),picture:o.string().min(1).optional()}).refine(t=>[t.fill,t.gradient,t.picture].filter(e=>e!==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()}),InnerShadowSchema=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()}),GlowSchema=o.strictObject({color:ColorFileSchema.optional(),size:o.number().min(0).max(150).optional(),transparency:c.optional()}),ReflectionSchema=o.strictObject({transparency:c.optional(),size:c.optional(),distance:o.number().min(0).max(100).optional(),blur:o.number().min(0).max(100).optional()});const R=o.union([o.strictObject({shape:o.string().min(1),site:o.int().min(0)}),o.literal("none")]);export const MergedCellsSchema=o.object({row:o.int().min(0),column:o.int().min(0),rows:o.int().min(1).optional(),columns:o.int().min(1).optional()});function N(t,e,r,n){const i=t.rows??1,s=t.columns??1;if(i*s<2)return"A merge takes two cells or more.";if(t.row+i>e||t.column+s>r)return`A merge from row ${String(t.row)}, column ${String(t.column)} goes past the table's ${String(e)} rows and ${String(r)} columns.`;for(let a=t.row;a<t.row+i;a++)for(let l=t.column;l<t.column+s;l++){const p=`${String(a)},${String(l)}`;if(n.has(p))return`Two merges take the cell at row ${String(a)}, column ${String(l)}.`;n.add(p)}}export const MEDIA_STARTS=["auto","on-click"],PlaybackSchema=o.strictObject({start:o.enum(MEDIA_STARTS).optional(),trim:o.strictObject({start:o.number().min(0).optional(),end:o.number().positive().optional()}).refine(t=>t.start===void 0||t.end===void 0||t.end>t.start,{message:"A trim ends after it starts."}).optional(),loop:o.boolean().optional(),volume:o.number().min(0).max(1).optional(),fullscreen:o.boolean().optional(),hide:o.boolean().optional()}),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:R.optional(),end:R.optional()}).optional(),z:o.int().optional(),fill:o.union([ColorFileSchema,o.literal("none")]).optional(),fill_transparency:c.optional(),gradient:GradientSchema.optional(),pattern:PatternSchema.optional(),picture_fill:PictureFillSchema.optional(),shadow:ShadowSchema.optional(),inner_shadow:InnerShadowSchema.optional(),glow:GlowSchema.optional(),soft_edges:o.number().positive().max(100).optional(),reflection:ReflectionSchema.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_cap:o.enum(LINE_CAPS).optional(),line_join:o.enum(LINE_JOINS).optional(),line_compound:o.enum(LINE_COMPOUNDS).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:T.optional(),movie:o.string().min(1).optional(),audio:o.string().min(1).optional(),poster:o.number().min(0).optional(),playback:PlaybackSchema.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),merged:o.array(MergedCellsSchema).optional(),style:o.string().min(1).optional(),first_row:o.boolean().optional(),last_row:o.boolean().optional(),first_col:o.boolean().optional(),last_col:o.boolean().optional(),horz_banding:o.boolean().optional(),vert_banding:o.boolean().optional()}).superRefine((t,e)=>{const r=new Set;(t.merged??[]).forEach((n,i)=>{const s=N(n,t.rows.length,t.columns.length,r);s!==void 0&&e.addIssue({code:"custom",path:["merged",i],message:s})})}).optional(),chart:ChartSchema.optional(),link:o.string().trim().min(1).optional(),group:o.string().regex(/^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/u,"A group is a name of letters, digits, _ and -; a group in a group is outer/inner.").optional(),locked:o.literal(!0).optional(),component:o.union([h,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(),b).optional(),dur:o.number().positive().optional()}),groupLevels=t=>t.split("/").map((e,r,n)=>n.slice(0,r+1).join("/")),inGroup=(t,e)=>t!==void 0&&(t===e||t.startsWith(`${e}/`)),SHOW_JUMPS=["firstslide","lastslide","nextslide","previousslide","endshow"],showJumpLink=t=>`ppaction://hlinkshowjump?jump=${t}`;export function showJumpOf(t){const e=/^ppaction:\/\/hlinkshowjump\?jump=([a-z]+)$/u.exec(t);return SHOW_JUMPS.find(r=>r===e?.[1])}export const slideLinkOf=t=>t.startsWith("#")&&t.length>1?t.slice(1):void 0,SHAPE_KINDS=["textbox","picture","movie","audio","geometry","path","table","chart","component"],SLIDE_TRANSITIONS=["fade","push","wipe","split","reveal","cut","cover","uncover","zoom","morph"],TransitionSchema=o.strictObject({type:o.enum(SLIDE_TRANSITIONS),direction:o.enum(ANIMATION_DIRECTIONS).optional(),through_black:o.literal(!0).optional(),duration:o.number().min(0).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(),amount:o.number().positive().max(36e3).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(),animate_text:o.enum(ANIMATE_TEXT).optional(),text_delay:o.number().min(0).max(100).optional(),repeat:o.union([o.number().min(1).max(1e4),o.enum(ANIMATION_REPEATS)]).optional(),rewind:o.literal(!0).optional()}),SlideSchema=o.strictObject({id:h,layout:o.string().min(1).optional(),generate:h.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(),section:o.string().trim().min(1).max(255).optional()}),SlidesFileSchema=o.strictObject({slides:o.array(SlideSchema).default([])}).superRefine((t,e)=>{const r=new Set;t.slides.forEach((n,i)=>{r.has(n.id)&&e.addIssue({code:"custom",path:["slides",i,"id"],message:`Two slides are "${n.id}".`}),r.add(n.id),(n.layout===void 0?0:1)+(n.generate===void 0?0:1)!==1&&e.addIssue({code:"custom",path:["slides",i],message:`Slide ${n.id} has a layout or a generator: one of them.`}),n.hidden!==void 0&&n.generate===void 0&&n.hidden!==!0&&e.addIssue({code:"custom",path:["slides",i,"hidden"],message:`Slide ${n.id} is hidden (true); a list of ids is a generated block's.`});for(const[a,l]of Object.entries(n.shapes??{})){const p=SHAPE_KINDS.filter(u=>l[u]!==void 0);p.length>1&&e.addIssue({code:"custom",path:["slides",i,"shapes",a],message:`Shape ${a} is one kind of shape, not ${p.join(" and ")}.`});const m=a.includes("/")?a.split("/"):[a];(!(m.length<=2&&m.every(u=>_.test(u)))||m.length===2&&n.generate===void 0)&&e.addIssue({code:"custom",path:["slides",i,"shapes",a],message:"A shape's name is letters, digits, _ and -; <slide>/<shape> only in a generated block."})}})});
|
|
@@ -17,6 +17,12 @@ export interface FileEditorSpec {
|
|
|
17
17
|
readonly icon?: string | undefined;
|
|
18
18
|
/** Its colour, a token of the UI kit's. */
|
|
19
19
|
readonly color?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Whether it opens the files its patterns match by default, or only when
|
|
22
|
+
* no default editor's do (VS Code's "Reopen With"): a text editor of any
|
|
23
|
+
* file opens a canvas only when asked; none is `default`.
|
|
24
|
+
*/
|
|
25
|
+
readonly priority?: "default" | "option" | undefined;
|
|
20
26
|
/**
|
|
21
27
|
* Its check module, where the check imports it from (its contribution's
|
|
22
28
|
* `check`, resolved against its extension's folder): its default export
|
|
@@ -37,10 +43,11 @@ export interface EditorFile {
|
|
|
37
43
|
* A glob pattern as a test of project paths, as VS Code's file patterns
|
|
38
44
|
* read: `*` is any run of characters but `/`, `?` one of them, `**` any
|
|
39
45
|
* run of folders (none among them), `{a,b}` either; a pattern with no `/`
|
|
40
|
-
* matches a file's name in any folder (`*.canvas` as `**\/*.canvas`)
|
|
46
|
+
* matches a file's name in any folder (`*.canvas` as `**\/*.canvas`);
|
|
47
|
+
* whatever the case of its letters.
|
|
41
48
|
*/
|
|
42
49
|
export declare function globTest(pattern: string): (path: string) => boolean;
|
|
43
|
-
/** The editor that opens a project path by its name, in a table: the first whose pattern matches. */
|
|
50
|
+
/** The editor that opens a project path by its name, in a table: the first whose pattern matches, an editor of its files by default before one that opens them only when asked. */
|
|
44
51
|
export declare function fileEditorIn(table: FileEditorTable, path: string): FileEditorSpec | undefined;
|
|
45
52
|
/**
|
|
46
53
|
* The files of a project the editors of `table` open by their names, in
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{unscanned as
|
|
2
|
+
import{unscanned as u}from"./layout.js";const l=/[.+^${}()|[\]\\]/gu;export function globTest(i){const e=i.includes("/")?i:`**/${i}`;let s="";for(let t=0;t<e.length;t++){const o=e.charAt(t);if(o==="*"&&e.charAt(t+1)==="*"){const n=e.charAt(t+2)==="/";s+=n?"(?:[^/]+/)*":".*",t+=n?2:1}else if(o==="*")s+="[^/]*";else if(o==="?")s+="[^/]";else if(o==="{"){const n=e.indexOf("}",t);n<0?s+="\\{":(s+=`(?:${e.slice(t+1,n).split(",").map(c=>c.replace(l,"\\$&").replaceAll("*","[^/]*")).join("|")})`,t=n)}else s+=o.replace(l,"\\$&")}const r=new RegExp(`^${s}$`,"iu");return t=>r.test(t)}const f=i=>i.priority==="option",p=i=>[...i.filter(e=>!f(e)),...i.filter(f)];export function fileEditorIn(i,e){return p(i).find(s=>s.files.some(r=>globTest(r)(e)))}export function scanFiles(i,e){if(e.length===0)return[];const s=p(e).map(t=>({id:t.id,tests:t.files.map(globTest)})),r=[];for(const t of[...i].filter(o=>!u(o)).sort()){const o=s.find(n=>n.tests.some(c=>c(t)));o&&r.push({path:t,editor:o.id})}return r}
|
|
@@ -56,4 +56,13 @@ export declare function mapOutline(outline: readonly (readonly NotePoint[])[], m
|
|
|
56
56
|
export declare function outlineBox(outline: readonly (readonly NotePoint[])[]): NoteBox;
|
|
57
57
|
/** Whether a point is inside an outline: inside one of its rings (the even-odd rule a ring). */
|
|
58
58
|
export declare function insideOutline(outline: readonly (readonly NotePoint[])[], p: NotePoint): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* A mark as SVG path data, its points mapped (into the pixels of what it is
|
|
61
|
+
* on: a board, a picture), and whether it holds an area: a region a tool
|
|
62
|
+
* that takes a mask is handed (`NoteRegion`).
|
|
63
|
+
*/
|
|
64
|
+
export declare function shapePath(shape: NoteShape, map: (p: NotePoint) => NotePoint): {
|
|
65
|
+
path: string;
|
|
66
|
+
area: boolean;
|
|
67
|
+
};
|
|
59
68
|
//# 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 O=6,P=.85,I=.25,S=40,k=12,
|
|
2
|
+
const O=6,P=.85,I=.25,S=40,k=12,f=(t,n,r)=>Math.min(r,Math.max(n,t));function a(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}=a(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 w(t,n){const r=t.width/2||1,c=t.height/2||1,o=t.x+r,e=t.y+c,i=(f(o,n.x,n.x+n.width)-o)/r,s=(f(e,n.y,n.y+n.height)-e)/c;return Math.hypot(i,s)<=.85}function $(t,n,r){const c=n.x-t.x,o=n.y-t.y;let e=0,i=1;for(const[s,u]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(u<0)return!1}else s<0?e=Math.max(e,u/s):i=Math.min(i,u/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 w(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)?w(a(t.points),n):t.points.some((r,c)=>$(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 T(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=f(Math.ceil(r/40)+1,2,12);return Array.from({length:c},(o,e)=>{let i=r*e/(c-1);for(const[s,u]of t.entries()){const x=n[s]??0,h=t[s-1];if(h&&i<=x){const M=x===0?0:i/x;return{x:h.x+(u.x-h.x)*M,y:h.y+(u.y-h.y)*M}}i-=x}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(a(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),o=Math.sin(r),e=t.x+t.width/2,i=t.y+t.height/2;return rectOutline(t).map(s=>s.map(u=>({x:e+(u.x-e)*c-(u.y-i)*o,y:i+(u.x-e)*o+(u.y-i)*c})))}const g=48;export function roundOutline(t){const n=t.width/2,r=t.height/2;return[Array.from({length:g},(c,o)=>{const e=2*Math.PI*o/g;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 a(t.flat())}export function insideOutline(t,n){return t.some(r=>{let c=!1;for(let o=0,e=r.length-1;o<r.length;e=o++){const i=r[o],s=r[e];!i||!s||i.y>n.y!=s.y>n.y&&n.x<(s.x-i.x)*(n.y-i.y)/(s.y-i.y)+i.x&&(c=!c)}return c})}const y=t=>String(Math.round(t*10)/10);export function shapePath(t,n){switch(t.kind){case"box":{const r=n({x:t.rect.x,y:t.rect.y}),c=n({x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height});return{path:`M ${y(r.x)} ${y(r.y)} H ${y(c.x)} V ${y(c.y)} H ${y(r.x)} Z`,area:!0}}case"round":{const r=n({x:t.rect.x,y:t.rect.y}),c=n({x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height}),o=Math.abs(c.x-r.x)/2,e=Math.abs(c.y-r.y)/2,i=(r.y+c.y)/2,s=Math.min(r.x,c.x);return{path:`M ${y(s)} ${y(i)} A ${y(o)} ${y(e)} 0 1 0 ${y(s+2*o)} ${y(i)} A ${y(o)} ${y(e)} 0 1 0 ${y(s)} ${y(i)} Z`,area:!0}}case"arrow":{const r=n(t.from),c=n(t.to);return{path:`M ${y(r.x)} ${y(r.y)} L ${y(c.x)} ${y(c.y)}`,area:!1}}case"line":{const r=t.points.map(n),c=r.length>2&&l(r);return{path:r.map((o,e)=>`${e===0?"M":"L"} ${y(o.x)} ${y(o.y)}`).join(" ")+(c?" Z":""),area:c}}}}
|