Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [UNRELEASED]

## Added
- [#3534]((https://github.com/plotly/dash/pull/3534) Adds `playsInline` prop to `html.Video`. Based on [#2338]((https://github.com/plotly/dash/pull/2338)
- [#3541](https://github.com/plotly/dash/pull/3541) Add `attributes` dictionary to be be formatted on script/link (_js_dist/_css_dist) tags of the index, allows for `type="module"` or `type="importmap"`. [#3538](https://github.com/plotly/dash/issues/3538)

## Fixed
Expand Down
7 changes: 7 additions & 0 deletions components/dash-html-components/scripts/data/attributes.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@
],
"description": "Provides a hint to the user of what can be entered in the field."
},
"playsInline": {
"elements": [
"video"
],
"description": "A Boolean attribute indicating that the video is to be played \"inline\"; that is, within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen."
},
"poster": {
"elements": [
"video"
Expand Down Expand Up @@ -898,6 +904,7 @@
"height",
"loop",
"muted",
"playsInline",
"poster",
"preload",
"src",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const supportedAttributes = ['accept', 'accessKey', 'action', 'allow',
'keyParams', 'keyType', 'kind', 'label', 'lang', 'list', 'loop', 'low',
'manifest', 'marginHeight', 'marginWidth', 'max', 'maxLength', 'media',
'mediaGroup', 'method', 'min', 'minLength', 'multiple', 'muted', 'name',
'noValidate', 'nonce', 'open', 'optimum', 'pattern', 'placeholder', 'poster',
'noValidate', 'nonce', 'open', 'optimum', 'pattern', 'placeholder', 'playsInline', 'poster',
'preload', 'profile', 'radioGroup', 'readOnly', 'referrerPolicy', 'rel', 'required',
'reversed', 'role', 'rowSpan', 'rows', 'sandbox', 'scope', 'scoped', 'scrolling',
'seamless', 'selected', 'shape', 'size', 'sizes', 'span', 'spellCheck', 'src',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const BOOLEAN_PROPERTIES = [
'noModule',
'noValidate',
'open',
'playsInline',
'readonly',
'required',
'reversed',
Expand Down
2 changes: 2 additions & 0 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,7 @@ def router():
Output(_ID_STORE, "data"),
inputs=inputs,
prevent_initial_call=True,
hidden=True,
)
async def update(pathname_, search_, **states):
"""
Expand Down Expand Up @@ -2594,6 +2595,7 @@ async def update(pathname_, search_, **states):
Output(_ID_STORE, "data"),
inputs=inputs,
prevent_initial_call=True,
hidden=True,
)
def update(pathname_, search_, **states):
"""
Expand Down
28 changes: 15 additions & 13 deletions dash/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from enum import Enum
from typing import Union, Sequence, Any

from .development.base_component import Component
Expand All @@ -9,32 +10,33 @@
ComponentIdType = Union[str, Component, dict]


class _Wildcard: # pylint: disable=too-few-public-methods
def __init__(self, name: str):
self._name = name
class Wildcard(Enum):
MATCH = "MATCH"
ALL = "ALL"
ALLSMALLER = "ALLSMALLER"

def __str__(self):
return self._name
return self.value

def __repr__(self):
return f"<{self}>"
return f"<{self.value}>"

def to_json(self) -> str:
# used in serializing wildcards - arrays are not allowed as
# id values, so make the wildcards look like length-1 arrays.
return f'["{self._name}"]'
return f'["{self.value}"]'


MATCH = _Wildcard("MATCH")
ALL = _Wildcard("ALL")
ALLSMALLER = _Wildcard("ALLSMALLER")
MATCH = Wildcard.MATCH
ALL = Wildcard.ALL
ALLSMALLER = Wildcard.ALLSMALLER


class DashDependency: # pylint: disable=too-few-public-methods
component_id: ComponentIdType
allow_duplicate: bool
component_property: str
allowed_wildcards: Sequence[_Wildcard]
allowed_wildcards: Sequence[Wildcard]
allow_optional: bool

def __init__(self, component_id: ComponentIdType, component_property: str):
Expand Down Expand Up @@ -95,8 +97,8 @@ def _id_matches(self, other) -> bool:
other_v = other_id[k]
if v == other_v:
continue
v_wild = isinstance(v, _Wildcard)
other_wild = isinstance(other_v, _Wildcard)
v_wild = isinstance(v, Wildcard)
other_wild = isinstance(other_v, Wildcard)
if v_wild or other_wild:
if not (v_wild and other_wild):
continue # one wild, one not
Expand All @@ -120,7 +122,7 @@ def has_wildcard(self) -> bool:
"""
if isinstance(self.component_id, dict):
for v in self.component_id.values():
if isinstance(v, _Wildcard):
if isinstance(v, Wildcard):
return True
return False

Expand Down
9 changes: 3 additions & 6 deletions dash/development/_py_components_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@
from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
from dash.development.base_component import Component, _explicitize_args
{custom_imports}
ComponentSingleType = typing.Union[str, int, float, Component, None]
ComponentType = typing.Union[
str,
int,
float,
Component,
None,
typing.Sequence[typing.Union[str, int, float, Component, None]],
ComponentSingleType,
typing.Sequence[ComponentSingleType],
]

NumberType = typing.Union[
Expand Down
9 changes: 3 additions & 6 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,11 @@ def _validate_deprecation(self):
warnings.warn(DeprecationWarning(textwrap.dedent(deprecation_message)))


ComponentSingleType = typing.Union[str, int, float, Component, None]
# Renderable node type.
ComponentType = typing.Union[
str,
int,
float,
Component,
None,
typing.Sequence[typing.Union[str, int, float, Component, None]],
ComponentSingleType,
typing.Sequence[ComponentSingleType],
]

ComponentTemplate = typing.TypeVar("ComponentTemplate")
Expand Down
Loading