Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nuernbergerA committed Feb 6, 2020
2 parents 1f6c214 + 5d545ac commit b99bb0d
Show file tree
Hide file tree
Showing 75 changed files with 574 additions and 497 deletions.
28 changes: 28 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,34 @@
"contributions": [
"code"
]
},
{
"login": "tormjens",
"name": "Tor Morten Jensen",
"avatar_url": "https://avatars0.githubusercontent.com/u/3974889?v=4",
"profile": "http://tormorten.no",
"contributions": [
"code"
]
},
{
"login": "kdion4891",
"name": "Kevin Dion",
"avatar_url": "https://avatars0.githubusercontent.com/u/54263485?v=4",
"profile": "https://github.com/kdion4891",
"contributions": [
"maintenance"
]
},
{
"login": "nuernbergerA",
"name": "Adrian Nürnberger",
"avatar_url": "https://avatars3.githubusercontent.com/u/13331388?v=4",
"profile": "https://github.com/nuernbergerA",
"contributions": [
"maintenance",
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
![Livewire: If Vue and Blade had a baby, it would be a jellyfish.](github_banner.png)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-43-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-46-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

# Laravel Livewire
Expand Down Expand Up @@ -77,6 +76,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
</tr>
<tr>
<td align="center"><a href="https://driesvints.com"><img src="https://avatars1.githubusercontent.com/u/594614?v=4" width="100px;" alt=""/><br /><sub><b>Dries Vints</b></sub></a><br /><a href="https://github.com/livewire/livewire/commits?author=driesvints" title="Code">💻</a></td>
<td align="center"><a href="http://tormorten.no"><img src="https://avatars0.githubusercontent.com/u/3974889?v=4" width="100px;" alt=""/><br /><sub><b>Tor Morten Jensen</b></sub></a><br /><a href="https://github.com/livewire/livewire/commits?author=tormjens" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/kdion4891"><img src="https://avatars0.githubusercontent.com/u/54263485?v=4" width="100px;" alt=""/><br /><sub><b>Kevin Dion</b></sub></a><br /><a href="#maintenance-kdion4891" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/nuernbergerA"><img src="https://avatars3.githubusercontent.com/u/13331388?v=4" width="100px;" alt=""/><br /><sub><b>Adrian Nürnberger</b></sub></a><br /><a href="#maintenance-nuernbergerA" title="Maintenance">🚧</a> <a href="https://github.com/livewire/livewire/commits?author=nuernbergerA" title="Code">💻</a></td>
</tr>
</table>

Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
{
targets: {
node: 'current',
edge: '18'
},
},
],
Expand Down
21 changes: 9 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "livewire/livewire",
"description": "Build and test rich client-side functionality: with only backend code.",
"description": "A front-end framework for Laravel.",
"license": "MIT",
"authors": [
{
Expand All @@ -10,17 +10,17 @@
],
"require": {
"php": "^7.1.3",
"illuminate/database": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"symfony/http-kernel": "^4.0|^5.0",
"illuminate/support": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"illuminate/validation": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"symfony/http-kernel": "^4.0|^5.0"
"illuminate/database": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"illuminate/validation": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0"
},
"require-dev": {
"laravel/framework": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"psy/psysh": "@stable",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0",
"phpunit/phpunit": "^7.5.15|^8.4|^9.0",
"psy/psysh": "@stable"
"laravel/framework": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0"
},
"autoload": {
"psr-4": {
Expand All @@ -29,8 +29,8 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
"App\\": "vendor/orchestra/testbench-core/laravel/app"
"App\\": "vendor/orchestra/testbench-core/laravel/app",
"Tests\\": "tests/"
}
},
"extra": {
Expand All @@ -43,9 +43,6 @@
}
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
4 changes: 2 additions & 2 deletions dist/livewire.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/livewire.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=57c5b1dac2d78da7a3e8"}
{"/livewire.js":"/livewire.js?id=7ae9b84ffd78d9d8cd99"}
Binary file removed github_banner.png
Binary file not shown.
181 changes: 3 additions & 178 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,185 +2,10 @@
// https://jestjs.io/docs/en/configuration.html

module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,

// Stop running tests after `n` failures
// bail: 0,

// Respect "browser" field in package.json when resolving modules
// browser: false,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/p8/t_s1ktjx6qqczfcrb5jpn30c0000gn/T/jest_dx",

// Automatically clear mock calls and instances between every test
notify: true,
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: null,

// The directory where Jest should output its coverage files
// coverageDirectory: null,

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: null,

// A path to a custom dependency extractor
// dependencyExtractor: null,

// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,

// Force coverage collection from ignored files usin a array of glob patterns
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: null,

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: null,

// A set of global variables that need to be available in all test environments
// globals: {},

// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: [
"node_modules",
"src/js"
],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "ts",
// "tsx",
// "node"
// ],

// A map from regular expressions to module names that allow to stub out resources with a single module
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],

// Activates notifications for test results
notify: true,

// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
// preset: null,

// Run tests from one or more projects
// projects: null,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,

// Automatically reset mock state between every test
// resetMocks: false,

// Reset the module registry before running each individual test
// resetModules: false,

// A path to a custom resolver
// resolver: null,

// Automatically restore mock state between every test
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: null,

// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],

// The test environment that will be used for testing
// testEnvironment: "jest-environment-jsdom",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],

// This option allows the use of a custom results processor
// testResultsProcessor: null,

// This option allows use of a custom test runner
// testRunner: "jasmine2",

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",

// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",

// A map from regular expressions to paths to transformers
// transform: null,

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/"
// ],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: null,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
"js"
]
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions src/js/Store.js → js/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,31 @@ const store = {
)
},

emitUp(el, event, ...params) {
this.componentsListeningForEventThatAreTreeAncestors(el, event).forEach(
component => component.addAction(new EventAction(
event, params
))
)
},

componentsListeningForEventThatAreTreeAncestors(el, event) {
var parentIds = []

var parent = el.rawNode().parentElement.closest('[wire\\:id]')

while (parent) {
parentIds.push(parent.getAttribute('wire:id'))

parent = parent.parentElement.closest('[wire\\:id]')
}

return this.components().filter(component => {
return component.events.includes(event)
&& parentIds.includes(component.id)
})
},

componentsListeningForEvent(event) {
return this.components().filter(component => {
return component.events.includes(event)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function () {

new window.Vue().$mount(div.firstElementChild)

yo.html = div.firstElementChild.outerHTML
component.html = div.firstElementChild.outerHTML
})

store.registerHook('elementInitialized', el => {
Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion src/js/component/index.js → js/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ export default class Component {
if (response.eventQueue && response.eventQueue.length > 0) {
response.eventQueue.forEach(event => {
this.scopedListeners.call(event.event, ...event.params)
store.emit(event.event, ...event.params)

if (event.ancestorsOnly) {
store.emitUp(this.el, event.event, ...event.params)
} else {
store.emit(event.event, ...event.params)
}
})
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/js/node_initializer.js → js/node_initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ export default {
return
}

if (method === '$emitUp') {
store.emitUp(el, ...params)
return
}

if (directive.value) {
component.addAction(new MethodAction(method, params, el))
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b99bb0d

Please sign in to comment.