@trebired/frontend 0.5.0 → 1.1.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/CHANGELOG.md +18 -0
  2. package/README.md +56 -84
  3. package/dist/config/fonts.d.ts +5 -0
  4. package/dist/config/fonts.d.ts.map +1 -0
  5. package/dist/config/fonts.js +158 -0
  6. package/dist/config/fonts.js.map +1 -0
  7. package/dist/config/index.d.ts +1 -1
  8. package/dist/config/index.d.ts.map +1 -1
  9. package/dist/config/module.js +1 -1
  10. package/dist/config/module.js.map +1 -1
  11. package/dist/config/normalize.d.ts +1 -2
  12. package/dist/config/normalize.d.ts.map +1 -1
  13. package/dist/config/normalize.js +30 -13
  14. package/dist/config/normalize.js.map +1 -1
  15. package/dist/config/palette.d.ts +8 -0
  16. package/dist/config/palette.d.ts.map +1 -0
  17. package/dist/config/palette.js +104 -0
  18. package/dist/config/palette.js.map +1 -0
  19. package/dist/config/scales-css.d.ts +8 -0
  20. package/dist/config/scales-css.d.ts.map +1 -0
  21. package/dist/config/scales-css.js +103 -0
  22. package/dist/config/scales-css.js.map +1 -0
  23. package/dist/config/scales.d.ts +4 -0
  24. package/dist/config/scales.d.ts.map +1 -0
  25. package/dist/config/scales.js +55 -0
  26. package/dist/config/scales.js.map +1 -0
  27. package/dist/config/scss.d.ts.map +1 -1
  28. package/dist/config/scss.js +61 -7
  29. package/dist/config/scss.js.map +1 -1
  30. package/dist/config/types.d.ts +97 -2
  31. package/dist/config/types.d.ts.map +1 -1
  32. package/dist/flash/dialogs.d.ts +20 -2
  33. package/dist/flash/dialogs.d.ts.map +1 -1
  34. package/dist/flash/dialogs.js +185 -17
  35. package/dist/flash/dialogs.js.map +1 -1
  36. package/dist/flash/elements.d.ts +1 -1
  37. package/dist/flash/elements.d.ts.map +1 -1
  38. package/dist/flash/elements.js +17 -4
  39. package/dist/flash/elements.js.map +1 -1
  40. package/dist/flash/index.d.ts +5 -4
  41. package/dist/flash/index.d.ts.map +1 -1
  42. package/dist/flash/index.js +21 -3
  43. package/dist/flash/index.js.map +1 -1
  44. package/dist/flash/stack.d.ts.map +1 -1
  45. package/dist/flash/stack.js +26 -1
  46. package/dist/flash/stack.js.map +1 -1
  47. package/dist/flash/styles/index.scss +54 -2
  48. package/dist/flash/toast.d.ts +10 -1
  49. package/dist/flash/toast.d.ts.map +1 -1
  50. package/dist/flash/toast.js +23 -4
  51. package/dist/flash/toast.js.map +1 -1
  52. package/dist/flash/types.d.ts +38 -2
  53. package/dist/flash/types.d.ts.map +1 -1
  54. package/dist/fullscreen/components/index.d.ts +20 -0
  55. package/dist/fullscreen/components/index.d.ts.map +1 -0
  56. package/dist/fullscreen/components/index.js +19 -0
  57. package/dist/fullscreen/components/index.js.map +1 -0
  58. package/dist/fullscreen/index.d.ts +24 -3
  59. package/dist/fullscreen/index.d.ts.map +1 -1
  60. package/dist/fullscreen/index.js +268 -7
  61. package/dist/fullscreen/index.js.map +1 -1
  62. package/dist/fullscreen/styles/index.scss +71 -0
  63. package/dist/index.d.ts +7 -1
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +9 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/layout/components/index.d.ts +43 -0
  68. package/dist/layout/components/index.d.ts.map +1 -0
  69. package/dist/layout/components/index.js +53 -0
  70. package/dist/layout/components/index.js.map +1 -0
  71. package/dist/layout/index.d.ts +27 -0
  72. package/dist/layout/index.d.ts.map +1 -0
  73. package/dist/layout/index.js +80 -0
  74. package/dist/layout/index.js.map +1 -0
  75. package/dist/layout/styles/index.scss +137 -0
  76. package/dist/react/index.d.ts +14 -0
  77. package/dist/react/index.d.ts.map +1 -1
  78. package/dist/react/index.js +14 -0
  79. package/dist/react/index.js.map +1 -1
  80. package/dist/server/index.d.ts +5 -0
  81. package/dist/server/index.d.ts.map +1 -0
  82. package/dist/server/index.js +5 -0
  83. package/dist/server/index.js.map +1 -0
  84. package/dist/sidebar/components/index.d.ts +35 -0
  85. package/dist/sidebar/components/index.d.ts.map +1 -0
  86. package/dist/sidebar/components/index.js +49 -0
  87. package/dist/sidebar/components/index.js.map +1 -0
  88. package/dist/sidebar/index.d.ts +62 -0
  89. package/dist/sidebar/index.d.ts.map +1 -0
  90. package/dist/sidebar/index.js +247 -0
  91. package/dist/sidebar/index.js.map +1 -0
  92. package/dist/sidebar/styles/index.scss +205 -0
  93. package/dist/src/config/fonts.d.ts +5 -0
  94. package/dist/src/config/fonts.d.ts.map +1 -0
  95. package/dist/src/config/fonts.js +158 -0
  96. package/dist/src/config/fonts.js.map +1 -0
  97. package/dist/src/config/index.d.ts +1 -1
  98. package/dist/src/config/index.d.ts.map +1 -1
  99. package/dist/src/config/module.js +1 -1
  100. package/dist/src/config/module.js.map +1 -1
  101. package/dist/src/config/normalize.d.ts +1 -2
  102. package/dist/src/config/normalize.d.ts.map +1 -1
  103. package/dist/src/config/normalize.js +30 -13
  104. package/dist/src/config/normalize.js.map +1 -1
  105. package/dist/src/config/palette.d.ts +8 -0
  106. package/dist/src/config/palette.d.ts.map +1 -0
  107. package/dist/src/config/palette.js +104 -0
  108. package/dist/src/config/palette.js.map +1 -0
  109. package/dist/src/config/scales-css.d.ts +8 -0
  110. package/dist/src/config/scales-css.d.ts.map +1 -0
  111. package/dist/src/config/scales-css.js +103 -0
  112. package/dist/src/config/scales-css.js.map +1 -0
  113. package/dist/src/config/scales.d.ts +4 -0
  114. package/dist/src/config/scales.d.ts.map +1 -0
  115. package/dist/src/config/scales.js +55 -0
  116. package/dist/src/config/scales.js.map +1 -0
  117. package/dist/src/config/scss.d.ts.map +1 -1
  118. package/dist/src/config/scss.js +61 -7
  119. package/dist/src/config/scss.js.map +1 -1
  120. package/dist/src/config/types.d.ts +97 -2
  121. package/dist/src/config/types.d.ts.map +1 -1
  122. package/dist/src/flash/dialogs.d.ts +20 -2
  123. package/dist/src/flash/dialogs.d.ts.map +1 -1
  124. package/dist/src/flash/dialogs.js +185 -17
  125. package/dist/src/flash/dialogs.js.map +1 -1
  126. package/dist/src/flash/elements.d.ts +1 -1
  127. package/dist/src/flash/elements.d.ts.map +1 -1
  128. package/dist/src/flash/elements.js +17 -4
  129. package/dist/src/flash/elements.js.map +1 -1
  130. package/dist/src/flash/index.d.ts +5 -4
  131. package/dist/src/flash/index.d.ts.map +1 -1
  132. package/dist/src/flash/index.js +21 -3
  133. package/dist/src/flash/index.js.map +1 -1
  134. package/dist/src/flash/stack.d.ts.map +1 -1
  135. package/dist/src/flash/stack.js +26 -1
  136. package/dist/src/flash/stack.js.map +1 -1
  137. package/dist/src/flash/toast.d.ts +10 -1
  138. package/dist/src/flash/toast.d.ts.map +1 -1
  139. package/dist/src/flash/toast.js +23 -4
  140. package/dist/src/flash/toast.js.map +1 -1
  141. package/dist/src/flash/types.d.ts +38 -2
  142. package/dist/src/flash/types.d.ts.map +1 -1
  143. package/dist/src/fullscreen/components/index.d.ts +20 -0
  144. package/dist/src/fullscreen/components/index.d.ts.map +1 -0
  145. package/dist/src/fullscreen/components/index.js +19 -0
  146. package/dist/src/fullscreen/components/index.js.map +1 -0
  147. package/dist/src/fullscreen/index.d.ts +24 -3
  148. package/dist/src/fullscreen/index.d.ts.map +1 -1
  149. package/dist/src/fullscreen/index.js +268 -7
  150. package/dist/src/fullscreen/index.js.map +1 -1
  151. package/dist/src/index.d.ts +7 -1
  152. package/dist/src/index.d.ts.map +1 -1
  153. package/dist/src/index.js +9 -1
  154. package/dist/src/index.js.map +1 -1
  155. package/dist/src/layout/components/index.d.ts +43 -0
  156. package/dist/src/layout/components/index.d.ts.map +1 -0
  157. package/dist/src/layout/components/index.js +53 -0
  158. package/dist/src/layout/components/index.js.map +1 -0
  159. package/dist/src/layout/index.d.ts +27 -0
  160. package/dist/src/layout/index.d.ts.map +1 -0
  161. package/dist/src/layout/index.js +80 -0
  162. package/dist/src/layout/index.js.map +1 -0
  163. package/dist/src/react/index.d.ts +14 -0
  164. package/dist/src/react/index.d.ts.map +1 -1
  165. package/dist/src/react/index.js +14 -0
  166. package/dist/src/react/index.js.map +1 -1
  167. package/dist/src/server/index.d.ts +5 -0
  168. package/dist/src/server/index.d.ts.map +1 -0
  169. package/dist/src/server/index.js +5 -0
  170. package/dist/src/server/index.js.map +1 -0
  171. package/dist/src/sidebar/components/index.d.ts +35 -0
  172. package/dist/src/sidebar/components/index.d.ts.map +1 -0
  173. package/dist/src/sidebar/components/index.js +49 -0
  174. package/dist/src/sidebar/components/index.js.map +1 -0
  175. package/dist/src/sidebar/index.d.ts +62 -0
  176. package/dist/src/sidebar/index.d.ts.map +1 -0
  177. package/dist/src/sidebar/index.js +247 -0
  178. package/dist/src/sidebar/index.js.map +1 -0
  179. package/dist/styles/tokens.scss +61 -9
  180. package/dist/styles/utils.scss +479 -0
  181. package/package.json +4 -167
  182. package/dist/src/styles/index.d.ts +0 -3
  183. package/dist/src/styles/index.d.ts.map +0 -1
  184. package/dist/src/styles/index.js +0 -15
  185. package/dist/src/styles/index.js.map +0 -1
  186. package/dist/styles/index.d.ts +0 -3
  187. package/dist/styles/index.d.ts.map +0 -1
  188. package/dist/styles/index.js +0 -15
  189. package/dist/styles/index.js.map +0 -1
@@ -0,0 +1,55 @@
1
+ import { assertPlainObject, invalidConfig } from "./shared.js";
2
+ const SCALE_STEP_KEY_RE = /^[a-z0-9][a-z0-9_-]*$/iu;
3
+ function normalizeScaleSteps(value, pathLabel) {
4
+ if (value === undefined)
5
+ return {};
6
+ const source = assertPlainObject(value, pathLabel);
7
+ const out = {};
8
+ for (const [step, amount] of Object.entries(source).sort(([a], [b]) => a.localeCompare(b))) {
9
+ if (!SCALE_STEP_KEY_RE.test(step)) {
10
+ throw invalidConfig(`${pathLabel}.${step} has an invalid step key`);
11
+ }
12
+ if (typeof amount !== "number" || !Number.isFinite(amount)) {
13
+ throw invalidConfig(`${pathLabel}.${step} must be a finite number`);
14
+ }
15
+ out[step] = amount;
16
+ }
17
+ return out;
18
+ }
19
+ function normalizeZIndexRole(value, steps, pathLabel) {
20
+ if (value === undefined || value === "")
21
+ return "";
22
+ const key = String(value).trim();
23
+ if (!Object.prototype.hasOwnProperty.call(steps, key)) {
24
+ throw invalidConfig(`${pathLabel} must name a step declared in scales.zIndex.steps`);
25
+ }
26
+ return key;
27
+ }
28
+ function normalizeZIndexScale(value) {
29
+ if (value === undefined) {
30
+ return { confetti: "", layerRoot: "", progress: "", steps: {} };
31
+ }
32
+ const source = assertPlainObject(value, "scales.zIndex");
33
+ const steps = normalizeScaleSteps(source.steps, "scales.zIndex.steps");
34
+ return {
35
+ confetti: normalizeZIndexRole(source.confetti, steps, "scales.zIndex.confetti"),
36
+ layerRoot: normalizeZIndexRole(source.layerRoot, steps, "scales.zIndex.layerRoot"),
37
+ progress: normalizeZIndexRole(source.progress, steps, "scales.zIndex.progress"),
38
+ steps,
39
+ };
40
+ }
41
+ function normalizeScalesConfig(value) {
42
+ const source = value === undefined ? {} : assertPlainObject(value, "scales");
43
+ return {
44
+ height: normalizeScaleSteps(source.height, "scales.height"),
45
+ lineHeight: normalizeScaleSteps(source.lineHeight, "scales.lineHeight"),
46
+ padding: normalizeScaleSteps(source.padding, "scales.padding"),
47
+ radius: normalizeScaleSteps(source.radius, "scales.radius"),
48
+ spacing: normalizeScaleSteps(source.spacing, "scales.spacing"),
49
+ textSize: normalizeScaleSteps(source.textSize, "scales.textSize"),
50
+ width: normalizeScaleSteps(source.width, "scales.width"),
51
+ zIndex: normalizeZIndexScale(source.zIndex),
52
+ };
53
+ }
54
+ export { normalizeScalesConfig };
55
+ //# sourceMappingURL=scales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scales.js","sourceRoot":"","sources":["../../../src/config/scales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO/D,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD,SAAS,mBAAmB,CAAC,KAAc,EAAE,SAAiB;IAC5D,IAAI,KAAK,KAAK,SAAS;QAAE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AK,EAAE,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC;QACxD,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../../src/config/scss.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,gCAAgC,EAEhC,sBAAsB,EAEvB,MAAM,YAAY,CAAC;AA+EpB,iBAAS,4BAA4B,CACnC,WAAW,EAAE,sBAAsB,GAAG,gCAAgC,GACrE,MAAM,CAWR;AAED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../../src/config/scss.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,gCAAgC,EAEhC,sBAAsB,EAEvB,MAAM,YAAY,CAAC;AA6HpB,iBAAS,4BAA4B,CACnC,WAAW,EAAE,sBAAsB,GAAG,gCAAgC,GACrE,MAAM,CAiBR;AAED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
@@ -1,6 +1,40 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { renderFontsCss } from "./fonts.js";
1
4
  import { cssComment, cssString } from "./shared.js";
2
- import { SYSTEM_ORDER, SYSTEM_STYLE_IMPORTS, THEME_MODE_ATTRIBUTE, normalizeTrebiredFrontendConfig, } from "./normalize.js";
5
+ import { SYSTEM_ORDER, THEME_MODE_ATTRIBUTE, normalizeTrebiredFrontendConfig, } from "./normalize.js";
6
+ import { findPaletteMode, paletteModeScaleDeclarations, paletteSemanticDeclarations, paletteSuffixedDeclarations, } from "./palette.js";
7
+ import { renderScalesCss } from "./scales-css.js";
3
8
  import { flattenThemeTokens } from "./theme.js";
9
+ const SYSTEM_STYLE_FILES = {
10
+ actions: "actions/styles/index.scss",
11
+ flash: "flash/styles/index.scss",
12
+ icons: "icons/styles/index.scss",
13
+ inputs: "inputs/styles/index.scss",
14
+ layer: "layer/styles/index.scss",
15
+ layout: "layout/styles/index.scss",
16
+ modal: "modal/styles/index.scss",
17
+ popover: "popover/styles/index.scss",
18
+ progress: "progress/styles/index.scss",
19
+ sidebar: "sidebar/styles/index.scss",
20
+ tooltip: "tooltip/styles/index.scss",
21
+ fullscreen: "fullscreen/styles/index.scss",
22
+ };
23
+ function packageStylePath(relativePath) {
24
+ const configDir = path.dirname(fileURLToPath(import.meta.url));
25
+ return path.resolve(configDir, "..", relativePath).replace(/\\/gu, "/");
26
+ }
27
+ function packageStyleUse(relativePath) {
28
+ return `@use ${cssString(packageStylePath(relativePath))} as *;`;
29
+ }
30
+ function isNormalizedConfig(value) {
31
+ if (!value || typeof value !== "object" || Array.isArray(value))
32
+ return false;
33
+ const config = value;
34
+ return Array.isArray(config.fonts?.families) &&
35
+ Array.isArray(config.theme?.modes) &&
36
+ Array.isArray(config.palette?.modes);
37
+ }
4
38
  function tokenDeclarations(prefix, tokens) {
5
39
  return flattenThemeTokens(tokens).map(([key, value]) => ` --${prefix}-${key}: ${String(value)};`);
6
40
  }
@@ -12,12 +46,16 @@ function rootDeclarations(config) {
12
46
  ...(modes.length ? [` --${config.prefix}-theme-modes: ${cssString(modes.map((mode) => mode.key).join(" "))};`] : []),
13
47
  ...(defaultMode ? [` --${config.prefix}-theme-default: ${cssString(defaultMode)};`] : []),
14
48
  ...tokenDeclarations(config.prefix, config.theme.tokens),
49
+ ...paletteSemanticDeclarations(config.palette),
50
+ ...paletteSuffixedDeclarations(config.palette),
15
51
  ];
16
52
  }
17
53
  function modeDeclarations(config, mode) {
54
+ const paletteMode = findPaletteMode(config.palette, mode.key);
18
55
  return [
19
56
  ` color-scheme: ${mode.scheme};`,
20
57
  ...tokenDeclarations(config.prefix, mode.tokens),
58
+ ...(paletteMode ? paletteModeScaleDeclarations(paletteMode) : []),
21
59
  ];
22
60
  }
23
61
  function renderBlock(selector, declarations, indent = "") {
@@ -59,24 +97,40 @@ function renderThemeCss(config) {
59
97
  ...renderSystemPreferenceBlock(config, "light"),
60
98
  ];
61
99
  }
100
+ function renderScalesRootBlock(vars) {
101
+ if (!vars.length)
102
+ return [];
103
+ return ["", ...renderBlock(":root", vars)];
104
+ }
105
+ function renderScalesBody(body) {
106
+ if (!body.length)
107
+ return [];
108
+ return ["", ...body];
109
+ }
62
110
  function renderSystemImports(config) {
63
111
  const lines = [];
64
112
  for (const system of SYSTEM_ORDER) {
65
- const importPath = SYSTEM_STYLE_IMPORTS[system];
66
- if (importPath && config.systems[system])
67
- lines.push(`@use ${cssString(importPath)} as *;`);
113
+ const stylePath = SYSTEM_STYLE_FILES[system];
114
+ if (stylePath && config.systems[system])
115
+ lines.push(packageStyleUse(stylePath));
68
116
  }
69
117
  return lines;
70
118
  }
71
119
  function generateTrebiredFrontendScss(configInput) {
72
- const config = normalizeTrebiredFrontendConfig(configInput);
120
+ const config = isNormalizedConfig(configInput)
121
+ ? configInput
122
+ : normalizeTrebiredFrontendConfig(configInput);
123
+ const scalesCss = renderScalesCss(config.scales);
73
124
  const lines = [
74
125
  "/* Generated by @trebired/frontend. Do not edit directly. */",
75
126
  `/* prefix: ${cssComment(config.prefix)} */`,
76
- '@use "@trebired/frontend/styles/tokens" as *;',
77
- '@use "@trebired/frontend/styles/utils" as *;',
127
+ packageStyleUse("styles/tokens.scss"),
128
+ packageStyleUse("styles/utils.scss"),
78
129
  ...renderSystemImports(config),
130
+ ...renderFontsCss(config.fonts),
79
131
  ...renderThemeCss(config),
132
+ ...renderScalesRootBlock(scalesCss.vars),
133
+ ...renderScalesBody(scalesCss.body),
80
134
  ];
81
135
  return `${lines.join("\n")}\n`;
82
136
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scss.js","sourceRoot":"","sources":["../../../src/config/scss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,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,CAAC,SAAS,CAAC,IAAI,CAAC;QACxC,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC;KACpC,CAAC;IACF,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  type TrebiredFrontendIconPack = "remixicon" | "simple-icons";
2
- type TrebiredFrontendSystemKey = "actions" | "flash" | "fullscreen" | "icons" | "inputs" | "layer" | "modal" | "popover" | "progress" | "theme" | "tooltip";
2
+ type TrebiredFrontendSystemKey = "actions" | "flash" | "fullscreen" | "icons" | "inputs" | "layer" | "layout" | "modal" | "popover" | "progress" | "sidebar" | "theme" | "tooltip";
3
3
  type TrebiredFrontendThemeTokens = Record<string, unknown>;
4
4
  type TrebiredFrontendThemeModeScheme = "dark" | "light";
5
5
  type TrebiredFrontendThemeMode = {
@@ -15,12 +15,61 @@ type TrebiredFrontendThemeConfig = {
15
15
  modes?: Record<string, TrebiredFrontendThemeMode>;
16
16
  tokens?: TrebiredFrontendThemeTokens;
17
17
  };
18
+ type TrebiredFrontendPaletteScale = Record<string, string>;
19
+ type TrebiredFrontendPaletteFamilies = Record<string, TrebiredFrontendPaletteScale>;
20
+ type TrebiredFrontendPaletteMode = {
21
+ scale: TrebiredFrontendPaletteFamilies;
22
+ };
23
+ type TrebiredFrontendPaletteSemanticRef = {
24
+ family: string;
25
+ step: string;
26
+ };
27
+ type TrebiredFrontendPaletteConfig = {
28
+ modes?: Record<string, TrebiredFrontendPaletteMode>;
29
+ semantic?: Record<string, TrebiredFrontendPaletteSemanticRef>;
30
+ suffixedVariants?: boolean;
31
+ };
32
+ type TrebiredFrontendScaleSteps = Record<string, number>;
33
+ type TrebiredFrontendZIndexScaleConfig = {
34
+ confetti?: string;
35
+ layerRoot?: string;
36
+ progress?: string;
37
+ steps: TrebiredFrontendScaleSteps;
38
+ };
39
+ type TrebiredFrontendScalesConfig = {
40
+ height?: TrebiredFrontendScaleSteps;
41
+ lineHeight?: TrebiredFrontendScaleSteps;
42
+ padding?: TrebiredFrontendScaleSteps;
43
+ radius?: TrebiredFrontendScaleSteps;
44
+ spacing?: TrebiredFrontendScaleSteps;
45
+ textSize?: TrebiredFrontendScaleSteps;
46
+ width?: TrebiredFrontendScaleSteps;
47
+ zIndex?: TrebiredFrontendZIndexScaleConfig;
48
+ };
49
+ type TrebiredFrontendFontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
50
+ type TrebiredFrontendFontStyle = "italic" | "normal";
51
+ type TrebiredFrontendFontFamilyConfig = {
52
+ display?: TrebiredFrontendFontDisplay;
53
+ family?: string;
54
+ fontsource?: string;
55
+ package?: string;
56
+ styles?: readonly TrebiredFrontendFontStyle[];
57
+ subsets?: readonly string[];
58
+ weights?: readonly number[];
59
+ };
60
+ type TrebiredFrontendFontConfig = {
61
+ families?: Record<string, TrebiredFrontendFontFamilyConfig>;
62
+ sans?: string;
63
+ };
18
64
  type TrebiredFrontendConfig = {
65
+ fonts?: TrebiredFrontendFontConfig;
66
+ palette?: TrebiredFrontendPaletteConfig;
19
67
  prefix?: string;
20
68
  icons?: {
21
69
  endpoint?: string;
22
70
  packs?: readonly TrebiredFrontendIconPack[];
23
71
  };
72
+ scales?: TrebiredFrontendScalesConfig;
24
73
  systems?: Partial<Record<TrebiredFrontendSystemKey, boolean>>;
25
74
  theme?: TrebiredFrontendThemeConfig;
26
75
  };
@@ -38,12 +87,58 @@ type NormalizedTrebiredFrontendThemeConfig = {
38
87
  modes: NormalizedTrebiredFrontendThemeMode[];
39
88
  tokens: TrebiredFrontendThemeTokens;
40
89
  };
90
+ type NormalizedTrebiredFrontendPaletteMode = {
91
+ key: string;
92
+ scale: TrebiredFrontendPaletteFamilies;
93
+ };
94
+ type NormalizedTrebiredFrontendPaletteSemantic = {
95
+ family: string;
96
+ name: string;
97
+ step: string;
98
+ };
99
+ type NormalizedTrebiredFrontendPaletteConfig = {
100
+ modes: NormalizedTrebiredFrontendPaletteMode[];
101
+ semantic: NormalizedTrebiredFrontendPaletteSemantic[];
102
+ suffixedVariants: boolean;
103
+ };
104
+ type NormalizedTrebiredFrontendZIndexScaleConfig = {
105
+ confetti: string;
106
+ layerRoot: string;
107
+ progress: string;
108
+ steps: TrebiredFrontendScaleSteps;
109
+ };
110
+ type NormalizedTrebiredFrontendScalesConfig = {
111
+ height: TrebiredFrontendScaleSteps;
112
+ lineHeight: TrebiredFrontendScaleSteps;
113
+ padding: TrebiredFrontendScaleSteps;
114
+ radius: TrebiredFrontendScaleSteps;
115
+ spacing: TrebiredFrontendScaleSteps;
116
+ textSize: TrebiredFrontendScaleSteps;
117
+ width: TrebiredFrontendScaleSteps;
118
+ zIndex: NormalizedTrebiredFrontendZIndexScaleConfig;
119
+ };
120
+ type NormalizedTrebiredFrontendFontFamilyConfig = {
121
+ display: TrebiredFrontendFontDisplay;
122
+ family: string;
123
+ key: string;
124
+ packageName: string;
125
+ styles: TrebiredFrontendFontStyle[];
126
+ subsets: string[];
127
+ weights: number[];
128
+ };
129
+ type NormalizedTrebiredFrontendFontConfig = {
130
+ families: NormalizedTrebiredFrontendFontFamilyConfig[];
131
+ sans: string;
132
+ };
41
133
  type NormalizedTrebiredFrontendConfig = {
134
+ fonts: NormalizedTrebiredFrontendFontConfig;
135
+ palette: NormalizedTrebiredFrontendPaletteConfig;
42
136
  prefix: string;
43
137
  icons: {
44
138
  endpoint: string;
45
139
  packs: TrebiredFrontendIconPack[];
46
140
  };
141
+ scales: NormalizedTrebiredFrontendScalesConfig;
47
142
  systems: Record<TrebiredFrontendSystemKey, boolean>;
48
143
  theme: NormalizedTrebiredFrontendThemeConfig;
49
144
  };
@@ -58,5 +153,5 @@ type LoadTrebiredFrontendConfigOptions = {
58
153
  defaultIfMissing?: boolean;
59
154
  searchFrom?: string;
60
155
  };
61
- export type { LoadTrebiredFrontendConfigOptions, LoadedTrebiredFrontendConfig, NormalizedTrebiredFrontendConfig, NormalizedTrebiredFrontendThemeConfig, NormalizedTrebiredFrontendThemeMode, TrebiredFrontendConfig, TrebiredFrontendIconPack, TrebiredFrontendSystemKey, TrebiredFrontendThemeConfig, TrebiredFrontendThemeMode, TrebiredFrontendThemeModeScheme, TrebiredFrontendThemeTokens, };
156
+ export type { LoadTrebiredFrontendConfigOptions, LoadedTrebiredFrontendConfig, NormalizedTrebiredFrontendConfig, NormalizedTrebiredFrontendFontConfig, NormalizedTrebiredFrontendFontFamilyConfig, NormalizedTrebiredFrontendPaletteConfig, NormalizedTrebiredFrontendPaletteMode, NormalizedTrebiredFrontendPaletteSemantic, NormalizedTrebiredFrontendScalesConfig, NormalizedTrebiredFrontendThemeConfig, NormalizedTrebiredFrontendThemeMode, NormalizedTrebiredFrontendZIndexScaleConfig, TrebiredFrontendConfig, TrebiredFrontendFontConfig, TrebiredFrontendFontDisplay, TrebiredFrontendFontFamilyConfig, TrebiredFrontendFontStyle, TrebiredFrontendIconPack, TrebiredFrontendPaletteConfig, TrebiredFrontendPaletteFamilies, TrebiredFrontendPaletteMode, TrebiredFrontendPaletteScale, TrebiredFrontendPaletteSemanticRef, TrebiredFrontendScaleSteps, TrebiredFrontendScalesConfig, TrebiredFrontendSystemKey, TrebiredFrontendThemeConfig, TrebiredFrontendThemeMode, TrebiredFrontendThemeModeScheme, TrebiredFrontendThemeTokens, TrebiredFrontendZIndexScaleConfig, };
62
157
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,GAAG,WAAW,GAAG,cAAc,CAAC;AAE7D,KAAK,yBAAyB,GAC1B,SAAS,GACT,OAAO,GACP,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,OAAO,GACP,OAAO,GACP,SAAS,GACT,UAAU,GACV,OAAO,GACP,SAAS,CAAC;AAEd,KAAK,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,O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AiC,EACjC,4BAA4B,EAC5B,gCAAgC,EAChC,oCAAoC,EACpC,0CAA0C,EAC1C,uCAAuC,EACvC,qCAAqC,EACrC,yCAAyC,EACzC,sCAAsC,EACtC,qCAAqC,EACrC,mCAAmC,EACnC,2CAA2C,EAC3C,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EAClC,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,iCAAiC,GAClC,CAAC"}
@@ -1,6 +1,24 @@
1
- import type { ConfirmOptions, PromptOptions } from "./types.js";
1
+ import type { ConfirmationAttrsInput, ConfirmModel, ConfirmOptions, PromptOptions } from "./types.js";
2
2
  declare function confirm(message: unknown, description?: string, options?: ConfirmOptions): Promise<boolean>;
3
3
  declare function prompt(message: unknown, description?: string, options?: PromptOptions): Promise<any>;
4
4
  declare function confirmElement(source: Element | null, fallbackSource?: Element | null): Promise<boolean>;
5
- export { confirm, confirmElement, prompt };
5
+ declare function buildConfirmModel(message: unknown, description?: unknown, options?: ConfirmOptions): ConfirmModel;
6
+ declare function confirmationVariantAttrs(input: ConfirmationAttrsInput): Record<string, string>;
7
+ declare function hasElementConfirmRequest(source: Element | null | undefined): boolean;
8
+ declare function readElementConfirmRequest(source: Element | null | undefined): {
9
+ description: string;
10
+ options: {
11
+ confirmationText: string;
12
+ mode: "text" | "classic";
13
+ subject: string;
14
+ target: string;
15
+ variant: string;
16
+ };
17
+ title: string;
18
+ } | {
19
+ description: string;
20
+ options: ConfirmOptions;
21
+ title: string;
22
+ };
23
+ export { buildConfirmModel, confirm, confirmationVariantAttrs, confirmElement, hasElementConfirmRequest, prompt, readElementConfirmRequest, };
6
24
  //# sourceMappingURL=dialogs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../../src/flash/dialogs.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgBhE,iBAAS,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAK,EAAE,OAAO,GAAE,cAAmB,oBAqBhF;AAgCD,iBAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAK,EAAE,OAAO,GAAE,aAAkB,gBAc9E;AAkDD,iBAAS,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,cAAc,GAAE,OAAO,GAAG,IAAW,oBAWpF;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../../src/flash/dialogs.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,sBAAsB,EACtB,YAAY,EACZ,cAAc,EAGd,aAAa,EACd,MAAM,YAAY,CAAC;AAgBpB,iBAAS,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAK,EAAE,OAAO,GAAE,cAAmB,oBAyBhF;AAgCD,iBAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAK,EAAE,OAAO,GAAE,aAAkB,gBAiB9E;AAkDD,iBAAS,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,cAAc,GAAE,OAAO,GAAG,IAAW,oBAKpF;AAED,iBAAS,iBAAiB,CACxB,OAAO,EAAE,OAAO,EAChB,WAAW,GAAE,OAAY,EACzB,OAAO,GAAE,cAAmB,GAC3B,YAAY,CAkBd;AAED,iBAAS,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,0BAe9D;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,WAanE;AAED,iBAAS,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;EAYpE;AA+GD,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,wBAAwB,EACxB,cAAc,EACd,wBAAwB,EACxB,MAAM,EACN,yBAAyB,GAC1B,CAAC"}
@@ -15,13 +15,16 @@ function confirm(message, description = "", options = {}) {
15
15
  if (!stack)
16
16
  return Promise.resolve(false);
17
17
  return new Promise((resolve) => {
18
- const controls = createDialogFlash(normalizeFlashType(options.type || "warn"), message, description);
18
+ const model = buildConfirmModel(message, description, options);
19
+ const controls = createDialogFlash(model.type, model.title, model.description, {
20
+ progressTone: model.progressTone,
21
+ });
19
22
  const body = controls.element.querySelector(".tbf-flash__body");
20
23
  const actions = document.createElement("div");
21
24
  actions.className = "tbf-flash__actions";
22
- const cancel = makeButton(options.cancelText || "Cancel", "tbf-button");
23
- const ok = makeButton(options.confirmText || "OK", "tbf-button tbf-button--strong");
24
- const input = createConfirmInput(options, ok);
25
+ const cancel = makeButton(model.cancelText, "tbf-button");
26
+ const ok = makeButton(model.confirmButtonText, "tbf-button tbf-button--strong");
27
+ const input = createConfirmInput(model, ok);
25
28
  if (input)
26
29
  body?.appendChild(input);
27
30
  actions.append(cancel, ok);
@@ -31,6 +34,7 @@ function confirm(message, description = "", options = {}) {
31
34
  const finish = (value) => finishDialog(stack, controls.element, resolve, value, timeoutId);
32
35
  bindConfirmControls(controls.element, finish, cancel, ok, controls.close);
33
36
  timeoutId = window.setTimeout(() => finish(false), FLASH_CONFIRM_TIMEOUT_MS);
37
+ controls.progress.style.animationDuration = `${FLASH_CONFIRM_TIMEOUT_MS}ms`;
34
38
  revealDialog(stack, controls.element, input);
35
39
  });
36
40
  }
@@ -45,7 +49,7 @@ function bindConfirmControls(element, finish, cancel, ok, close) {
45
49
  }
46
50
  function createConfirmInput(options, ok) {
47
51
  const confirmationText = String(options.confirmationText || "").trim();
48
- if (options.mode !== "text" || !confirmationText)
52
+ if (options.confirmMode !== "text" || !confirmationText)
49
53
  return null;
50
54
  ok.disabled = true;
51
55
  const input = document.createElement("input");
@@ -63,7 +67,9 @@ function prompt(message, description = "", options = {}) {
63
67
  if (!stack)
64
68
  return Promise.resolve(null);
65
69
  return new Promise((resolve) => {
66
- const controls = createDialogFlash("info", message, description);
70
+ const controls = createDialogFlash("info", message, description, {
71
+ progressTone: options.progressTone || options.progressType || "blue",
72
+ });
67
73
  const form = createPromptForm(options);
68
74
  controls.element.querySelector(".tbf-flash__body")?.appendChild(form);
69
75
  stack.appendChild(controls.element);
@@ -71,6 +77,7 @@ function prompt(message, description = "", options = {}) {
71
77
  const finish = (value) => finishDialog(stack, controls.element, resolve, value, timeoutId);
72
78
  bindPromptControls(form, controls.close, finish);
73
79
  timeoutId = window.setTimeout(() => finish(null), FLASH_PROMPT_TIMEOUT_MS);
80
+ controls.progress.style.animationDuration = `${FLASH_PROMPT_TIMEOUT_MS}ms`;
74
81
  revealDialog(stack, controls.element, form.querySelector("input"));
75
82
  });
76
83
  }
@@ -113,17 +120,178 @@ function revealDialog(stack, element, focusTarget) {
113
120
  });
114
121
  }
115
122
  function confirmElement(source, fallbackSource = null) {
116
- const target = source?.hasAttribute("data-tbf-confirm-title")
117
- ? source
118
- : fallbackSource || source;
119
- const title = target?.getAttribute("data-tbf-confirm-title") || "";
120
- if (!title)
123
+ const target = hasElementConfirmRequest(source) ? source : fallbackSource;
124
+ if (!hasElementConfirmRequest(target))
121
125
  return Promise.resolve(true);
122
- return confirm(title, target?.getAttribute("data-tbf-confirm-description") || "", {
123
- confirmationText: target?.getAttribute("data-tbf-confirm-text") || "",
124
- mode: target?.getAttribute("data-tbf-confirm-mode") === "text" ? "text" : "classic",
125
- type: normalizeFlashType(target?.getAttribute("data-tbf-confirm-type") || "warn"),
126
- });
126
+ const request = readElementConfirmRequest(target);
127
+ return confirm(request.title, request.description, request.options);
128
+ }
129
+ function buildConfirmModel(message, description = "", options = {}) {
130
+ const opts = options && typeof options === "object" ? options : {};
131
+ const variantModel = buildVariantConfirmModel(opts);
132
+ if (variantModel)
133
+ return variantModel;
134
+ const confirmMode = normalizeConfirmMode(opts.confirmType || opts.confirmMode || opts.mode || "classic");
135
+ const confirmationText = text(opts.confirmationText);
136
+ return {
137
+ cancelText: text(opts.cancelText, "Cancel"),
138
+ confirmButtonText: text(opts.confirmButtonText || opts.confirmText, "OK"),
139
+ confirmMode,
140
+ confirmationText,
141
+ description: text(description),
142
+ isTextConfirm: confirmMode === "text" && Boolean(confirmationText),
143
+ placeholder: text(opts.placeholder, confirmationText),
144
+ progressTone: text(opts.progressTone || opts.progressType),
145
+ title: text(message),
146
+ type: normalizeFlashType(opts.type || "info"),
147
+ };
148
+ }
149
+ function confirmationVariantAttrs(input) {
150
+ const item = input && typeof input === "object" ? input : {};
151
+ const variant = text(item.variant).toLowerCase();
152
+ const attrs = {};
153
+ if (!variant)
154
+ return attrs;
155
+ attrs["data-tbf-confirm-variant"] = variant;
156
+ const mode = text(item.mode).toLowerCase();
157
+ const target = text(item.target);
158
+ const subject = text(item.subject);
159
+ const confirmationText = text(item.confirmationText);
160
+ if (mode)
161
+ attrs["data-tbf-confirm-mode"] = mode;
162
+ if (target)
163
+ attrs["data-tbf-confirm-target"] = target;
164
+ if (subject)
165
+ attrs["data-tbf-confirm-subject"] = subject;
166
+ if (confirmationText)
167
+ attrs["data-tbf-confirm-text"] = confirmationText;
168
+ return attrs;
169
+ }
170
+ function hasElementConfirmRequest(source) {
171
+ const node = elementNode(source);
172
+ if (!node)
173
+ return false;
174
+ return Boolean(attr(node, "data-tbf-confirm-variant") ||
175
+ attr(node, "data-tbf-confirm-title") ||
176
+ attr(node, "data-tbf-confirm-description") ||
177
+ attr(node, "data-tbf-confirm-text") ||
178
+ attr(node, "data-confirmation-variant") ||
179
+ attr(node, "data-confirmation-title") ||
180
+ attr(node, "data-confirmation-description") ||
181
+ attr(node, "data-confirmation-text"));
182
+ }
183
+ function readElementConfirmRequest(source) {
184
+ const node = elementNode(source);
185
+ if (!node) {
186
+ return { description: "", options: {}, title: "" };
187
+ }
188
+ const variant = attr(node, "data-tbf-confirm-variant") || attr(node, "data-confirmation-variant");
189
+ if (variant)
190
+ return variantElementConfirmRequest(node, variant);
191
+ return {
192
+ description: attr(node, "data-tbf-confirm-description") || attr(node, "data-confirmation-description"),
193
+ options: standardElementConfirmOptions(node),
194
+ title: attr(node, "data-tbf-confirm-title") || attr(node, "data-confirmation-title"),
195
+ };
196
+ }
197
+ function buildVariantConfirmModel(options) {
198
+ const variant = normalizeConfirmVariant(options.variant);
199
+ if (!variant)
200
+ return null;
201
+ const subject = text(options.subject, "item");
202
+ const target = text(options.target, subject);
203
+ const confirmMode = normalizeConfirmMode(options.mode || options.confirmType || options.confirmMode || (variant === "delete" ? "text" : "classic"));
204
+ const confirmationText = confirmMode === "text"
205
+ ? text(options.confirmationText, target)
206
+ : "";
207
+ const copy = variantCopy(variant, subject, target);
208
+ return {
209
+ cancelText: text(options.cancelText, "Cancel"),
210
+ confirmButtonText: text(options.confirmButtonText || options.confirmText, copy.button),
211
+ confirmMode,
212
+ confirmationText,
213
+ description: copy.description,
214
+ isTextConfirm: confirmMode === "text" && Boolean(confirmationText),
215
+ placeholder: text(options.placeholder, confirmationText),
216
+ progressTone: text(options.progressTone || options.progressType),
217
+ title: copy.title,
218
+ type: copy.type,
219
+ };
220
+ }
221
+ function variantElementConfirmRequest(node, variant) {
222
+ const mode = attr(node, "data-tbf-confirm-mode") || attr(node, "data-confirmation-mode");
223
+ return {
224
+ description: "",
225
+ options: {
226
+ confirmationText: attr(node, "data-tbf-confirm-text") || attr(node, "data-confirmation-text") || undefined,
227
+ mode: mode ? normalizeConfirmMode(mode) : undefined,
228
+ subject: attr(node, "data-tbf-confirm-subject") || attr(node, "data-confirmation-subject") || undefined,
229
+ target: attr(node, "data-tbf-confirm-target") || attr(node, "data-confirmation-target") || undefined,
230
+ variant,
231
+ },
232
+ title: "",
233
+ };
234
+ }
235
+ function standardElementConfirmOptions(node) {
236
+ const mode = attr(node, "data-tbf-confirm-mode") || attr(node, "data-confirmation-mode");
237
+ return {
238
+ cancelText: attr(node, "data-tbf-confirm-cancel-text") || attr(node, "data-confirmation-cancel-text") || undefined,
239
+ confirmButtonText: attr(node, "data-tbf-confirm-confirm-text") ||
240
+ attr(node, "data-confirmation-confirm-text") ||
241
+ undefined,
242
+ confirmationText: attr(node, "data-tbf-confirm-text") || attr(node, "data-confirmation-text") || undefined,
243
+ mode: mode ? normalizeConfirmMode(mode) : undefined,
244
+ placeholder: attr(node, "data-tbf-confirm-placeholder") ||
245
+ attr(node, "data-confirmation-placeholder") ||
246
+ undefined,
247
+ progressTone: attr(node, "data-tbf-confirm-progress-tone") ||
248
+ attr(node, "data-confirmation-progress-tone") ||
249
+ undefined,
250
+ type: normalizeFlashType(attr(node, "data-tbf-confirm-type") || "warn"),
251
+ };
252
+ }
253
+ function variantCopy(variant, subject, target) {
254
+ if (variant === "delete") {
255
+ return {
256
+ button: "Delete",
257
+ description: `This will permanently delete ${subject}.`,
258
+ title: `Delete ${target}?`,
259
+ type: "error",
260
+ };
261
+ }
262
+ if (variant === "drop") {
263
+ return {
264
+ button: "Drop",
265
+ description: `This will permanently drop ${subject}.`,
266
+ title: `Drop ${target}?`,
267
+ type: "error",
268
+ };
269
+ }
270
+ return {
271
+ button: "Archive",
272
+ description: `This will archive ${subject}.`,
273
+ title: `Archive ${target}?`,
274
+ type: "warn",
275
+ };
276
+ }
277
+ function normalizeConfirmVariant(value) {
278
+ const variant = text(value).toLowerCase();
279
+ return variant === "archive" || variant === "delete" || variant === "drop"
280
+ ? variant
281
+ : null;
282
+ }
283
+ function normalizeConfirmMode(value) {
284
+ return text(value).toLowerCase() === "text" ? "text" : "classic";
285
+ }
286
+ function elementNode(source) {
287
+ return source && typeof source.getAttribute === "function" ? source : null;
288
+ }
289
+ function attr(node, name) {
290
+ return text(node.getAttribute(name));
291
+ }
292
+ function text(value, fallback = "") {
293
+ const out = String(value ?? "").trim();
294
+ return out || fallback;
127
295
  }
128
- export { confirm, confirmElement, prompt };
296
+ export { buildConfirmModel, confirm, confirmationVariantAttrs, confirmElement, hasElementConfirmRequest, prompt, readElementConfirmRequest, };
129
297
  //# sourceMappingURL=dialogs.js.map