这是indexloc提供的服务,不要输入任何密码
Skip to content

Aliasing with layered shadow support #250

@nclsndr

Description

@nclsndr

I just noticed an issue with #246

The spec does not describe how aliasing should be supported along the introduction of the optional array-based value.

Let's take

{
  "simpleShadow": {
    "$type": "shadow",
    "$value": {
      "color": "#000000",
      "offsetX": "1px",
      "offsetY": "1px",
      "blur": "2px",
      "spread": "4px"
    }
  },
  "layeredShadow": {
    "$type": "shadow",
    "$value": [
      {
        "color": "#000000",
        "offsetX": "1px",
        "offsetY": "1px",
        "blur": "2px",
        "spread": "4px"
      },
      {
        "color": "#CCCCCC",
        "offsetX": "2px",
        "offsetY": "2px",
        "blur": "6px",
        "spread": "6px"
      }
    ]
  }
}

Following the current aliasing rules, I guess we allow:

{
  "referenceToSimpleShadow": {
    "$value": "{simpleShadow}"
  },
  "referenceToLayeredShadow": {
    "$value": "{layeredShadow}"
  }
}

But, do we intend to allow "partial aliasing" within the array value 👇 ?

  "layeredShadow": {
    "$type": "shadow",
    "$value": [
      "{simpleShadow}",
      {
        "color": "#CCCCCC",
        "offsetX": "2px",
        "offsetY": "2px",
        "blur": "6px",
        "spread": "6px"
      }
    ]
  }

I dunno to what extend this feature might be appealing for users, opinions here?

Yet, the current state of having the "shadow" type allowing both object and array based values makes the adoption of the feature almost impossible due to inconsistent spread/merge behaviours required to compute.
I described a solution addressing this in #239 - here and here

I guess that also relates to #241 - where it feels we'd need some simple rules we apply accros types with similar requirements.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions