marionette 5.0.0-beta.4 → 5.0.0-beta.5
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 +22 -0
- package/dist/docs/config/api-contracts/inventory.json +56 -31
- package/dist/docs/config/api-contracts/semantics.json +39 -12
- package/dist/docs/config/diagnostics/catalog.json +16 -0
- package/dist/docs/docs/agent-tools.md +2 -2
- package/dist/docs/docs/application-effects.md +63 -1
- package/dist/docs/docs/beta.md +7 -6
- package/dist/docs/docs/compact-reference.md +4 -3
- package/dist/docs/docs/data.api.md +9 -6
- package/dist/docs/docs/events.md +7 -0
- package/dist/docs/docs/installation.md +9 -9
- package/dist/docs/docs/marionette.application.md +161 -47
- package/dist/docs/docs/marionette.region.md +7 -0
- package/dist/docs/docs/marionette.state.md +5 -0
- package/dist/docs/docs/migration-from-v4.md +3 -3
- package/dist/docs/docs/optional-backbone.md +1 -1
- package/dist/docs/docs/readme.md +3 -3
- package/dist/docs/docs/task-recipes.md +137 -0
- package/dist/docs/docs/testing.md +7 -5
- package/dist/docs/docs/typescript.md +10 -6
- package/dist/docs/docs/view.lifecycle.md +5 -0
- package/dist/docs/docs/view.rendering.md +27 -0
- package/dist/docs/manifest.json +44 -32
- package/dist/docs/packages/adapters/readme.md +5 -5
- package/dist/docs/packages/data/readme.md +9 -6
- package/dist/docs/packages/radio/readme.md +1 -1
- package/dist/docs/packages/utils/readme.md +1 -1
- package/dist/docs/readme.md +3 -3
- package/dist/docs/starter/package.json +3 -3
- package/dist/docs/test/fixtures/docs-application-guides/preparation.mjs +90 -0
- package/dist/docs/test/fixtures/docs-application-guides/validate.mjs +7 -3
- package/dist/docs/test/fixtures/docs-prerendered-content/literal-template.mjs +58 -0
- package/dist/docs/test/fixtures/docs-prerendered-content/validate.mjs +3 -0
- package/dist/docs/test/fixtures/docs-region-lifecycle/retry-delete.mjs +190 -0
- package/dist/docs/test/fixtures/docs-region-lifecycle/validate.mjs +3 -0
- package/dist/docs/upgradeGuide.md +75 -0
- package/dist/marionette.cjs +89 -15
- package/dist/marionette.cjs.map +1 -1
- package/dist/marionette.js +89 -15
- package/dist/marionette.js.map +1 -1
- package/dist/marionette.min.js +1 -1
- package/dist/marionette.min.js.map +1 -1
- package/dist/marionette.umd.js +90 -16
- package/dist/marionette.umd.js.map +1 -1
- package/dist/types/cjs/index.d.ts +1 -1
- package/dist/types/cjs/modules/application.d.ts +9 -2
- package/dist/types/esm/index.d.ts +1 -1
- package/dist/types/esm/modules/application.d.ts +9 -2
- package/package.json +3 -3
- package/readme.md +1 -1
- package/upgradeGuide.md +75 -0
package/changelog.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
### v5.0.0-beta.5
|
|
2
|
+
|
|
3
|
+
> An Application can keep its children without keeping yesterday’s living room.
|
|
4
|
+
|
|
5
|
+
* Separate Application root ownership from its host Region. Stopping an Application
|
|
6
|
+
releases its prepared and displayed roots without clearing another Application's
|
|
7
|
+
replacement in a borrowed Region. Prepare roots with `setView()` and hand them
|
|
8
|
+
to the Region with `showView()`; displaying a View directly through a Region
|
|
9
|
+
does not transfer Application ownership.
|
|
10
|
+
* Accept an existing Region in `start({ region })` and `restart({ region })`, so
|
|
11
|
+
retained child Applications can follow recreated parent layouts. Constructor
|
|
12
|
+
Region definitions remain owned; startup Regions are borrowed. Use `restart()`
|
|
13
|
+
when changing the host of an active Application.
|
|
14
|
+
* Add `childApps` constructor maps or functions for static, no-argument children.
|
|
15
|
+
Construct and register them once before parent initialization; activation stays
|
|
16
|
+
explicit. Subclass and option declarations replace inherited maps. Use
|
|
17
|
+
`addChildApp()` for dynamic children or constructor arguments.
|
|
18
|
+
* Expand executable lifecycle and migration guidance, and direct documentation
|
|
19
|
+
retrieval toward relevant contracts. These changes do not establish measured
|
|
20
|
+
agent-effectiveness or stable-v5 readiness.
|
|
21
|
+
* Shard Windows release certification while retaining the complete fixture gate.
|
|
22
|
+
|
|
1
23
|
### v5.0.0-beta.4
|
|
2
24
|
|
|
3
25
|
> Events announce. Preparation waits. Apparently those needed separate job descriptions.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"authority": "authored TypeScript and explicit public behavioral evidence",
|
|
4
|
-
"semanticsSha256": "
|
|
4
|
+
"semanticsSha256": "077157bce1349db05f4e0870f4c4bce89077b3b0d227da7ec485034388c79074",
|
|
5
5
|
"entrypoints": [
|
|
6
6
|
{
|
|
7
7
|
"name": "marionette",
|
|
8
|
-
"version": "5.0.0-beta.
|
|
8
|
+
"version": "5.0.0-beta.5",
|
|
9
9
|
"kind": "runtime",
|
|
10
10
|
"source": "src/index.ts",
|
|
11
11
|
"conditions": {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"bindEvents": "<Receiver extends Listener>(this: Receiver, entity?: false | \"\" | 0 | 0n | EventSource | null | undefined, bindings?: false | object | \"\" | 0 | 0n | null | undefined) => Receiver",
|
|
57
57
|
"bindRequests": "<Receiver>(this: Receiver, channel?: false | \"\" | 0 | 0n | ReplyChannel | null | undefined, bindings?: false | object | \"\" | 0 | 0n | null | undefined) => Receiver",
|
|
58
58
|
"channelName": "?string | (() => string) | undefined",
|
|
59
|
+
"childApps": "?ChildApplications | (() => ChildApplications) | undefined",
|
|
59
60
|
"cid": "string",
|
|
60
61
|
"cidPrefix": "string",
|
|
61
62
|
"createState": "(options?: (object & ApplicationOptions) | undefined) => unknown",
|
|
@@ -96,10 +97,10 @@
|
|
|
96
97
|
"region": "?RegionDefinition | undefined",
|
|
97
98
|
"regionClass": "RegionClass",
|
|
98
99
|
"removeChildApp": "(name: string, options?: unknown) => Promise<ApplicationInstance<object, unknown, unknown> | undefined>",
|
|
99
|
-
"restart": "(options?:
|
|
100
|
+
"restart": "(options?: ApplicationStartOptions | undefined) => Promise<boolean>",
|
|
100
101
|
"setView": "<Child extends SupportedView>(view: Child) => Child",
|
|
101
102
|
"showView": "{ (view?: undefined, options?: ShowOptions | undefined): SupportedView | undefined; <Child extends SupportedView>(view: Child, options?: ShowOptions | undefined): Child; }",
|
|
102
|
-
"start": "(options?:
|
|
103
|
+
"start": "(options?: ApplicationStartOptions | undefined) => Promise<boolean>",
|
|
103
104
|
"state": "?unknown",
|
|
104
105
|
"State": "Partial<StateApi<never>>",
|
|
105
106
|
"stateEvents": "?object | (() => object) | undefined",
|
|
@@ -354,6 +355,7 @@
|
|
|
354
355
|
"bindEvents": "<Receiver extends Listener>(this: Receiver, entity?: false | \"\" | 0 | 0n | EventSource | null | undefined, bindings?: false | object | \"\" | 0 | 0n | null | undefined) => Receiver",
|
|
355
356
|
"bindRequests": "<Receiver>(this: Receiver, channel?: false | \"\" | 0 | 0n | ReplyChannel | null | undefined, bindings?: false | object | \"\" | 0 | 0n | null | undefined) => Receiver",
|
|
356
357
|
"channelName": "?string | (() => string) | undefined",
|
|
358
|
+
"childApps": "?ChildApplications | (() => ChildApplications) | undefined",
|
|
357
359
|
"cid": "string",
|
|
358
360
|
"cidPrefix": "string",
|
|
359
361
|
"createState": "(options?: Options | undefined) => unknown",
|
|
@@ -394,10 +396,10 @@
|
|
|
394
396
|
"region": "?RegionDefinition | undefined",
|
|
395
397
|
"regionClass": "RegionClass",
|
|
396
398
|
"removeChildApp": "(name: string, options?: unknown) => Promise<ApplicationInstance<object, unknown, unknown> | undefined>",
|
|
397
|
-
"restart": "(options?:
|
|
399
|
+
"restart": "(options?: ApplicationStartOptions | undefined) => Promise<boolean>",
|
|
398
400
|
"setView": "<Child extends SupportedView>(view: Child) => Child",
|
|
399
401
|
"showView": "{ (view?: undefined, options?: ShowOptions | undefined): SupportedView | undefined; <Child extends SupportedView>(view: Child, options?: ShowOptions | undefined): Child; }",
|
|
400
|
-
"start": "(options?:
|
|
402
|
+
"start": "(options?: ApplicationStartOptions | undefined) => Promise<boolean>",
|
|
401
403
|
"state": "?unknown",
|
|
402
404
|
"State": "Partial<StateApi<never>>",
|
|
403
405
|
"stateEvents": "?object | (() => object) | undefined",
|
|
@@ -604,6 +606,7 @@
|
|
|
604
606
|
],
|
|
605
607
|
"members": {
|
|
606
608
|
"channelName": "?string | (() => string) | undefined",
|
|
609
|
+
"childApps": "?ChildApplications | (() => ChildApplications) | undefined",
|
|
607
610
|
"radioEvents": "?object | (() => object) | undefined",
|
|
608
611
|
"radioRequests": "?object | (() => object) | undefined",
|
|
609
612
|
"region": "?RegionDefinition | undefined",
|
|
@@ -614,6 +617,19 @@
|
|
|
614
617
|
"callableMembers": [],
|
|
615
618
|
"operationContracts": {}
|
|
616
619
|
},
|
|
620
|
+
{
|
|
621
|
+
"name": "ApplicationStartOptions",
|
|
622
|
+
"kind": "type",
|
|
623
|
+
"signature": "ApplicationStartOptions",
|
|
624
|
+
"contracts": [
|
|
625
|
+
"type-shapes"
|
|
626
|
+
],
|
|
627
|
+
"members": {
|
|
628
|
+
"region": "?RegionInstance<RegionOptions> | undefined"
|
|
629
|
+
},
|
|
630
|
+
"callableMembers": [],
|
|
631
|
+
"operationContracts": {}
|
|
632
|
+
},
|
|
617
633
|
{
|
|
618
634
|
"name": "Behavior",
|
|
619
635
|
"kind": "value",
|
|
@@ -5342,7 +5358,7 @@
|
|
|
5342
5358
|
},
|
|
5343
5359
|
{
|
|
5344
5360
|
"name": "@mnjs/utils",
|
|
5345
|
-
"version": "5.0.0-beta.
|
|
5361
|
+
"version": "5.0.0-beta.5",
|
|
5346
5362
|
"kind": "runtime",
|
|
5347
5363
|
"source": "packages/utils/src/index.ts",
|
|
5348
5364
|
"conditions": {
|
|
@@ -5963,7 +5979,7 @@
|
|
|
5963
5979
|
},
|
|
5964
5980
|
{
|
|
5965
5981
|
"name": "@mnjs/radio",
|
|
5966
|
-
"version": "5.0.0-beta.
|
|
5982
|
+
"version": "5.0.0-beta.5",
|
|
5967
5983
|
"kind": "runtime",
|
|
5968
5984
|
"source": "packages/radio/src/index.ts",
|
|
5969
5985
|
"conditions": {
|
|
@@ -6424,7 +6440,7 @@
|
|
|
6424
6440
|
},
|
|
6425
6441
|
{
|
|
6426
6442
|
"name": "@mnjs/data",
|
|
6427
|
-
"version": "5.0.0-beta.
|
|
6443
|
+
"version": "5.0.0-beta.5",
|
|
6428
6444
|
"kind": "runtime",
|
|
6429
6445
|
"source": "packages/data/src/index.ts",
|
|
6430
6446
|
"conditions": {
|
|
@@ -6957,7 +6973,7 @@
|
|
|
6957
6973
|
},
|
|
6958
6974
|
{
|
|
6959
6975
|
"name": "@mnjs/adapters/backbone",
|
|
6960
|
-
"version": "5.0.0-beta.
|
|
6976
|
+
"version": "5.0.0-beta.5",
|
|
6961
6977
|
"kind": "runtime",
|
|
6962
6978
|
"source": "packages/adapters/src/data/backbone.ts",
|
|
6963
6979
|
"conditions": {
|
|
@@ -7032,7 +7048,7 @@
|
|
|
7032
7048
|
},
|
|
7033
7049
|
{
|
|
7034
7050
|
"name": "@mnjs/adapters/dom/jquery",
|
|
7035
|
-
"version": "5.0.0-beta.
|
|
7051
|
+
"version": "5.0.0-beta.5",
|
|
7036
7052
|
"kind": "runtime",
|
|
7037
7053
|
"source": "packages/adapters/src/dom/jquery.ts",
|
|
7038
7054
|
"conditions": {
|
|
@@ -7092,7 +7108,7 @@
|
|
|
7092
7108
|
},
|
|
7093
7109
|
{
|
|
7094
7110
|
"name": "@mnjs/adapters/xstate",
|
|
7095
|
-
"version": "5.0.0-beta.
|
|
7111
|
+
"version": "5.0.0-beta.5",
|
|
7096
7112
|
"kind": "runtime",
|
|
7097
7113
|
"source": "packages/adapters/src/data/xstate.ts",
|
|
7098
7114
|
"conditions": {
|
|
@@ -7179,7 +7195,7 @@
|
|
|
7179
7195
|
},
|
|
7180
7196
|
{
|
|
7181
7197
|
"name": "@mnjs/adapters/dom/morphdom",
|
|
7182
|
-
"version": "5.0.0-beta.
|
|
7198
|
+
"version": "5.0.0-beta.5",
|
|
7183
7199
|
"kind": "runtime",
|
|
7184
7200
|
"source": "packages/adapters/src/dom/morphdom.ts",
|
|
7185
7201
|
"conditions": {
|
|
@@ -7219,7 +7235,7 @@
|
|
|
7219
7235
|
},
|
|
7220
7236
|
{
|
|
7221
7237
|
"name": "@mnjs/adapters/dom/lit-html",
|
|
7222
|
-
"version": "5.0.0-beta.
|
|
7238
|
+
"version": "5.0.0-beta.5",
|
|
7223
7239
|
"kind": "runtime",
|
|
7224
7240
|
"source": "packages/adapters/src/dom/lit-html.ts",
|
|
7225
7241
|
"conditions": {
|
|
@@ -7444,6 +7460,13 @@
|
|
|
7444
7460
|
"Region",
|
|
7445
7461
|
"View"
|
|
7446
7462
|
]
|
|
7463
|
+
},
|
|
7464
|
+
{
|
|
7465
|
+
"code": "MN0041",
|
|
7466
|
+
"slug": "application-region-conflict",
|
|
7467
|
+
"objects": [
|
|
7468
|
+
"Application"
|
|
7469
|
+
]
|
|
7447
7470
|
}
|
|
7448
7471
|
],
|
|
7449
7472
|
"toolingEntrypoints": [
|
|
@@ -8030,7 +8053,7 @@
|
|
|
8030
8053
|
"packages/utils/src/trigger-method.ts": "3a6460a5fdc6e0a319a6eea1e323f34f19fa0811ee1ea71fccaa45ade531d38f",
|
|
8031
8054
|
"packages/utils/src/unique-id.ts": "22f5f12062eeef10c1336ee01e4b28b7d0cfe562c0f53f79e2a3219eb389f72b",
|
|
8032
8055
|
"src/create-marionette.ts": "12baf1aadeeae54aefbb7e5777db9392f74650a407dcd506e97ebf18b73cfcc1",
|
|
8033
|
-
"src/index.ts": "
|
|
8056
|
+
"src/index.ts": "41476602f9a5712f0742954fdc7d20a09bef62ba80711d25abe3d1bda8064656",
|
|
8034
8057
|
"src/mixins/behaviors.ts": "720633138c31d36c3c9e9367c1cd9ef4a9b8514b2e5cfcb88e04bfdea7566991",
|
|
8035
8058
|
"src/mixins/common.ts": "375340ed4f7c5db6c3bd9dc9d73c73b49e69347e3451c0db7dd646ae714f5156",
|
|
8036
8059
|
"src/mixins/delegate-entity-events.ts": "778dc193ff0b32611e6a9112e133f961c2f522c6864ea847c70e7d676fb41c9c",
|
|
@@ -8041,7 +8064,7 @@
|
|
|
8041
8064
|
"src/mixins/ui.ts": "5cb417e1456cd17b43357e480102be3fc1b436167c43b853af7d45ab79d35ffd",
|
|
8042
8065
|
"src/mixins/view-events.ts": "108a31ba7d0f74916848c5b2f85b422afe15703a8e9fa2dbca0b17b6a5ff0fb2",
|
|
8043
8066
|
"src/mixins/view.ts": "d0895d07d087d24d5cd8ce8d051a7acbbc9cee64fd2b5a6824b26973fc064e18",
|
|
8044
|
-
"src/modules/application.ts": "
|
|
8067
|
+
"src/modules/application.ts": "a13c62d8e5985de4c05806c71265a051023ab845dc9b9c65fa120734494817e8",
|
|
8045
8068
|
"src/modules/behavior.ts": "475fe0451e629559992bd0f5ec18ad16438309b018bf643b5917dfc47a1693b6",
|
|
8046
8069
|
"src/modules/child-view-container.ts": "ab52685a0a4fd8861534b8e9784704791c3e72a15ee19547766293be4a030803",
|
|
8047
8070
|
"src/modules/collection-view.ts": "40bbaefedea29de171597e905f8fdde7ee6f55877da9e441996c9b5bf56bfe58",
|
|
@@ -8062,39 +8085,41 @@
|
|
|
8062
8085
|
"src/utils/subscribe-bindings.ts": "24633b6b39c2d0a8c833670e2ab1d584fb6bed2fae3ac5cfb5d42461cf233f4a"
|
|
8063
8086
|
},
|
|
8064
8087
|
"evidence": {
|
|
8065
|
-
"config/diagnostics/catalog.json": "
|
|
8088
|
+
"config/diagnostics/catalog.json": "45360deea6dfe7d531b256dbbebb443e9fa578fb0d43fc9becce7ab5126c76bf",
|
|
8066
8089
|
"docs/choosing-integrations.md": "385bfb2c7d85a8e0db71fd795ed1fef488aa637aa5094e93210810ff91f31f12",
|
|
8067
8090
|
"docs/common.md": "1d14004d1c49e98ca40be9fd28d35faaf372f2a12f13fae6afa3cac8a8bf14cc",
|
|
8068
|
-
"docs/data.api.md": "
|
|
8091
|
+
"docs/data.api.md": "f96a24fa8f08ed1437944d558e91878a16f941b7efd3dcc40c91b2de52d1f5a2",
|
|
8069
8092
|
"docs/diagnostic-catalog.md": "1df844c7e8edbea59a8c07776d656d45f77266108babb770d7690183fe85d180",
|
|
8070
8093
|
"docs/dom.api.md": "a697a637ae4c6cc92aa5d72850b404763f08e0417800feacc0b431ec073d3916",
|
|
8071
8094
|
"docs/dom.interactions.md": "81bd678c7d498e08c08c84cfc3bbe1d27451ef46ed521e67fff4f72450bdbadb",
|
|
8072
8095
|
"docs/events.class.md": "faed5ac4f6eca3ec447ae7cd44b6efd8f039e935b38a4c191076d485bd57a35f",
|
|
8073
|
-
"docs/events.md": "
|
|
8074
|
-
"docs/marionette.application.md": "
|
|
8096
|
+
"docs/events.md": "8225ceda0d100b6bf466ab779cacc1001b7eec16b8dfd09d8c43d97924228e50",
|
|
8097
|
+
"docs/marionette.application.md": "711283795f71f7bff273498e97a0e0c54a815f02f1ff9339a22fdf13d8bca048",
|
|
8075
8098
|
"docs/marionette.behavior.md": "bf002b5ba380cf1bb1054b98f9813d89b4aef16ba6495d02b823ed178ab3f0c4",
|
|
8076
8099
|
"docs/marionette.collectionview.md": "5af1ed04daaf0e976fdd0538b0931fd370fd09167079d0c21b01195f8628cefe",
|
|
8077
8100
|
"docs/marionette.mnobject.md": "056bb3041902d66831a0031e2e9c97770f485f613450861ae55aba46ca592243",
|
|
8078
|
-
"docs/marionette.region.md": "
|
|
8079
|
-
"docs/marionette.state.md": "
|
|
8101
|
+
"docs/marionette.region.md": "4b205c3699d771e6d6b288fd0914b15af80a7a76cfaaae9e63a92ac9ed0a6dee",
|
|
8102
|
+
"docs/marionette.state.md": "2598f36fad1f5103f1f940312e311e1ed3c446d2e7725bdac690367511f73d97",
|
|
8080
8103
|
"docs/marionette.view.md": "b7b5871b0b56474cc3bc2513c2e2c4fdabdafcd724bfbaa8076ea7eee40d5ab5",
|
|
8081
|
-
"docs/optional-backbone.md": "
|
|
8104
|
+
"docs/optional-backbone.md": "f1d47cd797e109a9a57f56e1db187b50bafd16f1ff2775f03559f9f7e59bc86c",
|
|
8082
8105
|
"docs/radio.md": "c0013e382554aa6cd4e46ab60908f5e6cce7117c134b3f4656c37a163f8a5f4e",
|
|
8083
8106
|
"docs/runtime-isolation.md": "e18927a5aa30558805018c9c28dffceaf02d953394efce8eaa7d35f0711de7f4",
|
|
8084
|
-
"docs/typescript.md": "
|
|
8107
|
+
"docs/typescript.md": "08361d38a3b3c29dcc45097fc44d74962cee91d9d97bea9f84006c1a9639e59b",
|
|
8085
8108
|
"docs/utils.md": "5c2d0854895bb19f613926788cf81c5849cf18af1e43ac540e860b226fa80d2a",
|
|
8086
|
-
"docs/view.lifecycle.md": "
|
|
8087
|
-
"docs/view.rendering.md": "
|
|
8088
|
-
"packages/adapters/readme.md": "
|
|
8089
|
-
"packages/data/readme.md": "
|
|
8090
|
-
"packages/utils/readme.md": "
|
|
8109
|
+
"docs/view.lifecycle.md": "1e5f0e77d9bba799296ed40860a1d466e58cc086c36f72314cbe3c9daeedf8e3",
|
|
8110
|
+
"docs/view.rendering.md": "106bd7c14f5897513a5072bed98d36e029b9be91650267f17ebcf90b03d8cb13",
|
|
8111
|
+
"packages/adapters/readme.md": "d1be90d2631fcd4346b9e4648e7288e63ff28063fd7ffb860f32de25164d5d29",
|
|
8112
|
+
"packages/data/readme.md": "041e330fad1a87c891844b774dd5309aae61cc7a36d76b3dcf9ec5dfcd7b8c95",
|
|
8113
|
+
"packages/utils/readme.md": "2ea64109e9b65c9fb66d48c30fec86b6475aa4d8c809cc68c68a28925ed93021",
|
|
8091
8114
|
"test/contracts/dom-adapters.js": "a3f71df6a2e52f8d4a52ebb2d3cbbc8e77e055f459daf7c071f4e5fd55ad8c3f",
|
|
8115
|
+
"test/unit/application-child-declarations.spec.js": "3b98e033f99902a8bff5c533c03599375381da4b4a01b9014e825eb21cb80e2b",
|
|
8092
8116
|
"test/unit/application-child-lifecycle.spec.js": "e69e6a140e341563b49333d09bd1c483151f9f4b2a494960a4dfc78bb81f8dcb",
|
|
8093
8117
|
"test/unit/application-lifecycle.spec.js": "43da21063d3b03c1c16fd047735458a26a98abe003ef75e607bad0f01a473f37",
|
|
8094
8118
|
"test/unit/application-ownership.spec.js": "f1e6a74f639bb6ceedd85957c696a45de28e1526ed41df0f34663a23b25bb68f",
|
|
8095
8119
|
"test/unit/application-preparation.spec.js": "23e58351eec5983b4d412be099a7e9306f4b758a1f501874f46baca8be940b56",
|
|
8096
|
-
"test/unit/application-prepared-view.spec.js": "
|
|
8097
|
-
"test/unit/application-root-view.spec.js": "
|
|
8120
|
+
"test/unit/application-prepared-view.spec.js": "9d97d5e8f4783d3fb9ffff19afda25d46e6c6fd5f61a89929c42d559f2a2cee4",
|
|
8121
|
+
"test/unit/application-root-view.spec.js": "e497b73aa9f1c67c228008dc744ba6675cfb7a72b3279367f95cf304d76b02da",
|
|
8122
|
+
"test/unit/application-start-region.spec.js": "d29546de2a4f7a56153eaeee39386b9c3f07933fb11c6c4e4d3ad0fdf60bb703",
|
|
8098
8123
|
"test/unit/backbone-adapter.spec.js": "016907f55d5e20d695f916dbd4189ac7e3e543a0f903df6a3922c207dade59df",
|
|
8099
8124
|
"test/unit/behavior-lifecycle.spec.js": "8c70d05fa530d27eac901291a3487c9cacac1ef1d0c22a3adda917da5774d05a",
|
|
8100
8125
|
"test/unit/behavior-ui-contract.spec.js": "65def27b40f17e3d931803faeff7c9dbb3c580e14f157fa5d2f8145fb95c1761",
|
|
@@ -1509,12 +1509,14 @@
|
|
|
1509
1509
|
"Application"
|
|
1510
1510
|
],
|
|
1511
1511
|
"result": "Operations resolve true at the requested target, false when superseded, and compatible calls share in-flight promises. Current readiness failure rejects the operation promise.",
|
|
1512
|
-
"timing": "Before and completion notifications are synchronous and ignore returns. Only prepareStart/prepareStop/prepareDestroy are awaited with options and an abort context; start completion receives one resolved preparation result. Supersession aborts before replacement preparation; adopted stop retains its original context/options without abort.",
|
|
1512
|
+
"timing": "Before and completion notifications are synchronous and ignore returns. Only prepareStart/prepareStop/prepareDestroy are awaited with options and an abort context; start completion receives one resolved preparation result. Supersession aborts before replacement preparation; adopted stop retains its original context/options without abort. Startup Region binding occurs before startup notifications, after any adopted stop readiness finishes.",
|
|
1513
1513
|
"ownership": "Registration never starts children. Callers explicitly await prerequisites. Stop/destroy traverse all owned descendants, including stopped intermediate owners; descendants cannot start/restart during an ancestor stop or terminal phase.",
|
|
1514
1514
|
"mutation": "Canceled readiness cannot append stale framework completion events or alter stable state.",
|
|
1515
|
-
"repetition": "Compatible calls share promises. A stopped owner still drains owned descendants without repeating its own stop preparation or notifications. Restart deactivates children; reactivation is explicit.",
|
|
1515
|
+
"repetition": "Compatible calls share promises. A stopped owner still drains owned descendants without repeating its own stop preparation or notifications. Restart deactivates children; reactivation is explicit. A different Region on start while running or starting is rejected with MN0041. Restart with a different host supersedes pending start/restart, deactivates first, then binds the latest host. A fresh start from stopped may bind a new host. Start-time region options accept only existing Region instances; constructor options retain Region definitions.",
|
|
1516
1516
|
"destruction": "Destruction blocks owner and descendant start/restart; successful destruction destroys owned children. Readiness rejection preserves the documented retry and partial-child boundaries.",
|
|
1517
|
-
"diagnostics": [
|
|
1517
|
+
"diagnostics": [
|
|
1518
|
+
"MN0041"
|
|
1519
|
+
],
|
|
1518
1520
|
"docs": [
|
|
1519
1521
|
{
|
|
1520
1522
|
"file": "docs/marionette.application.md",
|
|
@@ -1527,6 +1529,10 @@
|
|
|
1527
1529
|
{
|
|
1528
1530
|
"file": "docs/events.class.md",
|
|
1529
1531
|
"heading": "Application Events"
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
"file": "docs/marionette.application.md",
|
|
1535
|
+
"heading": "Starting an Application"
|
|
1530
1536
|
}
|
|
1531
1537
|
],
|
|
1532
1538
|
"tests": [
|
|
@@ -1573,6 +1579,14 @@
|
|
|
1573
1579
|
{
|
|
1574
1580
|
"file": "test/unit/application-preparation.spec.js",
|
|
1575
1581
|
"title": "notifies before startup, awaits preparation, and forwards one result to completion"
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
"file": "test/unit/application-start-region.spec.js",
|
|
1585
|
+
"title": "binds before startup notifications and forwards the complete options object"
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
"file": "test/unit/application-start-region.spec.js",
|
|
1589
|
+
"title": "keeps a prepared root while rebinding a stopped displayed root"
|
|
1576
1590
|
}
|
|
1577
1591
|
],
|
|
1578
1592
|
"events": [
|
|
@@ -2340,15 +2354,16 @@
|
|
|
2340
2354
|
"exports": [
|
|
2341
2355
|
"Application"
|
|
2342
2356
|
],
|
|
2343
|
-
"result": "Construction, addChildApp, setView and showView(view) return their public instance; showView() returns the prepared or
|
|
2344
|
-
"timing": "Construction, registration, root preparation/display and queries are synchronous; removeChildApp awaits child destruction before releasing ownership.",
|
|
2345
|
-
"ownership": "Named children belong to the Application until removal. setView temporarily owns a prepared View; showView hands it to the Region and
|
|
2346
|
-
"mutation": "setView destroys only a previous prepared View, leaving the displayed View until Region show replaces it. getView reads preparation or
|
|
2347
|
-
"repetition": "Preparing the same pending View is a no-op;
|
|
2348
|
-
"destruction": "Stop destroys a prepared View and empties the host. Destroy also tears down owned children and a constructed root Region; it preserves a borrowed Region. Direct destruction releases preparation; displayed
|
|
2357
|
+
"result": "Construction, addChildApp, setView and showView(view) return their public instance; showView() returns the prepared or selected displayed View, or undefined; repeated showView() on the selected displayed root is a no-op; removeChildApp returns a Promise of the removed child or undefined; queries return the declared state or optional owner member.",
|
|
2358
|
+
"timing": "Construction, registration, root preparation/display and queries are synchronous; removeChildApp awaits child destruction before releasing ownership. childApps resolves a map or function once and registers fresh no-argument children before initialize; declarations do not activate children. Parent restart retains registered instances without reconstructing or automatically reactivating them; start selected children explicitly.",
|
|
2359
|
+
"ownership": "Named children belong to the Application until removal. setView temporarily owns a prepared View; showView hands it to the Region and records the Application's selected displayed root. A direct Region display is not adopted or claimable; an Application may reselect its own displayed root.",
|
|
2360
|
+
"mutation": "setView destroys only a previous prepared View, leaving the selected displayed View until Region show replaces it. getView reads preparation or the Application's selected display without rendering. Child registration/removal coordinates with the owner lifecycle.",
|
|
2361
|
+
"repetition": "Preparing the same pending View is a no-op; reselecting the Application's displayed root cancels preparation. Showing the current View does not render or attach it again. Child registrations and lookups follow documented ownership guards. Child declaration maps replace rather than merge inherited maps and are not reprocessed on restart.",
|
|
2362
|
+
"destruction": "Stop destroys a prepared View and empties the host only when its selected displayed View is still current, or when a directly shown View occupies an Application-created Region. Destroy also tears down owned children and a constructed root Region; it preserves unrelated content in a borrowed Region. Direct destruction releases preparation; displayed View associations end on Region replacement, empty, or detachment.",
|
|
2349
2363
|
"diagnostics": [
|
|
2350
2364
|
"MN0003",
|
|
2351
|
-
"MN0007"
|
|
2365
|
+
"MN0007",
|
|
2366
|
+
"MN0031"
|
|
2352
2367
|
],
|
|
2353
2368
|
"docs": [
|
|
2354
2369
|
{
|
|
@@ -2387,15 +2402,27 @@
|
|
|
2387
2402
|
},
|
|
2388
2403
|
{
|
|
2389
2404
|
"file": "test/unit/application-root-view.spec.js",
|
|
2390
|
-
"title": "shows and reads
|
|
2405
|
+
"title": "shows and reads its selected View"
|
|
2391
2406
|
},
|
|
2392
2407
|
{
|
|
2393
2408
|
"file": "test/unit/application-root-view.spec.js",
|
|
2394
|
-
"title": "
|
|
2409
|
+
"title": "preserves an externally shown View and its borrowed Region"
|
|
2395
2410
|
},
|
|
2396
2411
|
{
|
|
2397
2412
|
"file": "test/unit/application-prepared-view.spec.js",
|
|
2398
2413
|
"title": "composes detached children through getView and updates one region after display"
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
"file": "test/unit/application-child-declarations.spec.js",
|
|
2417
|
+
"title": "retains declared children through explicit activation and restart, then destroys them"
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
"file": "test/unit/application-child-declarations.spec.js",
|
|
2421
|
+
"title": "replaces getter declarations through options without reading or assigning the getter"
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
"file": "test/unit/application-child-declarations.spec.js",
|
|
2425
|
+
"title": "resolves a function declaration once with the parent as context before initialize"
|
|
2399
2426
|
}
|
|
2400
2427
|
],
|
|
2401
2428
|
"members": [
|
|
@@ -702,6 +702,22 @@
|
|
|
702
702
|
"lint"
|
|
703
703
|
],
|
|
704
704
|
"benchmarkCategory": "lifecycle"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"code": "MN0041",
|
|
708
|
+
"slug": "application-region-conflict",
|
|
709
|
+
"status": "active",
|
|
710
|
+
"category": "ownership",
|
|
711
|
+
"severity": "error",
|
|
712
|
+
"objects": [
|
|
713
|
+
"Application"
|
|
714
|
+
],
|
|
715
|
+
"remediation": "Stop the Application before binding a different Region, or reuse the current Region while it is running or starting.",
|
|
716
|
+
"docsAnchor": "/errors/MN0041/",
|
|
717
|
+
"surfaces": [
|
|
718
|
+
"runtime"
|
|
719
|
+
],
|
|
720
|
+
"benchmarkCategory": "ownership"
|
|
705
721
|
}
|
|
706
722
|
]
|
|
707
723
|
}
|
|
@@ -92,13 +92,13 @@ and lockfile, including any npm alias. A v4 application may use
|
|
|
92
92
|
marionette found” does not mean the application has no Marionette dependency.
|
|
93
93
|
|
|
94
94
|
Download the exact target into a temporary directory without installing it in the
|
|
95
|
-
application. This example inspects `5.0.0-beta.
|
|
95
|
+
application. This example inspects `5.0.0-beta.5`; set `migration_target_version` to
|
|
96
96
|
the exact release selected for your migration, not `latest` or `next`. Downloading
|
|
97
97
|
requires npm registry access; reading the extracted docs requires Node 24 or later.
|
|
98
98
|
Run these commands in the same shell:
|
|
99
99
|
|
|
100
100
|
```sh
|
|
101
|
-
migration_target_version="5.0.0-beta.
|
|
101
|
+
migration_target_version="5.0.0-beta.5"
|
|
102
102
|
migration_target_dir="$(mktemp -d)"
|
|
103
103
|
npm pack "marionette@$migration_target_version" --ignore-scripts --pack-destination "$migration_target_dir"
|
|
104
104
|
tar -xzf "$migration_target_dir/marionette-$migration_target_version.tgz" -C "$migration_target_dir"
|
|
@@ -22,11 +22,73 @@ changes. Starting from stopped creates a fresh scope.
|
|
|
22
22
|
|
|
23
23
|
Canceling pending startup or rejecting its loader disposes the scope immediately.
|
|
24
24
|
Terminal destruction
|
|
25
|
-
also disposes effects. A
|
|
25
|
+
also disposes effects. A `prepareStart` signal covers only pending startup; it is
|
|
26
26
|
not a signal for the entire subsequent run. The scope below owns that longer
|
|
27
27
|
lifetime and passes its signal to the loader. Every awaited continuation checks
|
|
28
28
|
cancellation before committing its result, including providers that ignore abort.
|
|
29
29
|
|
|
30
|
+
## Recheck cancellation after awaited work
|
|
31
|
+
|
|
32
|
+
A `prepareStart` signal belongs to its pending startup phase. Read
|
|
33
|
+
`signal.aborted` after each awaited step before doing more work or committing its
|
|
34
|
+
result. Capturing `const canceled = signal.aborted` before an await only records
|
|
35
|
+
its earlier value. Checking `isRunning()` instead is also insufficient: a newer
|
|
36
|
+
start may be running when an older request finally resolves.
|
|
37
|
+
|
|
38
|
+
Stop preparation has different ownership: a replacement operation can adopt an
|
|
39
|
+
in-flight `prepareStop` phase, retaining its original options and context without
|
|
40
|
+
aborting its signal. The original caller's Promise resolving `false` does not mean
|
|
41
|
+
that adopted work was canceled. See
|
|
42
|
+
[preparation methods and notifications](./marionette.application.md#preparation-methods-and-notifications).
|
|
43
|
+
|
|
44
|
+
This example loads and validates a value before committing it. Supply asynchronous
|
|
45
|
+
`load({ signal })` and `validate(value, { signal })` functions and a synchronous
|
|
46
|
+
`commit(value)` function. The checks protect the commit even when a provider ignores
|
|
47
|
+
abort. They do not force that provider's Promise to settle or undo its own effects.
|
|
48
|
+
|
|
49
|
+
<!-- executable-example: application-preparation-commit -->
|
|
50
|
+
```javascript
|
|
51
|
+
import { Application } from 'marionette';
|
|
52
|
+
|
|
53
|
+
export function createPreparedFeature({ load, validate, commit }) {
|
|
54
|
+
const Feature = Application.extend({
|
|
55
|
+
async prepareStart(options, { signal }) {
|
|
56
|
+
const value = await load({ signal });
|
|
57
|
+
if (signal.aborted) { return; }
|
|
58
|
+
await validate(value, { signal });
|
|
59
|
+
if (signal.aborted) { return; }
|
|
60
|
+
commit(value);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return new Feature();
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If stop cancels startup while validation is pending, resolving validation later
|
|
68
|
+
must not call `commit`. The second check is necessary even though the first check
|
|
69
|
+
passed. Likewise, a newer successful start cannot authorize the old operation's
|
|
70
|
+
commit. Use [latest-request ownership](./application-refresh.md#share-one-latest-request-controller)
|
|
71
|
+
for independently replaceable refresh requests during an active run.
|
|
72
|
+
The [installed preparation checks](https://github.com/marionettejs/marionette/blob/master/test/fixtures/docs-application-guides/preparation.mjs)
|
|
73
|
+
exercise successful commit, canceled loading, and old validation completing after
|
|
74
|
+
a newer successful start.
|
|
75
|
+
|
|
76
|
+
## Distinguish delivery from resource cleanup
|
|
77
|
+
|
|
78
|
+
Configured `stateEvents` can intentionally remain subscribed for the object's
|
|
79
|
+
lifetime. A handler guarded by `isRunning()` suppresses its work while the feature
|
|
80
|
+
is stopped, but does not unsubscribe or cancel a timer. It also suppresses work
|
|
81
|
+
while stop permission is pending, because that is a lifecycle transition. Use the
|
|
82
|
+
explicit scope below when effects must continue until stop succeeds and remain
|
|
83
|
+
active if permission rejects. Disposing them in `onBeforeStop` would end them before
|
|
84
|
+
the permission decision; disposal belongs in `onStop` for that policy.
|
|
85
|
+
|
|
86
|
+
Successful `prepareStart` does not give its signal the lifetime of the subsequent
|
|
87
|
+
active run. Register active resources with their own scope and dispose that scope
|
|
88
|
+
on successful stop and terminal destruction. The executable example below and its
|
|
89
|
+
[installed checks](https://github.com/marionettejs/marionette/blob/master/test/fixtures/docs-application-guides/effects.mjs)
|
|
90
|
+
already cover rejected stop permission and successful timer cleanup.
|
|
91
|
+
|
|
30
92
|
## A complete feature
|
|
31
93
|
|
|
32
94
|
Save this module as `status-feature.js`. Supply an element, an `@mnjs/data` Model,
|
package/dist/docs/docs/beta.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Try Marionette v5 beta
|
|
2
2
|
|
|
3
|
-
`5.0.0-beta.
|
|
3
|
+
`5.0.0-beta.5` is prepared for application trials. Registry installation requires
|
|
4
4
|
a published release; use certified tarballs before publication. Release promotion
|
|
5
5
|
sets npm `latest` to the current prerelease until stable v5. A matching version
|
|
6
6
|
string alone does not prove that a locally built artifact matches a release.
|
|
@@ -37,9 +37,10 @@ pins matching runtime dependencies; a candidate kit instead supplies exact local
|
|
|
37
37
|
tarballs and a complete lockfile. Both include application agent instructions,
|
|
38
38
|
typecheck, consumer lint, unit tests, build, and a browser-test command.
|
|
39
39
|
|
|
40
|
-
The registry path requires beta.
|
|
41
|
-
published candidate
|
|
42
|
-
|
|
40
|
+
The registry path requires beta.5 to be published first. Beta.4 remains the previous
|
|
41
|
+
published candidate. Beta.5 adds ownership-aware root cleanup, existing Regions on
|
|
42
|
+
start/restart, and static child declarations. When upgrading from beta.3 or earlier,
|
|
43
|
+
move asynchronous `onBefore*` preparation to the corresponding `prepare*` methods.
|
|
43
44
|
|
|
44
45
|
The starter has editable rows, asynchronous local selection, deliberate cancellation,
|
|
45
46
|
and teardown. It has no backend, persistence, or URL router. Connect its `navigate`
|
|
@@ -83,7 +84,7 @@ permission, propagation, or trusted-publisher configuration.
|
|
|
83
84
|
|
|
84
85
|
## If the beta fails in your application
|
|
85
86
|
|
|
86
|
-
Pin `5.0.0-beta.
|
|
87
|
+
Pin `5.0.0-beta.4` across all five packages and restore the matching application
|
|
87
88
|
code and lockfile. The old `marionette@5.0.0-alpha.2` is not an API-compatible
|
|
88
89
|
rollback for this candidate. Existing v4 applications should retain their
|
|
89
90
|
pre-migration revision and `backbone.marionette` lockfile until their beta trial
|
|
@@ -92,5 +93,5 @@ succeeds.
|
|
|
92
93
|
Maintainers must not overwrite a published beta version. Withdraw its recommendation,
|
|
93
94
|
deprecate a broken version with a specific reason, and publish a corrected beta.
|
|
94
95
|
Move the selected npm tag (`latest` before the first stable v5) only to the verified
|
|
95
|
-
beta.
|
|
96
|
+
beta.4 release. Preserve exact artifacts and failure evidence.
|
|
96
97
|
See [release recovery](https://github.com/marionettejs/marionette/blob/master/docs/release-promotion.md#recovery-and-rollback).
|
|
@@ -13,15 +13,15 @@ Use plain functions or classes when you do not need Marionette lifecycle, events
|
|
|
13
13
|
| Region | show adopts a View; detach releases ownership without destroying it; empty/replacement destroy the current View. | [Lifecycle transition contract](./marionette.region.md) |
|
|
14
14
|
| CollectionView | Managed children belong to the CollectionView; stable unchanged model sources preserve child identity; same-key replacement recreates a child. | [Managing Children](./marionette.collectionview.md) |
|
|
15
15
|
| Behavior | Host owns top-level and nested Behaviors; direct Behavior destruction does not destroy its host. | [Behavior Lifecycle](./marionette.behavior.md) |
|
|
16
|
-
| Application | Named children belong to the Application until removal. setView temporarily owns a prepared View; showView hands it to the Region and
|
|
16
|
+
| Application | Named children belong to the Application until removal. setView temporarily owns a prepared View; showView hands it to the Region and records the Application's selected displayed root. A direct Region display is not adopted or claimable; an Application may reselect its own displayed root. | [Application Lifecycle](./marionette.application.md) |
|
|
17
17
|
|
|
18
18
|
## Lifecycle and cancellation
|
|
19
19
|
|
|
20
20
|
A synchronous callback/adapter exception escapes; no successful result or rollback is promised. Synchronous; callback or adapter exceptions abort the operation without rollback or attempt-all cleanup. Accepted idempotence guards remain; Application asynchronous cancellation is a distinct contract. [Synchronous failures](./view.lifecycle.md).
|
|
21
21
|
|
|
22
|
-
Operations resolve true at the requested target, false when superseded, and compatible calls share in-flight promises. Current readiness failure rejects the operation promise. Before and completion notifications are synchronous and ignore returns. Only prepareStart/prepareStop/prepareDestroy are awaited with options and an abort context; start completion receives one resolved preparation result. Supersession aborts before replacement preparation; adopted stop retains its original context/options without abort. Destruction blocks owner and descendant start/restart; successful destruction destroys owned children. Readiness rejection preserves the documented retry and partial-child boundaries. [Application Lifecycle](./marionette.application.md).
|
|
22
|
+
Operations resolve true at the requested target, false when superseded, and compatible calls share in-flight promises. Current readiness failure rejects the operation promise. Before and completion notifications are synchronous and ignore returns. Only prepareStart/prepareStop/prepareDestroy are awaited with options and an abort context; start completion receives one resolved preparation result. Supersession aborts before replacement preparation; adopted stop retains its original context/options without abort. Startup Region binding occurs before startup notifications, after any adopted stop readiness finishes. Destruction blocks owner and descendant start/restart; successful destruction destroys owned children. Readiness rejection preserves the documented retry and partial-child boundaries. [Application Lifecycle](./marionette.application.md).
|
|
23
23
|
|
|
24
|
-
Construction, addChildApp, setView and showView(view) return their public instance; showView() returns the prepared or
|
|
24
|
+
Construction, addChildApp, setView and showView(view) return their public instance; showView() returns the prepared or selected displayed View, or undefined; repeated showView() on the selected displayed root is a no-op; removeChildApp returns a Promise of the removed child or undefined; queries return the declared state or optional owner member. Construction, registration, root preparation/display and queries are synchronous; removeChildApp awaits child destruction before releasing ownership. childApps resolves a map or function once and registers fresh no-argument children before initialize; declarations do not activate children. Parent restart retains registered instances without reconstructing or automatically reactivating them; start selected children explicitly. Stop destroys a prepared View and empties the host only when its selected displayed View is still current, or when a directly shown View occupies an Application-created Region. Destroy also tears down owned children and a constructed root Region; it preserves unrelated content in a borrowed Region. Direct destruction releases preparation; displayed View associations end on Region replacement, empty, or detachment. [Application Lifecycle](./marionette.application.md).
|
|
25
25
|
|
|
26
26
|
Application readiness cancellation prevents stale framework completion. Application code must also respect the readiness signal before committing its own asynchronous side effects. Completion hooks are synchronous notifications. Use the [routing recipe](./routing.md) for cooperative cancellation and late-result checks.
|
|
27
27
|
|
|
@@ -112,6 +112,7 @@ Match a framework invariant by its stable diagnostic code, not message prose. Th
|
|
|
112
112
|
| `MN0037` | adapter-observation-unsupported |
|
|
113
113
|
| `MN0039` | collection-data-contract-invalid |
|
|
114
114
|
| `MN0040` | private-framework-member-access |
|
|
115
|
+
| `MN0041` | application-region-conflict |
|
|
115
116
|
|
|
116
117
|
Use public return values, DOM state, child identity, events, and externally counted subscriptions to prove behavior. Test focus and editable state in a real browser; test cancellation with held readiness and late results. A generated contract record proves consistency, not behavior or agent effectiveness.
|
|
117
118
|
|
|
@@ -216,7 +216,7 @@ Install `@mnjs/data` with `marionette` when an application wants a small
|
|
|
216
216
|
first-party observable Model and ordered Collection without Backbone:
|
|
217
217
|
|
|
218
218
|
```sh
|
|
219
|
-
npm install marionette@5.0.0-beta.
|
|
219
|
+
npm install marionette@5.0.0-beta.5 @mnjs/data@5.0.0-beta.5
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
```javascript
|
|
@@ -226,13 +226,16 @@ import { Collection, DataApi, Model, StateApi } from '@mnjs/data';
|
|
|
226
226
|
setDataApi(DataApi);
|
|
227
227
|
setStateApi(StateApi);
|
|
228
228
|
|
|
229
|
+
function escapeHtml(value) {
|
|
230
|
+
return String(value).replace(/[&<>"']/g, character => ({
|
|
231
|
+
'&': '&', '<': '<', '>': '>', '"': '"', "'": '''
|
|
232
|
+
}[character]));
|
|
233
|
+
}
|
|
234
|
+
|
|
229
235
|
const RowView = View.extend({
|
|
230
236
|
tagName: 'li',
|
|
231
|
-
template: () =>
|
|
232
|
-
modelEvents: { change: 'render' }
|
|
233
|
-
onRender() {
|
|
234
|
-
this.el.textContent = this.model.get('label');
|
|
235
|
-
}
|
|
237
|
+
template: ({ label }) => escapeHtml(label),
|
|
238
|
+
modelEvents: { change: 'render' }
|
|
236
239
|
});
|
|
237
240
|
const state = new Model({ selectedId: null });
|
|
238
241
|
const collection = new Collection([{ id: 1, label: 'one' }]);
|
package/dist/docs/docs/events.md
CHANGED
|
@@ -10,6 +10,7 @@ events are separate from [DOM events](./dom.interactions.md#canonical-view-inter
|
|
|
10
10
|
* [Triggering and Listening to Events](#triggering-and-listening-to-events)
|
|
11
11
|
* [Events API](#events-api)
|
|
12
12
|
* [`triggerMethod`](#triggermethod)
|
|
13
|
+
* [Resources created in lifecycle methods](#resources-created-in-lifecycle-methods)
|
|
13
14
|
* [Listening to Events](#listening-to-events)
|
|
14
15
|
* [`onEvent` Binding](#onevent-binding)
|
|
15
16
|
* [Backbone interop](#backbone-interop)
|
|
@@ -130,6 +131,12 @@ myView.triggerMethod('something:happened', 'foo');
|
|
|
130
131
|
|
|
131
132
|
**The `triggerMethod` method is available to [all Marionette classes](./common.md#triggermethod).**
|
|
132
133
|
|
|
134
|
+
#### Resources created in lifecycle methods
|
|
135
|
+
|
|
136
|
+
A lifecycle method runs before its matching event is emitted. A listener registered inside `onRender` for `render` can therefore run during that same render. Using `once` only limits the number of calls; it does not wait for the next lifecycle operation.
|
|
137
|
+
|
|
138
|
+
If `onRender` creates a resource that must survive until the next render, release the previous resource in `onBeforeRender` (or on `before:render`), and release the current resource in `onBeforeDestroy` (or on `before:destroy`). Pick cleanup boundaries from the resource's actual lifetime rather than subscribing to the event that is still creating it. Keep cleanup idempotent when two termination paths can apply.
|
|
139
|
+
|
|
133
140
|
### Listening to Events
|
|
134
141
|
|
|
135
142
|
Use `on` to register a callback directly on an emitter:
|