@xlsx-editor.dev/core 0.0.0-placeholder.0 → 0.1.0-beta.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/LICENSE +217 -0
- package/README.md +254 -2
- package/THIRD_PARTY_NOTICES.md +78 -0
- package/dist/automation.d.ts +299 -0
- package/dist/automation.js +42 -0
- package/dist/builtins-nmHrq2Et.d.ts +37 -0
- package/dist/cascade.d.ts +196 -0
- package/dist/cascade.js +60 -0
- package/dist/cell-format-DW8yF-c-.d.ts +226 -0
- package/dist/chunk-2DLJYRJC.js +3171 -0
- package/dist/chunk-2ZU4337U.js +204 -0
- package/dist/chunk-44L37ENZ.js +8219 -0
- package/dist/chunk-77N55BLP.js +911 -0
- package/dist/chunk-7PV5HQPE.js +84 -0
- package/dist/chunk-E4VJJ556.js +756 -0
- package/dist/chunk-KG4IL4JI.js +436 -0
- package/dist/chunk-PLDK4XO6.js +9125 -0
- package/dist/chunk-PRHLYXHL.js +1699 -0
- package/dist/chunk-TE4FXG5T.js +3156 -0
- package/dist/contracts.d.ts +32 -0
- package/dist/contracts.js +0 -0
- package/dist/dist-C7NLNUMD.js +2850 -0
- package/dist/editor.d.ts +3167 -0
- package/dist/editor.js +309 -0
- package/dist/harfbuzz-measurer-CkKfsEyu.d.ts +128 -0
- package/dist/harfbuzz.wasm +0 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +309 -0
- package/dist/layout.d.ts +111 -0
- package/dist/layout.js +104 -0
- package/dist/merge-commands-DthcNpfw.d.ts +53 -0
- package/dist/node-module-shim-LQXGL47O.js +18 -0
- package/dist/ops-CfUCjyph.d.ts +629 -0
- package/dist/output.d.ts +177 -0
- package/dist/output.js +29 -0
- package/dist/sheet-index-P5vevMWX.d.ts +52 -0
- package/dist/sheet-layout-D9M_4EBn.d.ts +494 -0
- package/dist/sheet-protection-D8goxm58.d.ts +209 -0
- package/dist/store.d.ts +615 -0
- package/dist/store.js +272 -0
- package/dist/theme-BprDji6x.d.ts +16 -0
- package/dist/units-D6CD_A5I.d.ts +13 -0
- package/dist/workbook-index-DsbeR8Kb.d.ts +294 -0
- package/licenses/Emscripten-LICENSE.txt +102 -0
- package/licenses/HarfBuzz-COPYING.txt +42 -0
- package/licenses/HarfBuzz-USE-MIT.txt +21 -0
- package/licenses/HarfBuzz-source-notices.txt +4508 -0
- package/licenses/README.md +19 -0
- package/licenses/Unicode-LICENSE.txt +39 -0
- package/licenses/compiler-rt-LICENSE.txt +311 -0
- package/licenses/harfbuzz-manifest.json +84 -0
- package/licenses/musl-COPYRIGHT.txt +193 -0
- package/package.json +79 -6
- package/src/styles/editor.css +1933 -0
- package/src/styles/editor.css.d.ts +2 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHROME_GROUPS,
|
|
3
|
+
CHROME_SLOT_IDS,
|
|
4
|
+
CLIPBOARD_TYPE,
|
|
5
|
+
COLOR_CHOICES,
|
|
6
|
+
CUSTOM_NUMBER_FORMAT_PREFIX,
|
|
7
|
+
CUT_REFUSAL_CODES,
|
|
8
|
+
DISABLED_REASON_KEYS,
|
|
9
|
+
EDIT_REFUSAL_CODES,
|
|
10
|
+
EMPTY_SNAPSHOT,
|
|
11
|
+
FONT_FAMILY_CHOICES,
|
|
12
|
+
FONT_SIZE_CHOICES,
|
|
13
|
+
ICON_PATHS,
|
|
14
|
+
MAX_CONTENT_FIELD_CHARS,
|
|
15
|
+
MAX_GO_TO_LENGTH,
|
|
16
|
+
MAX_LISTED_NUMBER_FORMATS,
|
|
17
|
+
MAX_ZOOM,
|
|
18
|
+
MIN_ZOOM,
|
|
19
|
+
NO_FILL,
|
|
20
|
+
NUMBER_FORMAT_CODE_PROBLEM_KEYS,
|
|
21
|
+
NUMBER_FORMAT_SAMPLE,
|
|
22
|
+
RENAME_COMMIT_EVENT,
|
|
23
|
+
SAVE_REFUSAL_CODES,
|
|
24
|
+
SHEET_MENU_ITEM,
|
|
25
|
+
TOOLBAR_FIXED_ATTRIBUTE,
|
|
26
|
+
TOOLBAR_HINT_KEYS,
|
|
27
|
+
arrangeToolbar,
|
|
28
|
+
arrangeToolbarGroups,
|
|
29
|
+
blockNextClick,
|
|
30
|
+
chromeControlForSlot,
|
|
31
|
+
chromeSlotId,
|
|
32
|
+
commitFocusedRename,
|
|
33
|
+
composesKey,
|
|
34
|
+
contentFieldText,
|
|
35
|
+
createXlsxEditor,
|
|
36
|
+
cycleRegion,
|
|
37
|
+
disabledReasonText,
|
|
38
|
+
displayName,
|
|
39
|
+
editMoveOf,
|
|
40
|
+
editorCommandSlice,
|
|
41
|
+
editorHostDocument,
|
|
42
|
+
editorHostElement,
|
|
43
|
+
editorHostWindow,
|
|
44
|
+
editorInstanceScope,
|
|
45
|
+
emptySnapshotOf,
|
|
46
|
+
fieldHistoryKey,
|
|
47
|
+
focusAfterRelease,
|
|
48
|
+
focusPopupItem,
|
|
49
|
+
followModeProp,
|
|
50
|
+
formulaSlice,
|
|
51
|
+
gridSetupProblem,
|
|
52
|
+
groupsThatFit,
|
|
53
|
+
guardToolbarMousedown,
|
|
54
|
+
hasOpenNestedPopup,
|
|
55
|
+
historyShortcutOf,
|
|
56
|
+
hostDocumentOf,
|
|
57
|
+
hostWindowOf,
|
|
58
|
+
insertFieldText,
|
|
59
|
+
isDialogBackdropPoint,
|
|
60
|
+
isElementNode,
|
|
61
|
+
isHTMLElementNode,
|
|
62
|
+
isHexColor,
|
|
63
|
+
keepGridFocus,
|
|
64
|
+
listenForOutsidePress,
|
|
65
|
+
listenForPopupEscape,
|
|
66
|
+
listenForPopupFocusLeave,
|
|
67
|
+
listenSaveKey,
|
|
68
|
+
listenSheetMenuDismiss,
|
|
69
|
+
loadSubstituteFonts,
|
|
70
|
+
measureToolbar,
|
|
71
|
+
mergeCommandState,
|
|
72
|
+
moveBarFocus,
|
|
73
|
+
moveInSheetMenu,
|
|
74
|
+
movePopupFocus,
|
|
75
|
+
numberFormatChoiceCode,
|
|
76
|
+
numberFormatChoices,
|
|
77
|
+
numberFormatCodeProblem,
|
|
78
|
+
numberFormatDialogApplyStep,
|
|
79
|
+
numberFormatDialogCurrent,
|
|
80
|
+
numberFormatDialogStart,
|
|
81
|
+
numberFormatListView,
|
|
82
|
+
numberFormatValue,
|
|
83
|
+
observeToolbar,
|
|
84
|
+
openSheetMenu,
|
|
85
|
+
packageFailureText,
|
|
86
|
+
parseCellInput,
|
|
87
|
+
parseFontSize,
|
|
88
|
+
pastLimitText,
|
|
89
|
+
placePopup,
|
|
90
|
+
popupTriggerAction,
|
|
91
|
+
pressFieldBox,
|
|
92
|
+
previewNumberFormat,
|
|
93
|
+
refusalText,
|
|
94
|
+
refusesEditText,
|
|
95
|
+
refusesReference,
|
|
96
|
+
relabelEditor,
|
|
97
|
+
renameFocused,
|
|
98
|
+
reportFontError,
|
|
99
|
+
resolveDarkChrome,
|
|
100
|
+
runToolbarCommand,
|
|
101
|
+
sameEditorCommandSlice,
|
|
102
|
+
sameFontSource,
|
|
103
|
+
sameSlice,
|
|
104
|
+
scrollIntoNearestScroller,
|
|
105
|
+
sheetCommandState,
|
|
106
|
+
sheetListKey,
|
|
107
|
+
sheetMenuLeft,
|
|
108
|
+
sheetRenameBox,
|
|
109
|
+
showCaretLine,
|
|
110
|
+
shownGroupCount,
|
|
111
|
+
slotWords,
|
|
112
|
+
statusSlice,
|
|
113
|
+
statusView,
|
|
114
|
+
stepFieldHistory,
|
|
115
|
+
subjectText,
|
|
116
|
+
subscribeSystemDark,
|
|
117
|
+
substituteFontFailure,
|
|
118
|
+
systemPrefersDark,
|
|
119
|
+
tabKey,
|
|
120
|
+
tabsSlice,
|
|
121
|
+
toolbarCommandState,
|
|
122
|
+
toolbarCommandStates,
|
|
123
|
+
toolbarGroupHeading,
|
|
124
|
+
toolbarGroups,
|
|
125
|
+
trapTabWithin,
|
|
126
|
+
watchFontErrors,
|
|
127
|
+
watchGridSetup,
|
|
128
|
+
whenOpenSettles,
|
|
129
|
+
workbookNumberFormatCodes,
|
|
130
|
+
zoomSlice
|
|
131
|
+
} from "./chunk-PLDK4XO6.js";
|
|
132
|
+
import {
|
|
133
|
+
pixelsToPoints,
|
|
134
|
+
pointsToPixels
|
|
135
|
+
} from "./chunk-TE4FXG5T.js";
|
|
136
|
+
import "./chunk-7PV5HQPE.js";
|
|
137
|
+
import "./chunk-E4VJJ556.js";
|
|
138
|
+
import "./chunk-2ZU4337U.js";
|
|
139
|
+
import {
|
|
140
|
+
sameNumberLocale
|
|
141
|
+
} from "./chunk-PRHLYXHL.js";
|
|
142
|
+
import "./chunk-77N55BLP.js";
|
|
143
|
+
import "./chunk-KG4IL4JI.js";
|
|
144
|
+
import {
|
|
145
|
+
MAX_COLUMN_WIDTH,
|
|
146
|
+
MAX_FORMAT_NEW_CELLS,
|
|
147
|
+
MAX_RESIZE_NEW_ROWS,
|
|
148
|
+
MAX_ROW_HEIGHT,
|
|
149
|
+
PATCH_BORDER_STYLES,
|
|
150
|
+
PATCH_HORIZONTAL,
|
|
151
|
+
PATCH_VERTICAL,
|
|
152
|
+
STRUCTURE_SUBJECT_KINDS
|
|
153
|
+
} from "./chunk-44L37ENZ.js";
|
|
154
|
+
import {
|
|
155
|
+
MAX_COLS,
|
|
156
|
+
MAX_ROWS,
|
|
157
|
+
columnLetters,
|
|
158
|
+
formatCellRef,
|
|
159
|
+
parseCellRef,
|
|
160
|
+
resolveLimits
|
|
161
|
+
} from "./chunk-2DLJYRJC.js";
|
|
162
|
+
export {
|
|
163
|
+
CHROME_GROUPS,
|
|
164
|
+
ICON_PATHS as CHROME_ICON_PATHS,
|
|
165
|
+
CHROME_SLOT_IDS,
|
|
166
|
+
CLIPBOARD_TYPE,
|
|
167
|
+
COLOR_CHOICES,
|
|
168
|
+
CUSTOM_NUMBER_FORMAT_PREFIX,
|
|
169
|
+
CUT_REFUSAL_CODES,
|
|
170
|
+
DISABLED_REASON_KEYS,
|
|
171
|
+
EDIT_REFUSAL_CODES,
|
|
172
|
+
EMPTY_SNAPSHOT,
|
|
173
|
+
FONT_FAMILY_CHOICES,
|
|
174
|
+
FONT_SIZE_CHOICES,
|
|
175
|
+
MAX_COLS,
|
|
176
|
+
MAX_COLUMN_WIDTH,
|
|
177
|
+
MAX_CONTENT_FIELD_CHARS,
|
|
178
|
+
MAX_FORMAT_NEW_CELLS,
|
|
179
|
+
MAX_GO_TO_LENGTH,
|
|
180
|
+
MAX_LISTED_NUMBER_FORMATS,
|
|
181
|
+
MAX_RESIZE_NEW_ROWS,
|
|
182
|
+
MAX_ROWS,
|
|
183
|
+
MAX_ROW_HEIGHT,
|
|
184
|
+
MAX_ZOOM,
|
|
185
|
+
MIN_ZOOM,
|
|
186
|
+
NO_FILL,
|
|
187
|
+
NUMBER_FORMAT_CODE_PROBLEM_KEYS,
|
|
188
|
+
NUMBER_FORMAT_SAMPLE,
|
|
189
|
+
PATCH_BORDER_STYLES,
|
|
190
|
+
PATCH_HORIZONTAL,
|
|
191
|
+
PATCH_VERTICAL,
|
|
192
|
+
RENAME_COMMIT_EVENT,
|
|
193
|
+
SAVE_REFUSAL_CODES,
|
|
194
|
+
SHEET_MENU_ITEM,
|
|
195
|
+
STRUCTURE_SUBJECT_KINDS,
|
|
196
|
+
TOOLBAR_FIXED_ATTRIBUTE,
|
|
197
|
+
TOOLBAR_HINT_KEYS,
|
|
198
|
+
arrangeToolbar,
|
|
199
|
+
arrangeToolbarGroups,
|
|
200
|
+
blockNextClick,
|
|
201
|
+
chromeControlForSlot,
|
|
202
|
+
chromeSlotId,
|
|
203
|
+
columnLetters,
|
|
204
|
+
commitFocusedRename,
|
|
205
|
+
composesKey,
|
|
206
|
+
contentFieldText,
|
|
207
|
+
createXlsxEditor,
|
|
208
|
+
cycleRegion,
|
|
209
|
+
disabledReasonText,
|
|
210
|
+
displayName,
|
|
211
|
+
editMoveOf,
|
|
212
|
+
editorCommandSlice,
|
|
213
|
+
editorHostDocument,
|
|
214
|
+
editorHostElement,
|
|
215
|
+
editorHostWindow,
|
|
216
|
+
editorInstanceScope,
|
|
217
|
+
emptySnapshotOf,
|
|
218
|
+
fieldHistoryKey,
|
|
219
|
+
focusAfterRelease,
|
|
220
|
+
focusPopupItem,
|
|
221
|
+
followModeProp,
|
|
222
|
+
formatCellRef,
|
|
223
|
+
formulaSlice,
|
|
224
|
+
gridSetupProblem,
|
|
225
|
+
groupsThatFit,
|
|
226
|
+
guardToolbarMousedown,
|
|
227
|
+
hasOpenNestedPopup,
|
|
228
|
+
historyShortcutOf,
|
|
229
|
+
hostDocumentOf,
|
|
230
|
+
hostWindowOf,
|
|
231
|
+
insertFieldText,
|
|
232
|
+
isDialogBackdropPoint,
|
|
233
|
+
isElementNode,
|
|
234
|
+
isHTMLElementNode,
|
|
235
|
+
isHexColor,
|
|
236
|
+
keepGridFocus,
|
|
237
|
+
listenForOutsidePress,
|
|
238
|
+
listenForPopupEscape,
|
|
239
|
+
listenForPopupFocusLeave,
|
|
240
|
+
listenSaveKey,
|
|
241
|
+
listenSheetMenuDismiss,
|
|
242
|
+
loadSubstituteFonts,
|
|
243
|
+
measureToolbar,
|
|
244
|
+
mergeCommandState,
|
|
245
|
+
moveBarFocus,
|
|
246
|
+
moveInSheetMenu,
|
|
247
|
+
movePopupFocus,
|
|
248
|
+
numberFormatChoiceCode,
|
|
249
|
+
numberFormatChoices,
|
|
250
|
+
numberFormatCodeProblem,
|
|
251
|
+
numberFormatDialogApplyStep,
|
|
252
|
+
numberFormatDialogCurrent,
|
|
253
|
+
numberFormatDialogStart,
|
|
254
|
+
numberFormatListView,
|
|
255
|
+
numberFormatValue,
|
|
256
|
+
observeToolbar,
|
|
257
|
+
openSheetMenu,
|
|
258
|
+
packageFailureText,
|
|
259
|
+
parseCellInput,
|
|
260
|
+
parseCellRef,
|
|
261
|
+
parseFontSize,
|
|
262
|
+
pastLimitText,
|
|
263
|
+
pixelsToPoints,
|
|
264
|
+
placePopup,
|
|
265
|
+
pointsToPixels,
|
|
266
|
+
popupTriggerAction,
|
|
267
|
+
pressFieldBox,
|
|
268
|
+
previewNumberFormat,
|
|
269
|
+
refusalText,
|
|
270
|
+
refusesEditText,
|
|
271
|
+
refusesReference,
|
|
272
|
+
relabelEditor,
|
|
273
|
+
renameFocused,
|
|
274
|
+
reportFontError,
|
|
275
|
+
resolveDarkChrome,
|
|
276
|
+
resolveLimits,
|
|
277
|
+
runToolbarCommand,
|
|
278
|
+
sameEditorCommandSlice,
|
|
279
|
+
sameFontSource,
|
|
280
|
+
sameNumberLocale,
|
|
281
|
+
sameSlice,
|
|
282
|
+
scrollIntoNearestScroller,
|
|
283
|
+
sheetCommandState,
|
|
284
|
+
sheetListKey,
|
|
285
|
+
sheetMenuLeft,
|
|
286
|
+
sheetRenameBox,
|
|
287
|
+
showCaretLine,
|
|
288
|
+
shownGroupCount,
|
|
289
|
+
slotWords,
|
|
290
|
+
statusSlice,
|
|
291
|
+
statusView,
|
|
292
|
+
stepFieldHistory,
|
|
293
|
+
subjectText,
|
|
294
|
+
subscribeSystemDark,
|
|
295
|
+
substituteFontFailure,
|
|
296
|
+
systemPrefersDark,
|
|
297
|
+
tabKey,
|
|
298
|
+
tabsSlice,
|
|
299
|
+
toolbarCommandState,
|
|
300
|
+
toolbarCommandStates,
|
|
301
|
+
toolbarGroupHeading,
|
|
302
|
+
toolbarGroups,
|
|
303
|
+
trapTabWithin,
|
|
304
|
+
watchFontErrors,
|
|
305
|
+
watchGridSetup,
|
|
306
|
+
whenOpenSettles,
|
|
307
|
+
workbookNumberFormatCodes,
|
|
308
|
+
zoomSlice
|
|
309
|
+
};
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export { C as CSS_PIXELS_PER_INCH, E as EMU_PER_POINT, P as POINTS_PER_PIXEL, e as emuToPoints, p as pixelsToPoints, a as pointsToPixels } from './units-D6CD_A5I.js';
|
|
2
|
+
import { T as TextMeasurer } from './harfbuzz-measurer-CkKfsEyu.js';
|
|
3
|
+
export { D as DEFAULT_FALLBACK_FAMILY, E as EAST_ASIAN_FALLBACK_FAMILIES, F as FONT_SUBSTITUTES, a as FaceMetrics, b as FontRequest, c as FontSource, H as HOST_SUBSTITUTE_ORIGIN, R as RegisteredFace, d as ResolvedFace, e as createFixedMeasurer, f as createHarfBuzzMeasurer, g as eastAsianFallbackFamilies, i as initializeHarfBuzz, h as isHarfBuzzReady } from './harfbuzz-measurer-CkKfsEyu.js';
|
|
4
|
+
import { G as GridProfile } from './sheet-layout-D9M_4EBn.js';
|
|
5
|
+
export { A as AutoRowHeight, a as AxisEntry, b as AxisIndex, c as AxisSegment, C as CellBox, d as CellRange, e as CellTextBox, f as CellTextInput, g as CellTextLayout, D as DrawingLayout, F as FontKey, h as FontPixels, i as FrozenPanes, j as GridMetrics, L as LayoutOptions, k as LayoutProblem, M as MAX_ANCHORS, l as MAX_WINDOW, m as MergeIndex, O as OVERFLOW_REACH, P as PRINT_PROFILE, n as PaneLayout, o as PictureLayout, R as Rect, S as SCREEN_PROFILE, p as ShapeLayout, q as SheetGeometry, r as SheetLayout, T as TextContext, s as TextLine, t as TextRunInput, u as TextSpan, v as TextStyle, U as UnsupportedDrawing, V as ValueKind, w as Viewport, x as autoRowHeight, y as baseColumnWidth, z as columnPixels, B as columnWidthForPixels, E as drawingBounds, H as drawingPartOf, I as fontPixels, J as frozenPanes, K as gridMetrics, N as layoutCellText, Q as layoutSheet, W as mergedRanges, X as parseRange, Y as pixelWidth, Z as rowHeightForPixels, _ as sheetDrawings, $ as sheetGeometry, a0 as zoomProfile } from './sheet-layout-D9M_4EBn.js';
|
|
6
|
+
import { XlsxPackage } from './store.js';
|
|
7
|
+
import { NumberLocale } from './cascade.js';
|
|
8
|
+
import './cell-format-DW8yF-c-.js';
|
|
9
|
+
import './sheet-index-P5vevMWX.js';
|
|
10
|
+
import './theme-BprDji6x.js';
|
|
11
|
+
|
|
12
|
+
/** One known approximation. */
|
|
13
|
+
interface Approximation {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
/** The bold title of its item in the public list, without the period. */
|
|
16
|
+
readonly title: string;
|
|
17
|
+
/** Whether layout detects it on a sheet. */
|
|
18
|
+
readonly perSheet: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The cases that no reference PDF measures, each as its public item names it word for word.
|
|
21
|
+
* A test keeps each one in the text of the item.
|
|
22
|
+
*/
|
|
23
|
+
readonly unmeasured?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
/** Every known approximation, in the order of the public list. */
|
|
26
|
+
declare const APPROXIMATIONS: readonly Approximation[];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Point the text shaper at an externally hosted copy of `harfbuzz.wasm`.
|
|
30
|
+
*
|
|
31
|
+
* Needed only under bundlers that do not emit `new URL(..., import.meta.url)`
|
|
32
|
+
* assets. esbuild and Bun are the common ones, and so is any build that inlines
|
|
33
|
+
* dynamic imports, such as a library bundle. There, the build succeeds and the
|
|
34
|
+
* shaper fails at runtime with an error that names this function;
|
|
35
|
+
* this function is the fix. Vite and webpack emit the binary on their own, and the
|
|
36
|
+
* `check:consumer-install` check in CI verifies both. Passing a URL there overrides the
|
|
37
|
+
* emitted one.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { setHarfBuzzWasmUrl } from '@xlsx-editor.dev/core/layout';
|
|
41
|
+
* setHarfBuzzWasmUrl('/static/harfbuzz.wasm');
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Pass a URL your application controls. It is fetched and instantiated as
|
|
45
|
+
* WebAssembly, so never derive it from user input, a query parameter, or remote
|
|
46
|
+
* configuration. Serving it cross-origin needs that origin in your `connect-src`
|
|
47
|
+
* CSP directive, and WebAssembly needs `wasm-unsafe-eval` in `script-src` either
|
|
48
|
+
* way.
|
|
49
|
+
*
|
|
50
|
+
* Call it before the first editor is created. The runtime reads the location once
|
|
51
|
+
* and caches the result, so a call afterwards warns and does nothing: fix the
|
|
52
|
+
* call site and reload. The file to serve is exported as
|
|
53
|
+
* `@xlsx-editor.dev/core/harfbuzz.wasm`, and it must be the copy from the
|
|
54
|
+
* installed package version, because the runtime refuses a version mismatch at
|
|
55
|
+
* load rather than shaping with unverified metrics.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
declare function setHarfBuzzWasmUrl(url: string | URL): void;
|
|
60
|
+
|
|
61
|
+
/** Whether a code point is an East Asian character that breaks per character. */
|
|
62
|
+
declare function isIdeographic(cp: number): boolean;
|
|
63
|
+
/** Kinsoku lists: characters that may not start a line, and characters that may not end one. */
|
|
64
|
+
interface KinsokuLists {
|
|
65
|
+
/** Characters that may not start a line. */
|
|
66
|
+
readonly notStart: string;
|
|
67
|
+
/** Characters that may not end a line. */
|
|
68
|
+
readonly notEnd: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Break opportunities in `text`. `eaLineBreak` applies the East Asian line breaking rules
|
|
72
|
+
* (`a:pPr/@eaLnBrk`, on by default); `latinLineBreak` allows a break between any two
|
|
73
|
+
* characters (`a:pPr/@latinLnBrk`). `kinsoku` replaces the built-in lists of those rules.
|
|
74
|
+
*/
|
|
75
|
+
declare function breakOpportunities(text: string, eaLineBreak?: boolean, latinLineBreak?: boolean, kinsoku?: KinsokuLists): Uint8Array;
|
|
76
|
+
|
|
77
|
+
/** The text of a number that fits `available` points, given a width function. */
|
|
78
|
+
declare function fitNumber(value: number, text: string, general: boolean, decimal: string, available: number, width: (text: string) => number): string;
|
|
79
|
+
|
|
80
|
+
/** What a fit measures with. */
|
|
81
|
+
interface FitOptions {
|
|
82
|
+
readonly measurer: TextMeasurer;
|
|
83
|
+
/** The profile at zoom 1. A width and a height are in zoom-1 units. */
|
|
84
|
+
readonly profile: GridProfile;
|
|
85
|
+
/** The zooms at which every fitted cell must show its text. Zoom 1 counts always. */
|
|
86
|
+
readonly zooms?: readonly number[];
|
|
87
|
+
}
|
|
88
|
+
/** What a column fit measures with. */
|
|
89
|
+
interface FitColumnOptions extends FitOptions {
|
|
90
|
+
/** The locale of the number formats. */
|
|
91
|
+
readonly locale?: NumberLocale;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The widths in characters that fit the columns `first` to `last` (0-based) of a worksheet to
|
|
95
|
+
* their content, by column. Each counted cell shows all of its text, unchanged, at each zoom of
|
|
96
|
+
* `options.zooms`. A column with no cell that fits it, a hidden column, and a column with a cell
|
|
97
|
+
* read after the conditional formatting check budget ran out have no entry.
|
|
98
|
+
* Undefined for an unknown sheet.
|
|
99
|
+
*/
|
|
100
|
+
declare function fitColumnWidths(pkg: XlsxPackage, sheetName: string, first: number, last: number, options: FitColumnOptions): Map<number, number> | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* The heights in points that fit the rows `first` to `last` (0-based) of a worksheet to their
|
|
103
|
+
* content, by row: the automatic height at zoom 1, raised for a row with a wrapped cell where
|
|
104
|
+
* a zoom of `options.zooms` needs more than one pixel of that zoom beyond it. Only rows that the
|
|
105
|
+
* file holds and whose `@ht` or `@customHeight` changes have an entry. A hidden row and a row
|
|
106
|
+
* with rotated or stacked text have none. Undefined for an unknown sheet.
|
|
107
|
+
*/
|
|
108
|
+
declare function fitRowHeights(pkg: XlsxPackage, sheetName: string, first: number, last: number, options: FitOptions): Map<number, number> | undefined;
|
|
109
|
+
|
|
110
|
+
export { APPROXIMATIONS, GridProfile, TextMeasurer, breakOpportunities, fitColumnWidths, fitNumber, fitRowHeights, isIdeographic, setHarfBuzzWasmUrl };
|
|
111
|
+
export type { Approximation, FitColumnOptions, FitOptions, KinsokuLists };
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
APPROXIMATIONS,
|
|
3
|
+
AxisIndex,
|
|
4
|
+
CSS_PIXELS_PER_INCH,
|
|
5
|
+
DEFAULT_FALLBACK_FAMILY,
|
|
6
|
+
EAST_ASIAN_FALLBACK_FAMILIES,
|
|
7
|
+
EMU_PER_POINT,
|
|
8
|
+
FONT_SUBSTITUTES,
|
|
9
|
+
HOST_SUBSTITUTE_ORIGIN,
|
|
10
|
+
MAX_ANCHORS,
|
|
11
|
+
MAX_WINDOW,
|
|
12
|
+
OVERFLOW_REACH,
|
|
13
|
+
POINTS_PER_PIXEL,
|
|
14
|
+
PRINT_PROFILE,
|
|
15
|
+
SCREEN_PROFILE,
|
|
16
|
+
autoRowHeight,
|
|
17
|
+
baseColumnWidth,
|
|
18
|
+
breakOpportunities,
|
|
19
|
+
columnPixels,
|
|
20
|
+
columnWidthForPixels,
|
|
21
|
+
createFixedMeasurer,
|
|
22
|
+
createHarfBuzzMeasurer,
|
|
23
|
+
drawingBounds,
|
|
24
|
+
drawingPartOf,
|
|
25
|
+
eastAsianFallbackFamilies,
|
|
26
|
+
emuToPoints,
|
|
27
|
+
fitColumnWidths,
|
|
28
|
+
fitNumber,
|
|
29
|
+
fitRowHeights,
|
|
30
|
+
fontPixels,
|
|
31
|
+
gridMetrics,
|
|
32
|
+
initializeHarfBuzz,
|
|
33
|
+
isHarfBuzzReady,
|
|
34
|
+
isIdeographic,
|
|
35
|
+
layoutCellText,
|
|
36
|
+
layoutSheet,
|
|
37
|
+
pixelWidth,
|
|
38
|
+
pixelsToPoints,
|
|
39
|
+
pointsToPixels,
|
|
40
|
+
rowHeightForPixels,
|
|
41
|
+
sheetDrawings,
|
|
42
|
+
sheetGeometry,
|
|
43
|
+
zoomProfile
|
|
44
|
+
} from "./chunk-TE4FXG5T.js";
|
|
45
|
+
import {
|
|
46
|
+
setHarfBuzzWasmUrl
|
|
47
|
+
} from "./chunk-7PV5HQPE.js";
|
|
48
|
+
import {
|
|
49
|
+
frozenPanes,
|
|
50
|
+
mergedRanges,
|
|
51
|
+
parseRange
|
|
52
|
+
} from "./chunk-2ZU4337U.js";
|
|
53
|
+
import "./chunk-PRHLYXHL.js";
|
|
54
|
+
import "./chunk-KG4IL4JI.js";
|
|
55
|
+
import "./chunk-44L37ENZ.js";
|
|
56
|
+
import "./chunk-2DLJYRJC.js";
|
|
57
|
+
export {
|
|
58
|
+
APPROXIMATIONS,
|
|
59
|
+
AxisIndex,
|
|
60
|
+
CSS_PIXELS_PER_INCH,
|
|
61
|
+
DEFAULT_FALLBACK_FAMILY,
|
|
62
|
+
EAST_ASIAN_FALLBACK_FAMILIES,
|
|
63
|
+
EMU_PER_POINT,
|
|
64
|
+
FONT_SUBSTITUTES,
|
|
65
|
+
HOST_SUBSTITUTE_ORIGIN,
|
|
66
|
+
MAX_ANCHORS,
|
|
67
|
+
MAX_WINDOW,
|
|
68
|
+
OVERFLOW_REACH,
|
|
69
|
+
POINTS_PER_PIXEL,
|
|
70
|
+
PRINT_PROFILE,
|
|
71
|
+
SCREEN_PROFILE,
|
|
72
|
+
autoRowHeight,
|
|
73
|
+
baseColumnWidth,
|
|
74
|
+
breakOpportunities,
|
|
75
|
+
columnPixels,
|
|
76
|
+
columnWidthForPixels,
|
|
77
|
+
createFixedMeasurer,
|
|
78
|
+
createHarfBuzzMeasurer,
|
|
79
|
+
drawingBounds,
|
|
80
|
+
drawingPartOf,
|
|
81
|
+
eastAsianFallbackFamilies,
|
|
82
|
+
emuToPoints,
|
|
83
|
+
fitColumnWidths,
|
|
84
|
+
fitNumber,
|
|
85
|
+
fitRowHeights,
|
|
86
|
+
fontPixels,
|
|
87
|
+
frozenPanes,
|
|
88
|
+
gridMetrics,
|
|
89
|
+
initializeHarfBuzz,
|
|
90
|
+
isHarfBuzzReady,
|
|
91
|
+
isIdeographic,
|
|
92
|
+
layoutCellText,
|
|
93
|
+
layoutSheet,
|
|
94
|
+
mergedRanges,
|
|
95
|
+
parseRange,
|
|
96
|
+
pixelWidth,
|
|
97
|
+
pixelsToPoints,
|
|
98
|
+
pointsToPixels,
|
|
99
|
+
rowHeightForPixels,
|
|
100
|
+
setHarfBuzzWasmUrl,
|
|
101
|
+
sheetDrawings,
|
|
102
|
+
sheetGeometry,
|
|
103
|
+
zoomProfile
|
|
104
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { R as ResolvedCellFormat } from './cell-format-DW8yF-c-.js';
|
|
2
|
+
import { W as WorkbookOp, O as OpRejection, F as FormatPatch } from './ops-CfUCjyph.js';
|
|
3
|
+
import { GridSelection } from './contracts.js';
|
|
4
|
+
|
|
5
|
+
/** Ops for a command, or why the command is refused before the store sees it. */
|
|
6
|
+
type CommandOps = {
|
|
7
|
+
readonly ok: true;
|
|
8
|
+
readonly ops: readonly WorkbookOp[];
|
|
9
|
+
} | {
|
|
10
|
+
readonly ok: false;
|
|
11
|
+
readonly rejection: OpRejection;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The `applyFormat` op of a patch on a range of a sheet. A number format code that the parser
|
|
15
|
+
* cannot read is refused here; the op keeps the code, and the store lowers it with the
|
|
16
|
+
* workbook's own `x:numFmt` records (`lowerNumberFormat`).
|
|
17
|
+
*/
|
|
18
|
+
declare function formatOps(sheet: string, ref: string, patch: FormatPatch): CommandOps;
|
|
19
|
+
/** What a clear removes: values and formulas, cell formats, or both. */
|
|
20
|
+
type ClearKind = 'contents' | 'formats' | 'all';
|
|
21
|
+
/** The ops of a clear of a range. `all` is one transaction of both clears. */
|
|
22
|
+
declare function clearOps(sheet: string, ref: string, kind: ClearKind): readonly WorkbookOp[];
|
|
23
|
+
/** The font properties that a shortcut toggles. */
|
|
24
|
+
type FormatToggle = 'bold' | 'italic' | 'underline';
|
|
25
|
+
/**
|
|
26
|
+
* The patch that toggles a font property, from the resolved format of the active cell: the
|
|
27
|
+
* same format that the editor shows as the toolbar state, so the state and the command agree.
|
|
28
|
+
*/
|
|
29
|
+
declare function togglePatch(format: ResolvedCellFormat, which: FormatToggle): FormatPatch;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* How a merge treats the selection.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
interface MergeOptions {
|
|
37
|
+
/** Also center the text of the merged cell, as `horizontal="center"`. */
|
|
38
|
+
readonly center?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Clear the values and formulas of the cells other than the top-left cell, so the merge keeps
|
|
41
|
+
* only the top-left value. Without it, a merge over other values is refused with
|
|
42
|
+
* `merge-drops-values`, so the host can ask the user first. The clear can refuse with the
|
|
43
|
+
* reasons of a clear of values, such as `shared-formula` for a part of an array formula range.
|
|
44
|
+
*/
|
|
45
|
+
readonly dropValues?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** The ops that merge the range of `selection` on `sheet`. */
|
|
48
|
+
declare function mergeOps(sheet: string, selection: GridSelection, options?: MergeOptions): WorkbookOp[];
|
|
49
|
+
/** The op that unmerges the merged ranges that the range of `selection` meets on `sheet`. */
|
|
50
|
+
declare function unmergeOp(sheet: string, selection: GridSelection): WorkbookOp;
|
|
51
|
+
|
|
52
|
+
export { clearOps as c, formatOps as f, mergeOps as m, togglePatch as t, unmergeOp as u };
|
|
53
|
+
export type { ClearKind as C, FormatToggle as F, MergeOptions as M, CommandOps as a };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/layout/node-module-shim.ts
|
|
2
|
+
function nodeModuleBuiltin() {
|
|
3
|
+
const runtime = globalThis.process;
|
|
4
|
+
if (typeof runtime?.getBuiltinModule !== "function") return void 0;
|
|
5
|
+
return runtime.getBuiltinModule("module");
|
|
6
|
+
}
|
|
7
|
+
function createRequire(path) {
|
|
8
|
+
const builtin = nodeModuleBuiltin();
|
|
9
|
+
if (!builtin) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
"createRequire is unavailable: this build reaches Node's `module` through process.getBuiltinModule, which needs Node 20.16+ or 22.3+."
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return builtin.createRequire(path);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
createRequire
|
|
18
|
+
};
|