@universityofmaryland/web-model-library 1.0.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 (252) hide show
  1. package/README.md +138 -0
  2. package/dist/_types.d.ts +77 -0
  3. package/dist/_types.d.ts.map +1 -0
  4. package/dist/_virtual/___vite-browser-external.js +8 -0
  5. package/dist/_virtual/___vite-browser-external.js.map +1 -0
  6. package/dist/_virtual/___vite-browser-external.mjs +7 -0
  7. package/dist/_virtual/___vite-browser-external.mjs.map +1 -0
  8. package/dist/_virtual/__vite-browser-external.js +4 -0
  9. package/dist/_virtual/__vite-browser-external.js.map +1 -0
  10. package/dist/_virtual/__vite-browser-external.mjs +5 -0
  11. package/dist/_virtual/__vite-browser-external.mjs.map +1 -0
  12. package/dist/_virtual/_commonjsHelpers.js +37 -0
  13. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  14. package/dist/_virtual/_commonjsHelpers.mjs +37 -0
  15. package/dist/_virtual/_commonjsHelpers.mjs.map +1 -0
  16. package/dist/_virtual/index.js +7 -0
  17. package/dist/_virtual/index.js.map +1 -0
  18. package/dist/_virtual/index.mjs +8 -0
  19. package/dist/_virtual/index.mjs.map +1 -0
  20. package/dist/_virtual/picocolors.browser.js +5 -0
  21. package/dist/_virtual/picocolors.browser.js.map +1 -0
  22. package/dist/_virtual/picocolors.browser.mjs +5 -0
  23. package/dist/_virtual/picocolors.browser.mjs.map +1 -0
  24. package/dist/_virtual/postcss.js +7 -0
  25. package/dist/_virtual/postcss.js.map +1 -0
  26. package/dist/_virtual/postcss.mjs +8 -0
  27. package/dist/_virtual/postcss.mjs.map +1 -0
  28. package/dist/_virtual/symbols.js +5 -0
  29. package/dist/_virtual/symbols.js.map +1 -0
  30. package/dist/_virtual/symbols.mjs +5 -0
  31. package/dist/_virtual/symbols.mjs.map +1 -0
  32. package/dist/attributes/checks.d.ts +133 -0
  33. package/dist/attributes/checks.d.ts.map +1 -0
  34. package/dist/attributes/checks.js +757 -0
  35. package/dist/attributes/checks.js.map +1 -0
  36. package/dist/attributes/checks.mjs +740 -0
  37. package/dist/attributes/checks.mjs.map +1 -0
  38. package/dist/attributes/handler.d.ts +52 -0
  39. package/dist/attributes/handler.d.ts.map +1 -0
  40. package/dist/attributes/handler.js +205 -0
  41. package/dist/attributes/handler.js.map +1 -0
  42. package/dist/attributes/handler.mjs +206 -0
  43. package/dist/attributes/handler.mjs.map +1 -0
  44. package/dist/attributes/index.d.ts +7 -0
  45. package/dist/attributes/index.d.ts.map +1 -0
  46. package/dist/attributes/names.d.ts +132 -0
  47. package/dist/attributes/names.d.ts.map +1 -0
  48. package/dist/attributes/names.js +145 -0
  49. package/dist/attributes/names.js.map +1 -0
  50. package/dist/attributes/names.mjs +146 -0
  51. package/dist/attributes/names.mjs.map +1 -0
  52. package/dist/attributes/values.d.ts +70 -0
  53. package/dist/attributes/values.d.ts.map +1 -0
  54. package/dist/attributes/values.js +80 -0
  55. package/dist/attributes/values.js.map +1 -0
  56. package/dist/attributes/values.mjs +81 -0
  57. package/dist/attributes/values.mjs.map +1 -0
  58. package/dist/attributes.d.ts +2 -0
  59. package/dist/attributes.js +23 -0
  60. package/dist/attributes.js.map +1 -0
  61. package/dist/attributes.mjs +23 -0
  62. package/dist/attributes.mjs.map +1 -0
  63. package/dist/index.d.ts +10 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +13 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/index.mjs +13 -0
  68. package/dist/index.mjs.map +1 -0
  69. package/dist/model/index.d.ts +43 -0
  70. package/dist/model/index.d.ts.map +1 -0
  71. package/dist/model.d.ts +2 -0
  72. package/dist/model.js +259 -0
  73. package/dist/model.js.map +1 -0
  74. package/dist/model.mjs +259 -0
  75. package/dist/model.mjs.map +1 -0
  76. package/dist/node_modules/nanoid/non-secure/index.js +31 -0
  77. package/dist/node_modules/nanoid/non-secure/index.js.map +1 -0
  78. package/dist/node_modules/nanoid/non-secure/index.mjs +31 -0
  79. package/dist/node_modules/nanoid/non-secure/index.mjs.map +1 -0
  80. package/dist/node_modules/picocolors/picocolors.browser.js +17 -0
  81. package/dist/node_modules/picocolors/picocolors.browser.js.map +1 -0
  82. package/dist/node_modules/picocolors/picocolors.browser.mjs +17 -0
  83. package/dist/node_modules/picocolors/picocolors.browser.mjs.map +1 -0
  84. package/dist/node_modules/postcss/lib/at-rule.js +30 -0
  85. package/dist/node_modules/postcss/lib/at-rule.js.map +1 -0
  86. package/dist/node_modules/postcss/lib/at-rule.mjs +30 -0
  87. package/dist/node_modules/postcss/lib/at-rule.mjs.map +1 -0
  88. package/dist/node_modules/postcss/lib/comment.js +21 -0
  89. package/dist/node_modules/postcss/lib/comment.js.map +1 -0
  90. package/dist/node_modules/postcss/lib/comment.mjs +21 -0
  91. package/dist/node_modules/postcss/lib/comment.mjs.map +1 -0
  92. package/dist/node_modules/postcss/lib/container.js +383 -0
  93. package/dist/node_modules/postcss/lib/container.js.map +1 -0
  94. package/dist/node_modules/postcss/lib/container.mjs +383 -0
  95. package/dist/node_modules/postcss/lib/container.mjs.map +1 -0
  96. package/dist/node_modules/postcss/lib/css-syntax-error.js +92 -0
  97. package/dist/node_modules/postcss/lib/css-syntax-error.js.map +1 -0
  98. package/dist/node_modules/postcss/lib/css-syntax-error.mjs +92 -0
  99. package/dist/node_modules/postcss/lib/css-syntax-error.mjs.map +1 -0
  100. package/dist/node_modules/postcss/lib/declaration.js +27 -0
  101. package/dist/node_modules/postcss/lib/declaration.js.map +1 -0
  102. package/dist/node_modules/postcss/lib/declaration.mjs +27 -0
  103. package/dist/node_modules/postcss/lib/declaration.mjs.map +1 -0
  104. package/dist/node_modules/postcss/lib/document.js +34 -0
  105. package/dist/node_modules/postcss/lib/document.js.map +1 -0
  106. package/dist/node_modules/postcss/lib/document.mjs +34 -0
  107. package/dist/node_modules/postcss/lib/document.mjs.map +1 -0
  108. package/dist/node_modules/postcss/lib/fromJSON.js +67 -0
  109. package/dist/node_modules/postcss/lib/fromJSON.js.map +1 -0
  110. package/dist/node_modules/postcss/lib/fromJSON.mjs +67 -0
  111. package/dist/node_modules/postcss/lib/fromJSON.mjs.map +1 -0
  112. package/dist/node_modules/postcss/lib/input.js +216 -0
  113. package/dist/node_modules/postcss/lib/input.js.map +1 -0
  114. package/dist/node_modules/postcss/lib/input.mjs +216 -0
  115. package/dist/node_modules/postcss/lib/input.mjs.map +1 -0
  116. package/dist/node_modules/postcss/lib/lazy-result.js +467 -0
  117. package/dist/node_modules/postcss/lib/lazy-result.js.map +1 -0
  118. package/dist/node_modules/postcss/lib/lazy-result.mjs +467 -0
  119. package/dist/node_modules/postcss/lib/lazy-result.mjs.map +1 -0
  120. package/dist/node_modules/postcss/lib/list.js +60 -0
  121. package/dist/node_modules/postcss/lib/list.js.map +1 -0
  122. package/dist/node_modules/postcss/lib/list.mjs +60 -0
  123. package/dist/node_modules/postcss/lib/list.mjs.map +1 -0
  124. package/dist/node_modules/postcss/lib/map-generator.js +314 -0
  125. package/dist/node_modules/postcss/lib/map-generator.js.map +1 -0
  126. package/dist/node_modules/postcss/lib/map-generator.mjs +314 -0
  127. package/dist/node_modules/postcss/lib/map-generator.mjs.map +1 -0
  128. package/dist/node_modules/postcss/lib/no-work-result.js +113 -0
  129. package/dist/node_modules/postcss/lib/no-work-result.js.map +1 -0
  130. package/dist/node_modules/postcss/lib/no-work-result.mjs +113 -0
  131. package/dist/node_modules/postcss/lib/no-work-result.mjs.map +1 -0
  132. package/dist/node_modules/postcss/lib/node.js +335 -0
  133. package/dist/node_modules/postcss/lib/node.js.map +1 -0
  134. package/dist/node_modules/postcss/lib/node.mjs +335 -0
  135. package/dist/node_modules/postcss/lib/node.mjs.map +1 -0
  136. package/dist/node_modules/postcss/lib/parse.js +30 -0
  137. package/dist/node_modules/postcss/lib/parse.js.map +1 -0
  138. package/dist/node_modules/postcss/lib/parse.mjs +30 -0
  139. package/dist/node_modules/postcss/lib/parse.mjs.map +1 -0
  140. package/dist/node_modules/postcss/lib/parser.js +543 -0
  141. package/dist/node_modules/postcss/lib/parser.js.map +1 -0
  142. package/dist/node_modules/postcss/lib/parser.mjs +543 -0
  143. package/dist/node_modules/postcss/lib/parser.mjs.map +1 -0
  144. package/dist/node_modules/postcss/lib/postcss.js +28 -0
  145. package/dist/node_modules/postcss/lib/postcss.js.map +1 -0
  146. package/dist/node_modules/postcss/lib/postcss.mjs +29 -0
  147. package/dist/node_modules/postcss/lib/postcss.mjs.map +1 -0
  148. package/dist/node_modules/postcss/lib/postcss2.js +110 -0
  149. package/dist/node_modules/postcss/lib/postcss2.js.map +1 -0
  150. package/dist/node_modules/postcss/lib/postcss2.mjs +110 -0
  151. package/dist/node_modules/postcss/lib/postcss2.mjs.map +1 -0
  152. package/dist/node_modules/postcss/lib/previous-map.js +123 -0
  153. package/dist/node_modules/postcss/lib/previous-map.js.map +1 -0
  154. package/dist/node_modules/postcss/lib/previous-map.mjs +123 -0
  155. package/dist/node_modules/postcss/lib/previous-map.mjs.map +1 -0
  156. package/dist/node_modules/postcss/lib/processor.js +61 -0
  157. package/dist/node_modules/postcss/lib/processor.js.map +1 -0
  158. package/dist/node_modules/postcss/lib/processor.mjs +61 -0
  159. package/dist/node_modules/postcss/lib/processor.mjs.map +1 -0
  160. package/dist/node_modules/postcss/lib/result.js +44 -0
  161. package/dist/node_modules/postcss/lib/result.js.map +1 -0
  162. package/dist/node_modules/postcss/lib/result.mjs +44 -0
  163. package/dist/node_modules/postcss/lib/result.mjs.map +1 -0
  164. package/dist/node_modules/postcss/lib/root.js +58 -0
  165. package/dist/node_modules/postcss/lib/root.js.map +1 -0
  166. package/dist/node_modules/postcss/lib/root.mjs +58 -0
  167. package/dist/node_modules/postcss/lib/root.mjs.map +1 -0
  168. package/dist/node_modules/postcss/lib/rule.js +33 -0
  169. package/dist/node_modules/postcss/lib/rule.js.map +1 -0
  170. package/dist/node_modules/postcss/lib/rule.mjs +33 -0
  171. package/dist/node_modules/postcss/lib/rule.mjs.map +1 -0
  172. package/dist/node_modules/postcss/lib/stringifier.js +308 -0
  173. package/dist/node_modules/postcss/lib/stringifier.js.map +1 -0
  174. package/dist/node_modules/postcss/lib/stringifier.mjs +308 -0
  175. package/dist/node_modules/postcss/lib/stringifier.mjs.map +1 -0
  176. package/dist/node_modules/postcss/lib/stringify.js +19 -0
  177. package/dist/node_modules/postcss/lib/stringify.js.map +1 -0
  178. package/dist/node_modules/postcss/lib/stringify.mjs +19 -0
  179. package/dist/node_modules/postcss/lib/stringify.mjs.map +1 -0
  180. package/dist/node_modules/postcss/lib/symbols.js +13 -0
  181. package/dist/node_modules/postcss/lib/symbols.js.map +1 -0
  182. package/dist/node_modules/postcss/lib/symbols.mjs +13 -0
  183. package/dist/node_modules/postcss/lib/symbols.mjs.map +1 -0
  184. package/dist/node_modules/postcss/lib/tokenize.js +219 -0
  185. package/dist/node_modules/postcss/lib/tokenize.js.map +1 -0
  186. package/dist/node_modules/postcss/lib/tokenize.mjs +219 -0
  187. package/dist/node_modules/postcss/lib/tokenize.mjs.map +1 -0
  188. package/dist/node_modules/postcss/lib/warning.js +40 -0
  189. package/dist/node_modules/postcss/lib/warning.js.map +1 -0
  190. package/dist/node_modules/postcss/lib/warning.mjs +40 -0
  191. package/dist/node_modules/postcss/lib/warning.mjs.map +1 -0
  192. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js +130 -0
  193. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js.map +1 -0
  194. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.mjs +130 -0
  195. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.mjs.map +1 -0
  196. package/dist/slots/create.d.ts +15 -0
  197. package/dist/slots/create.d.ts.map +1 -0
  198. package/dist/slots/create.js +50 -0
  199. package/dist/slots/create.js.map +1 -0
  200. package/dist/slots/create.mjs +50 -0
  201. package/dist/slots/create.mjs.map +1 -0
  202. package/dist/slots/element.d.ts +3 -0
  203. package/dist/slots/element.d.ts.map +1 -0
  204. package/dist/slots/element.js +42 -0
  205. package/dist/slots/element.js.map +1 -0
  206. package/dist/slots/element.mjs +42 -0
  207. package/dist/slots/element.mjs.map +1 -0
  208. package/dist/slots/extract.d.ts +6 -0
  209. package/dist/slots/extract.d.ts.map +1 -0
  210. package/dist/slots/index.d.ts +140 -0
  211. package/dist/slots/index.d.ts.map +1 -0
  212. package/dist/slots/mapping.d.ts +82 -0
  213. package/dist/slots/mapping.d.ts.map +1 -0
  214. package/dist/slots/mapping.js +97 -0
  215. package/dist/slots/mapping.js.map +1 -0
  216. package/dist/slots/mapping.mjs +97 -0
  217. package/dist/slots/mapping.mjs.map +1 -0
  218. package/dist/slots/query.d.ts +9 -0
  219. package/dist/slots/query.d.ts.map +1 -0
  220. package/dist/slots/validate.d.ts +22 -0
  221. package/dist/slots/validate.d.ts.map +1 -0
  222. package/dist/slots.d.ts +6 -0
  223. package/dist/slots.js +73 -0
  224. package/dist/slots.js.map +1 -0
  225. package/dist/slots.mjs +74 -0
  226. package/dist/slots.mjs.map +1 -0
  227. package/dist/utilities/index.d.ts +4 -0
  228. package/dist/utilities/index.d.ts.map +1 -0
  229. package/dist/utilities/lifecycle.d.ts +12 -0
  230. package/dist/utilities/lifecycle.d.ts.map +1 -0
  231. package/dist/utilities/lifecycle.js +21 -0
  232. package/dist/utilities/lifecycle.js.map +1 -0
  233. package/dist/utilities/lifecycle.mjs +21 -0
  234. package/dist/utilities/lifecycle.mjs.map +1 -0
  235. package/dist/utilities/register.d.ts +17 -0
  236. package/dist/utilities/register.d.ts.map +1 -0
  237. package/dist/utilities/register.js +32 -0
  238. package/dist/utilities/register.js.map +1 -0
  239. package/dist/utilities/register.mjs +32 -0
  240. package/dist/utilities/register.mjs.map +1 -0
  241. package/dist/utilities/styles.d.ts +5 -0
  242. package/dist/utilities/styles.d.ts.map +1 -0
  243. package/dist/utilities/styles.js +79 -0
  244. package/dist/utilities/styles.js.map +1 -0
  245. package/dist/utilities/styles.mjs +80 -0
  246. package/dist/utilities/styles.mjs.map +1 -0
  247. package/dist/utilities.d.ts +2 -0
  248. package/dist/utilities.js +11 -0
  249. package/dist/utilities.js.map +1 -0
  250. package/dist/utilities.mjs +11 -0
  251. package/dist/utilities.mjs.map +1 -0
  252. package/package.json +69 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.mjs","sources":["../../source/attributes/checks.ts"],"sourcesContent":["/**\n * Attribute Check Utilities\n *\n * Provides a comprehensive set of functions to check attribute states on HTML elements.\n * These utilities form the foundation of the component attribute system.\n *\n * ## Function Categories:\n *\n * 1. **isTheme**: Theme-related checks (dark, light, gold, maryland)\n * 2. **isVisual**: Visual state checks (aligned, bordered, transparent, etc.)\n * 3. **isDisplay**: Display mode checks (feature, list, promo, etc.)\n * 4. **isLayout**: Layout configuration checks (fixed, hidden, position)\n * 5. **isInfo**: Content type checks (admissions, events, news, etc.)\n * 6. **includesFeature**: Feature flag checks (animation, lazyLoad, etc.)\n * 7. **getValue**: Attribute value getters (url, title, styleProps)\n *\n * ## Naming Convention:\n * - `is*` functions return boolean values\n * - `includes*` functions check for feature presence\n * - `getValue*` functions return string values\n *\n * ## Deprecation Handling:\n * Many functions handle both current (data-*) and deprecated attribute names,\n * logging warnings when deprecated attributes are used.\n */\nimport * as Styles from '@universityofmaryland/web-styles-library';\nimport AttributeNames from './names';\nimport AttributesValues from './values';\n\n// Types\n/**\n * Properties for attribute checking functions\n */\ninterface AttributeElementProps {\n /** The HTML element to check attributes on */\n element: HTMLElement;\n /** Default value to return if attribute is not found */\n defaultValue?: boolean;\n}\n\ninterface AttributeProps extends AttributeElementProps {\n attributeName: string;\n attributeValue: string;\n}\n\ntype AttributeNullProps = Omit<AttributeProps, 'attributeValue'>;\n\ninterface DeprecatedAttributeProps extends AttributeElementProps {\n attributeNameOld: string;\n attributeNameNew: string;\n attributeValue: string;\n}\n\ninterface ValueGetterConfig {\n currentName: string;\n deprecatedName?: string;\n}\n\n// Core attribute check utilities\n\n/**\n * Checks if an attribute equals a specific value.\n * Returns defaultValue if attribute is not present.\n * Special handling: 'false' string always returns false.\n *\n * @internal\n */\nconst isAttributeTrue = ({\n element,\n attributeName,\n attributeValue,\n defaultValue = false,\n}: AttributeProps): boolean => {\n const value = element.getAttribute(attributeName);\n\n if (value === null) {\n return defaultValue;\n }\n\n if (value === 'false') {\n return false;\n }\n\n return value === attributeValue;\n};\n\nconst isAttributeNotNull = ({\n element,\n attributeName,\n}: AttributeNullProps): boolean => {\n const value = element.getAttribute(attributeName);\n\n if (value === 'true') return true;\n if (value === 'false') return false;\n\n return value !== null;\n};\n\nconst depcreationWarning = ({\n element,\n attributeNameOld,\n attributeNameNew,\n}: {\n element: HTMLElement;\n attributeNameOld: string;\n attributeNameNew: string;\n}) => {\n console.warn(\n `UMD Web Component: ${element.nodeName} - Attribute \"${attributeNameOld}\" is deprecated. ` +\n `Use \"${attributeNameNew}\" instead. This attribute will be removed in version 2.0.`,\n );\n};\n\nconst checkDeprecatedAttribute = (props: DeprecatedAttributeProps): boolean => {\n const {\n element,\n attributeNameOld,\n attributeNameNew,\n attributeValue,\n ...rest\n } = props;\n const isDeprecatedUsed = isAttributeTrue({\n ...rest,\n element,\n attributeName: attributeNameOld,\n attributeValue,\n });\n\n if (isDeprecatedUsed) {\n depcreationWarning(props);\n return true;\n }\n\n return false;\n};\n\nconst createAttributeCheck =\n (attributeName: string, attributeValue: string, defaultValue = false) =>\n (props: AttributeElementProps): boolean =>\n isAttributeTrue({\n ...props,\n attributeName,\n attributeValue,\n defaultValue,\n });\n\nconst createValueGetter = ({\n currentName,\n deprecatedName,\n}: ValueGetterConfig) => {\n return ({ element }: AttributeElementProps): string | null => {\n if (deprecatedName) {\n const deprecatedValue = element.getAttribute(deprecatedName);\n if (deprecatedValue !== null) {\n depcreationWarning({\n element,\n attributeNameOld: deprecatedName,\n attributeNameNew: currentName,\n });\n\n return deprecatedValue;\n }\n }\n\n const value = element.getAttribute(currentName);\n if (value !== null) {\n return value;\n }\n\n return null;\n };\n};\n\n// Value checks with null checks\nconst hasInfo = {\n gifts: (props: AttributeElementProps) =>\n isAttributeNotNull({\n ...props,\n attributeName: AttributeNames.information.gift,\n }),\n search: (props: AttributeElementProps) =>\n isAttributeNotNull({\n ...props,\n attributeName: AttributeNames.information.search,\n }),\n};\n\n// Decoration checks\nconst hasDecoration = {\n line: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.option.OPTIONAL_HAS_LINE,\n attributeNameNew: AttributeNames.decoration.line,\n attributeValue: '',\n }) ||\n isAttributeNotNull({\n ...props,\n attributeName: AttributeNames.decoration.line,\n }),\n};\n\n// Feature checks\nconst includesFeature = {\n animation: createAttributeCheck(\n AttributeNames.feature.animation,\n AttributesValues.state.TRUE,\n true,\n ),\n imageExpand: createAttributeCheck(\n AttributeNames.feature.imageExpand,\n AttributesValues.state.TRUE,\n true,\n ),\n fullScreenOption: createAttributeCheck(\n AttributeNames.deprecated.feature.FULLSCREEN,\n AttributesValues.state.TRUE,\n true,\n ),\n visualTime: createAttributeCheck(\n AttributeNames.deprecated.feature.SHOW_TIME,\n AttributesValues.state.TRUE,\n true,\n ),\n lazyLoad: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.feed.FEED_LAZY_LOAD,\n attributeNameNew: AttributeNames.feature.lazyLoad,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.feature.lazyLoad,\n attributeValue: AttributesValues.state.TRUE,\n }),\n} as const;\n\n// Data checks\nconst isData = {\n type: {\n academic: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.feed.type,\n attributeValue: AttributesValues.data.type.academic,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.feed.type,\n attributeValue: AttributesValues.data.type.academic,\n }),\n },\n union: createAttributeCheck(\n AttributeNames.deprecated.feed.FEED_UNION,\n AttributesValues.state.FALSE,\n true,\n ),\n} as const;\n\n// Display checks\nconst isDisplay = {\n block: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.display.DISPLAY_TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.block,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.block,\n }),\n feature: createAttributeCheck(\n AttributeNames.deprecated.display.DISPLAY,\n AttributesValues.display.feature,\n ),\n featured: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.featured,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.featured,\n }),\n hero: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.hero,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.hero,\n }),\n list: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.display.DISPLAY,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.list,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.list,\n }),\n outline: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.type.OUTLINE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.type.OUTLINE,\n }),\n overlay: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.overlay,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.overlay,\n }),\n promo: createAttributeCheck(\n AttributeNames.deprecated.display.DISPLAY,\n AttributesValues.display.promo,\n ),\n primary: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.type.PRIMARY,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.type.PRIMARY,\n }),\n secondary: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.type.SECONDARY,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.type.SECONDARY,\n }),\n short: createAttributeCheck(\n AttributeNames.display.default,\n AttributesValues.display.short,\n ),\n standardCentered: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.layout.defaultCentered,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.deprecated.type.TYPE,\n attributeValue: AttributesValues.layout.defaultCentered,\n }),\n standardInterior: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.layout.defaultInterior,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.deprecated.type.TYPE,\n attributeValue: AttributesValues.layout.defaultInterior,\n }),\n standardInteriorCentered: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.layout.defaultInteriorCentered,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.deprecated.type.TYPE,\n attributeValue: AttributesValues.layout.defaultInteriorCentered,\n }),\n statement: createAttributeCheck(\n AttributeNames.deprecated.display.DISPLAY,\n AttributesValues.display.statement,\n ),\n sticky: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.sticky,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.sticky,\n }),\n stacked: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.stacked,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.stacked,\n }),\n stackedInteriorDeprecated: createAttributeCheck(\n AttributeNames.deprecated.type.TYPE,\n AttributesValues.layout.stackedInterior,\n ),\n stackedInterior: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.layout.stackedInterior,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.layout.stackedInterior,\n }),\n tabular: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.display.DISPLAY,\n attributeNameNew: AttributeNames.display.default,\n attributeValue: AttributesValues.display.tabular,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.display.default,\n attributeValue: AttributesValues.display.tabular,\n }),\n} as const;\n\n// Information checks\nconst isInfo = {\n admissions: createAttributeCheck(\n AttributeNames.information.admissions,\n AttributesValues.state.TRUE,\n ),\n events: createAttributeCheck(\n AttributeNames.information.events,\n AttributesValues.state.TRUE,\n ),\n news: createAttributeCheck(\n AttributeNames.information.news,\n AttributesValues.state.TRUE,\n ),\n schools: createAttributeCheck(\n AttributeNames.information.schools,\n AttributesValues.state.TRUE,\n ),\n searchDomain: createAttributeCheck(\n AttributeNames.information.searchType,\n AttributesValues.search.domain,\n ),\n} as const;\n\n// Layout checks\nconst isLayout = {\n alertOff: createAttributeCheck(\n AttributeNames.layout.alertOff,\n AttributesValues.state.TRUE,\n ),\n alignmentRight: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.layout.LAYOUT_ALIGNMENT,\n attributeNameNew: AttributeNames.layout.alignment,\n attributeValue: AttributesValues.layout.right,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.alignment,\n attributeValue: AttributesValues.layout.right,\n }),\n fixed: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.layout.LAYOUT_FIXED,\n attributeNameNew: AttributeNames.layout.fixed,\n attributeValue: '',\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.fixed,\n attributeValue: AttributesValues.state.TRUE,\n }),\n fullImage: createAttributeCheck(\n AttributeNames.deprecated.type.TYPE,\n AttributesValues.layout.fullImage,\n ),\n heightSmall: (props: AttributeElementProps): boolean =>\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.height,\n attributeValue: AttributesValues.layout.small,\n }),\n hidden: createAttributeCheck(\n AttributeNames.layout.hidden,\n AttributesValues.state.TRUE,\n ),\n image: createAttributeCheck(\n AttributeNames.deprecated.type.TYPE,\n AttributesValues.display.image,\n ),\n imagePositionRight: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.layout.LAYOUT_IMAGE_POSITION,\n attributeNameNew: AttributeNames.layout.imagePosition,\n attributeValue: AttributesValues.layout.right,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.imagePosition,\n attributeValue: AttributesValues.layout.right,\n defaultValue: true,\n }),\n imagePositionLeft: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.layout.LAYOUT_IMAGE_POSITION,\n attributeNameNew: AttributeNames.layout.imagePosition,\n attributeValue: AttributesValues.layout.left,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.imagePosition,\n attributeValue: AttributesValues.layout.left,\n defaultValue: false,\n }),\n imageScaled: (props: AttributeElementProps): boolean =>\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.imageScaled,\n attributeValue: AttributesValues.state.TRUE,\n defaultValue: true,\n }),\n interior: createAttributeCheck(\n AttributeNames.layout.interior,\n AttributesValues.state.TRUE,\n ),\n lock: createAttributeCheck(\n AttributeNames.layout.lock,\n AttributesValues.state.TRUE,\n ),\n lockFull: createAttributeCheck(\n AttributeNames.layout.lock,\n AttributesValues.layout.large,\n ),\n reverse: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.layout.DEFAULT,\n attributeNameNew: AttributeNames.layout.reverse,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.reverse,\n attributeValue: AttributesValues.state.TRUE,\n }),\n spaceHorizontalLarge: (props: AttributeElementProps): boolean =>\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.spaceHorizontal,\n attributeValue: AttributesValues.layout.large,\n }),\n textCentered: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.visual.VISUAL_TEXT_CENTER,\n attributeNameNew: AttributeNames.layout.text,\n attributeValue: AttributesValues.layout.center,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.layout.text,\n attributeValue: AttributesValues.layout.center,\n }),\n} as const;\n\n// Social checks\n\nconst isSharing = {\n email: createAttributeCheck(\n AttributeNames.sharing.email,\n AttributesValues.state.TRUE,\n ),\n print: createAttributeCheck(\n AttributeNames.sharing.print,\n AttributesValues.state.TRUE,\n ),\n} as const;\n\nconst includesSharing = {\n facebook: createAttributeCheck(\n AttributeNames.social.facebook,\n AttributesValues.state.TRUE,\n true,\n ),\n twitter: createAttributeCheck(\n AttributeNames.social.twitter,\n AttributesValues.state.TRUE,\n true,\n ),\n} as const;\n\n// Theme checks\nconst isTheme = {\n dark: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.theme.THEME_DEPRECATD,\n attributeNameNew: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.DARK,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.DARK,\n }),\n gold: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.theme.THEME_DEPRECATD,\n attributeNameNew: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.GOLD,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.GOLD,\n }),\n light: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.theme.THEME_DEPRECATD,\n attributeNameNew: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.LIGHT,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.LIGHT,\n }),\n maryland: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.theme.THEME_DEPRECATD,\n attributeNameNew: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.MARYLAND,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.theme.default,\n attributeValue: AttributesValues.theme.MARYLAND,\n }),\n} as const;\n\n// Visual checks\nconst isVisual = {\n aligned: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.visual.VISUAL_ALIGN,\n attributeNameNew: AttributeNames.visual.imageAligned,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.imageAligned,\n attributeValue: AttributesValues.state.TRUE,\n }),\n bordered: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.visual.VISUAL_BORDER,\n attributeNameNew: AttributeNames.visual.bordered,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.bordered,\n attributeValue: AttributesValues.state.TRUE,\n }),\n campaign: createAttributeCheck(\n AttributeNames.visual.campaign,\n AttributesValues.campaign.forward,\n ),\n icon_seal: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.visual.VISUAL_HAS_LOGO,\n attributeNameNew: AttributeNames.visual.iconSeal,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.iconSeal,\n attributeValue: AttributesValues.state.TRUE,\n }),\n open: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.state.STATE_DEPRECATD,\n attributeNameNew: AttributeNames.visual.open,\n attributeValue: AttributesValues.state.OPENED,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.open,\n attributeValue: AttributesValues.state.TRUE,\n }),\n play: createAttributeCheck(\n AttributeNames.visual.play,\n AttributesValues.state.TRUE,\n ),\n quote: createAttributeCheck(\n AttributeNames.deprecated.visual.VISUAL_QUOTE,\n AttributesValues.state.TRUE,\n ),\n showIcon: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.visual.VISUAL_ICON,\n attributeNameNew: AttributeNames.visual.icon,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.icon,\n attributeValue: AttributesValues.state.TRUE,\n }),\n sizeNormal: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.display.DISPLAY_SIZE,\n attributeNameNew: AttributeNames.visual.size,\n attributeValue: AttributesValues.size.NORMAL,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.size,\n attributeValue: AttributesValues.size.NORMAL,\n }),\n showTime: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.feature.SHOW_TIME,\n attributeNameNew: AttributeNames.visual.time,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.time,\n attributeValue: AttributesValues.state.TRUE,\n defaultValue: true,\n }),\n sizeLarge: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.display.DISPLAY_SIZE,\n attributeNameNew: AttributeNames.visual.size,\n attributeValue: AttributesValues.size.LARGE,\n }) ||\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.display.DISPLAY_SIZE,\n attributeNameNew: AttributeNames.visual.size,\n attributeValue: '',\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.size,\n attributeValue: AttributesValues.size.LARGE,\n }),\n stickyFirst: createAttributeCheck(\n AttributeNames.deprecated.option.OPTIONAL_STICKY_FIRST,\n AttributesValues.state.TRUE,\n true,\n ),\n transparent: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.visual.VISUAL_TRANSPARENT,\n attributeNameNew: AttributeNames.visual.transparent,\n attributeValue: AttributesValues.state.TRUE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.visual.transparent,\n attributeValue: AttributesValues.state.TRUE,\n }),\n} as const;\n\n// Type checks\nconst isType = {\n mega: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.type.default,\n attributeValue: AttributesValues.type.MEGA,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.type.default,\n attributeValue: AttributesValues.type.MEGA,\n }),\n visual: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.type.default,\n attributeValue: AttributesValues.type.VISUAL,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.type.default,\n attributeValue: AttributesValues.type.VISUAL,\n }),\n simple: (props: AttributeElementProps): boolean =>\n checkDeprecatedAttribute({\n ...props,\n attributeNameOld: AttributeNames.deprecated.type.TYPE,\n attributeNameNew: AttributeNames.type.default,\n attributeValue: AttributesValues.type.SIMPLE,\n }) ||\n isAttributeTrue({\n ...props,\n attributeName: AttributeNames.type.default,\n attributeValue: AttributesValues.type.SIMPLE,\n }),\n} as const;\n\n// Value getters\nconst getValue = {\n alertUrl: createValueGetter({\n currentName: AttributeNames.information.alertUrl,\n }),\n daysToHide: createValueGetter({\n currentName: AttributeNames.visual.hiddenDays,\n deprecatedName: AttributeNames.deprecated.visual.VISUAL_DAYS_TO_HIDE,\n }),\n feedEntryRemoveIds: createValueGetter({\n currentName: AttributeNames.information.removeIds,\n deprecatedName: AttributeNames.deprecated.feed.FEED_NOT_ENTRIES,\n }),\n feedFilterIds: createValueGetter({\n currentName: AttributeNames.information.filterIds,\n deprecatedName: AttributeNames.deprecated.feed.FEED_CATEGORIES,\n }),\n feedToken: createValueGetter({\n currentName: AttributeNames.information.token,\n deprecatedName: AttributeNames.deprecated.feed.FEED_TOKEN,\n }),\n giftUrl: createValueGetter({\n currentName: AttributeNames.information.gift,\n }),\n layoutColumnCount: createValueGetter({\n currentName: AttributeNames.layout.columnCount,\n deprecatedName: AttributeNames.deprecated.feed.FEED_COLUMN_COUNT,\n }),\n layoutLock: createValueGetter({\n currentName: AttributeNames.layout.lock,\n }),\n layoutRowCount: createValueGetter({\n currentName: AttributeNames.layout.rowCount,\n deprecatedName: AttributeNames.deprecated.feed.FEED_ROW_COUNT,\n }),\n title: createValueGetter({\n currentName: AttributeNames.information.title,\n }),\n topPosition: createValueGetter({\n currentName: AttributeNames.layout.position,\n deprecatedName: AttributeNames.deprecated.layout.LAYOUT_STICKY_TOP,\n }),\n styleProps: (props: AttributeElementProps) => {\n const cssString = createValueGetter({\n ...props,\n currentName: AttributeNames.deprecated.visual.VISUAL_STYLE_PROPS,\n });\n\n if (cssString && typeof cssString === 'string') {\n return Styles.utilities.create.jss.objectFromString(cssString);\n }\n },\n url: createValueGetter({\n currentName: AttributeNames.information.url,\n }),\n} as const;\n\n// Public API\nexport {\n hasInfo,\n hasDecoration,\n includesFeature,\n isDisplay,\n isData,\n isInfo,\n isLayout,\n isSharing,\n includesSharing,\n isTheme,\n isType,\n isVisual,\n getValue,\n};\n\nexport type {\n AttributeElementProps,\n AttributeProps,\n AttributeNullProps,\n DeprecatedAttributeProps,\n};\n"],"names":["AttributesValues"],"mappings":";;;AAmEA,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,MAA+B;AAC7B,QAAM,QAAQ,QA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e,YAAY;AAAA,IACxC,gBAAgB,eAAe,WAAW,KAAK;AAAA,EAAA,CAChD;AAAA,EACD,WAAW,kBAAkB;AAAA,IAC3B,aAAa,eAAe,YAAY;AAAA,IACxC,gBAAgB,eAAe,WAAW,KAAK;AAAA,EAAA,CAChD;AAAA,EACD,SAAS,kBAAkB;AAAA,IACzB,aAAa,eAAe,YAAY;AAAA,EAAA,CACzC;AAAA,EACD,mBAAmB,kBAAkB;AAAA,IACnC,aAAa,eAAe,OAAO;AAAA,IACnC,gBAAgB,eAAe,WAAW,KAAK;AAAA,EAAA,CAChD;AAAA,EACD,YAAY,kBAAkB;AAAA,IAC5B,aAAa,eAAe,OAAO;AAAA,EAAA,CACpC;AAAA,EACD,gBAAgB,kBAAkB;AAAA,IAChC,aAAa,eAAe,OAAO;AAAA,IACnC,gBAAgB,eAAe,WAAW,KAAK;AAAA,EAAA,CAChD;AAAA,EACD,OAAO,kBAAkB;AAAA,IACvB,aAAa,eAAe,YAAY;AAAA,EAAA,CACzC;AAAA,EACD,aAAa,kBAAkB;AAAA,IAC7B,aAAa,eAAe,OAAO;AAAA,IACnC,gBAAgB,eAAe,WAAW,OAAO;AAAA,EAAA,CAClD;AAAA,EACD,YAAY,CAAC,UAAiC;AAC5C,UAAM,YAAY,kBAAkB;AAAA,MAClC,GAAG;AAAA,MACH,aAAa,eAAe,WAAW,OAAO;AAAA,IAAA,CAC/C;AAED,QAAI,aAAa,OAAO,cAAc,UAAU;AAC9C,aAAO,OAAO,UAAU,OAAO,IAAI,iBAAiB,SAAS;AAAA,IAC/D;AAAA,EACF;AAAA,EACA,KAAK,kBAAkB;AAAA,IACrB,aAAa,eAAe,YAAY;AAAA,EAAA,CACzC;AACH;"}
@@ -0,0 +1,52 @@
1
+ export interface AttributeElementRef {
2
+ element: HTMLElement;
3
+ events?: Record<string, Function>;
4
+ }
5
+ export type AttributeCallback = (arg: AttributeElementRef, arg2?: any) => void;
6
+ export interface AttributeHandlerConfig {
7
+ name: string;
8
+ handler: (ref: AttributeElementRef, oldValue: string | null, newValue: string | null) => void;
9
+ }
10
+ export interface AttributeHandlerProps {
11
+ callback: AttributeCallback;
12
+ name?: string;
13
+ }
14
+ export declare const CommonAttributeHandlers: {
15
+ resize: (callback: (element: AttributeElementRef) => void) => AttributeHandlerConfig;
16
+ visualShowHide: (options: {
17
+ onShow?: (element: AttributeElementRef) => void;
18
+ onHide?: (element: AttributeElementRef) => void;
19
+ }) => AttributeHandlerConfig[];
20
+ visualToggle: (options: {
21
+ onOpen?: (element: AttributeElementRef) => void;
22
+ onClose?: (element: AttributeElementRef) => void;
23
+ }) => AttributeHandlerConfig[];
24
+ accordion: () => AttributeHandlerConfig[];
25
+ };
26
+ declare const _default: {
27
+ combine: (...configs: AttributeHandlerConfig[]) => AttributeHandlerConfig[];
28
+ observe: {
29
+ resize: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
30
+ stateOpen: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
31
+ stateClosed: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
32
+ visuallyHide: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
33
+ visuallyOpen: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
34
+ visuallyClosed: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
35
+ visuallyPosition: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
36
+ visuallyShow: ({ callback, name, }: AttributeHandlerProps) => AttributeHandlerConfig;
37
+ };
38
+ common: {
39
+ resize: (callback: (element: AttributeElementRef) => void) => AttributeHandlerConfig;
40
+ visualShowHide: (options: {
41
+ onShow?: (element: AttributeElementRef) => void;
42
+ onHide?: (element: AttributeElementRef) => void;
43
+ }) => AttributeHandlerConfig[];
44
+ visualToggle: (options: {
45
+ onOpen?: (element: AttributeElementRef) => void;
46
+ onClose?: (element: AttributeElementRef) => void;
47
+ }) => AttributeHandlerConfig[];
48
+ accordion: () => AttributeHandlerConfig[];
49
+ };
50
+ };
51
+ export default _default;
52
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../source/attributes/handler.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,mBAAmB;IAElC,OAAO,EAAE,WAAW,CAAC;IAErB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACnC;AAKD,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;AAK/E,MAAM,WAAW,sBAAsB;IAErC,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,CACP,GAAG,EAAE,mBAAmB,EACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,KACpB,IAAI,CAAC;CACX;AAKD,MAAM,WAAW,qBAAqB;IAEpC,QAAQ,EAAE,iBAAiB,CAAC;IAE5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAyTD,eAAO,MAAM,uBAAuB;uBA9Ef,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI;8BAM/B;QACxB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;QAChD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;KACjD;4BAqBuB;QACtB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;QAChD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;KAClD;;CA6C0C,CAAC;;0BAvShC,sBAAsB,EAAE,KACnC,sBAAsB,EAAE;;sCAoCxB,qBAAqB,KAAG,sBAAsB;yCAgD9C,qBAAqB,KAAG,sBAAsB;2CAmB9C,qBAAqB,KAAG,sBAAsB;4CAmC9C,qBAAqB,KAAG,sBAAsB;4CAe9C,qBAAqB,KAAG,sBAAsB;8CA9B9C,qBAAqB,KAAG,sBAAsB;gDA6C9C,qBAAqB,KAAG,sBAAsB;4CAiB9C,qBAAqB,KAAG,sBAAsB;;;2BA+B5B,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI;kCAM/B;YACxB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;YAChD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;SACjD;gCAqBuB;YACtB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;YAChD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;SAClD;;;;AA+CH,wBAA4C"}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ const names = require("./names.js");
3
+ const values = require("./values.js");
4
+ const combine = (...configs) => {
5
+ const handlerMap = /* @__PURE__ */ new Map();
6
+ configs.forEach((config) => {
7
+ const handlers = handlerMap.get(config.name) || [];
8
+ handlers.push(config.handler);
9
+ handlerMap.set(config.name, handlers);
10
+ });
11
+ return Array.from(handlerMap.entries()).map(([name, handlers]) => ({
12
+ name,
13
+ handler: (ref, oldValue, newValue) => {
14
+ handlers.forEach((handler2) => handler2(ref, oldValue, newValue));
15
+ }
16
+ }));
17
+ };
18
+ const resize = ({
19
+ callback,
20
+ name
21
+ }) => ({
22
+ name: name || names.deprecated.state.RESIZE,
23
+ handler: (ref, _, newValue) => {
24
+ if (newValue === values.state.TRUE) {
25
+ const element = ref.element;
26
+ const previousSize = {
27
+ width: element.offsetWidth,
28
+ height: element.offsetHeight
29
+ };
30
+ callback(ref);
31
+ setTimeout(() => {
32
+ const currentSize = {
33
+ width: element.offsetWidth,
34
+ height: element.offsetHeight
35
+ };
36
+ element.dispatchEvent(
37
+ new CustomEvent("component:resize", {
38
+ detail: {
39
+ tagName: element.tagName.toLowerCase(),
40
+ element,
41
+ timestamp: Date.now(),
42
+ previousSize,
43
+ currentSize,
44
+ source: "attribute"
45
+ },
46
+ bubbles: true,
47
+ composed: true
48
+ })
49
+ );
50
+ }, 0);
51
+ }
52
+ }
53
+ });
54
+ const stateOpen = ({
55
+ callback,
56
+ name
57
+ }) => ({
58
+ name: name || names.deprecated.state.STATE,
59
+ handler: (ref, oldValue, newValue) => {
60
+ if (newValue === values.state.OPENED && oldValue === values.state.CLOSED) {
61
+ callback(ref);
62
+ }
63
+ }
64
+ });
65
+ const stateClosed = ({
66
+ callback,
67
+ name
68
+ }) => ({
69
+ name: name || names.deprecated.state.STATE,
70
+ handler: (ref, oldValue, newValue) => {
71
+ if (newValue === values.state.CLOSED && oldValue === values.state.OPENED) {
72
+ callback(ref);
73
+ }
74
+ }
75
+ });
76
+ const visuallyClosed = ({
77
+ callback,
78
+ name
79
+ }) => ({
80
+ name: name || names.visual.open,
81
+ handler: (ref, oldValue, newValue) => {
82
+ if (newValue === values.state.FALSE && oldValue === values.state.TRUE) {
83
+ callback(ref);
84
+ }
85
+ }
86
+ });
87
+ const visuallyHide = ({
88
+ callback,
89
+ name
90
+ }) => ({
91
+ name: name || names.layout.hidden,
92
+ handler: (ref, oldValue, newValue) => {
93
+ if (newValue === values.state.TRUE && oldValue === values.state.FALSE) {
94
+ callback(ref);
95
+ }
96
+ }
97
+ });
98
+ const visuallyOpen = ({
99
+ callback,
100
+ name
101
+ }) => ({
102
+ name: name || names.visual.open,
103
+ handler: (ref, oldValue, newValue) => {
104
+ if (newValue === values.state.TRUE && oldValue === values.state.FALSE) {
105
+ callback(ref);
106
+ }
107
+ }
108
+ });
109
+ const visuallyPosition = ({
110
+ callback,
111
+ name
112
+ }) => ({
113
+ name: name || names.layout.position,
114
+ handler: (ref, oldValue, newValue) => {
115
+ if (newValue !== oldValue) {
116
+ const top = newValue ? parseInt(newValue) : null;
117
+ if (top) {
118
+ callback(ref, top);
119
+ } else {
120
+ callback(ref);
121
+ }
122
+ }
123
+ }
124
+ });
125
+ const visuallyShow = ({
126
+ callback,
127
+ name
128
+ }) => ({
129
+ name: name || names.layout.hidden,
130
+ handler: (ref, oldValue, newValue) => {
131
+ if (newValue === values.state.FALSE && oldValue === values.state.TRUE) {
132
+ callback(ref);
133
+ }
134
+ }
135
+ });
136
+ const observe = {
137
+ resize,
138
+ stateOpen,
139
+ stateClosed,
140
+ visuallyHide,
141
+ visuallyOpen,
142
+ visuallyClosed,
143
+ visuallyPosition,
144
+ visuallyShow
145
+ };
146
+ const common = {
147
+ /**
148
+ * Resize observer for responsive components
149
+ */
150
+ resize: (callback) => resize({ callback }),
151
+ /**
152
+ * Visual show/hide handlers for modals and overlays
153
+ */
154
+ visualShowHide: (options) => combine(
155
+ ...options.onShow ? [
156
+ visuallyShow({
157
+ callback: options.onShow
158
+ })
159
+ ] : [],
160
+ ...options.onHide ? [
161
+ visuallyHide({
162
+ callback: options.onHide
163
+ })
164
+ ] : []
165
+ ),
166
+ /**
167
+ * Visual open/close handlers for expandable components
168
+ */
169
+ visualToggle: (options) => combine(
170
+ ...options.onOpen ? [
171
+ visuallyOpen({
172
+ callback: options.onOpen
173
+ })
174
+ ] : [],
175
+ ...options.onClose ? [
176
+ visuallyClosed({
177
+ callback: options.onClose
178
+ })
179
+ ] : []
180
+ ),
181
+ /**
182
+ * Standard accordion handlers with open/close transitions
183
+ */
184
+ accordion: () => combine(
185
+ resize({
186
+ callback: (element) => element.events?.open({ hasAnimation: false })
187
+ }),
188
+ visuallyOpen({
189
+ callback: (element) => element.events?.open({ hasAnimation: true })
190
+ }),
191
+ visuallyClosed({
192
+ callback: (element) => element.events?.close({ hasAnimation: true })
193
+ }),
194
+ // Deprecated handlers for backwards compatibility
195
+ stateClosed({
196
+ callback: (element) => element.events?.close({ hasAnimation: true })
197
+ }),
198
+ stateOpen({
199
+ callback: (element) => element.events?.open({ hasAnimation: true })
200
+ })
201
+ )
202
+ };
203
+ const handler = { combine, observe, common };
204
+ module.exports = handler;
205
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sources":["../../source/attributes/handler.ts"],"sourcesContent":["import AttributeNames from './names';\nimport AttributeValues from './values';\n\n/**\n * Attribute Handler System\n *\n * Provides reactive attribute observation for web components.\n * Handlers watch for specific attribute changes and execute callbacks.\n *\n * ## Handler Types:\n *\n * 1. **State Transitions**: Watch for specific value changes\n * - e.g., state changing from \"closed\" to \"open\"\n *\n * 2. **Boolean Triggers**: Watch for true/false changes\n * - e.g., resize=\"true\" triggers recalculation\n *\n * 3. **Value Changes**: Watch for any value change\n * - e.g., data-layout-position updates\n *\n * ## Usage Example:\n * ```typescript\n * const attributes = Attributes.handler.combine(\n * Attributes.handler.observe.resize({\n * callback: (element) => element.events?.recalculate()\n * }),\n * Attributes.handler.observe.visuallyOpen({\n * callback: (element) => element.events?.open({ hasAnimation: true })\n * })\n * );\n * ```\n */\n/**\n * Reference to an element with optional event handlers\n */\nexport interface AttributeElementRef {\n /** The HTML element being observed */\n element: HTMLElement;\n /** Optional event handlers attached to the element */\n events?: Record<string, Function>;\n}\n\n/**\n * Callback function type for attribute handlers\n */\nexport type AttributeCallback = (arg: AttributeElementRef, arg2?: any) => void;\n\n/**\n * Configuration for an attribute handler\n */\nexport interface AttributeHandlerConfig {\n /** The attribute name to observe */\n name: string;\n /** Handler function called when the attribute changes */\n handler: (\n ref: AttributeElementRef,\n oldValue: string | null,\n newValue: string | null,\n ) => void;\n}\n\n/**\n * Properties for creating attribute handlers\n */\nexport interface AttributeHandlerProps {\n /** Callback function to execute when attribute changes */\n callback: AttributeCallback;\n /** Optional attribute name override */\n name?: string;\n}\n\n/**\n * Combines multiple attribute handlers for the same attribute name.\n * When multiple handlers target the same attribute, they execute in sequence.\n *\n * @param configs - Array of attribute handler configurations\n * @returns Combined handler configurations\n *\n * @example\n * ```typescript\n * const handlers = combine(\n * handler1, // First to execute\n * handler2 // Second to execute\n * );\n * ```\n */\nconst combine = (\n ...configs: AttributeHandlerConfig[]\n): AttributeHandlerConfig[] => {\n const handlerMap = new Map<\n string,\n ((\n ref: AttributeElementRef,\n oldValue: string | null,\n newValue: string | null,\n ) => void)[]\n >();\n\n configs.forEach((config) => {\n const handlers = handlerMap.get(config.name) || [];\n handlers.push(config.handler);\n handlerMap.set(config.name, handlers);\n });\n\n return Array.from(handlerMap.entries()).map(([name, handlers]) => ({\n name,\n handler: (\n ref: AttributeElementRef,\n oldValue: string | null,\n newValue: string | null,\n ) => {\n handlers.forEach((handler) => handler(ref, oldValue, newValue));\n },\n }));\n};\n\n/**\n * Observes the 'resize' attribute.\n * Triggers callback when resize=\"true\" and dispatches component:resize event.\n * Commonly used to recalculate component dimensions.\n */\nconst resize = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.deprecated.state.RESIZE,\n handler: (ref, _, newValue) => {\n if (newValue === AttributeValues.state.TRUE) {\n const element = ref.element;\n\n // Capture dimensions before resize\n const previousSize = {\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n\n // Execute resize callback\n callback(ref);\n\n // Dispatch resize event after callback with updated dimensions\n setTimeout(() => {\n const currentSize = {\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n\n element.dispatchEvent(\n new CustomEvent('component:resize', {\n detail: {\n tagName: element.tagName.toLowerCase(),\n element,\n timestamp: Date.now(),\n previousSize,\n currentSize,\n source: 'attribute',\n },\n bubbles: true,\n composed: true,\n }),\n );\n }, 0);\n }\n },\n});\n\n/**\n * @deprecated Use visuallyOpen instead\n * Observes 'state' attribute transition from \"closed\" to \"open\".\n */\nconst stateOpen = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.deprecated.state.STATE,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.OPENED &&\n oldValue === AttributeValues.state.CLOSED\n ) {\n callback(ref);\n }\n },\n});\n\n/**\n * @deprecated Use visuallyClosed instead\n * Observes 'state' attribute transition from \"open\" to \"closed\".\n */\nconst stateClosed = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.deprecated.state.STATE,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.CLOSED &&\n oldValue === AttributeValues.state.OPENED\n ) {\n callback(ref);\n }\n },\n});\n\n/**\n * Observes 'data-visual-open' attribute.\n * Triggers callback when changing from \"true\" to \"false\".\n * Used for closing animations and transitions.\n */\nconst visuallyClosed = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.visual.open,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.FALSE &&\n oldValue === AttributeValues.state.TRUE\n ) {\n callback(ref);\n }\n },\n});\n\nconst visuallyHide = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.layout.hidden,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.TRUE &&\n oldValue === AttributeValues.state.FALSE\n ) {\n callback(ref);\n }\n },\n});\n\nconst visuallyOpen = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.visual.open,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.TRUE &&\n oldValue === AttributeValues.state.FALSE\n ) {\n callback(ref);\n }\n },\n});\n\nconst visuallyPosition = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.layout.position,\n handler: (ref, oldValue, newValue) => {\n if (newValue !== oldValue) {\n const top = newValue ? parseInt(newValue) : null;\n if (top) {\n callback(ref, top);\n } else {\n callback(ref);\n }\n }\n },\n});\n\nconst visuallyShow = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.layout.hidden,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.FALSE &&\n oldValue === AttributeValues.state.TRUE\n ) {\n callback(ref);\n }\n },\n});\n\nconst observe = {\n resize,\n stateOpen,\n stateClosed,\n visuallyHide,\n visuallyOpen,\n visuallyClosed,\n visuallyPosition,\n visuallyShow,\n};\n\n/**\n * Common attribute handler combinations for standard component behaviors.\n * These pre-configured handlers simplify component implementation.\n */\nconst common = {\n /**\n * Resize observer for responsive components\n */\n resize: (callback: (element: AttributeElementRef) => void) =>\n resize({ callback }),\n\n /**\n * Visual show/hide handlers for modals and overlays\n */\n visualShowHide: (options: {\n onShow?: (element: AttributeElementRef) => void;\n onHide?: (element: AttributeElementRef) => void;\n }) =>\n combine(\n ...(options.onShow\n ? [\n visuallyShow({\n callback: options.onShow,\n }),\n ]\n : []),\n ...(options.onHide\n ? [\n visuallyHide({\n callback: options.onHide,\n }),\n ]\n : []),\n ),\n\n /**\n * Visual open/close handlers for expandable components\n */\n visualToggle: (options: {\n onOpen?: (element: AttributeElementRef) => void;\n onClose?: (element: AttributeElementRef) => void;\n }) =>\n combine(\n ...(options.onOpen\n ? [\n visuallyOpen({\n callback: options.onOpen,\n }),\n ]\n : []),\n ...(options.onClose\n ? [\n visuallyClosed({\n callback: options.onClose,\n }),\n ]\n : []),\n ),\n\n /**\n * Standard accordion handlers with open/close transitions\n */\n accordion: () =>\n combine(\n resize({\n callback: (element) => element.events?.open({ hasAnimation: false }),\n }),\n visuallyOpen({\n callback: (element) => element.events?.open({ hasAnimation: true }),\n }),\n visuallyClosed({\n callback: (element) => element.events?.close({ hasAnimation: true }),\n }),\n // Deprecated handlers for backwards compatibility\n stateClosed({\n callback: (element) => element.events?.close({ hasAnimation: true }),\n }),\n stateOpen({\n callback: (element) => element.events?.open({ hasAnimation: true }),\n }),\n ),\n};\n\n/**\n * @deprecated Use Attributes.handler.common instead\n */\nexport const CommonAttributeHandlers = common;\n\nexport default { combine, observe, common };\n// Types are now exported directly, not through namespace\n"],"names":["handler","AttributeNames","Attribute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E,eAAe;AAAA,QACb,UAAU,QAAQ;AAAA,MAAA,CACnB;AAAA,IAAA,IAEH,CAAA;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA,EAMT,WAAW,MACT;AAAA,IACE,OAAO;AAAA,MACL,UAAU,CAAC,YAAY,QAAQ,QAAQ,KAAK,EAAE,cAAc,MAAA,CAAO;AAAA,IAAA,CACpE;AAAA,IACD,aAAa;AAAA,MACX,UAAU,CAAC,YAAY,QAAQ,QAAQ,KAAK,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACnE;AAAA,IACD,eAAe;AAAA,MACb,UAAU,CAAC,YAAY,QAAQ,QAAQ,MAAM,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACpE;AAAA;AAAA,IAED,YAAY;AAAA,MACV,UAAU,CAAC,YAAY,QAAQ,QAAQ,MAAM,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACpE;AAAA,IACD,UAAU;AAAA,MACR,UAAU,CAAC,YAAY,QAAQ,QAAQ,KAAK,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACnE;AAAA,EAAA;AAEP;AAOA,MAAA,UAAe,EAAE,SAAS,SAAS,OAAA;;"}
@@ -0,0 +1,206 @@
1
+ import AttributeNames from "./names.mjs";
2
+ import AttributeValues from "./values.mjs";
3
+ const combine = (...configs) => {
4
+ const handlerMap = /* @__PURE__ */ new Map();
5
+ configs.forEach((config) => {
6
+ const handlers = handlerMap.get(config.name) || [];
7
+ handlers.push(config.handler);
8
+ handlerMap.set(config.name, handlers);
9
+ });
10
+ return Array.from(handlerMap.entries()).map(([name, handlers]) => ({
11
+ name,
12
+ handler: (ref, oldValue, newValue) => {
13
+ handlers.forEach((handler2) => handler2(ref, oldValue, newValue));
14
+ }
15
+ }));
16
+ };
17
+ const resize = ({
18
+ callback,
19
+ name
20
+ }) => ({
21
+ name: name || AttributeNames.deprecated.state.RESIZE,
22
+ handler: (ref, _, newValue) => {
23
+ if (newValue === AttributeValues.state.TRUE) {
24
+ const element = ref.element;
25
+ const previousSize = {
26
+ width: element.offsetWidth,
27
+ height: element.offsetHeight
28
+ };
29
+ callback(ref);
30
+ setTimeout(() => {
31
+ const currentSize = {
32
+ width: element.offsetWidth,
33
+ height: element.offsetHeight
34
+ };
35
+ element.dispatchEvent(
36
+ new CustomEvent("component:resize", {
37
+ detail: {
38
+ tagName: element.tagName.toLowerCase(),
39
+ element,
40
+ timestamp: Date.now(),
41
+ previousSize,
42
+ currentSize,
43
+ source: "attribute"
44
+ },
45
+ bubbles: true,
46
+ composed: true
47
+ })
48
+ );
49
+ }, 0);
50
+ }
51
+ }
52
+ });
53
+ const stateOpen = ({
54
+ callback,
55
+ name
56
+ }) => ({
57
+ name: name || AttributeNames.deprecated.state.STATE,
58
+ handler: (ref, oldValue, newValue) => {
59
+ if (newValue === AttributeValues.state.OPENED && oldValue === AttributeValues.state.CLOSED) {
60
+ callback(ref);
61
+ }
62
+ }
63
+ });
64
+ const stateClosed = ({
65
+ callback,
66
+ name
67
+ }) => ({
68
+ name: name || AttributeNames.deprecated.state.STATE,
69
+ handler: (ref, oldValue, newValue) => {
70
+ if (newValue === AttributeValues.state.CLOSED && oldValue === AttributeValues.state.OPENED) {
71
+ callback(ref);
72
+ }
73
+ }
74
+ });
75
+ const visuallyClosed = ({
76
+ callback,
77
+ name
78
+ }) => ({
79
+ name: name || AttributeNames.visual.open,
80
+ handler: (ref, oldValue, newValue) => {
81
+ if (newValue === AttributeValues.state.FALSE && oldValue === AttributeValues.state.TRUE) {
82
+ callback(ref);
83
+ }
84
+ }
85
+ });
86
+ const visuallyHide = ({
87
+ callback,
88
+ name
89
+ }) => ({
90
+ name: name || AttributeNames.layout.hidden,
91
+ handler: (ref, oldValue, newValue) => {
92
+ if (newValue === AttributeValues.state.TRUE && oldValue === AttributeValues.state.FALSE) {
93
+ callback(ref);
94
+ }
95
+ }
96
+ });
97
+ const visuallyOpen = ({
98
+ callback,
99
+ name
100
+ }) => ({
101
+ name: name || AttributeNames.visual.open,
102
+ handler: (ref, oldValue, newValue) => {
103
+ if (newValue === AttributeValues.state.TRUE && oldValue === AttributeValues.state.FALSE) {
104
+ callback(ref);
105
+ }
106
+ }
107
+ });
108
+ const visuallyPosition = ({
109
+ callback,
110
+ name
111
+ }) => ({
112
+ name: name || AttributeNames.layout.position,
113
+ handler: (ref, oldValue, newValue) => {
114
+ if (newValue !== oldValue) {
115
+ const top = newValue ? parseInt(newValue) : null;
116
+ if (top) {
117
+ callback(ref, top);
118
+ } else {
119
+ callback(ref);
120
+ }
121
+ }
122
+ }
123
+ });
124
+ const visuallyShow = ({
125
+ callback,
126
+ name
127
+ }) => ({
128
+ name: name || AttributeNames.layout.hidden,
129
+ handler: (ref, oldValue, newValue) => {
130
+ if (newValue === AttributeValues.state.FALSE && oldValue === AttributeValues.state.TRUE) {
131
+ callback(ref);
132
+ }
133
+ }
134
+ });
135
+ const observe = {
136
+ resize,
137
+ stateOpen,
138
+ stateClosed,
139
+ visuallyHide,
140
+ visuallyOpen,
141
+ visuallyClosed,
142
+ visuallyPosition,
143
+ visuallyShow
144
+ };
145
+ const common = {
146
+ /**
147
+ * Resize observer for responsive components
148
+ */
149
+ resize: (callback) => resize({ callback }),
150
+ /**
151
+ * Visual show/hide handlers for modals and overlays
152
+ */
153
+ visualShowHide: (options) => combine(
154
+ ...options.onShow ? [
155
+ visuallyShow({
156
+ callback: options.onShow
157
+ })
158
+ ] : [],
159
+ ...options.onHide ? [
160
+ visuallyHide({
161
+ callback: options.onHide
162
+ })
163
+ ] : []
164
+ ),
165
+ /**
166
+ * Visual open/close handlers for expandable components
167
+ */
168
+ visualToggle: (options) => combine(
169
+ ...options.onOpen ? [
170
+ visuallyOpen({
171
+ callback: options.onOpen
172
+ })
173
+ ] : [],
174
+ ...options.onClose ? [
175
+ visuallyClosed({
176
+ callback: options.onClose
177
+ })
178
+ ] : []
179
+ ),
180
+ /**
181
+ * Standard accordion handlers with open/close transitions
182
+ */
183
+ accordion: () => combine(
184
+ resize({
185
+ callback: (element) => element.events?.open({ hasAnimation: false })
186
+ }),
187
+ visuallyOpen({
188
+ callback: (element) => element.events?.open({ hasAnimation: true })
189
+ }),
190
+ visuallyClosed({
191
+ callback: (element) => element.events?.close({ hasAnimation: true })
192
+ }),
193
+ // Deprecated handlers for backwards compatibility
194
+ stateClosed({
195
+ callback: (element) => element.events?.close({ hasAnimation: true })
196
+ }),
197
+ stateOpen({
198
+ callback: (element) => element.events?.open({ hasAnimation: true })
199
+ })
200
+ )
201
+ };
202
+ const handler = { combine, observe, common };
203
+ export {
204
+ handler as default
205
+ };
206
+ //# sourceMappingURL=handler.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.mjs","sources":["../../source/attributes/handler.ts"],"sourcesContent":["import AttributeNames from './names';\nimport AttributeValues from './values';\n\n/**\n * Attribute Handler System\n *\n * Provides reactive attribute observation for web components.\n * Handlers watch for specific attribute changes and execute callbacks.\n *\n * ## Handler Types:\n *\n * 1. **State Transitions**: Watch for specific value changes\n * - e.g., state changing from \"closed\" to \"open\"\n *\n * 2. **Boolean Triggers**: Watch for true/false changes\n * - e.g., resize=\"true\" triggers recalculation\n *\n * 3. **Value Changes**: Watch for any value change\n * - e.g., data-layout-position updates\n *\n * ## Usage Example:\n * ```typescript\n * const attributes = Attributes.handler.combine(\n * Attributes.handler.observe.resize({\n * callback: (element) => element.events?.recalculate()\n * }),\n * Attributes.handler.observe.visuallyOpen({\n * callback: (element) => element.events?.open({ hasAnimation: true })\n * })\n * );\n * ```\n */\n/**\n * Reference to an element with optional event handlers\n */\nexport interface AttributeElementRef {\n /** The HTML element being observed */\n element: HTMLElement;\n /** Optional event handlers attached to the element */\n events?: Record<string, Function>;\n}\n\n/**\n * Callback function type for attribute handlers\n */\nexport type AttributeCallback = (arg: AttributeElementRef, arg2?: any) => void;\n\n/**\n * Configuration for an attribute handler\n */\nexport interface AttributeHandlerConfig {\n /** The attribute name to observe */\n name: string;\n /** Handler function called when the attribute changes */\n handler: (\n ref: AttributeElementRef,\n oldValue: string | null,\n newValue: string | null,\n ) => void;\n}\n\n/**\n * Properties for creating attribute handlers\n */\nexport interface AttributeHandlerProps {\n /** Callback function to execute when attribute changes */\n callback: AttributeCallback;\n /** Optional attribute name override */\n name?: string;\n}\n\n/**\n * Combines multiple attribute handlers for the same attribute name.\n * When multiple handlers target the same attribute, they execute in sequence.\n *\n * @param configs - Array of attribute handler configurations\n * @returns Combined handler configurations\n *\n * @example\n * ```typescript\n * const handlers = combine(\n * handler1, // First to execute\n * handler2 // Second to execute\n * );\n * ```\n */\nconst combine = (\n ...configs: AttributeHandlerConfig[]\n): AttributeHandlerConfig[] => {\n const handlerMap = new Map<\n string,\n ((\n ref: AttributeElementRef,\n oldValue: string | null,\n newValue: string | null,\n ) => void)[]\n >();\n\n configs.forEach((config) => {\n const handlers = handlerMap.get(config.name) || [];\n handlers.push(config.handler);\n handlerMap.set(config.name, handlers);\n });\n\n return Array.from(handlerMap.entries()).map(([name, handlers]) => ({\n name,\n handler: (\n ref: AttributeElementRef,\n oldValue: string | null,\n newValue: string | null,\n ) => {\n handlers.forEach((handler) => handler(ref, oldValue, newValue));\n },\n }));\n};\n\n/**\n * Observes the 'resize' attribute.\n * Triggers callback when resize=\"true\" and dispatches component:resize event.\n * Commonly used to recalculate component dimensions.\n */\nconst resize = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.deprecated.state.RESIZE,\n handler: (ref, _, newValue) => {\n if (newValue === AttributeValues.state.TRUE) {\n const element = ref.element;\n\n // Capture dimensions before resize\n const previousSize = {\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n\n // Execute resize callback\n callback(ref);\n\n // Dispatch resize event after callback with updated dimensions\n setTimeout(() => {\n const currentSize = {\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n\n element.dispatchEvent(\n new CustomEvent('component:resize', {\n detail: {\n tagName: element.tagName.toLowerCase(),\n element,\n timestamp: Date.now(),\n previousSize,\n currentSize,\n source: 'attribute',\n },\n bubbles: true,\n composed: true,\n }),\n );\n }, 0);\n }\n },\n});\n\n/**\n * @deprecated Use visuallyOpen instead\n * Observes 'state' attribute transition from \"closed\" to \"open\".\n */\nconst stateOpen = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.deprecated.state.STATE,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.OPENED &&\n oldValue === AttributeValues.state.CLOSED\n ) {\n callback(ref);\n }\n },\n});\n\n/**\n * @deprecated Use visuallyClosed instead\n * Observes 'state' attribute transition from \"open\" to \"closed\".\n */\nconst stateClosed = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.deprecated.state.STATE,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.CLOSED &&\n oldValue === AttributeValues.state.OPENED\n ) {\n callback(ref);\n }\n },\n});\n\n/**\n * Observes 'data-visual-open' attribute.\n * Triggers callback when changing from \"true\" to \"false\".\n * Used for closing animations and transitions.\n */\nconst visuallyClosed = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.visual.open,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.FALSE &&\n oldValue === AttributeValues.state.TRUE\n ) {\n callback(ref);\n }\n },\n});\n\nconst visuallyHide = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.layout.hidden,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.TRUE &&\n oldValue === AttributeValues.state.FALSE\n ) {\n callback(ref);\n }\n },\n});\n\nconst visuallyOpen = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.visual.open,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.TRUE &&\n oldValue === AttributeValues.state.FALSE\n ) {\n callback(ref);\n }\n },\n});\n\nconst visuallyPosition = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.layout.position,\n handler: (ref, oldValue, newValue) => {\n if (newValue !== oldValue) {\n const top = newValue ? parseInt(newValue) : null;\n if (top) {\n callback(ref, top);\n } else {\n callback(ref);\n }\n }\n },\n});\n\nconst visuallyShow = ({\n callback,\n name,\n}: AttributeHandlerProps): AttributeHandlerConfig => ({\n name: name || AttributeNames.layout.hidden,\n handler: (ref, oldValue, newValue) => {\n if (\n newValue === AttributeValues.state.FALSE &&\n oldValue === AttributeValues.state.TRUE\n ) {\n callback(ref);\n }\n },\n});\n\nconst observe = {\n resize,\n stateOpen,\n stateClosed,\n visuallyHide,\n visuallyOpen,\n visuallyClosed,\n visuallyPosition,\n visuallyShow,\n};\n\n/**\n * Common attribute handler combinations for standard component behaviors.\n * These pre-configured handlers simplify component implementation.\n */\nconst common = {\n /**\n * Resize observer for responsive components\n */\n resize: (callback: (element: AttributeElementRef) => void) =>\n resize({ callback }),\n\n /**\n * Visual show/hide handlers for modals and overlays\n */\n visualShowHide: (options: {\n onShow?: (element: AttributeElementRef) => void;\n onHide?: (element: AttributeElementRef) => void;\n }) =>\n combine(\n ...(options.onShow\n ? [\n visuallyShow({\n callback: options.onShow,\n }),\n ]\n : []),\n ...(options.onHide\n ? [\n visuallyHide({\n callback: options.onHide,\n }),\n ]\n : []),\n ),\n\n /**\n * Visual open/close handlers for expandable components\n */\n visualToggle: (options: {\n onOpen?: (element: AttributeElementRef) => void;\n onClose?: (element: AttributeElementRef) => void;\n }) =>\n combine(\n ...(options.onOpen\n ? [\n visuallyOpen({\n callback: options.onOpen,\n }),\n ]\n : []),\n ...(options.onClose\n ? [\n visuallyClosed({\n callback: options.onClose,\n }),\n ]\n : []),\n ),\n\n /**\n * Standard accordion handlers with open/close transitions\n */\n accordion: () =>\n combine(\n resize({\n callback: (element) => element.events?.open({ hasAnimation: false }),\n }),\n visuallyOpen({\n callback: (element) => element.events?.open({ hasAnimation: true }),\n }),\n visuallyClosed({\n callback: (element) => element.events?.close({ hasAnimation: true }),\n }),\n // Deprecated handlers for backwards compatibility\n stateClosed({\n callback: (element) => element.events?.close({ hasAnimation: true }),\n }),\n stateOpen({\n callback: (element) => element.events?.open({ hasAnimation: true }),\n }),\n ),\n};\n\n/**\n * @deprecated Use Attributes.handler.common instead\n */\nexport const CommonAttributeHandlers = common;\n\nexport default { combine, observe, common };\n// Types are now exported directly, not through namespace\n"],"names":["handler"],"mappings":";;AAsFA,MAAM,UAAU,IACX,YAC0B;AAC7B,QAAM,iCAAiB,IAAA;AASvB,UAAQ,QAAQ,CAAC,WAAW;AAC1B,UAAM,WAAW,WAAW,IAAI,OAAO,IAAI,KAAK,CAAA;AAChD,aAAS,KAAK,OAAO,OAAO;AAC5B,eAAW,IAAI,OAAO,MAAM,QAAQ;AAAA,EACtC,CAAC;AAED,SAAO,MAAM,KAAK,WAAW,QAAA,CAAS,EAAE,IAAI,CAAC,CAAC,MAAM,QAAQ,OAAO;AAAA,IACjE;AAAA,IACA,SAAS,CACP,KACA,UACA,aACG;AACH,eAAS,QAAQ,CAACA,aAAYA,SAAQ,KAAK,UAAU,QAAQ,CAAC;AAAA,IAChE;AAAA,EAAA,EACA;AACJ;AAOA,MAAM,SAAS,CAAC;AAAA,EACd;AAAA,EACA;AACF,OAAsD;AAAA,EACpD,MAAM,QAAQ,eAAe,WAAW,MAAM;AAAA,EAC9C,SAAS,CAAC,KAAK,GAAG,aAAa;AAC7B,QAAI,aAAa,gBAAgB,MAAM,MAAM;AAC3C,YAAM,UAAU,IAAI;AAGpB,YAAM,eAAe;AAAA,QACnB,OAAO,QAAQ;AAAA,QACf,QAAQ,QAAQ;AAAA,MAAA;AAIlB,eAAS,GAAG;AAGZ,iBAAW,MAAM;AACf,cAAM,cAAc;AAAA,UAClB,OAAO,QAAQ;AAAA,UACf,QAAQ,QAAQ;AAAA,QAAA;AAGlB,gBAAQ;AAAA,UACN,I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J,GAAI,QAAQ,SACR;AAAA,MACE,aAAa;AAAA,QACX,UAAU,QAAQ;AAAA,MAAA,CACnB;AAAA,IAAA,IAEH,CAAA;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA,EAMT,cAAc,CAAC,YAIb;AAAA,IACE,GAAI,QAAQ,SACR;AAAA,MACE,aAAa;AAAA,QACX,UAAU,QAAQ;AAAA,MAAA,CACnB;AAAA,IAAA,IAEH,CAAA;AAAA,IACJ,GAAI,QAAQ,UACR;AAAA,MACE,eAAe;AAAA,QACb,UAAU,QAAQ;AAAA,MAAA,CACnB;AAAA,IAAA,IAEH,CAAA;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA,EAMT,WAAW,MACT;AAAA,IACE,OAAO;AAAA,MACL,UAAU,CAAC,YAAY,QAAQ,QAAQ,KAAK,EAAE,cAAc,MAAA,CAAO;AAAA,IAAA,CACpE;AAAA,IACD,aAAa;AAAA,MACX,UAAU,CAAC,YAAY,QAAQ,QAAQ,KAAK,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACnE;AAAA,IACD,eAAe;AAAA,MACb,UAAU,CAAC,YAAY,QAAQ,QAAQ,MAAM,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACpE;AAAA;AAAA,IAED,YAAY;AAAA,MACV,UAAU,CAAC,YAAY,QAAQ,QAAQ,MAAM,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACpE;AAAA,IACD,UAAU;AAAA,MACR,UAAU,CAAC,YAAY,QAAQ,QAAQ,KAAK,EAAE,cAAc,KAAA,CAAM;AAAA,IAAA,CACnE;AAAA,EAAA;AAEP;AAOA,MAAA,UAAe,EAAE,SAAS,SAAS,OAAA;"}
@@ -0,0 +1,7 @@
1
+ import { default as handler } from './handler';
2
+ import { default as names } from './names';
3
+ import { default as values } from './values';
4
+ export { hasInfo, hasDecoration, includesFeature, isDisplay, isData, isInfo, isLayout, isSharing, includesSharing, isTheme, isType, isVisual, getValue, type AttributeElementProps, } from './checks';
5
+ export { handler, names, values };
6
+ export type { AttributeElementRef, AttributeCallback, AttributeHandlerConfig, AttributeHandlerProps, } from './handler';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/attributes/index.ts"],"names":[],"mappings":"AAkCA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,qBAAqB,GAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAClC,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,WAAW,CAAC"}