django-admin-react 1.7.0__tar.gz → 1.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/PKG-INFO +61 -7
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/README.md +59 -5
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/conf.py +6 -3
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/pwa.py +7 -8
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/static/admin_react/.vite/manifest.json +4 -4
- django_admin_react-1.7.0/django_admin_react/static/admin_react/assets/ColumnLayoutModal-CwhusoTF.js → django_admin_react-1.8.1/django_admin_react/static/admin_react/assets/ColumnLayoutModal-B7vV9j0o.js +1 -1
- django_admin_react-1.7.0/django_admin_react/static/admin_react/assets/JsonViewer-7HjTBTgO.js → django_admin_react-1.8.1/django_admin_react/static/admin_react/assets/JsonViewer-Bex6hfee.js +1 -1
- django_admin_react-1.7.0/django_admin_react/static/admin_react/assets/index-BFuttSSg.js → django_admin_react-1.8.1/django_admin_react/static/admin_react/assets/index-B5KYsso9.js +4 -4
- django_admin_react-1.8.1/django_admin_react/static/admin_react/assets/index-DVKgpuxv.css +1 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/static/admin_react/index.html +2 -2
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templatetags/experience_toggle.py +1 -1
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/views.py +16 -9
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/pyproject.toml +18 -57
- django_admin_react-1.7.0/django_admin_react/audit.py +0 -58
- django_admin_react-1.7.0/django_admin_react/static/admin_react/assets/index-YKSkp2ru.css +0 -1
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/LICENSE +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/README.md +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/__init__.py +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/apps.py +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/README.md +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/admin/base_site.html +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/admin_react/README.md +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/admin_react/index.html +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/admin_react/login.html +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/admin_react/sw.js +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templates/django_admin_react/_experience_toggle_strip.html +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/templatetags/__init__.py +0 -0
- {django_admin_react-1.7.0 → django_admin_react-1.8.1}/django_admin_react/urls.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-admin-react
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.1
|
|
4
4
|
Summary: A drop-in React single-page admin for Django, driven entirely by ModelAdmin.
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -28,7 +28,7 @@ Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
|
|
|
28
28
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
29
|
Requires-Dist: django (>=4.2,<7.0)
|
|
30
30
|
Requires-Dist: django-admin-mcp-api (>=1.1.0,<2.0.0)
|
|
31
|
-
Requires-Dist: django-admin-rest-api (>=1.
|
|
31
|
+
Requires-Dist: django-admin-rest-api (>=1.3.0,<2.0.0)
|
|
32
32
|
Project-URL: Documentation, https://github.com/MartinCastroAlvarez/django-admin-react#readme
|
|
33
33
|
Project-URL: Homepage, https://github.com/MartinCastroAlvarez/django-admin-react
|
|
34
34
|
Project-URL: Repository, https://github.com/MartinCastroAlvarez/django-admin-react
|
|
@@ -826,11 +826,65 @@ HTML admin. The wire shape is identical regardless of locale —
|
|
|
826
826
|
only the human-readable strings change.
|
|
827
827
|
|
|
828
828
|
**The SPA's own chrome strings** ("Add", "Search", "Save and
|
|
829
|
-
continue editing", "Loading…")
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
829
|
+
continue editing", "Loading…") flow through the same locale (#630,
|
|
830
|
+
since 1.7.0). Shipped catalogs: English (source-as-key), Spanish,
|
|
831
|
+
Portuguese / pt-BR, French. Adding a new language: drop a JSON file
|
|
832
|
+
under `frontend/packages/ui/src/i18n/`, import it in
|
|
833
|
+
`frontend/packages/ui/src/i18n.ts`, ship.
|
|
834
|
+
|
|
835
|
+
### Custom widgets (`formfield_overrides` + `registerFieldWidget`)
|
|
836
|
+
|
|
837
|
+
When your `ModelAdmin` routes a field through a custom widget —
|
|
838
|
+
`formfield_overrides = {MyJSONField: {"widget": MyCustomWidget}}`,
|
|
839
|
+
or a custom `Form` class declaring widgets directly, or a
|
|
840
|
+
third-party widget library — the API surfaces it as
|
|
841
|
+
`widget: "custom"` + `widget_class: "<dotted.Python.Path>"`
|
|
842
|
+
(`django-admin-rest-api` 1.3.0+). The SPA dispatches the render to
|
|
843
|
+
a consumer-registered widget via a small plugin protocol (#625).
|
|
844
|
+
|
|
845
|
+
Register your widget BEFORE the SPA bundle runs — in your custom
|
|
846
|
+
`change_form_template`, a shared base template, or any `<script>`
|
|
847
|
+
tag that loads ahead of the SPA's bundle:
|
|
848
|
+
|
|
849
|
+
```html
|
|
850
|
+
<!-- in your Django template -->
|
|
851
|
+
<script>
|
|
852
|
+
window.darFieldWidgets = window.darFieldWidgets ?? {};
|
|
853
|
+
window.darFieldWidgets['mypkg.widgets.MarkdownEditor'] = {
|
|
854
|
+
mount(container, props) {
|
|
855
|
+
// Read `props.value` for the current value.
|
|
856
|
+
// Call `props.onChange(next)` when the operator edits.
|
|
857
|
+
// Render whatever — vanilla JS, jQuery, mini-React, …
|
|
858
|
+
const textarea = document.createElement('textarea');
|
|
859
|
+
textarea.value = props.value ?? '';
|
|
860
|
+
textarea.addEventListener('input', (e) => props.onChange(e.target.value));
|
|
861
|
+
container.appendChild(textarea);
|
|
862
|
+
// (Optional) return a cleanup fn called on SPA unmount.
|
|
863
|
+
return () => textarea.remove();
|
|
864
|
+
},
|
|
865
|
+
};
|
|
866
|
+
</script>
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
The `props` object passed to `mount` has:
|
|
870
|
+
|
|
871
|
+
| Prop | Type | Description |
|
|
872
|
+
|---|---|---|
|
|
873
|
+
| `value` | `WriteValue` | Current draft value (live — read each access via getter). |
|
|
874
|
+
| `onChange` | `(next) => void` | Call to emit a new value; the SPA re-renders. |
|
|
875
|
+
| `error` | `string[] \| undefined` | Per-field validation errors from the last save attempt. |
|
|
876
|
+
| `widgetClass` | `string` | The dotted class path (handy if a single mount fn handles related widgets). |
|
|
877
|
+
|
|
878
|
+
When no registration matches the `widget_class` on the wire, the
|
|
879
|
+
SPA falls back to a default text input + a small amber note
|
|
880
|
+
(`Custom widget <class> is not registered; using the default text
|
|
881
|
+
input.`). The operator can still complete the form; the gap is
|
|
882
|
+
explicit and recoverable, not a silent break.
|
|
883
|
+
|
|
884
|
+
If you'd rather skip the consumer-side widget for a model and keep
|
|
885
|
+
it on the legacy `/admin/`, the
|
|
886
|
+
[experience-toggle strip](#experience-toggle-strip-optional) +
|
|
887
|
+
`LEGACY_ADMIN_URL_PREFIX` give consumers a one-click hop back.
|
|
834
888
|
|
|
835
889
|
---
|
|
836
890
|
|
|
@@ -790,11 +790,65 @@ HTML admin. The wire shape is identical regardless of locale —
|
|
|
790
790
|
only the human-readable strings change.
|
|
791
791
|
|
|
792
792
|
**The SPA's own chrome strings** ("Add", "Search", "Save and
|
|
793
|
-
continue editing", "Loading…")
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
793
|
+
continue editing", "Loading…") flow through the same locale (#630,
|
|
794
|
+
since 1.7.0). Shipped catalogs: English (source-as-key), Spanish,
|
|
795
|
+
Portuguese / pt-BR, French. Adding a new language: drop a JSON file
|
|
796
|
+
under `frontend/packages/ui/src/i18n/`, import it in
|
|
797
|
+
`frontend/packages/ui/src/i18n.ts`, ship.
|
|
798
|
+
|
|
799
|
+
### Custom widgets (`formfield_overrides` + `registerFieldWidget`)
|
|
800
|
+
|
|
801
|
+
When your `ModelAdmin` routes a field through a custom widget —
|
|
802
|
+
`formfield_overrides = {MyJSONField: {"widget": MyCustomWidget}}`,
|
|
803
|
+
or a custom `Form` class declaring widgets directly, or a
|
|
804
|
+
third-party widget library — the API surfaces it as
|
|
805
|
+
`widget: "custom"` + `widget_class: "<dotted.Python.Path>"`
|
|
806
|
+
(`django-admin-rest-api` 1.3.0+). The SPA dispatches the render to
|
|
807
|
+
a consumer-registered widget via a small plugin protocol (#625).
|
|
808
|
+
|
|
809
|
+
Register your widget BEFORE the SPA bundle runs — in your custom
|
|
810
|
+
`change_form_template`, a shared base template, or any `<script>`
|
|
811
|
+
tag that loads ahead of the SPA's bundle:
|
|
812
|
+
|
|
813
|
+
```html
|
|
814
|
+
<!-- in your Django template -->
|
|
815
|
+
<script>
|
|
816
|
+
window.darFieldWidgets = window.darFieldWidgets ?? {};
|
|
817
|
+
window.darFieldWidgets['mypkg.widgets.MarkdownEditor'] = {
|
|
818
|
+
mount(container, props) {
|
|
819
|
+
// Read `props.value` for the current value.
|
|
820
|
+
// Call `props.onChange(next)` when the operator edits.
|
|
821
|
+
// Render whatever — vanilla JS, jQuery, mini-React, …
|
|
822
|
+
const textarea = document.createElement('textarea');
|
|
823
|
+
textarea.value = props.value ?? '';
|
|
824
|
+
textarea.addEventListener('input', (e) => props.onChange(e.target.value));
|
|
825
|
+
container.appendChild(textarea);
|
|
826
|
+
// (Optional) return a cleanup fn called on SPA unmount.
|
|
827
|
+
return () => textarea.remove();
|
|
828
|
+
},
|
|
829
|
+
};
|
|
830
|
+
</script>
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
The `props` object passed to `mount` has:
|
|
834
|
+
|
|
835
|
+
| Prop | Type | Description |
|
|
836
|
+
|---|---|---|
|
|
837
|
+
| `value` | `WriteValue` | Current draft value (live — read each access via getter). |
|
|
838
|
+
| `onChange` | `(next) => void` | Call to emit a new value; the SPA re-renders. |
|
|
839
|
+
| `error` | `string[] \| undefined` | Per-field validation errors from the last save attempt. |
|
|
840
|
+
| `widgetClass` | `string` | The dotted class path (handy if a single mount fn handles related widgets). |
|
|
841
|
+
|
|
842
|
+
When no registration matches the `widget_class` on the wire, the
|
|
843
|
+
SPA falls back to a default text input + a small amber note
|
|
844
|
+
(`Custom widget <class> is not registered; using the default text
|
|
845
|
+
input.`). The operator can still complete the form; the gap is
|
|
846
|
+
explicit and recoverable, not a silent break.
|
|
847
|
+
|
|
848
|
+
If you'd rather skip the consumer-side widget for a model and keep
|
|
849
|
+
it on the legacy `/admin/`, the
|
|
850
|
+
[experience-toggle strip](#experience-toggle-strip-optional) +
|
|
851
|
+
`LEGACY_ADMIN_URL_PREFIX` give consumers a one-click hop back.
|
|
798
852
|
|
|
799
853
|
---
|
|
800
854
|
|
|
@@ -91,7 +91,7 @@ DEFAULTS: dict[str, Any] = {
|
|
|
91
91
|
"REACT_LOGIN": True,
|
|
92
92
|
# PWA (Issue #86) — all optional; sane defaults make the manifest
|
|
93
93
|
# work with zero config. See ``django_admin_react/pwa.py`` +
|
|
94
|
-
# ``
|
|
94
|
+
# ``ARCHITECTURE.md`` §5.4.
|
|
95
95
|
#
|
|
96
96
|
# ``PWA_NAME`` — installed-app name. ``None`` (default) falls
|
|
97
97
|
# back to the AdminSite ``site_header``, then
|
|
@@ -152,8 +152,11 @@ DEFAULTS: dict[str, Any] = {
|
|
|
152
152
|
class _PackageSettings:
|
|
153
153
|
"""Resolved package settings.
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
An immutable, frozen record of the merged
|
|
156
|
+
``settings.DJANGO_ADMIN_REACT`` overrides on top of :data:`DEFAULTS`,
|
|
157
|
+
built once by :func:`_load` and cached. Each field carries its
|
|
158
|
+
default; modules read the typed attribute names off the cached
|
|
159
|
+
instance via this module's :func:`__getattr__`.
|
|
157
160
|
"""
|
|
158
161
|
|
|
159
162
|
ADMIN_SITE: str = DEFAULTS["ADMIN_SITE"]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""PWA surface: web app manifest + service worker (Issue #86).
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
surface because its load-bearing properties are security ones:
|
|
3
|
+
Frontend build/ship context: ``ARCHITECTURE.md`` §5.4. The Security lane
|
|
4
|
+
owns this surface because its load-bearing properties are security ones:
|
|
5
5
|
|
|
6
6
|
- The **manifest** (``<mount>/web.manifest``) is served unauthenticated
|
|
7
7
|
(the install prompt fires before login) and is computed at request
|
|
@@ -15,8 +15,7 @@ surface because its load-bearing properties are security ones:
|
|
|
15
15
|
no-store`` (so the package's no-store API reads are never cached),
|
|
16
16
|
never caches non-GET requests (mutation safety), and exposes a
|
|
17
17
|
cache-purge message used on logout so read-cached payloads can't
|
|
18
|
-
outlive the session (
|
|
19
|
-
expiry).
|
|
18
|
+
outlive the session (defense-in-depth atop session expiry).
|
|
20
19
|
|
|
21
20
|
Both views live **outside** ``api/`` because they're served at the
|
|
22
21
|
mount root, not under ``api/v1/``, and the manifest is intentionally
|
|
@@ -33,13 +32,13 @@ from django.http import JsonResponse
|
|
|
33
32
|
from django.shortcuts import render
|
|
34
33
|
from django.views.generic import View
|
|
35
34
|
|
|
36
|
-
from django_admin_react import conf as dar_conf
|
|
37
|
-
|
|
38
35
|
# Re-use the API package's admin-site lookup (this repo implements no
|
|
39
36
|
# API; the registry helper lives there). The PWA only needs the active
|
|
40
37
|
# `AdminSite.name` for the manifest's start URL.
|
|
41
38
|
from django_admin_rest_api.api.registry import get_admin_site
|
|
42
39
|
|
|
40
|
+
from django_admin_react import conf as dar_conf
|
|
41
|
+
|
|
43
42
|
# Theme colours keyed by the resolved colour scheme. Kept here (not in
|
|
44
43
|
# the SPA's CSS-var system) because the manifest is rendered server-side
|
|
45
44
|
# before any CSS loads; these are the install-banner / splash colours
|
|
@@ -79,7 +78,7 @@ def _mount(request: HttpRequest, suffix: str) -> str:
|
|
|
79
78
|
def _resolved_scheme(request: HttpRequest) -> str:
|
|
80
79
|
"""Resolve light/dark from the ``Sec-CH-Prefers-Color-Scheme`` hint.
|
|
81
80
|
|
|
82
|
-
Pairs with the theming client-hint path (``
|
|
81
|
+
Pairs with the theming client-hint path (``ARCHITECTURE.md`` §5.3). Any
|
|
83
82
|
value other than a case-insensitive ``"dark"`` resolves to light —
|
|
84
83
|
the safe, neutral default when the hint is absent or unexpected.
|
|
85
84
|
"""
|
|
@@ -93,7 +92,7 @@ class ManifestView(View):
|
|
|
93
92
|
Unauthenticated by design (the install prompt needs it pre-login).
|
|
94
93
|
Carries no per-user data; every field is static or mount-/header-
|
|
95
94
|
derived. ``Cache-Control: no-store`` is **not** set — the manifest
|
|
96
|
-
is deliberately cacheable/network-first
|
|
95
|
+
is deliberately cacheable/network-first.
|
|
97
96
|
"""
|
|
98
97
|
|
|
99
98
|
http_method_names = ["get"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"../../packages/details/src/JsonViewer.tsx": {
|
|
3
|
-
"file": "assets/JsonViewer-
|
|
3
|
+
"file": "assets/JsonViewer-Bex6hfee.js",
|
|
4
4
|
"name": "JsonViewer",
|
|
5
5
|
"src": "../../packages/details/src/JsonViewer.tsx",
|
|
6
6
|
"isDynamicEntry": true,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
]
|
|
10
10
|
},
|
|
11
11
|
"index.html": {
|
|
12
|
-
"file": "assets/index-
|
|
12
|
+
"file": "assets/index-B5KYsso9.js",
|
|
13
13
|
"name": "index",
|
|
14
14
|
"src": "index.html",
|
|
15
15
|
"isEntry": true,
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"src/ColumnLayoutModal.tsx"
|
|
19
19
|
],
|
|
20
20
|
"css": [
|
|
21
|
-
"assets/index-
|
|
21
|
+
"assets/index-DVKgpuxv.css"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"src/ColumnLayoutModal.tsx": {
|
|
25
|
-
"file": "assets/ColumnLayoutModal-
|
|
25
|
+
"file": "assets/ColumnLayoutModal-B7vV9j0o.js",
|
|
26
26
|
"name": "ColumnLayoutModal",
|
|
27
27
|
"src": "src/ColumnLayoutModal.tsx",
|
|
28
28
|
"isDynamicEntry": true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as tt,d as c,R as $,r as ke,j as I,M as kn,b as On,a as Jt}from"./index-
|
|
1
|
+
import{c as tt,d as c,R as $,r as ke,j as I,M as kn,b as On,a as Jt}from"./index-B5KYsso9.js";const Tn=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Qt=tt("grip-vertical",Tn);const Ln=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],jn=tt("lock-open",Ln);const zn=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],jt=tt("lock",zn);const $n=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Bn=tt("rotate-ccw",$n);function Pn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function mt(e){return"nodeType"in e}function B(e){var t,n;return e?xe(e)?e:mt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function yt(e){const{Document:t}=B(e);return e instanceof t}function Pe(e){return xe(e)?!1:e instanceof B(e).HTMLElement}function Zt(e){return e instanceof B(e).SVGElement}function we(e){return e?xe(e)?e.document:mt(e)?yt(e)?e:Pe(e)||Zt(e)?e.ownerDocument:document:document:document}const Z=nt?c.useLayoutEffect:c.useEffect;function xt(e){const t=c.useRef(e);return Z(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Fn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function je(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Z(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Je(e){const t=xt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ht(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let lt={};function Xe(e,t){return c.useMemo(()=>{if(t)return t;const n=lt[e]==null?0:lt[e]+1;return lt[e]=n,e+"-"+n},[e,t])}function en(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const ye=en(1),ze=en(-1);function Xn(e){return"clientX"in e&&"clientY"in e}function wt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Un(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function gt(e){if(Un(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Xn(e)?{x:e.clientX,y:e.clientY}:null}const $e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[$e.Translate.toString(e),$e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),zt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Yn(e){return e.matches(zt)?e:e.querySelector(zt)}const Wn={display:"none"};function Vn(e){let{id:t,value:n}=e;return $.createElement("div",{id:t,style:Wn},n)}function Hn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return $.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Kn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const tn=c.createContext(null);function _n(e){const t=c.useContext(tn);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function qn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Gn={draggable:`
|
|
2
2
|
To pick up a draggable item, press the space bar.
|
|
3
3
|
While dragging, use the arrow keys to move the item.
|
|
4
4
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,d as l,j as e,C as h}from"./index-
|
|
1
|
+
import{c as d,d as l,j as e,C as h}from"./index-B5KYsso9.js";const p=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],g=d("chevron-right",p);const y=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],j=d("copy",y);function N({raw:t,parsed:r}){const[s,c]=l.useState(!1);async function a(){try{await navigator.clipboard.writeText(t),c(!0),setTimeout(()=>c(!1),2e3)}catch{}}return e.jsxs("div",{className:"relative w-full overflow-x-auto rounded border border-gray-200 bg-gray-50 p-3 font-mono text-xs leading-relaxed text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200",children:[e.jsx("button",{type:"button",onClick:a,"aria-label":"Copy JSON",title:s?"Copied":"Copy",className:"absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded border border-gray-300 bg-white text-gray-600 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",children:s?e.jsx(h,{className:"h-3.5 w-3.5 text-green-600","aria-hidden":!0}):e.jsx(j,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx(o,{value:r,depth:0})]})}function o({value:t,depth:r}){return t===null?e.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"null"}):typeof t=="boolean"?e.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:t?"true":"false"}):typeof t=="number"?e.jsx("span",{className:"text-blue-700",children:String(t)}):typeof t=="string"?e.jsxs("span",{className:"text-green-700 dark:text-green-400",children:['"',t,'"']}):Array.isArray(t)?e.jsx(u,{value:t,depth:r}):typeof t=="object"?e.jsx(m,{value:t,depth:r}):e.jsx("span",{className:"text-gray-500",children:String(t)})}function m({value:t,depth:r}){const s=Object.keys(t),[c,a]=l.useState(r<2);return s.length===0?e.jsx("span",{className:"text-gray-500",children:"{}"}):e.jsx(x,{open:c,onToggle:()=>a(n=>!n),collapsedLabel:`{…} ${s.length} ${s.length===1?"key":"keys"}`,openBracket:"{",closeBracket:"}",depth:r,children:s.map((n,i)=>e.jsxs("div",{className:"pl-4",children:[e.jsxs("span",{className:"text-rose-700 dark:text-rose-400",children:['"',n,'"']}),e.jsx("span",{className:"text-gray-500",children:": "}),e.jsx(o,{value:t[n],depth:r+1}),i<s.length-1?e.jsx("span",{className:"text-gray-500",children:","}):null]},n))})}function u({value:t,depth:r}){const[s,c]=l.useState(r<2);return t.length===0?e.jsx("span",{className:"text-gray-500",children:"[]"}):e.jsx(x,{open:s,onToggle:()=>c(a=>!a),collapsedLabel:`[…] ${t.length} ${t.length===1?"item":"items"}`,openBracket:"[",closeBracket:"]",depth:r,children:t.map((a,n)=>e.jsxs("div",{className:"pl-4",children:[e.jsx(o,{value:a,depth:r+1}),n<t.length-1?e.jsx("span",{className:"text-gray-500",children:","}):null]},n))})}function x({open:t,onToggle:r,collapsedLabel:s,openBracket:c,closeBracket:a,depth:n,children:i}){return e.jsxs("span",{children:[e.jsx("button",{type:"button",onClick:r,"aria-expanded":t,className:"inline-flex items-center align-baseline text-gray-500 hover:text-gray-800 dark:hover:text-gray-200",children:e.jsx(g,{className:`h-3 w-3 shrink-0 transition-transform ${t?"rotate-90":""}`,"aria-hidden":!0})}),e.jsx("span",{className:"text-gray-500",children:c}),t?e.jsxs(e.Fragment,{children:[i,e.jsx("div",{className:n===0?"":"pl-0",children:e.jsx("span",{className:"text-gray-500",children:a})})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"px-1 text-gray-500",children:s}),e.jsx("span",{className:"text-gray-500",children:a})]})]})}export{N as default};
|