@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,318 @@
1
+ import { Binding, type BindingDirective } from "../binding/binding.js";
2
+ import type { FASTElement } from "../components/fast-element.js";
3
+ import type { DOMPolicy } from "../dom-policy.js";
4
+ import { type Constructable } from "../interfaces.js";
5
+ import type { Subscriber } from "../observation/notifier.js";
6
+ import type { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
7
+ import type { ContentTemplate, ContentView } from "./html-binding-directive.js";
8
+ import { type AddViewBehaviorFactory, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
9
+ import { type CaptureType, type SyntheticViewTemplate, type TemplateValue, ViewTemplate } from "./template.js";
10
+ /**
11
+ * A Behavior that enables advanced rendering.
12
+ * @public
13
+ */
14
+ export declare class RenderBehavior<TSource = any> implements ViewBehavior, Subscriber {
15
+ private directive;
16
+ private location;
17
+ private controller;
18
+ private view;
19
+ private template;
20
+ private templateBindingObserver;
21
+ private data;
22
+ private dataBindingObserver;
23
+ /**
24
+ * Creates an instance of RenderBehavior.
25
+ * @param directive - The render directive that created this behavior.
26
+ */
27
+ constructor(directive: RenderDirective);
28
+ /**
29
+ * Bind this behavior.
30
+ * @param controller - The view controller that manages the lifecycle of this behavior.
31
+ */
32
+ bind(controller: ViewController): void;
33
+ /**
34
+ * Unbinds this behavior.
35
+ * @param controller - The view controller that manages the lifecycle of this behavior.
36
+ */
37
+ unbind(controller: ViewController): void;
38
+ /**
39
+ * Handles changes from data or template binding observers.
40
+ * Guards against stale notifications that may arrive after the
41
+ * controller's view has been unbound (e.g., when a parent `when`
42
+ * directive tears down and later recreates a child element).
43
+ * @internal
44
+ */
45
+ handleChange(source: any, observer: ExpressionObserver): void;
46
+ private bindView;
47
+ private refreshView;
48
+ }
49
+ /**
50
+ * A Directive that enables use of the RenderBehavior.
51
+ * @public
52
+ */
53
+ export declare class RenderDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
54
+ readonly dataBinding: Binding<TSource>;
55
+ readonly templateBinding: Binding<TSource, ContentTemplate>;
56
+ readonly templateBindingDependsOnData: boolean;
57
+ /**
58
+ * The structural id of the DOM node to which the created behavior will apply.
59
+ */
60
+ targetNodeId: string;
61
+ /**
62
+ * Creates an instance of RenderDirective.
63
+ * @param dataBinding - A binding expression that returns the data to render.
64
+ * @param templateBinding - A binding expression that returns the template to use to render the data.
65
+ */
66
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, ContentTemplate>, templateBindingDependsOnData: boolean);
67
+ /**
68
+ * Creates HTML to be used within a template.
69
+ * @param add - Can be used to add behavior factories to a template.
70
+ */
71
+ createHTML(add: AddViewBehaviorFactory): string;
72
+ /**
73
+ * Creates a behavior.
74
+ * @param targets - The targets available for behaviors to be attached to.
75
+ */
76
+ createBehavior(): RenderBehavior<TSource>;
77
+ }
78
+ /**
79
+ * Provides instructions for how to render a type.
80
+ * @public
81
+ */
82
+ export interface RenderInstruction {
83
+ /**
84
+ * Identifies this as a RenderInstruction.
85
+ */
86
+ brand: symbol;
87
+ /**
88
+ * The type this instruction is associated with.
89
+ */
90
+ type: Constructable;
91
+ /**
92
+ * The template to use when rendering.
93
+ */
94
+ template: ContentTemplate;
95
+ /**
96
+ * A name that can be used to identify the instruction.
97
+ */
98
+ name: string;
99
+ }
100
+ /**
101
+ * Render options that are common to all configurations.
102
+ * @public
103
+ */
104
+ export type CommonRenderOptions = {
105
+ /**
106
+ * The type this instruction is associated with.
107
+ */
108
+ type: Constructable;
109
+ /**
110
+ * A name that can be used to identify the instruction.
111
+ */
112
+ name?: string;
113
+ };
114
+ /**
115
+ * Render options used to specify a template.
116
+ * @public
117
+ */
118
+ export type TemplateRenderOptions = CommonRenderOptions & {
119
+ /**
120
+ * The template to use when rendering.
121
+ */
122
+ template: ContentTemplate;
123
+ };
124
+ /**
125
+ * Render options that are common to all element render instructions.
126
+ * @public
127
+ */
128
+ export type BaseElementRenderOptions<TSource = any, TParent = any> = CommonRenderOptions & {
129
+ /**
130
+ * Attributes to use when creating the element template.
131
+ * @remarks
132
+ * This API should be used with caution. When providing attributes, if not done properly,
133
+ * you can open up the application to XSS attacks. When using this API, provide a strong
134
+ * DOMPolicy that can properly sanitize and also be sure to manually sanitize attribute
135
+ * values particularly if they can come from user input.
136
+ */
137
+ attributes?: Record<string, string | TemplateValue<TSource, TParent>>;
138
+ /**
139
+ * Content to use when creating the element template.
140
+ * @remarks
141
+ * This API should be used with caution. When providing content, if not done properly,
142
+ * you can open up the application to XSS attacks. When using this API, provide a strong
143
+ * DOMPolicy that can properly sanitize and also be sure to manually sanitize content
144
+ * particularly if it can come from user input. Prefer passing a template
145
+ * created by the the html tag helper rather than passing a raw string, as that will
146
+ * enable the JS runtime to help secure the static strings.
147
+ */
148
+ content?: string | SyntheticViewTemplate;
149
+ /**
150
+ * The DOMPolicy to create the render instruction with.
151
+ */
152
+ policy?: DOMPolicy;
153
+ };
154
+ /**
155
+ * Render options for directly creating an element with {@link RenderInstruction.createElementTemplate}
156
+ * @public
157
+ */
158
+ export type ElementCreateOptions<TSource = any, TParent = any> = Omit<BaseElementRenderOptions, "type" | "name"> & {
159
+ /**
160
+ * Directives to use when creating the element template. These directives are applied directly to the specified tag.
161
+ *
162
+ * @remarks
163
+ * Directives supported by this API are: `ref`, `children`, `slotted`, or any custom `HTMLDirective` that can be used on a HTML tag.
164
+ */
165
+ directives?: TemplateValue<TSource, TParent>[];
166
+ };
167
+ /**
168
+ * Render options used to specify an element.
169
+ * @public
170
+ */
171
+ export type ElementConstructorRenderOptions<TSource = any, TParent = any> = BaseElementRenderOptions<TSource, TParent> & {
172
+ /**
173
+ * The element to use when rendering.
174
+ */
175
+ element: Constructable<FASTElement>;
176
+ };
177
+ /**
178
+ * Render options use to specify an element by tag name.
179
+ * @public
180
+ */
181
+ export type TagNameRenderOptions<TSource = any, TParent = any> = BaseElementRenderOptions<TSource, TParent> & {
182
+ /**
183
+ * The tag name to use when rendering.
184
+ */
185
+ tagName: string;
186
+ };
187
+ declare function createElementTemplate<TSource = any, TParent = any>(tagName: string, options?: ElementCreateOptions): ViewTemplate<TSource, TParent>;
188
+ declare function create(options: TagNameRenderOptions): RenderInstruction;
189
+ declare function create(options: ElementConstructorRenderOptions): RenderInstruction;
190
+ declare function create(options: TemplateRenderOptions): RenderInstruction;
191
+ declare function instanceOf(object: any): object is RenderInstruction;
192
+ declare function register(options: TagNameRenderOptions): RenderInstruction;
193
+ declare function register(options: ElementConstructorRenderOptions): RenderInstruction;
194
+ declare function register(options: TemplateRenderOptions): RenderInstruction;
195
+ declare function register(instruction: RenderInstruction): RenderInstruction;
196
+ declare function getByType(type: Constructable, name?: string): RenderInstruction | undefined;
197
+ declare function getForInstance(object: any, name?: string): RenderInstruction | undefined;
198
+ /**
199
+ * Provides APIs for creating and interacting with render instructions.
200
+ * @public
201
+ */
202
+ export declare const RenderInstruction: Readonly<{
203
+ /**
204
+ * Checks whether the provided object is a RenderInstruction.
205
+ * @param object - The object to check.
206
+ * @returns true if the object is a RenderInstruction; false otherwise
207
+ */
208
+ instanceOf: typeof instanceOf;
209
+ /**
210
+ * Creates a RenderInstruction for a set of options.
211
+ * @param options - The options to use when creating the RenderInstruction.
212
+ * @remarks
213
+ * This API should be used with caution. When providing attributes or content,
214
+ * if not done properly, you can open up the application to XSS attacks. When using this API,
215
+ * provide a strong DOMPolicy that can properly sanitize and also be sure to manually sanitize
216
+ * content and attribute values particularly if they can come from user input.
217
+ */
218
+ create: typeof create;
219
+ /**
220
+ * Creates a template based on a tag name.
221
+ * @param tagName - The tag name to use when creating the template.
222
+ * @param attributes - The attributes to apply to the element.
223
+ * @param content - The content to insert into the element.
224
+ * @param policy - The DOMPolicy to create the template with.
225
+ * @returns A template based on the provided specifications.
226
+ * @remarks
227
+ * This API should be used with caution. When providing attributes or content,
228
+ * if not done properly, you can open up the application to XSS attacks. When using this API,
229
+ * provide a strong DOMPolicy that can properly sanitize and also be sure to manually sanitize
230
+ * content and attribute values particularly if they can come from user input.
231
+ */
232
+ createElementTemplate: typeof createElementTemplate;
233
+ /**
234
+ * Creates and registers an instruction.
235
+ * @param options The options to use when creating the RenderInstruction.
236
+ * @remarks
237
+ * A previously created RenderInstruction can also be registered.
238
+ */
239
+ register: typeof register;
240
+ /**
241
+ * Finds a previously registered RenderInstruction by type and optionally by name.
242
+ * @param type - The type to retrieve the RenderInstruction for.
243
+ * @param name - An optional name used in differentiating between multiple registered instructions.
244
+ * @returns The located RenderInstruction that matches the criteria or undefined if none is found.
245
+ */
246
+ getByType: typeof getByType;
247
+ /**
248
+ * Finds a previously registered RenderInstruction for the instance's type and optionally by name.
249
+ * @param object - The instance to retrieve the RenderInstruction for.
250
+ * @param name - An optional name used in differentiating between multiple registered instructions.
251
+ * @returns The located RenderInstruction that matches the criteria or undefined if none is found.
252
+ */
253
+ getForInstance: typeof getForInstance;
254
+ }>;
255
+ /**
256
+ * Decorates a type with render instruction metadata.
257
+ * @param options - The options used in creating the RenderInstruction.
258
+ * @public
259
+ */
260
+ export declare function renderWith(options: Omit<TagNameRenderOptions, "type">): ClassDecorator;
261
+ /**
262
+ * Decorates a type with render instruction metadata.
263
+ * @param options - The options used in creating the RenderInstruction.
264
+ * @public
265
+ */
266
+ export declare function renderWith(options: Omit<ElementConstructorRenderOptions, "type">): ClassDecorator;
267
+ /**
268
+ * Decorates a type with render instruction metadata.
269
+ * @param options - The options used in creating the RenderInstruction.
270
+ * @public
271
+ */
272
+ export declare function renderWith(options: Omit<TemplateRenderOptions, "type">): ClassDecorator;
273
+ /**
274
+ * Decorates a type with render instruction metadata.
275
+ * @param element - The element to use to render the decorated class.
276
+ * @param name - An optional name to differentiate the render instruction.
277
+ * @public
278
+ */
279
+ export declare function renderWith(element: Constructable<FASTElement>, name?: string): ClassDecorator;
280
+ /**
281
+ * Decorates a type with render instruction metadata.
282
+ * @param template - The template to use to render the decorated class.
283
+ * @param name - An optional name to differentiate the render instruction.
284
+ * @public
285
+ */
286
+ export declare function renderWith(template: ContentTemplate, name?: string): ClassDecorator;
287
+ /**
288
+ * @internal
289
+ */
290
+ export declare class NodeTemplate implements ContentTemplate, ContentView {
291
+ readonly node: Node;
292
+ constructor(node: Node);
293
+ get context(): ExecutionContext<any>;
294
+ bind(source: any): void;
295
+ unbind(): void;
296
+ insertBefore(refNode: Node): void;
297
+ remove(): void;
298
+ create(): ContentView;
299
+ hydrate(first: Node, last: Node): ContentView;
300
+ }
301
+ /**
302
+ * Creates a RenderDirective for use in advanced rendering scenarios.
303
+ * @param value - The binding expression that returns the data to be rendered. The expression
304
+ * can also return a Node to render directly.
305
+ * @param template - A template to render the data with
306
+ * or a string to indicate which RenderInstruction to use when looking up a RenderInstruction.
307
+ * Expressions can also be provided to dynamically determine either the template or the name.
308
+ * @returns A RenderDirective suitable for use in a template.
309
+ * @remarks
310
+ * If no binding is provided, then a default binding that returns the source is created.
311
+ * If no template is provided, then a binding is created that will use registered
312
+ * RenderInstructions to determine the view.
313
+ * If the template binding returns a string, then it will be used to look up a
314
+ * RenderInstruction to determine the view.
315
+ * @public
316
+ */
317
+ export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType<TSource, TParent>;
318
+ export {};
@@ -0,0 +1,131 @@
1
+ import type { Binding, BindingDirective } from "../binding/binding.js";
2
+ import { type Sort, type Splice } from "../observation/arrays.js";
3
+ import type { Subscriber } from "../observation/notifier.js";
4
+ import { type Expression, type ExpressionObserver } from "../observation/observable.js";
5
+ import { type AddViewBehaviorFactory, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
6
+ import type { CaptureType, SyntheticViewTemplate, ViewTemplate } from "./template.js";
7
+ import { type SyntheticView } from "./view.js";
8
+ /**
9
+ * Options for configuring repeat behavior.
10
+ * @public
11
+ */
12
+ export interface RepeatOptions {
13
+ /**
14
+ * Enables index, length, and dependent positioning updates in item templates.
15
+ */
16
+ positioning?: boolean;
17
+ /**
18
+ * Enables view recycling
19
+ */
20
+ recycle?: boolean;
21
+ }
22
+ export declare class HydrationRepeatError extends Error {
23
+ readonly propertyBag: {
24
+ index: number;
25
+ hydrationStage: string;
26
+ itemsLength?: number;
27
+ viewsState: string[];
28
+ viewTemplateString?: string;
29
+ rootNodeContent: string;
30
+ };
31
+ constructor(
32
+ /**
33
+ * The error message
34
+ */
35
+ message: string | undefined, propertyBag: {
36
+ index: number;
37
+ hydrationStage: string;
38
+ itemsLength?: number;
39
+ viewsState: string[];
40
+ viewTemplateString?: string;
41
+ rootNodeContent: string;
42
+ });
43
+ }
44
+ /**
45
+ * A behavior that renders a template for each item in an array.
46
+ * @public
47
+ */
48
+ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
49
+ private directive;
50
+ private location;
51
+ private controller;
52
+ private isBound;
53
+ private template;
54
+ private templateBindingObserver;
55
+ private items;
56
+ private itemsObserver;
57
+ private itemsBindingObserver;
58
+ private bindView;
59
+ /** @internal */
60
+ views: SyntheticView[];
61
+ /**
62
+ * Creates an instance of RepeatBehavior.
63
+ * @param location - The location in the DOM to render the repeat.
64
+ * @param dataBinding - The array to render.
65
+ * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
66
+ * @param templateBinding - The template to render for each item.
67
+ * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
68
+ * @param options - Options used to turn on special repeat features.
69
+ */
70
+ constructor(directive: RepeatDirective);
71
+ /**
72
+ * Bind this behavior.
73
+ * @param controller - The view controller that manages the lifecycle of this behavior.
74
+ */
75
+ bind(controller: ViewController): void;
76
+ /**
77
+ * Unbinds this behavior.
78
+ */
79
+ unbind(): void;
80
+ /**
81
+ * Handles changes in the array, its items, and the repeat template.
82
+ * @param source - The source of the change.
83
+ * @param args - The details about what was changed.
84
+ */
85
+ handleChange(source: any, args: Splice[] | Sort[] | ExpressionObserver): void;
86
+ private observeItems;
87
+ private updateSortedViews;
88
+ private updateSplicedViews;
89
+ private refreshAllViews;
90
+ private unbindAllViews;
91
+ private hydrateViews;
92
+ }
93
+ /**
94
+ * A directive that configures list rendering.
95
+ * @public
96
+ */
97
+ export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
98
+ readonly dataBinding: Binding<TSource>;
99
+ readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
100
+ readonly options: RepeatOptions;
101
+ /**
102
+ * The structural id of the DOM node to which the created behavior will apply.
103
+ */
104
+ targetNodeId: string;
105
+ /**
106
+ * Creates a placeholder string based on the directive's index within the template.
107
+ * @param index - The index of the directive within the template.
108
+ */
109
+ createHTML(add: AddViewBehaviorFactory): string;
110
+ /**
111
+ * Creates an instance of RepeatDirective.
112
+ * @param dataBinding - The binding that provides the array to render.
113
+ * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
114
+ * @param options - Options used to turn on special repeat features.
115
+ */
116
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
117
+ /**
118
+ * Creates a behavior for the provided target node.
119
+ * @param target - The node instance to create the behavior for.
120
+ */
121
+ createBehavior(): RepeatBehavior<TSource>;
122
+ }
123
+ /**
124
+ * A directive that enables list rendering.
125
+ * @param items - The array to render.
126
+ * @param template - The template or a template binding used obtain a template
127
+ * to render for each item in the array.
128
+ * @param options - Options used to turn on special repeat features.
129
+ * @public
130
+ */
131
+ export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
@@ -0,0 +1,38 @@
1
+ import { type NodeBehaviorOptions, NodeObservationDirective } from "./node-observation.js";
2
+ import type { CaptureType } from "./template.js";
3
+ /**
4
+ * The options used to configure slotted node observation.
5
+ * @public
6
+ */
7
+ export interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
8
+ }
9
+ /**
10
+ * The runtime behavior for slotted node observation.
11
+ * @public
12
+ */
13
+ export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
14
+ /**
15
+ * Begins observation of the nodes.
16
+ * @param target - The target to observe.
17
+ */
18
+ observe(target: EventSource): void;
19
+ /**
20
+ * Disconnects observation of the nodes.
21
+ * @param target - The target to unobserve.
22
+ */
23
+ disconnect(target: EventSource): void;
24
+ /**
25
+ * Retrieves the raw nodes that should be assigned to the source property.
26
+ * @param target - The target to get the node to.
27
+ */
28
+ getNodes(target: HTMLSlotElement): Node[];
29
+ /** @internal */
30
+ handleEvent(event: Event): void;
31
+ }
32
+ /**
33
+ * A directive that observes the `assignedNodes()` of a slot and updates a property
34
+ * whenever they change.
35
+ * @param propertyOrOptions - The options used to configure slotted node observation.
36
+ * @public
37
+ */
38
+ export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;