@lushly-dev/fast-element 3.0.1-preview.0 → 3.0.1-preview.2

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 (250) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/command/command.api.json +7857 -0
  3. package/dist/context/context.api.json +1084 -0
  4. package/dist/declarative/declarative.api.json +8130 -0
  5. package/dist/definition-schema/definition-schema.api.json +2689 -0
  6. package/dist/di/di.api.json +4945 -0
  7. package/dist/dts/arrays.d.ts +2 -0
  8. package/dist/dts/binding/binding.d.ts +59 -0
  9. package/dist/dts/binding/exports.d.ts +9 -0
  10. package/dist/dts/binding/normalize.d.ts +9 -0
  11. package/dist/dts/binding/one-time.d.ts +11 -0
  12. package/dist/dts/binding/one-way.d.ts +20 -0
  13. package/dist/dts/binding/signal.d.ts +36 -0
  14. package/dist/dts/binding/two-way.d.ts +44 -0
  15. package/dist/dts/command/behavior.d.ts +94 -0
  16. package/dist/dts/command/behaviors/confirm-behavior.d.ts +139 -0
  17. package/dist/dts/command/behaviors/undo-behavior.d.ts +178 -0
  18. package/dist/dts/command/command.d.ts +79 -0
  19. package/dist/dts/command/component-registry.d.ts +50 -0
  20. package/dist/dts/command/components/confirm-dialog.d.ts +117 -0
  21. package/dist/dts/command/index.d.ts +21 -0
  22. package/dist/dts/command/registry.d.ts +201 -0
  23. package/dist/dts/command/schema-validation.d.ts +45 -0
  24. package/dist/dts/command/types.d.ts +332 -0
  25. package/dist/dts/command/validation.d.ts +116 -0
  26. package/dist/dts/command/weak-ref.d.ts +11 -0
  27. package/dist/dts/components/attributes.d.ts +153 -0
  28. package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
  29. package/dist/dts/components/element-controller.d.ts +349 -0
  30. package/dist/dts/components/element-hydration.d.ts +2 -0
  31. package/dist/dts/components/enable-hydration.d.ts +66 -0
  32. package/dist/dts/components/fast-definitions.d.ts +211 -0
  33. package/dist/dts/components/fast-element-registry.d.ts +23 -0
  34. package/dist/dts/components/fast-element.d.ts +91 -0
  35. package/dist/dts/components/hydration-tracker.d.ts +110 -0
  36. package/dist/dts/components/hydration.d.ts +52 -0
  37. package/dist/dts/components/schema.d.ts +205 -0
  38. package/dist/dts/context.d.ts +171 -0
  39. package/dist/dts/debug.d.ts +5 -0
  40. package/dist/dts/declarative/attribute-map.d.ts +58 -0
  41. package/dist/dts/declarative/debug.d.ts +4 -0
  42. package/dist/dts/declarative/index.d.ts +14 -0
  43. package/dist/dts/declarative/interfaces.d.ts +8 -0
  44. package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
  45. package/dist/dts/declarative/observer-map.d.ts +89 -0
  46. package/dist/dts/declarative/runtime.d.ts +5 -0
  47. package/dist/dts/declarative/syntax.d.ts +21 -0
  48. package/dist/dts/declarative/template-bridge.d.ts +33 -0
  49. package/dist/dts/declarative/template-parser.d.ts +98 -0
  50. package/dist/dts/declarative/template.d.ts +9 -0
  51. package/dist/dts/declarative/utilities.d.ts +358 -0
  52. package/dist/dts/definition-schema/api.d.ts +42 -0
  53. package/dist/dts/definition-schema/cem.d.ts +78 -0
  54. package/dist/dts/definition-schema/extension.d.ts +18 -0
  55. package/dist/dts/definition-schema/extract.d.ts +38 -0
  56. package/dist/dts/definition-schema/index.d.ts +9 -0
  57. package/dist/dts/definition-schema/storage.d.ts +35 -0
  58. package/dist/dts/definition-schema/types.d.ts +176 -0
  59. package/dist/dts/dev-mode.d.ts +13 -0
  60. package/dist/dts/di/di.d.ts +894 -0
  61. package/dist/dts/dom-policy.d.ts +101 -0
  62. package/dist/dts/dom.d.ts +88 -0
  63. package/dist/dts/hydration/diagnostics.d.ts +93 -0
  64. package/dist/dts/hydration/exports.d.ts +18 -0
  65. package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
  66. package/dist/dts/hydration/messages.d.ts +62 -0
  67. package/dist/dts/hydration/runtime.d.ts +7 -0
  68. package/dist/dts/hydration/target-builder.d.ts +107 -0
  69. package/dist/dts/index.d.ts +51 -0
  70. package/dist/dts/index.debug.d.ts +1 -0
  71. package/dist/dts/index.rollup.d.ts +1 -0
  72. package/dist/dts/index.rollup.debug.d.ts +1 -0
  73. package/dist/dts/interfaces.d.ts +106 -0
  74. package/dist/dts/metadata.d.ts +26 -0
  75. package/dist/dts/observation/arrays.d.ts +248 -0
  76. package/dist/dts/observation/notifier.d.ts +127 -0
  77. package/dist/dts/observation/observable.d.ts +276 -0
  78. package/dist/dts/observation/update-queue.d.ts +40 -0
  79. package/dist/dts/observation/volatile.d.ts +9 -0
  80. package/dist/dts/platform.d.ts +87 -0
  81. package/dist/dts/registry.d.ts +2 -0
  82. package/dist/dts/render.d.ts +7 -0
  83. package/dist/dts/schema.d.ts +1 -0
  84. package/dist/dts/scoped/detection.d.ts +55 -0
  85. package/dist/dts/scoped/index.d.ts +68 -0
  86. package/dist/dts/scoped/mixin.d.ts +118 -0
  87. package/dist/dts/scoped/registry.d.ts +76 -0
  88. package/dist/dts/scoped/types.d.ts +48 -0
  89. package/dist/dts/state/exports.d.ts +3 -0
  90. package/dist/dts/state/reactive.d.ts +8 -0
  91. package/dist/dts/state/state.d.ts +141 -0
  92. package/dist/dts/state/visitor.d.ts +6 -0
  93. package/dist/dts/state/watch.d.ts +10 -0
  94. package/dist/dts/styles/css-directive.d.ts +50 -0
  95. package/dist/dts/styles/css.d.ts +34 -0
  96. package/dist/dts/styles/element-styles.d.ts +61 -0
  97. package/dist/dts/styles/host.d.ts +65 -0
  98. package/dist/dts/styles/style-strategy.d.ts +42 -0
  99. package/dist/dts/templating/children.d.ts +62 -0
  100. package/dist/dts/templating/compiler.d.ts +54 -0
  101. package/dist/dts/templating/html-binding-directive.d.ts +155 -0
  102. package/dist/dts/templating/html-directive.d.ts +218 -0
  103. package/dist/dts/templating/html.d.ts +1 -0
  104. package/dist/dts/templating/hydration-view.d.ts +130 -0
  105. package/dist/dts/templating/markup.d.ts +48 -0
  106. package/dist/dts/templating/node-observation.d.ts +99 -0
  107. package/dist/dts/templating/ref.d.ts +23 -0
  108. package/dist/dts/templating/render.d.ts +318 -0
  109. package/dist/dts/templating/repeat.d.ts +131 -0
  110. package/dist/dts/templating/slotted.d.ts +38 -0
  111. package/dist/dts/templating/template.d.ts +221 -0
  112. package/dist/dts/templating/view.d.ts +268 -0
  113. package/dist/dts/templating/when.d.ts +12 -0
  114. package/dist/dts/testing/exports.d.ts +3 -0
  115. package/dist/dts/testing/fakes.d.ts +16 -0
  116. package/dist/dts/testing/fixture.d.ts +84 -0
  117. package/dist/dts/testing/models.d.ts +20 -0
  118. package/dist/dts/testing/timeout.d.ts +7 -0
  119. package/dist/dts/trust/index.d.ts +8 -0
  120. package/dist/dts/trust/types.d.ts +48 -0
  121. package/dist/dts/trust/utils.d.ts +26 -0
  122. package/dist/dts/tsdoc-metadata.json +11 -0
  123. package/dist/dts/utilities.d.ts +76 -0
  124. package/dist/esm/arrays.js +1 -0
  125. package/dist/esm/binding/binding.js +18 -0
  126. package/dist/esm/binding/exports.js +6 -0
  127. package/dist/esm/binding/normalize.js +17 -0
  128. package/dist/esm/binding/one-time.js +21 -0
  129. package/dist/esm/binding/one-way.js +30 -0
  130. package/dist/esm/binding/signal.js +99 -0
  131. package/dist/esm/binding/two-way.js +109 -0
  132. package/dist/esm/command/behavior.js +155 -0
  133. package/dist/esm/command/behaviors/confirm-behavior.js +225 -0
  134. package/dist/esm/command/behaviors/undo-behavior.js +313 -0
  135. package/dist/esm/command/command.js +104 -0
  136. package/dist/esm/command/component-registry.js +107 -0
  137. package/dist/esm/command/components/confirm-dialog.js +370 -0
  138. package/dist/esm/command/index.js +22 -0
  139. package/dist/esm/command/registry.js +755 -0
  140. package/dist/esm/command/schema-validation.js +194 -0
  141. package/dist/esm/command/types.js +86 -0
  142. package/dist/esm/command/validation.js +508 -0
  143. package/dist/esm/command/weak-ref.js +5 -0
  144. package/dist/esm/components/attributes.js +219 -0
  145. package/dist/esm/components/definition-schema-transforms.js +23 -0
  146. package/dist/esm/components/element-controller.js +840 -0
  147. package/dist/esm/components/element-hydration.js +2 -0
  148. package/dist/esm/components/enable-hydration.js +123 -0
  149. package/dist/esm/components/fast-definitions.js +294 -0
  150. package/dist/esm/components/fast-element-registry.js +67 -0
  151. package/dist/esm/components/fast-element.js +82 -0
  152. package/dist/esm/components/hydration-tracker.js +211 -0
  153. package/dist/esm/components/hydration.js +187 -0
  154. package/dist/esm/components/schema.js +253 -0
  155. package/dist/esm/context.js +185 -0
  156. package/dist/esm/debug.js +71 -0
  157. package/dist/esm/declarative/attribute-map.js +122 -0
  158. package/dist/esm/declarative/debug.js +4 -0
  159. package/dist/esm/declarative/index.js +10 -0
  160. package/dist/esm/declarative/interfaces.js +9 -0
  161. package/dist/esm/declarative/observer-map-utilities.js +565 -0
  162. package/dist/esm/declarative/observer-map.js +216 -0
  163. package/dist/esm/declarative/runtime.js +14 -0
  164. package/dist/esm/declarative/syntax.js +36 -0
  165. package/dist/esm/declarative/template-bridge.js +160 -0
  166. package/dist/esm/declarative/template-parser.js +306 -0
  167. package/dist/esm/declarative/template.js +116 -0
  168. package/dist/esm/declarative/utilities.js +1069 -0
  169. package/dist/esm/definition-schema/api.js +129 -0
  170. package/dist/esm/definition-schema/cem.js +89 -0
  171. package/dist/esm/definition-schema/extension.js +53 -0
  172. package/dist/esm/definition-schema/extract.js +167 -0
  173. package/dist/esm/definition-schema/index.js +8 -0
  174. package/dist/esm/definition-schema/storage.js +58 -0
  175. package/dist/esm/definition-schema/types.js +8 -0
  176. package/dist/esm/dev-mode.js +22 -0
  177. package/dist/esm/di/di.js +1441 -0
  178. package/dist/esm/dom-policy.js +374 -0
  179. package/dist/esm/dom.js +101 -0
  180. package/dist/esm/hydration/diagnostics.js +50 -0
  181. package/dist/esm/hydration/exports.js +6 -0
  182. package/dist/esm/hydration/hydration-debugger.js +112 -0
  183. package/dist/esm/hydration/messages.js +84 -0
  184. package/dist/esm/hydration/runtime.js +33 -0
  185. package/dist/esm/hydration/target-builder.js +264 -0
  186. package/dist/esm/index.debug.js +3 -0
  187. package/dist/esm/index.js +49 -0
  188. package/dist/esm/index.rollup.debug.js +6 -0
  189. package/dist/esm/index.rollup.js +4 -0
  190. package/dist/esm/interfaces.js +55 -0
  191. package/dist/esm/metadata.js +57 -0
  192. package/dist/esm/observation/arrays.js +661 -0
  193. package/dist/esm/observation/notifier.js +162 -0
  194. package/dist/esm/observation/observable.js +324 -0
  195. package/dist/esm/observation/update-queue.js +56 -0
  196. package/dist/esm/observation/volatile.js +16 -0
  197. package/dist/esm/platform.js +98 -0
  198. package/dist/esm/registry.js +2 -0
  199. package/dist/esm/render.js +1 -0
  200. package/dist/esm/schema.js +1 -0
  201. package/dist/esm/scoped/detection.js +102 -0
  202. package/dist/esm/scoped/index.js +69 -0
  203. package/dist/esm/scoped/mixin.js +127 -0
  204. package/dist/esm/scoped/registry.js +125 -0
  205. package/dist/esm/scoped/types.js +4 -0
  206. package/dist/esm/state/exports.js +3 -0
  207. package/dist/esm/state/reactive.js +34 -0
  208. package/dist/esm/state/state.js +148 -0
  209. package/dist/esm/state/visitor.js +28 -0
  210. package/dist/esm/state/watch.js +36 -0
  211. package/dist/esm/styles/css-directive.js +36 -0
  212. package/dist/esm/styles/css.js +56 -0
  213. package/dist/esm/styles/element-styles.js +144 -0
  214. package/dist/esm/styles/host.js +1 -0
  215. package/dist/esm/styles/style-strategy.js +1 -0
  216. package/dist/esm/templating/children.js +67 -0
  217. package/dist/esm/templating/compiler.js +359 -0
  218. package/dist/esm/templating/html-binding-directive.js +288 -0
  219. package/dist/esm/templating/html-directive.js +113 -0
  220. package/dist/esm/templating/html.js +1 -0
  221. package/dist/esm/templating/hydration-view.js +228 -0
  222. package/dist/esm/templating/markup.js +83 -0
  223. package/dist/esm/templating/node-observation.js +84 -0
  224. package/dist/esm/templating/ref.js +21 -0
  225. package/dist/esm/templating/render.js +468 -0
  226. package/dist/esm/templating/repeat.js +434 -0
  227. package/dist/esm/templating/slotted.js +49 -0
  228. package/dist/esm/templating/template.js +206 -0
  229. package/dist/esm/templating/view.js +298 -0
  230. package/dist/esm/templating/when.js +22 -0
  231. package/dist/esm/testing/exports.js +3 -0
  232. package/dist/esm/testing/fakes.js +107 -0
  233. package/dist/esm/testing/fixture.js +86 -0
  234. package/dist/esm/testing/models.js +58 -0
  235. package/dist/esm/testing/timeout.js +24 -0
  236. package/dist/esm/trust/index.js +7 -0
  237. package/dist/esm/trust/types.js +6 -0
  238. package/dist/esm/trust/utils.js +126 -0
  239. package/dist/esm/utilities.js +140 -0
  240. package/dist/fast-element.api.json +26798 -0
  241. package/dist/fast-element.d.ts +3985 -0
  242. package/dist/fast-element.debug.js +7604 -0
  243. package/dist/fast-element.debug.min.js +3 -0
  244. package/dist/fast-element.js +7603 -0
  245. package/dist/fast-element.min.js +3 -0
  246. package/dist/fast-element.untrimmed.d.ts +4103 -0
  247. package/dist/observation/arrays/arrays.api.json +2621 -0
  248. package/dist/scoped/scoped.api.json +891 -0
  249. package/dist/trust/trust.api.json +629 -0
  250. package/package.json +21 -23
@@ -0,0 +1,276 @@
1
+ import { type Disposable } from "../interfaces.js";
2
+ import type { Notifier, Subscriber } from "./notifier.js";
3
+ /**
4
+ * Represents a getter/setter property accessor on an object.
5
+ * @public
6
+ */
7
+ export interface Accessor {
8
+ /**
9
+ * The name of the property.
10
+ */
11
+ name: string;
12
+ /**
13
+ * Gets the value of the property on the source object.
14
+ * @param source - The source object to access.
15
+ */
16
+ getValue(source: any): any;
17
+ /**
18
+ * Sets the value of the property on the source object.
19
+ * @param source - The source object to access.
20
+ * @param value - The value to set the property to.
21
+ */
22
+ setValue(source: any, value: any): void;
23
+ }
24
+ /**
25
+ * The signature of an arrow function capable of being evaluated
26
+ * against source data and within an execution context.
27
+ * @public
28
+ */
29
+ export type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
30
+ /**
31
+ * A record of observable property access.
32
+ * @public
33
+ */
34
+ export interface ObservationRecord {
35
+ /**
36
+ * The source object with an observable property that was accessed.
37
+ */
38
+ propertySource: any;
39
+ /**
40
+ * The name of the observable property on {@link ObservationRecord.propertySource} that was accessed.
41
+ */
42
+ propertyName: string;
43
+ }
44
+ /**
45
+ * Describes how the source's lifetime relates to its controller's lifetime.
46
+ * @public
47
+ */
48
+ export declare const SourceLifetime: Readonly<{
49
+ /**
50
+ * The source to controller lifetime relationship is unknown.
51
+ */
52
+ readonly unknown: undefined;
53
+ /**
54
+ * The source and controller lifetimes are coupled to one another.
55
+ * They can/will be GC'd together.
56
+ */
57
+ readonly coupled: 1;
58
+ }>;
59
+ /**
60
+ * Describes how the source's lifetime relates to its controller's lifetime.
61
+ * @public
62
+ */
63
+ export type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
64
+ /**
65
+ * Controls the lifecycle of an expression and provides relevant context.
66
+ * @public
67
+ */
68
+ export interface ExpressionController<TSource = any, TParent = any> {
69
+ /**
70
+ * The source the expression is evaluated against.
71
+ */
72
+ readonly source: TSource;
73
+ /**
74
+ * Indicates how the source's lifetime relates to the controller's lifetime.
75
+ */
76
+ readonly sourceLifetime?: SourceLifetime;
77
+ /**
78
+ * The context the expression is evaluated against.
79
+ */
80
+ readonly context: ExecutionContext<TParent>;
81
+ /**
82
+ * Indicates whether the controller is bound.
83
+ */
84
+ readonly isBound: boolean;
85
+ /**
86
+ * Registers an unbind handler with the controller.
87
+ * @param behavior - An object to call when the controller unbinds.
88
+ */
89
+ onUnbind(behavior: {
90
+ unbind(controller: ExpressionController<TSource, TParent>): any;
91
+ }): void;
92
+ }
93
+ /**
94
+ * Observes an expression for changes.
95
+ * @public
96
+ */
97
+ export interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
98
+ /**
99
+ * Binds the expression to the source.
100
+ * @param controller - The controller that manages the lifecycle and related
101
+ * context for the expression.
102
+ */
103
+ bind(controller: ExpressionController<TSource, TParent>): TReturn;
104
+ }
105
+ /**
106
+ * Enables evaluation of and subscription to a binding.
107
+ * @public
108
+ */
109
+ export interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
110
+ /**
111
+ * Observes the expression.
112
+ * @param source - The source for the expression.
113
+ * @param context - The context for the expression.
114
+ */
115
+ observe(source: TSource, context?: ExecutionContext): TReturn;
116
+ /**
117
+ * Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
118
+ * is observing.
119
+ */
120
+ records(): IterableIterator<ObservationRecord>;
121
+ /**
122
+ * Sets the update mode used by the observer.
123
+ * @param isAsync - Indicates whether updates should be asynchronous.
124
+ * @remarks
125
+ * By default, the update mode is asynchronous, since that provides the best
126
+ * performance for template rendering scenarios. Passing false to setMode will
127
+ * instead cause the observer to notify subscribers immediately when changes occur.
128
+ */
129
+ setMode(isAsync: boolean): void;
130
+ }
131
+ /**
132
+ * Common Observable APIs.
133
+ * @public
134
+ */
135
+ export declare const Observable: Readonly<{
136
+ /**
137
+ * @internal
138
+ * @param factory - The factory used to create array observers.
139
+ */
140
+ setArrayObserverFactory(factory: (collection: any[]) => Notifier): void;
141
+ /**
142
+ * Gets a notifier for an object or Array.
143
+ * @param source - The object or Array to get the notifier for.
144
+ */
145
+ getNotifier: <T extends Notifier = Notifier>(source: any) => T;
146
+ /**
147
+ * Records a property change for a source object.
148
+ * @param source - The object to record the change against.
149
+ * @param propertyName - The property to track as changed.
150
+ */
151
+ track(source: unknown, propertyName: string): void;
152
+ /**
153
+ * Notifies watchers that the currently executing property getter or function is volatile
154
+ * with respect to its observable dependencies.
155
+ */
156
+ trackVolatile(): void;
157
+ /**
158
+ * Notifies subscribers of a source object of changes.
159
+ * @param source - the object to notify of changes.
160
+ * @param args - The change args to pass to subscribers.
161
+ */
162
+ notify(source: unknown, args: any): void;
163
+ /**
164
+ * Defines an observable property on an object or prototype.
165
+ * @param target - The target object to define the observable on.
166
+ * @param nameOrAccessor - The name of the property to define as observable;
167
+ * or a custom accessor that specifies the property name and accessor implementation.
168
+ */
169
+ defineProperty(target: {}, nameOrAccessor: string | Accessor): void;
170
+ /**
171
+ * Finds all the observable accessors defined on the target,
172
+ * including its prototype chain.
173
+ * @param target - The target object to search for accessor on.
174
+ */
175
+ getAccessors: (target: {}) => Accessor[];
176
+ /**
177
+ * Creates a {@link ExpressionNotifier} that can watch the
178
+ * provided {@link Expression} for changes.
179
+ * @param expression - The binding to observe.
180
+ * @param initialSubscriber - An initial subscriber to changes in the binding value.
181
+ * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
182
+ */
183
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn>;
184
+ /**
185
+ * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
186
+ * on every evaluation of the value.
187
+ * @param expression - The binding to inspect.
188
+ */
189
+ isVolatileBinding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>): boolean;
190
+ }>;
191
+ /**
192
+ * Decorator: Defines an observable property on the target.
193
+ * @param target - The target to define the observable on.
194
+ * @param nameOrAccessor - The property name or accessor to define the observable as.
195
+ * @public
196
+ */
197
+ export declare function observable(target: {}, nameOrAccessor: string | Accessor): void;
198
+ /**
199
+ * Provides additional contextual information available to behaviors and expressions.
200
+ * @public
201
+ */
202
+ export interface ExecutionContext<TParent = any> {
203
+ /**
204
+ * The index of the current item within a repeat context.
205
+ */
206
+ index: number;
207
+ /**
208
+ * The length of the current collection within a repeat context.
209
+ */
210
+ length: number;
211
+ /**
212
+ * The parent data source within a nested context.
213
+ */
214
+ parent: TParent;
215
+ /**
216
+ * The parent execution context when in nested context scenarios.
217
+ */
218
+ parentContext: ExecutionContext<TParent>;
219
+ /**
220
+ * The current event within an event handler.
221
+ */
222
+ readonly event: Event;
223
+ /**
224
+ * Indicates whether the current item within a repeat context
225
+ * has an even index.
226
+ */
227
+ readonly isEven: boolean;
228
+ /**
229
+ * Indicates whether the current item within a repeat context
230
+ * has an odd index.
231
+ */
232
+ readonly isOdd: boolean;
233
+ /**
234
+ * Indicates whether the current item within a repeat context
235
+ * is the first item in the collection.
236
+ */
237
+ readonly isFirst: boolean;
238
+ /**
239
+ * Indicates whether the current item within a repeat context
240
+ * is somewhere in the middle of the collection.
241
+ */
242
+ readonly isInMiddle: boolean;
243
+ /**
244
+ * Indicates whether the current item within a repeat context
245
+ * is the last item in the collection.
246
+ */
247
+ readonly isLast: boolean;
248
+ /**
249
+ * Returns the typed event detail of a custom event.
250
+ */
251
+ eventDetail<TDetail>(): TDetail;
252
+ /**
253
+ * Returns the typed event target of the event.
254
+ */
255
+ eventTarget<TTarget extends EventTarget>(): TTarget;
256
+ }
257
+ /**
258
+ * Provides additional contextual information available to behaviors and expressions.
259
+ * @public
260
+ */
261
+ export declare const ExecutionContext: Readonly<{
262
+ /**
263
+ * A default execution context.
264
+ */
265
+ default: ExecutionContext;
266
+ /**
267
+ * Gets the current event.
268
+ * @returns An event object.
269
+ */
270
+ getEvent(): Event | null;
271
+ /**
272
+ * Sets the current event.
273
+ * @param event - An event object.
274
+ */
275
+ setEvent(event: Event | null): void;
276
+ }>;
@@ -0,0 +1,40 @@
1
+ import type { Callable } from "../interfaces.js";
2
+ /**
3
+ * A work queue used to synchronize writes to the DOM.
4
+ * @public
5
+ */
6
+ export interface UpdateQueue {
7
+ /**
8
+ * Schedules DOM update work in the next batch.
9
+ * @param callable - The callable function or object to queue.
10
+ */
11
+ enqueue(callable: Callable): void;
12
+ /**
13
+ * Resolves with the next DOM update.
14
+ */
15
+ next(): Promise<void>;
16
+ /**
17
+ * Immediately processes all work previously scheduled
18
+ * through enqueue.
19
+ * @remarks
20
+ * This also forces next() promises
21
+ * to resolve.
22
+ */
23
+ process(): void;
24
+ /**
25
+ * Sets the update mode used by enqueue.
26
+ * @param isAsync - Indicates whether DOM updates should be asynchronous.
27
+ * @remarks
28
+ * By default, the update mode is asynchronous, since that provides the best
29
+ * performance in the browser. Passing false to setMode will instead cause
30
+ * the queue to be immediately processed for each call to enqueue. However,
31
+ * ordering will still be preserved so that nested tasks do not run until
32
+ * after parent tasks complete.
33
+ */
34
+ setMode(isAsync: boolean): void;
35
+ }
36
+ /**
37
+ * The default UpdateQueue.
38
+ * @public
39
+ */
40
+ export declare const Updates: UpdateQueue;
@@ -0,0 +1,9 @@
1
+ import { type Accessor } from "./observable.js";
2
+ /**
3
+ * Decorator: Marks a property getter as having volatile observable dependencies.
4
+ * @param target - The target that the property is defined on.
5
+ * @param name - The property name.
6
+ * @param descriptor - The existing descriptor.
7
+ * @public
8
+ */
9
+ export declare function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The FAST messaging API for warnings and errors.
3
+ * @public
4
+ */
5
+ export declare const FAST: {
6
+ /**
7
+ * Sends a warning to the developer.
8
+ * @param code - The warning code to send.
9
+ * @param values - Values relevant for the warning message.
10
+ */
11
+ warn(_code: number, _values?: Record<string, any>): void;
12
+ /**
13
+ * Creates an error from a code.
14
+ * @param code - The error code.
15
+ * @param values - Values relevant for the error message.
16
+ */
17
+ error(code: number, _values?: Record<string, any>): Error;
18
+ /**
19
+ * Adds debug messages for errors and warnings.
20
+ * @param messages - The message dictionary to add.
21
+ */
22
+ addMessages(messages: Record<number, string>): void;
23
+ };
24
+ /**
25
+ * Gets the shared debug message lookup.
26
+ * @internal
27
+ */
28
+ export declare function getDebugMessageLookup(): Record<number, string>;
29
+ /**
30
+ * A readonly, empty array.
31
+ * @remarks
32
+ * Typically returned by APIs that return arrays when there are
33
+ * no actual items to return.
34
+ * @public
35
+ */
36
+ export declare const emptyArray: readonly never[];
37
+ /**
38
+ * A type that can be registered with a `TypeRegistry`.
39
+ * @public
40
+ */
41
+ export interface TypeDefinition {
42
+ /**
43
+ * The registered type constructor.
44
+ */
45
+ type: Function;
46
+ }
47
+ /**
48
+ * A registry that stores definitions by type.
49
+ * @public
50
+ */
51
+ export interface TypeRegistry<TDefinition extends TypeDefinition> {
52
+ /**
53
+ * Registers a type definition.
54
+ * @param definition - The type definition to register.
55
+ * @returns `true` when the definition was registered, otherwise `false`.
56
+ */
57
+ register(definition: TDefinition): boolean;
58
+ /**
59
+ * Gets a definition by type.
60
+ * @param key - The type to retrieve the definition for.
61
+ */
62
+ getByType(key: Function): TDefinition | undefined;
63
+ /**
64
+ * Gets a definition by instance.
65
+ * @param object - The instance to retrieve the definition for.
66
+ */
67
+ getForInstance(object: any): TDefinition | undefined;
68
+ }
69
+ /**
70
+ * Do not change. Part of shared kernel contract.
71
+ * @internal
72
+ */
73
+ export declare function createTypeRegistry<TDefinition extends TypeDefinition>(): TypeRegistry<TDefinition>;
74
+ /**
75
+ * Creates a function capable of locating metadata associated with a type.
76
+ * @returns A metadata locator function.
77
+ * @internal
78
+ */
79
+ export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
80
+ /**
81
+ * Makes a type noop for JSON serialization.
82
+ * @param type - The type to make noop for JSON serialization.
83
+ * @internal
84
+ */
85
+ export declare function makeSerializationNoop(type: {
86
+ readonly prototype: any;
87
+ }): void;
@@ -0,0 +1,2 @@
1
+ export { FASTElementDefinition, type TypeDefinition, type TypeRegistry, } from "./components/fast-definitions.js";
2
+ export { type FASTElementRegistry, fastElementRegistry, } from "./components/fast-element-registry.js";
@@ -0,0 +1,7 @@
1
+ export type { Binding, BindingDirective } from "./binding/binding.js";
2
+ export type { Subscriber } from "./observation/notifier.js";
3
+ export type { Expression, ExpressionObserver } from "./observation/observable.js";
4
+ export type { ContentTemplate } from "./templating/html-binding-directive.js";
5
+ export type { AddViewBehaviorFactory, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController, } from "./templating/html-directive.js";
6
+ export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
7
+ export type { CaptureType } from "./templating/template.js";
@@ -0,0 +1 @@
1
+ export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "./components/schema.js";
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Detection and polyfill loading for Scoped Custom Element Registries.
3
+ */
4
+ declare global {
5
+ interface GlobalThis {
6
+ __scopedRegistryPolyfillApplied?: boolean;
7
+ __scopedRegistryPolyfillPromise?: Promise<void>;
8
+ }
9
+ }
10
+ /**
11
+ * Robust feature detection for Scoped Custom Element Registries.
12
+ *
13
+ * @remarks
14
+ * Tests the full API surface, not just the constructor existence.
15
+ * This ensures the browser actually supports attaching a custom registry
16
+ * to a shadow root, which is the critical functionality.
17
+ *
18
+ * @returns true if the browser supports scoped custom element registries
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * if (supportsScopedRegistries()) {
23
+ * const registry = new CustomElementRegistry();
24
+ * element.attachShadow({ mode: 'open', customElementRegistry: registry });
25
+ * }
26
+ * ```
27
+ *
28
+ * @public
29
+ */
30
+ export declare function supportsScopedRegistries(): boolean;
31
+ /**
32
+ * Idempotency-safe polyfill loading for Scoped Custom Element Registries.
33
+ *
34
+ * @remarks
35
+ * Safe to call from multiple micro-frontend bundles. Uses a global flag
36
+ * (`window.__scopedRegistryPolyfillApplied`) to prevent double-patching
37
+ * which could corrupt the CustomElementRegistry prototype.
38
+ *
39
+ * If native support is detected, returns immediately without loading the polyfill.
40
+ * On polyfill load failure, the flag is reset to allow retry on subsequent calls.
41
+ *
42
+ * @throws Error if the polyfill fails to load (network error, etc.)
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * // At app startup
47
+ * await ensureScopedRegistrySupport();
48
+ *
49
+ * // Now safe to use scoped registries
50
+ * const registry = new CustomElementRegistry();
51
+ * ```
52
+ *
53
+ * @public
54
+ */
55
+ export declare function ensureScopedRegistrySupport(): Promise<void>;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Scoped Custom Element Registries support for FAST-AF.
3
+ *
4
+ * @remarks
5
+ * This module provides utilities for working with Scoped Custom Element Registries,
6
+ * enabling isolated component definitions within shadow roots. This solves namespace
7
+ * collisions for micro-frontends and design system versioning.
8
+ *
9
+ * @example Using ScopedRegistryMixin (recommended)
10
+ * ```typescript
11
+ * import { FASTElement, html } from '@lushly-dev/fast-element';
12
+ * import { ScopedRegistryMixin } from '@lushly-dev/fast-element/scoped.js';
13
+ *
14
+ * class MyButton extends HTMLElement {}
15
+ *
16
+ * class MyCard extends ScopedRegistryMixin(FASTElement) {
17
+ * static elementDefinitions = {
18
+ * 'my-button': MyButton,
19
+ * };
20
+ * }
21
+ *
22
+ * // The shadow root gets the scoped registry, so <my-button> is upgraded without
23
+ * // being defined globally.
24
+ * await FASTElement.define(MyCard, {
25
+ * name: 'my-card',
26
+ * template: html`<my-button>Click me</my-button>`,
27
+ * shadowOptions: MyCard.getShadowOptions(),
28
+ * });
29
+ * ```
30
+ *
31
+ * @example Using createRegistry directly
32
+ * ```typescript
33
+ * import {
34
+ * createRegistry,
35
+ * createRegistryAsync,
36
+ * supportsScopedRegistries,
37
+ * ensureScopedRegistrySupport,
38
+ * } from '@lushly-dev/fast-element/scoped.js';
39
+ *
40
+ * class MyButton extends HTMLElement {}
41
+ * class MyInput extends HTMLElement {}
42
+ *
43
+ * // Check support
44
+ * if (supportsScopedRegistries()) {
45
+ * const registry = createRegistry([
46
+ * [MyButton, 'my-button'],
47
+ * [MyInput, 'my-input'],
48
+ * ]);
49
+ *
50
+ * element.attachShadow({
51
+ * mode: 'open',
52
+ * customElementRegistry: registry,
53
+ * });
54
+ * }
55
+ *
56
+ * // Or use async version with automatic polyfill
57
+ * const registry = await createRegistryAsync([
58
+ * [MyButton, 'my-button'],
59
+ * ]);
60
+ * ```
61
+ *
62
+ * @packageDocumentation
63
+ */
64
+ export type { ScopedShadowRootInit, ElementDefinition, CreateRegistryOptions, } from "./types.js";
65
+ export { supportsScopedRegistries, ensureScopedRegistrySupport } from "./detection.js";
66
+ export { createRegistry, createRegistryAsync } from "./registry.js";
67
+ export { ScopedRegistryMixin } from "./mixin.js";
68
+ export type { ElementDefinitionMap, ScopedRegistryHost, ScopedRegistryHostConstructor, } from "./mixin.js";
@@ -0,0 +1,118 @@
1
+ /**
2
+ * ScopedRegistryMixin for FAST Elements.
3
+ *
4
+ * @remarks
5
+ * Provides a mixin that enables components to define and use scoped registries,
6
+ * following the Lit labs pattern. Child elements are isolated within the
7
+ * component's shadow root.
8
+ */
9
+ import type { ScopedShadowRootInit } from "./types.js";
10
+ /**
11
+ * Map of element definitions: tag-name to constructor.
12
+ *
13
+ * @remarks
14
+ * Used with ScopedRegistryMixin to define child elements that should
15
+ * be registered in the component's scoped registry.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * static elementDefinitions: ElementDefinitionMap = {
20
+ * 'my-button': MyButton,
21
+ * 'my-input': MyInput,
22
+ * };
23
+ * ```
24
+ *
25
+ * @public
26
+ */
27
+ export type ElementDefinitionMap = Record<string, CustomElementConstructor>;
28
+ /**
29
+ * Interface for classes that host a scoped registry.
30
+ *
31
+ * @remarks
32
+ * Implemented by classes using the ScopedRegistryMixin.
33
+ *
34
+ * @public
35
+ */
36
+ export interface ScopedRegistryHost {
37
+ /**
38
+ * Static element definitions for the scoped registry.
39
+ */
40
+ elementDefinitions?: ElementDefinitionMap;
41
+ /**
42
+ * The scoped registry created from elementDefinitions.
43
+ * @remarks
44
+ * Lazily created on first access.
45
+ */
46
+ scopedRegistry: CustomElementRegistry | undefined;
47
+ }
48
+ /**
49
+ * Static interface for ScopedRegistryMixin classes.
50
+ * @public
51
+ */
52
+ export interface ScopedRegistryHostConstructor {
53
+ /**
54
+ * Static element definitions for the scoped registry.
55
+ */
56
+ elementDefinitions?: ElementDefinitionMap;
57
+ /**
58
+ * The scoped registry created from elementDefinitions.
59
+ */
60
+ readonly scopedRegistry: CustomElementRegistry | undefined;
61
+ /**
62
+ * Gets shadow root options with the scoped registry configured.
63
+ * @param baseOptions - Optional base shadow root options to extend
64
+ * @returns Shadow root options with customElementRegistry if applicable
65
+ */
66
+ getShadowOptions(baseOptions?: ScopedShadowRootInit): ScopedShadowRootInit;
67
+ }
68
+ /**
69
+ * Creates a mixin that enables scoped custom element registries for a FASTElement.
70
+ *
71
+ * @remarks
72
+ * The ScopedRegistryMixin provides a way to define child elements that are
73
+ * scoped to the component's shadow root, preventing namespace collisions
74
+ * in micro-frontend scenarios and enabling design system versioning.
75
+ *
76
+ * The mixin adds:
77
+ * - A static `elementDefinitions` property for defining child elements
78
+ * - A static `scopedRegistry` getter that lazily creates the registry
79
+ * - A method to get shadow root options with the scoped registry
80
+ *
81
+ * When scoped registries are not supported by the browser, elements fall back
82
+ * to the global registry with a development warning.
83
+ *
84
+ * @param Base - The FASTElement base class to extend
85
+ * @returns A class that supports scoped element definitions
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * import { FASTElement, html, css } from '@lushly-dev/fast-element';
90
+ * import { ScopedRegistryMixin } from '@lushly-dev/fast-element/scoped.js';
91
+ *
92
+ * // Children can be plain custom elements. FASTElement children must be composed
93
+ * // first (FASTElementDefinition.compose(MyIcon, { name: 'my-icon' })) so the
94
+ * // registry can reuse their FAST definition; creating an element of an
95
+ * // undefined FASTElement class throws FAST error 1401.
96
+ * class MyButton extends HTMLElement {
97
+ * // Button implementation
98
+ * }
99
+ *
100
+ * class MyCard extends ScopedRegistryMixin(FASTElement) {
101
+ * static elementDefinitions = {
102
+ * 'my-button': MyButton,
103
+ * };
104
+ * }
105
+ *
106
+ * // Attach the scoped registry to the shadow root through getShadowOptions().
107
+ * // The template's <my-button> is created against it and does not need to be
108
+ * // (and here is not) defined in the global registry.
109
+ * await FASTElement.define(MyCard, {
110
+ * name: 'my-card',
111
+ * template: html`<my-button>Click me</my-button>`,
112
+ * shadowOptions: MyCard.getShadowOptions(),
113
+ * });
114
+ * ```
115
+ *
116
+ * @public
117
+ */
118
+ export declare function ScopedRegistryMixin<T extends CustomElementConstructor>(Base: T): T & ScopedRegistryHostConstructor;