diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 6cfbdbe..2cbc388 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -98,12 +98,18 @@ jobs: - name: Setup dependencies uses: ./.github/actions/setup-deps + - name: Lint WordPress styles + run: npm run lint:css + - name: Setup WP-Env uses: ./.github/actions/setup-wp-env - name: Run PHP unit tests run: npm run test:unit:backend + - name: Run Personal Stuff block and search tests + run: npm run test:unit:stuff + build-and-publish: if: ${{ github.event.pull_request.state == 'open' && github.event.pull_request.draft == false }} needs: [test] @@ -116,6 +122,7 @@ jobs: - personal-evernote-sync - personal-todo - personal-ai-chat + - personal-stuff steps: - name: Checkout PR merge ref uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9acf133..647ef2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ jobs: - personal-evernote-sync - personal-todo - personal-ai-chat + - personal-stuff steps: - name: Checkout Repository diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..bab058d --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,10 @@ +# Generated output and bundled dependencies. +**/build/** +**/dist/** +**/out/** +**/vendor/** +**/coverage/** +**/.next/** + +# Separate Next.js project; it does not use WordPress CSS conventions. +src-chatbot/** diff --git a/.wp-env.json b/.wp-env.json index 8c6feb2..2e8eb72 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -5,7 +5,8 @@ "./packages/personal-readwise-sync", "./packages/personal-evernote-sync", "./packages/personal-todo", - "./packages/personal-ai-chat" + "./packages/personal-ai-chat", + "./packages/personal-stuff" ], "config": { "WP_DEBUG": true, diff --git a/.wp-env.personal-stuff.json b/.wp-env.personal-stuff.json new file mode 100644 index 0000000..d1edd60 --- /dev/null +++ b/.wp-env.personal-stuff.json @@ -0,0 +1,19 @@ +{ + "plugins": [ + "https://downloads.wordpress.org/plugin/gutenberg.23.7.0.zip", + "./packages/personal-stuff" + ], + "config": { + "WP_DEBUG": true, + "WP_DEBUG_LOG": true, + "SCRIPT_DEBUG": true, + "WP_DEBUG_DISPLAY": true + }, + "mappings": { + "wp-content/shared/php": "./shared/php", + "wp-content/vendor": "./vendor" + }, + "lifecycleScripts": { + "afterStart": "wp-env run cli wp option update gutenberg-experiments '{\"gutenberg-guidelines\":true}' --format=json" + } +} diff --git a/AGENTS.md b/AGENTS.md index 75f2a32..be53d16 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,6 +31,22 @@ Assume environment is set up. - IMPORTANT: When you learn something about the codebase or how I want you to operate, add it to lessons below. ### Lessons +- Personal Stuff UX should keep search and uncropped photos prominent, minimize mobile header clutter, and use a full-viewport add/edit flow on phones with inputs at least 16px and persistent save/progress controls. Keep secondary photo controls and block settings optional. `docs/personal-stuff-ux-feedback.md` records applicable feedback mined from the original Stuff sessions; no PRs were available there. +- DataViews grid `layout.previewSize` is a column count, not a pixel width. Leave it unset for responsive defaults; a value such as 240 produces an unusable grid below the library's mobile breakpoint. +- On M5, offer the optional Tailscale hostname setup when working with wp-env WordPress projects, but never enable it automatically or treat this project's approval as consent for other projects. The shared machine-context skill and M5 profile hold the reusable procedure; localhost remains the default until the user accepts. +- Host-specific wp-env domains belong in ignored `.wp-env.override.json` under `env.development.config` (`WP_HOME` and `WP_SITEURL`), leaving the PHPUnit site's URL local. Back up and replace stored development URLs with serialization-aware WP-CLI search-replace, skipping GUIDs. Normal wp-env startup reactivates configured packages on both sites, so a standalone ZIP test copy must not remain active alongside the same source plugin when returning to the suite. +- Keep CSS lint dependencies compatible with the installed WordPress scripts: scripts 30.7.0 uses `@wordpress/stylelint-config/scss-stylistic` from config 23.6.0 and Stylelint 16.12.0. Declare the config and binary explicitly, preserve the lockfile, and validate with `npm ci`; ignore generated/bundled CSS and the separate Next.js project, while linting all WordPress source styles without disabling rules. +- Personal Stuff creates a private empty Knowledge row before opening its editor so every upload surface has a saved authorized parent. Use both upload and sideload prefilters for filename randomization: Gutenberg/core REST supports raw-body and multipart uploads, while the native Media Library uses verified `post_id`. Keep originals and derivatives on the same random basename. +- Browser tests confirmed Stuff and Personal Notes share native Gutenberg content without adding the `note` identity to Stuff items; Notes continues to list note records. Moving/tagging an item must omit unchanged `content` so gallery captions, order and custom blocks remain intact. +- Personal Stuff is planned as a standalone plugin replicating `~/GIT/stuff`; its physical places must be hierarchical `wp_knowledge_type` terms in a tree rooted at the top-level `stuff` Knowledge Type, not separate place posts or `post_parent` relationships. Items remain individual Knowledge posts, and location is a taxonomy assignment. +- Personal Stuff item photos and galleries belong in `post_content` as native Gutenberg image/gallery blocks, with block order determining photo order and cover. Both Gutenberg and the native Stuff UI must edit the same content losslessly; do not store a parallel gallery in meta. Include a required operating skill, but no importing affordances or importer phase. `docs/personal-stuff-plan.md` holds the revised lean plan. +- Personal Stuff has no quantity field and no linked place-content posts or `personal_stuff_content_id`. Places/tags are raw taxonomy terms using native name, slug, parent and description; omit place galleries and custom Stuff post/term meta. Photos belong to item posts only; existing Knowledge provenance and normal WordPress attachment metadata may remain. +- Personal Stuff is primarily a JS app over existing Knowledge, Knowledge Type and Media REST APIs. Add no custom REST namespace, server projection API, package-specific Abilities, storage schema, ACL registry or persistent lock/idempotency store. Keep PHP thin: fixed-term provisioning, WpApp/assets/editor integration, scoped upload filename randomization and narrow native hooks as needed; rely on existing WordPress permissions and editing behavior. +- Prefer the simplest Personal Stuff implementation: a small PHP bootstrap for terms and required integration, with JS using existing WordPress APIs/components. Do not prebuild controllers/services, custom permissions/concurrency, a separate editor engine, media reference scanner, repair framework or offline subsystem. Preserve the requested inventory UI using native facilities; add abstractions only when concrete implementation needs justify them. +- Personal Stuff should expose a private top-level `/stuff/` app through the existing bundled WpApp helper, with wp-admin entries acting as launchers and My Apps integration when available. The user meant WpApps, not a my.wordpress.net-specific browser runtime; do not add browser-local deployment requirements from that reference. +- Personal Stuff routing terms such as `stuff`, `stuff-places` and `stuff-tags` must be recognized by stable slugs and created idempotently on activation, with deferred provisioning when Knowledge becomes available. Do not store root term IDs, installed/schema flags or other speculative persistent plugin options; derive readiness from actual terms and use native WordPress relationships. +- Personal Stuff must replace new upload basenames with cryptographically random names before files enter WordPress's public Media uploads directory, preserving validated extensions and applying the rule in both the Stuff UI and its Gutenberg upload context. Original/scaled/thumbnail filenames must retain the unpredictable basename. These remain public URLs that are hard to guess, not private media; do not rename unrelated uploads or existing attachments retroactively, and do not add an option for this rule. +- When porting Stuff, inspect its current code as well as its PRD: the app includes filtered collection links, Print / PDF, contextual previous/next and swipe navigation, inline description editing, photo recovery/publication, and cached read-only browsing. Do not copy its broad same-origin service-worker caching into an authenticated WordPress app. - For the plugin split, prefer a lean Personal-branded, Knowledge-centered target: Notes UI, Readwise sync, Evernote sync, TODO+ICS, and AI Chat; remove/defer OpenAI, Perplexity, IMAP/email responder, podcast/ElevenLabs, transcription, and voice/realtime instead of extracting every old module. - TODO should store each task as its own `wp_knowledge` post tagged `artifact` and `todo` so non-PersonalOS Knowledge consumers can discover tasks; do not use `plan` or `personalos` for ordinary TODO rows. - Current GitHub Actions build one monolithic `wp-personal-os.zip`; the plugin split needs a package matrix that builds and uploads separate ZIPs for Notes, Readwise, Evernote, TODO, and AI Chat. diff --git a/docs/personal-stuff-plan.md b/docs/personal-stuff-plan.md new file mode 100644 index 0000000..dc9f932 --- /dev/null +++ b/docs/personal-stuff-plan.md @@ -0,0 +1,199 @@ +# Personal Stuff: lean implementation plan + +Implemented on 2026-09-06 in `packages/personal-stuff`. This document preserves the agreed scope; [TECHNICAL.md](../packages/personal-stuff/TECHNICAL.md) defines the implemented contract and [the verification record](personal-stuff-verification.md) records the test results. + +## 1. Shape of the plugin + +**Personal Stuff is a JS inventory app over WordPress Knowledge, exposed as a private WpApp at `/stuff/`.** WordPress owns storage, REST, users, permissions, media and Gutenberg. Reuse those facilities directly. + +Keep PHP to a small bootstrap using the existing shared helpers: + +1. Ensure the fixed Knowledge Type terms exist. +2. Register the WpApp, launcher links and package assets. +3. Make native Knowledge/Gutenberg editing available for Stuff items when needed. +4. Randomize new Stuff upload filenames before WordPress saves them publicly. + +No custom REST API, CRUD service layer, database tables, custom post/term meta, persistent plugin options, custom permissions, lock registry, job system or package-specific Abilities. Add a helper only when the implementation has real duplication or a clearly separate responsibility; do not scaffold controller/service classes in advance. + +## 2. What is stored + +| Data | Existing WordPress representation | +| --- | --- | +| Item | One `wp_knowledge` post | +| Item name | `post_title` | +| Description and ordered photos | Gutenberg blocks in `post_content` | +| Author/privacy/lifecycle | Native `post_author`, `post_status`, timestamps and trash | +| Place | Raw `wp_knowledge_type` term: name, slug, parent, description | +| Tag | Raw term in the same taxonomy | +| Item location/tags | Native post-to-term relationships | +| Photo file and image sizes | WordPress attachment and standard media metadata | + +There is no quantity field, place-content post, content-ID link, gallery meta, saved path, photo count or featured-image mirror. Existing shared Knowledge provenance may be preserved; do not add a source field just for Stuff. + +Photo order comes from block order. The first image supplies the cover. Paths, ancestor lists, search text and counts are computed in JS. Counts mean item posts, not quantities. + +### Taxonomy tree + +```text +wp_knowledge_type +├── artifact existing shared Knowledge identity +└── stuff fixed root + ├── stuff-item fixed item identity + ├── stuff-places fixed places branch + │ ├── Home + │ │ ├── Garage + │ │ │ └── Blue box + │ │ └── Office + │ └── Camper + └── stuff-tags fixed tags branch + ├── cables + └── camping +``` + +Each item receives `artifact` and `stuff-item`, zero or one physical place term, and chosen tags. Preserve unrelated Knowledge Type assignments. No place means unassigned; no fake room is needed. + +The fixed root/branch terms are structural, not assignable through Stuff controls. Actual places remain assignable even when they contain child places: an item can be directly in Garage. This does not change existing PARA container behavior. The native Gutenberg Knowledge Type panel remains available. + +Resolve fixed terms by **slug**, not name or saved numeric ID. Create missing terms parent-first on activation; reuse existing exact slugs. If Knowledge is unavailable then, repeat the same idempotent ensure operation once its taxonomy is available. No installed flag, schema-version option or root-ID option. Report conflicting root structure rather than silently making `stuff-2` or moving unrelated terms. + +User-created places/tags use normal WordPress term APIs. Preserve their IDs and slugs on rename. Do not rewrite user hierarchy on every request. + +Moving Blue box from Garage to Office changes only its term's `parent`. Items keep their assigned Blue box term. Their displayed paths and ancestor search matches change when JS recomputes the tree. There is no item `post_parent` location and no cascade of item writes. + +Places use native term descriptions only. They have no galleries or Gutenberg documents of their own; that source feature is intentionally omitted. + +## 3. Existing APIs only + +| Action | Interface | +| --- | --- | +| List/read/create/edit/trash items | Existing `/wp/v2/knowledge` endpoints | +| Assign a place or tags | Native taxonomy field on the Knowledge REST record | +| Create/rename/move/delete places/tags | Existing Knowledge Type taxonomy REST endpoints | +| Upload/read media | Existing `/wp/v2/media` endpoints | +| Add/remove/reorder photos | Edit blocks in JS, then save the post's content through Knowledge REST | +| Search/tree/breadcrumbs/counts | JS over authorized records already loaded | + +Use WordPress `api-fetch` and core-data where useful. Discover the taxonomy's actual REST base and post field from the runtime. Load all required pages before treating local search as complete. Read raw content in authorized edit context for editing; do not reconstruct a document from rendered content. + +Use existing WordPress permissions. Hide actions the user cannot perform and handle core permission errors. No custom household sharing system or new roles are required; access follows the site's existing user configuration. + +Keep validation close to the UI: required item name, one selected physical location, no self/descendant place move, no duplicate sibling names, and no deletion of a place with dependents. Use core validation as supplied; add a narrowly scoped hook only for a demonstrated invariant that cannot be kept through existing paths. Do not build a replacement taxonomy controller or promise transaction/locking guarantees beyond WordPress. + +Preserve drafts on failure. Refetch before overwriting a document from an older snapshot and show changed data for review. This is ordinary best-effort conflict handling, not a new atomic version protocol. Do not automatically repeat an uncertain create/upload POST; reconcile known saved IDs first. + +## 4. Gutenberg and the Stuff UI + +Store descriptions as ordinary paragraphs/headings/lists and photos as `core/gallery` with `core/image` children, or standalone image blocks. Use the registered WordPress block parser/serializer; no regex rewriting, custom photo format or PHP gallery formatter. + +Both interfaces edit the same content: + +- **Gutenberg:** normal native editor, core blocks and raw Knowledge Type panel. +- **Stuff:** quick-add/edit, location/tag controls, description editing, image upload and gallery arrangement. Reuse WordPress block-editor components for rich content instead of implementing another editor engine. + +Fast controls change the intended block and preserve everything else. If a post contains multiple galleries or images mixed with text, retain those groups and ordering; do not flatten the document. Unknown/custom blocks, captions, alt text and layout must survive. Provide a direct native Gutenberg edit link as well. + +Derive photo occurrences in document order from core image/gallery blocks. A repeated attachment is a repeated block occurrence, not necessarily an error. Use block paths only within the current in-memory document; store no photo UUIDs or Gutenberg client IDs. Do not expand dynamic queries or synced patterns into owned inventory photos. + +New name-only items get valid initial block content. Verify that Stuff items stay Gutenberg-editable when emptied and that any small editor integration does not change Personal Notes' behavior for unrelated Markdown/plain-text Knowledge. + +## 5. Photos and public filenames + +New Stuff uploads use ordinary WordPress Media, with an unpredictable basename **before the file is moved into the public uploads directory**. + +- Generate at least 128 random bits server-side, for example `bin2hex( random_bytes( 16 ) )`, plus the validated image extension. No original basename, item name, sequential ID or timestamp as the random component. Fail without a predictable fallback if secure randomness is unavailable. +- Apply this in both the Stuff UI and its native Gutenberg upload context, using existing WordPress upload hooks and a verified authorized destination post. No custom upload endpoint and no global renaming of unrelated uploads. +- Confirm the actual core upload paths used, including raw-body/multipart differences. Client-side renaming may help but does not replace server enforcement. +- Let retained originals, scaled files and generated thumbnails use the randomized basename. Do not leave an original-name public copy or rename only after upload. +- Preserve original bytes where supported and generate previews using normal WordPress media handling. Report unsupported phone formats or upload limits clearly. +- Save the item first, then upload and insert photos sequentially. Keep the item and earlier successful photos if a later file fails. Retain known successful attachment IDs instead of uploading them again on retry. +- Removing an image block removes a reference, not its file. Keep permanent attachment deletion in ordinary Media management; do not build a custom reference scanner or media-deletion workflow in Stuff. +- Existing attachments are not renamed retroactively. URL-only images remain references and cannot be randomized unless explicitly uploaded as new files. No automatic sideload/import feature. + +**The image URLs remain public and hard to guess; they are not private access-controlled media.** Say this in help/readme. Keep the `/stuff/` UI and Knowledge records private through normal WordPress permissions. No media-mode setting or private-file-serving adapter is part of v1. + +## 6. UI behavior to preserve from Stuff + +The source audit used `~/GIT/stuff` at commit `12a19b1`; all 49 source Node tests passed. Port its useful behavior, not its Google infrastructure: + +- Mobile-first visual grid and compact list, with cover images or placeholders. +- Search names, description text, tags and full ancestor location paths; preserve accent/case normalization and small typo tolerance. +- Combined place-subtree, tag and photo-presence filters; encode filters in app URLs. +- Name-only quick-add, item editing/moving and raw place/tag editing. +- Image galleries, camera/device uploads, captions, ordering and broken-image handling. +- Contextual previous/next, touch swipe, return to filtered results and inline description editing. +- Print / Save as PDF of the full filtered result set, waiting for images with a bounded timeout. +- Keyboard/touch accessibility, clear progress, retained drafts and partial-upload feedback. + +Use DataViews for the compact list where it fits; the photo grid can use the same data and filter state. Port the source's small pure search functions rather than rebuilding search server-side. Avoid a request per card; fetch records/terms in pages and load image bytes lazily. + +There is no quantity, place gallery, importer, Google login, spreadsheet repair, custom error-log screen or migration workflow. Native WordPress error handling/debug logging is enough. Client-side diagnostics can report malformed/missing data without a new endpoint or repair framework. + +Home-screen/install polish should reuse existing app/site facilities. Do not build a separate offline data store or service-worker subsystem as a prerequisite. If a worker is later needed, keep it app-scoped with an explicit static-asset allowlist; never copy the source's broad same-origin caching over authenticated WordPress data. + +## 7. Operating skill + +Include a portable operating skill at `packages/personal-stuff/skills/personal-stuff/SKILL.md`, linked from app help/readme. Write it against the verified existing APIs once the integration works; no custom ability layer is needed. + +The skill covers finding, adding, editing and moving items/places, and adding photos: + +- Resolve fixed roots by slug and distinguish term IDs, post IDs and attachment IDs. +- Disambiguate duplicate names using full paths. +- Use normal Knowledge/term/Media APIs and preserve unrelated terms/content. +- Parse and serialize Gutenberg content correctly; never replace it with a photo-meta representation. +- Upload with the authorized Stuff destination context and verify randomized returned filenames. +- Preserve successful work on partial failure; distinguish image-block removal from file deletion. +- Verify saved content and relationships after changes; do not invent tags or assume permissions. + +No importer is required. A future authorized data-entry/transfer request can use these ordinary operations without adding importing affordances to the plugin. + +## 8. Files and delivery + +Start small: + +```text +packages/personal-stuff/ + personal-stuff.php thin bootstrap/hooks and term setup + src/ + index.js app and components + content.js block helpers if useful + search.js source search logic + style.scss + skills/personal-stuff/SKILL.md + TECHNICAL.md + readme.txt + LICENSE + build/ generated + includes/shared/ release-bundled existing helpers + vendor/akirk/wp-app/ pinned existing runtime +``` + +Split files/classes only as real code size/responsibility warrants. No pre-created controller/repository/service directories. Follow existing package conventions, build commands and PHP style. + +1. **Foundation:** term provisioning, private `/stuff/` WpApp, assets and existing API reads/writes. Name-only create/edit and place moves work. +2. **UI/content:** visual inventory/search/filters, native term editing, shared Gutenberg document editing and randomized photo uploads. Complete the source interactions above and the operating skill. +3. **Package/verify:** add the app to existing webpack/build/ZIP lists, wp-env configs and release/preview matrices. Bundle existing shared helpers and pinned WpApp; document the implemented schema in `TECHNICAL.md`. + +The plugin must run independently of other Personal packages, with the Knowledge runtime available. Reuse the existing `PersonalOS_Wp_App` helper, My Apps integration and wp-admin launcher pattern. No my.wordpress.net-specific deployment requirement. Follow the current app targets (WordPress 7.0, PHP 7.4, WpApp 1.3.2) and existing test fixture conventions. + +## 9. Focused verification + +- Repeated/deferred term initialization preserves exact slugs and creates no duplicate roots or options. +- Items use only native posts/blocks/term relationships; raw places have no companion posts/meta; no quantity or custom REST namespace exists. +- Both editors round-trip representative paragraphs, nested galleries, standalone images, captions and custom blocks without data loss or invalid-block dialogs. +- Renaming/reparenting places updates derived paths/search while item term assignments remain unchanged. +- Core post/term/media permissions are respected. No permission widening or site-wide visibility change. +- New app/Gutenberg uploads have random basenames before public persistence, including originals/sizes. Unrelated uploads and existing attachments remain untouched. +- Failed uploads preserve prior work; stale drafts and uncertain POST results are handled visibly without blind retries. +- Search/filter/context navigation and full-result printing work on a representative inventory. +- The operating skill performs ordinary tasks through existing APIs and its changes appear in both UIs. +- Build/lint, relevant backend/JS tests and actual standalone ZIP activation pass. If wp-env fails, report the environment failure rather than repairing it as part of this feature. + +Deactivation/uninstall retains records, terms and media. No new data migration or cleanup framework is needed. + +## References + +Source behavior: `../../stuff/src/components/stuff-app.js`, `../../stuff/src/search/search-index.js`, `../../stuff/src/services/media-service.js`, `../../stuff/SKILL.md`. + +Existing integration: `../shared/php/class-personalos-wp-app.php`, `../shared/php/class-personalos-knowledge-bridge.php`, `../shared/php/class-personalos-knowledge-type-vocabulary.php`, `../packages/personal-notes/includes/class-personal-notes-plugin.php`. + +Packaging: `../tools/package-plugin.mjs`, `../tools/sync-package-builds.mjs`, `../tools/verify-split-packages.mjs`. Existing technical-document precedent: `../packages/personal-todo/TECHNICAL.md`. diff --git a/docs/personal-stuff-ux-feedback.md b/docs/personal-stuff-ux-feedback.md new file mode 100644 index 0000000..c327d07 --- /dev/null +++ b/docs/personal-stuff-ux-feedback.md @@ -0,0 +1,14 @@ +# Personal Stuff UX feedback + +Research date: 2026-09-06. A bounded Luna sub-agent reviewed `~/GIT/stuff` local Codex sessions, repository documentation and commit history. `gh pr list --repo artpi/stuff --state all` returned no PRs; no PR review feedback was available. Session IDs below identify local source conversations, not public links. PRD statements are product requirements, not verbatim user messages. + +| Evidence | Applicable decision | +| --- | --- | +| Session `01a025ab-e83d-7912-9e0b-49c398c4e12a`: “header takes too much space” and “make the add/edit panel on mobile full screen because there are zoom problem when editing on ios.” Follow-up `01a076b3-85bc-73a1-b2c1-855d3ef5ca1d`; source commit `12a19b1`. | Full-viewport add/edit at phone widths, compact app header, inputs at least 16px, sticky save actions, optional inline block inspector. Verify iOS on a real device separately from Chrome emulation. | +| Source `docs/prd.md`: “camera/gallery action is visually primary on phones but never blocks a text-only record.” | Prominent photo target; blank name field for a new item; name-only save remains valid. The private Knowledge parent still exists before uploads. | +| Session `01a03f98-c544-7c71-b392-a392e1d7bc41`: “sharing photos after uploading takes forever and then fails”; source commit `1ce3800`. | Keep upload progress visible beside the save controls; preserve entered values and successful uploads on failure. No Drive sharing phase in WordPress. | +| Session `01a023c8-1da7-7e32-a5c4-52538171dba7`: “each thumbnail was in its entirety” and “photos [should be] in the center of attention”; source commits `7dc8ab8`, `12a19b1`. | Inventory thumbnails use contain, with clear missing-image placeholders. Preserve photo-led filtered printing and native gallery content. | +| Session `01a023de-9a93-7e53-a263-a1aa83e0606a`: “This seems very misaligned when you click ‘choose location’”; source commit `027cd13`. | Explicit place breadcrumbs and child-place buttons, with the complete hierarchical selector in Filters. Parent filtering includes descendants. | +| Source `docs/prd.md`: “feel as visual and inviting as Pinterest while keeping search, location context, and fast data entry more prominent”; design review request in session `01a02465-a2db-7b22-882c-82845c3f6042`. | Search-led layout, restrained green/cream palette with dark counterpart, consistent card spacing and progressive disclosure of filters and secondary editor controls. | + +Existing contextual previous/next, swipe navigation, error retention and Gutenberg interoperability remain part of the implementation. The original app's quantity, place photos, Google Picker/Drive recovery, spreadsheet storage/migration and broad service-worker caching are superseded by the current Knowledge-only plan and must not be reintroduced from historical feedback. diff --git a/docs/personal-stuff-verification.md b/docs/personal-stuff-verification.md new file mode 100644 index 0000000..f7c0afd --- /dev/null +++ b/docs/personal-stuff-verification.md @@ -0,0 +1,49 @@ +# Personal Stuff verification + +Verified locally on 2026-09-06 using wp-env, WordPress 7.1 and the pinned Gutenberg 23.7.0 Knowledge fixture. The development site runs all six split packages; the separate test site also exercised the release ZIP with only Gutenberg and Personal Stuff active. + +## Automated checks + +- Full PHP unit suite: 171 tests, 1,047 assertions, 10 existing skips; no failures. +- Stuff PHP coverage: six tests / 31 assertions covering vocabulary, native REST permissions/content, Notes editor compatibility and upload filename/thumbnail behavior. +- Stuff JS suite: four passing tests using WordPress block parsing and serialization, including unknown blocks, gallery order and search. +- PHP, JS and repository-wide WordPress CSS lint passed. `git diff --check` passed. +- Production build passed; package verification accepted all six standalone ZIPs, including Stuff's bundled helpers, WpApp, editor assets, technical contract and operating skill. +- The extracted Stuff ZIP activated independently. Its shared base loaded from the ZIP's own `includes/shared` directory, the fixed `stuff` term existed, and authenticated native Knowledge REST returned HTTP 200. +- Operating skill validation passed. + +CSS lint initially could not start because the lockfile paired WordPress scripts 30.7.0 with the obsolete Stylelint 14 / WordPress config 21.33.0. After authorization to repair the tooling, the project explicitly pins Stylelint 16.12.0 and the matching WordPress config 23.6.0. A clean `npm ci` succeeds, and all WordPress source styles pass the unmodified WordPress lint rules. Generated/bundled files and the separate Next.js project are excluded. Formatting, equivalent color notation, selector ordering and a duplicate rule were corrected; normal webpack bundle-size warnings remain. + +The tooling fix was checked with Node 20.20.2 and npm 10, matching CI's Node major: clean install, full CSS lint, four JS tests, production build and all six ZIP checks passed. A declaration comparison confirmed that all 13 reformatted stylesheets retain equivalent properties/values per selector and media context; reordered rules were reviewed for cascade behavior. CSS lint is now part of the PR workflow. + +## Browser checks + +Used the in-app browser and Chrome against `http://localhost:8901/stuff/`. + +- Created raw Home / Garage place terms and a Travel tag, then assigned them to private item posts. +- Created a name-only item, uploaded photos, edited the description inline, and reopened saved records. +- Verified typo search, parent-place filtering and the no-photo filter. Contextual Previous navigation followed the filtered collection. +- Uploaded through Stuff's photo input, native Gutenberg, and the Media Library inside Stuff. All new files had 32-character random hexadecimal basenames. WordPress image sizes retained the random stem and uploads had the saved item as parent. +- Edited a gallery caption and photo order in native Gutenberg with Personal Notes active. Stuff displayed the saved caption and cover order. A later place/tag-only save retained the exact `post_content` checksum. +- Confirmed Personal Notes' sidebar remains available in the Stuff Gutenberg editor. The Notes library displayed its own note without automatically enrolling Stuff items. A Markdown note still opened in the classic editor. +- Checked dark appearance and a 390px Chrome viewport; document width equaled viewport width without horizontal overflow. +- Opened native Print preview with the full sample collection. After correcting print layout overflow, Chrome's PDF renderer produced one page containing both sample items and their photos. The final PDF check captured the app-generated print content; temporary browser instrumentation was removed by reloading. No physical print job was sent. +- Confirmed anonymous `/stuff/` access redirects to login. + +The development site is left running with synthetic sample records: Camera kit, Charging cables, and the Packing checklist note. Sample images are the source Stuff app's icons. Public upload URLs remain public even though the items and app are private. + +## Scope of evidence + +These checks establish the native storage/editor and standalone package paths on the tested fixture. They do not establish private media access, atomic multi-editor concurrency, offline support, or exhaustive compatibility with third-party Gutenberg blocks. Those are not features of this implementation. + +## UX refinement — 2026-09-06 + +The follow-up design uses cream/green and dark green palettes, uncropped photo cards, compact search with optional filters, place breadcrumbs, and a native DataViews header containing counts and actions. Add/edit uses the entire viewport on phones, a sticky save/progress footer, and optional photo/block controls. The source feedback and superseded requirements are recorded in `docs/personal-stuff-ux-feedback.md`. + +- Browser checks on the development site at `http://artpi-m5.tailaea879.ts.net:8901/stuff/`: name-only creation, saved place assignment, Home subtree browsing, search, photo filtering and empty results, detail/editor transitions, and saving existing gallery content with its caption retained. +- The restyled file input opened the chooser and uploaded a synthetic icon into a native gallery, with randomized basename `c2d61a7cdcdd3a4c430625ece75c9a0e.png`. Progress changed from saving/uploading to saved; the photo filter reflected the upload. +- Chrome responsive inspection at 390×844 and 320×740 confirmed the editor starts at (0, 0), matches the viewport width/height, has no horizontal overflow, uses 16px inputs, and keeps the save footer at the bottom. Light and dark appearances were visually inspected. These are emulated layout checks; real iOS keyboard, focus zoom and camera behavior are not established by them. Chrome's automated touch dispatch was unavailable; functional interactions were exercised in the in-app browser. +- Personal Notes still lists the existing Packing checklist note and does not list the new Stuff items. No shared helper, PHP, storage, or Notes asset changes were made in this UX pass. +- Four block/search JS tests, JS lint, all WordPress source CSS lint, production build, and all six standalone package ZIP checks pass. Backend evidence above predates this JS/CSS pass; the previously reported test-site duplicate ZIP/source plugin activation issue was left untouched. + +Print media emulation with dark mode enabled confirms both the document and body remain white; screen theme backgrounds are scoped away from printing. diff --git a/modules/notes/admin-widgets.css b/modules/notes/admin-widgets.css index f0ebfa0..76ee319 100644 --- a/modules/notes/admin-widgets.css +++ b/modules/notes/admin-widgets.css @@ -1,42 +1,46 @@ .pos_admin_widget_notes li { - margin: 0 + margin: 0; } + +.pos_admin_widget_todos li { + display: flex; + flex-direction: row; + height: 25px; +} + .pos_admin_widget_notes li a { - display:block; - padding: 0.5em; - border-top: 1px solid #e5e5e5; + display: block; + padding: 0.5em; + border-top: 1px solid #e5e5e5; } + .pos_admin_widget_notes li:hover { - background-color: #efefef; + background-color: #efefef; } .pos_admin_widget_notes h5 { - margin: 0 5px 0 0; + margin: 0 5px 0 0; } .pos_admin_widget_notes time { - color:#646970; - display: block; - text-align: right; + color: #646970; + display: block; + text-align: right; } .pos_admin_widget_notes p { - color:gray; - font-style:italic; - margin-top: 0.1em; - margin-bottom: 0; + color: #808080; + font-style: italic; + margin-top: 0.1em; + margin-bottom: 0; } -.pos_admin_widget_todos li { - display:flex; - flex-direction: row; - height: 25px; -} .pos_admin_widget_todos li a { - line-height: 25px; - height: 25px; - display:flex; + line-height: 25px; + height: 25px; + display: flex; } + .pos_admin_widget_todos li svg { - margin-right: 10px; -} \ No newline at end of file + margin-right: 10px; +} diff --git a/package-lock.json b/package-lock.json index c4dad3a..963f21a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wp-personal-os", - "version": "0.3", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wp-personal-os", - "version": "0.3", + "version": "0.3.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/compose": "^6.27.0", @@ -21,8 +21,10 @@ "@wordpress/dependency-extraction-webpack-plugin": "^6.14.0", "@wordpress/env": "^9.2.0", "@wordpress/scripts": "^30.7.0", + "@wordpress/stylelint-config": "23.6.0", "eslint": "^8.56.0", - "prettier": "npm:wp-prettier@3.0.3" + "prettier": "npm:wp-prettier@3.0.3", + "stylelint": "16.12.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -1998,23 +2000,6 @@ "@csstools/css-tokenizer": "^3.0.3" } }, - "node_modules/@csstools/selector-specificity": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", - "integrity": "sha512-+OJ9konv95ClSTOJCmMZqpd5+YGsB2S+x6w3E1oaM8UuR5j8nTNHYSz8c9BEPGDOCMQYIEEGlVPj/VY64iTbGw==", - "dev": true, - "peer": true, - "engines": { - "node": "^14 || ^16 || >=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - }, - "peerDependencies": { - "postcss-selector-parser": "^6.0.10" - } - }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -3888,6 +3873,77 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@stylistic/stylelint-plugin": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@stylistic/stylelint-plugin/-/stylelint-plugin-3.1.3.tgz", + "integrity": "sha512-85fsmzgsIVmyG3/GFrjuYj6Cz8rAM7IZiPiXCMiSMfoDOC1lOrzrXPDk24WqviAghnPqGpx8b0caK2PuewWGFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-parser-algorithms": "^3.0.1", + "@csstools/css-tokenizer": "^3.0.1", + "@csstools/media-query-list-parser": "^3.0.1", + "is-plain-object": "^5.0.0", + "postcss": "^8.4.41", + "postcss-selector-parser": "^6.1.2", + "postcss-value-parser": "^4.2.0", + "style-search": "^0.1.0" + }, + "engines": { + "node": "^18.12 || >=20.9" + }, + "peerDependencies": { + "stylelint": "^16.8.0" + } + }, + "node_modules/@stylistic/stylelint-plugin/node_modules/@csstools/media-query-list-parser": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@csstools/media-query-list-parser/-/media-query-list-parser-3.0.1.tgz", + "integrity": "sha512-HNo8gGD02kHmcbX6PvCoUuOQvn4szyB9ca63vZHKX5A81QytgDG4oxG4IaEfHTlEZSZ6MjPEMWIVU+zF2PZcgw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.1", + "@csstools/css-tokenizer": "^3.0.1" + } + }, + "node_modules/@stylistic/stylelint-plugin/node_modules/is-plain-object": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.1.0.tgz", + "integrity": "sha512-bUi/yjmtKYcRVUtWRGr0UA6xEFh2I6zWUwMrUXB3s7bmYCaZ8a+0ZsTRkrawh/mzlSD1Y0Ph8bp/U+TvBpWDNw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@stylistic/stylelint-plugin/node_modules/postcss-selector-parser": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz", + "integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@svgr/babel-plugin-add-jsx-attribute": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", @@ -7226,28 +7282,6 @@ "react-dom": "^18.0.0" } }, - "node_modules/@wordpress/scripts/node_modules/@csstools/selector-specificity": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-5.0.0.tgz", - "integrity": "sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/csstools" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - } - ], - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "postcss-selector-parser": "^7.0.0" - } - }, "node_modules/@wordpress/scripts/node_modules/ajv": { "version": "8.17.1", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", @@ -7276,491 +7310,164 @@ "ajv": "^8.8.2" } }, - "node_modules/@wordpress/scripts/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "node_modules/@wordpress/scripts/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, - "node_modules/@wordpress/scripts/node_modules/balanced-match": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", - "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "node_modules/@wordpress/scripts/node_modules/json2php": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/json2php/-/json2php-0.0.9.tgz", + "integrity": "sha512-fQMYwvPsQt8hxRnCGyg1r2JVi6yL8Um0DIIawiKiMK9yhAAkcRNj5UsBWoaFvFzPpcWbgw9L6wzj+UMYA702Mw==", "dev": true }, - "node_modules/@wordpress/scripts/node_modules/cosmiconfig": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", - "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "node_modules/@wordpress/scripts/node_modules/schema-utils": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", + "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", "dev": true, "dependencies": { - "env-paths": "^2.2.1", - "import-fresh": "^3.3.0", - "js-yaml": "^4.1.0", - "parse-json": "^5.2.0" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" }, "engines": { - "node": ">=14" + "node": ">= 10.13.0" }, "funding": { - "url": "https://github.com/sponsors/d-fischer" - }, - "peerDependencies": { - "typescript": ">=4.9.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "node_modules/@wordpress/scripts/node_modules/css-tree": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.1.0.tgz", - "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", - "dev": true, + "node_modules/@wordpress/server-side-render": { + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@wordpress/server-side-render/-/server-side-render-4.27.1.tgz", + "integrity": "sha512-hovofyT0z75NSK/CSkkSbbTdkq9Afc1MKbEVGXTGpqq5sKOa7IAcxWjzmh8byTgT8x7GEaAyHZUr31p4l0CGnQ==", "dependencies": { - "mdn-data": "2.12.2", - "source-map-js": "^1.0.1" + "@babel/runtime": "^7.16.0", + "@wordpress/api-fetch": "^6.47.0", + "@wordpress/blocks": "^12.27.1", + "@wordpress/components": "^25.16.0", + "@wordpress/compose": "^6.27.0", + "@wordpress/data": "^9.20.0", + "@wordpress/deprecated": "^3.50.0", + "@wordpress/element": "^5.27.0", + "@wordpress/i18n": "^4.50.0", + "@wordpress/url": "^3.51.0", + "fast-deep-equal": "^3.1.3" }, "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + "node": ">=12" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" } }, - "node_modules/@wordpress/scripts/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, + "node_modules/@wordpress/shortcode": { + "version": "3.50.0", + "resolved": "https://registry.npmjs.org/@wordpress/shortcode/-/shortcode-3.50.0.tgz", + "integrity": "sha512-RnlqS2OsNUaI6VOLwyUiaL3trAJcWjtoiW21BjIXODbTkEreRJgBJnch7wdFpGimJmKIWBwRD8jQ4hdTND8xVw==", "dependencies": { - "ms": "^2.1.3" + "@babel/runtime": "^7.16.0", + "memize": "^2.0.1" }, "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=12" } }, - "node_modules/@wordpress/scripts/node_modules/file-entry-cache": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-9.1.0.tgz", - "integrity": "sha512-/pqPFG+FdxWQj+/WSuzXSDaNzxgTLr/OrR1QuqfEZzDakpdYE70PwUxL7BPUa8hpjbvY1+qvCl8k+8Tq34xJgg==", - "dev": true, + "node_modules/@wordpress/style-engine": { + "version": "1.33.1", + "resolved": "https://registry.npmjs.org/@wordpress/style-engine/-/style-engine-1.33.1.tgz", + "integrity": "sha512-mkur1jw3Trz76iwxU6DalTFsJyF5P/NTdU9xniMT8bo1H9HspgKrzqXAaxkTL9F9BXkyiYs+ctVekJYRUKlgcw==", "dependencies": { - "flat-cache": "^5.0.0" + "@babel/runtime": "^7.16.0", + "change-case": "^4.1.2" }, "engines": { - "node": ">=18" + "node": ">=12" } }, - "node_modules/@wordpress/scripts/node_modules/flat-cache": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-5.0.0.tgz", - "integrity": "sha512-JrqFmyUl2PnPi1OvLyTVHnQvwQ0S+e6lGSwu8OkAZlSaNIZciTY2H/cOOROxsBA1m/LZNHDsqAgDZt6akWcjsQ==", + "node_modules/@wordpress/stylelint-config": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/@wordpress/stylelint-config/-/stylelint-config-23.6.0.tgz", + "integrity": "sha512-vi0Uz/CFt3FHWpXpVFTulSWdHRa3WaiCo1qX58cG3Z31bs1bgqUT3pOpW/4pfLQACdYZS8YpOKRidbFSmfc6og==", "dev": true, + "license": "MIT", "dependencies": { - "flatted": "^3.3.1", - "keyv": "^4.5.4" + "@stylistic/stylelint-plugin": "^3.0.1", + "stylelint-config-recommended": "^14.0.1", + "stylelint-config-recommended-scss": "^14.1.0" }, "engines": { - "node": ">=18" + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "stylelint": "^16.8.2" } }, - "node_modules/@wordpress/scripts/node_modules/global-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", - "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", - "dev": true, + "node_modules/@wordpress/sync": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/sync/-/sync-0.12.0.tgz", + "integrity": "sha512-45gU1Gu/ys3zqYO4dDQf6eG5gGgJK9nXa62IUtUWFXIH4FN29XlvGppMVK/zzhJwejF/XnDuT7mQuVEFCZGswA==", "dependencies": { - "global-prefix": "^3.0.0" + "@babel/runtime": "^7.16.0", + "@types/simple-peer": "^9.11.5", + "@wordpress/url": "^3.51.0", + "import-locals": "^2.0.0", + "lib0": "^0.2.42", + "simple-peer": "^9.11.0", + "y-indexeddb": "~9.0.11", + "y-protocols": "^1.0.5", + "y-webrtc": "~10.2.5", + "yjs": "~13.6.6" }, "engines": { - "node": ">=6" + "node": ">=12" } }, - "node_modules/@wordpress/scripts/node_modules/global-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", - "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", - "dev": true, + "node_modules/@wordpress/token-list": { + "version": "2.50.0", + "resolved": "https://registry.npmjs.org/@wordpress/token-list/-/token-list-2.50.0.tgz", + "integrity": "sha512-LTjXkoljQpJIHqs0isTUzIc1fMu68y0N9HcDIdsCMGkmKptWUCETtb+DItnraxDDLuyWNuTYf840S83a3XAVRA==", "dependencies": { - "ini": "^1.3.5", - "kind-of": "^6.0.2", - "which": "^1.3.1" + "@babel/runtime": "^7.16.0" }, "engines": { - "node": ">=6" + "node": ">=12" } }, - "node_modules/@wordpress/scripts/node_modules/ignore": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-6.0.2.tgz", - "integrity": "sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A==", - "dev": true, + "node_modules/@wordpress/undo-manager": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@wordpress/undo-manager/-/undo-manager-0.10.0.tgz", + "integrity": "sha512-ODDqAL6BSvD+J7FV+sQTAaVHiPChh/4KBnKg8pb2ogg+Weq6VynthxDxGpQnN8FcMKB9ZoyS3SNIl8pVXLKIwA==", + "dependencies": { + "@babel/runtime": "^7.16.0", + "@wordpress/is-shallow-equal": "^4.50.0" + }, "engines": { - "node": ">= 4" + "node": ">=12" } }, - "node_modules/@wordpress/scripts/node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true, + "node_modules/@wordpress/url": { + "version": "3.51.0", + "resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.51.0.tgz", + "integrity": "sha512-OjucjlP1763gfKbe8lv/k3RCisyX8AfNBrhASk7JqxAj6rFhb1ZZO7YmAgB2m+WoGB5v7fkOli0FZyDqISdYyg==", + "dependencies": { + "@babel/runtime": "^7.16.0", + "remove-accents": "^0.5.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=12" } }, - "node_modules/@wordpress/scripts/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@wordpress/scripts/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/@wordpress/scripts/node_modules/json2php": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/json2php/-/json2php-0.0.9.tgz", - "integrity": "sha512-fQMYwvPsQt8hxRnCGyg1r2JVi6yL8Um0DIIawiKiMK9yhAAkcRNj5UsBWoaFvFzPpcWbgw9L6wzj+UMYA702Mw==", - "dev": true - }, - "node_modules/@wordpress/scripts/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@wordpress/scripts/node_modules/known-css-properties": { - "version": "0.35.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.35.0.tgz", - "integrity": "sha512-a/RAk2BfKk+WFGhhOCAYqSiFLc34k8Mt/6NWRI4joER0EYUzXIcFivjjnoD3+XU1DggLn/tZc3DOAgke7l8a4A==", - "dev": true - }, - "node_modules/@wordpress/scripts/node_modules/mdn-data": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.2.tgz", - "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==", - "dev": true - }, - "node_modules/@wordpress/scripts/node_modules/meow": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", - "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wordpress/scripts/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/@wordpress/scripts/node_modules/postcss-safe-parser": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-7.0.1.tgz", - "integrity": "sha512-0AioNCJZ2DPYz5ABT6bddIqlhgwhpHZ/l65YAYo0BCIn0xiDpsnTHz0gnoTGk0OXZW0JRs+cDwL8u/teRdz+8A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss-safe-parser" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "engines": { - "node": ">=18.0" - }, - "peerDependencies": { - "postcss": "^8.4.31" - } - }, - "node_modules/@wordpress/scripts/node_modules/postcss-selector-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.0.0.tgz", - "integrity": "sha512-9RbEr1Y7FFfptd/1eEdntyjMwLeghW1bHX9GWjXo19vx4ytPQhANltvVxDggzJl7mnWM+dX28kb6cyS/4iQjlQ==", - "dev": true, - "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@wordpress/scripts/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/@wordpress/scripts/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@wordpress/scripts/node_modules/stylelint": { - "version": "16.12.0", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.12.0.tgz", - "integrity": "sha512-F8zZ3L/rBpuoBZRvI4JVT20ZanPLXfQLzMOZg1tzPflRVh9mKpOZ8qcSIhh1my3FjAjZWG4T2POwGnmn6a6hbg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/stylelint" - }, - { - "type": "github", - "url": "https://github.com/sponsors/stylelint" - } - ], - "dependencies": { - "@csstools/css-parser-algorithms": "^3.0.4", - "@csstools/css-tokenizer": "^3.0.3", - "@csstools/media-query-list-parser": "^4.0.2", - "@csstools/selector-specificity": "^5.0.0", - "@dual-bundle/import-meta-resolve": "^4.1.0", - "balanced-match": "^2.0.0", - "colord": "^2.9.3", - "cosmiconfig": "^9.0.0", - "css-functions-list": "^3.2.3", - "css-tree": "^3.0.1", - "debug": "^4.3.7", - "fast-glob": "^3.3.2", - "fastest-levenshtein": "^1.0.16", - "file-entry-cache": "^9.1.0", - "global-modules": "^2.0.0", - "globby": "^11.1.0", - "globjoin": "^0.1.4", - "html-tags": "^3.3.1", - "ignore": "^6.0.2", - "imurmurhash": "^0.1.4", - "is-plain-object": "^5.0.0", - "known-css-properties": "^0.35.0", - "mathml-tag-names": "^2.1.3", - "meow": "^13.2.0", - "micromatch": "^4.0.8", - "normalize-path": "^3.0.0", - "picocolors": "^1.1.1", - "postcss": "^8.4.49", - "postcss-resolve-nested-selector": "^0.1.6", - "postcss-safe-parser": "^7.0.1", - "postcss-selector-parser": "^7.0.0", - "postcss-value-parser": "^4.2.0", - "resolve-from": "^5.0.0", - "string-width": "^4.2.3", - "supports-hyperlinks": "^3.1.0", - "svg-tags": "^1.0.0", - "table": "^6.9.0", - "write-file-atomic": "^5.0.1" - }, - "bin": { - "stylelint": "bin/stylelint.mjs" - }, - "engines": { - "node": ">=18.12.0" - } - }, - "node_modules/@wordpress/scripts/node_modules/supports-hyperlinks": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.1.0.tgz", - "integrity": "sha512-2rn0BZ+/f7puLOHZm1HOJfwBggfaHXUpPUSSG/SWM4TWp5KCfmNYwnC3hruy2rZlMnmWZ+QAGpZfchu3f3695A==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wordpress/scripts/node_modules/write-file-atomic": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", - "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/@wordpress/server-side-render": { - "version": "4.27.1", - "resolved": "https://registry.npmjs.org/@wordpress/server-side-render/-/server-side-render-4.27.1.tgz", - "integrity": "sha512-hovofyT0z75NSK/CSkkSbbTdkq9Afc1MKbEVGXTGpqq5sKOa7IAcxWjzmh8byTgT8x7GEaAyHZUr31p4l0CGnQ==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/api-fetch": "^6.47.0", - "@wordpress/blocks": "^12.27.1", - "@wordpress/components": "^25.16.0", - "@wordpress/compose": "^6.27.0", - "@wordpress/data": "^9.20.0", - "@wordpress/deprecated": "^3.50.0", - "@wordpress/element": "^5.27.0", - "@wordpress/i18n": "^4.50.0", - "@wordpress/url": "^3.51.0", - "fast-deep-equal": "^3.1.3" - }, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^18.0.0", - "react-dom": "^18.0.0" - } - }, - "node_modules/@wordpress/shortcode": { - "version": "3.50.0", - "resolved": "https://registry.npmjs.org/@wordpress/shortcode/-/shortcode-3.50.0.tgz", - "integrity": "sha512-RnlqS2OsNUaI6VOLwyUiaL3trAJcWjtoiW21BjIXODbTkEreRJgBJnch7wdFpGimJmKIWBwRD8jQ4hdTND8xVw==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "memize": "^2.0.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/style-engine": { - "version": "1.33.1", - "resolved": "https://registry.npmjs.org/@wordpress/style-engine/-/style-engine-1.33.1.tgz", - "integrity": "sha512-mkur1jw3Trz76iwxU6DalTFsJyF5P/NTdU9xniMT8bo1H9HspgKrzqXAaxkTL9F9BXkyiYs+ctVekJYRUKlgcw==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "change-case": "^4.1.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/stylelint-config": { - "version": "21.33.0", - "resolved": "https://registry.npmjs.org/@wordpress/stylelint-config/-/stylelint-config-21.33.0.tgz", - "integrity": "sha512-DwjXrjRBva0tkYILvDV7rjl3VaKXxvchlxnFfFs6l2DWL/Qo31CJ+f2rVw4XSWuuWxY1EsyIn9tOBS9URloWTQ==", - "dev": true, - "dependencies": { - "stylelint-config-recommended": "^6.0.0", - "stylelint-config-recommended-scss": "^5.0.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "stylelint": "^14.2" - } - }, - "node_modules/@wordpress/sync": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/sync/-/sync-0.12.0.tgz", - "integrity": "sha512-45gU1Gu/ys3zqYO4dDQf6eG5gGgJK9nXa62IUtUWFXIH4FN29XlvGppMVK/zzhJwejF/XnDuT7mQuVEFCZGswA==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@types/simple-peer": "^9.11.5", - "@wordpress/url": "^3.51.0", - "import-locals": "^2.0.0", - "lib0": "^0.2.42", - "simple-peer": "^9.11.0", - "y-indexeddb": "~9.0.11", - "y-protocols": "^1.0.5", - "y-webrtc": "~10.2.5", - "yjs": "~13.6.6" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/token-list": { - "version": "2.50.0", - "resolved": "https://registry.npmjs.org/@wordpress/token-list/-/token-list-2.50.0.tgz", - "integrity": "sha512-LTjXkoljQpJIHqs0isTUzIc1fMu68y0N9HcDIdsCMGkmKptWUCETtb+DItnraxDDLuyWNuTYf840S83a3XAVRA==", - "dependencies": { - "@babel/runtime": "^7.16.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/undo-manager": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/undo-manager/-/undo-manager-0.10.0.tgz", - "integrity": "sha512-ODDqAL6BSvD+J7FV+sQTAaVHiPChh/4KBnKg8pb2ogg+Weq6VynthxDxGpQnN8FcMKB9ZoyS3SNIl8pVXLKIwA==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/is-shallow-equal": "^4.50.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/url": { - "version": "3.51.0", - "resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.51.0.tgz", - "integrity": "sha512-OjucjlP1763gfKbe8lv/k3RCisyX8AfNBrhASk7JqxAj6rFhb1ZZO7YmAgB2m+WoGB5v7fkOli0FZyDqISdYyg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "remove-accents": "^0.5.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/viewport": { - "version": "5.27.0", - "resolved": "https://registry.npmjs.org/@wordpress/viewport/-/viewport-5.27.0.tgz", - "integrity": "sha512-ET8X3Ln0K6wrBba+u0AjBD/mP02SuvwhK/EVaI3uAhNlGnkx+J3PdtShbu63lHmp0SG+J27CDjEqfcZ6CdAnfA==", + "node_modules/@wordpress/viewport": { + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/@wordpress/viewport/-/viewport-5.27.0.tgz", + "integrity": "sha512-ET8X3Ln0K6wrBba+u0AjBD/mP02SuvwhK/EVaI3uAhNlGnkx+J3PdtShbu63lHmp0SG+J27CDjEqfcZ6CdAnfA==", "dependencies": { "@babel/runtime": "^7.16.0", "@wordpress/compose": "^6.27.0", @@ -13910,16 +13617,6 @@ "node": ">=4" } }, - "node_modules/import-lazy": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", - "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -15650,11 +15347,11 @@ } }, "node_modules/known-css-properties": { - "version": "0.26.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", - "integrity": "sha512-5FZRzrZzNTBruuurWpvZnvP9pum+fe0HcK8z/ooo+U+Hmp4vtbyp1/QDsqmufirXy4egGzbaH/y2uCZf+6W5Kg==", + "version": "0.35.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.35.0.tgz", + "integrity": "sha512-a/RAk2BfKk+WFGhhOCAYqSiFLc34k8Mt/6NWRI4joER0EYUzXIcFivjjnoD3+XU1DggLn/tZc3DOAgke7l8a4A==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/language-subtag-registry": { "version": "0.3.22", @@ -18458,20 +18155,30 @@ "dev": true }, "node_modules/postcss-safe-parser": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", - "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-7.1.0.tgz", + "integrity": "sha512-1WzZxRLaAFwEh6Do+zyGpjWV3nGJNxxhuh7Ubu/q1ICImMgZJnLwhoaEpRbG4pJppp2Y1ncL9ffA2f+LhrefQg==", "dev": true, - "peer": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss-safe-parser" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", "engines": { - "node": ">=12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" + "node": ">=18.0" }, "peerDependencies": { - "postcss": "^8.3.3" + "postcss": "^8.4.31" } }, "node_modules/postcss-scss": { @@ -20979,158 +20686,353 @@ "escape-string-regexp": "^1.0.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/style-search": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", + "integrity": "sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==", + "dev": true + }, + "node_modules/stylehacks": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.2.tgz", + "integrity": "sha512-00zvJGnCu64EpMjX8b5iCZ3us2Ptyw8+toEkb92VdmkEaRaSGBNKAoK6aWZckhXxmQP8zWiTaFaiMGIU8Ve8sg==", + "dev": true, + "dependencies": { + "browserslist": "^4.22.2", + "postcss-selector-parser": "^6.0.15" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.4.31" + } + }, + "node_modules/stylelint": { + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.12.0.tgz", + "integrity": "sha512-F8zZ3L/rBpuoBZRvI4JVT20ZanPLXfQLzMOZg1tzPflRVh9mKpOZ8qcSIhh1my3FjAjZWG4T2POwGnmn6a6hbg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/stylelint" + }, + { + "type": "github", + "url": "https://github.com/sponsors/stylelint" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "@csstools/media-query-list-parser": "^4.0.2", + "@csstools/selector-specificity": "^5.0.0", + "@dual-bundle/import-meta-resolve": "^4.1.0", + "balanced-match": "^2.0.0", + "colord": "^2.9.3", + "cosmiconfig": "^9.0.0", + "css-functions-list": "^3.2.3", + "css-tree": "^3.0.1", + "debug": "^4.3.7", + "fast-glob": "^3.3.2", + "fastest-levenshtein": "^1.0.16", + "file-entry-cache": "^9.1.0", + "global-modules": "^2.0.0", + "globby": "^11.1.0", + "globjoin": "^0.1.4", + "html-tags": "^3.3.1", + "ignore": "^6.0.2", + "imurmurhash": "^0.1.4", + "is-plain-object": "^5.0.0", + "known-css-properties": "^0.35.0", + "mathml-tag-names": "^2.1.3", + "meow": "^13.2.0", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "picocolors": "^1.1.1", + "postcss": "^8.4.49", + "postcss-resolve-nested-selector": "^0.1.6", + "postcss-safe-parser": "^7.0.1", + "postcss-selector-parser": "^7.0.0", + "postcss-value-parser": "^4.2.0", + "resolve-from": "^5.0.0", + "string-width": "^4.2.3", + "supports-hyperlinks": "^3.1.0", + "svg-tags": "^1.0.0", + "table": "^6.9.0", + "write-file-atomic": "^5.0.1" + }, + "bin": { + "stylelint": "bin/stylelint.mjs" + }, + "engines": { + "node": ">=18.12.0" + } + }, + "node_modules/stylelint-config-recommended": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-14.0.1.tgz", + "integrity": "sha512-bLvc1WOz/14aPImu/cufKAZYfXs/A/owZfSMZ4N+16WGXLoX5lOir53M6odBxvhgmgdxCVnNySJmZKx73T93cg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/stylelint" + }, + { + "type": "github", + "url": "https://github.com/sponsors/stylelint" + } + ], + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "stylelint": "^16.1.0" + } + }, + "node_modules/stylelint-config-recommended-scss": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-14.1.0.tgz", + "integrity": "sha512-bhaMhh1u5dQqSsf6ri2GVWWQW5iUjBYgcHkh7SgDDn92ijoItC/cfO/W+fpXshgTQWhwFkP1rVcewcv4jaftRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-scss": "^4.0.9", + "stylelint-config-recommended": "^14.0.1", + "stylelint-scss": "^6.4.0" + }, + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "postcss": "^8.3.3", + "stylelint": "^16.6.1" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + } + } + }, + "node_modules/stylelint-scss": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-6.14.0.tgz", + "integrity": "sha512-ZKmHMZolxeuYsnB+PCYrTpFce0/QWX9i9gh0hPXzp73WjuIMqUpzdQaBCrKoLWh6XtCFSaNDErkMPqdjy1/8aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.1", + "is-plain-object": "^5.0.0", + "known-css-properties": "^0.37.0", + "mdn-data": "^2.25.0", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.6", + "postcss-selector-parser": "^7.1.1", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "stylelint": "^16.8.2" + } + }, + "node_modules/stylelint-scss/node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, - "node_modules/strip-outer/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "node_modules/stylelint-scss/node_modules/css-tree/node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/stylelint-scss/node_modules/is-plain-object": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.1.0.tgz", + "integrity": "sha512-bUi/yjmtKYcRVUtWRGr0UA6xEFh2I6zWUwMrUXB3s7bmYCaZ8a+0ZsTRkrawh/mzlSD1Y0Ph8bp/U+TvBpWDNw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.8.0" + "node": ">=0.10.0" } }, - "node_modules/style-search": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", - "integrity": "sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==", + "node_modules/stylelint-scss/node_modules/known-css-properties": { + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.37.0.tgz", + "integrity": "sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==", "dev": true, - "peer": true + "license": "MIT" }, - "node_modules/stylehacks": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.2.tgz", - "integrity": "sha512-00zvJGnCu64EpMjX8b5iCZ3us2Ptyw8+toEkb92VdmkEaRaSGBNKAoK6aWZckhXxmQP8zWiTaFaiMGIU8Ve8sg==", + "node_modules/stylelint-scss/node_modules/mdn-data": { + "version": "2.35.0", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.35.0.tgz", + "integrity": "sha512-k+1+dEIm2z/BEfdvYzT/fIyAGeDBo/1AJNJI4ilFXJRYoxP/3Ds+GP8shAOIq8jYXY9N5nGB3Ag104NsagmLAA==", "dev": true, + "license": "CC0-1.0" + }, + "node_modules/stylelint-scss/node_modules/postcss-selector-parser": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.6.tgz", + "integrity": "sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw==", + "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.22.2", - "postcss-selector-parser": "^6.0.15" + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" }, "engines": { - "node": "^14 || ^16 || >=18.0" + "node": ">=4" + } + }, + "node_modules/stylelint/node_modules/@csstools/selector-specificity": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-5.0.0.tgz", + "integrity": "sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=18" }, "peerDependencies": { - "postcss": "^8.4.31" + "postcss-selector-parser": "^7.0.0" } }, - "node_modules/stylelint": { - "version": "14.16.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", - "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", + "node_modules/stylelint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "peer": true, + "license": "Python-2.0" + }, + "node_modules/stylelint/node_modules/balanced-match": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", + "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "dev": true, + "license": "MIT" + }, + "node_modules/stylelint/node_modules/cosmiconfig": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.2.tgz", + "integrity": "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg==", + "dev": true, + "license": "MIT", "dependencies": { - "@csstools/selector-specificity": "^2.0.2", - "balanced-match": "^2.0.0", - "colord": "^2.9.3", - "cosmiconfig": "^7.1.0", - "css-functions-list": "^3.1.0", - "debug": "^4.3.4", - "fast-glob": "^3.2.12", - "fastest-levenshtein": "^1.0.16", - "file-entry-cache": "^6.0.1", - "global-modules": "^2.0.0", - "globby": "^11.1.0", - "globjoin": "^0.1.4", - "html-tags": "^3.2.0", - "ignore": "^5.2.1", - "import-lazy": "^4.0.0", - "imurmurhash": "^0.1.4", - "is-plain-object": "^5.0.0", - "known-css-properties": "^0.26.0", - "mathml-tag-names": "^2.1.3", - "meow": "^9.0.0", - "micromatch": "^4.0.5", - "normalize-path": "^3.0.0", - "picocolors": "^1.0.0", - "postcss": "^8.4.19", - "postcss-media-query-parser": "^0.2.3", - "postcss-resolve-nested-selector": "^0.1.1", - "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.11", - "postcss-value-parser": "^4.2.0", - "resolve-from": "^5.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "style-search": "^0.1.0", - "supports-hyperlinks": "^2.3.0", - "svg-tags": "^1.0.0", - "table": "^6.8.1", - "v8-compile-cache": "^2.3.0", - "write-file-atomic": "^4.0.2" - }, - "bin": { - "stylelint": "bin/stylelint.js" + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=14" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/stylelint" - } - }, - "node_modules/stylelint-config-recommended": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-6.0.0.tgz", - "integrity": "sha512-ZorSSdyMcxWpROYUvLEMm0vSZud2uB7tX1hzBZwvVY9SV/uly4AvvJPPhCcymZL3fcQhEQG5AELmrxWqtmzacw==", - "dev": true, + "url": "https://github.com/sponsors/d-fischer" + }, "peerDependencies": { - "stylelint": "^14.0.0" + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/stylelint-config-recommended-scss": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-5.0.2.tgz", - "integrity": "sha512-b14BSZjcwW0hqbzm9b0S/ScN2+3CO3O4vcMNOw2KGf8lfVSwJ4p5TbNEXKwKl1+0FMtgRXZj6DqVUe/7nGnuBg==", + "node_modules/stylelint/node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", "dev": true, + "license": "MIT", "dependencies": { - "postcss-scss": "^4.0.2", - "stylelint-config-recommended": "^6.0.0", - "stylelint-scss": "^4.0.0" + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" }, - "peerDependencies": { - "stylelint": "^14.0.0" + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, - "node_modules/stylelint-scss": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.7.0.tgz", - "integrity": "sha512-TSUgIeS0H3jqDZnby1UO1Qv3poi1N8wUYIJY6D1tuUq2MN3lwp/rITVo0wD+1SWTmRm0tNmGO0b7nKInnqF6Hg==", + "node_modules/stylelint/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, + "license": "MIT", "dependencies": { - "postcss-media-query-parser": "^0.2.3", - "postcss-resolve-nested-selector": "^0.1.1", - "postcss-selector-parser": "^6.0.11", - "postcss-value-parser": "^4.2.0" + "ms": "^2.1.3" }, - "peerDependencies": { - "stylelint": "^14.5.1 || ^15.0.0" + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/stylelint/node_modules/balanced-match": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", - "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "node_modules/stylelint/node_modules/file-entry-cache": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-9.1.0.tgz", + "integrity": "sha512-/pqPFG+FdxWQj+/WSuzXSDaNzxgTLr/OrR1QuqfEZzDakpdYE70PwUxL7BPUa8hpjbvY1+qvCl8k+8Tq34xJgg==", "dev": true, - "peer": true + "license": "MIT", + "dependencies": { + "flat-cache": "^5.0.0" + }, + "engines": { + "node": ">=18" + } }, - "node_modules/stylelint/node_modules/cosmiconfig": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "node_modules/stylelint/node_modules/flat-cache": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-5.0.0.tgz", + "integrity": "sha512-JrqFmyUl2PnPi1OvLyTVHnQvwQ0S+e6lGSwu8OkAZlSaNIZciTY2H/cOOROxsBA1m/LZNHDsqAgDZt6akWcjsQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "flatted": "^3.3.1", + "keyv": "^4.5.4" }, "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/stylelint/node_modules/global-modules": { @@ -21138,7 +21040,7 @@ "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "global-prefix": "^3.0.0" }, @@ -21151,7 +21053,7 @@ "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "ini": "^1.3.5", "kind-of": "^6.0.2", @@ -21161,26 +21063,144 @@ "node": ">=6" } }, + "node_modules/stylelint/node_modules/ignore": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-6.0.2.tgz", + "integrity": "sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/stylelint/node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.1.0.tgz", + "integrity": "sha512-bUi/yjmtKYcRVUtWRGr0UA6xEFh2I6zWUwMrUXB3s7bmYCaZ8a+0ZsTRkrawh/mzlSD1Y0Ph8bp/U+TvBpWDNw==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, + "node_modules/stylelint/node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/stylelint/node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, + "node_modules/stylelint/node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/stylelint/node_modules/meow": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", + "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stylelint/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/stylelint/node_modules/postcss-selector-parser": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.6.tgz", + "integrity": "sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/stylelint/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/stylelint/node_modules/supports-hyperlinks": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz", + "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=14.18" + }, + "funding": { + "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1" + } + }, + "node_modules/stylelint/node_modules/write-file-atomic": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/stylis": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", @@ -22196,13 +22216,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/v8-compile-cache": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", - "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", - "dev": true, - "peer": true - }, "node_modules/v8-to-istanbul": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", diff --git a/package.json b/package.json index 411f342..a84c5b5 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,9 @@ "wp-env:ai-chat": "wp-env start --config .wp-env.personal-ai-chat.json", "dev": "wp-scripts start", "test:unit:backend": "wp-env run tests-cli --env-cwd=wp-content/personalos-tests ./vendor/bin/phpunit --testsuite=unit", - "test:integration:backend": "wp-env run tests-cli --env-cwd=wp-content/personalos-tests ./vendor/bin/phpunit --testsuite=integration" + "test:integration:backend": "wp-env run tests-cli --env-cwd=wp-content/personalos-tests ./vendor/bin/phpunit --testsuite=integration", + "wp-env:stuff": "wp-env start --config .wp-env.personal-stuff.json", + "test:unit:stuff": "wp-scripts test-unit-js --runInBand --testEnvironmentOptions='{\"customExportConditions\":[\"node\",\"node-addons\"]}' packages/personal-stuff/src/test" }, "dependencies": { "@wordpress/compose": "^6.27.0", @@ -49,7 +51,9 @@ "@wordpress/dependency-extraction-webpack-plugin": "^6.14.0", "@wordpress/env": "^9.2.0", "@wordpress/scripts": "^30.7.0", + "@wordpress/stylelint-config": "23.6.0", "eslint": "^8.56.0", - "prettier": "npm:wp-prettier@3.0.3" + "prettier": "npm:wp-prettier@3.0.3", + "stylelint": "16.12.0" } } diff --git a/packages/personal-ai-chat/src/blocks/message/index.css b/packages/personal-ai-chat/src/blocks/message/index.css index 6b5c2d5..c9d0ccf 100644 --- a/packages/personal-ai-chat/src/blocks/message/index.css +++ b/packages/personal-ai-chat/src/blocks/message/index.css @@ -78,6 +78,7 @@ .wp-block-pos-ai-message .markdown-content { word-wrap: break-word; overflow-wrap: break-word; + cursor: text; } .wp-block-pos-ai-message .markdown-content h1, @@ -91,24 +92,15 @@ line-height: 1.3; } -.wp-block-pos-ai-message .markdown-content h1:first-child, -.wp-block-pos-ai-message .markdown-content h2:first-child, -.wp-block-pos-ai-message .markdown-content h3:first-child, -.wp-block-pos-ai-message .markdown-content h4:first-child, -.wp-block-pos-ai-message .markdown-content h5:first-child, -.wp-block-pos-ai-message .markdown-content h6:first-child { - margin-top: 0; -} - .wp-block-pos-ai-message .markdown-content h1 { font-size: 1.5em; - border-bottom: 2px solid currentColor; + border-bottom: 2px solid currentcolor; padding-bottom: 4px; } .wp-block-pos-ai-message .markdown-content h2 { font-size: 1.3em; - border-bottom: 1px solid currentColor; + border-bottom: 1px solid currentcolor; padding-bottom: 2px; } @@ -125,6 +117,15 @@ font-size: 1em; } +.wp-block-pos-ai-message .markdown-content h1:first-child, +.wp-block-pos-ai-message .markdown-content h2:first-child, +.wp-block-pos-ai-message .markdown-content h3:first-child, +.wp-block-pos-ai-message .markdown-content h4:first-child, +.wp-block-pos-ai-message .markdown-content h5:first-child, +.wp-block-pos-ai-message .markdown-content h6:first-child { + margin-top: 0; +} + .wp-block-pos-ai-message .markdown-content ul, .wp-block-pos-ai-message .markdown-content ol { margin: 12px 0; @@ -180,7 +181,7 @@ background: rgba(0, 0, 0, 0.1); padding: 2px 6px; border-radius: 4px; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; font-size: 0.85em; border: 1px solid rgba(0, 0, 0, 0.05); } @@ -193,7 +194,7 @@ padding: 16px; margin: 16px 0; overflow-x: auto; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; font-size: 0.85em; line-height: 1.5; white-space: pre; @@ -232,7 +233,7 @@ } .wp-block-pos-ai-message .markdown-content blockquote { - border-left: 4px solid currentColor; + border-left: 4px solid currentcolor; margin: 16px 0; padding-left: 16px; font-style: italic; @@ -286,12 +287,12 @@ .wp-block-pos-ai-message.message-role-user .message-role-icon { background: #3b82f6; - color: white; + color: #fff; } .wp-block-pos-ai-message.message-role-user .message-content { background: #3b82f6; - color: white; + color: #fff; border-color: #2563eb; margin-left: 32px; } @@ -334,7 +335,7 @@ .wp-block-pos-ai-message.message-role-assistant .message-role-icon { background: #10b981; - color: white; + color: #fff; } .wp-block-pos-ai-message.message-role-assistant .message-content { @@ -369,7 +370,7 @@ .wp-block-pos-ai-message.message-role-system .message-role-icon { background: #f59e0b; - color: white; + color: #fff; } .wp-block-pos-ai-message.message-role-system .message-content { @@ -404,6 +405,10 @@ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); } +.wp-block-pos-ai-message.is-selected .message-content { + transform: translateY(-1px); +} + .wp-block-pos-ai-message.message-role-user:hover .message-content { box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3); } @@ -417,9 +422,6 @@ } /* Selected state */ -.wp-block-pos-ai-message.is-selected .message-content { - transform: translateY(-1px); -} .wp-block-pos-ai-message.is-selected.message-role-user .message-content { box-shadow: 0 0 0 2px #3b82f6, 0 4px 12px rgba(59, 130, 246, 0.4); @@ -435,15 +437,16 @@ /* Mobile responsiveness */ @media (max-width: 768px) { + .wp-block-pos-ai-message { margin: 12px 0; } - + .wp-block-pos-ai-message .message-content { padding: 10px 14px; font-size: 13px; } - + .wp-block-pos-ai-message.message-role-user .message-content { margin-left: 24px; } @@ -486,7 +489,7 @@ padding: 0; border: none; background: transparent; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; font-size: 13px; line-height: 1.6; color: inherit; @@ -500,12 +503,9 @@ } /* Click-to-edit hint */ -.wp-block-pos-ai-message .markdown-content { - cursor: text; -} .wp-block-pos-ai-message.is-selected .markdown-content:not(:has(textarea))::after { - content: 'Click to edit'; + content: "Click to edit"; position: absolute; bottom: 8px; right: 12px; @@ -513,4 +513,4 @@ opacity: 0.4; font-style: italic; pointer-events: none; -} \ No newline at end of file +} diff --git a/packages/personal-ai-chat/src/style.css b/packages/personal-ai-chat/src/style.css index e624288..9e66f55 100644 --- a/packages/personal-ai-chat/src/style.css +++ b/packages/personal-ai-chat/src/style.css @@ -115,6 +115,7 @@ body.personal-ai-chat-js .personal-ai-chat-admin-fallback { } @media (max-width: 900px) { + .personal-ai-chat-admin__layout { grid-template-columns: 1fr; } diff --git a/packages/personal-notes/src/blocks/note/index.css b/packages/personal-notes/src/blocks/note/index.css index 0c29903..1e003ac 100644 --- a/packages/personal-notes/src/blocks/note/index.css +++ b/packages/personal-notes/src/blocks/note/index.css @@ -1,17 +1,17 @@ .wp-block-pos-note { - background-color: #f3f3f3; - border-radius: 0.5em; + background-color: #f3f3f3; + border-radius: 0.5em; } .wp-block-pos-note__title { - font-size: .75em; - margin: 0; - padding: 0.5em; - font-style: oblique; - border: 1px solid #c0c6c9; - border-radius: 0.5em; + font-size: 0.75em; + margin: 0; + padding: 0.5em; + font-style: oblique; + border: 1px solid #c0c6c9; + border-radius: 0.5em; } .block-editor-block-list__layout { - padding: 0 .5em .5em .5em; -} \ No newline at end of file + padding: 0 0.5em 0.5em 0.5em; +} diff --git a/packages/personal-notes/src/style.css b/packages/personal-notes/src/style.css index 15f995d..747c777 100644 --- a/packages/personal-notes/src/style.css +++ b/packages/personal-notes/src/style.css @@ -25,6 +25,7 @@ body.personal-notes-js .personal-notes-admin-fallback { } @media (max-width: 782px) { + .personal-notes-admin { margin-right: 10px; } diff --git a/packages/personal-readwise-sync/src/blocks/readwise/index.css b/packages/personal-readwise-sync/src/blocks/readwise/index.css index 470da4b..fe967e7 100644 --- a/packages/personal-readwise-sync/src/blocks/readwise/index.css +++ b/packages/personal-readwise-sync/src/blocks/readwise/index.css @@ -1,6 +1,6 @@ .wp-block-pos-readwise { - background-color: rgb(255, 255, 255); - border-radius: 20px; - padding: 20px; - font-style: oblique; + background-color: rgb(255, 255, 255); + border-radius: 20px; + padding: 20px; + font-style: oblique; } diff --git a/packages/personal-stuff/LICENSE b/packages/personal-stuff/LICENSE new file mode 100644 index 0000000..f0d1307 --- /dev/null +++ b/packages/personal-stuff/LICENSE @@ -0,0 +1,7 @@ +Personal Notes is licensed under GPL-2.0-or-later. + +You may redistribute and/or modify it under the terms of the GNU General Public +License as published by the Free Software Foundation, either version 2 of the +License, or any later version. + +The license text is available at https://www.gnu.org/licenses/gpl-2.0.html. diff --git a/packages/personal-stuff/TECHNICAL.md b/packages/personal-stuff/TECHNICAL.md new file mode 100644 index 0000000..9678061 --- /dev/null +++ b/packages/personal-stuff/TECHNICAL.md @@ -0,0 +1,92 @@ +# Personal Stuff + +Personal Stuff is a JS inventory app over native WordPress Knowledge, Knowledge Type, and Media endpoints. PHP provisions vocabulary, exposes the WpApp, enables the item editor, and scopes filename randomization. It registers no REST routes, abilities, custom post types, taxonomies, post/term meta, settings, or tables. + +## Canonical representation + +| Value | Stored representation | +| --- | --- | +| Item | One `wp_knowledge` post; private on creation, current author | +| Identity | Native post ID; existing WordPress slug is untouched | +| Name | `post_title` | +| Description and photos | `post_content`, serialized Gutenberg blocks | +| Identity terms | `artifact` and `stuff-item` in `wp_knowledge_type` | +| Physical place | Zero or one descendant term of `stuff-places` assigned to the item | +| Tags | Descendant terms of `stuff-tags` assigned to the item | +| Place or tag | Raw term `name`, `slug`, `parent`, `description` | +| Media | Native attachment post, file, and WordPress attachment metadata | + +``` +artifact +stuff + stuff-item + stuff-places + Home + Garage + Blue box + stuff-tags + Travel +``` + +The five fixed terms are resolved by slug. Activation creates missing terms if Knowledge is available. Each later `init` checks actual terms so deferred availability needs no installed flag. Only fixed Stuff term parents are normalized; existing labels/descriptions and user branches are retained. Dynamic place/tag CRUD uses core taxonomy REST. + +The app assigns the leaf identity, physical location and tags, preserving unrelated Knowledge Types. It never assigns structural roots itself. Native Gutenberg's raw taxonomy panel remains unrestricted. If another editor assigns multiple physical places, Stuff displays them and its editor warns that saving chooses the selected place. No quantity, linked place post, term content ID, place gallery, or custom Stuff metadata exists. + +Derived in memory: breadcrumbs, descendants, cover, photo count, search index, filtered collection, previous/next order. Filters and item selection are URL query parameters (`q`, `place`, `tag`, `photo`, `item`); place/tag filter values are slugs. DataViews layout and paging stay in memory. There is no localStorage database, service worker or offline write queue. + +## Content and editing + +Core paragraphs, images and galleries are the only native structures needed. Gallery children and document block order define photo order; the first image is the cover. Captions, alt text, image links, gallery layout and any other blocks live in their ordinary block attributes/HTML. + +The app uses `BlockEditorProvider`, `BlockList`, native block settings, the core Media Library, and `@wordpress/blocks` parsing/serialization. Unavailable custom blocks retain Gutenberg's original-content representation; users can open the full editor for plugin-specific controls. A title/place/tag edit does not send `content` when it has not changed. Content edits use normal Gutenberg serialization, which may normalize delimiter whitespace. The inline description editor changes only the first top-level paragraph (or prepends one), preserving other blocks. + +Clicking Add item creates a private, empty Knowledge row before opening the editor, as in the existing Notes creation flow. This guarantees a saved, authorized parent for uploads from all editor surfaces. Closing does not delete that row. Existing records retain their status; publishing, trash and restore use WordPress's native editor controls. + +The inventory uses a search-led photo grid with uncropped covers, optional filters, and derived place breadcrumbs/child navigation. Add/edit fills the viewport at widths up to 700px, with 16px or larger inputs and a sticky save/progress footer. Block settings remain optional and stack below the content on phones. New-item presentation is transient React state, not persisted metadata. DataViews `previewSize` means a column count, not a pixel width; leave it unset for responsive defaults. + +Before a Stuff save, the app reads the current row and compares content, title, modification time and taxonomy assignments with the last version it loaded/saved. A mismatch requests reopening the item. This is a best-effort stale-edit guard, not an atomic lock. WordPress remains responsible for native editor locking, revisions and permissions. + +## Uploads and recovery + +New files are renamed by `wp_handle_upload_prefilter` and `wp_handle_sideload_prefilter`, before the public move. The basename is 16 cryptographically random bytes rendered as 32 hexadecimal characters, followed by an extension validated with `wp_check_filetype` and the current user's allowed MIME types. Core still validates actual file content. Random-number failure and disallowed extensions fail closed. + +The filters require both `upload_files` and `edit_post` on a verified Stuff item. REST upload context comes from the `post` parameter on `POST /wp/v2/media`, scoped with before/after-callback hooks. The Gutenberg-only API-fetch middleware supplies that parent for uploads lacking it. Native Media Library uploads use core's `post_id`; the Stuff editor gives the library its saved item ID. Unrelated uploads are untouched. + +Original, scaled and thumbnail files retain the randomized stem through WordPress's normal image processing. Existing attachments are never renamed. External URL references are not sideloaded. The file URLs are public, including if the parent is private; randomness reduces guessability and does not provide media authorization. EXIF and other original image metadata are not stripped by Stuff. + +The explicit photo uploader saves the item first, uploads sequentially and saves each successful image block before continuing. Earlier successes survive later failure. Block-editor/Media Library uploads use normal editor Save behavior. Errors retain the editor state; there is no blind automatic retry of uncertain POSTs. Recover an uncertain upload from the native Media Library before trying again. Removing a photo block unlinks it; permanent attachment deletion belongs to Media Library. + +## Integration and API + +`PersonalOS_Wp_App` wraps pinned WpApp 1.3.2 at `/stuff/`, requires `edit_posts`, supplies My Apps registration when supported, and isolates the app from the theme. Pretty permalinks are required by this top-level route. Admin menus and plugin action links are launchers. The existing WpApp helper may use its shared transient rewrite-flush option during activation; Stuff adds no persistent options or term-ID registry. + +PHP passes paths discovered with `rest_get_route_for_post_type_items` and `rest_get_route_for_taxonomy_items`, plus the taxonomy's actual REST field. JS uses API-fetch's native nonce middleware: + +- Knowledge collection/item CRUD: `/wp/v2/knowledge`, using `context=edit` for raw content. +- Terms: resolved core Knowledge Type REST collection; paginate all terms and expand descendants in JS. +- Files: `/wp/v2/media`, with `post=` on upload. + +Every permission decision is WordPress's existing post, term or attachment permission. Taxonomy terms retain the Knowledge runtime's native visibility. No claim is made that raw term names/descriptions are private merely because the app is private. + +Personal Notes deliberately lists `note` records; Stuff does not add the `note` identity. Items therefore do not become ordinary Notes rows automatically. They share the same CPT, taxonomy and native editor. Notes' sidebar remains available on Stuff items. Stuff's editor-selection filter runs after Notes and enables Gutenberg for Stuff items even if empty. Other Knowledge rows keep Notes' content-based classic/Gutenberg choice. + +All content remains on deactivation/uninstall. Release builds bundle shared helpers and WpApp inside this package; the package has no runtime dependency on Personal Notes or the monorepo. + +## Verification + +From the repository root: + +``` +npm run build +npm run test:unit:stuff +npm run test:unit:backend +npm run package:plugins +npm run verify:split-packages +npm run wp-env -- start +``` + +The suite config mounts Stuff with Notes and the other packages. `.wp-env.personal-stuff.json` provides the single-package fixture. The fixtures use pinned Gutenberg 23.7.0 to expose Knowledge; it is not a release dependency. On a fresh site, save a pretty permalink structure in Settings > Permalinks. + +`PersonalStuffTest` covers idempotent/deferred raw terms without plugin options, Notes editor compatibility, private native REST rows, unknown content/unrelated term retention, permission-scoped filenames and raw-body upload derivatives. JS tests use the core serializer for gallery validity/order, unknown block retention, description isolation, and accent/typo/path search. The Jest command selects Node exports for dependencies while retaining JSDOM for block serialization. + +Browser checks should cover term parent changes, a camera/file upload, gallery caption/order, inline description editing, native Gutenberg round trips with Notes active, URL filters, collection navigation, responsive layout, and Print/PDF. Check anonymous app access and inspect attachment filenames and generated sizes. Do not cache authenticated responses in a broad service worker. diff --git a/packages/personal-stuff/includes/class-personal-stuff-plugin.php b/packages/personal-stuff/includes/class-personal-stuff-plugin.php new file mode 100644 index 0000000..3494e9a --- /dev/null +++ b/packages/personal-stuff/includes/class-personal-stuff-plugin.php @@ -0,0 +1,242 @@ + 'personal-stuff', + 'display_name' => 'Personal Stuff', + 'text_domain' => 'personal-stuff', + 'version' => PERSONAL_STUFF_VERSION, + 'plugin_file' => PERSONAL_STUFF_FILE, + 'app' => array( + 'path' => 'stuff', + 'name' => 'Stuff', + 'capability' => 'edit_posts', + 'icon' => 'dashicons-archive', + ), + ) + ); + } + + /** Register only native integrations; no package REST or storage. */ + public function register() { + $this->register_missing_knowledge_notice(); + $this->register_wp_app( array( $this, 'render_app' ) ); + add_action( 'admin_menu', array( $this, 'add_admin_menu' ) ); + // Recheck actual terms when Knowledge becomes available; no installed flag. + $this->ensure_terms(); + if ( $this->knowledge()->is_available() ) { + get_post_type_object( 'wp_knowledge' )->show_ui = true; + get_taxonomy( 'wp_knowledge_type' )->show_ui = true; + } + add_filter( 'use_block_editor_for_post', array( $this, 'use_item_editor' ), 20, 2 ); + add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_item_editor' ) ); + add_filter( 'rest_request_before_callbacks', array( $this, 'begin_upload' ), 10, 3 ); + add_filter( 'rest_request_after_callbacks', array( $this, 'end_upload' ), 10, 3 ); + add_filter( 'wp_handle_upload_prefilter', array( $this, 'randomize_upload' ) ); + add_filter( 'wp_handle_sideload_prefilter', array( $this, 'randomize_upload' ) ); + } + + /** + * Ensure only fixed routing terms. Preserve names and user-created branches. + * + * @return array|WP_Error Resolved term IDs or the native insertion error. + */ + public function ensure_terms() { + if ( ! taxonomy_exists( 'wp_knowledge_type' ) ) { + return array(); + } + $ids = array(); + foreach ( array( + 'artifact' => array( + 'name' => 'Artifact', + 'parent' => '', + ), + 'stuff' => array( + 'name' => 'Stuff', + 'parent' => '', + ), + 'stuff-item' => array( + 'name' => 'Stuff item', + 'parent' => 'stuff', + ), + 'stuff-places' => array( + 'name' => 'Places', + 'parent' => 'stuff', + ), + 'stuff-tags' => array( + 'name' => 'Stuff tags', + 'parent' => 'stuff', + ), + ) as $slug => $config ) { + $parent = $config['parent'] ? $ids[ $config['parent'] ] : 0; + $term = get_term_by( 'slug', $slug, 'wp_knowledge_type' ); + if ( ! $term ) { + $result = wp_insert_term( + $config['name'], + 'wp_knowledge_type', + array( + 'slug' => $slug, + 'parent' => $parent, + ) + ); + if ( is_wp_error( $result ) ) { + return $result; + } + $ids[ $slug ] = (int) $result['term_id']; + } else { + $ids[ $slug ] = (int) $term->term_id; + if ( 'artifact' !== $slug && $parent !== (int) $term->parent ) { + $result = wp_update_term( $term->term_id, 'wp_knowledge_type', array( 'parent' => $parent ) ); + if ( is_wp_error( $result ) ) { + return $result; + } + } + } + } + return $ids; + } + + /** + * Recognize items by canonical post type and subtype slug. + * + * @param int $post_id Post ID. + * @return bool + */ + public function is_item( $post_id ) { + return 'wp_knowledge' === get_post_type( $post_id ) && has_term( 'stuff-item', 'wp_knowledge_type', $post_id ); + } + + /** + * Keep empty Stuff items in Gutenberg even with Personal Notes active. + * + * @param bool $use Existing editor decision. + * @param WP_Post $post Edited post. + * @return bool + */ + public function use_item_editor( $use, $post ) { + return $this->is_item( $post->ID ) ? use_block_editor_for_post_type( $post->post_type ) : $use; + } + + /** Add the wp-admin launcher. */ + public function add_admin_menu() { + $this->add_app_admin_page_hook( add_menu_page( __( 'Stuff', 'personal-stuff' ), __( 'Stuff', 'personal-stuff' ), 'edit_posts', 'personal-stuff', array( $this, 'render_app' ), 'dashicons-archive', 4 ) ); + } + + /** Render the app mount. */ + public function render_app() { + if ( ! $this->knowledge()->is_available() ) { + echo '

' . esc_html__( 'Knowledge is not available yet.', 'personal-stuff' ) . '

'; + return; + } + echo '
'; + } + + /** Enqueue the JS app with existing core endpoint discovery. */ + public function enqueue_package_assets() { + parent::enqueue_package_assets(); + if ( ! $this->knowledge()->is_available() ) { + return; + } + wp_enqueue_style( 'wp-block-library' ); + wp_enqueue_style( 'wp-edit-blocks' ); + wp_enqueue_media(); + $taxonomy = get_taxonomy( 'wp_knowledge_type' ); + wp_localize_script( + $this->script_handle(), + 'personalStuffSettings', + array( + 'knowledgeRestPath' => rest_get_route_for_post_type_items( 'wp_knowledge' ), + 'taxonomyRestPath' => rest_get_route_for_taxonomy_items( 'wp_knowledge_type' ), + 'taxonomyField' => $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name, + 'editPostUrl' => admin_url( 'post.php' ), + 'canManageTerms' => current_user_can( $taxonomy->cap->manage_terms ), + 'canUpload' => current_user_can( 'upload_files' ), + 'skillUrl' => plugins_url( 'skills/personal-stuff/SKILL.md', PERSONAL_STUFF_FILE ), + ) + ); + } + + /** Make Gutenberg's Media requests identify the authorized item. */ + public function enqueue_item_editor() { + $post = get_post(); + if ( ! $post || ! $this->is_item( $post->ID ) || ! current_user_can( 'edit_post', $post->ID ) ) { + return; + } + PersonalOS_Assets_Helper::register_script( 'personal-stuff-editor', PERSONAL_STUFF_FILE, 'build/editor.js' ); + wp_localize_script( 'personal-stuff-editor', 'personalStuffEditor', array( 'postId' => $post->ID ) ); + wp_enqueue_script( 'personal-stuff-editor' ); + } + + /** + * Scope filename filtering to the current authenticated Media create request. + * + * @param mixed $response Response. + * @param array $handler Core handler. + * @param WP_REST_Request $request REST request. + * @return mixed + */ + public function begin_upload( $response, $handler, $request ) { + if ( '/wp/v2/media' === untrailingslashit( $request->get_route() ) && 'POST' === $request->get_method() ) { + $this->upload_post = (int) $request->get_param( 'post' ); + } + return $response; + } + + /** + * Clear request-local context, including failed uploads. + * + * @param mixed $response Response. + * @param array $handler Core handler. + * @param WP_REST_Request $request REST request. + * @return mixed + */ + public function end_upload( $response, $handler, $request ) { + if ( '/wp/v2/media' === untrailingslashit( $request->get_route() ) ) { + $this->upload_post = 0; + } + return $response; + } + + /** + * Randomize before WordPress moves a file into publicly accessible uploads. + * + * @param array $file Native upload data. + * @return array + */ + public function randomize_upload( $file ) { + // Core async-upload verifies its nonce and upload capability before this hook. + // phpcs:ignore WordPress.Security.NonceVerification.Missing + $post_id = $this->upload_post ? $this->upload_post : absint( $_POST['post_id'] ?? 0 ); + if ( ! $post_id || ! $this->is_item( $post_id ) || ! current_user_can( 'edit_post', $post_id ) || ! current_user_can( 'upload_files' ) ) { + return $file; + } + $type = wp_check_filetype( $file['name'], get_allowed_mime_types() ); + if ( ! $type['ext'] || ! $type['type'] ) { + $file['error'] = __( 'This file type is not allowed.', 'personal-stuff' ); + return $file; + } + try { + $file['name'] = bin2hex( random_bytes( 16 ) ) . '.' . strtolower( $type['ext'] ); + } catch ( Exception $error ) { + $file['error'] = __( 'Could not generate a safe upload filename.', 'personal-stuff' ); + } + return $file; + } +} diff --git a/packages/personal-stuff/personal-stuff.php b/packages/personal-stuff/personal-stuff.php new file mode 100644 index 0000000..fed6ea0 --- /dev/null +++ b/packages/personal-stuff/personal-stuff.php @@ -0,0 +1,92 @@ +ensure_terms(); + PersonalOS_Wp_App::activate(); +} + +register_activation_hook( __FILE__, 'personal_stuff_activate' ); + +/** + * Remove the app route after deactivation. + * + * @return void + */ +function personal_stuff_deactivate() { + PersonalOS_Wp_App::deactivate(); +} + +register_deactivation_hook( __FILE__, 'personal_stuff_deactivate' ); diff --git a/packages/personal-stuff/readme.txt b/packages/personal-stuff/readme.txt new file mode 100644 index 0000000..278e916 --- /dev/null +++ b/packages/personal-stuff/readme.txt @@ -0,0 +1,57 @@ +=== Personal Stuff === +Contributors: artpi +Tags: inventory, knowledge, photos +Requires at least: 7.0 +Tested up to: 7.1 +Requires PHP: 7.4 +Stable tag: 0.1.0 +License: GPL-2.0-or-later +License URI: https://www.gnu.org/licenses/gpl-2.0.html + +Find and organize belongings with places, tags, and Gutenberg photo galleries. + +== Description == + +Personal Stuff is a private inventory app at `/stuff/`, built on WordPress Knowledge. Browse a photo grid or list, search names, descriptions and location paths, organize hierarchical places, assign tags, and print a filtered collection to PDF using your browser. + +Items are private Knowledge posts. Places and tags are ordinary Knowledge Type terms. Photos, captions, and their ordering use native Gutenberg image and gallery blocks, editable in both Stuff and the WordPress block editor. Personal Notes can be active alongside Stuff. + +No custom database tables, item metadata, settings, or REST endpoints are added. The bundled operating skill explains how an agent can use the same native APIs. + +== Installation == + +1. Upload the `personal-stuff` directory to `/wp-content/plugins/` and activate it. +2. Ensure the site provides `wp_knowledge`, hierarchical `wp_knowledge_type`, and their core REST endpoints. +3. Enable pretty permalinks in WordPress Settings > Permalinks for top-level WpApp routes. +4. Open Stuff from the admin menu, plugin launcher, or `/stuff/`. + +Fixed routing terms are provisioned by slug when Knowledge is available. No other Personal plugin is required. + +== Frequently Asked Questions == + += Where are photos stored? = + +Photos are WordPress Media attachments. New files uploaded for Stuff receive cryptographically random filenames before entering the uploads directory. Media files still have public URLs; knowing a URL permits access. Existing attachments and external photo URLs retain their existing filenames and access rules. + += How do I edit a photo or remove an item? = + +Use the native image/gallery block controls to edit captions, alt text, order, and image source. The WordPress Media Library manages attachment deletion. The Gutenberg document controls provide Move to trash for an item. Removing an image block leaves its Media file intact. + +== Privacy == + +Personal Stuff does not contact external services automatically. A photo URL you add is fetched by the browser from that host and may disclose the visitor's IP address and ordinary request information to that host. No telemetry is collected. + +Inventory posts are private by default and use WordPress's existing permissions. Place/tag terms have the visibility provided by the Knowledge taxonomy; this plugin adds no separate term privacy layer. Media URLs remain public and hard to guess, rather than access-controlled. Original image metadata is not stripped by this plugin. + +== Data Retention == + +Deactivating or uninstalling leaves Knowledge posts, taxonomy terms, and Media files in WordPress. There is no importer or separate inventory storage to remove. WordPress may keep normal revisions, editing metadata, and attachment metadata. + +== Source and Build == + +Source is included under `src/`. In the PersonalOS repository run `npm ci`, `composer install`, `npm run build`, and `npm run package:plugin -- --package=personal-stuff`. The ZIP bundles shared helpers and WpApp 1.3.2 (GPL-2.0-or-later) for routing and app access control. See TECHNICAL.md for the storage contract and tests. The portable agent skill is included at skills/personal-stuff/SKILL.md and linked from the app. + +== Changelog == + += 0.1.0 = +Initial Knowledge-backed Personal Stuff app. diff --git a/packages/personal-stuff/skills/personal-stuff/SKILL.md b/packages/personal-stuff/skills/personal-stuff/SKILL.md new file mode 100644 index 0000000..3121cb4 --- /dev/null +++ b/packages/personal-stuff/skills/personal-stuff/SKILL.md @@ -0,0 +1,62 @@ +--- +name: personal-stuff +description: Find, add, describe, photograph, tag, or move belongings in Personal Stuff using existing WordPress Knowledge, Knowledge Type, and Media APIs. Use for inventory operations on a site with Personal Stuff, including places and item photo galleries. +--- + +# Personal Stuff operating skill + +Use the site's existing authenticated WordPress connection. Discover the available WordPress tools and core REST schema; do not invent Stuff endpoints or require another Personal plugin. Read `../../TECHNICAL.md` for the full storage contract. + +## Resolve vocabulary and access + +1. Confirm `wp_knowledge` and hierarchical `wp_knowledge_type` exist. Discover their REST routes/fields from `/wp/v2/types/wp_knowledge` and `/wp/v2/taxonomies/wp_knowledge_type`, or equivalent existing tools. The Knowledge collection is `/wp/v2/knowledge`. +2. Resolve terms by slugs `artifact`, `stuff`, `stuff-item`, `stuff-places`, `stuff-tags`; include `hide_empty=false`. Follow REST pagination. Never persist root IDs in options or another registry. +3. If fixed roots are absent, report that Personal Stuff must be activated with Knowledge available. Do not invent parallel taxonomies or create place posts. +4. Only operate within the authenticated user's existing permissions. Private item access does not make Media file URLs or raw taxonomy terms private. + +## Find belongings + +Query the core Knowledge collection with the resolved taxonomy REST field containing the `stuff-item` term ID. Use `context=edit` when raw content is needed and authorized. Inventory may include private, published, draft, pending or future records; exclude trash from ordinary browsing. Paginate all relevant results before claiming completeness. + +Read descriptions from content blocks. Resolve location assignments against descendants of `stuff-places`; derive ancestor paths from raw `parent` relationships. Filter a parent place by expanding its descendants. Match tags under `stuff-tags`. Search names, description text, tag names and full location paths; normalize accents/case/whitespace. Report ambiguity rather than moving a guessed item. + +## Add or update an item + +- Create one Knowledge post with `status: private`, a meaningful `title`, and taxonomy IDs for `artifact`, `stuff-item`, zero/one physical place and any descriptive tags. Let WordPress assign the author, ID and slug. +- Store descriptions in native paragraph blocks and photos in core image/gallery blocks in `content`. Preserve all unrelated blocks, captions, gallery settings, and other Knowledge Type assignments. +- Before editing, fetch the current raw row. Send only fields that need changing. For a move, update taxonomy assignments and leave content untouched. Never send an empty content field accidentally. +- If concurrent edits are visible, refetch and reconcile before saving. Core REST updates do not provide an atomic compare-and-swap guarantee. Check the result of every write. +- There is no quantity, custom Stuff meta, place-content post, content ID or parallel photo list. Do not create any of these. + +For a new description: + +```html + +

Camera and lenses in a padded pouch.

+ +``` + +Prefer an available Gutenberg parser/serializer for changes involving existing blocks. Do not flatten a whole post to plain text or rebuild its gallery from derived thumbnails. Use the native editor if the available tools cannot preserve its block structure. + +## Places and tags + +Use native Knowledge Type term endpoints. A place is a raw term beneath `stuff-places`, optionally under another place. A tag belongs beneath `stuff-tags`. Use only native `name`, `slug`, `parent`, and `description`. Resolve the complete path before creating a same-named place, avoid duplicates/cycles, and never change the five fixed routing slugs. + +Term deletion removes assignments and reparents children according to WordPress behavior. Follow the user's authorization for destructive operations. Prefer moving/renaming when that is what they requested. Photos belong to item posts, never to terms. + +## Photos and failed uploads + +1. Save the private item before uploading so a real authorized parent exists. +2. Generate an unpredictable filename before handing a new file to WordPress: at least 128 bits from a cryptographically secure random generator, preserving the validated extension. Do not expose descriptive source filenames in public uploads. The plugin enforces the same server-side rule in its verified item upload contexts. +3. Upload to core `/wp/v2/media` with the item ID in `post`. Both multipart and raw-body requests must identify that parent. Do not sideload a URL automatically; an external URL may remain a direct image block reference if requested. +4. Use the returned attachment ID and source URL in a native `core/image`, normally inside `core/gallery`. Preserve existing image attributes/captions. Serialize using Gutenberg; block order defines the cover and photo order. +5. Save each successful addition before continuing a batch. If a response is lost, inspect recent Media attachments for this parent before retrying; do not blindly duplicate uploads. Keep successful attachment IDs in the current operation's memory, without persistent locks/idempotency tables. +6. Removing an image block retains the Media attachment. Use WordPress's normal Media controls for an explicitly requested permanent deletion. + +Random filenames provide hard-to-guess public URLs, not private media. Do not claim otherwise. Existing attachment names are unchanged; original image metadata may remain. Do not rename unrelated uploads or existing files retroactively. + +## UI handoff + +Open `/stuff/` for the native inventory app or `wp-admin/post.php?post=&action=edit` for full Gutenberg editing. URL filters use `q`, `place` (slug), `tag` (slug), `photo` (`all`, `with`, `without`), and `item` (post ID). Collection links retain filters. Print/PDF uses the browser's print dialog on the full filtered set. + +There is no importing UI, importer endpoint or bulk migration workflow in this plugin. Use ordinary authorized item operations and report what changed, including the final location and any photos that failed. diff --git a/packages/personal-stuff/src/content.js b/packages/personal-stuff/src/content.js new file mode 100644 index 0000000..1ccceac --- /dev/null +++ b/packages/personal-stuff/src/content.js @@ -0,0 +1,71 @@ +import { createBlock, parse, serialize } from '@wordpress/blocks'; + +export function itemContent( content ) { + const document = new window.DOMParser().parseFromString( + content, + 'text/html' + ); + return { + description: document.body.textContent.trim(), + photos: Array.from( document.querySelectorAll( 'img' ) ).map( + ( img ) => ( { + url: img.getAttribute( 'src' ), + alt: img.getAttribute( 'alt' ) || '', + } ) + ), + }; +} + +export function appendPhotos( blocks, photos ) { + const images = photos.map( ( photo ) => + createBlock( 'core/image', { + id: photo.id, + url: photo.url || photo.source_url, + alt: photo.alt_text || '', + sizeSlug: 'full', + linkDestination: 'none', + } ) + ); + const last = blocks[ blocks.length - 1 ]; + return last?.name === 'core/gallery' + ? [ + ...blocks.slice( 0, -1 ), + { ...last, innerBlocks: [ ...last.innerBlocks, ...images ] }, + ] + : [ + ...blocks, + createBlock( 'core/gallery', { linkTo: 'none' }, images ), + ]; +} + +// Keep the original post for non-content edits. Gutenberg's serializer retains +// originalContent for unavailable custom blocks when surrounding blocks change. +export function contentSession( raw ) { + const blocks = parse( raw ); + const originals = new Map( + blocks.map( ( block ) => [ + block.clientId, + { block, serialized: serialize( [ block ] ) }, + ] ) + ); + return { + blocks, + serialize: ( next ) => { + if ( + next.length === blocks.length && + next.every( ( block, i ) => block === blocks[ i ] ) + ) { + return raw; + } + // The block parser preserves unknown blocks' originalContent, including + // nested content. Avoid reparsing the post during unrelated field edits. + return next + .map( ( block ) => + originals.get( block.clientId )?.block === block + ? originals.get( block.clientId ).serialized + : serialize( [ block ] ) + ) + .join( '\n\n' ); + }, + }; +} diff --git a/packages/personal-stuff/src/editor.js b/packages/personal-stuff/src/editor.js new file mode 100644 index 0000000..507b3de --- /dev/null +++ b/packages/personal-stuff/src/editor.js @@ -0,0 +1,19 @@ +import apiFetch from '@wordpress/api-fetch'; +import { addQueryArgs } from '@wordpress/url'; + +// Gutenberg may upload without a parent. Identify this saved Stuff item so +// both multipart and raw-body Media uploads receive the server filename rule. +apiFetch.use( ( options, next ) => { + if ( + /^\/wp\/v2\/media\/?(?:\?|$)/.test( options.path || '' ) && + options.method?.toUpperCase() === 'POST' + ) { + options = { + ...options, + path: addQueryArgs( options.path, { + post: window.personalStuffEditor.postId, + } ), + }; + } + return next( options ); +} ); diff --git a/packages/personal-stuff/src/index.js b/packages/personal-stuff/src/index.js new file mode 100644 index 0000000..5457e53 --- /dev/null +++ b/packages/personal-stuff/src/index.js @@ -0,0 +1,1556 @@ +import apiFetch from '@wordpress/api-fetch'; +import { registerCoreBlocks } from '@wordpress/block-library'; +import { + BlockEditorProvider, + BlockList, + BlockTools, + WritingFlow, + ObserveTyping, + Inserter, + BlockInspector, + RichText, +} from '@wordpress/block-editor'; +import { createBlock } from '@wordpress/blocks'; +import { MediaUpload } from '@wordpress/media-utils'; +import { addFilter } from '@wordpress/hooks'; +import { + Button, + Modal, + Notice, + SelectControl, + TextControl, + TextareaControl, + CheckboxControl, + SlotFillProvider, + Popover, + Spinner, +} from '@wordpress/components'; +import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews/wp'; +import { + createRoot, + useEffect, + useMemo, + useRef, + useState, + RawHTML, +} from '@wordpress/element'; +import { __, _n, sprintf } from '@wordpress/i18n'; +import { addQueryArgs } from '@wordpress/url'; +import { + edit, + plus, + search as searchIcon, + image as imageIcon, + Icon, + chevronRight, + update, + funnel, + category, +} from '@wordpress/icons'; +import { contentSession, appendPhotos, itemContent } from './content'; +import { SearchIndex } from './search'; +import './style.css'; + +registerCoreBlocks(); +addFilter( 'editor.MediaUpload', 'personal-stuff/media', () => MediaUpload ); +const settings = window.personalStuffSettings; +const termIds = ( item ) => item[ settings.taxonomyField ] || []; +const title = ( item ) => item.title.raw; +const editorUrl = ( item ) => + addQueryArgs( settings.editPostUrl, { post: item.id, action: 'edit' } ); + +async function allPages( path, query = {} ) { + let rows = []; + for ( let page = 1, pages = 1; page <= pages; page++ ) { + const response = await apiFetch( { + path: addQueryArgs( path, { ...query, per_page: 100, page } ), + parse: false, + } ); + rows = rows.concat( await response.json() ); + pages = Number( response.headers.get( 'X-WP-TotalPages' ) || 1 ); + } + return rows; +} + +function ancestors( term, byId ) { + const chain = []; + const seen = new Set(); + while ( term && ! seen.has( term.id ) ) { + seen.add( term.id ); + chain.unshift( term ); + term = byId.get( term.parent ); + } + return chain; +} + +function useVocabulary( terms ) { + return useMemo( () => { + const byId = new Map( terms.map( ( term ) => [ term.id, term ] ) ); + const bySlug = new Map( terms.map( ( term ) => [ term.slug, term ] ) ); + const below = ( term, slug ) => + term.slug !== slug && + ancestors( term, byId ).some( ( parent ) => parent.slug === slug ); + const path = ( term ) => + ancestors( term, byId ) + .filter( ( parent ) => below( parent, 'stuff-places' ) ) + .map( ( parent ) => parent.name ) + .join( ' / ' ); + return { + byId, + bySlug, + below, + path, + places: terms + .filter( ( term ) => below( term, 'stuff-places' ) ) + .sort( ( a, b ) => path( a ).localeCompare( path( b ) ) ), + tags: terms.filter( ( term ) => below( term, 'stuff-tags' ) ), + }; + }, [ terms ] ); +} + +function Photo( { url, alt = '' } ) { + const [ broken, setBroken ] = useState( false ); + useEffect( () => setBroken( false ), [ url ] ); + return url && ! broken ? ( + { setBroken( true ) } + /> + ) : ( + + + { url + ? __( 'Photo unavailable', 'personal-stuff' ) + : __( 'No photo', 'personal-stuff' ) } + + ); +} + +function ItemEditor( { item, isNew, vocabulary, onSaved, onClose } ) { + useEffect( () => { + const previous = window.wp.media.view.settings.post.id; + window.wp.media.view.settings.post.id = item.id; + return () => { + window.wp.media.view.settings.post.id = previous; + }; + }, [ item.id ] ); + const session = useMemo( + () => contentSession( item.content.raw ), + [ item.content.raw ] + ); + const [ blocks, setBlocks ] = useState( session.blocks ); + const blocksRef = useRef( blocks ); + blocksRef.current = blocks; + const [ name, setName ] = useState( isNew ? '' : title( item ) ); + const currentPlaces = termIds( item ).filter( ( id ) => + vocabulary.places.some( ( place ) => place.id === id ) + ); + const [ place, setPlace ] = useState( String( currentPlaces[ 0 ] || '' ) ); + const [ tags, setTags ] = useState( + termIds( item ).filter( ( id ) => + vocabulary.tags.some( ( tag ) => tag.id === id ) + ) + ); + const [ saved, setSaved ] = useState( item ); + const savedRef = useRef( saved ); + savedRef.current = saved; + const [ busy, setBusy ] = useState( false ); + const [ error, setError ] = useState( '' ); + const [ progress, setProgress ] = useState( '' ); + const [ url, setUrl ] = useState( '' ); + const [ inspect, setInspect ] = useState( false ); + const [ confirmClose, setConfirmClose ] = useState( false ); + const [ dirty, setDirty ] = useState( false ); + useEffect( () => { + if ( ! dirty ) { + return; + } + const warn = ( event ) => { + event.preventDefault(); + event.returnValue = ''; + }; + window.addEventListener( 'beforeunload', warn ); + return () => window.removeEventListener( 'beforeunload', warn ); + }, [ dirty ] ); + const changeBlocks = ( next ) => { + setBlocks( next ); + setDirty( true ); + }; + + async function persist( nextBlocks = blocksRef.current ) { + const previous = savedRef.current; + if ( previous.id ) { + const current = await apiFetch( { + path: `${ settings.knowledgeRestPath }/${ previous.id }?context=edit`, + } ); + if ( + current.modified_gmt !== previous.modified_gmt || + current.content.raw !== previous.content.raw || + JSON.stringify( termIds( current ) ) !== + JSON.stringify( termIds( previous ) ) || + title( current ) !== title( previous ) + ) { + throw new Error( + __( + 'This item changed elsewhere. Close and reopen it before saving your changes.', + 'personal-stuff' + ) + ); + } + } + const unrelated = termIds( previous ).filter( + ( id ) => + ! vocabulary.places.some( ( term ) => term.id === id ) && + ! vocabulary.tags.some( ( term ) => term.id === id ) + ); + const content = session.serialize( nextBlocks ); + const data = { + title: name.trim() || __( 'Untitled item', 'personal-stuff' ), + [ settings.taxonomyField ]: Array.from( + new Set( [ + ...unrelated, + vocabulary.bySlug.get( 'artifact' ).id, + vocabulary.bySlug.get( 'stuff-item' ).id, + ...tags, + ...( place ? [ Number( place ) ] : [] ), + ] ) + ), + ...( previous.id ? {} : { status: 'private' } ), + ...( ! previous.id || content !== previous.content.raw + ? { content } + : {} ), + }; + const result = await apiFetch( { + path: `${ settings.knowledgeRestPath }${ + previous.id ? `/${ previous.id }` : '' + }`, + method: 'POST', + data, + } ); + savedRef.current = result; + setSaved( result ); + setDirty( false ); + onSaved( result ); + return result; + } + + async function save() { + setBusy( true ); + setError( '' ); + try { + await persist(); + onClose(); + } catch ( failure ) { + setError( failure.message ); + } finally { + setBusy( false ); + } + } + + async function upload( filesList, onFileChange, onError ) { + const files = Array.from( filesList ); + setBusy( true ); + setError( '' ); + const uploaded = []; + try { + const parent = await persist(); + for ( const [ index, file ] of Array.from( files ).entries() ) { + setProgress( + sprintf( + // translators: 1: current photo, 2: number of photos. + __( 'Uploading photo %1$d of %2$d…', 'personal-stuff' ), + index + 1, + files.length + ) + ); + const body = new FormData(); + body.append( 'file', file ); + body.append( 'post', parent.id ); + const media = await apiFetch( { + path: '/wp/v2/media', + method: 'POST', + body, + } ); + const photo = { ...media, url: media.source_url }; + uploaded.push( photo ); + if ( onFileChange ) { + onFileChange( [ ...uploaded ] ); + } else { + const next = appendPhotos( blocksRef.current, [ photo ] ); + blocksRef.current = next; + changeBlocks( next ); + await persist( next ); + } + } + } catch ( failure ) { + setError( + `${ failure.message } ${ __( + 'Successful uploads are retained. Check Media before retrying an uncertain upload.', + 'personal-stuff' + ) }` + ); + onError?.( failure ); + } finally { + setBusy( false ); + setProgress( '' ); + } + } + + function addUrl() { + try { + if ( ! [ 'https:', 'http:' ].includes( new URL( url ).protocol ) ) { + throw new Error(); + } + changeBlocks( appendPhotos( blocks, [ { url } ] ) ); + setUrl( '' ); + setError( '' ); + } catch { + setError( + __( + 'Enter an absolute HTTP or HTTPS photo URL.', + 'personal-stuff' + ) + ); + } + } + const close = () => ( dirty ? setConfirmClose( true ) : onClose() ); + const saveStatus = dirty + ? __( 'Unsaved changes', 'personal-stuff' ) + : __( 'Saved', 'personal-stuff' ); + return ( + {} : close } + shouldCloseOnClickOutside={ false } + > + { error && ( + + { error } + + ) } + { currentPlaces.length > 1 && ( + + { __( + 'This item has multiple places. Saving will use the place selected below.', + 'personal-stuff' + ) } + + ) } +
+ { + setName( value ); + setDirty( true ); + } } + /> + { + setPlace( value ); + setDirty( true ); + } } + options={ [ + { + value: '', + label: __( 'Unplaced', 'personal-stuff' ), + }, + ...vocabulary.places.map( ( term ) => ( { + value: String( term.id ), + label: vocabulary.path( term ), + } ) ), + ] } + /> +
+ { __( 'Tags', 'personal-stuff' ) } + { vocabulary.tags.map( ( tag ) => ( + { + setTags( + checked + ? [ ...tags, tag.id ] + : tags.filter( ( id ) => id !== tag.id ) + ); + setDirty( true ); + } } + /> + ) ) } +
+
+ { settings.canUpload && ( + + ) } +
+
+ + { __( 'More photo options', 'personal-stuff' ) } + + { saved.id > 0 && ( + + ) } +

+ { __( + 'Photos use public, hard-to-guess Media URLs. Reorder image blocks to choose the cover. Removing a block keeps its Media file.', + 'personal-stuff' + ) } +

+ + +
+
+ + + + upload( filesList, onFileChange, onError ) + : undefined, + } } + > +
+ + { __( 'Notes & photos', 'personal-stuff' ) } + + + +
+
+
+ + + + + + + +
+ { inspect && ( + + ) } +
+ +
+
+
+
+ { busy + ? progress || __( 'Saving item…', 'personal-stuff' ) + : saveStatus } +
+
+ + +
+
+ { confirmClose && ( + setConfirmClose( false ) } + > +

+ { __( + 'Uploaded photos and previously saved changes will remain.', + 'personal-stuff' + ) } +

+ + +
+ ) } +
+ ); +} + +function InlineDescription( { item, onSaved } ) { + const [ editing, setEditing ] = useState( false ); + const [ busy, setBusy ] = useState( false ); + const [ error, setError ] = useState( '' ); + const session = useMemo( + () => contentSession( item.content.raw ), + [ item.content.raw ] + ); + const paragraph = session.blocks.find( + ( block ) => block.name === 'core/paragraph' + ); + const [ text, setText ] = useState( '' ); + async function save() { + setBusy( true ); + try { + const current = await apiFetch( { + path: `${ settings.knowledgeRestPath }/${ item.id }?context=edit`, + } ); + if ( current.content.raw !== item.content.raw ) { + throw new Error( + __( + 'Content changed elsewhere. Refresh before editing.', + 'personal-stuff' + ) + ); + } + const changed = paragraph + ? { + ...paragraph, + attributes: { ...paragraph.attributes, content: text }, + } + : createBlock( 'core/paragraph', { content: text } ); + const blocks = paragraph + ? session.blocks.map( ( block ) => + block === paragraph ? changed : block + ) + : [ changed, ...session.blocks ]; + const result = await apiFetch( { + path: `${ settings.knowledgeRestPath }/${ item.id }`, + method: 'POST', + data: { content: session.serialize( blocks ) }, + } ); + onSaved( result ); + setEditing( false ); + } catch ( failure ) { + setError( failure.message ); + } finally { + setBusy( false ); + } + } + return ( +
+ { error && ( + setError( '' ) }> + { error } + + ) } + { editing ? ( + <> + +
+ + +
+ + ) : ( + + ) } +
+ ); +} + +function TermEditor( { vocabulary, onChanged, onClose } ) { + const [ selected, setSelected ] = useState( '' ); + const [ kind, setKind ] = useState( 'stuff-places' ); + const [ name, setName ] = useState( '' ); + const [ slug, setSlug ] = useState( '' ); + const [ description, setDescription ] = useState( '' ); + const [ parent, setParent ] = useState( vocabulary.bySlug.get( kind ).id ); + const [ error, setError ] = useState( '' ); + const [ busy, setBusy ] = useState( false ); + const [ deleting, setDeleting ] = useState( false ); + const branch = + kind === 'stuff-places' ? vocabulary.places : vocabulary.tags; + function choose( id ) { + const term = vocabulary.byId.get( Number( id ) ); + setSelected( id ); + setName( term?.name || '' ); + setSlug( term?.slug || '' ); + setDescription( term?.description || '' ); + setParent( term?.parent || vocabulary.bySlug.get( kind ).id ); + } + async function mutate( remove = false ) { + setBusy( true ); + setError( '' ); + try { + await apiFetch( { + path: `${ settings.taxonomyRestPath }${ + selected ? `/${ selected }` : '' + }`, + method: remove ? 'DELETE' : 'POST', + data: remove + ? { force: true } + : { + name, + ...( slug ? { slug } : {} ), + description, + parent: Number( parent ), + }, + } ); + await onChanged(); + choose( '' ); + setDeleting( false ); + } catch ( failure ) { + setError( failure.message ); + } finally { + setBusy( false ); + } + } + return ( + {} : onClose } + > + { error && ( + + { error } + + ) } +
+ { + setKind( value ); + setSelected( '' ); + setName( '' ); + setSlug( '' ); + setDescription( '' ); + setParent( vocabulary.bySlug.get( value ).id ); + } } + /> + ( { + value: String( term.id ), + label: + kind === 'stuff-places' + ? vocabulary.path( term ) + : term.name, + } ) ), + ] } + /> + + + + + ! ancestors( term, vocabulary.byId ).some( + ( ancestor ) => + ancestor.id === Number( selected ) + ) + ) + .map( ( term ) => ( { + value: String( term.id ), + label: + kind === 'stuff-places' + ? vocabulary.path( term ) + : term.name, + } ) ), + ] } + /> +
+ + { selected && ( + + ) } +
+
+ { deleting && ( + setDeleting( false ) } + > +

+ { __( + 'WordPress removes this assignment from items and reparents its children. Items and photos remain.', + 'personal-stuff' + ) } +

+ +
+ ) } +
+ ); +} + +function Stuff() { + const [ items, setItems ] = useState( [] ); + const [ terms, setTerms ] = useState( [] ); + const vocabulary = useVocabulary( terms ); + const [ loading, setLoading ] = useState( true ); + const [ error, setError ] = useState( '' ); + const [ editing, setEditing ] = useState( null ); + const [ managing, setManaging ] = useState( false ); + const [ addingId, setAddingId ] = useState( null ); + const [ showFilters, setShowFilters ] = useState( false ); + const [ route, setRoute ] = useState( + () => new URLSearchParams( window.location.search ) + ); + const [ printing, setPrinting ] = useState( false ); + const [ view, setView ] = useState( { + type: 'grid', + page: 1, + perPage: 24, + titleField: 'name', + mediaField: 'cover', + descriptionField: 'location', + fields: [ 'tags' ], + layout: {}, + search: '', + } ); + const touch = useRef( null ); + const detail = items.find( + ( item ) => item.id === Number( route.get( 'item' ) ) + ); + const search = route.get( 'q' ) || ''; + const place = route.get( 'place' ) || ''; + const tag = route.get( 'tag' ) || ''; + const photo = route.get( 'photo' ) || 'all'; + function navigate( changes, replace = false ) { + const next = new URLSearchParams( window.location.search ); + Object.entries( changes ).forEach( ( [ key, value ] ) => + value ? next.set( key, value ) : next.delete( key ) + ); + window.history[ replace ? 'replaceState' : 'pushState' ]( + {}, + '', + `${ window.location.pathname }${ next.size ? `?${ next }` : '' }` + ); + setRoute( next ); + if ( + Object.keys( changes ).some( ( key ) => + [ 'q', 'place', 'tag', 'photo' ].includes( key ) + ) + ) { + setView( ( current ) => ( { ...current, page: 1 } ) ); + } + } + async function load() { + setLoading( true ); + setError( '' ); + try { + const fetchedTerms = await allPages( settings.taxonomyRestPath, { + hide_empty: false, + } ); + const identity = fetchedTerms.find( + ( term ) => term.slug === 'stuff-item' + ); + if ( + ! identity || + ! [ 'artifact', 'stuff', 'stuff-places', 'stuff-tags' ].every( + ( slug ) => + fetchedTerms.some( ( term ) => term.slug === slug ) + ) + ) { + throw new Error( + __( + 'Stuff Knowledge Types are missing. Reload after Knowledge is available.', + 'personal-stuff' + ) + ); + } + const fetchedItems = await allPages( settings.knowledgeRestPath, { + context: 'edit', + status: [ 'private', 'publish', 'draft', 'future', 'pending' ], + [ settings.taxonomyField ]: [ identity.id ], + } ); + setTerms( fetchedTerms ); + setItems( fetchedItems ); + } catch ( failure ) { + setError( failure.message ); + } finally { + setLoading( false ); + } + } + useEffect( () => { + load(); + const pop = () => + setRoute( new URLSearchParams( window.location.search ) ); + window.addEventListener( 'popstate', pop ); + return () => window.removeEventListener( 'popstate', pop ); + }, [] ); + const projected = useMemo( + () => + items.map( ( item ) => { + const content = itemContent( item.content.raw ); + const assigned = termIds( item ) + .map( ( id ) => vocabulary.byId.get( id ) ) + .filter( Boolean ); + const locations = assigned.filter( ( term ) => + vocabulary.below( term, 'stuff-places' ) + ); + return { + ...item, + ...content, + name: title( item ), + tags: assigned + .filter( ( term ) => + vocabulary.below( term, 'stuff-tags' ) + ) + .map( ( term ) => term.name ), + location: locations.map( vocabulary.path ).join( '; ' ), + placeId: locations[ 0 ]?.id, + photoCount: content.photos.length, + }; + } ), + [ items, vocabulary ] + ); + const filtered = useMemo( () => { + const index = new SearchIndex(); + index.rebuild( + projected.filter( + ( item ) => + ( ! tag || + termIds( item ).includes( + vocabulary.bySlug.get( tag )?.id + ) ) && + ( ! place || + ( place === 'unplaced' + ? ! item.placeId + : termIds( item ).some( ( id ) => + ancestors( + vocabulary.byId.get( id ), + vocabulary.byId + ).some( + ( ancestor ) => ancestor.slug === place + ) + ) ) ) + ) + ); + return index.search( search, { photo } ); + }, [ projected, vocabulary, search, photo, place, tag ] ); + const fields = useMemo( + () => [ + { + id: 'name', + label: __( 'Name', 'personal-stuff' ), + type: 'text', + getValue: ( { item } ) => item.name, + enableSorting: true, + enableHiding: false, + }, + { + id: 'cover', + label: __( 'Photo', 'personal-stuff' ), + render: ( { item } ) => , + enableSorting: false, + }, + { + id: 'location', + label: __( 'Place', 'personal-stuff' ), + type: 'text', + getValue: ( { item } ) => + item.location || __( 'Unplaced', 'personal-stuff' ), + enableSorting: true, + }, + { + id: 'tags', + label: __( 'Tags', 'personal-stuff' ), + type: 'text', + getValue: ( { item } ) => item.tags.join( ', ' ), + enableSorting: false, + }, + ], + [] + ); + const { data, paginationInfo } = filterSortAndPaginate( + filtered, + view, + fields + ); + // Detail navigation and printing use the entire filtered/sorted set, not a page. + const ordered = filterSortAndPaginate( + filtered, + { ...view, page: 1, perPage: Math.max( filtered.length, 1 ) }, + fields + ).data; + const position = ordered.findIndex( ( item ) => item.id === detail?.id ); + function step( offset ) { + const next = ordered[ position + offset ]; + if ( next ) { + navigate( { item: next.id } ); + } + } + async function createItem() { + setLoading( true ); + setError( '' ); + try { + const ids = [ + vocabulary.bySlug.get( 'artifact' ).id, + vocabulary.bySlug.get( 'stuff-item' ).id, + ]; + if ( + place && + place !== 'unplaced' && + vocabulary.bySlug.has( place ) + ) { + ids.push( vocabulary.bySlug.get( place ).id ); + } + const item = await apiFetch( { + path: settings.knowledgeRestPath, + method: 'POST', + data: { + title: __( 'Untitled item', 'personal-stuff' ), + content: '', + status: 'private', + [ settings.taxonomyField ]: ids, + }, + } ); + onSaved( item ); + setAddingId( item.id ); + setEditing( item ); + } catch ( failure ) { + setError( failure.message ); + } finally { + setLoading( false ); + } + } + function onSaved( item ) { + setItems( ( current ) => + current.some( ( row ) => row.id === item.id ) + ? current.map( ( row ) => ( row.id === item.id ? item : row ) ) + : [ item, ...current ] + ); + } + useEffect( () => { + if ( ! printing ) { + return; + } + let cancelled = false; + let timeout; + const finish = () => setPrinting( false ); + window.addEventListener( 'afterprint', finish ); + Promise.race( [ + Promise.all( + Array.from( + document.querySelectorAll( '.stuff-print img' ) + ).map( ( image ) => { + image.loading = 'eager'; + return image.decode().catch( () => {} ); + } ) + ), + new Promise( ( resolve ) => { + timeout = window.setTimeout( resolve, 10000 ); + } ), + ] ).then( () => { + window.clearTimeout( timeout ); + if ( ! cancelled ) { + window.print(); + setPrinting( false ); + } + } ); + return () => { + cancelled = true; + window.clearTimeout( timeout ); + window.removeEventListener( 'afterprint', finish ); + }; + }, [ printing ] ); + return ( +
+
+
+

+ { __( 'PERSONAL INVENTORY', 'personal-stuff' ) } +

+

{ __( 'Stuff', 'personal-stuff' ) }

+

+ { __( 'Everything in its place.', 'personal-stuff' ) } +

+
+
+ + { settings.canManageTerms && ( + + ) } + +
+
+ { error && ( + setError( '' ) }> + { error } + + ) } +
+ + + navigate( { q: value, item: '' }, true ) + } + /> + +
+ + + + + + { sprintf( + // translators: %d: number of matching inventory items. + _n( + '%d item', + '%d items', + filtered.length, + 'personal-stuff' + ), + filtered.length + ) } + + + + + } + data={ data } + fields={ fields } + view={ view } + onChangeView={ setView } + paginationInfo={ paginationInfo } + defaultLayouts={ { + grid: { layout: {} }, + list: {}, + table: {}, + } } + getItemId={ ( item ) => String( item.id ) } + isLoading={ loading } + search={ false } + actions={ [ + { + id: 'edit', + label: __( 'Edit item', 'personal-stuff' ), + icon: edit, + isPrimary: true, + callback: ( rows ) => setEditing( rows[ 0 ] ), + }, + ] } + onClickItem={ ( item ) => navigate( { item: item.id } ) } + isItemClickable={ () => true } + /> + { loading && } + { ! loading && route.has( 'item' ) && ! detail && ( + + { __( + 'This item is unavailable. It may have been trashed or you may not have access.', + 'personal-stuff' + ) } + + ) } + { detail && ! editing && ( + navigate( { item: '' } ) } + > +
+ + + { position >= 0 + ? `${ position + 1 } / ${ ordered.length }` + : __( + 'Outside current filter', + 'personal-stuff' + ) } + + + + +
+
+ { termIds( detail ) + .map( ( id ) => vocabulary.byId.get( id ) ) + .filter( + ( term ) => + term && + ( vocabulary.below( + term, + 'stuff-places' + ) || + vocabulary.below( term, 'stuff-tags' ) ) + ) + .map( ( term ) => ( + + ) ) } +
+ +
{ + if ( event.target.tagName === 'IMG' ) { + event.target.alt = __( + 'Photo unavailable. Edit this item to update its image source.', + 'personal-stuff' + ); + } + } } + onTouchStart={ ( event ) => { + touch.current = [ + event.touches[ 0 ].clientX, + event.touches[ 0 ].clientY, + ]; + } } + onTouchEnd={ ( event ) => { + if ( ! touch.current ) { + return; + } + const dx = + event.changedTouches[ 0 ].clientX - + touch.current[ 0 ]; + const dy = + event.changedTouches[ 0 ].clientY - + touch.current[ 1 ]; + if ( Math.abs( dx ) > 90 && Math.abs( dy ) < 50 ) { + step( dx < 0 ? 1 : -1 ); + } + touch.current = null; + } } + > + { detail.content.rendered } +
+
+ ) } + { editing && ( + { + setEditing( null ); + setAddingId( null ); + } } + /> + ) } + { managing && ( + setManaging( false ) } + /> + ) } + { printing && ( +
+

{ __( 'Stuff', 'personal-stuff' ) }

+

+ { [ search, place, tag, photo === 'all' ? '' : photo ] + .filter( Boolean ) + .join( ' · ' ) } +

+ { ordered.map( ( item ) => ( +
+

{ item.name }

+

+ { item.location } { item.tags.join( ', ' ) } +

+ { item.content.rendered } +
+ ) ) } +
+ ) } + +
+ ); +} + +const mount = document.getElementById( 'personal-stuff-app' ); +if ( mount ) { + createRoot( mount ).render( ); +} diff --git a/packages/personal-stuff/src/search.js b/packages/personal-stuff/src/search.js new file mode 100644 index 0000000..b947fa5 --- /dev/null +++ b/packages/personal-stuff/src/search.js @@ -0,0 +1,126 @@ +// Adapted from Artur Piszek's Stuff search index. +const normalizeSearchText = ( value = '' ) => + String( value ) + .normalize( 'NFD' ) + .replace( /[\u0300-\u036f]/g, '' ) + .replace( /ł/g, 'l' ) + .replace( /Ł/g, 'L' ) + .toLowerCase() + .replace( /\s+/g, ' ' ) + .trim(); +const parseTags = ( value ) => + Array.isArray( value ) ? value : String( value || '' ).split( ',' ); + +function boundedDistance( left, right, maximum = 2 ) { + if ( Math.abs( left.length - right.length ) > maximum ) return maximum + 1; + const previous = Array.from( + { length: right.length + 1 }, + ( _, index ) => index + ); + for ( let leftIndex = 1; leftIndex <= left.length; leftIndex += 1 ) { + const current = [ leftIndex ]; + let rowMinimum = current[ 0 ]; + for ( + let rightIndex = 1; + rightIndex <= right.length; + rightIndex += 1 + ) { + const insertion = current[ rightIndex - 1 ] + 1; + const deletion = previous[ rightIndex ] + 1; + const substitution = + previous[ rightIndex - 1 ] + + ( left[ leftIndex - 1 ] === right[ rightIndex - 1 ] ? 0 : 1 ); + current[ rightIndex ] = Math.min( + insertion, + deletion, + substitution + ); + rowMinimum = Math.min( rowMinimum, current[ rightIndex ] ); + } + if ( rowMinimum > maximum ) return maximum + 1; + previous.splice( 0, previous.length, ...current ); + } + return previous[ right.length ]; +} + +function tokenMatches( queryToken, candidateToken ) { + if ( candidateToken === queryToken ) return 1; + if ( candidateToken.startsWith( queryToken ) ) return 0.82; + if ( candidateToken.includes( queryToken ) ) return 0.64; + if ( + queryToken.length >= 4 && + boundedDistance( queryToken, candidateToken, 2 ) <= 2 + ) + return 0.48; + return 0; +} + +function fieldScore( query, tokens, field, weight ) { + if ( ! field ) return 0; + if ( field === query ) return weight * 1.5; + if ( field.startsWith( query ) ) return weight * 1.25; + const candidates = field.split( ' ' ); + return tokens.reduce( ( score, token ) => { + const best = candidates.reduce( + ( maximum, candidate ) => + Math.max( maximum, tokenMatches( token, candidate ) ), + 0 + ); + return score + best * weight; + }, 0 ); +} + +export class SearchIndex { + #entries = []; + + rebuild( items, placesById = new Map() ) { + this.#entries = items.map( ( item, order ) => { + const place = placesById.get( item.placeId ); + const location = normalizeSearchText( + item.location || place?.path || '' + ); + return { + item, + order, + name: normalizeSearchText( item.name ), + description: normalizeSearchText( item.description ), + tags: normalizeSearchText( parseTags( item.tags ).join( ' ' ) ), + location, + }; + } ); + } + + search( query, { placeIds = null, photo = 'all' } = {} ) { + const normalized = normalizeSearchText( query ); + const tokens = normalized ? normalized.split( ' ' ) : []; + return this.#entries + .filter( + ( { item } ) => ! placeIds || placeIds.has( item.placeId ) + ) + .filter( + ( { item } ) => + photo === 'all' || + ( photo === 'with' + ? Number( item.photoCount ) > 0 + : Number( item.photoCount ) === 0 ) + ) + .map( ( entry ) => ( { + item: entry.item, + order: entry.order, + score: normalized + ? fieldScore( normalized, tokens, entry.name, 12 ) + + fieldScore( normalized, tokens, entry.tags, 8 ) + + fieldScore( normalized, tokens, entry.location, 6 ) + + fieldScore( normalized, tokens, entry.description, 3 ) + : 1, + } ) ) + .filter( ( { score } ) => score > 0 ) + .sort( + ( left, right ) => + right.score - left.score || left.order - right.order + ) + .map( ( { item } ) => item ); + } +} + +export { boundedDistance }; diff --git a/packages/personal-stuff/src/style.css b/packages/personal-stuff/src/style.css new file mode 100644 index 0000000..93fd867 --- /dev/null +++ b/packages/personal-stuff/src/style.css @@ -0,0 +1,761 @@ +@import "@wordpress/dataviews/build-style/style.css?personal-stuff"; + +body.wp-app-body.personalos-wp-app-body.personalos-wp-app-stuff { + --wp-app-color-background: #f6f5f1; + --wp-app-color-surface: #fffefa; + --wp-app-color-surface-alt: #eeede6; + --wp-app-color-text: #233a34; + --wp-app-color-muted: #64726b; + --wp-app-color-border: #dcded5; + --wp-app-color-accent: #29634e; + --wp-admin-theme-color: #29634e; + --wp-admin-theme-color--rgb: 41, 99, 78; + --wp-components-color-accent: #29634e; + --wp-components-color-accent-inverted: #fff; + --wp-components-color-foreground: var(--wp-app-color-text); + --wp-components-color-background: var(--wp-app-color-surface); + + /* WpApp also offsets the document for its masterbar. */ + margin: 0 !important; + color: var(--wp-app-color-text); +} + +@media (prefers-color-scheme: dark) { + + body.wp-app-body.personalos-wp-app-body.personalos-wp-app-stuff { + --wp-app-color-background: #141d19; + --wp-app-color-surface: #1d2822; + --wp-app-color-surface-alt: #26342c; + --wp-app-color-text: #edf1e7; + --wp-app-color-muted: #acb9ae; + --wp-app-color-border: #37473c; + --wp-app-color-accent: #b9d9a1; + --wp-admin-theme-color: #b9d9a1; + --wp-admin-theme-color--rgb: 185, 217, 161; + --wp-components-color-accent: #b9d9a1; + --wp-components-color-accent-inverted: #18251d; + } +} + +.personalos-wp-app-stuff .personalos-wp-app-main { + max-width: 1320px; + padding: 32px 40px; +} + +.personal-stuff { + max-width: 1320px; + margin: auto; + color: var(--wp-app-color-text); +} + +.stuff-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; + margin-bottom: 28px; +} + +.personal-stuff .stuff-header h1 { + color: var(--wp-app-color-text); + font-size: 52px; + font-weight: 550; + letter-spacing: -2.5px; + line-height: 1.1; + margin: 0; +} + +.stuff-header p { + color: var(--wp-app-color-muted); + margin: 8px 0 0; +} + +.stuff-header .stuff-eyebrow { + font-size: 10px; + font-weight: 600; + letter-spacing: 2px; + margin: 0 0 10px; +} + +.stuff-toolbar { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + margin: 12px 0; +} + +.personalos-wp-app-stuff .components-button { + border-radius: 8px; +} + +.personalos-wp-app-stuff .components-button.is-primary { + background: var(--wp-app-color-accent); + color: var(--wp-components-color-accent-inverted); +} + +.personalos-wp-app-stuff .components-button.is-secondary { + color: var(--wp-app-color-accent); + box-shadow: inset 0 0 0 1px var(--wp-app-color-border); +} + + +.stuff-search-row { + display: flex; + align-items: center; + gap: 12px; + padding: 8px 12px 8px 20px; + background: var(--wp-app-color-surface); + border: 1px solid var(--wp-app-color-border); + border-radius: 14px; + box-shadow: 0 3px 12px #00000004; +} + +.stuff-search-row > svg { + flex-shrink: 0; + fill: var(--wp-app-color-muted); +} + +.stuff-search-row .components-base-control { + flex: 1; + min-width: 0; + margin: 0; +} + +.stuff-search-row .components-base-control__field { + margin: 0; +} + +.personalos-wp-app-stuff .stuff-search-row input[type="text"] { + background: transparent; + border: 0; + box-shadow: none; + font-size: 18px; + padding: 8px 0; + min-height: 40px; +} + +.personalos-wp-app-stuff .stuff-search-row input[type="text"]:focus { + box-shadow: 0 2px 0 var(--wp-app-color-accent); +} + +.stuff-filter-dot { + width: 6px; + height: 6px; + background: var(--wp-app-color-accent); + border-radius: 50%; + margin-left: 6px; +} + +.stuff-filters { + display: grid; + grid-template-columns: 2fr 1fr 1fr; + gap: 16px; + padding: 20px; + margin-top: 8px; + background: var(--wp-app-color-surface); + border: 1px solid var(--wp-app-color-border); + border-radius: 12px; +} + +.stuff-filters[hidden] { + display: none; +} + +.stuff-filters .components-base-control { + margin: 0; +} + +.stuff-places { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 4px; + padding: 14px 0 8px; + font-size: 13px; +} + +.personal-stuff .stuff-places a { + color: var(--wp-app-color-muted); + padding: 8px 10px; + text-decoration: none; + border-radius: 6px; +} + +.stuff-places [aria-current="location"] { + font-weight: 600; + color: var(--wp-app-color-text); +} + +.stuff-place-crumb { + display: inline-flex; + align-items: center; +} + +.stuff-place-children { + display: flex; + flex-wrap: wrap; + gap: 6px; + border-left: 1px solid var(--wp-app-color-border); + padding-left: 12px; + margin-left: 10px; +} + +.stuff-place-children:empty { + display: none; +} + +.stuff-place-children .components-button { + background: var(--wp-app-color-surface-alt); + height: 32px; +} + +.stuff-count { + flex: 1; + order: -1; + justify-content: flex-end; + margin: 4px 0; + gap: 0; +} + +.stuff-count .stuff-clear-filters:disabled { + display: none; +} + +.stuff-count > span { + margin-right: auto; + color: var(--wp-app-color-muted); + font-size: 12px; +} + +.personal-stuff .dataviews-wrapper { + background: transparent; +} + +.personal-stuff .dataviews__view-actions { + padding: 0; + margin: 0 0 12px; + min-height: 36px; +} + +.personal-stuff .dataviews-view-grid { + padding: 0 0 24px; + gap: 20px; + grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); +} + +.personal-stuff .dataviews-view-grid__card { + background: var(--wp-app-color-surface); + border: 1px solid var(--wp-app-color-border); + border-radius: 16px; + overflow: hidden; + padding: 8px; + transition: box-shadow 150ms ease; +} + +.personal-stuff .dataviews-view-grid__card:hover { + box-shadow: 0 6px 24px #00000012; +} + +.personal-stuff .dataviews-view-grid__media { + min-height: 0; + border-radius: 10px; + overflow: hidden; + background: var(--wp-app-color-surface-alt); +} + +.personal-stuff .dataviews-view-grid__media::after { + box-shadow: none; +} + +.stuff-blocks img, +.stuff-detail-content img { + max-width: 100%; + height: auto; +} + +.personal-stuff .dataviews-view-grid__media img { + width: 100%; + height: 100%; + object-fit: contain; +} + +.personal-stuff .dataviews-view-grid__title-actions { + padding: 10px 6px 4px; +} + +.personal-stuff .dataviews-title-field { + color: var(--wp-app-color-text); + font-weight: 600; +} + +.personal-stuff .dataviews-view-grid__fields { + padding: 0 6px 8px; +} + +.personal-stuff .dataviews-view-grid__field-name { + display: none; +} + +.personal-stuff .dataviews-view-grid__field-value { + color: var(--wp-app-color-muted); +} + +.stuff-photo-empty { + display: flex; + flex-direction: column; + gap: 12px; + width: 100%; + height: 100%; + min-height: 100px; + align-items: center; + justify-content: center; + color: var(--wp-app-color-muted); + font-size: 12px; + background: radial-gradient(ellipse at center, transparent 30%, #00000005); +} + +.stuff-photo-empty svg { + fill: currentcolor; + opacity: 0.55; +} + +.stuff-editor-modal, +.stuff-detail-modal { + width: min(960px, 92vw); + max-height: 92vh; + border-radius: 18px; + background: var(--wp-app-color-surface); + color: var(--wp-app-color-text); +} + +.stuff-editor-modal .components-modal__header, +.stuff-detail-modal .components-modal__header { + background: var(--wp-app-color-surface); + color: var(--wp-app-color-text); + border-bottom: 1px solid var(--wp-app-color-border); +} + +.stuff-editor-modal .components-modal__content { + padding-bottom: 0; +} + +.stuff-editor-modal fieldset { + border: 0; + padding: 0; + margin: 0; + min-width: 0; +} + +.stuff-item-fields > .components-base-control { + margin-bottom: 20px; +} + +.stuff-item-name input { + font-size: 22px; + font-weight: 500; + min-height: 48px; +} + +.stuff-photo-actions { + align-items: center; +} + +.stuff-file { + position: relative; + display: flex; + flex-direction: column; + flex: 1; + align-items: center; + gap: 8px; + padding: 24px 16px; + border: 1px dashed var(--wp-app-color-accent); + color: var(--wp-app-color-text); + background: var(--wp-app-color-surface-alt); + border-radius: 12px; + cursor: pointer; + text-align: center; +} + +.stuff-file:focus-within { + outline: 2px solid var(--wp-app-color-accent); + outline-offset: 3px; +} + +.stuff-file svg { + fill: var(--wp-app-color-accent); +} + +.stuff-file span { + font-size: 12px; + color: var(--wp-app-color-muted); +} + +.stuff-file input { + position: absolute; + inset: 0; + opacity: 0; + width: 100%; + height: 100%; + cursor: pointer; +} + +.stuff-editor-modal details { + padding: 8px 0; +} + +.stuff-editor-modal summary { + cursor: pointer; + margin-bottom: 8px; + font-size: 13px; +} + +.stuff-block-layout { + display: flex; + gap: 20px; +} + +.stuff-block-layout aside { + width: 280px; + flex-shrink: 0; +} + +.stuff-blocks { + background: #fff; + color: #1e1e1e; + min-height: 160px; + border: 1px solid var(--wp-app-color-border); + border-radius: 10px; + flex: 1; + min-width: 0; + padding: 24px; +} + +.stuff-blocks .block-editor-writing-flow { + min-height: 100px; +} + +.stuff-detail-content { + margin-top: 24px; +} + +.stuff-hint { + font-size: 12px; + color: var(--wp-app-color-muted); + line-height: 1.6; +} + +.stuff-editor-footer { + position: sticky; + bottom: 0; + z-index: 30; + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + background: var(--wp-app-color-surface); + border-top: 1px solid var(--wp-app-color-border); + margin-top: 24px; + padding: 8px 0 max(8px, env(safe-area-inset-bottom)); +} + +.stuff-save-status { + font-size: 12px; + color: var(--wp-app-color-muted); +} + +.stuff-print { + position: absolute; + left: -100000px; + top: 0; + width: 800px; +} + +.personalos-wp-app-stuff .components-button:not(.is-primary):not(.is-secondary):not(.is-destructive) { + color: var(--wp-app-color-text); +} + +@media (prefers-reduced-motion: reduce) { + + .personal-stuff .dataviews-view-grid__card { + transition: none; + } +} + +@media (max-width: 700px) { + + .personalos-wp-app-stuff .personalos-wp-app-main { + padding: 20px 16px; + } + + .stuff-header { + align-items: center; + gap: 12px; + margin-bottom: 20px; + } + + .personal-stuff .stuff-header h1 { + font-size: 36px; + letter-spacing: -1.5px; + } + + .stuff-header p:not(.stuff-eyebrow), + .stuff-refresh { + display: none; + } + + .stuff-header .stuff-eyebrow { + font-size: 8px; + letter-spacing: 1px; + margin-bottom: 6px; + } + + .stuff-header > .stuff-toolbar { + justify-content: flex-end; + gap: 4px; + margin: 0; + } + + .stuff-header .components-button { + font-size: 12px; + padding: 6px 10px; + } + + .stuff-search-row { + gap: 8px; + padding: 6px 8px 6px 12px; + } + + .personalos-wp-app-stuff .stuff-search-row input[type="text"] { + font-size: 16px; + } + + .stuff-filters { + grid-template-columns: 1fr 1fr; + padding: 16px; + gap: 12px; + } + + .stuff-filters > :first-child { + grid-column: 1 / -1; + } + + .personal-stuff .dataviews-view-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + } + + .personal-stuff .dataviews-view-grid__card { + border-radius: 12px; + padding: 5px; + } + + .personal-stuff .dataviews-view-grid__title-actions { + padding: 6px 2px 2px; + } + + .personal-stuff .dataviews-view-grid__fields { + padding: 0 2px 4px; + } + + .personal-stuff .dataviews-view-grid__title-field { + font-size: 13px; + } + + .personal-stuff .dataviews-view-grid__media { + min-height: 0; + } + + .stuff-editor-modal.components-modal__frame, + .stuff-detail-modal.components-modal__frame { + position: fixed; + inset: 0; + width: 100%; + max-width: none; + height: 100dvh; + max-height: none; + margin: 0; + border: 0; + border-radius: 0; + transform: none; + } + + .stuff-editor-modal .components-modal__content, + .stuff-detail-modal .components-modal__content { + padding-left: 16px; + padding-right: 16px; + overscroll-behavior: contain; + } + + .stuff-editor-modal .components-modal__header, + .stuff-detail-modal .components-modal__header { + padding-left: 16px; + padding-right: 16px; + } + + .personalos-wp-app-stuff input, + .personalos-wp-app-stuff select, + .personalos-wp-app-stuff textarea, + .stuff-editor-modal [contenteditable="true"] { + font-size: 16px; + } + + .stuff-item-name input { + font-size: 20px; + } + + .stuff-photo-actions { + flex-direction: column; + align-items: stretch; + } + + .stuff-file { + padding: 20px 16px; + } + + .stuff-photo-actions > .components-button { + align-self: center; + } + + .stuff-block-layout { + flex-direction: column; + } + + .stuff-block-layout aside { + width: 100%; + } + + .stuff-blocks { + padding: 16px; + } + + .stuff-editor-footer .components-button { + min-height: 44px; + } +} + +@media print { + + html:root, + body.wp-app-body.personalos-wp-app-body.personalos-wp-app-stuff { + margin: 0 !important; + min-height: 0 !important; + height: auto !important; + background: #fff; + } + + .personal-stuff > :not(.stuff-print), + #wpadminbar { + display: none !important; + } + + .personalos-wp-app-stuff .personalos-wp-app-main { + padding: 0; + max-width: none; + } + + body * { + visibility: hidden; + } + + .stuff-print, + .stuff-print * { + visibility: visible; + } + + .stuff-print { + position: static; + width: 100%; + color: #111; + background: #fff; + } + + .stuff-print article { + break-inside: avoid; + border-bottom: 1px solid #ccc; + padding-bottom: 20px; + } + + .stuff-print img { + max-width: 200px; + max-height: 160px; + object-fit: contain; + } + + .stuff-print .wp-block-gallery { + display: flex; + flex-wrap: wrap; + gap: 12px; + margin: 12px 0; + } + + .stuff-print .wp-block-image { + margin: 0; + flex: 0 1 200px; + } +} + +body.personalos-wp-app-stuff.modal-open #wpadminbar { + display: none; +} + +.personalos-wp-app-stuff .stuff-hint a { + color: var(--wp-app-color-accent); +} + +@media screen { + + html:has(body.personalos-wp-app-stuff) { + background: #f6f5f1; + } +} + +@media screen and (prefers-color-scheme: dark) { + + html:has(body.personalos-wp-app-stuff) { + background: #141d19; + } +} + +.personal-stuff .dataviews-view-grid__title-field { + min-width: 0; + flex: 1; +} + +.personal-stuff .dataviews-view-grid__title-field .dataviews-title-field { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: block; +} + +@media (max-width: 700px) { + + .stuff-manage span { + display: none; + } + + .stuff-header .stuff-manage { + padding: 8px; + min-width: 40px; + } +} + +.stuff-editor-modal .components-modal__header-heading, +.stuff-detail-modal .components-modal__header-heading { + color: var(--wp-app-color-text); +} + +.stuff-content-toolbar strong { + margin-right: auto; + font-size: 13px; +} + +.personal-stuff .dataviews__view-actions > :last-child { + flex: 1; + min-width: 0; +} + +.stuff-detail-content .wp-block-gallery img { + object-fit: contain; +} diff --git a/packages/personal-stuff/src/test/content.test.js b/packages/personal-stuff/src/test/content.test.js new file mode 100644 index 0000000..77c93bf --- /dev/null +++ b/packages/personal-stuff/src/test/content.test.js @@ -0,0 +1,106 @@ +import { registerCoreBlocks } from '@wordpress/block-library'; +import { parse, serialize } from '@wordpress/blocks'; +import { parse as parseMarkup } from '@wordpress/block-serialization-default-parser'; +import { appendPhotos, contentSession, itemContent } from '../content'; +import { SearchIndex } from '../search'; + +beforeAll( () => registerCoreBlocks() ); + +test( 'title and taxonomy edits leave original content untouched', () => { + const raw = + '\n

Camera kit

\n\n\n'; + const session = contentSession( raw ); + expect( session.serialize( session.blocks ) ).toBe( raw ); + const next = session.blocks.map( ( block, i ) => + i === 0 + ? { + ...block, + attributes: { + ...block.attributes, + content: 'Changed description', + }, + } + : block + ); + const saved = session.serialize( next ); + const preserved = parseMarkup( saved ).find( + ( block ) => block.blockName === 'vendor/unknown' + ); + expect( preserved.attrs ).toEqual( { value: 42 } ); + expect( preserved.innerHTML.trim() ).toBe( '' ); + expect( saved ).toContain( '

Changed description

' ); +} ); + +test( 'photos serialize as native galleries and order determines cover', () => { + const blocks = appendPhotos( + [], + [ + { id: 4, source_url: 'https://example.org/a.jpg' }, + { id: 5, source_url: 'https://example.org/b.jpg' }, + ] + ); + const raw = serialize( blocks ); + expect( raw ).toContain( '\n

Old description

\n\n\n' + + serialize( + appendPhotos( + [], + [ { id: 4, source_url: 'https://example.org/a.jpg' } ] + ) + ); + const session = contentSession( raw ); + const next = session.blocks.map( ( block, i ) => + i === 0 + ? { + ...block, + attributes: { + ...block.attributes, + content: 'New description', + }, + } + : block + ); + expect( + parse( session.serialize( next ) )[ 1 ].innerBlocks[ 0 ].attributes.id + ).toBe( 4 ); +} ); + +test( 'search normalizes accents and searches ancestor paths with typo tolerance', () => { + const index = new SearchIndex(); + index.rebuild( [ + { + name: 'Łódź camera', + location: 'Home / Garage / Box', + tags: [ 'travel' ], + description: '', + photoCount: 1, + placeId: 4, + }, + ] ); + expect( index.search( 'lodz' ) ).toHaveLength( 1 ); + expect( index.search( 'camra' ) ).toHaveLength( 1 ); + expect( index.search( 'garage' ) ).toHaveLength( 1 ); + expect( index.search( 'camera', { photo: 'without' } ) ).toHaveLength( 0 ); + expect( + index.search( 'camera', { placeIds: new Set( [ 8 ] ) } ) + ).toHaveLength( 0 ); +} ); diff --git a/packages/personal-stuff/templates/index.php b/packages/personal-stuff/templates/index.php new file mode 100644 index 0000000..b20b7b8 --- /dev/null +++ b/packages/personal-stuff/templates/index.php @@ -0,0 +1,8 @@ +svg { +.dataviews-view-table__actions-column button.has-icon > svg { width: 24px; height: 24px; } + .pos__todo-form { margin-bottom: 10px; } -.pos__todo-form .components-datetime__date, .pos__todo-form .components-base-control { +.pos__todo-form .components-datetime__date, +.pos__todo-form .components-base-control { width: 100%; } -.components-panel__row.wide>div { +.components-panel__row.wide > div { width: 100%; } -.pos__todo-form-recurring .components-input-control__prefix, .pos__todo-form-recurring .components-input-control__suffix { +.pos__todo-form-recurring .components-input-control__prefix, +.pos__todo-form-recurring .components-input-control__suffix { display: flex; color: rgb(117, 117, 117); } + .pos__todo-form-recurring input { flex-basis: 60%; text-align: center; } + .pos__todo-edit { background: #f0f0f0; padding-top: 20px; padding-right: 20px; -} \ No newline at end of file +} diff --git a/src/notes/blocks/note/index.css b/src/notes/blocks/note/index.css index 0c29903..1e003ac 100644 --- a/src/notes/blocks/note/index.css +++ b/src/notes/blocks/note/index.css @@ -1,17 +1,17 @@ .wp-block-pos-note { - background-color: #f3f3f3; - border-radius: 0.5em; + background-color: #f3f3f3; + border-radius: 0.5em; } .wp-block-pos-note__title { - font-size: .75em; - margin: 0; - padding: 0.5em; - font-style: oblique; - border: 1px solid #c0c6c9; - border-radius: 0.5em; + font-size: 0.75em; + margin: 0; + padding: 0.5em; + font-style: oblique; + border: 1px solid #c0c6c9; + border-radius: 0.5em; } .block-editor-block-list__layout { - padding: 0 .5em .5em .5em; -} \ No newline at end of file + padding: 0 0.5em 0.5em 0.5em; +} diff --git a/src/openai/blocks/message/index.css b/src/openai/blocks/message/index.css index 6b5c2d5..c9d0ccf 100644 --- a/src/openai/blocks/message/index.css +++ b/src/openai/blocks/message/index.css @@ -78,6 +78,7 @@ .wp-block-pos-ai-message .markdown-content { word-wrap: break-word; overflow-wrap: break-word; + cursor: text; } .wp-block-pos-ai-message .markdown-content h1, @@ -91,24 +92,15 @@ line-height: 1.3; } -.wp-block-pos-ai-message .markdown-content h1:first-child, -.wp-block-pos-ai-message .markdown-content h2:first-child, -.wp-block-pos-ai-message .markdown-content h3:first-child, -.wp-block-pos-ai-message .markdown-content h4:first-child, -.wp-block-pos-ai-message .markdown-content h5:first-child, -.wp-block-pos-ai-message .markdown-content h6:first-child { - margin-top: 0; -} - .wp-block-pos-ai-message .markdown-content h1 { font-size: 1.5em; - border-bottom: 2px solid currentColor; + border-bottom: 2px solid currentcolor; padding-bottom: 4px; } .wp-block-pos-ai-message .markdown-content h2 { font-size: 1.3em; - border-bottom: 1px solid currentColor; + border-bottom: 1px solid currentcolor; padding-bottom: 2px; } @@ -125,6 +117,15 @@ font-size: 1em; } +.wp-block-pos-ai-message .markdown-content h1:first-child, +.wp-block-pos-ai-message .markdown-content h2:first-child, +.wp-block-pos-ai-message .markdown-content h3:first-child, +.wp-block-pos-ai-message .markdown-content h4:first-child, +.wp-block-pos-ai-message .markdown-content h5:first-child, +.wp-block-pos-ai-message .markdown-content h6:first-child { + margin-top: 0; +} + .wp-block-pos-ai-message .markdown-content ul, .wp-block-pos-ai-message .markdown-content ol { margin: 12px 0; @@ -180,7 +181,7 @@ background: rgba(0, 0, 0, 0.1); padding: 2px 6px; border-radius: 4px; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; font-size: 0.85em; border: 1px solid rgba(0, 0, 0, 0.05); } @@ -193,7 +194,7 @@ padding: 16px; margin: 16px 0; overflow-x: auto; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; font-size: 0.85em; line-height: 1.5; white-space: pre; @@ -232,7 +233,7 @@ } .wp-block-pos-ai-message .markdown-content blockquote { - border-left: 4px solid currentColor; + border-left: 4px solid currentcolor; margin: 16px 0; padding-left: 16px; font-style: italic; @@ -286,12 +287,12 @@ .wp-block-pos-ai-message.message-role-user .message-role-icon { background: #3b82f6; - color: white; + color: #fff; } .wp-block-pos-ai-message.message-role-user .message-content { background: #3b82f6; - color: white; + color: #fff; border-color: #2563eb; margin-left: 32px; } @@ -334,7 +335,7 @@ .wp-block-pos-ai-message.message-role-assistant .message-role-icon { background: #10b981; - color: white; + color: #fff; } .wp-block-pos-ai-message.message-role-assistant .message-content { @@ -369,7 +370,7 @@ .wp-block-pos-ai-message.message-role-system .message-role-icon { background: #f59e0b; - color: white; + color: #fff; } .wp-block-pos-ai-message.message-role-system .message-content { @@ -404,6 +405,10 @@ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); } +.wp-block-pos-ai-message.is-selected .message-content { + transform: translateY(-1px); +} + .wp-block-pos-ai-message.message-role-user:hover .message-content { box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3); } @@ -417,9 +422,6 @@ } /* Selected state */ -.wp-block-pos-ai-message.is-selected .message-content { - transform: translateY(-1px); -} .wp-block-pos-ai-message.is-selected.message-role-user .message-content { box-shadow: 0 0 0 2px #3b82f6, 0 4px 12px rgba(59, 130, 246, 0.4); @@ -435,15 +437,16 @@ /* Mobile responsiveness */ @media (max-width: 768px) { + .wp-block-pos-ai-message { margin: 12px 0; } - + .wp-block-pos-ai-message .message-content { padding: 10px 14px; font-size: 13px; } - + .wp-block-pos-ai-message.message-role-user .message-content { margin-left: 24px; } @@ -486,7 +489,7 @@ padding: 0; border: none; background: transparent; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; font-size: 13px; line-height: 1.6; color: inherit; @@ -500,12 +503,9 @@ } /* Click-to-edit hint */ -.wp-block-pos-ai-message .markdown-content { - cursor: text; -} .wp-block-pos-ai-message.is-selected .markdown-content:not(:has(textarea))::after { - content: 'Click to edit'; + content: "Click to edit"; position: absolute; bottom: 8px; right: 12px; @@ -513,4 +513,4 @@ opacity: 0.4; font-style: italic; pointer-events: none; -} \ No newline at end of file +} diff --git a/src/readwise/blocks/book-summary/index.css b/src/readwise/blocks/book-summary/index.css index e675d3c..73bc3a4 100644 --- a/src/readwise/blocks/book-summary/index.css +++ b/src/readwise/blocks/book-summary/index.css @@ -1,3 +1,3 @@ .pos-book-summary__panel { - padding: 10px; -} \ No newline at end of file + padding: 10px; +} diff --git a/src/readwise/blocks/readwise/index.css b/src/readwise/blocks/readwise/index.css index 470da4b..fe967e7 100644 --- a/src/readwise/blocks/readwise/index.css +++ b/src/readwise/blocks/readwise/index.css @@ -1,6 +1,6 @@ .wp-block-pos-readwise { - background-color: rgb(255, 255, 255); - border-radius: 20px; - padding: 20px; - font-style: oblique; + background-color: rgb(255, 255, 255); + border-radius: 20px; + padding: 20px; + font-style: oblique; } diff --git a/tests/unit/PersonalStuffTest.php b/tests/unit/PersonalStuffTest.php new file mode 100644 index 0000000..55f98d6 --- /dev/null +++ b/tests/unit/PersonalStuffTest.php @@ -0,0 +1,128 @@ + false, 'show_in_rest' => true, 'rest_base' => 'knowledge', 'supports' => array( 'title', 'editor', 'custom-fields' ) ) ); + } + if ( ! taxonomy_exists( 'wp_knowledge_type' ) ) { + register_taxonomy( 'wp_knowledge_type', 'wp_knowledge', array( 'hierarchical' => true, 'show_in_rest' => true ) ); + } + wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); + $this->plugin = new Personal_Stuff_Plugin(); + $this->ids = $this->plugin->ensure_terms(); + } + + private function item( $content = '' ) { + $id = self::factory()->post->create( array( 'post_type' => 'wp_knowledge', 'post_status' => 'private', 'post_author' => get_current_user_id(), 'post_content' => $content ) ); + wp_set_object_terms( $id, array( $this->ids['artifact'], $this->ids['stuff-item'] ), 'wp_knowledge_type' ); + return $id; + } + + public function test_terms_are_idempotent_raw_terms_without_plugin_options() { + global $wpdb; + $before = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'personal_stuff_%'" ); + $place = wp_insert_term( 'Garage', 'wp_knowledge_type', array( 'parent' => $this->ids['stuff-places'], 'description' => 'Raw term description' ) ); + $this->assertSame( $this->ids, $this->plugin->ensure_terms() ); + $this->assertSame( 0, (int) get_term( $this->ids['stuff'], 'wp_knowledge_type' )->parent ); + foreach ( array( 'stuff-item', 'stuff-places', 'stuff-tags' ) as $slug ) { + $this->assertSame( $this->ids['stuff'], (int) get_term( $this->ids[ $slug ], 'wp_knowledge_type' )->parent ); + } + $this->assertSame( 'Raw term description', get_term( $place['term_id'], 'wp_knowledge_type' )->description ); + $this->assertSame( array(), get_term_meta( $place['term_id'] ) ); + $this->assertSame( $before, $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'personal_stuff_%'" ) ); + } + + public function test_provisioning_can_be_deferred_until_knowledge_exists() { + unregister_taxonomy( 'wp_knowledge_type' ); + $this->assertSame( array(), $this->plugin->ensure_terms() ); + register_taxonomy( 'wp_knowledge_type', 'wp_knowledge', array( 'hierarchical' => true, 'show_in_rest' => true ) ); + $this->assertCount( 5, $this->plugin->ensure_terms() ); + } + + public function test_editor_selection_coexists_with_notes_for_empty_and_block_items() { + $notes = new Personal_Notes_Plugin(); + add_filter( 'use_block_editor_for_post', array( $notes, 'use_block_editor_for_knowledge_post' ), 10, 2 ); + add_filter( 'use_block_editor_for_post', array( $this->plugin, 'use_item_editor' ), 20, 2 ); + $this->assertTrue( use_block_editor_for_post( $this->item() ) ); + $this->assertTrue( use_block_editor_for_post( $this->item( '

Camera

' ) ) ); + $plain = self::factory()->post->create( array( 'post_type' => 'wp_knowledge', 'post_content' => '# Markdown' ) ); + $this->assertFalse( use_block_editor_for_post( $plain ) ); + $block = self::factory()->post->create( array( 'post_type' => 'wp_knowledge', 'post_content' => '

Note

' ) ); + $this->assertTrue( use_block_editor_for_post( $block ) ); + } + + public function test_upload_names_are_random_only_for_authorized_item_context() { + $file = array( 'name' => 'secret-camera.JPG', 'type' => 'image/jpeg', 'tmp_name' => '/tmp/example', 'error' => 0 ); + $request = new WP_REST_Request( 'POST', '/wp/v2/media' ); + $request->set_param( 'post', $this->item() ); + $this->plugin->begin_upload( null, array(), $request ); + $first = $this->plugin->randomize_upload( $file ); + $this->assertMatchesRegularExpression( '/^[a-f0-9]{32}\.jpg$/', $first['name'] ); + $this->assertNotSame( $first['name'], $this->plugin->randomize_upload( $file )['name'] ); + $this->assertNotEmpty( $this->plugin->randomize_upload( array_merge( $file, array( 'name' => 'secret.php' ) ) )['error'] ); + wp_set_current_user( 0 ); + $this->assertSame( $file, $this->plugin->randomize_upload( $file ) ); + $this->plugin->end_upload( null, array(), $request ); + $this->assertSame( $file, $this->plugin->randomize_upload( $file ) ); + } + + public function test_core_rest_creates_private_item_and_preserves_content_and_unrelated_terms() { + $server = rest_get_server(); + do_action( 'rest_api_init', $server ); + $extra = wp_insert_term( 'Other consumer', 'wp_knowledge_type', array( 'slug' => 'other-consumer' ) ); + $raw = '

Description

' . "\n\n" . ''; + $request = new WP_REST_Request( 'POST', '/wp/v2/knowledge' ); + $request->set_body_params( array( 'title' => 'Camera', 'status' => 'private', 'content' => $raw, 'wp_knowledge_type' => array( $this->ids['artifact'], $this->ids['stuff-item'], $extra['term_id'] ) ) ); + $response = $server->dispatch( $request ); + $this->assertSame( 201, $response->get_status() ); + $id = $response->get_data()['id']; + $this->assertTrue( $this->plugin->is_item( $id ) ); + $update = new WP_REST_Request( 'POST', '/wp/v2/knowledge/' . $id ); + $update->set_param( 'title', 'Renamed camera' ); + $this->assertSame( 200, $server->dispatch( $update )->get_status() ); + $this->assertSame( $raw, get_post( $id )->post_content ); + $this->assertSame( 'private', get_post_status( $id ) ); + $this->assertTrue( has_term( 'other-consumer', 'wp_knowledge_type', $id ) ); + wp_set_current_user( 0 ); + $read = new WP_REST_Request( 'GET', '/wp/v2/knowledge/' . $id ); + $this->assertSame( 401, $server->dispatch( $read )->get_status() ); + } + + public function test_raw_media_upload_and_generated_sizes_keep_random_basename() { + add_filter( 'rest_request_before_callbacks', array( $this->plugin, 'begin_upload' ), 10, 3 ); + add_filter( 'rest_request_after_callbacks', array( $this->plugin, 'end_upload' ), 10, 3 ); + add_filter( 'wp_handle_sideload_prefilter', array( $this->plugin, 'randomize_upload' ) ); + $request = new WP_REST_Request( 'POST', '/wp/v2/media' ); + $request->set_param( 'post', $this->item() ); + $request->set_header( 'Content-Type', 'image/jpeg' ); + $request->set_header( 'Content-Disposition', 'attachment; filename="identifying-camera.jpg"' ); + $request->set_body( file_get_contents( DIR_TESTDATA . '/images/canola.jpg' ) ); + $response = rest_get_server()->dispatch( $request ); + $this->assertSame( 201, $response->get_status() ); + $id = $response->get_data()['id']; + $file = get_attached_file( $id ); + $this->assertMatchesRegularExpression( '/^[a-f0-9]{32}\.jpg$/', basename( $file ) ); + $stem = pathinfo( $file, PATHINFO_FILENAME ); + $metadata = wp_get_attachment_metadata( $id ); + foreach ( $metadata['sizes'] as $size ) { + $this->assertStringStartsWith( $stem . '-', $size['file'] ); + } + $this->assertSame( 'ordinary.jpg', $this->plugin->randomize_upload( array( 'name' => 'ordinary.jpg' ) )['name'] ); + wp_delete_attachment( $id, true ); + } +} diff --git a/tools/package-plugin.mjs b/tools/package-plugin.mjs index 71a338f..a7c1938 100644 --- a/tools/package-plugin.mjs +++ b/tools/package-plugin.mjs @@ -17,8 +17,14 @@ const packages = [ 'personal-evernote-sync', 'personal-todo', 'personal-ai-chat', + 'personal-stuff', +]; +const appPackages = [ + 'personal-notes', + 'personal-todo', + 'personal-ai-chat', + 'personal-stuff', ]; -const appPackages = [ 'personal-notes', 'personal-todo', 'personal-ai-chat' ]; const wpAppVendorCopies = [ { source: 'vendor/akirk/wp-app/src', @@ -39,6 +45,7 @@ const wpAppVendorCopies = [ ]; const packageVendorCopies = { 'personal-notes': wpAppVendorCopies, + 'personal-stuff': wpAppVendorCopies, 'personal-evernote-sync': [ { source: 'vendor/evernote/evernote-cloud-sdk-php/src', diff --git a/tools/sync-package-builds.mjs b/tools/sync-package-builds.mjs index 910da6a..79035dc 100644 --- a/tools/sync-package-builds.mjs +++ b/tools/sync-package-builds.mjs @@ -12,8 +12,14 @@ const packages = [ 'personal-evernote-sync', 'personal-todo', 'personal-ai-chat', + 'personal-stuff', +]; +const appPackages = [ + 'personal-notes', + 'personal-todo', + 'personal-ai-chat', + 'personal-stuff', ]; -const appPackages = [ 'personal-notes', 'personal-todo', 'personal-ai-chat' ]; for ( const slug of packages ) { const source = path.join( root, 'build', slug ); diff --git a/tools/verify-split-packages.mjs b/tools/verify-split-packages.mjs index f1b7f1a..db6ca15 100644 --- a/tools/verify-split-packages.mjs +++ b/tools/verify-split-packages.mjs @@ -12,8 +12,14 @@ const packages = [ 'personal-evernote-sync', 'personal-todo', 'personal-ai-chat', + 'personal-stuff', +]; +const appPackages = [ + 'personal-notes', + 'personal-todo', + 'personal-ai-chat', + 'personal-stuff', ]; -const appPackages = [ 'personal-notes', 'personal-todo', 'personal-ai-chat' ]; const wpEnvConfigs = [ '.wp-env.json', ...packages.map( ( slug ) => `.wp-env.${ slug }.json` ), @@ -120,6 +126,16 @@ function verifyPackage( slug ) { requireFile( path.join( packageDir, 'build', 'index.js' ) ); requireFile( path.join( packageDir, 'build', 'index.asset.php' ) ); requireFile( path.join( packageDir, 'build', 'style-index.css' ) ); + if ( slug === 'personal-stuff' ) { + for ( const file of [ + 'build/editor.js', + 'build/editor.asset.php', + 'TECHNICAL.md', + 'skills/personal-stuff/SKILL.md', + ] ) { + requireFile( path.join( packageDir, file ) ); + } + } if ( slug === 'personal-notes' ) { requireFile( path.join( packageDir, 'src', 'editor.js' ) ); requireFile( path.join( packageDir, 'src', 'editor.css' ) ); @@ -326,6 +342,14 @@ function verifyPackage( slug ) { `${ slug }/build/editor.css` ); } + if ( slug === 'personal-stuff' ) { + requiredEntries.push( + `${ slug }/build/editor.js`, + `${ slug }/build/editor.asset.php`, + `${ slug }/TECHNICAL.md`, + `${ slug }/skills/personal-stuff/SKILL.md` + ); + } for ( const entry of requiredEntries ) { if ( ! entries.includes( entry ) ) { diff --git a/webpack.config.js b/webpack.config.js index fc38854..b893056 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,6 +5,8 @@ module.exports = { entry: { ...defaultConfig.entry(), index: './src/index.js', + 'personal-stuff/index': './packages/personal-stuff/src/index.js', + 'personal-stuff/editor': './packages/personal-stuff/src/editor.js', 'personal-notes/index': './packages/personal-notes/src/index.js', 'personal-notes/editor': './packages/personal-notes/src/editor.js', 'personal-notes/blocks/note/index':