@techfides/ui-library-design 0.3.1 → 0.7.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 (189) hide show
  1. package/dist/anatomies.d.ts +1586 -0
  2. package/dist/anatomies.js +107 -0
  3. package/dist/anatomies.js.map +1 -0
  4. package/dist/anatomy.d.ts +13 -0
  5. package/dist/anatomy.js +6 -0
  6. package/dist/anatomy.js.map +1 -0
  7. package/dist/control.d.ts +1 -2
  8. package/dist/control.js +1 -2
  9. package/dist/control.js.map +1 -1
  10. package/dist/index.d.ts +55 -58
  11. package/dist/index.js +59 -62
  12. package/dist/recipes/accordion.d.ts +28 -1
  13. package/dist/recipes/accordion.js +29 -1
  14. package/dist/recipes/accordion.js.map +1 -1
  15. package/dist/recipes/alert.d.ts +45 -1
  16. package/dist/recipes/alert.js +45 -1
  17. package/dist/recipes/alert.js.map +1 -1
  18. package/dist/recipes/band.d.ts +11 -1
  19. package/dist/recipes/band.js +7 -1
  20. package/dist/recipes/band.js.map +1 -1
  21. package/dist/recipes/bars.d.ts +60 -1
  22. package/dist/recipes/bars.js +59 -1
  23. package/dist/recipes/bars.js.map +1 -1
  24. package/dist/recipes/brandMark.d.ts +8 -1
  25. package/dist/recipes/brandMark.js +7 -1
  26. package/dist/recipes/brandMark.js.map +1 -1
  27. package/dist/recipes/button.d.ts +41 -4
  28. package/dist/recipes/button.js +31 -2
  29. package/dist/recipes/button.js.map +1 -1
  30. package/dist/recipes/cardHeader.d.ts +18 -1
  31. package/dist/recipes/cardHeader.js +19 -1
  32. package/dist/recipes/cardHeader.js.map +1 -1
  33. package/dist/recipes/checkbox.d.ts +16 -1
  34. package/dist/recipes/checkbox.js +16 -3
  35. package/dist/recipes/checkbox.js.map +1 -1
  36. package/dist/recipes/chip.d.ts +41 -2
  37. package/dist/recipes/chip.js +34 -1
  38. package/dist/recipes/chip.js.map +1 -1
  39. package/dist/recipes/codeEditor.d.ts +8 -1
  40. package/dist/recipes/codeEditor.js +7 -1
  41. package/dist/recipes/codeEditor.js.map +1 -1
  42. package/dist/recipes/datePicker.d.ts +62 -1
  43. package/dist/recipes/datePicker.js +56 -3
  44. package/dist/recipes/datePicker.js.map +1 -1
  45. package/dist/recipes/dialog.d.ts +49 -1
  46. package/dist/recipes/dialog.js +40 -1
  47. package/dist/recipes/dialog.js.map +1 -1
  48. package/dist/recipes/feature.d.ts +30 -1
  49. package/dist/recipes/feature.js +30 -2
  50. package/dist/recipes/feature.js.map +1 -1
  51. package/dist/recipes/field.js +1 -1
  52. package/dist/recipes/findings.d.ts +33 -1
  53. package/dist/recipes/findings.js +34 -1
  54. package/dist/recipes/findings.js.map +1 -1
  55. package/dist/recipes/heading.d.ts +12 -2
  56. package/dist/recipes/heading.js +7 -1
  57. package/dist/recipes/heading.js.map +1 -1
  58. package/dist/recipes/heartbeat.d.ts +52 -2
  59. package/dist/recipes/heartbeat.js +51 -4
  60. package/dist/recipes/heartbeat.js.map +1 -1
  61. package/dist/recipes/ink.d.ts +11 -0
  62. package/dist/recipes/ink.js +13 -0
  63. package/dist/recipes/ink.js.map +1 -0
  64. package/dist/recipes/input.d.ts +55 -1
  65. package/dist/recipes/input.js +52 -2
  66. package/dist/recipes/input.js.map +1 -1
  67. package/dist/recipes/listItem.d.ts +18 -1
  68. package/dist/recipes/listItem.js +20 -1
  69. package/dist/recipes/listItem.js.map +1 -1
  70. package/dist/recipes/listbox.d.ts +22 -2
  71. package/dist/recipes/listbox.js +19 -1
  72. package/dist/recipes/listbox.js.map +1 -1
  73. package/dist/recipes/marquee.d.ts +26 -2
  74. package/dist/recipes/marquee.js +24 -1
  75. package/dist/recipes/marquee.js.map +1 -1
  76. package/dist/recipes/menu.d.ts +33 -1
  77. package/dist/recipes/menu.js +29 -1
  78. package/dist/recipes/menu.js.map +1 -1
  79. package/dist/recipes/metaRow.d.ts +11 -2
  80. package/dist/recipes/metaRow.js +7 -1
  81. package/dist/recipes/metaRow.js.map +1 -1
  82. package/dist/recipes/meter.d.ts +36 -2
  83. package/dist/recipes/meter.js +34 -1
  84. package/dist/recipes/meter.js.map +1 -1
  85. package/dist/recipes/motion.d.ts +9 -1
  86. package/dist/recipes/nebula.js +1 -1
  87. package/dist/recipes/numberRange.d.ts +44 -1
  88. package/dist/recipes/numberRange.js +36 -1
  89. package/dist/recipes/numberRange.js.map +1 -1
  90. package/dist/recipes/paper.d.ts +55 -2
  91. package/dist/recipes/paper.js +47 -4
  92. package/dist/recipes/paper.js.map +1 -1
  93. package/dist/recipes/progressBar.d.ts +8 -1
  94. package/dist/recipes/progressBar.js +7 -1
  95. package/dist/recipes/progressBar.js.map +1 -1
  96. package/dist/recipes/queue.d.ts +33 -1
  97. package/dist/recipes/queue.js +35 -1
  98. package/dist/recipes/queue.js.map +1 -1
  99. package/dist/recipes/radioGroup.d.ts +18 -1
  100. package/dist/recipes/radioGroup.js +21 -3
  101. package/dist/recipes/radioGroup.js.map +1 -1
  102. package/dist/recipes/scopeSwitcher.d.ts +38 -1
  103. package/dist/recipes/scopeSwitcher.js +40 -1
  104. package/dist/recipes/scopeSwitcher.js.map +1 -1
  105. package/dist/recipes/scrollArea.d.ts +12 -3
  106. package/dist/recipes/scrollArea.js +7 -1
  107. package/dist/recipes/scrollArea.js.map +1 -1
  108. package/dist/recipes/searchPalette.d.ts +48 -1
  109. package/dist/recipes/searchPalette.js +49 -1
  110. package/dist/recipes/searchPalette.js.map +1 -1
  111. package/dist/recipes/sectionHeader.d.ts +20 -2
  112. package/dist/recipes/sectionHeader.js +20 -3
  113. package/dist/recipes/sectionHeader.js.map +1 -1
  114. package/dist/recipes/segmentedControl.d.ts +8 -1
  115. package/dist/recipes/segmentedControl.js +7 -1
  116. package/dist/recipes/segmentedControl.js.map +1 -1
  117. package/dist/recipes/select.d.ts +57 -1
  118. package/dist/recipes/select.js +51 -1
  119. package/dist/recipes/select.js.map +1 -1
  120. package/dist/recipes/separator.d.ts +13 -2
  121. package/dist/recipes/separator.js +8 -2
  122. package/dist/recipes/separator.js.map +1 -1
  123. package/dist/recipes/sidebar.d.ts +128 -2
  124. package/dist/recipes/sidebar.js +125 -2
  125. package/dist/recipes/sidebar.js.map +1 -1
  126. package/dist/recipes/sky.d.ts +31 -1
  127. package/dist/recipes/sky.js +30 -1
  128. package/dist/recipes/sky.js.map +1 -1
  129. package/dist/recipes/slider.d.ts +15 -1
  130. package/dist/recipes/slider.js +14 -1
  131. package/dist/recipes/slider.js.map +1 -1
  132. package/dist/recipes/stat.d.ts +72 -3
  133. package/dist/recipes/stat.js +73 -3
  134. package/dist/recipes/stat.js.map +1 -1
  135. package/dist/recipes/switch.d.ts +10 -1
  136. package/dist/recipes/switch.js +9 -3
  137. package/dist/recipes/switch.js.map +1 -1
  138. package/dist/recipes/table.d.ts +63 -3
  139. package/dist/recipes/table.js +56 -2
  140. package/dist/recipes/table.js.map +1 -1
  141. package/dist/recipes/tail.d.ts +40 -5
  142. package/dist/recipes/tail.js +37 -5
  143. package/dist/recipes/tail.js.map +1 -1
  144. package/dist/recipes/text.d.ts +16 -3
  145. package/dist/recipes/text.js +8 -3
  146. package/dist/recipes/text.js.map +1 -1
  147. package/dist/recipes/textarea.d.ts +46 -1
  148. package/dist/recipes/textarea.js +41 -1
  149. package/dist/recipes/textarea.js.map +1 -1
  150. package/dist/recipes/tile.d.ts +23 -1
  151. package/dist/recipes/tile.js +19 -1
  152. package/dist/recipes/tile.js.map +1 -1
  153. package/dist/recipes/tooltip.d.ts +8 -1
  154. package/dist/recipes/tooltip.js +7 -1
  155. package/dist/recipes/tooltip.js.map +1 -1
  156. package/dist/recipes/topBar.d.ts +43 -1
  157. package/dist/recipes/topBar.js +44 -1
  158. package/dist/recipes/topBar.js.map +1 -1
  159. package/dist/recipes/trail.d.ts +55 -5
  160. package/dist/recipes/trail.js +47 -5
  161. package/dist/recipes/trail.js.map +1 -1
  162. package/dist/recipes/userMenu.d.ts +23 -1
  163. package/dist/recipes/userMenu.js +24 -1
  164. package/dist/recipes/userMenu.js.map +1 -1
  165. package/package.json +1 -2
  166. package/dist/charts/animation.js +0 -14
  167. package/dist/charts/animation.js.map +0 -1
  168. package/dist/charts/bars.d.ts +0 -22
  169. package/dist/charts/bars.js +0 -61
  170. package/dist/charts/bars.js.map +0 -1
  171. package/dist/charts/groupedBars.d.ts +0 -20
  172. package/dist/charts/groupedBars.js +0 -82
  173. package/dist/charts/groupedBars.js.map +0 -1
  174. package/dist/charts/paint.js +0 -19
  175. package/dist/charts/paint.js.map +0 -1
  176. package/dist/charts/spark.d.ts +0 -17
  177. package/dist/charts/spark.js +0 -159
  178. package/dist/charts/spark.js.map +0 -1
  179. package/dist/charts/tooltip.js +0 -41
  180. package/dist/charts/tooltip.js.map +0 -1
  181. package/dist/czech.d.ts +0 -6
  182. package/dist/czech.js +0 -100
  183. package/dist/czech.js.map +0 -1
  184. package/dist/tally.d.ts +0 -17
  185. package/dist/tally.js +0 -75
  186. package/dist/tally.js.map +0 -1
  187. package/dist/words.d.ts +0 -116
  188. package/dist/words.js +0 -96
  189. package/dist/words.js.map +0 -1
@@ -1,159 +0,0 @@
1
- import { CHART_EASING, chartAnimation, chartStagger } from "./animation.js";
2
- import { TRANSPARENT, verticalGradient } from "./paint.js";
3
- import { chartTooltip } from "./tooltip.js";
4
- //#region src/charts/spark.ts
5
- const LINE_WIDTH = 2;
6
- const MARKER_SIZE = 5;
7
- const MIN_SPAN = 1;
8
- const EMPTY_LENGTH = 0;
9
- const LAST_INDEX_OFFSET = 1;
10
- const NO_GAP = 0;
11
- const LINE_BOUNDARY_GAP = [NO_GAP, NO_GAP];
12
- const LINE_GRID = {
13
- bottom: 4,
14
- left: 4,
15
- right: 4,
16
- top: 4
17
- };
18
- const BAR_GRID = {
19
- bottom: 0,
20
- left: 0,
21
- right: 0,
22
- top: 0
23
- };
24
- const BAR_CATEGORY_GAP = "25%";
25
- const MIN_HEIGHT_RATIO = .15;
26
- const BAR_AXIS_MAX = 1;
27
- const BAR_AXIS_MIN = 0;
28
- const AREA_OPACITY = .32;
29
- const STAGGER_MS = 30;
30
- const lastIndexOf = (values) => values.length - LAST_INDEX_OFFSET;
31
- const NO_VALUE = 0;
32
- const FIRST_INDEX = 0;
33
- const pointFormatter = (values) => (params) => {
34
- const point = params[FIRST_INDEX];
35
- if (!point || typeof point.dataIndex !== "number") return String(NO_VALUE);
36
- return String(values[point.dataIndex] ?? NO_VALUE);
37
- };
38
- const yRange = (values) => {
39
- const min = Math.min(...values);
40
- const max = Math.max(...values);
41
- if (max === min) return {
42
- max: min + MIN_SPAN,
43
- min
44
- };
45
- return {
46
- max,
47
- min
48
- };
49
- };
50
- const lineOption = (input) => {
51
- const last = lastIndexOf(input.values);
52
- const range = yRange(input.values);
53
- const lastValue = input.values[last] ?? range.min;
54
- return {
55
- ...chartAnimation(input.durationMs),
56
- grid: LINE_GRID,
57
- series: [{
58
- areaStyle: {
59
- color: verticalGradient(input.accent.hi, TRANSPARENT),
60
- opacity: AREA_OPACITY
61
- },
62
- data: input.values.map((value, index) => [index, value]),
63
- emphasis: { disabled: true },
64
- lineStyle: {
65
- cap: "round",
66
- color: input.accent.surface,
67
- join: "round",
68
- width: LINE_WIDTH
69
- },
70
- markPoint: {
71
- animation: true,
72
- data: [{
73
- coord: [last, lastValue],
74
- name: ""
75
- }],
76
- itemStyle: { color: input.accent.hi },
77
- label: { show: false },
78
- symbol: "circle",
79
- symbolSize: MARKER_SIZE
80
- },
81
- showSymbol: false,
82
- stateAnimation: {
83
- duration: input.stateDurationMs,
84
- easing: CHART_EASING
85
- },
86
- symbolSize: MARKER_SIZE,
87
- type: "line"
88
- }],
89
- tooltip: chartTooltip(pointFormatter(input.values), "axis"),
90
- xAxis: {
91
- boundaryGap: LINE_BOUNDARY_GAP,
92
- max: last,
93
- min: 0,
94
- show: false,
95
- type: "value"
96
- },
97
- yAxis: {
98
- max: range.max,
99
- min: range.min,
100
- show: false,
101
- type: "value"
102
- }
103
- };
104
- };
105
- const barHeightRatio = (value, range) => {
106
- const ratio = (value - range.min) / (range.max - range.min);
107
- return Math.max(ratio, MIN_HEIGHT_RATIO);
108
- };
109
- const barOption = (input) => {
110
- const last = lastIndexOf(input.values);
111
- const range = yRange(input.values);
112
- return {
113
- ...chartAnimation(input.durationMs),
114
- grid: BAR_GRID,
115
- series: [{
116
- animationDelay: chartStagger(STAGGER_MS),
117
- barCategoryGap: BAR_CATEGORY_GAP,
118
- data: input.values.map((value, index) => {
119
- const height = barHeightRatio(value, range);
120
- if (index === last) return {
121
- itemStyle: { color: input.accent.hi },
122
- value: height
123
- };
124
- return height;
125
- }),
126
- emphasis: { disabled: true },
127
- itemStyle: {
128
- borderRadius: input.radius,
129
- color: verticalGradient(input.accent.hi, input.accent.surface)
130
- },
131
- stateAnimation: {
132
- duration: input.stateDurationMs,
133
- easing: CHART_EASING
134
- },
135
- type: "bar"
136
- }],
137
- tooltip: chartTooltip(pointFormatter(input.values)),
138
- xAxis: {
139
- data: input.values.map((_value, index) => String(index)),
140
- show: false,
141
- type: "category"
142
- },
143
- yAxis: {
144
- max: BAR_AXIS_MAX,
145
- min: BAR_AXIS_MIN,
146
- show: false,
147
- type: "value"
148
- }
149
- };
150
- };
151
- const sparkOption = (input) => {
152
- if (input.values.length === EMPTY_LENGTH) return { series: [] };
153
- if (input.shape === "bars") return barOption(input);
154
- return lineOption(input);
155
- };
156
- //#endregion
157
- export { sparkOption };
158
-
159
- //# sourceMappingURL=spark.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spark.js","names":[],"sources":["../../src/charts/spark.ts"],"sourcesContent":["import type { DefaultLabelFormatterCallbackParams, EChartsOption } from 'echarts'\n\nimport { CHART_EASING, chartAnimation, chartStagger } from './animation'\nimport type { BarsAccent } from './bars'\nimport { TRANSPARENT, verticalGradient } from './paint'\nimport { chartTooltip } from './tooltip'\n\ntype SparkShape = 'line' | 'bars'\n\ntype SparkAccent = BarsAccent\n\ninterface SparkOptionInput {\n accent: SparkAccent\n durationMs: number\n stateDurationMs: number\n radius: number\n shape: SparkShape\n values: readonly number[]\n}\n\nconst LINE_WIDTH = 2\n\nconst MARKER_SIZE = 5\n\nconst MIN_SPAN = 1\n\nconst EMPTY_LENGTH = 0\n\nconst LAST_INDEX_OFFSET = 1\n\nconst NO_GAP = 0\n\nconst LINE_BOUNDARY_GAP: [number, number] = [NO_GAP, NO_GAP]\n\nconst LINE_GRID = { bottom: 4, left: 4, right: 4, top: 4 }\n\nconst BAR_GRID = { bottom: 0, left: 0, right: 0, top: 0 }\n\nconst BAR_CATEGORY_GAP = '25%'\n\nconst MIN_HEIGHT_RATIO = 0.15\n\nconst BAR_AXIS_MAX = 1\n\nconst BAR_AXIS_MIN = 0\n\nconst AREA_OPACITY = 0.32\n\nconst STAGGER_MS = 30\n\nconst lastIndexOf = (values: readonly number[]): number => values.length - LAST_INDEX_OFFSET\n\nconst NO_VALUE = 0\n\nconst FIRST_INDEX = 0\n\nconst pointFormatter =\n (values: readonly number[]) =>\n (params: readonly DefaultLabelFormatterCallbackParams[]): string => {\n const point = params[FIRST_INDEX]\n\n if (!point || typeof point.dataIndex !== 'number') {\n return String(NO_VALUE)\n }\n return String(values[point.dataIndex] ?? NO_VALUE)\n }\n\nconst yRange = (values: readonly number[]): { max: number; min: number } => {\n const min = Math.min(...values)\n const max = Math.max(...values)\n\n if (max === min) {\n return { max: min + MIN_SPAN, min }\n }\n return { max, min }\n}\n\nconst lineOption = (input: SparkOptionInput): EChartsOption => {\n const last = lastIndexOf(input.values)\n const range = yRange(input.values)\n const lastValue = input.values[last] ?? range.min\n\n return {\n ...chartAnimation(input.durationMs),\n grid: LINE_GRID,\n series: [\n {\n areaStyle: {\n color: verticalGradient(input.accent.hi, TRANSPARENT),\n opacity: AREA_OPACITY,\n },\n data: input.values.map((value, index) => [index, value]),\n emphasis: { disabled: true },\n lineStyle: {\n cap: 'round',\n color: input.accent.surface,\n join: 'round',\n width: LINE_WIDTH,\n },\n markPoint: {\n animation: true,\n data: [{ coord: [last, lastValue], name: '' }],\n itemStyle: { color: input.accent.hi },\n label: { show: false },\n symbol: 'circle',\n symbolSize: MARKER_SIZE,\n },\n showSymbol: false,\n stateAnimation: { duration: input.stateDurationMs, easing: CHART_EASING },\n symbolSize: MARKER_SIZE,\n type: 'line',\n },\n ],\n tooltip: chartTooltip(pointFormatter(input.values), 'axis'),\n xAxis: { boundaryGap: LINE_BOUNDARY_GAP, max: last, min: 0, show: false, type: 'value' },\n yAxis: { max: range.max, min: range.min, show: false, type: 'value' },\n }\n}\n\nconst barHeightRatio = (value: number, range: { max: number; min: number }): number => {\n const ratio = (value - range.min) / (range.max - range.min)\n\n return Math.max(ratio, MIN_HEIGHT_RATIO)\n}\n\nconst barOption = (input: SparkOptionInput): EChartsOption => {\n const last = lastIndexOf(input.values)\n const range = yRange(input.values)\n\n return {\n ...chartAnimation(input.durationMs),\n grid: BAR_GRID,\n series: [\n {\n animationDelay: chartStagger(STAGGER_MS),\n barCategoryGap: BAR_CATEGORY_GAP,\n data: input.values.map((value, index) => {\n const height = barHeightRatio(value, range)\n\n if (index === last) {\n return { itemStyle: { color: input.accent.hi }, value: height }\n }\n return height\n }),\n emphasis: { disabled: true },\n itemStyle: {\n borderRadius: input.radius,\n color: verticalGradient(input.accent.hi, input.accent.surface),\n },\n stateAnimation: { duration: input.stateDurationMs, easing: CHART_EASING },\n type: 'bar',\n },\n ],\n tooltip: chartTooltip(pointFormatter(input.values)),\n xAxis: {\n data: input.values.map((_value, index) => String(index)),\n show: false,\n type: 'category',\n },\n yAxis: { max: BAR_AXIS_MAX, min: BAR_AXIS_MIN, show: false, type: 'value' },\n }\n}\n\nconst sparkOption = (input: SparkOptionInput): EChartsOption => {\n if (input.values.length === EMPTY_LENGTH) {\n return { series: [] }\n }\n if (input.shape === 'bars') {\n return barOption(input)\n }\n return lineOption(input)\n}\n\nexport { type SparkAccent, type SparkOptionInput, type SparkShape, sparkOption }\n"],"mappings":";;;;AAoBA,MAAM,aAAa;AAEnB,MAAM,cAAc;AAEpB,MAAM,WAAW;AAEjB,MAAM,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MAAM;IAAiB,QAAQ;GAAa;GACxE,MAAM;EACR,CACF;EACA,SAAS,aAAa,eAAe,MAAM,MAAM,CAAC;EAClD,OAAO;GACL,MAAM,MAAM,OAAO,KAAK,QAAQ,UAAU,OAAO,KAAK,CAAC;GACvD,MAAM;GACN,MAAM;EACR;EACA,OAAO;GAAE,KAAK;GAAc,KAAK;GAAc,MAAM;GAAO,MAAM;EAAQ;CAC5E;AACF;AAEA,MAAM,eAAe,UAA2C;CAC9D,IAAI,MAAM,OAAO,WAAW,cAC1B,OAAO,EAAE,QAAQ,CAAC,EAAE;CAEtB,IAAI,MAAM,UAAU,QAClB,OAAO,UAAU,KAAK;CAExB,OAAO,WAAW,KAAK;AACzB"}
@@ -1,41 +0,0 @@
1
- //#region src/charts/tooltip.ts
2
- const TOOLTIP_CLASS = ["tf-edge-sweep tf-edge-plain rounded-tf-inline bg-tf-glass px-2 py-1", "font-tf-body text-tf-caption-sm text-tf-fg shadow-tf-float backdrop-blur-tf-glass"].join(" ");
3
- const NO_CHROME_CSS = "box-shadow: none; pointer-events: none;";
4
- const NO_CONTENT = "";
5
- const SNAP_TO_CURSOR = 0;
6
- const EMPTY_LENGTH = 0;
7
- const DEFAULT_AXIS_POINTER = { type: "none" };
8
- const appendToBody = () => document.body;
9
- const formatCallbackValue = (value) => {
10
- if (typeof value === "string" || typeof value === "number") return String(value);
11
- return NO_CONTENT;
12
- };
13
- const asParams = (raw) => {
14
- if (Array.isArray(raw)) return raw;
15
- return [raw];
16
- };
17
- const chartTooltip = (formatter, trigger = "item", axisPointer = DEFAULT_AXIS_POINTER) => {
18
- const base = {
19
- appendTo: appendToBody,
20
- backgroundColor: "transparent",
21
- borderWidth: 0,
22
- extraCssText: NO_CHROME_CSS,
23
- formatter: (raw) => {
24
- const params = asParams(raw);
25
- if (params.length === EMPTY_LENGTH) return NO_CONTENT;
26
- return `<div class="${TOOLTIP_CLASS}">${formatter(params)}</div>`;
27
- },
28
- padding: 0,
29
- transitionDuration: SNAP_TO_CURSOR,
30
- trigger
31
- };
32
- if (trigger === "axis") return {
33
- ...base,
34
- axisPointer
35
- };
36
- return base;
37
- };
38
- //#endregion
39
- export { chartTooltip, formatCallbackValue };
40
-
41
- //# sourceMappingURL=tooltip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tooltip.js","names":[],"sources":["../../src/charts/tooltip.ts"],"sourcesContent":["import type {\n DefaultLabelFormatterCallbackParams,\n TooltipComponentFormatterCallbackParams,\n TooltipComponentOption,\n} from 'echarts'\n\nconst TOOLTIP_CLASS = [\n 'tf-edge-sweep tf-edge-plain rounded-tf-inline bg-tf-glass px-2 py-1',\n 'font-tf-body text-tf-caption-sm text-tf-fg shadow-tf-float backdrop-blur-tf-glass',\n].join(' ')\n\nconst NO_CHROME_CSS = 'box-shadow: none; pointer-events: none;'\n\nconst NO_CONTENT = ''\n\nconst SNAP_TO_CURSOR = 0\n\nconst EMPTY_LENGTH = 0\n\ntype ChartTooltipTrigger = 'item' | 'axis'\n\ntype ChartTooltipAxisPointer = NonNullable<TooltipComponentOption['axisPointer']>\n\nconst DEFAULT_AXIS_POINTER: ChartTooltipAxisPointer = { type: 'none' }\n\nconst appendToBody = (): HTMLElement => document.body\n\nconst formatCallbackValue = (value: unknown): string => {\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value)\n }\n return NO_CONTENT\n}\n\nconst asParams = (\n raw: TooltipComponentFormatterCallbackParams,\n): readonly DefaultLabelFormatterCallbackParams[] => {\n if (Array.isArray(raw)) {\n return raw\n }\n return [raw]\n}\n\nconst chartTooltip = (\n formatter: (params: readonly DefaultLabelFormatterCallbackParams[]) => string,\n trigger: ChartTooltipTrigger = 'item',\n axisPointer: ChartTooltipAxisPointer = DEFAULT_AXIS_POINTER,\n): TooltipComponentOption => {\n const base: TooltipComponentOption = {\n appendTo: appendToBody,\n backgroundColor: 'transparent',\n borderWidth: 0,\n extraCssText: NO_CHROME_CSS,\n formatter: (raw: TooltipComponentFormatterCallbackParams) => {\n const params = asParams(raw)\n\n if (params.length === EMPTY_LENGTH) {\n return NO_CONTENT\n }\n return `<div class=\"${TOOLTIP_CLASS}\">${formatter(params)}</div>`\n },\n padding: 0,\n transitionDuration: SNAP_TO_CURSOR,\n trigger,\n }\n\n if (trigger === 'axis') {\n return { ...base, axisPointer }\n }\n return base\n}\n\nexport { chartTooltip, formatCallbackValue }\n"],"mappings":";AAMA,MAAM,gBAAgB,CACpB,uEACA,mFACF,CAAC,CAAC,KAAK,GAAG;AAEV,MAAM,gBAAgB;AAEtB,MAAM,aAAa;AAEnB,MAAM,iBAAiB;AAEvB,MAAM,eAAe;AAMrB,MAAM,uBAAgD,EAAE,MAAM,OAAO;AAErE,MAAM,qBAAkC,SAAS;AAEjD,MAAM,uBAAuB,UAA2B;CACtD,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAChD,OAAO,OAAO,KAAK;CAErB,OAAO;AACT;AAEA,MAAM,YACJ,QACmD;CACnD,IAAI,MAAM,QAAQ,GAAG,GACnB,OAAO;CAET,OAAO,CAAC,GAAG;AACb;AAEA,MAAM,gBACJ,WACA,UAA+B,QAC/B,cAAuC,yBACZ;CAC3B,MAAM,OAA+B;EACnC,UAAU;EACV,iBAAiB;EACjB,aAAa;EACb,cAAc;EACd,YAAY,QAAiD;GAC3D,MAAM,SAAS,SAAS,GAAG;GAE3B,IAAI,OAAO,WAAW,cACpB,OAAO;GAET,OAAO,eAAe,cAAc,IAAI,UAAU,MAAM,EAAE;EAC5D;EACA,SAAS;EACT,oBAAoB;EACpB;CACF;CAEA,IAAI,YAAY,QACd,OAAO;EAAE,GAAG;EAAM;CAAY;CAEhC,OAAO;AACT"}
package/dist/czech.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Language } from "./words.js";
2
- //#region src/czech.d.ts
3
- declare const czech: Language;
4
- //#endregion
5
- export { czech };
6
- //# sourceMappingURL=czech.d.ts.map
package/dist/czech.js DELETED
@@ -1,100 +0,0 @@
1
- //#region src/czech.ts
2
- const SINGLE = 1;
3
- const FEW_FIRST = 2;
4
- const FEW_LAST = 4;
5
- const results = (count, written) => {
6
- if (count === SINGLE) return "1 výsledek";
7
- if (count >= FEW_FIRST && count <= FEW_LAST) return `${written} výsledky`;
8
- return `${written} výsledků`;
9
- };
10
- const czech = {
11
- locale: "cs-CZ",
12
- words: {
13
- datePicker: {
14
- calendar: "Kalendář",
15
- choose: (day) => `Vybrat ${day}`,
16
- chosen: (day) => `Vybráno, ${day}`,
17
- clear: "Smazat data",
18
- close: "Zavřít kalendář",
19
- nextDecade: "Další dekáda",
20
- nextMonth: "Další měsíc",
21
- nextYear: "Další rok",
22
- open: "Otevřít kalendář",
23
- patternDay: "dd",
24
- patternMonth: "mm",
25
- patternYear: "rrrr",
26
- pickMonth: "Vyberte měsíc",
27
- pickYear: "Vyberte rok",
28
- preset: (span) => `Vybrat ${span}`,
29
- previousDecade: "Předchozí dekáda",
30
- previousMonth: "Předchozí měsíc",
31
- previousYear: "Předchozí rok",
32
- rangeFrom: (day) => `Začít rozsah na ${day}`,
33
- rangeTo: (day) => `Ukončit rozsah na ${day}`,
34
- showDays: "Zobrazit dny",
35
- showMonths: "Zobrazit měsíce",
36
- showYears: "Zobrazit roky",
37
- unavailable: (day) => `Nedostupné, ${day}`,
38
- week: "Týd.",
39
- weekNumber: (week) => `${week}. týden`
40
- },
41
- dialog: { close: "Zavřít" },
42
- listbox: { empty: "Není z čeho vybírat" },
43
- queue: { label: "Fronta" },
44
- search: {
45
- dismiss: "Esc zavře",
46
- nothing: "Tomu nic neodpovídá",
47
- results
48
- },
49
- select: { clear: "Zrušit výběr" },
50
- sidebar: {
51
- collapse: "Sbalit panel",
52
- expand: "Rozbalit panel",
53
- openMenu: "Otevřít menu"
54
- },
55
- stat: {
56
- change: "Změna",
57
- fell: "dolů",
58
- rose: "nahoru"
59
- },
60
- table: {
61
- actions: "Akce",
62
- anything: "Cokoli",
63
- clear: "Zrušit",
64
- clearAll: "Zrušit filtry",
65
- clearFilter: (column) => `Zrušit filtr na ${column}`,
66
- clearSelection: "Zrušit označení",
67
- done: "Hotovo",
68
- emptyHint: "Až tu něco bude, uvidíte to zde.",
69
- emptyTitle: "Zatím tu nic není",
70
- expandRow: (row) => `Zobrazit více o řádku ${row}`,
71
- filterBy: (column) => `Filtrovat ${column}`,
72
- filterPick: (column) => `Vyberte z ${column}`,
73
- filterRange: (column) => `Rozsah ${column}`,
74
- filterSearch: (column) => `Hledat v ${column}`,
75
- from: "Od",
76
- nextPage: "Další stránka",
77
- noRows: "Žádné řádky",
78
- nothingHint: "Zrušte jednu z podmínek, nebo smažte hledání.",
79
- nothingTitle: "Těmto filtrům nic neodpovídá",
80
- pages: "Stránky",
81
- previousPage: "Předchozí stránka",
82
- rowsPerPage: "Řádků na stránku",
83
- selectAll: "Označit řádky na této stránce",
84
- selectRow: (row) => `Označit řádek ${row}`,
85
- selected: (_count, written) => `${written} označeno`,
86
- shown: (from, to, total) => `${from}–${to} z ${total}`,
87
- sortAscending: (column) => `Řadit ${column} od nejmenšího`,
88
- sortBy: (column) => `Řadit podle ${column}`,
89
- sortClear: (column) => `Přestat řadit podle ${column}`,
90
- sortDescending: (column) => `Řadit ${column} od největšího`,
91
- to: "Do"
92
- },
93
- tail: { empty: "Žádné řádky logu" },
94
- userMenu: { account: "účet" }
95
- }
96
- };
97
- //#endregion
98
- export { czech };
99
-
100
- //# sourceMappingURL=czech.js.map
package/dist/czech.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"czech.js","names":[],"sources":["../src/czech.ts"],"sourcesContent":["import type { Language } from './words'\n\nconst SINGLE = 1\n\nconst FEW_FIRST = 2\n\nconst FEW_LAST = 4\n\nconst results = (count: number, written: string): string => {\n if (count === SINGLE) {\n return '1 výsledek'\n }\n if (count >= FEW_FIRST && count <= FEW_LAST) {\n return `${written} výsledky`\n }\n return `${written} výsledků`\n}\n\nconst czech: Language = {\n locale: 'cs-CZ',\n\n words: {\n datePicker: {\n calendar: 'Kalendář',\n choose: (day) => `Vybrat ${day}`,\n chosen: (day) => `Vybráno, ${day}`,\n clear: 'Smazat data',\n close: 'Zavřít kalendář',\n nextDecade: 'Další dekáda',\n nextMonth: 'Další měsíc',\n nextYear: 'Další rok',\n open: 'Otevřít kalendář',\n patternDay: 'dd',\n patternMonth: 'mm',\n patternYear: 'rrrr',\n pickMonth: 'Vyberte měsíc',\n pickYear: 'Vyberte rok',\n preset: (span) => `Vybrat ${span}`,\n previousDecade: 'Předchozí dekáda',\n previousMonth: 'Předchozí měsíc',\n previousYear: 'Předchozí rok',\n rangeFrom: (day) => `Začít rozsah na ${day}`,\n rangeTo: (day) => `Ukončit rozsah na ${day}`,\n showDays: 'Zobrazit dny',\n showMonths: 'Zobrazit měsíce',\n showYears: 'Zobrazit roky',\n unavailable: (day) => `Nedostupné, ${day}`,\n week: 'Týd.',\n weekNumber: (week) => `${week}. týden`,\n },\n\n dialog: {\n close: 'Zavřít',\n },\n\n listbox: {\n empty: 'Není z čeho vybírat',\n },\n\n queue: {\n label: 'Fronta',\n },\n\n search: {\n dismiss: 'Esc zavře',\n nothing: 'Tomu nic neodpovídá',\n results,\n },\n\n select: {\n clear: 'Zrušit výběr',\n },\n\n sidebar: {\n collapse: 'Sbalit panel',\n expand: 'Rozbalit panel',\n openMenu: 'Otevřít menu',\n },\n\n stat: {\n change: 'Změna',\n fell: 'dolů',\n rose: 'nahoru',\n },\n\n table: {\n actions: 'Akce',\n anything: 'Cokoli',\n clear: 'Zrušit',\n clearAll: 'Zrušit filtry',\n clearFilter: (column) => `Zrušit filtr na ${column}`,\n clearSelection: 'Zrušit označení',\n done: 'Hotovo',\n emptyHint: 'Až tu něco bude, uvidíte to zde.',\n emptyTitle: 'Zatím tu nic není',\n expandRow: (row) => `Zobrazit více o řádku ${row}`,\n filterBy: (column) => `Filtrovat ${column}`,\n filterPick: (column) => `Vyberte z ${column}`,\n filterRange: (column) => `Rozsah ${column}`,\n filterSearch: (column) => `Hledat v ${column}`,\n from: 'Od',\n nextPage: 'Další stránka',\n noRows: 'Žádné řádky',\n nothingHint: 'Zrušte jednu z podmínek, nebo smažte hledání.',\n nothingTitle: 'Těmto filtrům nic neodpovídá',\n pages: 'Stránky',\n previousPage: 'Předchozí stránka',\n rowsPerPage: 'Řádků na stránku',\n selectAll: 'Označit řádky na této stránce',\n selectRow: (row) => `Označit řádek ${row}`,\n selected: (_count, written) => `${written} označeno`,\n shown: (from, to, total) => `${from}–${to} z ${total}`,\n sortAscending: (column) => `Řadit ${column} od nejmenšího`,\n sortBy: (column) => `Řadit podle ${column}`,\n sortClear: (column) => `Přestat řadit podle ${column}`,\n sortDescending: (column) => `Řadit ${column} od největšího`,\n to: 'Do',\n },\n\n tail: {\n empty: 'Žádné řádky logu',\n },\n\n userMenu: {\n account: 'účet',\n },\n },\n}\n\nexport { czech }\n"],"mappings":";AAEA,MAAM,SAAS;AAEf,MAAM,YAAY;AAElB,MAAM,WAAW;AAEjB,MAAM,WAAW,OAAe,YAA4B;CAC1D,IAAI,UAAU,QACZ,OAAO;CAET,IAAI,SAAS,aAAa,SAAS,UACjC,OAAO,GAAG,QAAQ;CAEpB,OAAO,GAAG,QAAQ;AACpB;AAEA,MAAM,QAAkB;CACtB,QAAQ;CAER,OAAO;EACL,YAAY;GACV,UAAU;GACV,SAAS,QAAQ,UAAU;GAC3B,SAAS,QAAQ,YAAY;GAC7B,OAAO;GACP,OAAO;GACP,YAAY;GACZ,WAAW;GACX,UAAU;GACV,MAAM;GACN,YAAY;GACZ,cAAc;GACd,aAAa;GACb,WAAW;GACX,UAAU;GACV,SAAS,SAAS,UAAU;GAC5B,gBAAgB;GAChB,eAAe;GACf,cAAc;GACd,YAAY,QAAQ,mBAAmB;GACvC,UAAU,QAAQ,qBAAqB;GACvC,UAAU;GACV,YAAY;GACZ,WAAW;GACX,cAAc,QAAQ,eAAe;GACrC,MAAM;GACN,aAAa,SAAS,GAAG,KAAK;EAChC;EAEA,QAAQ,EACN,OAAO,SACT;EAEA,SAAS,EACP,OAAO,sBACT;EAEA,OAAO,EACL,OAAO,SACT;EAEA,QAAQ;GACN,SAAS;GACT,SAAS;GACT;EACF;EAEA,QAAQ,EACN,OAAO,eACT;EAEA,SAAS;GACP,UAAU;GACV,QAAQ;GACR,UAAU;EACZ;EAEA,MAAM;GACJ,QAAQ;GACR,MAAM;GACN,MAAM;EACR;EAEA,OAAO;GACL,SAAS;GACT,UAAU;GACV,OAAO;GACP,UAAU;GACV,cAAc,WAAW,mBAAmB;GAC5C,gBAAgB;GAChB,MAAM;GACN,WAAW;GACX,YAAY;GACZ,YAAY,QAAQ,yBAAyB;GAC7C,WAAW,WAAW,aAAa;GACnC,aAAa,WAAW,aAAa;GACrC,cAAc,WAAW,UAAU;GACnC,eAAe,WAAW,YAAY;GACtC,MAAM;GACN,UAAU;GACV,QAAQ;GACR,aAAa;GACb,cAAc;GACd,OAAO;GACP,cAAc;GACd,aAAa;GACb,WAAW;GACX,YAAY,QAAQ,iBAAiB;GACrC,WAAW,QAAQ,YAAY,GAAG,QAAQ;GAC1C,QAAQ,MAAM,IAAI,UAAU,GAAG,KAAK,GAAG,GAAG,KAAK;GAC/C,gBAAgB,WAAW,SAAS,OAAO;GAC3C,SAAS,WAAW,eAAe;GACnC,YAAY,WAAW,uBAAuB;GAC9C,iBAAiB,WAAW,SAAS,OAAO;GAC5C,IAAI;EACN;EAEA,MAAM,EACJ,OAAO,mBACT;EAEA,UAAU,EACR,SAAS,OACX;CACF;AACF"}
package/dist/tally.d.ts DELETED
@@ -1,17 +0,0 @@
1
- //#region src/tally.d.ts
2
- declare const WHOLE = 1;
3
- interface Tally {
4
- counts: boolean;
5
- group: string;
6
- head: string;
7
- places: number;
8
- point: string;
9
- tail: string;
10
- target: number;
11
- whole: string;
12
- }
13
- declare const tallyOf: (value: string) => Tally;
14
- declare const tallyAt: (tally: Tally, part: number) => string;
15
- //#endregion
16
- export { type Tally, WHOLE, tallyAt, tallyOf };
17
- //# sourceMappingURL=tally.d.ts.map
package/dist/tally.js DELETED
@@ -1,75 +0,0 @@
1
- //#region src/tally.ts
2
- const RUN = /\d(?:[\S\s]*\d)?/u;
3
- const MARKS = /\D/gu;
4
- const LAST = -1;
5
- const ONCE = 1;
6
- const ONE = 1;
7
- const NONE = 0;
8
- const WHOLE = 1;
9
- const GROUP_SIZE = 3;
10
- const DECIMAL_MAX = 2;
11
- const marksIn = (run) => run.match(MARKS) ?? [];
12
- const pointOf = (run) => {
13
- const marks = marksIn(run);
14
- const last = marks.at(LAST) ?? "";
15
- if (last === "" || marks.filter((mark) => mark === last).length > ONCE) return "";
16
- if (run.length - run.lastIndexOf(last) - ONE > DECIMAL_MAX) return "";
17
- return last;
18
- };
19
- const groupOf = (run, point) => marksIn(run).filter((mark) => mark !== point).at(LAST) ?? "";
20
- const NOT_DIGITS = /[^\d]/gu;
21
- const targetOf = (run, point) => {
22
- if (point === "") return Number(run.replace(NOT_DIGITS, ""));
23
- const [body = "", fraction = ""] = run.split(point);
24
- return Number(`${body.replace(NOT_DIGITS, "")}.${fraction.replace(NOT_DIGITS, "")}`);
25
- };
26
- const placesOf = (run, point) => {
27
- if (point === "") return NONE;
28
- return run.length - run.lastIndexOf(point) - ONE;
29
- };
30
- const RESTS = {
31
- counts: false,
32
- group: "",
33
- head: "",
34
- places: NONE,
35
- point: "",
36
- tail: "",
37
- target: NONE,
38
- whole: ""
39
- };
40
- const tallyOf = (value) => {
41
- const found = RUN.exec(value);
42
- if (!found) return {
43
- ...RESTS,
44
- whole: value
45
- };
46
- const [run] = found;
47
- const point = pointOf(run);
48
- return {
49
- counts: true,
50
- group: groupOf(run, point),
51
- head: value.slice(NONE, found.index),
52
- places: placesOf(run, point),
53
- point,
54
- tail: value.slice(found.index + run.length),
55
- target: targetOf(run, point),
56
- whole: value
57
- };
58
- };
59
- const grouped = (body, group) => {
60
- if (group === "") return body;
61
- const parts = [];
62
- for (let edge = body.length; edge > NONE; edge -= GROUP_SIZE) parts.unshift(body.slice(Math.max(edge - GROUP_SIZE, NONE), edge));
63
- return parts.join(group);
64
- };
65
- const tallyAt = (tally, part) => {
66
- if (!tally.counts || part >= 1) return tally.whole;
67
- const [body = "", fraction = ""] = (tally.target * part).toFixed(tally.places).split(".");
68
- const shown = grouped(body, tally.group);
69
- if (tally.point === "") return `${tally.head}${shown}${tally.tail}`;
70
- return `${tally.head}${shown}${tally.point}${fraction}${tally.tail}`;
71
- };
72
- //#endregion
73
- export { WHOLE, tallyAt, tallyOf };
74
-
75
- //# sourceMappingURL=tally.js.map
package/dist/tally.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"tally.js","names":[],"sources":["../src/tally.ts"],"sourcesContent":["const RUN = /\\d(?:[\\S\\s]*\\d)?/u\n\nconst MARKS = /\\D/gu\n\nconst LAST = -1\nconst ONCE = 1\nconst ONE = 1\nconst NONE = 0\nconst WHOLE = 1\nconst GROUP_SIZE = 3\nconst DECIMAL_MAX = 2\n\ninterface Tally {\n counts: boolean\n group: string\n head: string\n places: number\n point: string\n tail: string\n target: number\n whole: string\n}\n\nconst marksIn = (run: string): string[] => run.match(MARKS) ?? []\n\nconst pointOf = (run: string): string => {\n const marks = marksIn(run)\n const last = marks.at(LAST) ?? ''\n\n if (last === '' || marks.filter((mark) => mark === last).length > ONCE) {\n return ''\n }\n if (run.length - run.lastIndexOf(last) - ONE > DECIMAL_MAX) {\n return ''\n }\n return last\n}\n\nconst groupOf = (run: string, point: string): string =>\n marksIn(run)\n .filter((mark) => mark !== point)\n .at(LAST) ?? ''\n\nconst NOT_DIGITS = /[^\\d]/gu\n\nconst targetOf = (run: string, point: string): number => {\n if (point === '') {\n return Number(run.replace(NOT_DIGITS, ''))\n }\n const [body = '', fraction = ''] = run.split(point)\n\n return Number(`${body.replace(NOT_DIGITS, '')}.${fraction.replace(NOT_DIGITS, '')}`)\n}\n\nconst placesOf = (run: string, point: string): number => {\n if (point === '') {\n return NONE\n }\n return run.length - run.lastIndexOf(point) - ONE\n}\n\nconst RESTS: Tally = {\n counts: false,\n group: '',\n head: '',\n places: NONE,\n point: '',\n tail: '',\n target: NONE,\n whole: '',\n}\n\nconst tallyOf = (value: string): Tally => {\n const found = RUN.exec(value)\n\n if (!found) {\n return { ...RESTS, whole: value }\n }\n const [run] = found\n const point = pointOf(run)\n\n return {\n counts: true,\n group: groupOf(run, point),\n head: value.slice(NONE, found.index),\n places: placesOf(run, point),\n point,\n tail: value.slice(found.index + run.length),\n target: targetOf(run, point),\n whole: value,\n }\n}\n\nconst grouped = (body: string, group: string): string => {\n if (group === '') {\n return body\n }\n const parts: string[] = []\n\n for (let edge = body.length; edge > NONE; edge -= GROUP_SIZE) {\n parts.unshift(body.slice(Math.max(edge - GROUP_SIZE, NONE), edge))\n }\n return parts.join(group)\n}\n\nconst tallyAt = (tally: Tally, part: number): string => {\n if (!tally.counts || part >= WHOLE) {\n return tally.whole\n }\n const [body = '', fraction = ''] = (tally.target * part).toFixed(tally.places).split('.')\n const shown = grouped(body, tally.group)\n\n if (tally.point === '') {\n return `${tally.head}${shown}${tally.tail}`\n }\n return `${tally.head}${shown}${tally.point}${fraction}${tally.tail}`\n}\n\nexport { type Tally, WHOLE, tallyAt, tallyOf }\n"],"mappings":";AAAA,MAAM,MAAM;AAEZ,MAAM,QAAQ;AAEd,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,aAAa;AACnB,MAAM,cAAc;AAapB,MAAM,WAAW,QAA0B,IAAI,MAAM,KAAK,KAAK,CAAC;AAEhE,MAAM,WAAW,QAAwB;CACvC,MAAM,QAAQ,QAAQ,GAAG;CACzB,MAAM,OAAO,MAAM,GAAG,IAAI,KAAK;CAE/B,IAAI,SAAS,MAAM,MAAM,QAAQ,SAAS,SAAS,IAAI,CAAC,CAAC,SAAS,MAChE,OAAO;CAET,IAAI,IAAI,SAAS,IAAI,YAAY,IAAI,IAAI,MAAM,aAC7C,OAAO;CAET,OAAO;AACT;AAEA,MAAM,WAAW,KAAa,UAC5B,Q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E,OAAO,MAAM,KAAK,KAAK;AACzB;AAEA,MAAM,WAAW,OAAc,SAAyB;CACtD,IAAI,CAAC,MAAM,UAAU,QAAA,GACnB,OAAO,MAAM;CAEf,MAAM,CAAC,OAAO,IAAI,WAAW,OAAO,MAAM,SAAS,KAAA,CAAM,QAAQ,MAAM,MAAM,CAAC,CAAC,MAAM,GAAG;CACxF,MAAM,QAAQ,QAAQ,MAAM,MAAM,KAAK;CAEvC,IAAI,MAAM,UAAU,IAClB,OAAO,GAAG,MAAM,OAAO,QAAQ,MAAM;CAEvC,OAAO,GAAG,MAAM,OAAO,QAAQ,MAAM,QAAQ,WAAW,MAAM;AAChE"}
package/dist/words.d.ts DELETED
@@ -1,116 +0,0 @@
1
- //#region src/words.d.ts
2
- interface TableWords {
3
- actions: string;
4
- anything: string;
5
- clear: string;
6
- clearAll: string;
7
- clearFilter: (column: string) => string;
8
- clearSelection: string;
9
- done: string;
10
- emptyHint: string;
11
- emptyTitle: string;
12
- expandRow: (row: string) => string;
13
- filterBy: (column: string) => string;
14
- filterPick: (column: string) => string;
15
- filterRange: (column: string) => string;
16
- filterSearch: (column: string) => string;
17
- from: string;
18
- nextPage: string;
19
- noRows: string;
20
- pages: string;
21
- nothingHint: string;
22
- nothingTitle: string;
23
- previousPage: string;
24
- rowsPerPage: string;
25
- selectAll: string;
26
- selectRow: (row: string) => string;
27
- selected: (count: number, written: string) => string;
28
- shown: (from: string, to: string, total: string) => string;
29
- sortAscending: (column: string) => string;
30
- sortBy: (column: string) => string;
31
- sortClear: (column: string) => string;
32
- sortDescending: (column: string) => string;
33
- to: string;
34
- }
35
- interface DatePickerWords {
36
- calendar: string;
37
- choose: (day: string) => string;
38
- chosen: (day: string) => string;
39
- clear: string;
40
- close: string;
41
- nextDecade: string;
42
- nextMonth: string;
43
- nextYear: string;
44
- open: string;
45
- patternDay: string;
46
- patternMonth: string;
47
- patternYear: string;
48
- pickMonth: string;
49
- pickYear: string;
50
- preset: (span: string) => string;
51
- previousDecade: string;
52
- previousMonth: string;
53
- previousYear: string;
54
- rangeFrom: (day: string) => string;
55
- rangeTo: (day: string) => string;
56
- showDays: string;
57
- showMonths: string;
58
- showYears: string;
59
- unavailable: (day: string) => string;
60
- week: string;
61
- weekNumber: (week: string) => string;
62
- }
63
- interface DialogWords {
64
- close: string;
65
- }
66
- interface SidebarWords {
67
- collapse: string;
68
- expand: string;
69
- openMenu: string;
70
- }
71
- interface StatWords {
72
- change: string;
73
- fell: string;
74
- rose: string;
75
- }
76
- interface SearchWords {
77
- dismiss: string;
78
- nothing: string;
79
- results: (count: number, written: string) => string;
80
- }
81
- interface ListboxWords {
82
- empty: string;
83
- }
84
- interface QueueWords {
85
- label: string;
86
- }
87
- interface SelectWords {
88
- clear: string;
89
- }
90
- interface TailWords {
91
- empty: string;
92
- }
93
- interface UserMenuWords {
94
- account: string;
95
- }
96
- interface Words {
97
- datePicker: DatePickerWords;
98
- dialog: DialogWords;
99
- listbox: ListboxWords;
100
- queue: QueueWords;
101
- search: SearchWords;
102
- select: SelectWords;
103
- sidebar: SidebarWords;
104
- stat: StatWords;
105
- table: TableWords;
106
- tail: TailWords;
107
- userMenu: UserMenuWords;
108
- }
109
- interface Language {
110
- locale?: string;
111
- words: Words;
112
- }
113
- declare const english: Language;
114
- //#endregion
115
- export { type DatePickerWords, type DialogWords, type Language, type SearchWords, type SelectWords, type SidebarWords, type StatWords, type TableWords, type TailWords, type UserMenuWords, type Words, english };
116
- //# sourceMappingURL=words.d.ts.map
package/dist/words.js DELETED
@@ -1,96 +0,0 @@
1
- //#region src/words.ts
2
- const SINGLE = 1;
3
- const english = {
4
- locale: "en-US",
5
- words: {
6
- datePicker: {
7
- calendar: "Calendar",
8
- choose: (day) => `Choose ${day}`,
9
- chosen: (day) => `Chosen, ${day}`,
10
- clear: "Clear the dates",
11
- close: "Close the calendar",
12
- nextDecade: "Next decade",
13
- nextMonth: "Next month",
14
- nextYear: "Next year",
15
- open: "Open the calendar",
16
- patternDay: "dd",
17
- patternMonth: "mm",
18
- patternYear: "yyyy",
19
- pickMonth: "Pick a month",
20
- pickYear: "Pick a year",
21
- preset: (span) => `Choose ${span}`,
22
- previousDecade: "Previous decade",
23
- previousMonth: "Previous month",
24
- previousYear: "Previous year",
25
- rangeFrom: (day) => `Start the range at ${day}`,
26
- rangeTo: (day) => `End the range at ${day}`,
27
- showDays: "Show the days",
28
- showMonths: "Show the months",
29
- showYears: "Show the years",
30
- unavailable: (day) => `Not available, ${day}`,
31
- week: "Wk",
32
- weekNumber: (week) => `Week ${week}`
33
- },
34
- dialog: { close: "Close" },
35
- listbox: { empty: "Nothing to choose from" },
36
- queue: { label: "Queue" },
37
- search: {
38
- dismiss: "Esc closes",
39
- nothing: "Nothing matches that",
40
- results: (count, written) => {
41
- if (count === SINGLE) return "1 result";
42
- return `${written} results`;
43
- }
44
- },
45
- select: { clear: "Clear" },
46
- sidebar: {
47
- collapse: "Collapse the sidebar",
48
- expand: "Expand the sidebar",
49
- openMenu: "Open menu"
50
- },
51
- stat: {
52
- change: "Change",
53
- fell: "down",
54
- rose: "up"
55
- },
56
- table: {
57
- actions: "Actions",
58
- anything: "Anything",
59
- clear: "Clear",
60
- clearAll: "Clear the filters",
61
- clearFilter: (column) => `Remove the filter on ${column}`,
62
- clearSelection: "Clear selection",
63
- done: "Done",
64
- emptyHint: "Items will show up here once there are some.",
65
- emptyTitle: "No items yet",
66
- expandRow: (row) => `Show more about row ${row}`,
67
- filterBy: (column) => `Filter ${column}`,
68
- filterPick: (column) => `Pick from ${column}`,
69
- filterRange: (column) => `Range of ${column}`,
70
- filterSearch: (column) => `Search in ${column}`,
71
- from: "From",
72
- nextPage: "Next page",
73
- noRows: "No rows",
74
- nothingHint: "Drop one of the conditions, or clear the search.",
75
- nothingTitle: "Nothing matches those filters",
76
- pages: "Pages",
77
- previousPage: "Previous page",
78
- rowsPerPage: "Rows per page",
79
- selectAll: "Select the rows on this page",
80
- selectRow: (row) => `Select row ${row}`,
81
- selected: (_count, written) => `${written} selected`,
82
- shown: (from, to, total) => `${from}–${to} of ${total}`,
83
- sortAscending: (column) => `Sort ${column} smallest first`,
84
- sortBy: (column) => `Sort by ${column}`,
85
- sortClear: (column) => `Stop sorting by ${column}`,
86
- sortDescending: (column) => `Sort ${column} largest first`,
87
- to: "To"
88
- },
89
- tail: { empty: "No log lines" },
90
- userMenu: { account: "account" }
91
- }
92
- };
93
- //#endregion
94
- export { english };
95
-
96
- //# sourceMappingURL=words.js.map