workspace Example id "presentation-example" revision "presentation-example@1" commit "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" { import interface PresentationState; import interface StateRecord; import interface PresentationMount; import interface Presentation; import interface PresentationStates; import interface StateFactory; import interface ReaderNavigation; import interface DocumentNavigation; import package PresentationRuntime; atom PresentationMountRecord id "presentation-mount-record"; atom Library id "library"; atom OtherLibrary id "other-library"; atom PublicLibrary id "public-library"; atom Document id "document"; atom ReaderNavigationRecord id "reader-navigation-record"; atom DocumentNavigationRecord id "document-navigation-record"; conform PresentationMountRecord as PresentationMount id "presentation-mount-record:implementation" { private edge Membership id "presentation-mount:membership" { atom PresentationMountRecord projection members id "presentation-mount:members-projection" many-unique public-traversal; interface PresentationState projection presentationMount id "presentation-mount:owner-projection" optional-one public-traversal; } private edge Root id "presentation-mount:root-edge" { atom PresentationMountRecord projection root id "presentation-mount:root-projection" optional-one; interface PresentationState projection rootOf id "presentation-mount:root-of-projection" optional-one; } bind members.resolve to edge Membership.members.resolve; bind root.resolve to edge Root.root.resolve; bind create.call to package PresentationRuntime.createPresentationMount with {presentationMount to creation PresentationMountRecord with {};}; bind attach.call to package PresentationRuntime.attach with { members to edge Membership.members; root to edge Root.root; metadata to interface PresentationState from input; }; } conform Presentation as PresentationStates id "presentation:state-association" { private edge States id "presentation:states-edge" { atom Self projection states id "presentation:states-projection" many-unique keyed "string"; object Navigation projection subject id "presentation:subject-projection" optional-one; } bind states.resolve to edge States.states.resolve; bind ensure.call to package PresentationRuntime.ensure with { states to edge States.states; metadata to interface PresentationState from input; presentationMount to interface PresentationMount from input; factory to interface StateFactory; }; } conform StateRecord as PresentationState id "state-record:metadata" { private state Occurrence id "metadata:occurrence" on Self : string policy register; private edge Parent id "metadata:parent" { atom Self projection parent id "metadata:parent-projection" optional-one; interface PresentationState projection children id "metadata:children-projection" many-unique; } initialize {occurrence to state Occurrence;parent to edge Parent.parent;}; bind occurrence.get to state Occurrence.read; bind parent.resolve to edge Parent.parent.resolve; bind presentationMount.resolve to edge Membership.presentationMount.resolve; } conform ReaderNavigationRecord as StateRecord id "reader:state-record" {} conform DocumentNavigationRecord as StateRecord id "document:state-record" {} conform ReaderNavigationRecord as ReaderNavigation id "reader:navigation" { private state Mode id "reader:mode" on Self : string policy register default "library"; bind page to state Mode; } conform DocumentNavigationRecord as DocumentNavigation id "document:navigation" { private state Compact id "document:compact" on Self : bool policy register default false; bind compact to state Compact; } conform Library as StateFactory id "reader:factory" { bind create.call to package PresentationRuntime.createState with { navigation to creation ReaderNavigationRecord with {PresentationState from input;}; }; } conform Document as StateFactory id "document:factory" { bind create.call to package PresentationRuntime.createState with { navigation to creation DocumentNavigationRecord with {PresentationState from input;}; }; } conform Library as Presentation id "library:presentation" {} conform Document as Presentation id "document:presentation" {} conform OtherLibrary as StateFactory id "other-reader:factory" { bind create.call to package PresentationRuntime.createState with { navigation to creation ReaderNavigationRecord with {PresentationState from input;}; }; } conform OtherLibrary as Presentation id "other-library:presentation" {} conform PublicLibrary as StateFactory id "public-reader:factory" { bind create.call to package PresentationRuntime.createReaderState with { navigation to creation ReaderNavigationRecord with {PresentationState from input;}; }; } conform PublicLibrary as Presentation id "public-library:presentation" {} }