@alloy-js/core 0.10.0 → 0.12.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/CHANGELOG.md +28 -0
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +100 -19
- package/dist/src/code.js +1 -2
- package/dist/src/components/Block.js +2 -5
- package/dist/src/components/Declaration.js +2 -4
- package/dist/src/components/For.d.ts +2 -2
- package/dist/src/components/For.d.ts.map +1 -1
- package/dist/src/components/For.js +1 -2
- package/dist/src/components/Indent.js +2 -4
- package/dist/src/components/List.js +2 -5
- package/dist/src/components/MemberDeclaration.js +2 -4
- package/dist/src/components/MemberName.js +1 -2
- package/dist/src/components/MemberScope.js +2 -4
- package/dist/src/components/Name.js +1 -2
- package/dist/src/components/Output.js +2 -4
- package/dist/src/components/Prose.js +1 -2
- package/dist/src/components/ReferenceOrContent.d.ts +8 -0
- package/dist/src/components/ReferenceOrContent.d.ts.map +1 -0
- package/dist/src/components/ReferenceOrContent.js +11 -0
- package/dist/src/components/Scope.js +2 -4
- package/dist/src/components/Show.js +1 -2
- package/dist/src/components/SourceDirectory.js +2 -4
- package/dist/src/components/SourceFile.js +2 -5
- package/dist/src/components/StatementList.js +2 -4
- package/dist/src/components/Switch.d.ts +1 -1
- package/dist/src/components/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch.js +1 -2
- package/dist/src/components/Wrap.js +2 -4
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +2 -2
- package/dist/src/components/stc/index.d.ts +1 -0
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +2 -2
- package/dist/src/components/stc/sti.js +1 -2
- package/dist/src/context/assignment.js +1 -2
- package/dist/src/context/binder.js +1 -2
- package/dist/src/context/declaration.js +1 -2
- package/dist/src/context/index.js +1 -2
- package/dist/src/context/member-declaration.js +1 -2
- package/dist/src/context/member-scope.js +1 -2
- package/dist/src/context/name-policy.js +1 -2
- package/dist/src/context/scope.js +1 -2
- package/dist/src/context/source-directory.js +1 -2
- package/dist/src/context/source-file.js +1 -2
- package/dist/src/context.js +1 -2
- package/dist/src/debug.js +13 -15
- package/dist/src/index.browser.js +1 -2
- package/dist/src/index.js +1 -2
- package/dist/src/jsx-runtime.d.ts +1 -1
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +10 -5
- package/dist/src/name-policy.js +1 -2
- package/dist/src/refkey.js +1 -2
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +6 -2
- package/dist/src/scheduler.d.ts +8 -0
- package/dist/src/scheduler.d.ts.map +1 -0
- package/dist/src/scheduler.js +17 -0
- package/dist/src/slot.js +1 -2
- package/dist/src/stc.js +1 -2
- package/dist/src/sti.js +1 -2
- package/dist/src/tap.js +1 -2
- package/dist/src/tsdoc-metadata.json +1 -1
- package/dist/src/utils.js +2 -4
- package/dist/src/write-output.browser.js +1 -2
- package/dist/src/write-output.js +1 -2
- package/dist/test/browser-build.test.js +85 -0
- package/dist/test/children.test.js +27 -0
- package/dist/test/components/block.test.js +45 -0
- package/dist/test/components/declaration.test.js +32 -0
- package/dist/test/components/list.test.js +86 -0
- package/dist/test/components/prose.test.js +25 -0
- package/dist/test/components/reference-or-content.test.d.ts +2 -0
- package/dist/test/components/reference-or-content.test.d.ts.map +1 -0
- package/dist/test/components/reference-or-content.test.js +149 -0
- package/dist/test/components/slot.test.js +134 -0
- package/dist/test/components/source-file.test.js +64 -0
- package/dist/test/components/wrap.test.js +35 -0
- package/dist/test/control-flow/for.test.js +219 -0
- package/dist/test/control-flow/match.test.js +67 -0
- package/dist/test/control-flow/show.test.js +29 -0
- package/dist/test/name-policy.test.js +19 -0
- package/dist/test/props-with-defaults.test.js +93 -0
- package/dist/test/reactivity/circular-reactives.test.d.ts +2 -0
- package/dist/test/reactivity/circular-reactives.test.d.ts.map +1 -0
- package/dist/test/reactivity/circular-reactives.test.js +31 -0
- package/dist/test/reactivity/cleanup.test.js +82 -0
- package/dist/test/reactivity/memo.test.js +16 -0
- package/dist/test/reactivity/ref-rendering.test.js +37 -0
- package/dist/test/reactivity/test.test.js +61 -0
- package/dist/test/reactivity/untrack.test.js +26 -0
- package/dist/test/refkey.test.js +25 -0
- package/dist/test/rendering/basic.test.js +96 -0
- package/dist/test/rendering/code.test.js +55 -0
- package/dist/test/rendering/formatting.test.js +402 -0
- package/dist/test/rendering/indent.test.js +90 -0
- package/dist/test/rendering/memoization.test.js +27 -0
- package/dist/test/rendering/refkeys.test.js +32 -0
- package/dist/test/split-props.test.js +77 -0
- package/dist/test/stc.test.js +34 -0
- package/dist/test/symbols.test.js +877 -0
- package/dist/test/utils.test.d.ts.map +1 -1
- package/dist/test/utils.test.js +223 -0
- package/dist/testing/extend-expect.js +1 -2
- package/dist/testing/index.js +1 -2
- package/dist/testing/render.js +1 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -22
- package/src/binder.ts +100 -17
- package/src/components/For.tsx +6 -6
- package/src/components/ReferenceOrContent.tsx +22 -0
- package/src/components/index.tsx +1 -0
- package/src/components/stc/index.ts +1 -0
- package/src/debug.ts +12 -13
- package/src/jsx-runtime.ts +24 -14
- package/src/render.ts +5 -0
- package/src/scheduler.ts +24 -0
- package/temp/api.json +216 -15
- package/test/components/declaration.test.tsx +2 -0
- package/test/components/list.test.tsx +0 -1
- package/test/components/reference-or-content.test.tsx +138 -0
- package/test/control-flow/for.test.tsx +34 -4
- package/test/reactivity/circular-reactives.test.tsx +32 -0
- package/test/reactivity/cleanup.test.tsx +5 -0
- package/test/reactivity/untrack.test.ts +3 -0
- package/test/rendering/memoization.test.tsx +2 -0
- package/test/symbols.test.ts +392 -13
- package/test/utils.test.tsx +2 -0
- package/babel.config.cjs +0 -4
- package/dist/src/binder.js.map +0 -1
- package/dist/src/code.js.map +0 -1
- package/dist/src/components/Block.js.map +0 -1
- package/dist/src/components/Declaration.js.map +0 -1
- package/dist/src/components/For.js.map +0 -1
- package/dist/src/components/Indent.js.map +0 -1
- package/dist/src/components/List.js.map +0 -1
- package/dist/src/components/MemberDeclaration.js.map +0 -1
- package/dist/src/components/MemberName.js.map +0 -1
- package/dist/src/components/MemberScope.js.map +0 -1
- package/dist/src/components/Name.js.map +0 -1
- package/dist/src/components/Output.js.map +0 -1
- package/dist/src/components/Prose.js.map +0 -1
- package/dist/src/components/Scope.js.map +0 -1
- package/dist/src/components/Show.js.map +0 -1
- package/dist/src/components/SourceDirectory.js.map +0 -1
- package/dist/src/components/SourceFile.js.map +0 -1
- package/dist/src/components/StatementList.js.map +0 -1
- package/dist/src/components/Switch.js.map +0 -1
- package/dist/src/components/Wrap.js.map +0 -1
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/components/stc/index.js.map +0 -1
- package/dist/src/components/stc/sti.js.map +0 -1
- package/dist/src/context/assignment.js.map +0 -1
- package/dist/src/context/binder.js.map +0 -1
- package/dist/src/context/declaration.js.map +0 -1
- package/dist/src/context/index.js.map +0 -1
- package/dist/src/context/member-declaration.js.map +0 -1
- package/dist/src/context/member-scope.js.map +0 -1
- package/dist/src/context/name-policy.js.map +0 -1
- package/dist/src/context/scope.js.map +0 -1
- package/dist/src/context/source-directory.js.map +0 -1
- package/dist/src/context/source-file.js.map +0 -1
- package/dist/src/context.js.map +0 -1
- package/dist/src/debug.js.map +0 -1
- package/dist/src/index.browser.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/jsx-runtime.js.map +0 -1
- package/dist/src/name-policy.js.map +0 -1
- package/dist/src/refkey.js.map +0 -1
- package/dist/src/render.js.map +0 -1
- package/dist/src/slot.js.map +0 -1
- package/dist/src/stc.js.map +0 -1
- package/dist/src/sti.js.map +0 -1
- package/dist/src/tap.js.map +0 -1
- package/dist/src/utils.js.map +0 -1
- package/dist/src/write-output.browser.js.map +0 -1
- package/dist/src/write-output.js.map +0 -1
- package/dist/testing/extend-expect.js.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/render.js.map +0 -1
- package/dist/testing/vitest.d.js.map +0 -1
package/temp/api.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
-
"toolVersion": "7.47.
|
|
4
|
+
"toolVersion": "7.47.12",
|
|
5
5
|
"schemaVersion": 1011,
|
|
6
6
|
"oldestForwardsCompatibleVersion": 1001,
|
|
7
7
|
"tsdocConfig": {
|
|
@@ -5715,7 +5715,7 @@
|
|
|
5715
5715
|
},
|
|
5716
5716
|
{
|
|
5717
5717
|
"kind": "Content",
|
|
5718
|
-
"text": "T extends "
|
|
5718
|
+
"text": "number extends keyof T ? [value: T[number]] : T extends "
|
|
5719
5719
|
},
|
|
5720
5720
|
{
|
|
5721
5721
|
"kind": "Reference",
|
|
@@ -5742,7 +5742,7 @@
|
|
|
5742
5742
|
},
|
|
5743
5743
|
{
|
|
5744
5744
|
"kind": "Content",
|
|
5745
|
-
"text": "<U> : T extends
|
|
5745
|
+
"text": "<U> : T extends "
|
|
5746
5746
|
},
|
|
5747
5747
|
{
|
|
5748
5748
|
"kind": "Reference",
|
|
@@ -6003,25 +6003,25 @@
|
|
|
6003
6003
|
},
|
|
6004
6004
|
{
|
|
6005
6005
|
"kind": "Content",
|
|
6006
|
-
"text": "
|
|
6006
|
+
"text": "readonly unknown[] | "
|
|
6007
6007
|
},
|
|
6008
6008
|
{
|
|
6009
6009
|
"kind": "Reference",
|
|
6010
|
-
"text": "
|
|
6011
|
-
"canonicalReference": "!
|
|
6010
|
+
"text": "ReadonlyMap",
|
|
6011
|
+
"canonicalReference": "!ReadonlyMap:interface"
|
|
6012
6012
|
},
|
|
6013
6013
|
{
|
|
6014
6014
|
"kind": "Content",
|
|
6015
|
-
"text": "<
|
|
6015
|
+
"text": "<unknown, unknown> | "
|
|
6016
6016
|
},
|
|
6017
6017
|
{
|
|
6018
6018
|
"kind": "Reference",
|
|
6019
|
-
"text": "
|
|
6020
|
-
"canonicalReference": "!
|
|
6019
|
+
"text": "ReadonlySet",
|
|
6020
|
+
"canonicalReference": "!ReadonlySet:interface"
|
|
6021
6021
|
},
|
|
6022
6022
|
{
|
|
6023
6023
|
"kind": "Content",
|
|
6024
|
-
"text": "<
|
|
6024
|
+
"text": "<unknown> | "
|
|
6025
6025
|
},
|
|
6026
6026
|
{
|
|
6027
6027
|
"kind": "Reference",
|
|
@@ -6030,7 +6030,7 @@
|
|
|
6030
6030
|
},
|
|
6031
6031
|
{
|
|
6032
6032
|
"kind": "Content",
|
|
6033
|
-
"text": "<
|
|
6033
|
+
"text": "<unknown>"
|
|
6034
6034
|
},
|
|
6035
6035
|
{
|
|
6036
6036
|
"kind": "Content",
|
|
@@ -9234,7 +9234,43 @@
|
|
|
9234
9234
|
},
|
|
9235
9235
|
{
|
|
9236
9236
|
"kind": "Content",
|
|
9237
|
-
"text": ">"
|
|
9237
|
+
"text": "> & "
|
|
9238
|
+
},
|
|
9239
|
+
{
|
|
9240
|
+
"kind": "Reference",
|
|
9241
|
+
"text": "Required",
|
|
9242
|
+
"canonicalReference": "!Required:type"
|
|
9243
|
+
},
|
|
9244
|
+
{
|
|
9245
|
+
"kind": "Content",
|
|
9246
|
+
"text": "<"
|
|
9247
|
+
},
|
|
9248
|
+
{
|
|
9249
|
+
"kind": "Reference",
|
|
9250
|
+
"text": "Pick",
|
|
9251
|
+
"canonicalReference": "!Pick:type"
|
|
9252
|
+
},
|
|
9253
|
+
{
|
|
9254
|
+
"kind": "Content",
|
|
9255
|
+
"text": "<import(\"@alloy-js/core/jsx-runtime\")."
|
|
9256
|
+
},
|
|
9257
|
+
{
|
|
9258
|
+
"kind": "Reference",
|
|
9259
|
+
"text": "Component",
|
|
9260
|
+
"canonicalReference": "@alloy-js/core!Component:interface"
|
|
9261
|
+
},
|
|
9262
|
+
{
|
|
9263
|
+
"kind": "Content",
|
|
9264
|
+
"text": "<"
|
|
9265
|
+
},
|
|
9266
|
+
{
|
|
9267
|
+
"kind": "Reference",
|
|
9268
|
+
"text": "MatchProps",
|
|
9269
|
+
"canonicalReference": "@alloy-js/core!MatchProps:interface"
|
|
9270
|
+
},
|
|
9271
|
+
{
|
|
9272
|
+
"kind": "Content",
|
|
9273
|
+
"text": ">, \"tag\">>"
|
|
9238
9274
|
}
|
|
9239
9275
|
],
|
|
9240
9276
|
"fileUrlPath": "src/components/Switch.tsx",
|
|
@@ -9243,7 +9279,7 @@
|
|
|
9243
9279
|
"name": "Match",
|
|
9244
9280
|
"variableTypeTokenRange": {
|
|
9245
9281
|
"startIndex": 1,
|
|
9246
|
-
"endIndex":
|
|
9282
|
+
"endIndex": 14
|
|
9247
9283
|
}
|
|
9248
9284
|
},
|
|
9249
9285
|
{
|
|
@@ -12872,6 +12908,144 @@
|
|
|
12872
12908
|
],
|
|
12873
12909
|
"name": "pushStack"
|
|
12874
12910
|
},
|
|
12911
|
+
{
|
|
12912
|
+
"kind": "Function",
|
|
12913
|
+
"canonicalReference": "@alloy-js/core!ReferenceOrContent:function(1)",
|
|
12914
|
+
"docComment": "",
|
|
12915
|
+
"excerptTokens": [
|
|
12916
|
+
{
|
|
12917
|
+
"kind": "Content",
|
|
12918
|
+
"text": "export declare function ReferenceOrContent(props: "
|
|
12919
|
+
},
|
|
12920
|
+
{
|
|
12921
|
+
"kind": "Reference",
|
|
12922
|
+
"text": "ReferenceOrContentProps",
|
|
12923
|
+
"canonicalReference": "@alloy-js/core!ReferenceOrContentProps:interface"
|
|
12924
|
+
},
|
|
12925
|
+
{
|
|
12926
|
+
"kind": "Content",
|
|
12927
|
+
"text": "): "
|
|
12928
|
+
},
|
|
12929
|
+
{
|
|
12930
|
+
"kind": "Content",
|
|
12931
|
+
"text": "import(\"@vue/reactivity\")."
|
|
12932
|
+
},
|
|
12933
|
+
{
|
|
12934
|
+
"kind": "Reference",
|
|
12935
|
+
"text": "ComputedRef",
|
|
12936
|
+
"canonicalReference": "@vue/reactivity!ComputedRef:interface"
|
|
12937
|
+
},
|
|
12938
|
+
{
|
|
12939
|
+
"kind": "Content",
|
|
12940
|
+
"text": "<"
|
|
12941
|
+
},
|
|
12942
|
+
{
|
|
12943
|
+
"kind": "Reference",
|
|
12944
|
+
"text": "Children",
|
|
12945
|
+
"canonicalReference": "@alloy-js/core!Children:type"
|
|
12946
|
+
},
|
|
12947
|
+
{
|
|
12948
|
+
"kind": "Content",
|
|
12949
|
+
"text": ">"
|
|
12950
|
+
},
|
|
12951
|
+
{
|
|
12952
|
+
"kind": "Content",
|
|
12953
|
+
"text": ";"
|
|
12954
|
+
}
|
|
12955
|
+
],
|
|
12956
|
+
"fileUrlPath": "src/components/ReferenceOrContent.tsx",
|
|
12957
|
+
"returnTypeTokenRange": {
|
|
12958
|
+
"startIndex": 3,
|
|
12959
|
+
"endIndex": 8
|
|
12960
|
+
},
|
|
12961
|
+
"releaseTag": "Public",
|
|
12962
|
+
"overloadIndex": 1,
|
|
12963
|
+
"parameters": [
|
|
12964
|
+
{
|
|
12965
|
+
"parameterName": "props",
|
|
12966
|
+
"parameterTypeTokenRange": {
|
|
12967
|
+
"startIndex": 1,
|
|
12968
|
+
"endIndex": 2
|
|
12969
|
+
},
|
|
12970
|
+
"isOptional": false
|
|
12971
|
+
}
|
|
12972
|
+
],
|
|
12973
|
+
"name": "ReferenceOrContent"
|
|
12974
|
+
},
|
|
12975
|
+
{
|
|
12976
|
+
"kind": "Interface",
|
|
12977
|
+
"canonicalReference": "@alloy-js/core!ReferenceOrContentProps:interface",
|
|
12978
|
+
"docComment": "",
|
|
12979
|
+
"excerptTokens": [
|
|
12980
|
+
{
|
|
12981
|
+
"kind": "Content",
|
|
12982
|
+
"text": "export interface ReferenceOrContentProps "
|
|
12983
|
+
}
|
|
12984
|
+
],
|
|
12985
|
+
"fileUrlPath": "src/components/ReferenceOrContent.tsx",
|
|
12986
|
+
"releaseTag": "Public",
|
|
12987
|
+
"name": "ReferenceOrContentProps",
|
|
12988
|
+
"preserveMemberOrder": false,
|
|
12989
|
+
"members": [
|
|
12990
|
+
{
|
|
12991
|
+
"kind": "PropertySignature",
|
|
12992
|
+
"canonicalReference": "@alloy-js/core!ReferenceOrContentProps#children:member",
|
|
12993
|
+
"docComment": "",
|
|
12994
|
+
"excerptTokens": [
|
|
12995
|
+
{
|
|
12996
|
+
"kind": "Content",
|
|
12997
|
+
"text": "readonly children: "
|
|
12998
|
+
},
|
|
12999
|
+
{
|
|
13000
|
+
"kind": "Reference",
|
|
13001
|
+
"text": "Children",
|
|
13002
|
+
"canonicalReference": "@alloy-js/core!Children:type"
|
|
13003
|
+
},
|
|
13004
|
+
{
|
|
13005
|
+
"kind": "Content",
|
|
13006
|
+
"text": ";"
|
|
13007
|
+
}
|
|
13008
|
+
],
|
|
13009
|
+
"isReadonly": true,
|
|
13010
|
+
"isOptional": false,
|
|
13011
|
+
"releaseTag": "Public",
|
|
13012
|
+
"name": "children",
|
|
13013
|
+
"propertyTypeTokenRange": {
|
|
13014
|
+
"startIndex": 1,
|
|
13015
|
+
"endIndex": 2
|
|
13016
|
+
}
|
|
13017
|
+
},
|
|
13018
|
+
{
|
|
13019
|
+
"kind": "PropertySignature",
|
|
13020
|
+
"canonicalReference": "@alloy-js/core!ReferenceOrContentProps#refkey:member",
|
|
13021
|
+
"docComment": "",
|
|
13022
|
+
"excerptTokens": [
|
|
13023
|
+
{
|
|
13024
|
+
"kind": "Content",
|
|
13025
|
+
"text": "readonly refkey: "
|
|
13026
|
+
},
|
|
13027
|
+
{
|
|
13028
|
+
"kind": "Reference",
|
|
13029
|
+
"text": "Refkey",
|
|
13030
|
+
"canonicalReference": "@alloy-js/core!Refkey:type"
|
|
13031
|
+
},
|
|
13032
|
+
{
|
|
13033
|
+
"kind": "Content",
|
|
13034
|
+
"text": ";"
|
|
13035
|
+
}
|
|
13036
|
+
],
|
|
13037
|
+
"isReadonly": true,
|
|
13038
|
+
"isOptional": false,
|
|
13039
|
+
"releaseTag": "Public",
|
|
13040
|
+
"name": "refkey",
|
|
13041
|
+
"propertyTypeTokenRange": {
|
|
13042
|
+
"startIndex": 1,
|
|
13043
|
+
"endIndex": 2
|
|
13044
|
+
}
|
|
13045
|
+
}
|
|
13046
|
+
],
|
|
13047
|
+
"extendsTokenRanges": []
|
|
13048
|
+
},
|
|
12875
13049
|
{
|
|
12876
13050
|
"kind": "Function",
|
|
12877
13051
|
"canonicalReference": "@alloy-js/core!refkey:function(1)",
|
|
@@ -15842,7 +16016,34 @@
|
|
|
15842
16016
|
},
|
|
15843
16017
|
{
|
|
15844
16018
|
"kind": "Content",
|
|
15845
|
-
"text": "<TProps>"
|
|
16019
|
+
"text": "<TProps> & "
|
|
16020
|
+
},
|
|
16021
|
+
{
|
|
16022
|
+
"kind": "Reference",
|
|
16023
|
+
"text": "Required",
|
|
16024
|
+
"canonicalReference": "!Required:type"
|
|
16025
|
+
},
|
|
16026
|
+
{
|
|
16027
|
+
"kind": "Content",
|
|
16028
|
+
"text": "<"
|
|
16029
|
+
},
|
|
16030
|
+
{
|
|
16031
|
+
"kind": "Reference",
|
|
16032
|
+
"text": "Pick",
|
|
16033
|
+
"canonicalReference": "!Pick:type"
|
|
16034
|
+
},
|
|
16035
|
+
{
|
|
16036
|
+
"kind": "Content",
|
|
16037
|
+
"text": "<"
|
|
16038
|
+
},
|
|
16039
|
+
{
|
|
16040
|
+
"kind": "Reference",
|
|
16041
|
+
"text": "Component",
|
|
16042
|
+
"canonicalReference": "@alloy-js/core!Component:interface"
|
|
16043
|
+
},
|
|
16044
|
+
{
|
|
16045
|
+
"kind": "Content",
|
|
16046
|
+
"text": "<TProps>, \"tag\">>"
|
|
15846
16047
|
},
|
|
15847
16048
|
{
|
|
15848
16049
|
"kind": "Content",
|
|
@@ -15852,7 +16053,7 @@
|
|
|
15852
16053
|
"fileUrlPath": "src/jsx-runtime.ts",
|
|
15853
16054
|
"returnTypeTokenRange": {
|
|
15854
16055
|
"startIndex": 8,
|
|
15855
|
-
"endIndex":
|
|
16056
|
+
"endIndex": 16
|
|
15856
16057
|
},
|
|
15857
16058
|
"releaseTag": "Public",
|
|
15858
16059
|
"overloadIndex": 1,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Scope,
|
|
8
8
|
useBinder,
|
|
9
9
|
} from "../../src/index.js";
|
|
10
|
+
import { flushJobs } from "../../src/scheduler.js";
|
|
10
11
|
import { createTap } from "../../src/tap.js";
|
|
11
12
|
|
|
12
13
|
it("creates and cleans up a symbol", () => {
|
|
@@ -33,5 +34,6 @@ it("creates and cleans up a symbol", () => {
|
|
|
33
34
|
const subScope = [...binder.globalScope.children][0];
|
|
34
35
|
expect(subScope.symbols.size).toBe(1);
|
|
35
36
|
doDecl.value = false;
|
|
37
|
+
flushJobs();
|
|
36
38
|
expect(subScope.symbols.size).toBe(0);
|
|
37
39
|
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
Children,
|
|
4
|
+
createTap,
|
|
5
|
+
Declaration,
|
|
6
|
+
List,
|
|
7
|
+
Output,
|
|
8
|
+
ReferenceOrContent,
|
|
9
|
+
Refkey,
|
|
10
|
+
refkey,
|
|
11
|
+
resolve,
|
|
12
|
+
Scope,
|
|
13
|
+
SourceFile,
|
|
14
|
+
useBinder,
|
|
15
|
+
} from "../../src/index.js";
|
|
16
|
+
import { d, renderToString } from "../../testing/render.js";
|
|
17
|
+
|
|
18
|
+
function TestWrapper(props: { children: Children }) {
|
|
19
|
+
const GetBinder = createTap(() => useBinder());
|
|
20
|
+
|
|
21
|
+
function Reference(props: { refkey: Refkey }) {
|
|
22
|
+
const result = resolve(props.refkey);
|
|
23
|
+
return result.value.targetDeclaration.name;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Output>
|
|
28
|
+
<SourceFile path="test.txt" filetype="txt" reference={Reference}>
|
|
29
|
+
<GetBinder />
|
|
30
|
+
<Scope>
|
|
31
|
+
<List>{props.children}</List>
|
|
32
|
+
</Scope>
|
|
33
|
+
</SourceFile>
|
|
34
|
+
</Output>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe("render the reference name if a declaration exists", () => {
|
|
39
|
+
it("declaration is before", () => {
|
|
40
|
+
const rk1 = refkey();
|
|
41
|
+
const template = (
|
|
42
|
+
<TestWrapper>
|
|
43
|
+
<Declaration name="A" refkey={rk1}>
|
|
44
|
+
Declare A
|
|
45
|
+
</Declaration>
|
|
46
|
+
<ReferenceOrContent refkey={rk1}>No Reference A</ReferenceOrContent>
|
|
47
|
+
</TestWrapper>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
expect(renderToString(template)).toEqual(d`
|
|
51
|
+
Declare A
|
|
52
|
+
A
|
|
53
|
+
`);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("declaration is after", () => {
|
|
57
|
+
const rk1 = refkey();
|
|
58
|
+
const template = (
|
|
59
|
+
<TestWrapper>
|
|
60
|
+
<ReferenceOrContent refkey={rk1}>No Reference A</ReferenceOrContent>
|
|
61
|
+
<Declaration name="A" refkey={rk1}>
|
|
62
|
+
Declare A
|
|
63
|
+
</Declaration>
|
|
64
|
+
</TestWrapper>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
expect(renderToString(template)).toEqual(d`
|
|
68
|
+
A
|
|
69
|
+
Declare A
|
|
70
|
+
`);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("render content if there is not declaration attached to symbol", () => {
|
|
75
|
+
const rk1 = refkey();
|
|
76
|
+
const template = (
|
|
77
|
+
<TestWrapper>
|
|
78
|
+
<ReferenceOrContent refkey={rk1}>No Reference A</ReferenceOrContent>
|
|
79
|
+
</TestWrapper>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
expect(renderToString(template)).toEqual(d`
|
|
83
|
+
No Reference A
|
|
84
|
+
`);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("mixed", () => {
|
|
88
|
+
const rk1 = refkey();
|
|
89
|
+
const rk2 = refkey();
|
|
90
|
+
const template = (
|
|
91
|
+
<TestWrapper>
|
|
92
|
+
<Declaration name="A" refkey={rk1}>
|
|
93
|
+
Declare A
|
|
94
|
+
</Declaration>
|
|
95
|
+
<ReferenceOrContent refkey={rk1}>No Reference A</ReferenceOrContent>
|
|
96
|
+
<ReferenceOrContent refkey={rk2}>No Reference B</ReferenceOrContent>
|
|
97
|
+
</TestWrapper>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
expect(renderToString(template)).toEqual(d`
|
|
101
|
+
Declare A
|
|
102
|
+
A
|
|
103
|
+
No Reference B
|
|
104
|
+
`);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("resolve ref via source file reference", () => {
|
|
108
|
+
const rk1 = refkey();
|
|
109
|
+
|
|
110
|
+
const GetBinder = createTap(() => useBinder());
|
|
111
|
+
|
|
112
|
+
const Reference = vi.fn((props: { refkey: Refkey }) => {
|
|
113
|
+
const result = resolve(props.refkey);
|
|
114
|
+
return `ViaRef.${result.value.targetDeclaration.name}`;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const template = (
|
|
118
|
+
<Output>
|
|
119
|
+
<SourceFile path="test.txt" filetype="txt" reference={Reference}>
|
|
120
|
+
<GetBinder />
|
|
121
|
+
<Scope>
|
|
122
|
+
<List>
|
|
123
|
+
<Declaration name="A" refkey={rk1}>
|
|
124
|
+
Declare A
|
|
125
|
+
</Declaration>
|
|
126
|
+
<ReferenceOrContent refkey={rk1}>No Reference A</ReferenceOrContent>
|
|
127
|
+
</List>
|
|
128
|
+
</Scope>
|
|
129
|
+
</SourceFile>
|
|
130
|
+
</Output>
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
expect(renderToString(template)).toEqual(d`
|
|
134
|
+
Declare A
|
|
135
|
+
ViaRef.A
|
|
136
|
+
`);
|
|
137
|
+
expect(Reference).toHaveBeenCalledTimes(1);
|
|
138
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "@alloy-js/core/testing";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
|
-
import { expect, it } from "vitest";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { For } from "../../src/components/For.jsx";
|
|
5
5
|
import { onCleanup, printTree, reactive, renderTree } from "../../src/index.js";
|
|
6
|
+
import { flushJobs } from "../../src/scheduler.js";
|
|
6
7
|
|
|
7
8
|
it("works", () => {
|
|
8
9
|
const messages = ["hi", "bye"];
|
|
@@ -17,6 +18,30 @@ it("works", () => {
|
|
|
17
18
|
`);
|
|
18
19
|
});
|
|
19
20
|
|
|
21
|
+
describe("readonly collections", () => {
|
|
22
|
+
const out = d`
|
|
23
|
+
a
|
|
24
|
+
b
|
|
25
|
+
`;
|
|
26
|
+
it("array", () => {
|
|
27
|
+
const messages: readonly string[] = ["a", "b"];
|
|
28
|
+
expect(<For each={messages}>{(x) => <>{x}</>}</For>).toRenderTo(out);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("map", () => {
|
|
32
|
+
const messages: ReadonlyMap<string, string> = new Map([
|
|
33
|
+
["a", "a"],
|
|
34
|
+
["b", "b"],
|
|
35
|
+
]);
|
|
36
|
+
expect(<For each={messages}>{(x) => <>{x}</>}</For>).toRenderTo(out);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("set", () => {
|
|
40
|
+
const messages: ReadonlySet<string> = new Set(["a", "b"]);
|
|
41
|
+
expect(<For each={messages}>{(x) => <>{x}</>}</For>).toRenderTo(out);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
20
45
|
it("handles map entries", () => {
|
|
21
46
|
const map = new Map([["a", { name: "foo" }]]);
|
|
22
47
|
const entries = Array.from(map.entries());
|
|
@@ -76,6 +101,7 @@ it("doesn't rerender mappers", () => {
|
|
|
76
101
|
expect(count).toBe(2);
|
|
77
102
|
|
|
78
103
|
messages.push("maybe");
|
|
104
|
+
flushJobs();
|
|
79
105
|
|
|
80
106
|
expect(count).toBe(3);
|
|
81
107
|
expect(printTree(tree)).toBe(d`
|
|
@@ -93,7 +119,7 @@ it("doesn't rerender mappers with sets", () => {
|
|
|
93
119
|
expect(count).toBe(2);
|
|
94
120
|
|
|
95
121
|
messages.add("maybe");
|
|
96
|
-
|
|
122
|
+
flushJobs();
|
|
97
123
|
expect(count).toBe(3);
|
|
98
124
|
expect(printTree(tree)).toBe(d`
|
|
99
125
|
item 0
|
|
@@ -116,7 +142,7 @@ it("doesn't rerender mappers with maps", () => {
|
|
|
116
142
|
expect(count).toBe(2);
|
|
117
143
|
|
|
118
144
|
messages.set("maybe", "three");
|
|
119
|
-
|
|
145
|
+
flushJobs();
|
|
120
146
|
expect(count).toBe(3);
|
|
121
147
|
expect(printTree(tree)).toBe(d`
|
|
122
148
|
item 0
|
|
@@ -132,9 +158,11 @@ it("doesn't rerender mappers (with splice)", () => {
|
|
|
132
158
|
const tree = renderTree(template);
|
|
133
159
|
expect(count).toBe(3);
|
|
134
160
|
messages.splice(1, 1);
|
|
161
|
+
flushJobs();
|
|
135
162
|
// A sufficiently smart mapJoin would be able to handle this case...
|
|
136
163
|
// but for now we re-render everything after the splice point.
|
|
137
164
|
expect(count).toBe(4);
|
|
165
|
+
|
|
138
166
|
expect(printTree(tree)).toBe(d`
|
|
139
167
|
item 0
|
|
140
168
|
item 3
|
|
@@ -165,12 +193,14 @@ it("cleans up things which end up removed (with push)", () => {
|
|
|
165
193
|
`);
|
|
166
194
|
|
|
167
195
|
items.pop();
|
|
196
|
+
flushJobs();
|
|
168
197
|
expect(cleanups).toEqual(["b"]);
|
|
169
198
|
expect(printTree(tree)).toBe(d`
|
|
170
199
|
Letter a
|
|
171
200
|
`);
|
|
172
201
|
|
|
173
202
|
items.pop();
|
|
203
|
+
flushJobs();
|
|
174
204
|
expect(cleanups).toEqual(["b", "a"]);
|
|
175
205
|
expect(printTree(tree)).toBe("");
|
|
176
206
|
});
|
|
@@ -200,7 +230,7 @@ it("cleans up things which end up removed (with splice)", () => {
|
|
|
200
230
|
`);
|
|
201
231
|
|
|
202
232
|
items.splice(1, 1);
|
|
203
|
-
|
|
233
|
+
flushJobs();
|
|
204
234
|
// A sufficiently smart mapJoin would be able to handle this case...
|
|
205
235
|
// but for now we re-render everything after the splice point.
|
|
206
236
|
expect(cleanups).toEqual(["b", "c"]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { shallowReactive } from "@vue/reactivity";
|
|
2
|
+
import { expect, it } from "vitest";
|
|
3
|
+
import { For } from "../../src/index.js";
|
|
4
|
+
import { printTree, renderTree } from "../../src/render.js";
|
|
5
|
+
import { d } from "../../testing/render.js";
|
|
6
|
+
|
|
7
|
+
it("it should work with circular reactives", () => {
|
|
8
|
+
const items: string[] = shallowReactive([]);
|
|
9
|
+
let added = false;
|
|
10
|
+
function MaybeAddString(props: any) {
|
|
11
|
+
if (!added) {
|
|
12
|
+
items.push("item " + items.length);
|
|
13
|
+
added = true;
|
|
14
|
+
}
|
|
15
|
+
return <>{props.item}</>;
|
|
16
|
+
}
|
|
17
|
+
const template = (
|
|
18
|
+
<>
|
|
19
|
+
<For each={items}>
|
|
20
|
+
{(item) => {
|
|
21
|
+
return <MaybeAddString item={item} />;
|
|
22
|
+
}}
|
|
23
|
+
</For>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
const tree = renderTree(template);
|
|
27
|
+
items.push("item start");
|
|
28
|
+
expect(printTree(tree)).toBe(d`
|
|
29
|
+
item start
|
|
30
|
+
item 1
|
|
31
|
+
`);
|
|
32
|
+
});
|
|
@@ -2,6 +2,7 @@ import { Children, effect, memo, onCleanup } from "@alloy-js/core/jsx-runtime";
|
|
|
2
2
|
import { ref } from "@vue/reactivity";
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { renderTree } from "../../src/render.js";
|
|
5
|
+
import { flushJobs } from "../../src/scheduler.js";
|
|
5
6
|
|
|
6
7
|
describe("memo cleanup", () => {
|
|
7
8
|
it("cleans up when memo value is recomputed", () => {
|
|
@@ -19,6 +20,7 @@ describe("memo cleanup", () => {
|
|
|
19
20
|
expect(callCount).toBe(0);
|
|
20
21
|
|
|
21
22
|
r.value = 2;
|
|
23
|
+
flushJobs();
|
|
22
24
|
|
|
23
25
|
expect(m()).toBe(2);
|
|
24
26
|
expect(callCount).toBe(1);
|
|
@@ -40,6 +42,7 @@ describe("effect cleanup", () => {
|
|
|
40
42
|
expect(cleanedUp).toBe(false);
|
|
41
43
|
|
|
42
44
|
r.value = 2;
|
|
45
|
+
flushJobs();
|
|
43
46
|
|
|
44
47
|
expect(cleanedUp).toBe(true);
|
|
45
48
|
});
|
|
@@ -58,6 +61,7 @@ describe("element cleanup", () => {
|
|
|
58
61
|
const template = <>{el}</>;
|
|
59
62
|
renderTree(template);
|
|
60
63
|
el.value = "";
|
|
64
|
+
flushJobs();
|
|
61
65
|
expect(cleanedUp).toBe(true);
|
|
62
66
|
});
|
|
63
67
|
|
|
@@ -85,6 +89,7 @@ describe("element cleanup", () => {
|
|
|
85
89
|
const template = <>{el}</>;
|
|
86
90
|
renderTree(template);
|
|
87
91
|
el.value = "";
|
|
92
|
+
flushJobs();
|
|
88
93
|
expect(cleanedUpC1).toBe(true);
|
|
89
94
|
expect(cleanedUpC2).toBe(true);
|
|
90
95
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ref } from "@vue/reactivity";
|
|
2
2
|
import { expect, it } from "vitest";
|
|
3
3
|
import { memo, untrack } from "../../src/jsx-runtime.js";
|
|
4
|
+
import { flushJobs } from "../../src/scheduler.js";
|
|
4
5
|
|
|
5
6
|
it("ignores signals for dependency tracking", () => {
|
|
6
7
|
const signal = ref(0);
|
|
@@ -12,6 +13,7 @@ it("ignores signals for dependency tracking", () => {
|
|
|
12
13
|
expect(m()).toBe(0);
|
|
13
14
|
|
|
14
15
|
signal.value = 1;
|
|
16
|
+
flushJobs();
|
|
15
17
|
|
|
16
18
|
expect(m()).toBe(0);
|
|
17
19
|
});
|
|
@@ -28,6 +30,7 @@ it("doesn't affect signal changes", () => {
|
|
|
28
30
|
untrack(() => {
|
|
29
31
|
signal.value = 1;
|
|
30
32
|
});
|
|
33
|
+
flushJobs();
|
|
31
34
|
|
|
32
35
|
expect(m()).toBe(1);
|
|
33
36
|
});
|
|
@@ -2,6 +2,7 @@ import { memo } from "@alloy-js/core/jsx-runtime";
|
|
|
2
2
|
import { ref } from "@vue/reactivity";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import { renderTree } from "../../src/render.js";
|
|
5
|
+
import { flushJobs } from "../../src/scheduler.js";
|
|
5
6
|
|
|
6
7
|
it("memoizes child components", () => {
|
|
7
8
|
let renderCount = 0;
|
|
@@ -26,5 +27,6 @@ it("memoizes child components", () => {
|
|
|
26
27
|
|
|
27
28
|
renderTree(template);
|
|
28
29
|
doThing.value = true;
|
|
30
|
+
flushJobs();
|
|
29
31
|
expect(renderCount).toBe(2);
|
|
30
32
|
});
|