-
Notifications
You must be signed in to change notification settings - Fork 389
Add petite-vue plugins support #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ws-rush
wants to merge
53
commits into
vuejs:main
Choose a base branch
from
ws-rush:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some times like in dialogs we need access to root component from child nodes, also it is a way to access root element from `v-scope` . the next snippet from another PR to expose `$el` to scope, but this PR can solve the same problem also ```html <textarea v-scope="{width: $root.offsetWidth, height: $root.offsetHeight}" @click="width = $el.offsetWidth; height = $el.offsetHeight;" > {{ width }} × {{ height }} </textarea> ```
what is the advantage of use() over directive() ? example:
|
- Replace deprecated vuejs/vue-next with microsoft/vscode repository - Fix branch names from wildcards to specific release branches
fix: update commits example to use working API endpoint
- Add complete Vitest configuration with Happy DOM environment - Create 119 tests covering all core modules and directives - Achieve 82.84% test coverage across the entire codebase - Add tests for app creation, mounting, and lifecycle - Test all built-in directives (v-bind, v-on, v-model, v-show, v-text, v-html, v-effect) - Include comprehensive reactivity and async testing patterns - Add error handling and edge case coverage - Create integration tests for component-like behavior - Add tests for utilities, scheduler, and DOM walking functionality - Write comprehensive testing guide with best practices - Document common testing patterns and examples
- Add ES module support with type: module - Upgrade Vue dependencies from 3.2.45 to 3.5.21 - Update dev dependencies to latest stable versions
chore: update dependencies and build configuration to modern standards
fix: build command
…odifire as in number input
- Update production CDN URLs from version 1.0.3 to 1.0.5 - Add comprehensive CDN links section with jsDelivr and unpkg options - Provide direct links for both global and ESM builds across CDN providers
- Use parentNode fallback when parentElement is null - Add safety check to prevent runtime errors - Handle template tag scenarios in v-for loops - Prevents crashes when v-if is used inside template elements
Enhances
release: v1.0.0
This commit addresses several issues and introduces improvements across the library, primarily focusing on the `v-bind` directive's reactivity and enhancing the test environment's reliability. **Bug Fixes:** - **`ReferenceError: style is not defined` in `src/directives/bind.ts`:** Resolved an issue where the `style` object was not consistently defined, leading to errors in style binding. **Refactoring & Enhancements:** - **`v-bind` Directive (`src/directives/bind.ts`):** - Removed `happy-dom`-specific conditional workarounds, restoring the code to its original, idiomatic DOM manipulation logic. - **Test Environment (`src/test/setup.ts`):** - Implemented a `happy-dom` patch for `Element.prototype.setAttribute`. This patch forces attribute updates (for `id`, `class`, `style`, `title`, `lang`, `dir`) by performing `removeAttribute` before `setAttribute` in the test environment. This ensures reliable test execution without polluting application code. - **Directive Integration (`src/directives/index.ts`):** - Formalized the inclusion of `ref`, `v-for` (`_for`), and `v-if` (`_if`) directives into `builtInDirectives`. - **`v-for` and `v-if` Directives (`src/directives/for.ts`, `src/directives/if.ts`):** - Corrected `evaluate` calls to consistently pass the `el` argument, ensuring proper evaluation context. - **`v-model` Directive (`src/directives/model.ts`):** - Improved behavior for `<select multiple>` elements by ensuring new array instances are created on update. - Adjusted checkbox array handling for consistency. - **`v-ref` Directive (`src/directives/ref.ts`):** - Added fallback logic to use the expression string as the ref name if the evaluated ref value is `undefined`. - **`evaluate` and `execute` Functions (`src/eval.ts`):** - Refactored `evaluate` for direct `new Function` usage and optimized `execute` with `evalCache`. - **`nextTick` Function (`src/scheduler.ts`):** - Enhanced `nextTick` to support both callback and Promise-based waiting for job completion. - **`createApp` Function (`src/app.ts`):** - Added `rootBlocks` and `scope` getters to the app instance. - Improved error reporting for invalid selectors. - **`walk` Function (`src/walk.ts`):** - Updated to reflect changes in `ref` directive handling and `evaluate` context. **Chore:** - **Dependency Updates:** Updated various development dependencies (`@types/node`, `happy-dom`, `typescript`, `vitest`, `terser`). - **Script Changes:** Renamed `test:run` to `test:once` and added a `typecheck` script in `package.json`. - **Configuration Update:** Updated `moduleResolution` to `bundler` in `tsconfig.json`. This commit significantly improves the stability and maintainability of the library's testing setup while also delivering minor bug fixes and feature enhancements.
The `v-bind` directive was not correctly removing attributes like `id`, `title`, `lang`, and `dir` when their bound values became `null` or `undefined`. Previously, `el.setAttribute(key, value)` would set the attribute's value to the string "null" or "undefined" instead of removing the attribute entirely. This commit modifies the `setProp` function in `src/directives/bind.ts` to explicitly call `el.removeAttribute(key)` when the value for these specific attributes is `null` or `undefined`. Additionally, a logical error in `__tests__/directives.test.ts` was corrected. An `expect(div?.hasAttribute("id")).toBe(false);` assertion was incorrectly placed before the `data.id` was set to `undefined`, causing a premature test failure. This assertion has been removed from its incorrect position.
Test coverage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am so excited, this is my first pull request on github, I dont know typescript, and I wish this pull request accepted
I did this commit to distribute custom directives as packages then use them with
petite-vue
, I also added example use in README file, thats it:Use Plugins
You can write custome directive then distrbute it as a pacage, then add it to create vue, like:
A plugin code similar to vue plugins code: