foldkit 0.156.0 → 0.157.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.
- package/README.md +3 -3
- package/dist/asyncData/asyncData.d.ts +7 -7
- package/dist/asyncData/asyncData.d.ts.map +1 -1
- package/dist/asyncData/asyncData.js +12 -12
- package/dist/calendar/calendarDate.d.ts +15 -15
- package/dist/calendar/calendarDate.d.ts.map +1 -1
- package/dist/calendar/calendarDate.js +14 -14
- package/dist/calendar/comparison.d.ts +2 -2
- package/dist/calendar/comparison.d.ts.map +1 -1
- package/dist/calendar/comparison.js +5 -5
- package/dist/calendar/info.d.ts +2 -2
- package/dist/calendar/info.d.ts.map +1 -1
- package/dist/calendar/info.js +2 -2
- package/dist/calendar/locale.d.ts +7 -7
- package/dist/calendar/locale.d.ts.map +1 -1
- package/dist/calendar/locale.js +23 -23
- package/dist/canvas/shape.d.ts +89 -89
- package/dist/canvas/shape.d.ts.map +1 -1
- package/dist/canvas/shape.js +65 -53
- package/dist/command/index.d.ts +3 -3
- package/dist/customElement/index.d.ts +2 -2
- package/dist/customElement/index.js +2 -2
- package/dist/devTools/protocol.d.ts +278 -278
- package/dist/devTools/protocol.d.ts.map +1 -1
- package/dist/devTools/protocol.js +98 -92
- package/dist/devTools/schemaSummarize.d.ts.map +1 -1
- package/dist/devTools/schemaSummarize.js +24 -24
- package/dist/devTools/serialize.d.ts +1 -1
- package/dist/devTools/serialize.d.ts.map +1 -1
- package/dist/devTools/serialize.js +10 -10
- package/dist/devTools/store.d.ts.map +1 -1
- package/dist/devTools/store.js +52 -28
- package/dist/devTools/submodelPath.d.ts.map +1 -1
- package/dist/devTools/submodelPath.js +3 -3
- package/dist/devTools/summarize.d.ts +6 -6
- package/dist/devTools/summarize.d.ts.map +1 -1
- package/dist/devTools/summarize.js +13 -13
- package/dist/devTools/webSocketBridge.d.ts +3 -3
- package/dist/devTools/webSocketBridge.d.ts.map +1 -1
- package/dist/devTools/webSocketBridge.js +8 -8
- package/dist/dom/dom.d.ts +2 -0
- package/dist/dom/dom.d.ts.map +1 -1
- package/dist/dom/dom.js +47 -13
- package/dist/experimental/machine/machine.d.ts +29 -6
- package/dist/experimental/machine/machine.d.ts.map +1 -1
- package/dist/experimental/machine/machine.js +9 -8
- package/dist/experimental/server/entry.js +2 -2
- package/dist/experimental/server/serialize.js +2 -2
- package/dist/experimental/server/server.js +4 -4
- package/dist/fieldValidation/fieldValidation.d.ts +12 -12
- package/dist/fieldValidation/fieldValidation.d.ts.map +1 -1
- package/dist/fieldValidation/fieldValidation.js +9 -9
- package/dist/fieldValidation/rule.d.ts +2 -2
- package/dist/fieldValidation/rule.d.ts.map +1 -1
- package/dist/fieldValidation/rule.js +6 -6
- package/dist/file/file.d.ts +3 -3
- package/dist/file/file.d.ts.map +1 -1
- package/dist/file/file.js +3 -3
- package/dist/html/boundary.d.ts +93 -36
- package/dist/html/boundary.d.ts.map +1 -1
- package/dist/html/boundary.js +242 -75
- package/dist/html/childAttribute.d.ts +6 -4
- package/dist/html/childAttribute.d.ts.map +1 -1
- package/dist/html/childAttribute.js +7 -1
- package/dist/html/index.d.ts +31 -16
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +97 -40
- package/dist/html/lazy.d.ts +6 -6
- package/dist/html/lazy.d.ts.map +1 -1
- package/dist/html/lazy.js +37 -15
- package/dist/html/public.d.ts +1 -1
- package/dist/html/public.d.ts.map +1 -1
- package/dist/html/runtimeSingleton.d.ts +27 -6
- package/dist/html/runtimeSingleton.d.ts.map +1 -1
- package/dist/html/runtimeSingleton.js +46 -29
- package/dist/html/submodel.d.ts.map +1 -1
- package/dist/html/submodel.js +28 -39
- package/dist/http/http.d.ts +1 -1
- package/dist/http/http.js +1 -1
- package/dist/managedResource/managedResource.d.ts +5 -5
- package/dist/managedResource/managedResource.js +3 -3
- package/dist/mount/index.d.ts +92 -39
- package/dist/mount/index.d.ts.map +1 -1
- package/dist/mount/index.js +28 -8
- package/dist/mount/public.d.ts +1 -1
- package/dist/mount/public.d.ts.map +1 -1
- package/dist/mount/public.js +1 -1
- package/dist/navigation/urlRequest.d.ts +9 -9
- package/dist/navigation/urlRequest.d.ts.map +1 -1
- package/dist/navigation/urlRequest.js +2 -2
- package/dist/onUnmountModule.d.ts +19 -0
- package/dist/onUnmountModule.d.ts.map +1 -0
- package/dist/onUnmountModule.js +80 -0
- package/dist/port/port.d.ts +5 -5
- package/dist/port/port.js +5 -5
- package/dist/route/parser.d.ts +2 -2
- package/dist/route/parser.js +2 -2
- package/dist/runtime/hmrProtocol.d.ts +10 -10
- package/dist/runtime/hmrProtocol.d.ts.map +1 -1
- package/dist/runtime/hmrProtocol.js +10 -10
- package/dist/runtime/runtime.d.ts +4 -4
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +168 -51
- package/dist/schema/index.d.ts +41 -29
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +9 -9
- package/dist/snabbdom/init.d.ts +1 -1
- package/dist/snabbdom/init.d.ts.map +1 -1
- package/dist/snabbdom/init.js +5 -1
- package/dist/snabbdom/vnode.d.ts +1 -0
- package/dist/snabbdom/vnode.d.ts.map +1 -1
- package/dist/snabbdom/vnode.js +1 -0
- package/dist/subscription/animationFrame.d.ts +3 -3
- package/dist/subscription/animationFrame.d.ts.map +1 -1
- package/dist/subscription/animationFrame.js +2 -2
- package/dist/subscription/fromEvent.d.ts +2 -2
- package/dist/subscription/fromEvent.js +2 -2
- package/dist/subscription/subscription.d.ts +3 -3
- package/dist/subscription/subscription.js +1 -1
- package/dist/test/apps/bubbling.d.ts +6 -6
- package/dist/test/apps/bubbling.d.ts.map +1 -1
- package/dist/test/apps/bubbling.js +6 -6
- package/dist/test/apps/colorPicker.d.ts +7 -7
- package/dist/test/apps/colorPicker.d.ts.map +1 -1
- package/dist/test/apps/colorPicker.js +5 -5
- package/dist/test/apps/contextMenu.d.ts +5 -5
- package/dist/test/apps/contextMenu.d.ts.map +1 -1
- package/dist/test/apps/contextMenu.js +4 -4
- package/dist/test/apps/counter.d.ts +8 -8
- package/dist/test/apps/counter.d.ts.map +1 -1
- package/dist/test/apps/counter.js +8 -8
- package/dist/test/apps/crashOnRender.d.ts +18 -18
- package/dist/test/apps/crashOnRender.d.ts.map +1 -1
- package/dist/test/apps/crashOnRender.js +11 -11
- package/dist/test/apps/drafts.d.ts +9 -9
- package/dist/test/apps/drafts.d.ts.map +1 -1
- package/dist/test/apps/drafts.js +6 -6
- package/dist/test/apps/feedSocket.d.ts +6 -6
- package/dist/test/apps/feedSocket.d.ts.map +1 -1
- package/dist/test/apps/feedSocket.js +8 -8
- package/dist/test/apps/fileUpload.d.ts +2 -2
- package/dist/test/apps/fileUpload.d.ts.map +1 -1
- package/dist/test/apps/fileUpload.js +2 -2
- package/dist/test/apps/focusBoundary.d.ts +3 -3
- package/dist/test/apps/focusBoundary.d.ts.map +1 -1
- package/dist/test/apps/focusBoundary.js +3 -3
- package/dist/test/apps/formChild.d.ts +11 -11
- package/dist/test/apps/formChild.d.ts.map +1 -1
- package/dist/test/apps/formChild.js +13 -12
- package/dist/test/apps/interactions.d.ts +8 -8
- package/dist/test/apps/interactions.d.ts.map +1 -1
- package/dist/test/apps/interactions.js +8 -8
- package/dist/test/apps/keypress.d.ts +6 -6
- package/dist/test/apps/keypress.d.ts.map +1 -1
- package/dist/test/apps/keypress.js +6 -6
- package/dist/test/apps/login.d.ts +11 -11
- package/dist/test/apps/login.d.ts.map +1 -1
- package/dist/test/apps/login.js +15 -15
- package/dist/test/apps/logoutButton.d.ts +3 -3
- package/dist/test/apps/logoutButton.d.ts.map +1 -1
- package/dist/test/apps/logoutButton.js +2 -2
- package/dist/test/apps/mountPanel.d.ts +9 -9
- package/dist/test/apps/mountPanel.d.ts.map +1 -1
- package/dist/test/apps/mountPanel.js +9 -9
- package/dist/test/apps/multiRole.d.ts +3 -3
- package/dist/test/apps/multiRole.d.ts.map +1 -1
- package/dist/test/apps/multiRole.js +2 -2
- package/dist/test/apps/pointer.d.ts +7 -7
- package/dist/test/apps/pointer.d.ts.map +1 -1
- package/dist/test/apps/pointer.js +7 -7
- package/dist/test/apps/resumeUpload.d.ts +8 -8
- package/dist/test/apps/resumeUpload.d.ts.map +1 -1
- package/dist/test/apps/resumeUpload.js +7 -7
- package/dist/test/apps/scorePanel.d.ts +3 -3
- package/dist/test/apps/scorePanel.d.ts.map +1 -1
- package/dist/test/apps/scorePanel.js +2 -2
- package/dist/test/apps/selectiveKeys.d.ts +3 -3
- package/dist/test/apps/selectiveKeys.d.ts.map +1 -1
- package/dist/test/apps/selectiveKeys.js +3 -3
- package/dist/test/apps/uploads.d.ts +18 -18
- package/dist/test/apps/uploads.d.ts.map +1 -1
- package/dist/test/apps/uploads.js +13 -13
- package/dist/test/matchers.d.ts.map +1 -1
- package/dist/test/matchers.js +4 -4
- package/dist/test/query.d.ts.map +1 -1
- package/dist/test/query.js +28 -28
- package/dist/test/scene.d.ts +37 -8
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +58 -15
- package/dist/test/story.d.ts +35 -8
- package/dist/test/story.d.ts.map +1 -1
- package/dist/test/story.js +44 -22
- package/dist/update/update.d.ts +17 -20
- package/dist/update/update.d.ts.map +1 -1
- package/dist/url/index.d.ts +8 -8
- package/dist/url/index.d.ts.map +1 -1
- package/dist/url/index.js +19 -19
- package/dist/vdom.d.ts +3 -2
- package/dist/vdom.d.ts.map +1 -1
- package/dist/vdom.js +16 -6
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array
|
|
1
|
+
import { Array } from 'effect';
|
|
2
2
|
import { BOOLEAN_PROPERTIES, FOREIGN_REPRESENTABLE_PROPERTIES, GLOBAL_ATTRIBUTE_PROPERTIES, HTML_NAMESPACE, PASSTHROUGH_PROPERTIES, RENAMED_PROPERTY_ATTRIBUTES, assertStyleIsRepresentable, htmlAttributeValue, isHtmlPropertyRepresentable, parsedAttributeName, serializedHtmlPropertyValue, serializedStyleAttribute, } from '../../domReflection.js';
|
|
3
3
|
import { HYDRATION_IDENTITY_ATTRIBUTE, HYDRATION_KEY_ATTRIBUTE, hydrationIdentityMarker, hydrationKeyMarker, } from '../../hydrationMarkers.js';
|
|
4
4
|
import { hasTrustedInnerHtml, isClientOnlyProperty, } from '../../propertyProvenance.js';
|
|
@@ -245,7 +245,7 @@ const collectDataAttributes = (attributes, data) => {
|
|
|
245
245
|
const classes = data.class;
|
|
246
246
|
if (classes !== undefined) {
|
|
247
247
|
const activeClasses = Object.keys(classes).filter(className => classes[className] === true);
|
|
248
|
-
if (
|
|
248
|
+
if (Array.isArrayNonEmpty(activeClasses)) {
|
|
249
249
|
appendClass(attributes, activeClasses.join(' '));
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array
|
|
1
|
+
import { Array, Context, Data, Effect, Option, Predicate, Schema, String, pipe, } from 'effect';
|
|
2
2
|
import { html as Parse5Html, defaultTreeAdapter, parse, parseFragment, } from 'parse5';
|
|
3
3
|
import { HYDRATION_BUILD_ATTRIBUTE } from '../../buildToken.js';
|
|
4
4
|
import { MATHML_NAMESPACE, SVG_NAMESPACE, parsedAttributeName, } from '../../domReflection.js';
|
|
@@ -158,7 +158,7 @@ const assertStructureMatches = (parsed, vnode) => {
|
|
|
158
158
|
if (parsedChildren.length !== vnodeChildren.length) {
|
|
159
159
|
throw structureMismatch(parsed);
|
|
160
160
|
}
|
|
161
|
-
for (const [parsedChild, vnodeChild] of
|
|
161
|
+
for (const [parsedChild, vnodeChild] of Array.zip(parsedChildren, vnodeChildren)) {
|
|
162
162
|
if (parsedChild.kind !== vnodeChild.kind) {
|
|
163
163
|
throw structureMismatch(parsed);
|
|
164
164
|
}
|
|
@@ -283,7 +283,7 @@ const parsedChildrenAgree = (scripted, unscripted) => {
|
|
|
283
283
|
if (scriptedChildren.length !== unscriptedChildren.length) {
|
|
284
284
|
return false;
|
|
285
285
|
}
|
|
286
|
-
for (const [scriptedChild, unscriptedChild] of
|
|
286
|
+
for (const [scriptedChild, unscriptedChild] of Array.zip(scriptedChildren, unscriptedChildren)) {
|
|
287
287
|
if (scriptedChild.kind !== unscriptedChild.kind) {
|
|
288
288
|
return false;
|
|
289
289
|
}
|
|
@@ -615,7 +615,7 @@ const elementsAtAndBelow = (element) => {
|
|
|
615
615
|
};
|
|
616
616
|
const elementsCarrying = (root, attributeName) => elementsAtAndBelow(root).filter(element => element.attrs.some(attribute => attribute.name === attributeName));
|
|
617
617
|
const assertNoReservedHandoffMarkers = (root) => {
|
|
618
|
-
const maybeMarker =
|
|
618
|
+
const maybeMarker = Array.findFirst(Array.fromIterable(RESERVED_HANDOFF_ATTRIBUTES), attributeName => elementsCarrying(root, attributeName).length > 0);
|
|
619
619
|
if (Option.isNone(maybeMarker)) {
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Option, Schema
|
|
1
|
+
import { Array, Option, Schema } from 'effect';
|
|
2
2
|
import { type Rule, type RuleMessage } from './rule.js';
|
|
3
3
|
/** The `NotValidated` state: user hasn't interacted yet. */
|
|
4
4
|
export type NotValidated<A> = Readonly<{
|
|
@@ -43,20 +43,20 @@ export declare const Invalid: <A>(field: Readonly<{
|
|
|
43
43
|
/** Builds the four-state `Field` Schema for a value of the given Schema. Put the
|
|
44
44
|
* result in your Model. The value Schema should match what the control
|
|
45
45
|
* actually holds as the user edits, not the type you parse it into:
|
|
46
|
-
* `Field(
|
|
46
|
+
* `Field(Schema.String)` for text inputs, `Field(Schema.Array(Schema.String))` for a
|
|
47
47
|
* multi-select. A scalar like a checkbox's boolean usually stays plain
|
|
48
|
-
* `
|
|
48
|
+
* `Schema.Boolean` in the Model; wrap it in `Field` only when it needs the
|
|
49
49
|
* validation lifecycle. Validation rules stay separate, in a `makeRules`
|
|
50
50
|
* bundle. */
|
|
51
|
-
export declare const Field: <A, I>(valueSchema:
|
|
52
|
-
readonly value:
|
|
53
|
-
}>,
|
|
54
|
-
readonly value:
|
|
55
|
-
}>,
|
|
56
|
-
readonly value:
|
|
57
|
-
}>,
|
|
58
|
-
readonly value:
|
|
59
|
-
readonly errors:
|
|
51
|
+
export declare const Field: <A, I>(valueSchema: Schema.Codec<A, I>) => Schema.Union<readonly [Schema.TaggedStruct<"NotValidated", {
|
|
52
|
+
readonly value: Schema.Codec<A, I, never, never>;
|
|
53
|
+
}>, Schema.TaggedStruct<"Validating", {
|
|
54
|
+
readonly value: Schema.Codec<A, I, never, never>;
|
|
55
|
+
}>, Schema.TaggedStruct<"Valid", {
|
|
56
|
+
readonly value: Schema.Codec<A, I, never, never>;
|
|
57
|
+
}>, Schema.TaggedStruct<"Invalid", {
|
|
58
|
+
readonly value: Schema.Codec<A, I, never, never>;
|
|
59
|
+
readonly errors: Schema.NonEmptyArray<Schema.String>;
|
|
60
60
|
}>]>;
|
|
61
61
|
/** A field's validation rules: the required message (if any), the list of rules,
|
|
62
62
|
* and an empty predicate. Produced by `makeRules`; consumed by the module's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValidation.d.ts","sourceRoot":"","sources":["../../src/fieldValidation/fieldValidation.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"fieldValidation.d.ts","sourceRoot":"","sources":["../../src/fieldValidation/fieldValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,EAAU,MAAM,EAAgB,MAAM,QAAQ,CAAA;AAE9E,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAkB,MAAM,WAAW,CAAA;AAIvE,4DAA4D;AAC5D,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA;AAE1E,6DAA6D;AAC7D,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;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AAEH;;;;;;;;+CAQ+C;AAC/C,eAAO,MAAM,OAAO,GACjB,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,aACX,KAAK,CAAC,CAAC,CAAC,KAAG,OAQlB,CAAA;AAEH;sEACsE;AACtE,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,KAAG,OACV,CAAA;AAEtC;;;;kBAIkB;AAClB,eAAO,MAAM,SAAS,UAAW,KAAK,CAAC,OAAO,CAAC,KAAG,OACxB,CAAA;AAE1B;;;;uCAIuC;AACvC,eAAO,MAAM,QAAQ,GAAI,CAAC,SACjB,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAClD,OAAwE,CAAA;AAE3E;wEACwE;AACxE,eAAO,MAAM,UAAU,WAAY,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAG,OACpC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Function, Option, Result, Schema
|
|
1
|
+
import { Array, Function, Option, Result, Schema, String, pipe } from 'effect';
|
|
2
2
|
import { resolveMessage } from './rule.js';
|
|
3
3
|
/** Constructs a `NotValidated` state. */
|
|
4
4
|
export const NotValidated = (field) => ({
|
|
@@ -24,18 +24,18 @@ export const Invalid = (field) => ({
|
|
|
24
24
|
/** Builds the four-state `Field` Schema for a value of the given Schema. Put the
|
|
25
25
|
* result in your Model. The value Schema should match what the control
|
|
26
26
|
* actually holds as the user edits, not the type you parse it into:
|
|
27
|
-
* `Field(
|
|
27
|
+
* `Field(Schema.String)` for text inputs, `Field(Schema.Array(Schema.String))` for a
|
|
28
28
|
* multi-select. A scalar like a checkbox's boolean usually stays plain
|
|
29
|
-
* `
|
|
29
|
+
* `Schema.Boolean` in the Model; wrap it in `Field` only when it needs the
|
|
30
30
|
* validation lifecycle. Validation rules stay separate, in a `makeRules`
|
|
31
31
|
* bundle. */
|
|
32
|
-
export const Field = (valueSchema) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
export const Field = (valueSchema) => Schema.Union([
|
|
33
|
+
Schema.TaggedStruct('NotValidated', { value: valueSchema }),
|
|
34
|
+
Schema.TaggedStruct('Validating', { value: valueSchema }),
|
|
35
|
+
Schema.TaggedStruct('Valid', { value: valueSchema }),
|
|
36
|
+
Schema.TaggedStruct('Invalid', {
|
|
37
37
|
value: valueSchema,
|
|
38
|
-
errors:
|
|
38
|
+
errors: Schema.NonEmptyArray(Schema.String),
|
|
39
39
|
}),
|
|
40
40
|
]);
|
|
41
41
|
const isEmptyValue = (value) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Predicate, Schema
|
|
1
|
+
import { Predicate, Schema } from 'effect';
|
|
2
2
|
/** An error message for a rule: either a static string, or a function that receives the invalid value. */
|
|
3
3
|
export type RuleMessage<A> = string | ((value: A) => string);
|
|
4
4
|
/** A tuple of a predicate and error message used for field validation. */
|
|
@@ -42,5 +42,5 @@ export declare const maxItems: (max: number, message?: RuleMessage<ReadonlyArray
|
|
|
42
42
|
* sync with the schema instead of duplicating its logic. It does nothing a
|
|
43
43
|
* custom rule can't, so prefer the dedicated rules for plain checks. Decoding
|
|
44
44
|
* is synchronous: the schema must decode without running an effect. */
|
|
45
|
-
export declare const fromSchema: <A, I>(schema:
|
|
45
|
+
export declare const fromSchema: <A, I>(schema: Schema.Codec<A, I>, message: RuleMessage<I>) => Rule<I>;
|
|
46
46
|
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/fieldValidation/rule.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/fieldValidation/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,SAAS,EAAE,MAAM,EAAgB,MAAM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W,CAAC,MAAM,CAAC,KAC5B,IAAI,CAAC,MAAM,CAGb,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,QAAQ,cACR,MAAM,YACP,WAAW,CAAC,MAAM,CAAC,KAC5B,IAAI,CAAC,MAAM,CAGb,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,MAAM,aACP,MAAM,YACN,WAAW,CAAC,MAAM,CAAC,KAC5B,IAAI,CAAC,MAAM,CAGb,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,KAAK,WACR,aAAa,CAAC,MAAM,CAAC,YACnB,WAAW,CAAC,MAAM,CAAC,KAC5B,IAAI,CAAC,MAAM,CAMb,CAAA;AAID,wEAAwE;AACxE,eAAO,MAAM,QAAQ,QACd,MAAM,YACD,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAC5C,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAG7B,CAAA;AAED,uEAAuE;AACvE,eAAO,MAAM,QAAQ,QACd,MAAM,YACD,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAC5C,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAG7B,CAAA;AAID;;;;;;wEAMwE;AACxE,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,CAAC,UACrB,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,WACjB,WAAW,CAAC,CAAC,CAAC,KACtB,IAAI,CAAC,CAAC,CAAgE,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Array, Number
|
|
1
|
+
import { Array, Number, Option, Schema, String, flow } from 'effect';
|
|
2
2
|
/** Resolves a `RuleMessage` to a concrete string, applying it to the value when the message is a function. */
|
|
3
3
|
export const resolveMessage = (message, value) => typeof message === 'string' ? message : message(value);
|
|
4
4
|
// STRING RULES
|
|
5
5
|
/** Creates a `Rule` that checks if a string meets a minimum length. */
|
|
6
6
|
export const minLength = (min, message) => [
|
|
7
|
-
flow(String.length,
|
|
7
|
+
flow(String.length, Number.isGreaterThanOrEqualTo(min)),
|
|
8
8
|
message ?? `Must be at least ${min} characters`,
|
|
9
9
|
];
|
|
10
10
|
/** Creates a `Rule` that checks if a string does not exceed a maximum length. */
|
|
11
11
|
export const maxLength = (max, message) => [
|
|
12
|
-
flow(String.length,
|
|
12
|
+
flow(String.length, Number.isLessThanOrEqualTo(max)),
|
|
13
13
|
message ?? `Must be at most ${max} characters`,
|
|
14
14
|
];
|
|
15
15
|
/** Creates a `Rule` that checks if a string matches a regular expression. */
|
|
@@ -58,12 +58,12 @@ export const oneOf = (values, message) => {
|
|
|
58
58
|
// ARRAY RULES
|
|
59
59
|
/** Creates a `Rule` that checks an array holds at least `min` items. */
|
|
60
60
|
export const minItems = (min, message) => [
|
|
61
|
-
flow(Array.length,
|
|
61
|
+
flow(Array.length, Number.isGreaterThanOrEqualTo(min)),
|
|
62
62
|
message ?? `Must select at least ${min}`,
|
|
63
63
|
];
|
|
64
64
|
/** Creates a `Rule` that checks an array holds at most `max` items. */
|
|
65
65
|
export const maxItems = (max, message) => [
|
|
66
|
-
flow(Array.length,
|
|
66
|
+
flow(Array.length, Number.isLessThanOrEqualTo(max)),
|
|
67
67
|
message ?? `Must select at most ${max}`,
|
|
68
68
|
];
|
|
69
69
|
// SCHEMA RULES
|
|
@@ -74,4 +74,4 @@ export const maxItems = (max, message) => [
|
|
|
74
74
|
* sync with the schema instead of duplicating its logic. It does nothing a
|
|
75
75
|
* custom rule can't, so prefer the dedicated rules for plain checks. Decoding
|
|
76
76
|
* is synchronous: the schema must decode without running an effect. */
|
|
77
|
-
export const fromSchema = (schema, message) => [flow(
|
|
77
|
+
export const fromSchema = (schema, message) => [flow(Schema.decodeOption(schema), Option.isSome), message];
|
package/dist/file/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
/**
|
|
3
3
|
* A file selected by the user. Direct alias for the browser's native `File`
|
|
4
4
|
* type — opaque by convention (Foldkit never constructs files itself, only
|
|
@@ -11,10 +11,10 @@ export type File = globalThis.File;
|
|
|
11
11
|
* Use in Model fields that hold user-selected files:
|
|
12
12
|
*
|
|
13
13
|
* ```ts
|
|
14
|
-
* attachedResume:
|
|
14
|
+
* attachedResume: Schema.Option(File.File)
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export declare const File:
|
|
17
|
+
export declare const File: Schema.Schema<File>;
|
|
18
18
|
/** The file's name including extension, as reported by the browser. */
|
|
19
19
|
export declare const name: (file: File) => string;
|
|
20
20
|
/** The file's size in bytes. */
|
package/dist/file/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/file/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/file/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAA;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAsC,CAAA;AAE3E,uEAAuE;AACvE,eAAO,MAAM,IAAI,SAAU,IAAI,KAAG,MAAmB,CAAA;AAErD,gCAAgC;AAChC,eAAO,MAAM,IAAI,SAAU,IAAI,KAAG,MAAmB,CAAA;AAErD,4GAA4G;AAC5G,eAAO,MAAM,QAAQ,SAAU,IAAI,KAAG,MAAmB,CAAA"}
|
package/dist/file/file.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
/**
|
|
3
3
|
* Schema that accepts any value that is an instance of the DOM `File` class.
|
|
4
4
|
* Use in Model fields that hold user-selected files:
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
|
-
* attachedResume:
|
|
7
|
+
* attachedResume: Schema.Option(File.File)
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
export const File =
|
|
10
|
+
export const File = Schema.instanceOf(globalThis.File);
|
|
11
11
|
/** The file's name including extension, as reported by the browser. */
|
|
12
12
|
export const name = (file) => file.name;
|
|
13
13
|
/** The file's size in bytes. */
|
package/dist/html/boundary.d.ts
CHANGED
|
@@ -9,6 +9,29 @@ export type WrapDescriptor = Readonly<{
|
|
|
9
9
|
* contain the separator character; {@link composeBoundary} throws when
|
|
10
10
|
* they do. */
|
|
11
11
|
export type BoundaryId = string;
|
|
12
|
+
type BoundaryWrapRegistration = Readonly<{
|
|
13
|
+
_tag: 'Registration';
|
|
14
|
+
boundaryId: BoundaryId;
|
|
15
|
+
descriptor: WrapDescriptor;
|
|
16
|
+
mountOuterDispatch: DispatchSync;
|
|
17
|
+
previousDescriptor: WrapDescriptor | undefined;
|
|
18
|
+
previousMountDescriptor: WrapDescriptor | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
type BoundaryWrapRollback = Readonly<{
|
|
21
|
+
_tag: 'Rollback';
|
|
22
|
+
rollback: () => void;
|
|
23
|
+
}>;
|
|
24
|
+
type BoundaryWrapTransactionEntry = BoundaryWrapRegistration | BoundaryWrapRollback;
|
|
25
|
+
type BoundaryWrapTransaction = Readonly<{
|
|
26
|
+
parent: BoundaryWrapTransaction | undefined;
|
|
27
|
+
startIndex: number;
|
|
28
|
+
}>;
|
|
29
|
+
/** @internal Registration metadata retained by a lazy VNode cache entry. */
|
|
30
|
+
export type TrackedBoundaryWrap = Readonly<{
|
|
31
|
+
callSite: string;
|
|
32
|
+
descriptor: WrapDescriptor;
|
|
33
|
+
mountOuterDispatch: DispatchSync;
|
|
34
|
+
}>;
|
|
12
35
|
export declare const ROOT_BOUNDARY: BoundaryId;
|
|
13
36
|
export declare const composeBoundary: (parent: BoundaryId, childId: string) => BoundaryId;
|
|
14
37
|
/** Per-runtime registry of Submodel wrapping descriptors. The runtime
|
|
@@ -28,6 +51,14 @@ export declare const composeBoundary: (parent: BoundaryId, childId: string) => B
|
|
|
28
51
|
* dispatcher created during a live render would still close over the
|
|
29
52
|
* live outerDispatch after a jump-to and silently mutate the live app.
|
|
30
53
|
*
|
|
54
|
+
* `mountWraps` provides the corresponding ownership-aware path for Mount
|
|
55
|
+
* results. Unlike event handlers, a surviving live Mount can emit while a
|
|
56
|
+
* replay render's wraps occupy `wraps`. Its dispatcher therefore reads only
|
|
57
|
+
* the wraps registered by renders with the same root Mount dispatcher, while
|
|
58
|
+
* still seeing replacements from later live renders. `mountWrapOwners`
|
|
59
|
+
* records every owner that has occupied a boundary so its final destroy hook
|
|
60
|
+
* can clear entries whose earlier hooks were replaced by in-place patches.
|
|
61
|
+
*
|
|
31
62
|
* `seenThisRender` tracks boundaries marked alive during the current
|
|
32
63
|
* render for duplicate-slotId detection: two `h.submodel` calls
|
|
33
64
|
* inside the same parent boundary must use different `slotId`s.
|
|
@@ -35,53 +66,66 @@ export declare const composeBoundary: (parent: BoundaryId, childId: string) => B
|
|
|
35
66
|
* second register collides so both locations land in the throw
|
|
36
67
|
* message. The map is cleared at the start of each render via
|
|
37
68
|
* `beginRender`. Boundaries behind a `createLazy`/`createKeyedLazy`
|
|
38
|
-
* cache hit are replayed into this map via
|
|
39
|
-
* so the duplicate-slotId guard
|
|
40
|
-
* siblings, not just against siblings
|
|
41
|
-
* not drive pruning
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* deregistration in the remount case. See {@link beginRender}.
|
|
69
|
+
* cache hit are replayed into this map via
|
|
70
|
+
* {@link restoreBoundaryWrapsForLazyHit} so the duplicate-slotId guard
|
|
71
|
+
* catches collisions against memoized siblings, not just against siblings
|
|
72
|
+
* that re-ran this frame. It does not drive pruning; VNode destroy hooks
|
|
73
|
+
* remove a descriptor only when it is still the current entry, so an old
|
|
74
|
+
* root cannot delete a same-cycle remount.
|
|
45
75
|
*
|
|
46
|
-
* `lazyTrackingStack` is a stack of
|
|
47
|
-
* `createKeyedLazy` to capture which boundary
|
|
76
|
+
* `lazyTrackingStack` is a stack of maps used by `createLazy` and
|
|
77
|
+
* `createKeyedLazy` to capture which boundary registrations were marked alive
|
|
48
78
|
* during the wrapped function's first execution. On a later cache
|
|
49
79
|
* hit, the lazy helper replays the captured ids into
|
|
50
80
|
* `seenThisRender` so the duplicate-slotId guard sees them. Each
|
|
51
|
-
* active lazy invocation pushes its own
|
|
52
|
-
* and `
|
|
53
|
-
* outer lazy correctly captures
|
|
54
|
-
* wraps.
|
|
81
|
+
* active lazy invocation pushes its own map; `registerBoundaryWrap`
|
|
82
|
+
* and `restoreBoundaryWrapsForLazyHit` write to every map on the stack so an
|
|
83
|
+
* outer lazy correctly captures registrations contributed by inner lazies it
|
|
84
|
+
* wraps. The registration snapshot also lets a cache hit restore wrapping
|
|
85
|
+
* descriptors after its cached VNode was removed and later reinserted.
|
|
86
|
+
*
|
|
87
|
+
* `boundaryWrapTransactionLog` and `activeBoundaryWrapTransaction` make a
|
|
88
|
+
* Submodel view's registration and lazy-cache writes transactional. If that
|
|
89
|
+
* view throws or returns `null`, every nested registration and cache entry it
|
|
90
|
+
* produced is restored because none of those VNodes will reach snabbdom and
|
|
91
|
+
* run its destroy hook. */
|
|
55
92
|
export type BoundaryRegistry = {
|
|
56
93
|
readonly wraps: Map<BoundaryId, WrapDescriptor>;
|
|
57
94
|
readonly boundaryDispatches: WeakMap<DispatchSync, Map<BoundaryId, DispatchSync>>;
|
|
95
|
+
readonly mountWraps: WeakMap<DispatchSync, Map<BoundaryId, WrapDescriptor>>;
|
|
96
|
+
readonly mountWrapOwners: Map<BoundaryId, Set<DispatchSync>>;
|
|
58
97
|
readonly seenThisRender: Map<BoundaryId, string>;
|
|
59
|
-
readonly lazyTrackingStack: Array<Map<BoundaryId,
|
|
98
|
+
readonly lazyTrackingStack: Array<Map<BoundaryId, TrackedBoundaryWrap>>;
|
|
99
|
+
readonly boundaryWrapTransactionLog: Array<BoundaryWrapTransactionEntry>;
|
|
100
|
+
activeBoundaryWrapTransaction: BoundaryWrapTransaction | undefined;
|
|
60
101
|
readonly dedupeSeen: Set<object>;
|
|
61
102
|
};
|
|
62
103
|
export declare const createBoundaryRegistry: () => BoundaryRegistry;
|
|
63
|
-
export declare const registerBoundaryWrap: (registry: BoundaryRegistry, boundaryId: BoundaryId, descriptor: WrapDescriptor) => void;
|
|
104
|
+
export declare const registerBoundaryWrap: (registry: BoundaryRegistry, boundaryId: BoundaryId, descriptor: WrapDescriptor, mountOuterDispatch: DispatchSync) => void;
|
|
64
105
|
/** Starts capturing boundary registrations on a fresh set pushed onto
|
|
65
106
|
* `lazyTrackingStack`. Used by `createLazy`/`createKeyedLazy` around the
|
|
66
107
|
* wrapped view function. Must be paired with {@link endLazyTracking} on
|
|
67
108
|
* the same call stack so an exception inside the view does not leak the
|
|
68
109
|
* tracking frame to a later render. */
|
|
69
|
-
export declare const beginLazyTracking: (registry: BoundaryRegistry) => Map<BoundaryId,
|
|
110
|
+
export declare const beginLazyTracking: (registry: BoundaryRegistry) => Map<BoundaryId, TrackedBoundaryWrap>;
|
|
70
111
|
/** Pops the most recent tracking set. Throws when called on an empty
|
|
71
112
|
* stack to surface unmatched begin/end pairs immediately rather than
|
|
72
113
|
* silently corrupting later renders. */
|
|
73
114
|
export declare const endLazyTracking: (registry: BoundaryRegistry) => void;
|
|
74
|
-
/**
|
|
75
|
-
* into `seenThisRender` so the duplicate-slotId guard sees
|
|
76
|
-
* forwards them into
|
|
77
|
-
* wrapping this cache hit captures the
|
|
115
|
+
/** Restores boundary registrations captured during a previous lazy run and
|
|
116
|
+
* replays their ids into `seenThisRender` so the duplicate-slotId guard sees
|
|
117
|
+
* them. Also forwards them into active tracking maps so an outer lazy
|
|
118
|
+
* wrapping this cache hit captures the registrations in its own snapshot.
|
|
78
119
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
120
|
+
* A registration that still occupies both lookup tables needs only its seen
|
|
121
|
+
* marker restored. A registration evicted when the cached VNode left the DOM
|
|
122
|
+
* is written back transactionally, so a surrounding Submodel render that
|
|
123
|
+
* later fails can still roll the cache hit back. */
|
|
124
|
+
export declare const restoreBoundaryWrapsForLazyHit: (registry: BoundaryRegistry, trackedBoundaries: ReadonlyMap<BoundaryId, TrackedBoundaryWrap>) => void;
|
|
125
|
+
/** Removes a boundary's wrap when it still matches the descriptor owned by the
|
|
126
|
+
* VNode being destroyed. A replacement registered earlier in the same patch
|
|
127
|
+
* is left intact. Called by `h.submodel`'s destroy hook when the corresponding
|
|
128
|
+
* VNode leaves the DOM.
|
|
85
129
|
*
|
|
86
130
|
* Does not touch `boundaryDispatches`: it is a WeakMap keyed by
|
|
87
131
|
* outerDispatch, so per-outerDispatch inner Maps become unreachable and
|
|
@@ -90,7 +134,19 @@ export declare const markSeenForLazyHit: (registry: BoundaryRegistry, trackedIds
|
|
|
90
134
|
* when it cannot find an ancestor wrap, which surfaces a clear error
|
|
91
135
|
* rather than letting events from a destroyed boundary silently
|
|
92
136
|
* misroute. */
|
|
93
|
-
export declare const deregisterBoundaryWrap: (registry: BoundaryRegistry, boundaryId: BoundaryId) => void;
|
|
137
|
+
export declare const deregisterBoundaryWrap: (registry: BoundaryRegistry, boundaryId: BoundaryId, descriptor: WrapDescriptor, mountOuterDispatch: DispatchSync) => void;
|
|
138
|
+
/** Starts a nested boundary-registration transaction for one Submodel view. */
|
|
139
|
+
export declare const beginBoundaryWrapTransaction: (registry: BoundaryRegistry) => BoundaryWrapTransaction;
|
|
140
|
+
/** Commits a Submodel view's boundary registrations. Nested registrations stay
|
|
141
|
+
* in the parent transaction until that parent also produces a VNode. */
|
|
142
|
+
export declare const commitBoundaryWrapTransaction: (registry: BoundaryRegistry, transaction: BoundaryWrapTransaction) => void;
|
|
143
|
+
/** Registers an internal cache restoration with the active Submodel boundary
|
|
144
|
+
* transaction. Calls outside a Submodel view need no rollback and are ignored. */
|
|
145
|
+
export declare const registerBoundaryWrapTransactionRollback: <A>(registry: BoundaryRegistry, value: A, restore: (value: A) => void) => void;
|
|
146
|
+
/** Restores every boundary registration performed since a Submodel view began,
|
|
147
|
+
* including registrations from nested Submodels whose VNodes never reached
|
|
148
|
+
* snabbdom. */
|
|
149
|
+
export declare const rollbackBoundaryWrapTransaction: (registry: BoundaryRegistry, transaction: BoundaryWrapTransaction) => void;
|
|
94
150
|
/** Resolves a message through `boundaryId`'s wrapping chain immediately,
|
|
95
151
|
* applying every `toParentMessage` from innermost to outermost against the
|
|
96
152
|
* wraps present right now, and returns a thunk that dispatches the fully
|
|
@@ -115,16 +171,17 @@ export declare const resolveBoundaryDispatchThunk: (registry: BoundaryRegistry,
|
|
|
115
171
|
* (boundary alive at call time), matching {@link dispatchAcrossBoundary}. */
|
|
116
172
|
export declare const boundaryMappers: (registry: BoundaryRegistry, boundaryId: BoundaryId) => ReadonlyArray<(message: unknown) => unknown>;
|
|
117
173
|
export declare const getOrCreateBoundaryDispatch: (registry: BoundaryRegistry, outerDispatch: DispatchSync, boundaryId: BoundaryId) => DispatchSync;
|
|
174
|
+
/** Returns a dispatcher for a Mount acquired inside `boundaryId`.
|
|
175
|
+
* The root dispatcher identifies the render owner: live and replay renders
|
|
176
|
+
* therefore consult separate wrap tables. Within that owner, the dispatcher
|
|
177
|
+
* resolves the current wrapping chain at emission time so a surviving Mount
|
|
178
|
+
* follows later live `toParentMessage` closures just like an event handler. */
|
|
179
|
+
export declare const resolveMountBoundaryDispatch: (registry: BoundaryRegistry, mountOuterDispatch: DispatchSync, boundaryId: BoundaryId) => DispatchSync;
|
|
118
180
|
/** Called at the start of each top-level render. Clears the
|
|
119
181
|
* per-render duplicate-slotId tracking map so siblings inside the
|
|
120
|
-
* same parent boundary can be re-validated. Does
|
|
121
|
-
* or
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* Clear `seenThisRender` only here, at the start of a cycle, never
|
|
125
|
-
* between the view and patch phases. The Submodel destroy hook reads
|
|
126
|
-
* it during patch to tell a same-cycle remount (a keyed root whose
|
|
127
|
-
* key changed) from a true unmount; clearing it mid-cycle would
|
|
128
|
-
* resurrect the `dispatchAcrossBoundary missing wrap` crash. */
|
|
182
|
+
* same parent boundary can be re-validated. Does not touch the wrap
|
|
183
|
+
* or dispatcher tables. Those persist across renders and are evicted
|
|
184
|
+
* by VNode destroy hooks instead. */
|
|
129
185
|
export declare const beginRender: (registry: BoundaryRegistry) => void;
|
|
186
|
+
export {};
|
|
130
187
|
//# sourceMappingURL=boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../src/html/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;eAIe;AACf,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAI/B,eAAO,MAAM,aAAa,EAAE,UAAe,CAAA;AAE3C,eAAO,MAAM,eAAe,WAClB,UAAU,WACT,MAAM,KACd,UAUF,CAAA;AAKD
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../src/html/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;eAIe;AACf,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAI/B,KAAK,wBAAwB,GAAG,QA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