@universityofmaryland/web-model-library 1.0.7 → 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 (209) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +1 -1
  3. package/dist/_types.d.ts +43 -0
  4. package/dist/_types.d.ts.map +1 -1
  5. package/dist/_virtual/index.js +1 -1
  6. package/dist/_virtual/postcss.js +1 -1
  7. package/dist/attributes/change-detection.d.ts +21 -0
  8. package/dist/attributes/change-detection.d.ts.map +1 -0
  9. package/dist/attributes/change-detection.js +60 -0
  10. package/dist/attributes/change-detection.js.map +1 -0
  11. package/dist/attributes/checks.d.ts.map +1 -1
  12. package/dist/attributes/checks.js +15 -8
  13. package/dist/attributes/checks.js.map +1 -1
  14. package/dist/attributes/config.d.ts +29 -0
  15. package/dist/attributes/config.d.ts.map +1 -0
  16. package/dist/attributes/config.js +57 -0
  17. package/dist/attributes/config.js.map +1 -0
  18. package/dist/attributes/converters.d.ts +14 -0
  19. package/dist/attributes/converters.d.ts.map +1 -0
  20. package/dist/attributes/converters.js +84 -0
  21. package/dist/attributes/converters.js.map +1 -0
  22. package/dist/attributes/errors.d.ts +16 -0
  23. package/dist/attributes/errors.d.ts.map +1 -0
  24. package/dist/attributes/errors.js +51 -0
  25. package/dist/attributes/errors.js.map +1 -0
  26. package/dist/attributes/index.d.ts +4 -0
  27. package/dist/attributes/index.d.ts.map +1 -1
  28. package/dist/attributes.js +18 -0
  29. package/dist/attributes.js.map +1 -1
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +3 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/model/controllers.d.ts +22 -0
  35. package/dist/model/controllers.d.ts.map +1 -0
  36. package/dist/model/controllers.js +53 -0
  37. package/dist/model/controllers.js.map +1 -0
  38. package/dist/model/errors.d.ts +13 -0
  39. package/dist/model/errors.d.ts.map +1 -0
  40. package/dist/model/errors.js +23 -0
  41. package/dist/model/errors.js.map +1 -0
  42. package/dist/model/index.d.ts +54 -3
  43. package/dist/model/index.d.ts.map +1 -1
  44. package/dist/model/registration.d.ts +13 -0
  45. package/dist/model/registration.d.ts.map +1 -0
  46. package/dist/model/registration.js +83 -0
  47. package/dist/model/registration.js.map +1 -0
  48. package/dist/model/update-cycle.d.ts +12 -0
  49. package/dist/model/update-cycle.d.ts.map +1 -0
  50. package/dist/model/update-cycle.js +41 -0
  51. package/dist/model/update-cycle.js.map +1 -0
  52. package/dist/model.js +335 -55
  53. package/dist/model.js.map +1 -1
  54. package/dist/node_modules/.pnpm/nanoid@3.3.11/node_modules/nanoid/non-secure/index.js.map +1 -0
  55. package/dist/node_modules/{picocolors → .pnpm/picocolors@1.1.1/node_modules/picocolors}/picocolors.browser.js +1 -1
  56. package/dist/node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.browser.js.map +1 -0
  57. package/dist/node_modules/.pnpm/postcss-discard-duplicates@5.1.0_postcss@8.5.8/node_modules/postcss-discard-duplicates/src/index.js.map +1 -0
  58. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/at-rule.js.map +1 -0
  59. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/comment.js.map +1 -0
  60. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/container.js.map +1 -0
  61. package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/css-syntax-error.js +2 -2
  62. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/css-syntax-error.js.map +1 -0
  63. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/declaration.js.map +1 -0
  64. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/document.js.map +1 -0
  65. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/fromJSON.js.map +1 -0
  66. package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/input.js +2 -2
  67. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/input.js.map +1 -0
  68. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/lazy-result.js.map +1 -0
  69. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/list.js.map +1 -0
  70. package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/map-generator.js +1 -1
  71. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/map-generator.js.map +1 -0
  72. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/no-work-result.js.map +1 -0
  73. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/node.js.map +1 -0
  74. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/parse.js.map +1 -0
  75. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/parser.js.map +1 -0
  76. package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/postcss.js +1 -1
  77. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/postcss.js.map +1 -0
  78. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/postcss2.js.map +1 -0
  79. package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/previous-map.js +1 -1
  80. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/previous-map.js.map +1 -0
  81. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/processor.js.map +1 -0
  82. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/result.js.map +1 -0
  83. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/root.js.map +1 -0
  84. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/rule.js.map +1 -0
  85. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/stringifier.js.map +1 -0
  86. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/stringify.js.map +1 -0
  87. package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/symbols.js +1 -1
  88. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/symbols.js.map +1 -0
  89. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/tokenize.js.map +1 -0
  90. package/dist/node_modules/.pnpm/postcss@8.5.8/node_modules/postcss/lib/warning.js.map +1 -0
  91. package/dist/slots/index.d.ts +6 -0
  92. package/dist/slots/index.d.ts.map +1 -1
  93. package/dist/slots/slot-events.d.ts +32 -0
  94. package/dist/slots/slot-events.d.ts.map +1 -0
  95. package/dist/slots/slot-events.js +83 -0
  96. package/dist/slots/slot-events.js.map +1 -0
  97. package/dist/slots/slot-query.d.ts +18 -0
  98. package/dist/slots/slot-query.d.ts.map +1 -0
  99. package/dist/slots/slot-query.js +59 -0
  100. package/dist/slots/slot-query.js.map +1 -0
  101. package/dist/slots/slot-validation.d.ts +5 -0
  102. package/dist/slots/slot-validation.d.ts.map +1 -0
  103. package/dist/slots/slot-validation.js +89 -0
  104. package/dist/slots/slot-validation.js.map +1 -0
  105. package/dist/slots.js +15 -1
  106. package/dist/slots.js.map +1 -1
  107. package/dist/testing/console.d.ts +8 -0
  108. package/dist/testing/console.d.ts.map +1 -0
  109. package/dist/testing/console.js +39 -0
  110. package/dist/testing/console.js.map +1 -0
  111. package/dist/testing/events.d.ts +11 -0
  112. package/dist/testing/events.d.ts.map +1 -0
  113. package/dist/testing/events.js +47 -0
  114. package/dist/testing/events.js.map +1 -0
  115. package/dist/testing/fixture.d.ts +10 -0
  116. package/dist/testing/fixture.d.ts.map +1 -0
  117. package/dist/testing/fixture.js +36 -0
  118. package/dist/testing/fixture.js.map +1 -0
  119. package/dist/testing/index.d.ts +8 -0
  120. package/dist/testing/index.d.ts.map +1 -0
  121. package/dist/testing/shadow.d.ts +6 -0
  122. package/dist/testing/shadow.d.ts.map +1 -0
  123. package/dist/testing/shadow.js +27 -0
  124. package/dist/testing/shadow.js.map +1 -0
  125. package/dist/testing/slots.d.ts +10 -0
  126. package/dist/testing/slots.d.ts.map +1 -0
  127. package/dist/testing/slots.js +62 -0
  128. package/dist/testing/slots.js.map +1 -0
  129. package/dist/testing.d.ts +2 -0
  130. package/dist/testing.js +26 -0
  131. package/dist/testing.js.map +1 -0
  132. package/dist/utilities/debug.d.ts +365 -0
  133. package/dist/utilities/debug.d.ts.map +1 -0
  134. package/dist/utilities/debug.js +71 -0
  135. package/dist/utilities/debug.js.map +1 -0
  136. package/dist/utilities/dom.d.ts +11 -0
  137. package/dist/utilities/dom.d.ts.map +1 -0
  138. package/dist/utilities/dom.js +57 -0
  139. package/dist/utilities/dom.js.map +1 -0
  140. package/dist/utilities/events.d.ts +22 -0
  141. package/dist/utilities/events.d.ts.map +1 -0
  142. package/dist/utilities/events.js +49 -0
  143. package/dist/utilities/events.js.map +1 -0
  144. package/dist/utilities/index.d.ts +7 -0
  145. package/dist/utilities/index.d.ts.map +1 -1
  146. package/dist/utilities/register.d.ts.map +1 -1
  147. package/dist/utilities/register.js +16 -4
  148. package/dist/utilities/register.js.map +1 -1
  149. package/dist/utilities/styles.js +1 -1
  150. package/dist/utilities/types.d.ts +10 -0
  151. package/dist/utilities/types.d.ts.map +1 -0
  152. package/dist/utilities/types.js +45 -0
  153. package/dist/utilities/types.js.map +1 -0
  154. package/dist/utilities.js +27 -1
  155. package/dist/utilities.js.map +1 -1
  156. package/package.json +21 -15
  157. package/dist/node_modules/nanoid/non-secure/index.js.map +0 -1
  158. package/dist/node_modules/picocolors/picocolors.browser.js.map +0 -1
  159. package/dist/node_modules/postcss/lib/at-rule.js.map +0 -1
  160. package/dist/node_modules/postcss/lib/comment.js.map +0 -1
  161. package/dist/node_modules/postcss/lib/container.js.map +0 -1
  162. package/dist/node_modules/postcss/lib/css-syntax-error.js.map +0 -1
  163. package/dist/node_modules/postcss/lib/declaration.js.map +0 -1
  164. package/dist/node_modules/postcss/lib/document.js.map +0 -1
  165. package/dist/node_modules/postcss/lib/fromJSON.js.map +0 -1
  166. package/dist/node_modules/postcss/lib/input.js.map +0 -1
  167. package/dist/node_modules/postcss/lib/lazy-result.js.map +0 -1
  168. package/dist/node_modules/postcss/lib/list.js.map +0 -1
  169. package/dist/node_modules/postcss/lib/map-generator.js.map +0 -1
  170. package/dist/node_modules/postcss/lib/no-work-result.js.map +0 -1
  171. package/dist/node_modules/postcss/lib/node.js.map +0 -1
  172. package/dist/node_modules/postcss/lib/parse.js.map +0 -1
  173. package/dist/node_modules/postcss/lib/parser.js.map +0 -1
  174. package/dist/node_modules/postcss/lib/postcss.js.map +0 -1
  175. package/dist/node_modules/postcss/lib/postcss2.js.map +0 -1
  176. package/dist/node_modules/postcss/lib/previous-map.js.map +0 -1
  177. package/dist/node_modules/postcss/lib/processor.js.map +0 -1
  178. package/dist/node_modules/postcss/lib/result.js.map +0 -1
  179. package/dist/node_modules/postcss/lib/root.js.map +0 -1
  180. package/dist/node_modules/postcss/lib/rule.js.map +0 -1
  181. package/dist/node_modules/postcss/lib/stringifier.js.map +0 -1
  182. package/dist/node_modules/postcss/lib/stringify.js.map +0 -1
  183. package/dist/node_modules/postcss/lib/symbols.js.map +0 -1
  184. package/dist/node_modules/postcss/lib/tokenize.js.map +0 -1
  185. package/dist/node_modules/postcss/lib/warning.js.map +0 -1
  186. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js.map +0 -1
  187. /package/dist/node_modules/{nanoid → .pnpm/nanoid@3.3.11/node_modules/nanoid}/non-secure/index.js +0 -0
  188. /package/dist/{packages/model → node_modules/.pnpm/postcss-discard-duplicates@5.1.0_postcss@8.5.8}/node_modules/postcss-discard-duplicates/src/index.js +0 -0
  189. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/at-rule.js +0 -0
  190. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/comment.js +0 -0
  191. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/container.js +0 -0
  192. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/declaration.js +0 -0
  193. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/document.js +0 -0
  194. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/fromJSON.js +0 -0
  195. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/lazy-result.js +0 -0
  196. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/list.js +0 -0
  197. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/no-work-result.js +0 -0
  198. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/node.js +0 -0
  199. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/parse.js +0 -0
  200. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/parser.js +0 -0
  201. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/postcss2.js +0 -0
  202. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/processor.js +0 -0
  203. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/result.js +0 -0
  204. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/root.js +0 -0
  205. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/rule.js +0 -0
  206. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/stringifier.js +0 -0
  207. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/stringify.js +0 -0
  208. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/tokenize.js +0 -0
  209. /package/dist/node_modules/{postcss → .pnpm/postcss@8.5.8/node_modules/postcss}/lib/warning.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../../source/attributes/config.ts"],"sourcesContent":["/**\n * Declarative reactive attribute configuration.\n *\n * Defines a map of property names → attribute configs, then provides\n * helpers to derive `observedAttributes`, bulk-read values from an\n * element, and pre-resolve converters for runtime use.\n */\nimport {\n resolveConverter,\n type AttributeConverter,\n type AttributeType,\n} from './converters';\nimport { AttributeValidationError } from './errors';\nimport type { HasChangedFn } from './change-detection';\n\nexport interface ReactiveAttributeConfig<T = unknown> {\n /** Custom attribute name, or `false` to skip attribute observation. */\n attribute?: string | false;\n /** Built-in type for auto-conversion. */\n type?: AttributeType;\n /** Sync property value back to the attribute. Default: false. */\n reflect?: boolean;\n /** Custom converter (overrides `type`). */\n converter?: AttributeConverter<T>;\n /** Value used when the attribute is absent. */\n defaultValue?: T;\n /** Return an error message string to reject the value. */\n validate?: (value: T) => string | void;\n /** Called when the property value changes (not during initial seeding). */\n onChange?: (host: HTMLElement, newValue: T | undefined, oldValue: T | undefined) => void;\n /** Custom change detection — return `true` if the value has changed and should trigger an update. */\n hasChanged?: (newValue: T, oldValue: T) => boolean;\n}\n\nexport type ReactiveAttributeMap = Record<string, ReactiveAttributeConfig>;\n\nexport interface ResolvedAttributeConfig {\n propertyName: string;\n attributeName: string | false;\n type?: AttributeType;\n converter: AttributeConverter;\n reflect: boolean;\n defaultValue: unknown;\n validate?: (value: unknown) => string | void;\n onChange?: (host: HTMLElement, newValue: unknown, oldValue: unknown) => void;\n hasChanged?: HasChangedFn;\n}\n\n/**\n * Convert a camelCase property name to a kebab-case attribute name.\n * e.g. `tabletSize` → `tablet-size`\n */\nexport function toAttributeName(propName: string): string {\n return propName.replace(/[A-Z]/g, (ch) => `-${ch.toLowerCase()}`);\n}\n\n/**\n * Derive the list of attribute names to observe from a reactive map.\n * Entries with `attribute: false` are excluded.\n */\nexport function defineObservedAttributes(map: ReactiveAttributeMap): string[] {\n return Object.entries(map)\n .map(([prop, cfg]) => {\n if (cfg.attribute === false) return null;\n return cfg.attribute ?? toAttributeName(prop);\n })\n .filter((n): n is string => n !== null);\n}\n\n/**\n * Bulk-read all reactive attributes from an element, applying type\n * conversion and defaults. Returns a typed object keyed by property name.\n */\nexport function readAttributes<T extends Record<string, unknown>>(\n element: Element,\n map: ReactiveAttributeMap,\n): T {\n const result: Record<string, unknown> = {};\n\n for (const [prop, cfg] of Object.entries(map)) {\n if (cfg.attribute === false) {\n result[prop] = cfg.defaultValue;\n continue;\n }\n\n const attrName = cfg.attribute ?? toAttributeName(prop);\n const converter = cfg.converter\n ? resolveConverter(cfg.converter)\n : cfg.type\n ? resolveConverter(cfg.type)\n : resolveConverter('string');\n\n const raw = element.getAttribute(attrName);\n const converted = converter.fromAttribute(raw, attrName);\n const value = converted !== undefined ? converted : cfg.defaultValue;\n\n if (value !== undefined && cfg.validate) {\n const error = cfg.validate(value);\n if (error) {\n throw new AttributeValidationError(attrName, error);\n }\n }\n\n result[prop] = value;\n }\n\n return result as T;\n}\n\n/**\n * Pre-resolve all configs for runtime use (converter instances,\n * computed attribute names, etc.).\n */\nexport function resolveAttributeConfigs(\n map: ReactiveAttributeMap,\n): ResolvedAttributeConfig[] {\n return Object.entries(map).map(([prop, cfg]) => {\n const attributeName =\n cfg.attribute === false ? false : (cfg.attribute ?? toAttributeName(prop));\n\n const converter = cfg.converter\n ? resolveConverter(cfg.converter)\n : cfg.type\n ? resolveConverter(cfg.type)\n : resolveConverter('string');\n\n return {\n propertyName: prop,\n attributeName,\n type: cfg.type,\n converter,\n reflect: cfg.reflect ?? false,\n defaultValue: cfg.defaultValue,\n validate: cfg.validate,\n onChange: cfg.onChange as ResolvedAttributeConfig['onChange'],\n hasChanged: cfg.hasChanged as ResolvedAttribut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gB,IAAI;AAE1E,UAAM,YAAY,IAAI,YAClB,iBAAiB,IAAI,SAAS,IAC9B,IAAI,OACF,iBAAiB,IAAI,IAAI,IACzB,iBAAiB,QAAQ;AAE/B,WAAO;AAAA,MACL,cAAc;AAAA,MACd;AAAA,MACA,MAAM,IAAI;AAAA,MACV;AAAA,MACA,SAAS,IAAI,WAAW;AAAA,MACxB,cAAc,IAAI;AAAA,MAClB,UAAU,IAAI;AAAA,MACd,UAAU,IAAI;AAAA,MACd,YAAY,IAAI;AAAA,IAAA;AAAA,EAEpB,CAAC;AACH;"}
@@ -0,0 +1,14 @@
1
+ export interface AttributeConverter<T = unknown> {
2
+ fromAttribute(value: string | null, attributeName: string): T | undefined;
3
+ toAttribute(value: T): string | null;
4
+ }
5
+ export type AttributeType = 'string' | 'number' | 'boolean' | 'object' | 'array';
6
+ export declare const Converters: {
7
+ readonly string: AttributeConverter<string>;
8
+ readonly number: AttributeConverter<number>;
9
+ readonly boolean: AttributeConverter<boolean>;
10
+ readonly object: AttributeConverter<unknown>;
11
+ readonly array: AttributeConverter<unknown[]>;
12
+ };
13
+ export declare function resolveConverter<T = unknown>(typeOrConverter: AttributeType | AttributeConverter<T>): AttributeConverter<T>;
14
+ //# sourceMappingURL=converters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../source/attributes/converters.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAQ7C,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAQ1E,WAAW,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;CACtC;AAYD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAmGjF,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAUX,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,eAAe,EAAE,aAAa,GAAG,kBAAkB,CAAC,CAAC,CAAC,GACrD,kBAAkB,CAAC,CAAC,CAAC,CAKvB"}
@@ -0,0 +1,84 @@
1
+ import { AttributeTypeError } from "./errors.js";
2
+ const stringConverter = {
3
+ fromAttribute(value) {
4
+ return value ?? void 0;
5
+ },
6
+ toAttribute(value) {
7
+ return value;
8
+ }
9
+ };
10
+ const numberConverter = {
11
+ fromAttribute(value, attributeName) {
12
+ if (value === null) return void 0;
13
+ if (value.trim() === "") {
14
+ throw new AttributeTypeError(attributeName, "number", value);
15
+ }
16
+ const num = Number(value);
17
+ if (Number.isNaN(num)) {
18
+ throw new AttributeTypeError(attributeName, "number", value);
19
+ }
20
+ return num;
21
+ },
22
+ toAttribute(value) {
23
+ return String(value);
24
+ }
25
+ };
26
+ const booleanConverter = {
27
+ fromAttribute(value) {
28
+ if (value === null) return void 0;
29
+ if (value === "false") return false;
30
+ return true;
31
+ },
32
+ toAttribute(value) {
33
+ return value ? "" : null;
34
+ }
35
+ };
36
+ const objectConverter = {
37
+ fromAttribute(value, attributeName) {
38
+ if (value === null) return void 0;
39
+ try {
40
+ return JSON.parse(value);
41
+ } catch {
42
+ throw new AttributeTypeError(attributeName, "object", value);
43
+ }
44
+ },
45
+ toAttribute(value) {
46
+ return JSON.stringify(value);
47
+ }
48
+ };
49
+ const arrayConverter = {
50
+ fromAttribute(value, attributeName) {
51
+ if (value === null) return void 0;
52
+ let parsed;
53
+ try {
54
+ parsed = JSON.parse(value);
55
+ } catch {
56
+ throw new AttributeTypeError(attributeName, "array", value);
57
+ }
58
+ if (!Array.isArray(parsed)) {
59
+ throw new AttributeTypeError(attributeName, "array", value);
60
+ }
61
+ return parsed;
62
+ },
63
+ toAttribute(value) {
64
+ return JSON.stringify(value);
65
+ }
66
+ };
67
+ const Converters = {
68
+ string: stringConverter,
69
+ number: numberConverter,
70
+ boolean: booleanConverter,
71
+ object: objectConverter,
72
+ array: arrayConverter
73
+ };
74
+ function resolveConverter(typeOrConverter) {
75
+ if (typeof typeOrConverter === "string") {
76
+ return Converters[typeOrConverter];
77
+ }
78
+ return typeOrConverter;
79
+ }
80
+ export {
81
+ Converters,
82
+ resolveConverter
83
+ };
84
+ //# sourceMappingURL=converters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converters.js","sources":["../../source/attributes/converters.ts"],"sourcesContent":["/**\n * Type-safe bidirectional attribute converters.\n *\n * Each converter handles string↔value conversion for a specific type.\n * Use {@link resolveConverter} to normalize an {@link AttributeType} or custom\n * {@link AttributeConverter} into a concrete converter instance.\n *\n * @module converters\n */\nimport { AttributeTypeError } from './errors';\n\n/**\n * Bidirectional converter between HTML attribute strings and typed values.\n *\n * Implement this interface to create custom converters for\n * {@link ReactiveAttributeConfig.converter}.\n *\n * @typeParam T - The JavaScript type this converter produces/consumes.\n */\nexport interface AttributeConverter<T = unknown> {\n /**\n * Convert an HTML attribute string to a typed value.\n *\n * @param value - The raw attribute string, or `null` if the attribute was removed.\n * @param attributeName - The attribute name (used in error messages).\n * @returns The converted value, or `undefined` if the attribute is absent.\n */\n fromAttribute(value: string | null, attributeName: string): T | undefined;\n\n /**\n * Convert a typed value back to an HTML attribute string.\n *\n * @param value - The typed value to serialize.\n * @returns The attribute string, or `null` to remove the attribute.\n */\n toAttribute(value: T): string | null;\n}\n\n/**\n * Built-in attribute type identifiers.\n *\n * Each maps to a pre-built {@link AttributeConverter}:\n * - `'string'` — pass-through (no conversion)\n * - `'number'` — `Number()` with NaN guard\n * - `'boolean'` — HTML boolean attribute convention (presence = true)\n * - `'object'` — `JSON.parse` / `JSON.stringify`\n * - `'array'` — `JSON.parse` / `JSON.stringify` with `Array.isArray` validation\n */\nexport type AttributeType = 'string' | 'number' | 'boolean' | 'object' | 'array';\n\n/** String pass-through converter. Returns the raw attribute value unchanged. */\nconst stringConverter: AttributeConverter<string> = {\n fromAttribute(value) {\n return value ?? undefined;\n },\n toAttribute(value) {\n return value;\n },\n};\n\n/**\n * Numeric converter. Parses with `Number()` and throws\n * {@link AttributeTypeError} for NaN or empty strings.\n */\nconst numberConverter: AttributeConverter<number> = {\n fromAttribute(value, attributeName) {\n if (value === null) return undefined;\n if (value.trim() === '') {\n throw new AttributeTypeError(attributeName, 'number', value);\n }\n const num = Number(value);\n if (Number.isNaN(num)) {\n throw new AttributeTypeError(attributeName, 'number', value);\n }\n return num;\n },\n toAttribute(value) {\n return String(value);\n },\n};\n\n/**\n * Boolean converter following HTML boolean attribute conventions.\n *\n * - Attribute present (any value except `\"false\"`) → `true`\n * - Attribute value `\"false\"` → `false`\n * - Attribute absent (`null`) → `undefined`\n * - `toAttribute`: `true` → `\"\"` (present), `false` → `null` (removed)\n */\nconst booleanConverter: AttributeConverter<boolean> = {\n fromAttribute(value) {\n if (value === null) return undefined;\n if (value === 'false') return false;\n return true;\n },\n toAttribute(value) {\n return value ? '' : null;\n },\n};\n\n/**\n * JSON object converter. Parses with `JSON.parse` and serializes with\n * `JSON.stringify`. Throws {@link AttributeTypeError} for invalid JSON.\n */\nconst objectConverter: AttributeConverter<unknown> = {\n fromAttribute(value, attributeName) {\n if (value === null) return undefined;\n try {\n return JSON.parse(value);\n } catch {\n throw new AttributeTypeError(attributeName, 'object', value);\n }\n },\n toAttribute(value) {\n return JSON.stringify(value);\n },\n};\n\n/**\n * JSON array converter. Same as {@link objectConverter} but additionally\n * validates that the parsed result is an array. Throws\n * {@link AttributeTypeError} if the parsed JSON is not an array.\n */\nconst arrayConverter: AttributeConverter<unknown[]> = {\n fromAttribute(value, attributeName) {\n if (value === null) return undefined;\n let parsed: unknown;\n try {\n parsed = JSON.parse(value);\n } catch {\n throw new AttributeTypeError(attributeName, 'array', value);\n }\n if (!Array.isArray(parsed)) {\n throw new AttributeTypeError(attributeName, 'array', value);\n }\n return parsed;\n },\n toAttribute(value) {\n return JSON.stringify(value);\n },\n};\n\n/**\n * Map of built-in {@link AttributeType} identifiers to their converter instances.\n *\n * Access directly or use {@link resolveConverter} for type-safe resolution.\n */\nexport const Converters = {\n string: stringConverter,\n number: numberConverter,\n boolean: booleanConverter,\n object: objectConverter,\n array: arrayConverter,\n} as const;\n\n/**\n * Resolve an {@link AttributeType} string or custom {@link AttributeConverter}\n * into a concrete converter instance.\n *\n * @typeParam T - The target value type.\n * @param typeOrConverter - A built-in type name or custom converter.\n * @returns The resolved converter instance.\n */\nexport function resolveConverter<T = unknown>(\n typeOrConverter: AttributeType | AttributeConverter<T>,\n): AttributeConverter<T> {\n if (typeof typeOrConverter === 'string') {\n return Converters[typeOrConverter] as unknown as AttributeConverter<T>;\n }\n return typeOrConverter;\n}\n"],"names":[],"mappings":";AAmDA,MAAM,kBAA8C;AAAA,EAClD,cAAc,OAAO;AACnB,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,YAAY,OAAO;AACjB,WAAO;AAAA,EACT;AACF;AAMA,MAAM,kBAA8C;AAAA,EAClD,cAAc,OAAO,eAAe;AAClC,QAAI,UAAU,KAAM,QAAO;AAC3B,QAAI,MAAM,KAAA,MAAW,IAAI;AACvB,YAAM,IAAI,mBAAmB,eAAe,UAAU,KAAK;AAAA,IAC7D;AACA,UAAM,MAAM,OAAO,KAAK;AACxB,QAAI,OAAO,MAAM,GAAG,GAAG;AACrB,YAAM,IAAI,mBAAmB,eAAe,UAAU,KAAK;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AAAA,EACA,YAAY,OAAO;AACjB,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAUA,MAAM,mBAAgD;AAAA,EACpD,cAAc,OAAO;AACnB,QAAI,UAAU,KAAM,QAAO;AAC3B,QAAI,UAAU,QAAS,QAAO;AAC9B,WAAO;AAAA,EACT;AAAA,EACA,YAAY,OAAO;AACjB,WAAO,QAAQ,KAAK;AAAA,EACtB;AACF;AAMA,MAAM,kBAA+C;AAAA,EACnD,cAAc,OAAO,eAAe;AAClC,QAAI,UAAU,KAAM,QAAO;AAC3B,QAAI;AACF,aAAO,KAAK,MAAM,KAAK;AAAA,IACzB,QAAQ;AACN,YAAM,IAAI,mBAAmB,eAAe,UAAU,KAAK;AAAA,IAC7D;AAAA,EACF;AAAA,EACA,YAAY,OAAO;AACjB,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AACF;AAOA,MAAM,iBAAgD;AAAA,EACpD,cAAc,OAAO,eAAe;AAClC,QAAI,UAAU,KAAM,QAAO;AAC3B,QAAI;AACJ,QAAI;AACF,eAAS,KAAK,MAAM,KAAK;AAAA,IAC3B,QAAQ;AACN,YAAM,IAAI,mBAAmB,eAAe,SAAS,KAAK;AAAA,IAC5D;AACA,QAAI,CAAC,MAAM,QAAQ,MAAM,GAAG;AAC1B,YAAM,IAAI,mBAAmB,eAAe,SAAS,KAAK;AAAA,IAC5D;AACA,WAAO;AAAA,EACT;AAAA,EACA,YAAY,OAAO;AACjB,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AACF;AAOO,MAAM,aAAa;AAAA,EACxB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAUO,SAAS,iBACd,iBACuB;AACvB,MAAI,OAAO,oBAAoB,UAAU;AACvC,WAAO,WAAW,eAAe;AAAA,EACnC;AACA,SAAO;AACT;"}
@@ -0,0 +1,16 @@
1
+ export declare class AttributeTypeError extends TypeError {
2
+ readonly attributeName: string;
3
+ readonly expectedType: string;
4
+ readonly actualValue: string | null;
5
+ readonly componentName?: string;
6
+ constructor(attributeName: string, expectedType: string, actualValue: string | null, componentName?: string);
7
+ }
8
+ export declare class AttributeValidationError extends Error {
9
+ readonly attributeName: string;
10
+ readonly constraint: string;
11
+ readonly componentName?: string;
12
+ constructor(attributeName: string, constraint: string, componentName?: string);
13
+ }
14
+ export declare function devWarning(message: string): void;
15
+ export declare function reportAttributeErrors(componentName: string, errors: Error[]): void;
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../source/attributes/errors.ts"],"names":[],"mappings":"AAWA,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;gBAG9B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,aAAa,CAAC,EAAE,MAAM;CAYzB;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;gBAEpB,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;CAU9E;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhD;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAYlF"}
@@ -0,0 +1,51 @@
1
+ import { isDev, createLogger } from "../utilities/debug.js";
2
+ class AttributeTypeError extends TypeError {
3
+ constructor(attributeName, expectedType, actualValue, componentName) {
4
+ const prefix = componentName ? `[${componentName}] ` : "";
5
+ super(
6
+ `${prefix}Attribute "${attributeName}" expected type "${expectedType}" but received "${actualValue}"`
7
+ );
8
+ this.name = "AttributeTypeError";
9
+ this.attributeName = attributeName;
10
+ this.expectedType = expectedType;
11
+ this.actualValue = actualValue;
12
+ this.componentName = componentName;
13
+ }
14
+ }
15
+ class AttributeValidationError extends Error {
16
+ constructor(attributeName, constraint, componentName) {
17
+ const prefix = componentName ? `[${componentName}] ` : "";
18
+ super(
19
+ `${prefix}Attribute "${attributeName}" failed validation: ${constraint}`
20
+ );
21
+ this.name = "AttributeValidationError";
22
+ this.attributeName = attributeName;
23
+ this.constraint = constraint;
24
+ this.componentName = componentName;
25
+ }
26
+ }
27
+ function devWarning(message) {
28
+ if (isDev()) {
29
+ console.warn(`[UMD-DS]`, message);
30
+ }
31
+ }
32
+ function reportAttributeErrors(componentName, errors) {
33
+ if (errors.length === 0) return;
34
+ const logger = createLogger(componentName);
35
+ if (errors.length === 1) {
36
+ logger.error(errors[0].message);
37
+ return;
38
+ }
39
+ logger.group(`${errors.length} attribute errors`);
40
+ for (const err of errors) {
41
+ logger.error(err.message);
42
+ }
43
+ logger.groupEnd();
44
+ }
45
+ export {
46
+ AttributeTypeError,
47
+ AttributeValidationError,
48
+ devWarning,
49
+ reportAttributeErrors
50
+ };
51
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["../../source/attributes/errors.ts"],"sourcesContent":["/**\n * Custom error types for the reactive attribute system.\n *\n * - `AttributeTypeError` — thrown when type conversion fails\n * - `AttributeValidationError` — thrown when validation fails\n * - `devWarning` — logs a warning only in dev mode\n * - `reportAttributeErrors` — groups multiple attribute errors under a component logger\n */\n\nimport { isDev, createLogger } from '../utilities/debug';\n\nexport class AttributeTypeError extends TypeError {\n readonly attributeName: string;\n readonly expectedType: string;\n readonly actualValue: string | null;\n readonly componentName?: string;\n\n constructor(\n attributeName: string,\n expectedType: string,\n actualValue: string | null,\n componentName?: string,\n ) {\n const prefix = componentName ? `[${componentName}] ` : '';\n super(\n `${prefix}Attribute \"${attributeName}\" expected type \"${expectedType}\" but received \"${actualValue}\"`,\n );\n this.name = 'AttributeTypeError';\n this.attributeName = attributeName;\n this.expectedType = expectedType;\n this.actualValue = actualValue;\n this.componentName = componentName;\n }\n}\n\nexport class AttributeValidationError extends Error {\n readonly attributeName: string;\n readonly constraint: string;\n readonly componentName?: string;\n\n constructor(attributeName: string, constraint: string, componentName?: string) {\n const prefix = componentName ? `[${componentName}] ` : '';\n super(\n `${prefix}Attribute \"${attributeName}\" failed validation: ${constraint}`,\n );\n this.name = 'AttributeValidationError';\n this.attributeName = attributeName;\n this.constraint = constraint;\n this.componentName = componentName;\n }\n}\n\nexport function devWarning(message: string): void {\n if (isDev()) {\n console.warn(`[UMD-DS]`, message);\n }\n}\n\nexport function reportAttributeErrors(componentName: string, errors: Error[]): void {\n if (errors.length === 0) return;\n const logger = createLogger(componentName);\n if (errors.length === 1) {\n logger.error(errors[0].message);\n return;\n }\n logger.group(`${errors.length} attribute errors`);\n for (const err of errors) {\n logger.error(err.message);\n }\n logger.groupEnd();\n}\n"],"names":[],"mappings":";AAWO,MAAM,2BAA2B,UAAU;AAAA,EAMhD,YACE,eACA,cACA,aACA,eACA;AACA,UAAM,SAAS,gBAAgB,IAAI,aAAa,OAAO;AACvD;AAAA,MACE,GAAG,MAAM,cAAc,aAAa,oBAAoB,YAAY,mBAAmB,WAAW;AAAA,IAAA;AAEpG,SAAK,OAAO;AACZ,SAAK,gBAAgB;AACrB,SAAK,eAAe;AACpB,SAAK,cAAc;AACnB,SAAK,gBAAgB;AAAA,EACvB;AACF;AAEO,MAAM,iCAAiC,MAAM;AAAA,EAKlD,YAAY,eAAuB,YAAoB,eAAwB;AAC7E,UAAM,SAAS,gBAAgB,IAAI,aAAa,OAAO;AACvD;AAAA,MACE,GAAG,MAAM,cAAc,aAAa,wBAAwB,UAAU;AAAA,IAAA;AAExE,SAAK,OAAO;AACZ,SAAK,gBAAgB;AACrB,SAAK,aAAa;AAClB,SAAK,gBAAgB;AAAA,EACvB;AACF;AAEO,SAAS,WAAW,SAAuB;AAChD,MAAI,SAAS;AACX,YAAQ,KAAK,YAAY,OAAO;AAAA,EAClC;AACF;AAEO,SAAS,sBAAsB,eAAuB,QAAuB;AAClF,MAAI,OAAO,WAAW,EAAG;AACzB,QAAM,SAAS,aAAa,aAAa;AACzC,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO,MAAM,OAAO,CAAC,EAAE,OAAO;AAC9B;AAAA,EACF;AACA,SAAO,MAAM,GAAG,OAAO,MAAM,mBAAmB;AAChD,aAAW,OAAO,QAAQ;AACxB,WAAO,MAAM,IAAI,OAAO;AAAA,EAC1B;AACA,SAAO,SAAA;AACT;"}
@@ -4,4 +4,8 @@ import { AttributeValues as values } from './values';
4
4
  export { hasInfo, hasDecoration, includesFeature, isDisplay, isData, isInfo, isLayout, isSharing, includesSharing, isTheme, isVisual, getValue, type AttributeElementProps, } from './checks';
5
5
  export { handler, names, values };
6
6
  export type { AttributeElementRef, AttributeCallback, AttributeHandlerConfig, AttributeHandlerProps, } from './handler';
7
+ export { AttributeTypeError, AttributeValidationError, devWarning, reportAttributeErrors } from './errors';
8
+ export { Converters, resolveConverter, type AttributeConverter, type AttributeType, } from './converters';
9
+ export { toAttributeName, defineObservedAttributes, readAttributes, resolveAttributeConfigs, type ReactiveAttributeConfig, type ReactiveAttributeMap, type ResolvedAttributeConfig, } from './config';
10
+ export { defaultEquality, jsonEquality, ChangeDetector, ChangeDetectors, type EqualityFn, type HasChangedFn, } from './change-detection';
7
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/attributes/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,eAAe,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,EACP,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/attributes/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,eAAe,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,EACP,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;AAGnB,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC3G,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC"}
@@ -2,7 +2,19 @@ import { handler } from "./attributes/handler.js";
2
2
  import { AttributeNames } from "./attributes/names.js";
3
3
  import { AttributeValues } from "./attributes/values.js";
4
4
  import { getValue, hasDecoration, hasInfo, includesFeature, includesSharing, isData, isDisplay, isInfo, isLayout, isSharing, isTheme, isVisual } from "./attributes/checks.js";
5
+ import { AttributeTypeError, AttributeValidationError, devWarning, reportAttributeErrors } from "./attributes/errors.js";
6
+ import { Converters, resolveConverter } from "./attributes/converters.js";
7
+ import { defineObservedAttributes, readAttributes, resolveAttributeConfigs, toAttributeName } from "./attributes/config.js";
8
+ import { ChangeDetector, ChangeDetectors, defaultEquality, jsonEquality } from "./attributes/change-detection.js";
5
9
  export {
10
+ AttributeTypeError,
11
+ AttributeValidationError,
12
+ ChangeDetector,
13
+ ChangeDetectors,
14
+ Converters,
15
+ defaultEquality,
16
+ defineObservedAttributes,
17
+ devWarning,
6
18
  getValue,
7
19
  handler,
8
20
  hasDecoration,
@@ -16,7 +28,13 @@ export {
16
28
  isSharing,
17
29
  isTheme,
18
30
  isVisual,
31
+ jsonEquality,
19
32
  AttributeNames as names,
33
+ readAttributes,
34
+ reportAttributeErrors,
35
+ resolveAttributeConfigs,
36
+ resolveConverter,
37
+ toAttributeName,
20
38
  AttributeValues as values
21
39
  };
22
40
  //# sourceMappingURL=attributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"attributes.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ import * as Attributes from './attributes';
4
4
  import * as Model from './model';
5
5
  import * as Register from './utilities/register';
6
6
  import * as Lifecycle from './utilities/lifecycle';
7
+ import * as Testing from './testing';
7
8
  export type * from './_types';
8
- export { Attributes, Model, Register, Slots, Lifecycle };
9
+ export { Attributes, Model, Register, Slots, Lifecycle, Testing };
9
10
  export type { SlotProps, BaseProps, OptionalProps, SlotResult };
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AA8DA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAGxB,mBAAmB,UAAU,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAGzD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AA8DA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAGxB,mBAAmB,UAAU,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAGlE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -3,11 +3,13 @@ import * as model from "./model.js";
3
3
  import * as register from "./utilities/register.js";
4
4
  import { Slots } from "./slots.js";
5
5
  import * as lifecycle from "./utilities/lifecycle.js";
6
+ import * as testing from "./testing.js";
6
7
  export {
7
8
  attributes as Attributes,
8
9
  lifecycle as Lifecycle,
9
10
  model as Model,
10
11
  register as Register,
11
- Slots
12
+ Slots,
13
+ testing as Testing
12
14
  };
13
15
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,22 @@
1
+ import { ReactiveController, ReactiveControllerHost } from '../_types';
2
+ export declare class IntersectionController implements ReactiveController {
3
+ private _host;
4
+ private _observer;
5
+ private _options;
6
+ isIntersecting: boolean;
7
+ entries: IntersectionObserverEntry[];
8
+ constructor(host: ReactiveControllerHost, options?: IntersectionObserverInit);
9
+ hostConnected(): void;
10
+ hostDisconnected(): void;
11
+ }
12
+ export declare class MediaQueryController implements ReactiveController {
13
+ private _host;
14
+ private _mql;
15
+ private _handler;
16
+ private _query;
17
+ matches: boolean;
18
+ constructor(host: ReactiveControllerHost, query: string);
19
+ hostConnected(): void;
20
+ hostDisconnected(): void;
21
+ }
22
+ //# sourceMappingURL=controllers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controllers.d.ts","sourceRoot":"","sources":["../../source/model/controllers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAM5E,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,QAAQ,CAA2B;IAE3C,cAAc,UAAS;IACvB,OAAO,EAAE,yBAAyB,EAAE,CAAM;gBAE9B,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAM5E,aAAa,IAAI,IAAI;IASrB,gBAAgB,IAAI,IAAI;CAIzB;AAMD,qBAAa,oBAAqB,YAAW,kBAAkB;IAC7D,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,IAAI,CAA+B;IAC3C,OAAO,CAAC,QAAQ,CAAmD;IACnE,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,UAAS;gBAEJ,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM;IAMvD,aAAa,IAAI,IAAI;IAUrB,gBAAgB,IAAI,IAAI;CAOzB"}
@@ -0,0 +1,53 @@
1
+ class IntersectionController {
2
+ constructor(host, options) {
3
+ this._observer = null;
4
+ this.isIntersecting = false;
5
+ this.entries = [];
6
+ this._host = host;
7
+ this._options = options ?? {};
8
+ host.addController(this);
9
+ }
10
+ hostConnected() {
11
+ this._observer = new IntersectionObserver((entries) => {
12
+ this.entries = entries;
13
+ this.isIntersecting = entries.some((e) => e.isIntersecting);
14
+ this._host.requestUpdate();
15
+ }, this._options);
16
+ this._observer.observe(this._host);
17
+ }
18
+ hostDisconnected() {
19
+ this._observer?.disconnect();
20
+ this._observer = null;
21
+ }
22
+ }
23
+ class MediaQueryController {
24
+ constructor(host, query) {
25
+ this._mql = null;
26
+ this._handler = null;
27
+ this.matches = false;
28
+ this._host = host;
29
+ this._query = query;
30
+ host.addController(this);
31
+ }
32
+ hostConnected() {
33
+ this._mql = window.matchMedia(this._query);
34
+ this.matches = this._mql.matches;
35
+ this._handler = (e) => {
36
+ this.matches = e.matches;
37
+ this._host.requestUpdate();
38
+ };
39
+ this._mql.addEventListener("change", this._handler);
40
+ }
41
+ hostDisconnected() {
42
+ if (this._mql && this._handler) {
43
+ this._mql.removeEventListener("change", this._handler);
44
+ }
45
+ this._mql = null;
46
+ this._handler = null;
47
+ }
48
+ }
49
+ export {
50
+ IntersectionController,
51
+ MediaQueryController
52
+ };
53
+ //# sourceMappingURL=controllers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controllers.js","sources":["../../source/model/controllers.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from '../_types';\n\n/**\n * Tracks viewport intersection using IntersectionObserver.\n * Calls host.requestUpdate() when intersection state changes.\n */\nexport class IntersectionController implements ReactiveController {\n private _host: ReactiveControllerHost;\n private _observer: IntersectionObserver | null = null;\n private _options: IntersectionObserverInit;\n\n isIntersecting = false;\n entries: IntersectionObserverEntry[] = [];\n\n constructor(host: ReactiveControllerHost, options?: IntersectionObserverInit) {\n this._host = host;\n this._options = options ?? {};\n host.addController(this);\n }\n\n hostConnected(): void {\n this._observer = new IntersectionObserver((entries) => {\n this.entries = entries;\n this.isIntersecting = entries.some((e) => e.isIntersecting);\n this._host.requestUpdate();\n }, this._options);\n this._observer.observe(this._host);\n }\n\n hostDisconnected(): void {\n this._observer?.disconnect();\n this._observer = null;\n }\n}\n\n/**\n * Tracks a CSS media query match state.\n * Calls host.requestUpdate() when match changes.\n */\nexport class MediaQueryController implements ReactiveController {\n private _host: ReactiveControllerHost;\n private _mql: MediaQueryList | null = null;\n private _handler: ((e: MediaQueryListEvent) => void) | null = null;\n private _query: string;\n\n matches = false;\n\n constructor(host: ReactiveControllerHost, query: string) {\n this._host = host;\n this._query = query;\n host.addController(this);\n }\n\n hostConnected(): void {\n this._mql = window.matchMedia(this._query);\n this.matches = this._mql.matches;\n this._handler = (e) => {\n this.matches = e.matches;\n this._host.requestUpdate();\n };\n this._mql.addEventListener('change', this._handler);\n }\n\n hostDisconnected(): void {\n if (this._mql && this._handler) {\n this._mql.removeEventListener('change', this._handler);\n }\n this._mql = null;\n this._handler = null;\n }\n}\n"],"names":[],"mappings":"AAMO,MAAM,uBAAqD;AAAA,EAQhE,YAAY,MAA8B,SAAoC;AAN9E,SAAQ,YAAyC;AAGjD,SAAA,iBAAiB;AACjB,SAAA,UAAuC,CAAA;AAGrC,SAAK,QAAQ;AACb,SAAK,WAAW,WAAW,CAAA;AAC3B,SAAK,cAAc,IAAI;AAAA,EACzB;AAAA,EAEA,gBAAsB;AACpB,SAAK,YAAY,IAAI,qBAAqB,CAAC,YAAY;AACrD,WAAK,UAAU;AACf,WAAK,iBAAiB,QAAQ,KAAK,CAAC,MAAM,EAAE,cAAc;AAC1D,WAAK,MAAM,cAAA;AAAA,IACb,GAAG,KAAK,QAAQ;AAChB,SAAK,UAAU,QAAQ,KAAK,KAAK;AAAA,EACnC;AAAA,EAEA,mBAAyB;AACvB,SAAK,WAAW,WAAA;AAChB,SAAK,YAAY;AAAA,EACnB;AACF;AAMO,MAAM,qBAAmD;AAAA,EAQ9D,YAAY,MAA8B,OAAe;AANzD,SAAQ,OAA8B;AACtC,SAAQ,WAAsD;AAG9D,SAAA,UAAU;AAGR,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,cAAc,IAAI;AAAA,EACzB;AAAA,EAEA,gBAAsB;AACpB,SAAK,OAAO,OAAO,WAAW,KAAK,MAAM;AACzC,SAAK,UAAU,KAAK,KAAK;AACzB,SAAK,WAAW,CAAC,MAAM;AACrB,WAAK,UAAU,EAAE;AACjB,WAAK,MAAM,cAAA;AAAA,IACb;AACA,SAAK,KAAK,iBAAiB,UAAU,KAAK,QAAQ;AAAA,EACpD;AAAA,EAEA,mBAAyB;AACvB,QAAI,KAAK,QAAQ,KAAK,UAAU;AAC9B,WAAK,KAAK,oBAAoB,UAAU,KAAK,QAAQ;AAAA,IACvD;AACA,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AACF;"}
@@ -0,0 +1,13 @@
1
+ export type RegistrationFailureReason = 'conflict' | 'invalid-name' | 'missing-constructor';
2
+ export declare class ComponentRegistrationError extends Error {
3
+ readonly tagName: string;
4
+ readonly reason: RegistrationFailureReason;
5
+ readonly existingConstructor?: CustomElementConstructor;
6
+ constructor(tagName: string, reason: RegistrationFailureReason, message: string, existingConstructor?: CustomElementConstructor);
7
+ }
8
+ export declare class BatchRegistrationError extends Error {
9
+ readonly errors: ComponentRegistrationError[];
10
+ readonly succeeded: string[];
11
+ constructor(errors: ComponentRegistrationError[], succeeded: string[]);
12
+ }
13
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../source/model/errors.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,yBAAyB,GACjC,UAAU,GACV,cAAc,GACd,qBAAqB,CAAC;AAE1B,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;gBAGtD,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,yBAAyB,EACjC,OAAO,EAAE,MAAM,EACf,mBAAmB,CAAC,EAAE,wBAAwB;CAQjD;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,MAAM,EAAE,0BAA0B,EAAE,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;gBAG3B,MAAM,EAAE,0BAA0B,EAAE,EACpC,SAAS,EAAE,MAAM,EAAE;CAQtB"}
@@ -0,0 +1,23 @@
1
+ class ComponentRegistrationError extends Error {
2
+ constructor(tagName, reason, message, existingConstructor) {
3
+ super(`[${tagName}] ${message}`);
4
+ this.name = "ComponentRegistrationError";
5
+ this.tagName = tagName;
6
+ this.reason = reason;
7
+ this.existingConstructor = existingConstructor;
8
+ }
9
+ }
10
+ class BatchRegistrationError extends Error {
11
+ constructor(errors, succeeded) {
12
+ const names = errors.map((e) => e.tagName).join(", ");
13
+ super(`Batch registration failed for: ${names}`);
14
+ this.name = "BatchRegistrationError";
15
+ this.errors = errors;
16
+ this.succeeded = succeeded;
17
+ }
18
+ }
19
+ export {
20
+ BatchRegistrationError,
21
+ ComponentRegistrationError
22
+ };
23
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["../../source/model/errors.ts"],"sourcesContent":["/**\n * Registration-specific error classes.\n *\n * - `ComponentRegistrationError` — thrown when a single component fails to register\n * - `BatchRegistrationError` — thrown when one or more components fail in a batch\n */\n\nexport type RegistrationFailureReason =\n | 'conflict'\n | 'invalid-name'\n | 'missing-constructor';\n\nexport class ComponentRegistrationError extends Error {\n readonly tagName: string;\n readonly reason: RegistrationFailureReason;\n readonly existingConstructor?: CustomElementConstructor;\n\n constructor(\n tagName: string,\n reason: RegistrationFailureReason,\n message: string,\n existingConstructor?: CustomElementConstructor,\n ) {\n super(`[${tagName}] ${message}`);\n this.name = 'ComponentRegistrationError';\n this.tagName = tagName;\n this.reason = reason;\n this.existingConstructor = existingConstructor;\n }\n}\n\nexport class BatchRegistrationError extends Error {\n readonly errors: ComponentRegistrationError[];\n readonly succeeded: string[];\n\n constructor(\n errors: ComponentRegistrationError[],\n succeeded: string[],\n ) {\n const names = errors.map((e) => e.tagName).join(', ');\n super(`Batch registration failed for: ${names}`);\n this.name = 'BatchRegistrationError';\n this.errors = errors;\n this.succeeded = succeeded;\n }\n}\n"],"names":[],"mappings":"AAYO,MAAM,mCAAmC,MAAM;AAAA,EAKpD,YACE,SACA,QACA,SACA,qBACA;AACA,UAAM,IAAI,OAAO,KAAK,OAAO,EAAE;AAC/B,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,SAAS;AACd,SAAK,sBAAsB;AAAA,EAC7B;AACF;AAEO,MAAM,+BAA+B,MAAM;AAAA,EAIhD,YACE,QACA,WACA;AACA,UAAM,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI;AACpD,UAAM,kCAAkC,KAAK,EAAE;AAC/C,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,YAAY;AAAA,EACnB;AACF;"}
@@ -1,25 +1,46 @@
1
- import { SlotConfig, ComponentEventDetail, ElementRef } from '../_types';
1
+ import { Logger } from '../utilities/debug';
2
+ import { ReactiveAttributeMap, ResolvedAttributeConfig } from '../attributes/config';
3
+ import { ChangeDetector } from '../attributes/change-detection';
4
+ import { RegisterOptions } from './registration';
5
+ import { SlotConfig, ComponentEventDetail, ElementRef, PropertyValues, ReactiveController, ReactiveControllerHost } from '../_types';
2
6
  interface AttributeConfig {
3
7
  name: string;
4
8
  handler: (element: ElementRef, oldValue: string, newValue: string) => void;
5
9
  }
6
10
  interface ComponentLifecycle {
11
+ firstConnected?: (host: HTMLElement, shadow: ShadowRoot) => void;
12
+ willFirstUpdate?: (host: HTMLElement, shadow: ShadowRoot) => void;
7
13
  beforeConnect?: (ref: ElementRef, shadow: ShadowRoot) => void;
8
14
  afterConnect?: (ref: ElementRef, shadow: ShadowRoot) => void;
9
15
  onReady?: (ref: ElementRef, shadow: ShadowRoot) => void;
16
+ willUpdate?: (host: HTMLElement, changedProperties: PropertyValues) => void;
17
+ update?: (host: HTMLElement, changedProperties: PropertyValues) => void;
18
+ updated?: (host: HTMLElement, changedProperties: PropertyValues) => void;
10
19
  }
11
20
  interface ComponentConfig extends ComponentLifecycle {
12
21
  tagName: string;
13
22
  attributes?: AttributeConfig[];
23
+ reactiveAttributes?: ReactiveAttributeMap;
14
24
  slots?: Record<string, SlotConfig>;
15
25
  createComponent: (host: HTMLElement) => ElementRef;
16
26
  }
17
27
  declare const ComponentConfig: (config: ComponentConfig) => <T extends typeof BaseComponent>(constructor: T) => T;
18
- declare class BaseComponent extends HTMLElement {
28
+ declare class BaseComponent extends HTMLElement implements ReactiveControllerHost {
19
29
  static componentConfig: ComponentConfig;
20
30
  protected shadow: ShadowRoot;
21
31
  protected elementRef: ElementRef | null;
22
32
  protected config: ComponentConfig;
33
+ protected _logger: Logger;
34
+ protected _resolvedReactiveAttrs: ResolvedAttributeConfig[];
35
+ protected _changeDetector: ChangeDetector;
36
+ protected _reactiveValues: Map<string, unknown>;
37
+ private _isReflecting;
38
+ private _hasConnected;
39
+ private _hasFirstUpdated;
40
+ private _updateScheduler;
41
+ private _changedProperties;
42
+ private _isUpdating;
43
+ private _pendingPreUpgrade;
23
44
  constructor();
24
45
  static get observedAttributes(): string[];
25
46
  connectedCallback(): void;
@@ -30,14 +51,44 @@ declare class BaseComponent extends HTMLElement {
30
51
  protected validateConfig(): void;
31
52
  protected afterInit(): Promise<void>;
32
53
  protected handleAttributeChange(name: string, oldValue: string, newValue: string): void;
54
+ private capturePreUpgradeProperty;
55
+ private applyPreUpgradeProperties;
56
+ protected setupReactiveAttributes(): void;
57
+ private _slotCleanups;
58
+ private _controllers;
59
+ addController(controller: ReactiveController): void;
60
+ removeController(controller: ReactiveController): void;
61
+ requestUpdate(name?: string, oldValue?: unknown): void;
62
+ get updateComplete(): Promise<boolean>;
63
+ protected willUpdate(_changedProperties: PropertyValues): void;
64
+ protected update(_changedProperties: PropertyValues): void;
65
+ protected updated(_changedProperties: PropertyValues): void;
66
+ private _performUpdate;
67
+ private notifyControllers;
68
+ querySlot(slotName?: string, selector?: string): Element[];
69
+ querySlotElement<T extends Element = Element>(slotName?: string, selector?: string): T | null;
70
+ hasSlotContent(slotName?: string): boolean;
33
71
  protected cleanup(): void;
34
72
  protected dispatchComponentEvent<T extends ComponentEventDetail>(eventName: string, detail: Omit<T, 'tagName' | 'element' | 'timestamp'>): void;
35
73
  protected handleError(message: string, error: unknown): void;
36
74
  private validateSlots;
75
+ private reportSlotErrors;
76
+ private setupSlotObservers;
37
77
  private executeLifecycleCallbacks;
38
78
  private executeCallback;
39
79
  getRef(): ElementRef | null;
80
+ getShadowRoot(): ShadowRoot;
81
+ private executeFirstConnected;
82
+ protected firstConnected(): void;
83
+ private executeWillFirstUpdate;
84
+ protected willFirstUpdate(): void;
40
85
  }
41
86
  declare const createCustomElement: (config: ComponentConfig) => typeof BaseComponent;
42
- export { createCustomElement, BaseComponent, type ComponentConfig, type AttributeConfig, };
87
+ declare const defineComponent: (config: ComponentConfig, options?: RegisterOptions) => (() => void);
88
+ export { createCustomElement, defineComponent, BaseComponent, type ComponentConfig, type AttributeConfig, };
89
+ export { IntersectionController, MediaQueryController } from './controllers';
90
+ export type { ReactiveController, ReactiveControllerHost } from '../_types';
91
+ export { registerComponent, registerComponents, isComponentRegistered, whenComponentDefined, getComponentConstructor, } from './registration';
92
+ export type { RegisterOptions } from './registration';
93
+ export { ComponentRegistrationError, BatchRegistrationError } from './errors';
43
94
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/model/index.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EAGpB,UAAU,EACX,MAAM,WAAW,CAAC;AAEnB,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5E;AASD,UAAU,kBAAkB;IAC1B,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9D,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACzD;AAED,UAAU,eAAgB,SAAQ,kBAAkB;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,UAAU,CAAC;CACpD;AA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AAe,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface RegisterOptions {
2
+ eager?: boolean;
3
+ registry?: CustomElementRegistry;
4
+ }
5
+ export declare function registerComponent(tagName: string, element: CustomElementConstructor, options?: RegisterOptions): boolean;
6
+ export declare function isComponentRegistered(tagName: string, registry?: CustomElementRegistry): boolean;
7
+ export declare function whenComponentDefined(tagName: string, registry?: CustomElementRegistry): Promise<CustomElementConstructor>;
8
+ export declare function getComponentConstructor(tagName: string, registry?: CustomElementRegistry): CustomElementConstructor | undefined;
9
+ export declare function registerComponents(components: Array<{
10
+ tagName: string;
11
+ element: CustomElementConstructor;
12
+ }>, options?: RegisterOptions): void;
13
+ //# sourceMappingURL=registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../source/model/registration.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,eAAe;IAE9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AASD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,wBAAwB,EACjC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CA8CT;AAKD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,OAAO,CAET;AAKD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CAEnC;AAKD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,wBAAwB,GAAG,SAAS,CAEtC;AAMD,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,CAAC,EACzE,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CAsBN"}