@dxos/app-toolkit - v0.16.0
    Preparing search index...

    Function createTypeSectionExtension

    • Type Parameters

      • T extends AnyObj

      Parameters

      • type: T
      • options: {
            createObject?: (space: Space) => Effect<any, any, any>;
            dropInto?: (object: InstanceType<T>) => Container;
            groupSegment?: string;
            match?: (node: Readonly) => Option<Space>;
            position?: number;
            sectionUrlKey?: string;
            showEmpty?: boolean;
            sort?: (a: InstanceType<T>, b: InstanceType<T>) => number;
            urlKey: string;
        }
        • OptionalcreateObject?: (space: Space) => Effect<any, any, any>

          If provided, a "+" action is added to the section header that runs this effect when clicked. The action label is resolved from add-object.label in the type's i18n namespace.

        • OptionaldropInto?: (object: InstanceType<T>) => Container

          The container an object dropped onto a section object's row joins. Without it a section object only accepts objects of its own type, as reorders.

        • OptionalgroupSegment?: string

          Group segment the section nests under (e.g. GraphPath.GroupSegments.ai), when match places it beneath a navtree group rather than directly under the space. Included in the forward-resolution urlPath so section objects at root/<space>/<groupSegment>/<typename>/<id> resolve deterministically. Omit for a space-direct section (root/<space>/<typename>/<id>).

        • Optionalmatch?: (node: Readonly) => Option<Space>

          Override the default AppNodeMatcher.whenSpace match function. Use when the section should live under a group node rather than directly under a space. The match must still return Option<Space> so the connector can query the space db.

        • Optionalposition?: number

          Position hint for the section in the sidebar.

        • OptionalsectionUrlKey?: string

          Registered URL key making the section node itself addressable (e.g. library → /w/<space>/library), for a section that is worth linking to in its own right; it also names the section node. Omit and the section stays a bare container named by its typename: only its objects are addressable.

          Opting in splits the section into two extensions — one owning the section node, one owning its objects — since each extension carries one binding and the two need different ones. The objects are then materialized on expand rather than inline.

        • OptionalshowEmpty?: boolean

          Keep the section in the sidebar while the space has none of the type, so its "+" can start the first one (a section that is where its objects are made, like sessions). By default an empty section is suppressed.

        • Optionalsort?: (a: InstanceType<T>, b: InstanceType<T>) => number

          A fixed order for the section's objects (e.g. newest first, for sessions). The section then keeps that order rather than one the person drags into place, so its objects cannot be rearranged.

        • urlKey: string

          Registered URL prefix key for this section's connector (e.g. doc, mail). Keys are global, so it is declared here rather than derived — see @dxos/app-graph's path-resolution.ts for how registered keys resolve and serialize URLs.

      Returns Effect<
          Readonly<
              {
                  connector?: Connector<
                      Readonly<
                          {
                              cacheable?: string[];
                              data: any;
                              id: string;
                              properties: Readonly<Record<string, any>>;
                              type: string;
                          },
                      >,
                      NodeArg<any, Record<string, any>>,
                  >;
                  id: string;
                  meta?: UrlBinding;
                  position?: number;
                  relation?: RelationInput;
              },
          >[],
          never,
          never,
      >