drawnui-react 0.1.0-preview.3 → 0.1.0-preview.30

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 (91) hide show
  1. package/README.md +15 -1
  2. package/SKIPPED.md +32 -25
  3. package/dist/controls/AnimatedFramesRenderer.d.ts +7 -0
  4. package/dist/controls/AnimatedFramesRenderer.js +16 -1
  5. package/dist/controls/DrawnGame.d.ts +40 -0
  6. package/dist/controls/DrawnGame.js +64 -0
  7. package/dist/controls/GridStructure.d.ts +16 -2
  8. package/dist/controls/GridStructure.js +40 -4
  9. package/dist/controls/SkiaBackdrop.d.ts +8 -2
  10. package/dist/controls/SkiaBackdrop.js +42 -14
  11. package/dist/controls/SkiaButton.d.ts +15 -1
  12. package/dist/controls/SkiaButton.js +21 -4
  13. package/dist/controls/SkiaCarousel.d.ts +21 -2
  14. package/dist/controls/SkiaCarousel.js +49 -5
  15. package/dist/controls/SkiaCheckbox.d.ts +0 -1
  16. package/dist/controls/SkiaCheckbox.js +0 -6
  17. package/dist/controls/SkiaDrawer.d.ts +2 -0
  18. package/dist/controls/SkiaDrawer.js +2 -0
  19. package/dist/controls/SkiaEditor.d.ts +38 -1
  20. package/dist/controls/SkiaEditor.js +223 -49
  21. package/dist/controls/SkiaGif.d.ts +3 -0
  22. package/dist/controls/SkiaGif.js +12 -2
  23. package/dist/controls/SkiaImage.js +15 -10
  24. package/dist/controls/SkiaLabel.d.ts +78 -7
  25. package/dist/controls/SkiaLabel.js +379 -60
  26. package/dist/controls/SkiaLabelFps.d.ts +16 -0
  27. package/dist/controls/SkiaLabelFps.js +41 -0
  28. package/dist/controls/SkiaLayout.d.ts +97 -9
  29. package/dist/controls/SkiaLayout.js +387 -22
  30. package/dist/controls/SkiaLottie.js +4 -2
  31. package/dist/controls/SkiaProgress.d.ts +2 -1
  32. package/dist/controls/SkiaProgress.js +6 -3
  33. package/dist/controls/SkiaRadioButton.js +4 -3
  34. package/dist/controls/SkiaRichLabel.d.ts +1 -1
  35. package/dist/controls/SkiaRichLabel.js +11 -1
  36. package/dist/controls/SkiaScroll.d.ts +35 -5
  37. package/dist/controls/SkiaScroll.js +234 -23
  38. package/dist/controls/SkiaScrollBar.d.ts +27 -0
  39. package/dist/controls/SkiaScrollBar.js +51 -2
  40. package/dist/controls/SkiaShaderCarousel.d.ts +5 -0
  41. package/dist/controls/SkiaShaderCarousel.js +5 -0
  42. package/dist/controls/SkiaShape.d.ts +13 -2
  43. package/dist/controls/SkiaShape.js +50 -10
  44. package/dist/controls/SkiaSlider.d.ts +20 -2
  45. package/dist/controls/SkiaSlider.js +59 -5
  46. package/dist/controls/SkiaSprite.d.ts +1 -0
  47. package/dist/controls/SkiaSprite.js +4 -0
  48. package/dist/controls/SkiaSvg.js +1 -1
  49. package/dist/controls/SkiaSwitch.d.ts +0 -1
  50. package/dist/controls/SkiaSwitch.js +0 -6
  51. package/dist/controls/SkiaToggle.d.ts +25 -5
  52. package/dist/controls/SkiaToggle.js +58 -5
  53. package/dist/controls/SnappingLayout.d.ts +12 -1
  54. package/dist/controls/SnappingLayout.js +19 -1
  55. package/dist/core/Accessibility.d.ts +80 -0
  56. package/dist/core/Accessibility.js +421 -8
  57. package/dist/core/Animators.d.ts +37 -1
  58. package/dist/core/Animators.js +102 -9
  59. package/dist/core/Canvas.d.ts +108 -7
  60. package/dist/core/Canvas.js +353 -29
  61. package/dist/core/Easing.d.ts +12 -1
  62. package/dist/core/Easing.js +25 -1
  63. package/dist/core/Gestures.d.ts +34 -2
  64. package/dist/core/Gestures.js +84 -3
  65. package/dist/core/Hover.d.ts +47 -0
  66. package/dist/core/Hover.js +134 -0
  67. package/dist/core/KeyboardManager.d.ts +13 -0
  68. package/dist/core/KeyboardManager.js +18 -0
  69. package/dist/core/ScrollAnimators.js +9 -0
  70. package/dist/core/Shaping.d.ts +40 -0
  71. package/dist/core/Shaping.js +224 -0
  72. package/dist/core/SkiaControl.d.ts +209 -9
  73. package/dist/core/SkiaControl.js +500 -59
  74. package/dist/core/SkiaEffect.d.ts +17 -0
  75. package/dist/core/SkiaEffect.js +43 -8
  76. package/dist/core/SkiaImageManager.js +1 -1
  77. package/dist/core/Super.d.ts +22 -2
  78. package/dist/core/Super.js +47 -3
  79. package/dist/core/Types.d.ts +11 -1
  80. package/dist/core/Types.js +32 -1
  81. package/dist/core/ViewsAdapter.d.ts +7 -2
  82. package/dist/core/ViewsAdapter.js +10 -3
  83. package/dist/index.d.ts +3 -0
  84. package/dist/index.js +3 -0
  85. package/dist/react/SkiaShell.js +33 -14
  86. package/dist/react/index.d.ts +17 -4
  87. package/dist/react/index.js +103 -15
  88. package/dist/react/reconciler.js +33 -13
  89. package/dist/vite/index.d.ts +9 -0
  90. package/dist/vite/index.js +36 -3
  91. package/package.json +41 -3
@@ -1,6 +1,6 @@
1
1
  import { type DrawingContext, SkiaControl } from "../core/SkiaControl";
2
2
  import { type GestureEventProcessingInfo, type SkiaGesturesParameters } from "../core/Gestures";
3
- import { type Color, type DrawTextAlignment, type FontAttributes, type LineBreakMode, ScaledSize, type SkiaGradient, type TextAlignment, type TextTransform, Thickness } from "../core/Types";
3
+ import { type Color, type DrawTextAlignment, type FontAttributes, type LineBreakMode, ScaledSize, type SkiaGradient, type TextAlignment, type TextTransform, Thickness, type ThicknessValue } from "../core/Types";
4
4
  import { TextSpan } from "./TextSpan";
5
5
  /** One code point of the laid-out text: its UTF-16 index/length in Text and its box in pixels relative to DrawingRect. */
6
6
  export interface GlyphBox {
@@ -10,7 +10,8 @@ export interface GlyphBox {
10
10
  Left: number;
11
11
  Top: number;
12
12
  Width: number;
13
- Height: number;
13
+ Height: number; /** The code point runs right to left (its box is in visual place). */
14
+ Rtl?: boolean;
14
15
  }
15
16
  /** A laid-out line: first text index, box in pixels relative to DrawingRect. */
16
17
  export interface LineBox {
@@ -43,6 +44,8 @@ export declare class SkiaLabel extends SkiaControl {
43
44
  private verticalTextAlignment;
44
45
  private lineSpacing;
45
46
  private lineHeight;
47
+ private paragraphSpacing;
48
+ private characterSpacing;
46
49
  private textTransform;
47
50
  private padding;
48
51
  /** Styled fragments; when not empty they replace `Text` (same precedence as C#). */
@@ -53,6 +56,8 @@ export declare class SkiaLabel extends SkiaControl {
53
56
  protected DefaultAccessibilityLabel(): string | undefined;
54
57
  constructor();
55
58
  private Set;
59
+ /** A property that changes only the look (a color): no layout change, see UpdateDraw. */
60
+ private SetLook;
56
61
  get Text(): string;
57
62
  set Text(v: string);
58
63
  get FontSize(): number;
@@ -84,10 +89,22 @@ export declare class SkiaLabel extends SkiaControl {
84
89
  /** Multiplier applied to the natural line height (ascent + descent). */
85
90
  get LineHeight(): number;
86
91
  set LineHeight(v: number);
92
+ /**
93
+ * Space above every paragraph after the first, in lines (C# ParagraphSpacing; 0 here as DrawnUi.Rust, C# 0.25). A
94
+ * paragraph starts after "\n"; U+2028 breaks the line inside a paragraph.
95
+ */
96
+ get ParagraphSpacing(): number;
97
+ set ParagraphSpacing(v: number);
98
+ /**
99
+ * C# CharacterSpacing: 1 = the font's own spacing; every glyph is followed by (CharacterSpacing - 1) points more
100
+ * (less below 1), the line measures and wraps at the width it draws (C# 7cf1007c, DrawnUi.Rust label).
101
+ */
102
+ get CharacterSpacing(): number;
103
+ set CharacterSpacing(v: number);
87
104
  get TextTransform(): TextTransform;
88
105
  set TextTransform(v: TextTransform);
89
106
  get Padding(): Thickness;
90
- set Padding(v: Thickness);
107
+ set Padding(v: ThicknessValue);
91
108
  /** Number of laid-out lines after the last measure. */
92
109
  get LinesCount(): number;
93
110
  AddSubView(control: SkiaControl | TextSpan): void;
@@ -97,17 +114,49 @@ export declare class SkiaLabel extends SkiaControl {
97
114
  private mainFonts?;
98
115
  private readonly fontsCache;
99
116
  private readonly runCache;
117
+ /** CharacterSpacing in pixels at the measured scale: added after every glyph of a run (its Width includes them). */
118
+ private glyphSpacing;
100
119
  private ResolveFonts;
101
120
  /** The label's own style, and the base every span inherits from. */
102
121
  private ResolveMainFonts;
103
122
  private ResolveSpanFonts;
104
- private static Advance;
123
+ private static NeedsShapingOrRtl;
124
+ /** Width of a text in one font: the shaped glyphs where the text needs shaping (Arabic joins, emoji sequences), else glyph by glyph. */
125
+ private Advance;
126
+ private static readonly Ignorable;
127
+ /**
128
+ * Default-ignorable code points (zero width space, joiners, direction marks, word joiners, variation selectors such
129
+ * as U+FE0F after an emoji, tags) that none of the fonts has draw nothing and take no room, never the missing-glyph
130
+ * box (DrawnUi.Rust label_ignorables; text is not shaped here, C# hides them by shaping).
131
+ */
132
+ private static DropIgnorables;
105
133
  /**
106
134
  * Splits text into runs by glyph availability: the main font, or the first fallback that has a glyph where the
107
- * main font has glyph 0. Spaces always stay on the main font (fallback faces often carry very wide spaces).
135
+ * main font has glyph 0. Spaces always stay on the main font (fallback faces often carry very wide spaces). A joiner,
136
+ * a variation selector, a skin tone or a tag keeps the font of the glyph before it: an emoji sequence is one run.
108
137
  */
109
138
  private Segment;
110
139
  private Width;
140
+ /** A line never starts with these (closing punctuation, small kana, the long vowel mark): JIS X 4051 kinsoku (C#). */
141
+ private static readonly NoBreakBefore;
142
+ /** A line never ends with these (opening brackets and quotes). */
143
+ private static readonly NoBreakAfter;
144
+ /** Chinese / Japanese: ideographs, kana, CJK punctuation, full-width forms (C# IsCjkAt). Korean breaks at spaces only. */
145
+ private static readonly Cjk;
146
+ private static CanBreakBetween;
147
+ /**
148
+ * C# CanBreakInsideWord: whether a line may break between text[index - 1] and text[index] (UTF-16 indexes) inside a
149
+ * space-free run: next to a Chinese or Japanese character, never before closing punctuation or small kana, never
150
+ * after an opening bracket, never inside a surrogate pair.
151
+ */
152
+ static CanBreakInsideWord(text: string, index: number): boolean;
153
+ /**
154
+ * C# FitAtBreak: the last place inside the word where a Chinese / Japanese line may break and `prefix` plus the word
155
+ * up to there still fits; code points from the word's start, 0 = none.
156
+ */
157
+ private FitCjk;
158
+ /** The word cut after `count` code points: the head goes on a line, the rest follows. */
159
+ private SplitWord;
111
160
  private Transform;
112
161
  /**
113
162
  * Paragraphs (split on "\n") of wrap tokens, built from Spans when present, else from Text.
@@ -116,11 +165,33 @@ export declare class SkiaLabel extends SkiaControl {
116
165
  private Tokenize;
117
166
  private NewLine;
118
167
  private Append;
119
- /** Word-wraps tokens into lines that fit maxWidth (Infinity = no wrap), applies MaxLines with a tail ellipsis. */
168
+ /**
169
+ * Word-wraps tokens into lines that fit maxWidth (Infinity = no wrap); keeps the lines that fit maxHeight (at least one)
170
+ * and MaxLines, the last kept one ending with a tail ellipsis (C# / DrawnUi.Rust: a label in a box too short for its
171
+ * text cuts it, not only MaxLines).
172
+ */
120
173
  private LayoutLines;
174
+ /** A paragraph is right to left when its first strong letter is (DrawnUi.Rust split_bidi). */
175
+ static FirstStrongIsRtl(text: string): boolean;
176
+ /** The runs of a line cut where its visual run changes; `map` per UTF-16 index of the line text. */
177
+ private SplitByRuns;
178
+ /**
179
+ * After the layout, lines whose text needs shaping or runs right to left (DrawnUi.Rust build_blobs): with
180
+ * right-to-left text every run is cut where its bidirectional run changes (Unicode bidirectional algorithm, ICU, the
181
+ * paragraph direction from its first strong letter); runs that are right to left or need shaping get shaped glyphs;
182
+ * runs are placed in visual order. Lines without such text are left as they are (plain path).
183
+ */
184
+ private ShapeLines;
185
+ /**
186
+ * Where each run of a line with right-to-left text goes: visual runs left to right; inside a run, pieces (spans, fonts)
187
+ * in logical order, reversed in a right-to-left run.
188
+ */
189
+ private static PlaceRuns;
121
190
  private LineHeightPx;
191
+ /** ParagraphSpacing above a line that starts a paragraph (after the first): that many of its lines, with their spacing. */
192
+ private ParagraphSpace;
122
193
  private BlockHeight;
123
- protected MeasureAbsolute(widthConstraint: number, _heightConstraint: number, scale: number): ScaledSize;
194
+ protected MeasureAbsolute(widthConstraint: number, heightConstraint: number, scale: number): ScaledSize;
124
195
  /** C# GradientByLines: FillGradient spans each line's bounds (default) instead of the whole text block. */
125
196
  GradientByLines: boolean;
126
197
  /** C# KeepSpacesOnLineBreaks / NeedsGlyphPositions: accepted; glyph boxes are always available through GetGlyphBoxes. */