@allyhub/sdk 0.9.0 → 0.10.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 (134) hide show
  1. package/CHANGELOG.md +8 -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/package.json +1 -1
  9. package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
  10. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +87 -1
  11. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  12. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +89 -0
  13. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  14. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +50 -0
  15. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  16. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  17. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  18. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  19. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  20. package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
  21. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  22. package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +16 -0
  23. package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
  24. package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +6 -0
  25. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  26. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +132 -0
  27. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  28. package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
  29. package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
  30. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +337 -0
  31. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +2 -0
  32. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +153 -0
  33. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  34. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +4 -2
  35. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  36. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +43 -188
  37. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  38. package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +1 -0
  39. package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
  40. package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +1 -0
  41. package/dist/node_modules/@allyhub/protocol/dist/mail.js +1 -1
  42. package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +51 -91
  43. package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
  44. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +3 -3
  45. package/dist/node_modules/@allyhub/protocol/package.json +5 -1
  46. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  47. package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
  48. package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
  49. package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
  50. package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
  51. package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
  52. package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
  53. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  54. package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
  55. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.d.ts +70 -0
  56. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
  57. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.d.ts +6 -0
  58. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
  59. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
  60. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.d.ts +3 -1
  61. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.js +1 -1
  62. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
  63. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/kernels.js +1 -1
  64. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
  65. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/maths.js +1 -1
  66. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
  67. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.d.ts +9 -0
  68. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/calc/types.d.ts +6 -0
  70. package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
  71. package/dist/node_modules/@allyhub/sheet/dist/chart.d.ts +9 -0
  72. package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
  73. package/dist/node_modules/@allyhub/sheet/dist/formula/ast.d.ts +12 -1
  74. package/dist/node_modules/@allyhub/sheet/dist/formula/move.d.ts +5 -1
  75. package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
  76. package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
  77. package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
  78. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +2 -1
  79. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  80. package/dist/node_modules/@allyhub/sheet/dist/inspect.d.ts +12 -2
  81. package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/printed.d.ts +19 -0
  83. package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
  84. package/dist/node_modules/@allyhub/sheet/dist/values.d.ts +2 -0
  85. package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
  86. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +2 -0
  87. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  88. package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
  89. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.d.ts +6 -2
  90. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  91. package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
  92. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.d.ts +0 -1
  93. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  94. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +3 -1
  95. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  96. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.d.ts +7 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.js +3 -1
  98. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  99. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.d.ts +1 -1
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.d.ts +12 -1
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.js +3 -2
  104. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  105. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +57 -7
  106. package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
  107. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  108. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +24 -0
  109. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  110. package/dist/node_modules/@allyhub/slides-core/dist/fact.d.ts +15 -0
  111. package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
  112. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +6 -2
  113. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +3 -1
  114. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  115. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  116. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  117. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  118. package/dist/node_modules/@allyhub/video-core/dist/piece.d.ts +2 -2
  119. package/dist/node_modules/@allyhub/video-core/dist/schema.d.ts +2 -2
  120. package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
  121. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  122. package/dist/node_modules/@allyhub/video-sdk/dist/phone.d.ts +12 -5
  123. package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +1 -1
  124. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  125. package/docs/README.md +2 -0
  126. package/docs/canvas.md +28 -0
  127. package/docs/defaults.md +20 -2
  128. package/docs/docs.md +8 -8
  129. package/docs/scenery.md +3 -4
  130. package/docs/sheets.md +22 -5
  131. package/docs/slides.md +50 -4
  132. package/docs/speech.md +1 -1
  133. package/docs/x.md +73 -0
  134. package/package.json +1 -1
package/docs/slides.md CHANGED
@@ -101,7 +101,7 @@ slides:
101
101
  | `script` | none | Its script, from the module's folder, with `{locale}` once in its name for each language (`./deck.{locale}.yaml`) |
102
102
  | `size` | `"16:9"` | A slide size by name (`16:9`, `16:10`, `4:3` as PowerPoint's; `a4`, `a4-portrait`, `letter`, `letter-portrait` the paper's own; a carousel is an image, [image.md](image.md)) or `{ width, height }` in EMU |
103
103
  | `title` | none | Its name for people, what lists show it by |
104
- | `theme` | the project's look's colours, standard fonts | `{ colors, fonts }`: theme colours by PresentationML's names (`dk1`, `lt1`, `dk2`, `lt2`, `accent1`…`accent6`, `hlink`, `folHlink`), over the project's look (`dk1` its foreground, `lt1` its background, `accent1` its accent); fonts (`major`, `minor`, `major_east_asian`, `minor_east_asian`, and `code`, Courier New unless set, which the script's `` `code` `` is set in: PowerPoint's theme has no such font, so in the file it is a run's own), Arial and Microsoft YaHei unless set: fonts every PowerPoint, Keynote and Google Slides has, drawn here by fonts of the same metrics (Arimo, Noto Sans SC), so a line breaks in the file where it breaks here. Any other font the config's `fonts` lists goes in the PowerPoint file, a face each for regular, bold, italic and bold italic, unless its own licence bits (`fsType`) forbid it or it is a variable font; `allyhub render` says what did not go in. An app that does not read a file's fonts replaces them, and its lines may break elsewhere. A font named with no file the stage has is AK-L006 |
104
+ | `theme` | the project's look's colours, standard fonts | `{ colors, fonts }`: theme colours by PresentationML's names (`dk1`, `lt1`, `dk2`, `lt2`, `accent1`…`accent6`, `hlink`, `folHlink`), over the project's look (`dk1` its foreground, `lt1` its background, `accent1` its accent); fonts (`major`, `minor`, `major_east_asian`, `minor_east_asian`, and `code`, Courier New unless set, which the script's `` `code` `` is set in: PowerPoint's theme has no such font, so in the file it is a run's own), Arial and Microsoft YaHei unless set: fonts every PowerPoint, Keynote and Google Slides has. These and Calibri, Times New Roman, Cambria and Courier New are drawn here by fonts of the same metrics (Arimo, Noto Sans SC, Carlito, Tinos, Caladea, Cousine), so a line breaks in the file where it breaks here. Any other font the config's `fonts` lists goes in the PowerPoint file, a face each for regular, bold, italic and bold italic, unless its own licence bits (`fsType`) forbid it or it is a variable font; `allyhub render` says what did not go in. An app that does not read a file's fonts replaces them, and its lines may break elsewhere. A font named with no file the stage has is AK-L006 |
105
105
 
106
106
  ## Masters, layouts and placeholders
107
107
 
@@ -110,8 +110,12 @@ python-pptx opens these from a template; here code makes them.
110
110
  - `prs.slide_masters.add(name)`: a master, with PowerPoint's Office text styles (`master.text_styles.title_style`, `body_style`, `other_style`, nine levels each) and no placeholders yet.
111
111
  - `master.slide_layouts.add(name)`: a layout; its name is what the slides file's slides name, unique in the deck.
112
112
  - `placeholders.add(PP_PLACEHOLDER.X, left, top, width, height, { name })` on a master or a layout. A layout's placeholder given no frame takes its master's of its base type, as python-pptx reads it (a centre title the title's, a subtitle, picture, media or object the body's). Its name is its type's (`title`, `subtitle`, `body`, `picture`, `content`…) unless given: the slides file and the script name it. Its idx is PowerPoint's: a title 0, a date, footer and slide number 10, 11 and 12, the rest from 1.
113
- - Beyond python-pptx's `add_shape` and `add_connector` (`MSO_CONNECTOR.STRAIGHT`, `ELBOW`, `CURVE`, or a connector's preset by name, `straightConnector1`, `bentConnector2` to `5`, `curvedConnector2` to `5`; an elbow's middle is its `adjustments[0]`; `begin_connect(shape, site)` and `end_connect` glue its ends to a shape of the same slide, layout or master, at a site of the shape's geometry, a rectangle's 0 top, 1 left, 2 bottom, 3 right, and its ends then follow the shape; `begin_x`, `begin_y`, `end_x` and `end_y` read and move them), `shapes.build_freeform()` draws an outline (`add_line_segments`, `move_to`, `convert_to_shape`, and `add_curve_segment`, a cubic curve python-pptx lacks); `line.dash_style` takes `MSO_LINE`, and `line.begin_arrow` and `end_arrow` take `MSO_ARROWHEAD`; `shapes.add_group_shape()` groups what is added to its `.shapes`, and a group is its shapes, listed and drawn as they are, holding no group; `shapes.add_table(rows, cols, left, top, width, height).table` has `cell(r, c)` with `text`, `text_frame`, `fill`, `borders` (`{ bottom: { color, width } }`), `merge`, margins and `vertical_anchor`. `layout.display_master_shapes = false` hides its master's shapes.
114
- - A placeholder shrinks its text to fit its frame unless told not to (`MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE`, as PowerPoint's Office master's do; `text_frame.auto_size = MSO_AUTO_SIZE.NONE` keeps its sizes), and the type in use shows what it shrank to. A text box `add_textbox` makes does not wrap and grows to its text, as python-pptx's; a shape `add_shape` makes starts with one centred paragraph, and `text_frame.text` replaces it with paragraphs aligned as the text style says (left), as python-pptx's.
113
+ - Beyond python-pptx's `add_shape` and `add_connector` (`MSO_CONNECTOR.STRAIGHT`, `ELBOW`, `CURVE`, or a connector's preset by name, `straightConnector1`, `bentConnector2` to `5`, `curvedConnector2` to `5`; an elbow's middle is its `adjustments[0]`; `begin_connect(shape, site)` and `end_connect` glue its ends to a shape of the same slide, layout or master, at a site of the shape's geometry, numbered as its preset's `cxnLst` in ECMA-376 (most count counter-clockwise from the top: a rectangle's, a rounded rectangle's, a diamond's and a freeform's 0 top, 1 left, 2 bottom, 3 right; an ellipse's eight 0 top, 2 left, 4 bottom, 6 right; a hexagon's six start at its right), and its ends then follow the shape; `begin_x`, `begin_y`, `end_x` and `end_y` read and move them), `shapes.build_freeform(start_x, start_y, scale)` draws an outline in local units, `scale` EMU each, its start and every point after in those units (with `scale` 1 they are EMU) (`add_line_segments(vertices, close)`, which closes the outline back to its start unless `close` is `false`, as python-pptx's; `move_to`, `convert_to_shape`, and `add_curve_segment(x1, y1, x2, y2, x, y)`, a cubic curve python-pptx lacks), filled by its style as PowerPoint fills it, an open one too: `fill.background()` leaves a line; `line.dash_style` takes `MSO_LINE`, and `line.begin_arrow` and `end_arrow` take `MSO_ARROWHEAD`, each head's size `line.begin_arrow_width`, `begin_arrow_length`, `end_arrow_width` and `end_arrow_length` `MSO_ARROWHEAD_SIZE` (`SMALL`, `MEDIUM`, `LARGE`: two, three and five times the line's width, never less than 0.7 mm's; a freeform's open ends take heads too); `shapes.add_group_shape()` groups what is added to its `.shapes`, and a group is its shapes, listed and drawn as they are, holding no group; `shapes.add_table(rows, cols, left, top, width, height).table` has `cell(r, c)` with `text`, `text_frame`, `fill`, `borders` (`{ bottom: { color, width } }`), `merge`, margins and `vertical_anchor`. `layout.display_master_shapes = false` hides its master's shapes.
114
+ - A placeholder shrinks its text to fit its frame unless told not to (`MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE`, as PowerPoint's Office master's do; `text_frame.auto_size = MSO_AUTO_SIZE.NONE` keeps its sizes), and the type in use shows what it shrank to. A text box `add_textbox` makes does not wrap and grows to its text, as python-pptx's, so its frame has no room for its `vertical_anchor` to move it (`text_frame.auto_size = MSO_AUTO_SIZE.NONE` keeps the frame it was given); a shape `add_shape` makes starts with one centred paragraph, its text light 1 (white, on its accent 1 fill) by its style as PowerPoint's (a run's `font.color` sets its own), and `text_frame.text` replaces it with paragraphs aligned as the text style says (left), as python-pptx's.
115
+ - A run's `font.baseline` raises it by a share of its size (`0.3`, a superscript) or, below 0, lowers it (`-0.25`, a subscript): PowerPoint's `baseline`, which python-pptx has no name for.
116
+ - `shape.adjustments[i]` is the file's value over 100,000, as python-pptx's: most are a share of the shape's shorter side (`roundRect`'s `[0.16667]`); an angle's is in 60,000ths of a degree, so 0.6 a degree (`blockArc`'s first, 108, is 180°, measured clockwise from 3 o'clock). Reading `adjustments` gives a preset's defaults, each in its own scale.
117
+ - A colour in code is python-pptx's `ColorFormat`: `shape.fill.solid()` then `shape.fill.fore_color.rgb = RGBColor.from_string("1F4E79")` (or `"#1F4E79"`), `.theme_color = MSO_THEME_COLOR.ACCENT_1`, and the same on `line.color` and a run's `font.color`; a gradient's stops are each `color` and `position`, or set whole as `fill.gradient_stops = [{ at, color }, …]`.
118
+ - A shape is named by its kind and a number (`shape-3`) unless code names it; two shapes of one slide by one name are AK-M011, as the slides file and the script find a shape by its name.
115
119
  - A text style is a list style's level, `ListLevel`: `alignment`, `line_spacing`, `space_before`, `space_after`, `font` (with `font.spacing`, the space between letters, a length, negative to tighten, which python-pptx has no name for), `bullet` (a character, or `null` for none), `bullet_font`, `margin_left`, `indent`. No bullet keeps the level's `margin_left` and `indent`, as PowerPoint's `a:buNone` does: Office's body levels hang their wrapped lines a quarter inch in, so text with no bullets sets both to `0` to stand flush. A placeholder's `text_frame.list_style[n]` is what the text a slide gives it takes at level n, over its master's placeholder and its master's text style for its type.
116
120
 
117
121
  ## Components
@@ -122,6 +126,48 @@ python-pptx opens these from a template; here code makes them.
122
126
 
123
127
  `prs.generators.add(name, (g) => { … })` makes slides from data: `g.data(path)` reads a data file (CSV rows, YAML, JSON) from the module's folder; `g.slides.add_slide(layout, id)` adds a slide on a layout (an object, or a name) with its id in the block, and the slide is python-pptx's (`shapes.title`, `placeholders[idx]`, `shapes.add_*`, `notes_slide.notes_text_frame.text`). A generated slide's words are its code's (from its data), not the script's. The slides file places the block as `- id: stories, generate: name`; its slide is `stories/<id>`, hidden by `hidden: [<id>]`, and a shape on it is changed as `shapes: { <id>/<shape>: … }`.
124
128
 
129
+ A slide drawn whole by code, a diagram, is one generator's slide. The deck is then three files: its module, its slides file placing the generator's block, and its script, which still has its file (with `{locale}` in its name, one language or many), with no rows (`slides: []`):
130
+
131
+ ```ts file=figure/figure.ts
132
+ import {
133
+ MSO_ARROWHEAD,
134
+ MSO_CONNECTOR,
135
+ MSO_SHAPE,
136
+ Pt,
137
+ presentation,
138
+ } from "@allyhub/sdk/slides";
139
+
140
+ export default presentation(
141
+ { slides: "./figure.yaml", script: "./figure.{locale}.yaml" },
142
+ (prs) => {
143
+ prs.slide_masters.add("Blank").slide_layouts.add("Blank");
144
+ prs.generators.add("figure", (g) => {
145
+ const slide = g.slides.add_slide("Blank", "flow");
146
+ const a = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Pt(60), Pt(120), Pt(160), Pt(60));
147
+ a.text_frame.text = "Encoder";
148
+ const b = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Pt(360), Pt(120), Pt(160), Pt(60));
149
+ b.text_frame.text = "Decoder";
150
+ const c = slide.shapes.add_connector(MSO_CONNECTOR.STRAIGHT, 0, 0, Pt(1), 0);
151
+ c.begin_connect(a, 3);
152
+ c.end_connect(b, 1);
153
+ c.line.end_arrow = MSO_ARROWHEAD.TRIANGLE;
154
+ });
155
+ },
156
+ );
157
+ ```
158
+
159
+ ```yaml
160
+ # figure/figure.yaml
161
+ slides:
162
+ - id: figure
163
+ generate: figure
164
+ ```
165
+
166
+ ```yaml
167
+ # figure/figure.en.yaml
168
+ slides: []
169
+ ```
170
+
125
171
  ## The slides file
126
172
 
127
173
  | Field | What it is |
@@ -133,7 +179,7 @@ python-pptx opens these from a template; here code makes them.
133
179
  | `slides[].shapes` | Its shapes by name: what it changes of its layout's placeholders, and its own |
134
180
  | `slides[].background` | Its own background over its layout's: one of `fill` (a colour), `gradient` (as a shape's) or `picture` (a file, stretched over the slide) |
135
181
 
136
- A shape there changes a placeholder of the slide's layout (or a generated shape) with `frame` (`{ x, y, w, h }` in points), `text` (on all of its text, every level, as PowerPoint sets a selected shape's: `size` in points, `bold`, `italic`, `underline`, `strike`, `color`, `font`, a family, `align`: `l`, `ctr`, `r`, `just`, `line_spacing`, a multiple of single spacing, `1.5`, `space_before` and `space_after` in points, `anchor`, where the text stands in its shape: `t`, `ctr`, `b`, `bullet`, a character, `"•"`, or `false` for none, `numbered`, its paragraphs counted in place of a bullet: `arabicPeriod`, `arabicParenR`, `alphaLcPeriod`, `alphaUcPeriod`, `romanLcPeriod`, `romanUcPeriod`; given both, `numbered` stands; a bullet or a number in text with no indent hangs as PowerPoint's does), `fill` (a colour, or `none`), `fill_transparency` (a share that shows through), `gradient` (`angle`, degrees clockwise from left to right, and `stops`, each `at`, a share of the way, `color` and `transparency`), `shadow` (`blur` and `distance` in points, `angle`, `color`, `transparency`), `line` (its outline: a colour, or `none`), `line_width` in points, `line_dash` (`solid`, `sysDash`, `sysDot`, `dash`, `dashDot`, `lgDash`, `lgDashDot`, `lgDashDotDot`), `line_begin` and `line_end` (`none`, `triangle`, `arrow`, `stealth`, `diamond`, `oval`), `rotation` (degrees clockwise about its centre, 0 up to 360, python-pptx's `rotation`), `flip_h` and `flip_v` (`true`: mirrored left to right, top to bottom; a line runs from its frame's other corner; its text reads as it is), `crop` (a picture's: `left`, `top`, `right` and `bottom`, the share of it cut from each side, PowerPoint's `a:srcRect`; a negative share is space left beside it; the editor's Crop menu writes Fill and Fit, [pictures.md](pictures.md#a-decks-pictures)), `z`; or is the slide's own with one of `textbox: true` (its words are the script's; it wraps and grows to its text), `picture`, `movie` (a video file of the project; a video item goes on a slide as its render, `allyhub render`), `geometry` (any of PowerPoint's 187 preset shapes by its `prst` name, ECMA-376's `ST_ShapeType`: `rect`, `roundRect`, `ellipse`, `triangle`, `star5`, `chevron`, `rightArrow`, `wedgeRectCallout`, `heart`, `cloud`, `donut`, `flowChartProcess`…, drawn from ECMA-376's preset shape definitions as PowerPoint draws them; a connector, `line`, `straightConnector1`, `bentConnector2` to `5` or `curvedConnector2` to `5`, has the connector's line, no fill and no text, and its `line_begin` and `line_end` face along its path, and `connect: { begin: { shape, site }, end: { shape, site } }` glues its ends to shapes of the slide by name, at sites of their geometries (a rectangle's 0 top, 1 left, 2 bottom, 3 right; PowerPoint's `a:stCxn` and `a:endCxn`): its frame is then where its ends sit, and they follow the shapes; `none` lets go of an end the code glued, as dragging the end off its shape does; with `adjustments`, its handles' values in the definition's order as python-pptx's `adjustments` has them, a share each: `roundRect`'s `[0.1]` is a corner of a tenth of its shorter side), `path` (a freeform: `{ w, h, d }`, its outline in a box of `w` × `h` units stretched to its frame, `d` in SVG's `M`, `L`, `C` and `Z`, absolute, so a logo or a cursor is a real shape), `table` (`columns`, widths in points, and `rows`, each a `height` with its `fill`, `text` and `line`, a rule at its foot; stretched to its frame, its words the script's, a list of rows, each a list of cells) or `component` (with `props`, and `dur`, how long it moves), and a `frame`. `group`, a name a slide's own shapes share, makes them one group in PowerPoint, standing together where the topmost of them stands. A table here has no style of its own, unlike python-pptx's: its look is what its rows and cells say. A picture or a movie put in a picture, media or object placeholder fills it. Colours are the theme's (`accent1`…); the theme's lighter or darker, in PowerPoint's words (`accent1 lighter 40%`, `dk1 darker 25%`, a share over 0 up to 100 %), which follows a change of theme as PowerPoint's picker's tints and shades do; or `#RRGGBB`. In code a colour (`ColorFormat`) has python-pptx's `brightness`, -1 to 1 (`0.4` is lighter 40 %), on a theme colour only. `z` orders a shape among the slide's shapes and placeholders, so a negative `z` puts one under a placeholder's words. Paths are from the deck's module's folder.
182
+ A shape there changes a placeholder of the slide's layout (or a generated shape) with `frame` (`{ x, y, w, h }` in points), `text` (on all of its text, every level, as PowerPoint sets a selected shape's: `size` in points, `bold`, `italic`, `underline`, `strike`, `color`, `font`, a family, `align`: `l`, `ctr`, `r`, `just`, `line_spacing`, a multiple of single spacing, `1.5`, `space_before` and `space_after` in points, `anchor`, where the text stands in its shape: `t`, `ctr`, `b`, `bullet`, a character, `"•"`, or `false` for none, `numbered`, its paragraphs counted in place of a bullet: `arabicPeriod`, `arabicParenR`, `alphaLcPeriod`, `alphaUcPeriod`, `romanLcPeriod`, `romanUcPeriod`; given both, `numbered` stands; a bullet or a number in text with no indent hangs as PowerPoint's does), `fill` (a colour, or `none`), `fill_transparency` (a share that shows through), `gradient` (`angle`, degrees clockwise from left to right, and `stops`, each `at`, a share of the way, `color` and `transparency`), `shadow` (`blur` and `distance` in points, `angle`, `color`, `transparency`), `line` (its outline: a colour, or `none`), `line_width` in points, `line_dash` (`solid`, `sysDash`, `sysDot`, `dash`, `dashDot`, `lgDash`, `lgDashDot`, `lgDashDotDot`), `line_begin` and `line_end` (`none`, `triangle`, `arrow`, `stealth`, `diamond`, `oval`), `line_begin_size` and `line_end_size` (`{ w, len }`, each `sm`, `med` or `lg`: the head's width and length, PowerPoint's Arrow size), `rotation` (degrees clockwise about its centre, 0 up to 360, python-pptx's `rotation`), `flip_h` and `flip_v` (`true`: mirrored left to right, top to bottom; a line runs from its frame's other corner; its text reads as it is), `crop` (a picture's: `left`, `top`, `right` and `bottom`, the share of it cut from each side, PowerPoint's `a:srcRect`; a negative share is space left beside it; the editor's Crop menu writes Fill and Fit, [pictures.md](pictures.md#a-decks-pictures)), `z`; or is the slide's own with one of `textbox: true` (its words are the script's; it wraps, and grows from its frame's `h` to its text, so its frame still has all four of `x`, `y`, `w` and `h`), `picture`, `movie` (a video file of the project; a video item goes on a slide as its render, `allyhub render`), `geometry` (any of PowerPoint's 187 preset shapes by its `prst` name, ECMA-376's `ST_ShapeType`: `rect`, `roundRect`, `ellipse`, `triangle`, `star5`, `chevron`, `rightArrow`, `wedgeRectCallout`, `heart`, `cloud`, `donut`, `flowChartProcess`…, drawn from ECMA-376's preset shape definitions as PowerPoint draws them; a connector, `line`, `straightConnector1`, `bentConnector2` to `5` or `curvedConnector2` to `5`, has the connector's line, no fill and no text, and its `line_begin` and `line_end` face along its path, and `connect: { begin: { shape, site }, end: { shape, site } }` glues its ends to shapes of the slide by name, at sites of their geometries (a rectangle's 0 top, 1 left, 2 bottom, 3 right; PowerPoint's `a:stCxn` and `a:endCxn`): its frame is then where its ends sit, and they follow the shapes; `none` lets go of an end the code glued, as dragging the end off its shape does; with `adjustments`, its handles' values in the definition's order as python-pptx's `adjustments` has them, a share each: `roundRect`'s `[0.1]` is a corner of a tenth of its shorter side), `path` (a freeform: `{ w, h, d }`, its outline in a box of `w` × `h` units stretched to its frame, `d` in SVG's `M`, `L`, `C` and `Z`, absolute, so a logo or a cursor is a real shape), `table` (`columns`, widths in points, and `rows`, each a `height` with its `fill`, `text` and `line`, a rule at its foot; stretched to its frame, its words the script's, a list of rows, each a list of cells) or `component` (with `props`, and `dur`, how long it moves), and a `frame`. `group`, a name a slide's own shapes share, makes them one group in PowerPoint, standing together where the topmost of them stands. A table here has no style of its own, unlike python-pptx's: its look is what its rows and cells say. A picture or a movie put in a picture, media or object placeholder fills it. Colours are the theme's (`accent1`…); the theme's lighter or darker, in PowerPoint's words (`accent1 lighter 40%`, `dk1 darker 25%`, a share over 0 up to 100 %), which follows a change of theme as PowerPoint's picker's tints and shades do; or `#RRGGBB`. In code a colour (`ColorFormat`) has python-pptx's `brightness`, -1 to 1 (`0.4` is lighter 40 %), on a theme colour only. `z` orders a shape among the slide's shapes and placeholders, so a negative `z` puts one under a placeholder's words. Paths are from the deck's module's folder.
137
183
 
138
184
  A slide's `animations` are PowerPoint's Animation Pane, in order, each on one of the slide's own shapes (`shape`, by name; in a block, `<slide>/<shape>`), or one `paragraph` of its text, from 0:
139
185
 
package/docs/speech.md CHANGED
@@ -104,7 +104,7 @@ export default video({
104
104
  Text to speech. `allyhub voice` makes the missing files with the cloud voice tool, each in `assets/media/gen/say/<hash>` with its words and its record (each tool's description says what it costs). A `say` without its file is AK-T002; until it has one, the part lasts about as long as the line takes to say (`SPEECH_RATE_DEFAULTS`: 0.38 s a word, 0.22 s a Chinese, Japanese or Korean character; at least 1 s), and its anchors are placed in proportion along the line.
105
105
 
106
106
  - `voice`: the voice tool's voice id (`allyhub ai-media find-voices` finds them); default the tool's own.
107
- - `tool`: the voice tool; default `"speak"` (`"speak-like"` speaks in the voice of a recording you give in `params`; `allyhub help ai-media <tool>` lists its input).
107
+ - `tool`: the voice tool; default `"speak"` (`"clone-voice"` speaks in the voice of a recording you give in `params`; `allyhub help ai-media <tool>` lists its input).
108
108
  - `params`: more input for the tool, plain JSON: fields its schema has besides the text and voice (`text` and `voiceId` throw).
109
109
  - `speed`: 0.5 to 2, default 1: plays the file faster or slower, pitch kept, as `.speed()` does. Not sent to the tool, so the same file.
110
110
 
package/docs/x.md ADDED
@@ -0,0 +1,73 @@
1
+ # X posts and articles
2
+
3
+ Two kinds in X's own model, each a file listed in `allyhub.yaml` ([project.md](project.md#items)): an `x-post` (a post, a thread or a long post) and an `x-article`.
4
+
5
+ ## An X post
6
+
7
+ An `x-post` is a YAML file (`- { kind: x-post, file: launch/launch.yaml }`). Its fields are POST /2/tweets's own:
8
+
9
+ ```yaml
10
+ reply_settings: following # who may reply to each post: following, mentionedUsers, subscribers or verified
11
+ posts:
12
+ - text: |
13
+ We shipped dark mode.
14
+ media:
15
+ - file: ./shots.ts#hero # an image's board, a video item, or a picture or video file, from this file's folder
16
+ alt: The dashboard in dark mode.
17
+ - text: Which do you use?
18
+ poll: { options: [Light, Dark], duration_minutes: 1440 }
19
+ ```
20
+
21
+ - **A thread** is its posts in order; each after the first is published as a reply to the one before. A post alone is a thread of one. The first post may also `reply` (`in_reply_to_tweet_id`) or quote (`quote_tweet_id`) a post already on X; quoting through the API needs an Enterprise plan. A post may say `made_with_ai` and `paid_partnership`.
22
+ - **Length is X's weighted count**, not the characters shown: Latin letters, digits and common punctuation 1; Chinese, Japanese, Korean and most other scripts 2; every emoji 2, whatever it is made of; every link 23, however long. At most 280 a post.
23
+ - **A long post** is a post over 280, which an X Premium account publishes up to 25,000. `allyhub.config.ts`'s `x: { premium: true }` says the account is Premium; it also takes videos up to 4 hours and 16 GB. X's timeline folds a long post at "Show more": at most 280 characters, back to a word's end (measured on x.com; `allyhub frames` draws the fold).
24
+ - **Plain text.** The API publishes no bold or italics. A link is its address.
25
+ - **A post's text as a block (`|`) or in quotes** when it holds ` #` (YAML reads the rest of the line as a comment), starts with `@`, `#` or a quote, or holds `: `. The line break a block ends in is not posted.
26
+ - **Media**: up to 4 pictures (JPEG, PNG or WebP, 5 MB each), or 1 GIF (15 MB), or 1 video (MP4 or MOV), never mixed. Alt text up to 1,000 characters. X publishes no picture size, crop or safe area. A video is checked against the widest of what X publishes: 0.5 s to 20 minutes (4 hours with Premium), 8 GB (16 GB), sides 32 px to 1920 on the long side and 1200 on the short, 1:3 to 3:1. X's ways of posting take less: its web upload 1:2.39 to 2.39:1 at 40 frames a second and 25 Mbps, and without Premium 140 seconds and 512 MB; its API's media guide 1280×1024 and 60 frames a second. A 1280×720 or 720×1280 H.264 MP4 at 30 frames a second under 140 seconds suits every way.
27
+ - **Another item's made file**: `./shots.ts#hero` is the image `shots`'s board `hero`, made first when the post is rendered; a video item's file is its first version. Its bytes are checked when it is made.
28
+
29
+ ## An X article
30
+
31
+ An `x-article` is a Markdown file (`- { kind: x-article, file: launch/story.md }`), its title and cover in its front matter, its body in X's blocks alone:
32
+
33
+ ```markdown
34
+ ---
35
+ title: How we built dark mode
36
+ cover: ./shots.ts#cover # a picture file or an image's board; or { file, alt }
37
+ ---
38
+
39
+ Paragraphs with **bold**, _italic_, ~~strikethrough~~ and [links](https://example.com).
40
+
41
+ # A heading (X has two: # a Heading, ## a Subheading)
42
+
43
+ - a list, one level deep
44
+
45
+ 1. or numbered
46
+
47
+ > A quote.
48
+
49
+ <br />
50
+
51
+ ![What the picture shows](./chart.png "Its caption")
52
+
53
+ https://x.com/allyhub/status/1234567890
54
+
55
+ https://example.com/launch
56
+
57
+ ---
58
+
59
+ $$
60
+ e^{i\pi} + 1 = 0
61
+ $$
62
+ ```
63
+
64
+ - **Each element is one of X's blocks**: a paragraph, a Heading (`#`) and a Subheading (`##`), lists a level deep, a quote, a picture, GIF or video on a line of its own (its alt text and its caption), a post's address on a line of its own (an embedded post), any other address on a line of its own (a link's card, as X's link preview), `---` (a divider), `$$ … $$` (an equation), a code block or a table (X's Markdown block: 10,000 together, weighted as X counts), and `<br />` alone on a line (an empty line, which X keeps). A third level of heading, a list inside a list, inline code, a picture or an equation inside a line and other HTML are not: each is a problem at its line.
65
+ - **A code block or a picture written inside a list item** stands after the list, and the list starts again after it, as X's editor places it.
66
+ - **Media** are pictures (JPEG, PNG or WebP, 5 MB each), GIFs (15 MB) and videos (MP4 or MOV); the cover is a picture at 5:2. An image's board (`./shots.ts#chart`) or a video item (`./teaser.ts`) may be one, made first when the article is rendered. X publishes no most for a title or a body.
67
+ - **X Premium** writes articles. Through the API an article is drafted and published, and nothing else: it cannot be changed or deleted once published.
68
+
69
+ ## Check, measure and render
70
+
71
+ `allyhub check` reports what X refuses under `allyhub.x/…`, at its line. `allyhub inspect <post>` gives each post's weighted length beside 280 and 25,000, its links, mentions, hashtags and cashtags, and its media's bytes; `allyhub inspect <article>` its words, its weighted length, its headings, its media, its embedded posts and links' cards, and its code's weight against 10,000. `allyhub frames` draws a post or an article as X shows it once published (a thread as the timeline does, an article in X's column), in Inter in place of X's own face; an embedded post and a link's card are drawn by their address, as their content is X's to fetch.
72
+
73
+ `allyhub render <post>` writes POST /2/tweets's request for each post (`posts.json`, the media beside it), or each post's text (`--type txt`). `allyhub render <article>` writes POST /2/articles/draft's request (`article.json`, its media beside it with `media.json`). Publishing to X is not built.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "What an agent writes videos, decks and workbooks with: each built-in kind's authoring API, re-exported from its extension. The root, /dom, /media and /scenery are the video's: video(), parts with their speech, footage and sounds, defineComponent() and custom() layers, the layout, motion and input helpers, the scenery() layer's options; /slides is the deck's, python-pptx's API; /image is the image's, its boards each its own size; /sheets is the sheet's, openpyxl's API. Nothing a host needs.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://allyhub.com",