Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/template-parts
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.0
Choose a base ref
...
head repository: github/template-parts
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 13 commits
  • 10 files changed
  • 3 contributors

Commits on Dec 3, 2024

  1. build before publish

    keithamus authored Dec 3, 2024
    Configuration menu
    Copy the full SHA
    38c304a View commit details
    Browse the repository at this point in the history

Commits on Dec 9, 2024

  1. Accept Node values as Template Parts

    Related to [#62][] (see [3.2. Template Parts and Custom Template Process Callback][])
    Follow-up to [#65][]
    
    While the changes made in [#65][] improved support for `Element` parts,
    the expansion from `string` to `Element | string` was not broadened
    enough. While all `Element` instances are DOM Nodes, not all DOM Nodes
    are `Element` instances.
    
    For example, this change enables support for [DocumentFragment][]
    instances (generated from classes like [Range][] or properties like
    [HTMLTemplateElement.content][]), where prior support resulted in
    templating the `[object DocumentFragment]` text string instead of the
    fragment's `Node` instances.
    
    [#62]: #62
    [3.2. Template Parts and Custom Template Process Callback]: https://github.com/WICG/webcomponents/blob/159b1600bab02fe9cd794825440a98537d53b389/proposals/Template-Instantiation.md#32-template-parts-and-custom-template-process-callback
    [#65]: #65
    [DocumentFragment]: https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment
    [HTMLTemplateElement.content]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content
    seanpdoyle committed Dec 9, 2024
    Configuration menu
    Copy the full SHA
    28f61c6 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #73 from seanpdoyle/accept-node-template-parts

    Accept `Node` values as Template Parts
    keithamus authored Dec 9, 2024
    Configuration menu
    Copy the full SHA
    0678eb7 View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2024

  1. Change NodeTemplatePart.replace type signature

    Replace `ChildNode` with `Node` in `NodeTemplatePart.replace(...nodes)`
    signature.
    
    According to the [3.2. Template Parts and Custom Template Process
    Callback][] section of the specification, the `NodeTemplatePart`
    interface declares `replace(...nodes: Array<string | Node>)`:
    
    ```typescript
    interface NodeTemplatePart : TemplatePart {
      readonly attribute ContainerNode parentNode;
      readonly attribute Node? previousSibling;
      readonly attribute Node? nextSibling;
      [NewObject] readonly NodeList replacementNodes;
      void replace((Node or DOMString)... nodes);
      void replaceHTML(DOMString html);
    }
    ```
    
    This commit changes the type signature and adds coverage for replacing a
    `NodeTemplatePart` with a `DocumentFragment` instance.
    
    [3.2. Template Parts and Custom Template Process Callback]: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md#32-template-parts-and-custom-template-process-callback
    seanpdoyle committed Dec 13, 2024
    Configuration menu
    Copy the full SHA
    79b4ee6 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #74 from seanpdoyle/replace-child-node

    Change `NodeTemplatePart.replace` type signature
    keithamus authored Dec 13, 2024
    Configuration menu
    Copy the full SHA
    743b970 View commit details
    Browse the repository at this point in the history
  3. Implement InnerTemplatePart class

    The [3.3. Conditionals and Loops using Nested Templates][] section of
    the specification mentions special treatment of `<template>` elements
    with `[directive]` and `[expression]` attributes within `<template>`
    elements. They're to be treated as parts of their own, represented by an
    `InnerTemplatePart` interface:
    
    ```ts
     InnerTemplatePart : NodeTemplatePart {
        HTMLTemplateElement template;
        attribute DOMString directive;
    }
    ```
    
    This commit introduces that class, along with special treatment whenever
    collecting parts from an `HTMLTemplateElement` that also has a
    `[directive]` attribute.
    
    To demonstrate their utility, this commit includes a test case that
    exercises a naive implementation of an `if` conditional. As a caveat,
    it's worth mentioning that the specification proposal explicitly
    mentions the nuance surrounding looping and conditional rendering:
    
    > this approach involves the template process callback cloning template
    > parts along with other nodes, or let author scripts manually specify to
    > which element each template part belongs. This quickly becomes an
    > entangled mess because now we could have multiple template parts that
    > refer to a single DOM location or an attribute, and we have to start
    > dealing with multiple template parts trying to override one another even
    > though there is no good use case for such a behavior.
    >
    > We like the idea of supporting very basic control flow such as `if` and
    > `foreach` in the default template process callback but we don't think it's
    > a show stopper if the default template process callback didn't support
    > them in the initial cut.
    
    This commit does not aim to introduce a canonical implementation for
    conditionals or looping, but it should enable a change like that in the
    future.
    
    [3.3. Conditionals and Loops using Nested Templates]: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md#33-conditionals-and-loops-using-nested-templates
    seanpdoyle committed Dec 13, 2024
    Configuration menu
    Copy the full SHA
    8aba104 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #75 from seanpdoyle/inner-template-part

    Implement `InnerTemplatePart` class
    keithamus authored Dec 13, 2024
    Configuration menu
    Copy the full SHA
    187af82 View commit details
    Browse the repository at this point in the history
  5. Add test coverage for both built-in processor strategies

    Existing test coverage lacked tests that exercised _both_
    the default `processPropertyIdentity` strategy alongside the optional
    `propertyIdentityOrBooleanAttribute` strategy.
    
    This commit doesn't contain any implementation changes, but broadens
    test coverage instead.
    seanpdoyle committed Dec 13, 2024
    Configuration menu
    Copy the full SHA
    4e442b7 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2024

  1. Export InnerTemplatePart

    Add an entry to the `src/index.ts` to export the new
    `InnerTemplatePart`.
    
    Since consumers are most likely to import `TemplateInstance`, change the
    `test/template-instance.ts` test file to import properties from the
    module in a way that more closely resembles the end-user consumer
    experience.
    seanpdoyle committed Dec 14, 2024
    Configuration menu
    Copy the full SHA
    8e84757 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #78 from seanpdoyle/exports

    Export `InnerTemplatePart`
    keithamus authored Dec 14, 2024
    Configuration menu
    Copy the full SHA
    4e11d16 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2024

  1. Merge pull request #77 from seanpdoyle/add-test-coverage

    Add test coverage for both built-in processor strategies
    keithamus authored Dec 15, 2024
    Configuration menu
    Copy the full SHA
    65aa8f5 View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2025

  1. Configuration menu
    Copy the full SHA
    b98aa52 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2025

  1. Configuration menu
    Copy the full SHA
    68c4a79 View commit details
    Browse the repository at this point in the history
Loading