@ship-ui/core 0.22.15 → 0.22.17
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/assets/mcp/components.json +213 -47
- package/bin/src/subset.ts +6 -6
- package/bin/src/utilities.ts +14 -14
- package/fesm2022/ship-ui-core-ship-a11y-keybindings.mjs +12 -86
- package/fesm2022/ship-ui-core-ship-a11y-keybindings.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-accordion.mjs +4 -3
- package/fesm2022/ship-ui-core-ship-accordion.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-alert.mjs +1 -4
- package/fesm2022/ship-ui-core-ship-alert.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-blueprint.mjs +17 -11
- package/fesm2022/ship-ui-core-ship-blueprint.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-checkbox.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-checkbox.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-color-picker.mjs +66 -62
- package/fesm2022/ship-ui-core-ship-color-picker.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-datepicker.mjs +24 -16
- package/fesm2022/ship-ui-core-ship-datepicker.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-dialog.mjs +4 -0
- package/fesm2022/ship-ui-core-ship-dialog.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-editor.mjs +0 -42
- package/fesm2022/ship-ui-core-ship-editor.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-form-field.mjs +0 -1
- package/fesm2022/ship-ui-core-ship-form-field.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-kbd.mjs +0 -6
- package/fesm2022/ship-ui-core-ship-kbd.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-list-item-swipe.mjs +241 -0
- package/fesm2022/ship-ui-core-ship-list-item-swipe.mjs.map +1 -0
- package/fesm2022/ship-ui-core-ship-menu.mjs +7 -10
- package/fesm2022/ship-ui-core-ship-menu.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-popover.mjs +5 -20
- package/fesm2022/ship-ui-core-ship-popover.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-radio.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-radio.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-range-slider.mjs +7 -9
- package/fesm2022/ship-ui-core-ship-range-slider.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-select.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-sidenav.mjs +2 -2
- package/fesm2022/ship-ui-core-ship-sidenav.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-sortable.mjs +262 -68
- package/fesm2022/ship-ui-core-ship-sortable.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-spotlight.mjs +0 -11
- package/fesm2022/ship-ui-core-ship-spotlight.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-stepper.mjs +1 -1
- package/fesm2022/ship-ui-core-ship-stepper.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-table.mjs +426 -23
- package/fesm2022/ship-ui-core-ship-table.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-toggle.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-toggle.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-tree.mjs +1 -9
- package/fesm2022/ship-ui-core-ship-tree.mjs.map +1 -1
- package/fesm2022/ship-ui-core.mjs +37 -53
- package/fesm2022/ship-ui-core.mjs.map +1 -1
- package/package.json +5 -1
- package/types/ship-ui-core-ship-a11y-keybindings.d.ts +0 -55
- package/types/ship-ui-core-ship-accordion.d.ts +7 -7
- package/types/ship-ui-core-ship-blueprint.d.ts +2 -1
- package/types/ship-ui-core-ship-checkbox.d.ts +2 -3
- package/types/ship-ui-core-ship-color-picker.d.ts +1 -25
- package/types/ship-ui-core-ship-datepicker.d.ts +2 -3
- package/types/ship-ui-core-ship-editor.d.ts +10 -10
- package/types/ship-ui-core-ship-list-item-swipe.d.ts +25 -0
- package/types/ship-ui-core-ship-menu.d.ts +1 -2
- package/types/ship-ui-core-ship-radio.d.ts +2 -3
- package/types/ship-ui-core-ship-range-slider.d.ts +6 -6
- package/types/ship-ui-core-ship-sortable.d.ts +31 -9
- package/types/ship-ui-core-ship-table.d.ts +12 -1
- package/types/ship-ui-core-ship-toggle.d.ts +2 -3
- package/types/ship-ui-core-ship-tree.d.ts +20 -25
- package/types/ship-ui-core.d.ts +17 -24
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
"name": "clearTimeout",
|
|
172
|
-
"parameters": "this.destroyTimeout);\n this.destroyTimeout = null;\n }\n }\n\n
|
|
172
|
+
"parameters": "this.destroyTimeout);\n this.destroyTimeout = null;\n }\n }\n\n #showTooltip(",
|
|
173
173
|
"returnType": "any",
|
|
174
174
|
"description": ""
|
|
175
175
|
}
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
{
|
|
362
362
|
"name": "execCommand",
|
|
363
363
|
"parameters": "commandId: string, showUI?: boolean, value?: string",
|
|
364
|
-
"returnType": "boolean;\n queryCommandState(commandId: string): boolean;\n queryCommandEnabled(commandId: string): boolean;\n}\n\n
|
|
364
|
+
"returnType": "boolean;\n queryCommandState(commandId: string): boolean;\n queryCommandEnabled(commandId: string): boolean;\n}\n\n\nconst SHIP_EDITOR_VALUE_ACCESSOR: Provider =",
|
|
365
365
|
"description": ""
|
|
366
366
|
},
|
|
367
367
|
{
|
|
@@ -394,6 +394,30 @@
|
|
|
394
394
|
"returnType": "void",
|
|
395
395
|
"description": ""
|
|
396
396
|
},
|
|
397
|
+
{
|
|
398
|
+
"name": "onDOMInput",
|
|
399
|
+
"parameters": "",
|
|
400
|
+
"returnType": "any",
|
|
401
|
+
"description": ""
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"name": "onDOMBlur",
|
|
405
|
+
"parameters": "",
|
|
406
|
+
"returnType": "any",
|
|
407
|
+
"description": ""
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"name": "onCodeInput",
|
|
411
|
+
"parameters": "event: Event",
|
|
412
|
+
"returnType": "any",
|
|
413
|
+
"description": ""
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"name": "onCodeBlur",
|
|
417
|
+
"parameters": "event: Event",
|
|
418
|
+
"returnType": "any",
|
|
419
|
+
"description": ""
|
|
420
|
+
},
|
|
397
421
|
{
|
|
398
422
|
"name": "formatText",
|
|
399
423
|
"parameters": "command: string, value: string = ''",
|
|
@@ -454,18 +478,42 @@
|
|
|
454
478
|
"returnType": "any",
|
|
455
479
|
"description": ""
|
|
456
480
|
},
|
|
481
|
+
{
|
|
482
|
+
"name": "toggleViewMode",
|
|
483
|
+
"parameters": "",
|
|
484
|
+
"returnType": "any",
|
|
485
|
+
"description": ""
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"name": "onSelectionChange",
|
|
489
|
+
"parameters": "",
|
|
490
|
+
"returnType": "any",
|
|
491
|
+
"description": ""
|
|
492
|
+
},
|
|
457
493
|
{
|
|
458
494
|
"name": "openLinkModal",
|
|
459
495
|
"parameters": "",
|
|
460
496
|
"returnType": "any",
|
|
461
497
|
"description": ""
|
|
462
498
|
},
|
|
499
|
+
{
|
|
500
|
+
"name": "applyLink",
|
|
501
|
+
"parameters": "url: string",
|
|
502
|
+
"returnType": "any",
|
|
503
|
+
"description": ""
|
|
504
|
+
},
|
|
463
505
|
{
|
|
464
506
|
"name": "openImageModal",
|
|
465
507
|
"parameters": "",
|
|
466
508
|
"returnType": "any",
|
|
467
509
|
"description": ""
|
|
468
510
|
},
|
|
511
|
+
{
|
|
512
|
+
"name": "applyImage",
|
|
513
|
+
"parameters": "url: string",
|
|
514
|
+
"returnType": "any",
|
|
515
|
+
"description": ""
|
|
516
|
+
},
|
|
469
517
|
{
|
|
470
518
|
"name": "onComponentFocusIn",
|
|
471
519
|
"parameters": "event: FocusEvent",
|
|
@@ -502,6 +550,18 @@
|
|
|
502
550
|
"returnType": "string",
|
|
503
551
|
"description": ""
|
|
504
552
|
},
|
|
553
|
+
{
|
|
554
|
+
"name": "onToolbarKeyDown",
|
|
555
|
+
"parameters": "event: KeyboardEvent",
|
|
556
|
+
"returnType": "any",
|
|
557
|
+
"description": ""
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"name": "onToolbarFocusIn",
|
|
561
|
+
"parameters": "event: FocusEvent",
|
|
562
|
+
"returnType": "any",
|
|
563
|
+
"description": ""
|
|
564
|
+
},
|
|
505
565
|
{
|
|
506
566
|
"name": "onComponentScroll",
|
|
507
567
|
"parameters": "event: Event",
|
|
@@ -703,7 +763,7 @@
|
|
|
703
763
|
"methods": [
|
|
704
764
|
{
|
|
705
765
|
"name": "Autolayout",
|
|
706
|
-
"parameters": "true);\n autoLayout = input<boolean>(false);\n gridSize = input(20);\n snapToGrid = input<boolean>(true);\n gridColor = input<[string, string]>(['#d8d8d8', '#2c2c2c']);\n\n nodes = model<BlueprintNode[]>([]);\n\n #currentGridColor = computed(() => this.gridColor()[this.lightMode() ? 0 : 1]);\n\n panX = signal(0);\n panY = signal(0);\n zoomLevel = signal(1);\n gridSnapSize = signal(20);\n\n isHoveringNode = signal(false);\n midpointDivPosition = signal<{ x: number; y: number } | null>(null);\n showMidpointDiv = signal(false);\n isLocked = signal(false);\n draggingConnection = signal<DragState | null>(null);\n validationErrors = signal<ValidationErrors | null>(null);\n highlightedConnection = signal<Connection | null>(null);\n\n #draggingNodeCoordinates = signal<Coordinates | null>(null);\n #isDragging = signal(false);\n #lastMouseX = signal(0);\n #lastMouseY = signal(0);\n #initialPinchDistance = signal(0);\n #isNodeDragging = signal(false);\n #draggedNodeId = signal<string | null>(null);\n #dragOffset = signal<Coordinates | null>(null);\n #connections = signal<Connection[]>([]);\n #canvasWidth = signal(0);\n #canvasHeight = signal(0);\n\n
|
|
766
|
+
"parameters": "true);\n autoLayout = input<boolean>(false);\n gridSize = input(20);\n snapToGrid = input<boolean>(true);\n gridColor = input<[string, string]>(['#d8d8d8', '#2c2c2c']);\n\n nodes = model<BlueprintNode[]>([]);\n\n #currentGridColor = computed(() => this.gridColor()[this.lightMode() ? 0 : 1]);\n\n panX = signal(0);\n panY = signal(0);\n zoomLevel = signal(1);\n gridSnapSize = signal(20);\n\n isHoveringNode = signal(false);\n midpointDivPosition = signal<{ x: number; y: number } | null>(null);\n showMidpointDiv = signal(false);\n isLocked = signal(false);\n draggingConnection = signal<DragState | null>(null);\n validationErrors = signal<ValidationErrors | null>(null);\n highlightedConnection = signal<Connection | null>(null);\n\n #draggingNodeCoordinates = signal<Coordinates | null>(null);\n #isDragging = signal(false);\n #lastMouseX = signal(0);\n #lastMouseY = signal(0);\n #initialPinchDistance = signal(0);\n #isNodeDragging = signal(false);\n #draggedNodeId = signal<string | null>(null);\n #dragOffset = signal<Coordinates | null>(null);\n #connections = signal<Connection[]>([]);\n #canvasWidth = signal(0);\n #canvasHeight = signal(0);\n\n canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('blueprintCanvas');\n #ctx!: CanvasRenderingContext2D;\n #resizeObserver!: ResizeObserver;\n\n visibleNodes = computed(() => {\n const nodes = this.nodes();\n const panX = this.panX();\n const panY = this.panY();\n const zoom = this.zoomLevel();\n const width = this.#canvasWidth();\n const height = this.#canvasHeight();\n\n if (width === 0 || height === 0",
|
|
707
767
|
"returnType": "any",
|
|
708
768
|
"description": ""
|
|
709
769
|
},
|
|
@@ -936,7 +996,7 @@
|
|
|
936
996
|
},
|
|
937
997
|
{
|
|
938
998
|
"name": "return",
|
|
939
|
-
"parameters": "pos.left >= 0 &&\n pos.top >= 0 &&\n pos.left + m.width <= window.innerWidth &&\n pos.top + m.height <= window.innerHeight\n );\n }\n\n
|
|
999
|
+
"parameters": "pos.left >= 0 &&\n pos.top >= 0 &&\n pos.left + m.width <= window.innerWidth &&\n pos.top + m.height <= window.innerHeight\n );\n }\n\n \n #clampToViewport(pos: { left: number; top: number }, m: DOMRect",
|
|
940
1000
|
"returnType": "any",
|
|
941
1001
|
"description": ""
|
|
942
1002
|
}
|
|
@@ -1101,7 +1161,14 @@
|
|
|
1101
1161
|
}
|
|
1102
1162
|
],
|
|
1103
1163
|
"outputs": [],
|
|
1104
|
-
"methods": [
|
|
1164
|
+
"methods": [
|
|
1165
|
+
{
|
|
1166
|
+
"name": "onInternalInputChange",
|
|
1167
|
+
"parameters": "event: Event",
|
|
1168
|
+
"returnType": "any",
|
|
1169
|
+
"description": ""
|
|
1170
|
+
}
|
|
1171
|
+
],
|
|
1105
1172
|
"cssVariables": [
|
|
1106
1173
|
{
|
|
1107
1174
|
"name": "--toggle-bg",
|
|
@@ -1194,7 +1261,7 @@
|
|
|
1194
1261
|
"methods": [
|
|
1195
1262
|
{
|
|
1196
1263
|
"name": "effect",
|
|
1197
|
-
"parameters": "() => {\n const inputs = this.#inputObserver() as HTMLInputElement[];\n if (inputs.length === 0) return;\n\n if (inputs[0]) this
|
|
1264
|
+
"parameters": "() => {\n const inputs = this.#inputObserver() as HTMLInputElement[];\n if (inputs.length === 0) return;\n\n if (inputs[0]) this.#setupInput(inputs[0], true);\n if (inputs[1]) this.#setupInput(inputs[1], false);\n });\n }\n\n #setupInput(element: HTMLInputElement, isStart: boolean",
|
|
1198
1265
|
"returnType": "any",
|
|
1199
1266
|
"description": ""
|
|
1200
1267
|
},
|
|
@@ -1728,7 +1795,7 @@
|
|
|
1728
1795
|
},
|
|
1729
1796
|
{
|
|
1730
1797
|
"name": "effect",
|
|
1731
|
-
"parameters": "() => {\n this.items();
|
|
1798
|
+
"parameters": "() => {\n this.items(); \n this.updateProgress();\n });\n\n if (typeof MutationObserver !== 'undefined'",
|
|
1732
1799
|
"returnType": "any",
|
|
1733
1800
|
"description": ""
|
|
1734
1801
|
},
|
|
@@ -1891,6 +1958,12 @@
|
|
|
1891
1958
|
"description": "",
|
|
1892
1959
|
"defaultValue": "'start'"
|
|
1893
1960
|
},
|
|
1961
|
+
{
|
|
1962
|
+
"name": "grid",
|
|
1963
|
+
"type": "boolean",
|
|
1964
|
+
"description": "",
|
|
1965
|
+
"defaultValue": "false"
|
|
1966
|
+
},
|
|
1894
1967
|
{
|
|
1895
1968
|
"name": "loading",
|
|
1896
1969
|
"type": "boolean",
|
|
@@ -1948,6 +2021,18 @@
|
|
|
1948
2021
|
}
|
|
1949
2022
|
],
|
|
1950
2023
|
"methods": [
|
|
2024
|
+
{
|
|
2025
|
+
"name": "effect",
|
|
2026
|
+
"parameters": "() => {\n if (this.#sort()) return;\n\n const hostEl = this.#el.nativeElement;\n if (this.resizable()",
|
|
2027
|
+
"returnType": "any",
|
|
2028
|
+
"description": ""
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
"name": "onKeyDown",
|
|
2032
|
+
"parameters": "event: KeyboardEvent",
|
|
2033
|
+
"returnType": "any",
|
|
2034
|
+
"description": ""
|
|
2035
|
+
},
|
|
1951
2036
|
{
|
|
1952
2037
|
"name": "onMouseMove",
|
|
1953
2038
|
"parameters": "event: MouseEvent",
|
|
@@ -1956,19 +2041,19 @@
|
|
|
1956
2041
|
},
|
|
1957
2042
|
{
|
|
1958
2043
|
"name": "cancelAnimationFrame",
|
|
1959
|
-
"parameters": "this.#animationFrameRequest);\n }\n }\n}\n\n@Directive({\n selector: '[shSort]',\n standalone: true,\n host: {\n role: 'columnheader',\n '[class.sortable]': '!!shSort()',\n '[attr.tabindex]': '
|
|
1960
|
-
"returnType": "null',\n '[attr.aria-sort]': 'shSort() ? ariaSort() : null',\n '[class.sort-asc]': 'sortAsc()',\n '[class.sort-desc]': 'sortDesc()',\n },\n})\nexport class ShipSort",
|
|
2044
|
+
"parameters": "this.#animationFrameRequest);\n }\n }\n}\n\n@Directive({\n selector: '[shSort]',\n standalone: true,\n host: {\n role: 'columnheader',\n '[class.sortable]': '!!shSort()',\n '[attr.tabindex]': 'tabIndex()',\n '(click)': 'shSort() ? toggleSort($event",
|
|
2045
|
+
"returnType": "null',\n '[attr.aria-sort]': 'shSort() ? ariaSort() : null',\n '[class.sort-asc]': 'sortAsc()',\n '[class.sort-desc]': 'sortDesc()',\n '[attr.aria-keyshortcuts]': 'ariaKeyshortcuts()',\n },\n})\nexport class ShipSort",
|
|
1961
2046
|
"description": ""
|
|
1962
2047
|
},
|
|
1963
2048
|
{
|
|
1964
|
-
"name": "
|
|
1965
|
-
"parameters": "
|
|
2049
|
+
"name": "onCleanup",
|
|
2050
|
+
"parameters": "() => observer.disconnect());\n }\n });\n\n bodyEffect = effect(() => {\n const body = this.tbody()?.nativeElement;\n const head = this.thead()?.nativeElement;\n\n if (!body || !head) return;\n\n const stickyHeaderHeight = this.stickyHeaderHeight();\n\n queueMicrotask(() => {\n const hasStickyRowHeaderStartElement = head.querySelectorAll('tr.sticky').length > 0;\n const stickyBodyRows = body.querySelectorAll('tr.sticky');\n const hasStickyRowStartElement = stickyBodyRows.length > 0;\n\n if (hasStickyRowStartElement && hasStickyRowHeaderStartElement",
|
|
1966
2051
|
"returnType": "any",
|
|
1967
2052
|
"description": ""
|
|
1968
2053
|
},
|
|
1969
2054
|
{
|
|
1970
|
-
"name": "
|
|
1971
|
-
"parameters": "() =>
|
|
2055
|
+
"name": "untracked",
|
|
2056
|
+
"parameters": "() => {\n const host = this.#el.nativeElement;\n const allCells = host.querySelectorAll('th, td');\n\n if (gridActive",
|
|
1972
2057
|
"returnType": "any",
|
|
1973
2058
|
"description": ""
|
|
1974
2059
|
},
|
|
@@ -1990,6 +2075,12 @@
|
|
|
1990
2075
|
"returnType": "any",
|
|
1991
2076
|
"description": ""
|
|
1992
2077
|
},
|
|
2078
|
+
{
|
|
2079
|
+
"name": "onGridKeyDown",
|
|
2080
|
+
"parameters": "event: KeyboardEvent",
|
|
2081
|
+
"returnType": "any",
|
|
2082
|
+
"description": ""
|
|
2083
|
+
},
|
|
1993
2084
|
{
|
|
1994
2085
|
"name": "toggleSort",
|
|
1995
2086
|
"parameters": "column: string",
|
|
@@ -2123,8 +2214,8 @@
|
|
|
2123
2214
|
},
|
|
2124
2215
|
{
|
|
2125
2216
|
"name": "config-table",
|
|
2126
|
-
"html": "<sh-table\n [loading]=\"isLoading()\"\n [data]=\"users()\"\n (dataChange)=\"users.set($event)\"\n [variant]=\"variant()\"\n aria-label=\"User Management Configuration Table\">\n <button shButton actionbar class=\"small primary\" (click)=\"toggleLoading()\">\n <sh-icon>spinner</sh-icon>\n Toggle Loading\n </button>\n <button shButton actionbar class=\"small flat\" (click)=\"resetData()\">\n <sh-icon>arrow-counter-clockwise</sh-icon>\n Reset Data\n </button>\n\n <sh-table-content [columns]=\"columns()\" [data]=\"users()\" />\n\n <!-- Custom User Column Template -->\n <ng-template #nameTemplate let-row>\n <div class=\"user-cell\">\n <span class=\"user-name\">{{ row.name }}</span>\n <span class=\"user-email\">{{ row.email }}</span>\n </div>\n </ng-template>\n\n <!-- Custom Actions Column Template -->\n <ng-template #actionsTemplate let-row>\n <button shButton class=\"small text primary\" (click)=\"editUser(row)\" title=\"Edit user\">\n <sh-icon>pencil-simple</sh-icon>\n </button>\n <button shButton class=\"small text error\" (click)=\"deleteUser(row.id)\" title=\"Delete user\">\n <sh-icon>trash</sh-icon>\n </button>\n </ng-template>\n</sh-table>\n",
|
|
2127
|
-
"ts": "import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input, signal, TemplateRef, viewChild } from '@angular/core';\nimport { ShipTableVariant } from '@ship-ui/core';\nimport { ShipButton } from '@ship-ui/core/ship-button';\nimport { ShipIcon } from '@ship-ui/core/ship-icon';\nimport { ShipTable, ShipTableColumn, ShipTableContent } from '@ship-ui/core/ship-table';\n\nexport interface ConfigUserElement {\n id: number;\n name: string;\n email: string;\n role: string;\n active: boolean;\n joined: string;\n bio: string;\n}\n\nconst INITIAL_USERS: ConfigUserElement[] = [\n {\n id: 1,\n name: 'Alice Vance',\n email: 'alice@shipui.com',\n role: 'Administrator',\n active: true,\n joined: '2025-01-15T09:30:00',\n bio: 'Lead platform engineer and architect of the design system components.',\n },\n {\n id: 2,\n name: 'Bob Smith',\n email: 'bob@shipui.com',\n role: 'Developer',\n active: true,\n joined: '2025-03-22T17:15:00',\n bio: 'Frontend engineer specializing in accessible interactive charts and graphs.',\n },\n {\n id: 3,\n name: 'Charlie Brown',\n email: 'charlie@shipui.com',\n role: 'Support',\n active: false,\n joined: '2025-06-05T11:00:00',\n bio: 'Customer success advocate passionate about documentation and developer experience.',\n },\n {\n id: 4,\n name: 'Diana Prince',\n email: 'diana@shipui.com',\n role: 'Product Manager',\n active: true,\n joined: '2024-10-12T08:45:00',\n bio: 'Product strategist steering the integration of AI-assisted coding tools.',\n },\n {\n id: 5,\n name: 'Evan Wright',\n email: 'evan@shipui.com',\n role: 'Designer',\n active: false,\n joined: '2024-12-01T14:20:00',\n bio: 'UI/UX specialist designer who crafted the glassmorphism aesthetic guidelines.',\n },\n];\n\n@Component({\n selector: 'config-table',\n standalone: true,\n imports: [CommonModule, ShipTable, ShipTableContent, ShipButton, ShipIcon],\n templateUrl: './config-table.html',\n styleUrl: './config-table.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ConfigTable {\n variant = input<ShipTableVariant | null>(null);\n\n // Sample data\n users = signal<ConfigUserElement[]>([...INITIAL_USERS]);\n isLoading = signal<boolean>(false);\n\n // Template viewChild references\n nameTemplate = viewChild.required<TemplateRef<any>>('nameTemplate');\n actionsTemplate = viewChild.required<TemplateRef<any>>('actionsTemplate');\n\n // Reactively build columns once templates are loaded\n columns = computed<ShipTableColumn<ConfigUserElement>[]>(() => [\n {\n id: 'id',\n header: 'ID',\n type: 'number',\n sortable: true,\n size: '60px',\n sticky: 'start',\n },\n {\n id: 'name',\n header: 'User',\n type: 'string',\n sortable: true,\n size: '220px',\n sticky: 'start',\n cellTemplate: this.nameTemplate(),\n rowHeader: true,\n },\n {\n id: 'role',\n header: 'Role',\n type: 'badge',\n sortable: true,\n size: '150px',\n },\n {\n id: 'active',\n header: 'Active Status',\n type: 'boolean',\n sortable: true,\n size: '120px',\n },\n {\n id: 'joined',\n header: 'Joined Date',\n type: 'date',\n sortable: true,\n size: '140px',\n },\n {\n id: 'bio',\n header: 'Bio',\n type: 'string',\n resizable: true,\n size: '1fr',\n },\n {\n id: 'actions',\n header: 'Actions',\n sticky: 'end',\n cellTemplate: this.actionsTemplate(),\n },\n ]);\n\n toggleLoading() {\n this.isLoading.set(true);\n setTimeout(() => {\n this.isLoading.set(false);\n }, 1200);\n }\n\n deleteUser(id: number) {\n this.users.update((current) => current.filter((u) => u.id !== id));\n }\n\n editUser(user: ConfigUserElement) {\n alert(`Editing user: ${user.name}`);\n }\n\n resetData() {\n this.users.set([...INITIAL_USERS]);\n }\n}\n"
|
|
2217
|
+
"html": "<sh-table\n [loading]=\"isLoading()\"\n [data]=\"users()\"\n (dataChange)=\"users.set($event)\"\n [variant]=\"variant()\"\n [grid]=\"gridMode()\"\n aria-label=\"User Management Configuration Table\">\n <button shButton actionbar class=\"small primary\" (click)=\"toggleLoading()\">\n <sh-icon>spinner</sh-icon>\n Toggle Loading\n </button>\n <button shButton actionbar class=\"small outline\" [class.primary]=\"gridMode()\" (click)=\"gridMode.set(!gridMode())\">\n <sh-icon>{{ gridMode() ? 'check-square' : 'square' }}</sh-icon>\n Interactive Grid: {{ gridMode() ? 'ON' : 'OFF' }}\n </button>\n <button shButton actionbar class=\"small flat\" (click)=\"resetData()\">\n <sh-icon>arrow-counter-clockwise</sh-icon>\n Reset Data\n </button>\n\n <sh-table-content [columns]=\"columns()\" [data]=\"users()\" />\n\n <!-- Custom User Column Template -->\n <ng-template #nameTemplate let-row>\n <div class=\"user-cell\">\n <span class=\"user-name\">{{ row.name }}</span>\n <span class=\"user-email\">{{ row.email }}</span>\n </div>\n </ng-template>\n\n <!-- Custom Actions Column Template -->\n <ng-template #actionsTemplate let-row>\n <button shButton class=\"small text primary\" (click)=\"editUser(row)\" title=\"Edit user\">\n <sh-icon>pencil-simple</sh-icon>\n </button>\n <button shButton class=\"small text error\" (click)=\"deleteUser(row.id)\" title=\"Delete user\">\n <sh-icon>trash</sh-icon>\n </button>\n </ng-template>\n</sh-table>\n",
|
|
2218
|
+
"ts": "import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input, signal, TemplateRef, viewChild } from '@angular/core';\nimport { ShipTableVariant } from '@ship-ui/core';\nimport { ShipButton } from '@ship-ui/core/ship-button';\nimport { ShipIcon } from '@ship-ui/core/ship-icon';\nimport { ShipTable, ShipTableColumn, ShipTableContent } from '@ship-ui/core/ship-table';\n\nexport interface ConfigUserElement {\n id: number;\n name: string;\n email: string;\n role: string;\n active: boolean;\n joined: string;\n bio: string;\n}\n\nconst INITIAL_USERS: ConfigUserElement[] = [\n {\n id: 1,\n name: 'Alice Vance',\n email: 'alice@shipui.com',\n role: 'Administrator',\n active: true,\n joined: '2025-01-15T09:30:00',\n bio: 'Lead platform engineer and architect of the design system components.',\n },\n {\n id: 2,\n name: 'Bob Smith',\n email: 'bob@shipui.com',\n role: 'Developer',\n active: true,\n joined: '2025-03-22T17:15:00',\n bio: 'Frontend engineer specializing in accessible interactive charts and graphs.',\n },\n {\n id: 3,\n name: 'Charlie Brown',\n email: 'charlie@shipui.com',\n role: 'Support',\n active: false,\n joined: '2025-06-05T11:00:00',\n bio: 'Customer success advocate passionate about documentation and developer experience.',\n },\n {\n id: 4,\n name: 'Diana Prince',\n email: 'diana@shipui.com',\n role: 'Product Manager',\n active: true,\n joined: '2024-10-12T08:45:00',\n bio: 'Product strategist steering the integration of AI-assisted coding tools.',\n },\n {\n id: 5,\n name: 'Evan Wright',\n email: 'evan@shipui.com',\n role: 'Designer',\n active: false,\n joined: '2024-12-01T14:20:00',\n bio: 'UI/UX specialist designer who crafted the glassmorphism aesthetic guidelines.',\n },\n];\n\n@Component({\n selector: 'config-table',\n standalone: true,\n imports: [CommonModule, ShipTable, ShipTableContent, ShipButton, ShipIcon],\n templateUrl: './config-table.html',\n styleUrl: './config-table.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ConfigTable {\n variant = input<ShipTableVariant | null>(null);\n\n // Sample data\n users = signal<ConfigUserElement[]>([...INITIAL_USERS]);\n isLoading = signal<boolean>(false);\n gridMode = signal<boolean>(false);\n\n // Template viewChild references\n nameTemplate = viewChild.required<TemplateRef<any>>('nameTemplate');\n actionsTemplate = viewChild.required<TemplateRef<any>>('actionsTemplate');\n\n // Reactively build columns once templates are loaded\n columns = computed<ShipTableColumn<ConfigUserElement>[]>(() => [\n {\n id: 'id',\n header: 'ID',\n type: 'number',\n sortable: true,\n size: '60px',\n sticky: 'start',\n },\n {\n id: 'name',\n header: 'User',\n type: 'string',\n sortable: true,\n size: '220px',\n sticky: 'start',\n cellTemplate: this.nameTemplate(),\n rowHeader: true,\n },\n {\n id: 'role',\n header: 'Role',\n type: 'badge',\n sortable: true,\n size: '150px',\n },\n {\n id: 'active',\n header: 'Active Status',\n type: 'boolean',\n sortable: true,\n size: '120px',\n },\n {\n id: 'joined',\n header: 'Joined Date',\n type: 'date',\n sortable: true,\n size: '140px',\n },\n {\n id: 'bio',\n header: 'Bio',\n type: 'string',\n resizable: true,\n size: '1fr',\n },\n {\n id: 'actions',\n header: 'Actions',\n sticky: 'end',\n cellTemplate: this.actionsTemplate(),\n },\n ]);\n\n toggleLoading() {\n this.isLoading.set(true);\n setTimeout(() => {\n this.isLoading.set(false);\n }, 1200);\n }\n\n deleteUser(id: number) {\n this.users.update((current) => current.filter((u) => u.id !== id));\n }\n\n editUser(user: ConfigUserElement) {\n alert(`Editing user: ${user.name}`);\n }\n\n resetData() {\n this.users.set([...INITIAL_USERS]);\n }\n}\n"
|
|
2128
2219
|
},
|
|
2129
2220
|
{
|
|
2130
2221
|
"name": "multi-table-header",
|
|
@@ -2240,7 +2331,14 @@
|
|
|
2240
2331
|
}
|
|
2241
2332
|
],
|
|
2242
2333
|
"outputs": [],
|
|
2243
|
-
"methods": [
|
|
2334
|
+
"methods": [
|
|
2335
|
+
{
|
|
2336
|
+
"name": "onInternalInputChange",
|
|
2337
|
+
"parameters": "event: Event",
|
|
2338
|
+
"returnType": "any",
|
|
2339
|
+
"description": ""
|
|
2340
|
+
}
|
|
2341
|
+
],
|
|
2244
2342
|
"cssVariables": [
|
|
2245
2343
|
{
|
|
2246
2344
|
"name": "--radiod-c",
|
|
@@ -2288,7 +2386,7 @@
|
|
|
2288
2386
|
{
|
|
2289
2387
|
"name": "sortableManager",
|
|
2290
2388
|
"type": "any",
|
|
2291
|
-
"description": "
|
|
2389
|
+
"description": "",
|
|
2292
2390
|
"defaultValue": "null"
|
|
2293
2391
|
},
|
|
2294
2392
|
{
|
|
@@ -2330,19 +2428,19 @@
|
|
|
2330
2428
|
{
|
|
2331
2429
|
"name": "getIcon",
|
|
2332
2430
|
"type": "(item: any) => string | null",
|
|
2333
|
-
"description": "
|
|
2431
|
+
"description": "",
|
|
2334
2432
|
"defaultValue": "("
|
|
2335
2433
|
},
|
|
2336
2434
|
{
|
|
2337
2435
|
"name": "items",
|
|
2338
2436
|
"type": "any[]",
|
|
2339
|
-
"description": "
|
|
2437
|
+
"description": "",
|
|
2340
2438
|
"defaultValue": "[]"
|
|
2341
2439
|
},
|
|
2342
2440
|
{
|
|
2343
2441
|
"name": "selectedId",
|
|
2344
2442
|
"type": "string | null",
|
|
2345
|
-
"description": "
|
|
2443
|
+
"description": "",
|
|
2346
2444
|
"defaultValue": "null"
|
|
2347
2445
|
}
|
|
2348
2446
|
],
|
|
@@ -2536,7 +2634,7 @@
|
|
|
2536
2634
|
"methods": [
|
|
2537
2635
|
{
|
|
2538
2636
|
"name": "untracked",
|
|
2539
|
-
"parameters": "() => this
|
|
2637
|
+
"parameters": "() => this.#drawColorPicker());\n\n if (this.#previousLayoutHash !== layoutHash",
|
|
2540
2638
|
"returnType": "any",
|
|
2541
2639
|
"description": ""
|
|
2542
2640
|
}
|
|
@@ -2665,7 +2763,56 @@
|
|
|
2665
2763
|
]
|
|
2666
2764
|
},
|
|
2667
2765
|
{
|
|
2668
|
-
"name": "
|
|
2766
|
+
"name": "ShipListItemSwipeService",
|
|
2767
|
+
"selector": "sh-list-item-swipe",
|
|
2768
|
+
"path": "core/projects/ship-ui/ship-list-item-swipe/ship-list-item-swipe.ts",
|
|
2769
|
+
"description": "",
|
|
2770
|
+
"keywords": [],
|
|
2771
|
+
"inputs": [
|
|
2772
|
+
{
|
|
2773
|
+
"name": "swipeThreshold",
|
|
2774
|
+
"type": "number",
|
|
2775
|
+
"description": "",
|
|
2776
|
+
"defaultValue": "0.3"
|
|
2777
|
+
}
|
|
2778
|
+
],
|
|
2779
|
+
"outputs": [
|
|
2780
|
+
{
|
|
2781
|
+
"name": "swipeOpen",
|
|
2782
|
+
"type": "'left' | 'right'",
|
|
2783
|
+
"description": ""
|
|
2784
|
+
},
|
|
2785
|
+
{
|
|
2786
|
+
"name": "swipeClose",
|
|
2787
|
+
"type": "void",
|
|
2788
|
+
"description": ""
|
|
2789
|
+
}
|
|
2790
|
+
],
|
|
2791
|
+
"methods": [
|
|
2792
|
+
{
|
|
2793
|
+
"name": "onTouchStart",
|
|
2794
|
+
"parameters": "e: TouchEvent",
|
|
2795
|
+
"returnType": "any",
|
|
2796
|
+
"description": ""
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
"name": "open",
|
|
2800
|
+
"parameters": "side: 'left' | 'right'",
|
|
2801
|
+
"returnType": "any",
|
|
2802
|
+
"description": ""
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
"name": "close",
|
|
2806
|
+
"parameters": "",
|
|
2807
|
+
"returnType": "any",
|
|
2808
|
+
"description": ""
|
|
2809
|
+
}
|
|
2810
|
+
],
|
|
2811
|
+
"cssVariables": [],
|
|
2812
|
+
"examples": []
|
|
2813
|
+
},
|
|
2814
|
+
{
|
|
2815
|
+
"name": "ShipSortableService",
|
|
2669
2816
|
"selector": "[shSortable]",
|
|
2670
2817
|
"path": "core/projects/ship-ui/ship-sortable/ship-sortable.ts",
|
|
2671
2818
|
"description": "### Enable Sorting\n\nApply the\n`shSortable`\ndirective to any container element to enable drag-and-drop reordering.\n\n### Event Handling\n\nListen to the\n`sortDrop`\nevent to update your data source when an item is moved. For tree structures, listen to the\n`treeDrop`\nevent.\n\n### Sortable Manager (Recommended)\n\nVastly simplify drag-and-drop state by passing a manager to the\n`shSortable`\ninput. Use\n`createSortableManager()`\nfor simple and cross-list configurations, or\n`createTreeSortableManager()`\nfor hierarchical trees.\n\n### Tree View Drag & Drop\n\nEnable VSCode-explorer-style tree drag-and-drop by setting\n`sortingMode=\"tree\"`\nand binding\n`[treeItems]`\nto the visible items list. Target folders must include the\n`sortable-folder=\"true\"`\nattribute to accept drop-inside actions.\n\n### Drag Handles\n\nAdd the\n`sort-handle`\nattribute to a specific element within a sortable item to limit dragging to that specific region.",
|
|
@@ -2695,6 +2842,18 @@
|
|
|
2695
2842
|
"description": "",
|
|
2696
2843
|
"defaultValue": "'list'"
|
|
2697
2844
|
},
|
|
2845
|
+
{
|
|
2846
|
+
"name": "touchEnabled",
|
|
2847
|
+
"type": "boolean",
|
|
2848
|
+
"description": "",
|
|
2849
|
+
"defaultValue": "false"
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
"name": "touchActivation",
|
|
2853
|
+
"type": "'longpress' | 'handle' | 'none'",
|
|
2854
|
+
"description": "",
|
|
2855
|
+
"defaultValue": "'longpress'"
|
|
2856
|
+
},
|
|
2698
2857
|
{
|
|
2699
2858
|
"name": "treeItems",
|
|
2700
2859
|
"type": "any[]",
|
|
@@ -2744,38 +2903,38 @@
|
|
|
2744
2903
|
"description": ""
|
|
2745
2904
|
},
|
|
2746
2905
|
{
|
|
2747
|
-
"name": "
|
|
2748
|
-
"parameters": "
|
|
2906
|
+
"name": "processDragEnter",
|
|
2907
|
+
"parameters": "",
|
|
2749
2908
|
"returnType": "any",
|
|
2750
2909
|
"description": ""
|
|
2751
2910
|
},
|
|
2752
2911
|
{
|
|
2753
|
-
"name": "
|
|
2912
|
+
"name": "dragLeave",
|
|
2754
2913
|
"parameters": "e: DragEvent",
|
|
2755
2914
|
"returnType": "any",
|
|
2756
2915
|
"description": ""
|
|
2757
2916
|
},
|
|
2758
2917
|
{
|
|
2759
|
-
"name": "
|
|
2760
|
-
"parameters": "
|
|
2761
|
-
"returnType": "
|
|
2918
|
+
"name": "processDragLeave",
|
|
2919
|
+
"parameters": "clientX: number, clientY: number, relatedTarget: Node | null, force = false",
|
|
2920
|
+
"returnType": "any",
|
|
2762
2921
|
"description": ""
|
|
2763
2922
|
},
|
|
2764
2923
|
{
|
|
2765
|
-
"name": "
|
|
2766
|
-
"parameters": "event:
|
|
2767
|
-
"returnType": "
|
|
2924
|
+
"name": "clientX",
|
|
2925
|
+
"parameters": "array: T[],\n event: Pick<ShipDropEvent, 'previousIndex' | 'currentIndex'> | Pick<AfterDropResponse, 'fromIndex' | 'toIndex'>",
|
|
2926
|
+
"returnType": "T[]",
|
|
2768
2927
|
"description": ""
|
|
2769
2928
|
},
|
|
2770
2929
|
{
|
|
2771
|
-
"name": "
|
|
2772
|
-
"parameters": "",
|
|
2930
|
+
"name": "while",
|
|
2931
|
+
"parameters": "currentParentId !== null && currentParentId !== undefined",
|
|
2773
2932
|
"returnType": "any",
|
|
2774
2933
|
"description": ""
|
|
2775
2934
|
},
|
|
2776
2935
|
{
|
|
2777
|
-
"name": "
|
|
2778
|
-
"parameters": "
|
|
2936
|
+
"name": "drop",
|
|
2937
|
+
"parameters": "event: ShipTreeDropEvent, visibleNodesList: T[]",
|
|
2779
2938
|
"returnType": "any",
|
|
2780
2939
|
"description": ""
|
|
2781
2940
|
},
|
|
@@ -4695,7 +4854,14 @@
|
|
|
4695
4854
|
}
|
|
4696
4855
|
],
|
|
4697
4856
|
"outputs": [],
|
|
4698
|
-
"methods": [
|
|
4857
|
+
"methods": [
|
|
4858
|
+
{
|
|
4859
|
+
"name": "onInternalInputChange",
|
|
4860
|
+
"parameters": "event: Event",
|
|
4861
|
+
"returnType": "any",
|
|
4862
|
+
"description": ""
|
|
4863
|
+
}
|
|
4864
|
+
],
|
|
4699
4865
|
"cssVariables": [
|
|
4700
4866
|
{
|
|
4701
4867
|
"name": "--box-bw",
|
|
@@ -4856,19 +5022,19 @@
|
|
|
4856
5022
|
{
|
|
4857
5023
|
"name": "mode",
|
|
4858
5024
|
"type": "'global' | 'local'",
|
|
4859
|
-
"description": "
|
|
5025
|
+
"description": "",
|
|
4860
5026
|
"defaultValue": "'local'"
|
|
4861
5027
|
},
|
|
4862
5028
|
{
|
|
4863
5029
|
"name": "preventDefault",
|
|
4864
5030
|
"type": "boolean",
|
|
4865
|
-
"description": "
|
|
5031
|
+
"description": "",
|
|
4866
5032
|
"defaultValue": "true"
|
|
4867
5033
|
},
|
|
4868
5034
|
{
|
|
4869
5035
|
"name": "stopPropagation",
|
|
4870
5036
|
"type": "boolean",
|
|
4871
|
-
"description": "
|
|
5037
|
+
"description": "",
|
|
4872
5038
|
"defaultValue": "true"
|
|
4873
5039
|
}
|
|
4874
5040
|
],
|
|
@@ -4876,7 +5042,7 @@
|
|
|
4876
5042
|
{
|
|
4877
5043
|
"name": "triggered",
|
|
4878
5044
|
"type": "KeyboardEvent",
|
|
4879
|
-
"description": "
|
|
5045
|
+
"description": ""
|
|
4880
5046
|
}
|
|
4881
5047
|
],
|
|
4882
5048
|
"methods": [
|
|
@@ -4888,7 +5054,7 @@
|
|
|
4888
5054
|
},
|
|
4889
5055
|
{
|
|
4890
5056
|
"name": "onCleanup",
|
|
4891
|
-
"parameters": "() => {\n window.removeEventListener('keydown', listener);\n });\n }\n });\n }\n\n
|
|
5057
|
+
"parameters": "() => {\n window.removeEventListener('keydown', listener);\n });\n }\n });\n }\n\n \n\n\n @HostListener('keydown', ['$event'])\n onKeyDown(event: KeyboardEvent",
|
|
4892
5058
|
"returnType": "void",
|
|
4893
5059
|
"description": ""
|
|
4894
5060
|
}
|
|
@@ -4927,31 +5093,31 @@
|
|
|
4927
5093
|
"name": "registerDefaults",
|
|
4928
5094
|
"parameters": "defaults: Record<string, string>",
|
|
4929
5095
|
"returnType": "void",
|
|
4930
|
-
"description": "
|
|
5096
|
+
"description": ""
|
|
4931
5097
|
},
|
|
4932
5098
|
{
|
|
4933
5099
|
"name": "registerOverrides",
|
|
4934
5100
|
"parameters": "overrides: Record<string, string>",
|
|
4935
5101
|
"returnType": "void",
|
|
4936
|
-
"description": "
|
|
5102
|
+
"description": ""
|
|
4937
5103
|
},
|
|
4938
5104
|
{
|
|
4939
5105
|
"name": "getShortcut",
|
|
4940
5106
|
"parameters": "action: string",
|
|
4941
5107
|
"returnType": "string | undefined",
|
|
4942
|
-
"description": "
|
|
5108
|
+
"description": ""
|
|
4943
5109
|
},
|
|
4944
5110
|
{
|
|
4945
5111
|
"name": "getDefaultShortcut",
|
|
4946
5112
|
"parameters": "action: string",
|
|
4947
5113
|
"returnType": "string | undefined",
|
|
4948
|
-
"description": "
|
|
5114
|
+
"description": ""
|
|
4949
5115
|
},
|
|
4950
5116
|
{
|
|
4951
5117
|
"name": "getDisplayShortcut",
|
|
4952
5118
|
"parameters": "action: string",
|
|
4953
5119
|
"returnType": "string | undefined",
|
|
4954
|
-
"description": "
|
|
5120
|
+
"description": ""
|
|
4955
5121
|
}
|
|
4956
5122
|
],
|
|
4957
5123
|
"cssVariables": [],
|
|
@@ -5681,7 +5847,7 @@
|
|
|
5681
5847
|
"methods": [
|
|
5682
5848
|
{
|
|
5683
5849
|
"name": "onCleanup",
|
|
5684
|
-
"parameters": "() => {\n const index =
|
|
5850
|
+
"parameters": "() => {\n const index = openMenus.indexOf(this);\n if (index > -1",
|
|
5685
5851
|
"returnType": "any",
|
|
5686
5852
|
"description": ""
|
|
5687
5853
|
},
|
package/bin/src/subset.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname, resolve } from 'path';
|
|
|
4
4
|
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
import wawoff2 from 'wawoff2';
|
|
9
9
|
|
|
10
10
|
let harfbuzzInst: { harfbuzzJsWasm: any; heapu8: Uint8Array } | null = null;
|
|
@@ -42,18 +42,18 @@ export default async function subsetFont(originalFont: Buffer, text: string): Pr
|
|
|
42
42
|
const face = harfbuzzJsWasm.hb_face_create(blob, 0);
|
|
43
43
|
harfbuzzJsWasm.hb_blob_destroy(blob);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
const layoutFeatures = harfbuzzJsWasm.hb_subset_input_set(input, 6);
|
|
45
|
+
|
|
46
|
+
const layoutFeatures = harfbuzzJsWasm.hb_subset_input_set(input, 6);
|
|
47
47
|
harfbuzzJsWasm.hb_set_clear(layoutFeatures);
|
|
48
48
|
harfbuzzJsWasm.hb_set_invert(layoutFeatures);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
harfbuzzJsWasm.hb_subset_input_set_flags(
|
|
52
52
|
input,
|
|
53
53
|
harfbuzzJsWasm.hb_subset_input_get_flags(input) | 0x00000200
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
const inputUnicodes = harfbuzzJsWasm.hb_subset_input_unicode_set(input);
|
|
58
58
|
for (const c of text) {
|
|
59
59
|
const cp = c.codePointAt(0);
|
|
@@ -93,7 +93,7 @@ export default async function subsetFont(originalFont: Buffer, text: string): Pr
|
|
|
93
93
|
harfbuzzJsWasm.hb_face_destroy(face);
|
|
94
94
|
harfbuzzJsWasm.free(fontBuffer);
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
const woff2Buffer = await wawoff2.compress(subsetFontBuffer);
|
|
98
98
|
return Buffer.from(woff2Buffer);
|
|
99
99
|
}
|
package/bin/src/utilities.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
// export function createNameCodeObject(jsonData: Item[]): Record<string, string> {
|
|
2
|
-
// const nameCodeObject: Record<string, string> = {};
|
|
3
1
|
|
|
4
|
-
// for (let i = 0; i < jsonData.length; i++) {
|
|
5
|
-
// const item = jsonData[i];
|
|
6
|
-
// const hexCode = item.properties.code.toString(16); // Convert decimal to hex
|
|
7
|
-
// const codePoint = parseInt(hexCode, 16); // Parse hex to integer code point
|
|
8
|
-
// const glyph = String.fromCodePoint(codePoint); // Create the glyph
|
|
9
|
-
// nameCodeObject[item.properties.ligatures] = glyph;
|
|
10
|
-
// }
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
export const getUnicodeObject = (jsonData: Item[], isDuotone = false): Record<string, [string, string]> => {
|
|
16
16
|
const nameCodeObject: Record<string, [string, string]> = {};
|
|
17
17
|
|
|
18
18
|
for (let i = 0; i < jsonData.length; i++) {
|
|
19
19
|
const item = jsonData[i];
|
|
20
|
-
const hexCode = item.properties.code.toString(16);
|
|
21
|
-
const codePoint = parseInt(hexCode, 16);
|
|
22
|
-
const glyph = String.fromCodePoint(codePoint);
|
|
20
|
+
const hexCode = item.properties.code.toString(16);
|
|
21
|
+
const codePoint = parseInt(hexCode, 16);
|
|
22
|
+
const glyph = String.fromCodePoint(codePoint);
|
|
23
23
|
if (glyph === '') {
|
|
24
24
|
console.warn(`Invalid codepoint 0x${hexCode} for ligature ${item.properties.ligatures}`);
|
|
25
25
|
continue;
|