django-admin-react 1.4.8__tar.gz → 1.4.10__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.4.8 → django_admin_react-1.4.10}/PKG-INFO +34 -17
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/README.md +32 -15
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/static/admin_react/.vite/manifest.json +4 -4
- django_admin_react-1.4.10/django_admin_react/static/admin_react/README.md +15 -0
- django_admin_react-1.4.8/django_admin_react/static/admin_react/assets/ColumnLayoutModal-DcBGNls0.js → django_admin_react-1.4.10/django_admin_react/static/admin_react/assets/ColumnLayoutModal-WJwTw60H.js +1 -1
- django_admin_react-1.4.8/django_admin_react/static/admin_react/assets/JsonViewer-CW4eTVFi.js → django_admin_react-1.4.10/django_admin_react/static/admin_react/assets/JsonViewer-Do4CdnlE.js +1 -1
- django_admin_react-1.4.10/django_admin_react/static/admin_react/assets/index-D0bqDJUG.js +8 -0
- django_admin_react-1.4.8/django_admin_react/static/admin_react/assets/index-CN1EPHGl.css → django_admin_react-1.4.10/django_admin_react/static/admin_react/assets/index-DRQ2gAuA.css +1 -1
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/static/admin_react/index.html +2 -2
- django_admin_react-1.4.10/django_admin_react/templatetags/__init__.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/pyproject.toml +2 -2
- django_admin_react-1.4.8/django_admin_react/static/admin_react/assets/index-CuwsB7T7.js +0 -8
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/LICENSE +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/README.md +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/__init__.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/apps.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/audit.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/conf.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/pwa.py +0 -0
- /django_admin_react-1.4.8/django_admin_react/templatetags/__init__.py → /django_admin_react-1.4.10/django_admin_react/static/admin_react/.gitkeep +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/README.md +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/admin/base_site.html +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/admin_react/README.md +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/admin_react/index.html +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/admin_react/login.html +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/admin_react/sw.js +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templates/django_admin_react/_experience_toggle_strip.html +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/templatetags/experience_toggle.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/urls.py +0 -0
- {django_admin_react-1.4.8 → django_admin_react-1.4.10}/django_admin_react/views.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: django-admin-react
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.10
|
|
4
4
|
Summary: A drop-in React single-page admin for Django, driven entirely by ModelAdmin.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: django,admin,react,spa,tailwind
|
|
@@ -25,7 +25,7 @@ Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
|
|
|
25
25
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
26
|
Requires-Dist: django (>=5.0,<7.0)
|
|
27
27
|
Requires-Dist: django-admin-mcp-api (>=1.0.0,<2.0.0)
|
|
28
|
-
Requires-Dist: django-admin-rest-api (>=1.0.
|
|
28
|
+
Requires-Dist: django-admin-rest-api (>=1.0.6,<2.0.0)
|
|
29
29
|
Project-URL: Documentation, https://github.com/MartinCastroAlvarez/django-admin-react#readme
|
|
30
30
|
Project-URL: Homepage, https://github.com/MartinCastroAlvarez/django-admin-react
|
|
31
31
|
Project-URL: Repository, https://github.com/MartinCastroAlvarez/django-admin-react
|
|
@@ -33,6 +33,8 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
|
|
34
34
|
# django-admin-react
|
|
35
35
|
|
|
36
|
+
[](https://djangopackages.org/packages/p/django-admin-react/)
|
|
37
|
+
|
|
36
38
|
A drop-in **React single-page admin** for any Django 5+ project. Same
|
|
37
39
|
`pip install`, same `INSTALLED_APPS`, same `urls.py include()` — and
|
|
38
40
|
your `ModelAdmin` classes drive everything. No React code on your side.
|
|
@@ -455,18 +457,38 @@ class InvoiceAdmin(admin.ModelAdmin):
|
|
|
455
457
|
|
|
456
458
|
### Add custom admin actions
|
|
457
459
|
|
|
460
|
+
One `actions = (...)` declaration. The API classifies each callable by signature and the SPA renders it on the right surface — **changelist** (multi-select bulk run) or **detail page** (single-object button) — automatically:
|
|
461
|
+
|
|
458
462
|
```python
|
|
459
463
|
class InvoiceAdmin(admin.ModelAdmin):
|
|
460
|
-
actions =
|
|
464
|
+
actions = ("mark_paid", "regenerate_pdf")
|
|
461
465
|
|
|
466
|
+
# Third parameter is `queryset` → batch shape.
|
|
467
|
+
# Renders on the changelist with multi-select.
|
|
462
468
|
@admin.action(description="Mark selected as paid")
|
|
463
469
|
def mark_paid(self, request, queryset):
|
|
464
470
|
queryset.update(status="paid", paid_at=timezone.now())
|
|
471
|
+
|
|
472
|
+
# Third parameter named `obj_id` (or annotated `str`/`int`/Model)
|
|
473
|
+
# → detail shape. Renders as a button on the single-invoice
|
|
474
|
+
# detail page header.
|
|
475
|
+
@admin.action(description="Regenerate PDF")
|
|
476
|
+
def regenerate_pdf(self, request, obj_id: str):
|
|
477
|
+
invoice = self.model.objects.get(pk=obj_id)
|
|
478
|
+
invoice.regenerate_pdf()
|
|
479
|
+
self.message_user(request, f"Regenerated PDF for #{invoice.pk}.")
|
|
465
480
|
```
|
|
466
481
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
482
|
+
Classifier rules (api 1.0.6+):
|
|
483
|
+
|
|
484
|
+
| Third parameter | Target | Where it renders |
|
|
485
|
+
|---|---|---|
|
|
486
|
+
| name `queryset` / `qs`, or `QuerySet` annotation | `batch` | Changelist multi-select |
|
|
487
|
+
| name `obj_id` / `object_id` / `pk` / `id` / `object_pk` | `detail` | Detail page header |
|
|
488
|
+
| annotation `str` / `int` / `Model` subclass | `detail` | Detail page header |
|
|
489
|
+
| anything else | `batch` (default, preserves stock Django) | Changelist multi-select |
|
|
490
|
+
|
|
491
|
+
Same `@admin.action` decorator on both. Same `ModelAdmin.actions` tuple. Same audit trail. **No `django-object-actions`, no `change_actions = (...)` redeclaration** — the signature is the wire.
|
|
470
492
|
|
|
471
493
|
### Per-row permission gating
|
|
472
494
|
|
|
@@ -571,14 +593,11 @@ customisations.
|
|
|
571
593
|
|
|
572
594
|
---
|
|
573
595
|
|
|
574
|
-
## Feature status
|
|
596
|
+
## Feature status
|
|
575
597
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
per-feature *SPA* (UI) status is **not** duplicated here — it is tracked
|
|
580
|
-
live in the [frontend implementation tracker (#160)](https://github.com/MartinCastroAlvarez/django-admin-react/issues/160)
|
|
581
|
-
and the [project board](https://github.com/users/MartinCastroAlvarez/projects/3).
|
|
598
|
+
All three packages are **Production / Stable** on PyPI. The
|
|
599
|
+
`ModelAdmin`-driven REST API + the React SPA + the MCP adapter
|
|
600
|
+
all share the v1 wire contract. Per-feature live status below.
|
|
582
601
|
|
|
583
602
|
| `ModelAdmin` surface | Backend (REST API) |
|
|
584
603
|
| ------------------------------------------------------ | --------------------------------------------------------------- |
|
|
@@ -587,7 +606,7 @@ and the [project board](https://github.com/users/MartinCastroAlvarez/projects/3)
|
|
|
587
606
|
| `list_filter` (boolean / choice / FK / date / Simple) | ✅ |
|
|
588
607
|
| `date_hierarchy` | ✅ |
|
|
589
608
|
| `list_editable` + bulk PATCH | ✅ |
|
|
590
|
-
| `actions`
|
|
609
|
+
| `actions` — batch + detail (signature-classified) | ✅ |
|
|
591
610
|
| `autocomplete_fields` / `raw_id_fields` | ✅ |
|
|
592
611
|
| `ManyToManyField` read + write | ✅ |
|
|
593
612
|
| `inlines` (TabularInline / StackedInline) — read + write | ✅ |
|
|
@@ -602,9 +621,7 @@ and the [project board](https://github.com/users/MartinCastroAlvarez/projects/3)
|
|
|
602
621
|
| OpenAPI 3.1 schema at `/api/v1/schema/` | ✅ |
|
|
603
622
|
| PWA manifest + service worker (cache-purge on logout) | ✅ |
|
|
604
623
|
|
|
605
|
-
✅ = shipped
|
|
606
|
-
column is the **backend** capability only — for which surfaces the React
|
|
607
|
-
UI renders today, see the [frontend tracker (#160)](https://github.com/MartinCastroAlvarez/django-admin-react/issues/160).
|
|
624
|
+
✅ = shipped. 🟡 = not yet built (tracked).
|
|
608
625
|
|
|
609
626
|
---
|
|
610
627
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# django-admin-react
|
|
2
2
|
|
|
3
|
+
[](https://djangopackages.org/packages/p/django-admin-react/)
|
|
4
|
+
|
|
3
5
|
A drop-in **React single-page admin** for any Django 5+ project. Same
|
|
4
6
|
`pip install`, same `INSTALLED_APPS`, same `urls.py include()` — and
|
|
5
7
|
your `ModelAdmin` classes drive everything. No React code on your side.
|
|
@@ -422,18 +424,38 @@ class InvoiceAdmin(admin.ModelAdmin):
|
|
|
422
424
|
|
|
423
425
|
### Add custom admin actions
|
|
424
426
|
|
|
427
|
+
One `actions = (...)` declaration. The API classifies each callable by signature and the SPA renders it on the right surface — **changelist** (multi-select bulk run) or **detail page** (single-object button) — automatically:
|
|
428
|
+
|
|
425
429
|
```python
|
|
426
430
|
class InvoiceAdmin(admin.ModelAdmin):
|
|
427
|
-
actions =
|
|
431
|
+
actions = ("mark_paid", "regenerate_pdf")
|
|
428
432
|
|
|
433
|
+
# Third parameter is `queryset` → batch shape.
|
|
434
|
+
# Renders on the changelist with multi-select.
|
|
429
435
|
@admin.action(description="Mark selected as paid")
|
|
430
436
|
def mark_paid(self, request, queryset):
|
|
431
437
|
queryset.update(status="paid", paid_at=timezone.now())
|
|
438
|
+
|
|
439
|
+
# Third parameter named `obj_id` (or annotated `str`/`int`/Model)
|
|
440
|
+
# → detail shape. Renders as a button on the single-invoice
|
|
441
|
+
# detail page header.
|
|
442
|
+
@admin.action(description="Regenerate PDF")
|
|
443
|
+
def regenerate_pdf(self, request, obj_id: str):
|
|
444
|
+
invoice = self.model.objects.get(pk=obj_id)
|
|
445
|
+
invoice.regenerate_pdf()
|
|
446
|
+
self.message_user(request, f"Regenerated PDF for #{invoice.pk}.")
|
|
432
447
|
```
|
|
433
448
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
449
|
+
Classifier rules (api 1.0.6+):
|
|
450
|
+
|
|
451
|
+
| Third parameter | Target | Where it renders |
|
|
452
|
+
|---|---|---|
|
|
453
|
+
| name `queryset` / `qs`, or `QuerySet` annotation | `batch` | Changelist multi-select |
|
|
454
|
+
| name `obj_id` / `object_id` / `pk` / `id` / `object_pk` | `detail` | Detail page header |
|
|
455
|
+
| annotation `str` / `int` / `Model` subclass | `detail` | Detail page header |
|
|
456
|
+
| anything else | `batch` (default, preserves stock Django) | Changelist multi-select |
|
|
457
|
+
|
|
458
|
+
Same `@admin.action` decorator on both. Same `ModelAdmin.actions` tuple. Same audit trail. **No `django-object-actions`, no `change_actions = (...)` redeclaration** — the signature is the wire.
|
|
437
459
|
|
|
438
460
|
### Per-row permission gating
|
|
439
461
|
|
|
@@ -538,14 +560,11 @@ customisations.
|
|
|
538
560
|
|
|
539
561
|
---
|
|
540
562
|
|
|
541
|
-
## Feature status
|
|
563
|
+
## Feature status
|
|
542
564
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
per-feature *SPA* (UI) status is **not** duplicated here — it is tracked
|
|
547
|
-
live in the [frontend implementation tracker (#160)](https://github.com/MartinCastroAlvarez/django-admin-react/issues/160)
|
|
548
|
-
and the [project board](https://github.com/users/MartinCastroAlvarez/projects/3).
|
|
565
|
+
All three packages are **Production / Stable** on PyPI. The
|
|
566
|
+
`ModelAdmin`-driven REST API + the React SPA + the MCP adapter
|
|
567
|
+
all share the v1 wire contract. Per-feature live status below.
|
|
549
568
|
|
|
550
569
|
| `ModelAdmin` surface | Backend (REST API) |
|
|
551
570
|
| ------------------------------------------------------ | --------------------------------------------------------------- |
|
|
@@ -554,7 +573,7 @@ and the [project board](https://github.com/users/MartinCastroAlvarez/projects/3)
|
|
|
554
573
|
| `list_filter` (boolean / choice / FK / date / Simple) | ✅ |
|
|
555
574
|
| `date_hierarchy` | ✅ |
|
|
556
575
|
| `list_editable` + bulk PATCH | ✅ |
|
|
557
|
-
| `actions`
|
|
576
|
+
| `actions` — batch + detail (signature-classified) | ✅ |
|
|
558
577
|
| `autocomplete_fields` / `raw_id_fields` | ✅ |
|
|
559
578
|
| `ManyToManyField` read + write | ✅ |
|
|
560
579
|
| `inlines` (TabularInline / StackedInline) — read + write | ✅ |
|
|
@@ -569,9 +588,7 @@ and the [project board](https://github.com/users/MartinCastroAlvarez/projects/3)
|
|
|
569
588
|
| OpenAPI 3.1 schema at `/api/v1/schema/` | ✅ |
|
|
570
589
|
| PWA manifest + service worker (cache-purge on logout) | ✅ |
|
|
571
590
|
|
|
572
|
-
✅ = shipped
|
|
573
|
-
column is the **backend** capability only — for which surfaces the React
|
|
574
|
-
UI renders today, see the [frontend tracker (#160)](https://github.com/MartinCastroAlvarez/django-admin-react/issues/160).
|
|
591
|
+
✅ = shipped. 🟡 = not yet built (tracked).
|
|
575
592
|
|
|
576
593
|
---
|
|
577
594
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"../../packages/details/src/JsonViewer.tsx": {
|
|
3
|
-
"file": "assets/JsonViewer-
|
|
3
|
+
"file": "assets/JsonViewer-Do4CdnlE.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-D0bqDJUG.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-DRQ2gAuA.css"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"src/ColumnLayoutModal.tsx": {
|
|
25
|
-
"file": "assets/ColumnLayoutModal-
|
|
25
|
+
"file": "assets/ColumnLayoutModal-WJwTw60H.js",
|
|
26
26
|
"name": "ColumnLayoutModal",
|
|
27
27
|
"src": "src/ColumnLayoutModal.tsx",
|
|
28
28
|
"isDynamicEntry": true,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# django_admin_react/static/admin_react/
|
|
2
|
+
|
|
3
|
+
The built React bundle drops here at packaging time. Nothing checked
|
|
4
|
+
in to git except this README and `.gitkeep`.
|
|
5
|
+
|
|
6
|
+
The build step (run from `frontend/`):
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm --filter @dar/web build
|
|
10
|
+
poetry run dar-build-frontend # (script lands in PR #6)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
copies the hashed JS, CSS, and any static assets here so the wheel
|
|
14
|
+
shipped to PyPI contains a ready-to-serve bundle. Consumers do not
|
|
15
|
+
need Node to install the package.
|
|
@@ -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-D0bqDJUG.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-D0bqDJUG.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};
|